JAX-WS DOM Tools check-in
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project
new file mode 100755
index 0000000..0b19add
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..e1f9838
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DOM Integration (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.integration;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jdt.core,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.navigator,
+ org.eclipse.wst.validation,
+ org.eclipse.jdt.ui,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.jee.ui,
+ org.eclipse.jem.util,
+ org.eclipse.jst.ws.jaxws.dom.ui,
+ org.eclipse.jst.ws.jaxws.utils
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.jst.ws.jaxws.dom.integration.navigator,
+ org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions,
+ org.eclipse.jst.ws.jaxws.dom.integration.validation
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html
new file mode 100644
index 0000000..8410afb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 15, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties
new file mode 100755
index 0000000..df4e79e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties
new file mode 100755
index 0000000..4f2cc83
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+###############################################################################
+# Language File for this Plugin
+###############################################################################
+
+# Generic Label and Description
+DomValidator_Name = Web Services Validation
+DomValidation_MarkerName = Web Services Problem Marker
+navigatorContent.name.0 = JAX-WS Web Services Elements
+decorator.label.0 = Web Service Decorator
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml
new file mode 100755
index 0000000..4037979
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ SAP AG - initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri = "http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"
+ class = "org.eclipse.jst.ws.jaxws.dom.integration.navigator.CustomDomItemProviderAdapterFactory"
+ supportedTypes =
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource" />
+ </extension>
+
+ <!-- {{{ Defines integration for DOM objects to navigation tree -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ id="org.eclipse.jst.navigator.j2ee.ui.sapWS"
+ contentProvider="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider"
+ labelProvider="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider"
+ activeByDefault="true"
+ name="%navigatorContent.name.0"
+ priority="highest">
+ <triggerPoints>
+ <or>
+ <instanceof value="org.eclipse.core.resources.IProject" />
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ </or>
+ </possibleChildren>
+ <actionProvider
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions.WSActionProvider"
+ id="org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions.WSActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.jst.javaee.ejb.SessionBean"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"/>
+ </or>
+ </enablement>
+ </actionProvider>
+ </navigatorContent>
+ </extension>
+
+ <extension point="org.eclipse.ui.decorators">
+ <decorator
+ adaptable="true"
+ location="BOTTOM_RIGHT"
+ lightweight="false"
+ label="%decorator.label.0"
+ state="true"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceProblemsDecorator"
+ id="org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceDecorator">
+ <enablement>
+ <or>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ </or>
+ </enablement>
+ </decorator>
+ </extension>
+ <!-- }}} -->
+ <!-- {{{ Defines integration for DOM objects to properties view -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.ui.IDOMPropertyValue"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMItemValuePropertySourceFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySource">
+ </adapter>
+ </factory>
+ </extension>
+<!-- }}} -->
+<!-- {{{ Defines integration for WST validation framework -->
+ <extension
+ id="wsValidator"
+ name="%DomValidator_Name"
+ point="org.eclipse.wst.validation.validator">
+ <validator>
+ <filter objectClass="org.eclipse.core.resources.IFile" nameFilter="*.java" />
+ <markerId markerIdValue="WsValidatorMarker" />
+ <helper
+ class="org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationHelper">
+ </helper>
+ <run
+ class="org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationManager">
+ </run>
+ </validator>
+ </extension>
+ <extension
+ id="WsValidatorMarker"
+ name="%DomValidation_MarkerName"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.core.resources.problemmarker"/>
+ <super type="org.eclipse.core.resources.textmarker"/>
+ <persistent value="true" />
+ <attribute name="implementation"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java
new file mode 100755
index 0000000..34421b0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DomIntegrationMessages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages"; //$NON-NLS-1$
+
+ public static String DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_LoadingCanceledLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_LoadingDummyLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_SeiLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_WebServicesLabel;
+
+ /** message constant */
+ public static String OpenWSResourceAction_Name;
+
+ /** message constant */
+ public static String NavigateToImplementationAction_ShowInWebServicesAreaAction;
+
+ /** message constant */
+ public static String NavigateToImplementationAction_ShowInEJBAreaAction;
+
+ /** message constant */
+ public static String SelectFilesToCheckoutDlgTitle;
+
+ /** message constant */
+ public static String SelectFilesToCheckoutDlgTblTitle;
+
+ /** message constant */
+ public static String SelectFilesToCheckout_CanceledMessage;
+
+
+ static
+ {
+ NLS.initializeMessages(BUNDLE_NAME, DomIntegrationMessages.class);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties
new file mode 100755
index 0000000..07f9578
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel = JAX-WS Web Services
+DOMAdapterFactoryLabelProvider_LoadingCanceledLabel = Loading Canceled
+DOMAdapterFactoryLabelProvider_LoadingDummyLabel = Loading...
+DOMAdapterFactoryLabelProvider_SeiLabel = Service Endpoint Interfaces
+DOMAdapterFactoryLabelProvider_WebServicesLabel = Web Services
+
+OpenWSResourceAction_Name = Open
+
+NavigateToImplementationAction_ShowInWebServicesAreaAction = Locate in Web Services Node
+NavigateToImplementationAction_ShowInEJBAreaAction = Locate in Deployment Descriptor Node
+
+
+SelectFilesToCheckoutDlgTitle = Confirm resource checkout
+SelectFilesToCheckoutDlgTblTitle = The following resources need to be checked out during the operation
+SelectFilesToCheckout_CanceledMessage = Operation cannot continue as resources checkout has been canceled
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java
new file mode 100755
index 0000000..6a9ab0e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin;
+
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class DomIntegrationPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxws.dom.integration";
+
+ // The shared instance
+ private static DomIntegrationPlugin plugin;
+
+ private DOMAdapterFactoryLabelProvider labelProvider;
+
+ /**
+ * The constructor
+ */
+ public DomIntegrationPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DomIntegrationPlugin getDefault() {
+ return plugin;
+ }
+
+ public void setLabelProvider(final DOMAdapterFactoryLabelProvider labelProvider)
+ {
+ ContractChecker.nullCheckParam(labelProvider, "labelProvider"); //$NON-NLS-1$
+ this.labelProvider = labelProvider;
+ }
+
+ public DOMAdapterFactoryLabelProvider getLabelProvider()
+ {
+ return labelProvider;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java
new file mode 100755
index 0000000..82f68fd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.util;
+
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Utility class that holds methods to manipulate ProjectExplorer
+ *
+ * @author Georgi Vachkov
+ */
+public class ProjectExplorerUtil
+{
+ public static final ProjectExplorerUtil INSTANCE = new ProjectExplorerUtil();
+
+ /**
+ * This method should be called only from UI thread otherwise <code>null</code> will be returned
+ *
+ * @return the project explorer {@link IViewPart} in case it is available otherwise <code>null</code>
+ */
+ public IViewPart findProjectExplorer()
+ {
+ final IWorkbenchWindow workbenchWin = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (workbenchWin==null || workbenchWin.getActivePage()==null) {
+ return null;
+ }
+
+ return workbenchWin.getActivePage().findView("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java
new file mode 100755
index 0000000..55f2522
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.ui.DomItemProviderAdapterFactory;
+
+/**
+ * Factory that adapts DOM objects with Item provider adapters. For {@link ISEIChildList} and
+ * {@link IWebServiceChildList} it creates specific adapter for other DOM objects delegates to
+ * {@link DomItemProviderAdapterFactory}.
+ *
+ * @author
+ */
+public class CustomDomItemProviderAdapterFactory extends DomItemProviderAdapterFactory
+{
+ /**
+ * The singleton instance
+ */
+ public static final CustomDomItemProviderAdapterFactory INSTANCE = new CustomDomItemProviderAdapterFactory();
+
+ /**
+ * Constructor
+ */
+ private CustomDomItemProviderAdapterFactory()
+ {
+ super();
+
+ supportedTypes.add(IWebServiceChildList.class);
+ supportedTypes.add(ISEIChildList.class);
+ }
+
+ protected Adapter createIWebServiceChildListAdapter(final IWebServiceProject wsProj)
+ {
+ return new IWebServiceChildList()
+ {
+ public EList<IWebService> getWSChildList()
+ {
+ return wsProj.getWebServices();
+ }
+
+ public Notifier getTarget()
+ {
+ return wsProj;
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ // no processing needed currently
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ // no processing needed currently
+ }
+ };
+ }
+
+ protected Adapter createISEIChildListAdapter(final IWebServiceProject wsProj)
+ {
+ return new ISEIChildList()
+ {
+ public EList<IServiceEndpointInterface> getSEIChildList()
+ {
+ return wsProj.getServiceEndpointInterfaces();
+ }
+
+ public Notifier getTarget()
+ {
+ return wsProj;
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ // no processing needed currently
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ // no processing needed currently
+ }
+ };
+ }
+
+ @Override
+ public Adapter adapt(Notifier notifier, Object type)
+ {
+ if (notifier instanceof IWebServiceProject && type instanceof Class)
+ {
+ if(type.equals(IWebServiceChildList.class))
+ {
+ return adaptIWebServiceChildList((IWebServiceProject)notifier);
+ }
+ else if(type.equals(ISEIChildList.class))
+ {
+ return adaptISEIChildList((IWebServiceProject)notifier);
+ }
+ }
+
+ return super.adapt(notifier, type);
+ }
+
+ protected Adapter adaptISEIChildList(final IWebServiceProject wsProject)
+ {
+ for(Adapter adapter : wsProject.eAdapters())
+ {
+ if(adapter instanceof ISEIChildList) {
+ return adapter;
+ }
+ }
+
+ final Adapter adapter = createISEIChildListAdapter(wsProject);
+ associate(adapter, wsProject);
+
+ return adapter;
+ }
+
+ protected Adapter adaptIWebServiceChildList(final IWebServiceProject wsProject)
+ {
+ for(Adapter adapter : wsProject.eAdapters())
+ {
+ if(adapter instanceof IWebServiceChildList) {
+ return adapter;
+ }
+ }
+
+ final Adapter adapter = createIWebServiceChildListAdapter(wsProject);
+ associate(adapter, wsProject);
+
+ return adapter;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java
new file mode 100755
index 0000000..5c0e3dd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.util.ProjectExplorerUtil;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingCanceled;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingDummy;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.IWsDOMRuntimeInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.WsDOMRuntimeRegistry;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.facets.FacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+
+/**
+ * Content provider for DOM related objects
+ *
+ * @author
+ */
+public class DOMAdapterFactoryContentProvider extends AdapterFactoryContentProvider
+{
+ private Map<IWsDOMRuntimeExtension, IWsDomLoadListener> loadListeners = new HashMap<IWsDOMRuntimeExtension, IWsDomLoadListener>();
+
+ /**
+ * Constructor
+ */
+ public DOMAdapterFactoryContentProvider()
+ {
+ this(CustomDomItemProviderAdapterFactory.INSTANCE);
+ }
+
+ /**
+ * Constructor
+ * @param adapterFactory
+ */
+ public DOMAdapterFactoryContentProvider(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Object[] getChildren(final Object context)
+ {
+ if (context instanceof IAdaptable)
+ {
+ return getWsProject((IProject)((IAdaptable) context).getAdapter(IProject.class));
+ }
+ else if(context instanceof ILoadingWsProject)
+ {
+ return new Object[] { ((ILoadingWsProject)context).isLoadCanceled() ? new ILoadingCanceled(){} : new ILoadingDummy(){} };
+ }
+ else if(context instanceof IWebServiceProject)
+ {
+ return new Object[]{ adapterFactory.adapt(context, ISEIChildList.class),
+ adapterFactory.adapt(context, IWebServiceChildList.class) };
+ }
+ else if(context instanceof IWebServiceChildList)
+ {
+ Object[] webServices = ((IWebServiceChildList)context).getWSChildList().toArray();
+
+ for(int ii=0; ii<webServices.length; ii++)
+ {
+ adapterFactory.adapt(webServices[ii], ITreeItemContentProvider.class);
+ }
+
+ return webServices;
+ }
+ else if(context instanceof ISEIChildList)
+ {
+ Object[] sEIs = ((ISEIChildList)context).getSEIChildList().toArray();
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ adapterFactory.adapt(sEIs[ii], ITreeItemContentProvider.class);
+ }
+
+ return sEIs;
+ }
+ else if(context instanceof IWebService)
+ {
+ final IServiceEndpointInterface sei = ((IWebService)context).getServiceEndpoint();
+ if (sei == null) {
+ return new Object[0];
+ }
+
+ adapterFactory.adapt(sei, ITreeItemContentProvider.class);
+ return new Object[]{ sei };
+ }
+ else if(context instanceof IServiceEndpointInterface) {
+ return extractMethods((IServiceEndpointInterface) context);
+ }
+ else if (context instanceof IWebMethod) {
+ return extractParams((IWebMethod)context);
+ }
+
+ return new Object[0];
+ }
+
+ protected Object[] getWsProject(final IProject project)
+ {
+ try {
+ final IWsDOMRuntimeExtension runtime = getSupportingRuntime(project);
+ if (runtime == null) {
+ return new Object[0];
+ }
+
+ // WS project is loaded already
+ final IWebServiceProject wsProject = getWsProject(runtime.getDOM(), project);
+ if (wsProject != null)
+ {
+ adapterFactory.adapt(wsProject, ITreeItemContentProvider.class);
+ return new Object[] { wsProject };
+ }
+
+ addRuntimeLoadListener(runtime);
+ return new Object[] { new LoadingWsProject(project, false) };
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return new Object[] { new LoadingWsProject(project, true) };
+ }
+ }
+
+ protected IWsDomLoadListener addRuntimeLoadListener(final IWsDOMRuntimeExtension runtime)
+ {
+ IWsDomLoadListener loadListener = loadListeners.get(runtime);
+ if (loadListener!=null) {
+ return loadListener;
+ }
+
+ loadListener = new LoadListener(runtime);
+ loadListeners.put(runtime, loadListener);
+ runtime.addLoadListener(loadListener);
+
+ return loadListener;
+ }
+
+ protected Object[] extractMethods(final IServiceEndpointInterface sei)
+ {
+ final List<IWebMethod> webMethods = sei.getWebMethods();
+ for (IWebMethod webMethod : webMethods) {
+ adapterFactory.adapt(webMethod, ITreeItemContentProvider.class);
+ }
+
+ return webMethods.toArray();
+ }
+
+ protected Object[] extractParams(final IWebMethod method)
+ {
+ final List<IWebParam> params = method.getParameters();
+ for (IWebParam webParam : params) {
+ adapterFactory.adapt(webParam, ITreeItemContentProvider.class);
+ }
+
+ return params.toArray();
+ }
+
+ @Override
+ public boolean hasChildren(Object element)
+ {
+ if (element instanceof IWebServiceProject)
+ {
+ return true;
+ }
+ else if(element instanceof ILoadingWsProject)
+ {
+ return true;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return !((IWebServiceChildList)element).getWSChildList().isEmpty();
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return !((ISEIChildList)element).getSEIChildList().isEmpty();
+ }
+ else if (element instanceof IWebService)
+ {
+ return ((IWebService) element).getServiceEndpoint() != null;
+ }
+ else if (element instanceof IServiceEndpointInterface)
+ {
+ return !((IServiceEndpointInterface)element).getWebMethods().isEmpty();
+ }
+ else if (element instanceof IWebMethod)
+ {
+ return !((IWebMethod)element).getParameters().isEmpty();
+ }
+
+ return false;
+ }
+
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project)
+ {
+ if (dom == null) {
+ return null;
+ }
+
+ for (IWebServiceProject wsProject : dom.getWebServiceProjects()) {
+ if(wsProject.getName().equals(project.getName())) {
+ return wsProject;
+ }
+ }
+
+ return null;
+ }
+
+ protected IWsDOMRuntimeExtension getSupportingRuntime(final IProject project)
+ {
+ final Collection<IWsDOMRuntimeInfo> domRuntimeInfos = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+ Map<String, String> facets;
+ for (IWsDOMRuntimeInfo domRuntimeInfo : domRuntimeInfos)
+ {
+ facets = domRuntimeInfo.getProjectFacets();
+ if (hasFacet(facets, project)) {
+ return getDomRuntime(domRuntimeInfo.getId());
+ }
+ }
+
+ return null;
+ }
+
+ protected boolean hasFacet(final Map<String, String> facets, final IProject project)
+ {
+ for (String facetId : facets.keySet())
+ {
+ if (facetId == null || facets.get(facetId) == null) {
+ continue;
+ }
+
+ try {
+ if ((new FacetUtils()).hasFacetWithVersion(project, facets.get(facetId), facetId, true)){
+ return true;
+ }
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+ }
+
+ return false;
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime(String runtimeId) {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(runtimeId);
+ }
+
+ /**
+ * Class that is used to listen when the DOM load will be finished. After the load has finished
+ * this class traverses the project explorers tree in order to find all instances of
+ * {@link ILoadingWsProject} and substitute them with loaded {@link IWebServiceProject}
+ *
+ * @author Georgi Vachkov
+ */
+ protected class LoadListener implements IWsDomLoadListener
+ {
+ private final IWsDOMRuntimeExtension runtime;
+
+ public LoadListener(final IWsDOMRuntimeExtension runtime)
+ {
+ ContractChecker.nullCheckParam(runtime, "runtime"); //$NON-NLS-1$
+ this.runtime = runtime;
+ }
+
+ public void finished()
+ {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ final IViewPart viewPart = ProjectExplorerUtil.INSTANCE.findProjectExplorer();
+ if (viewPart instanceof CommonNavigator)
+ {
+ final CommonViewer commonViewer = ((CommonNavigator)viewPart).getCommonViewer();
+ for (TreeItem item : commonViewer.getTree().getItems()) {
+ exchangeDummy(item, commonViewer);
+ }
+ }
+ }
+ });
+ }
+
+ protected void exchangeDummy(final TreeItem treeItem, final CommonViewer commonViewer)
+ {
+ if (treeItem == null || treeItem.getData() instanceof IWebServiceProject) {
+ return;
+ }
+
+ if (treeItem.getData() instanceof ILoadingWsProject) {
+ exchangeTreeItemData(treeItem, commonViewer);
+ }
+ else {
+ for (TreeItem child : treeItem.getItems()) {
+ exchangeDummy(child, commonViewer);
+ }
+ }
+ }
+
+ private void exchangeTreeItemData(final TreeItem treeItem, final CommonViewer commonViewer)
+ {
+ final ILoadingWsProject loadingProject = (ILoadingWsProject)treeItem.getData();
+ try {
+ final IWebServiceProject wsProject = getWsProject(runtime.getDOM(), loadingProject.getProject());
+ adapterFactory.adapt(wsProject, ITreeItemContentProvider.class);
+ treeItem.setData(wsProject);
+
+ } catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ treeItem.setData(new LoadingWsProject(loadingProject.getProject(), true));
+ }
+
+ commonViewer.refresh(loadingProject.getProject());
+ }
+
+ public void started() {
+ // nothing to do here
+ }
+ }
+
+ private class LoadingWsProject implements ILoadingWsProject
+ {
+ final IProject project;
+ final boolean isCanceled;
+
+ public LoadingWsProject(final IProject project, final boolean isCanceled) {
+ ContractChecker.nullCheckParam(project, "project"); //$NON-NLS-1$
+ this.project = project;
+ this.isCanceled = isCanceled;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public boolean isLoadCanceled() {
+ return isCanceled;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java
new file mode 100755
index 0000000..9484e8f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingCanceled;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingDummy;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.ui.Images;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.navigator.IDescriptionProvider;
+
+/**
+ * DOM adapter factory that extends {@link AdapterFactoryLabelProvider} by providing
+ * icons and labels for some objects that are not part of DOM and also overrides some
+ * labels
+ *
+ * @author
+ */
+public class DOMAdapterFactoryLabelProvider extends AdapterFactoryLabelProvider implements IDescriptionProvider
+{
+ /**
+ * Default Constructor uses {@link CustomDomItemProviderAdapterFactory} as default
+ * adapter factory provided to the base class.
+ */
+ public DOMAdapterFactoryLabelProvider()
+ {
+ super(CustomDomItemProviderAdapterFactory.INSTANCE);
+
+ DomIntegrationPlugin.getDefault().setLabelProvider(this);
+ }
+
+ @Override
+ public Image getImage(Object element)
+ {
+ if(element instanceof IWebServiceChildList)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_WEB_SERVICE_GROUP);
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_SEI_GROUP);
+ }
+ else if(element instanceof ILoadingWsProject)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_DOM_WS_PROVIDER);
+ }
+ else if (element instanceof ILoadingDummy || element instanceof ILoadingCanceled)
+ {
+ return null;
+ }
+
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element)
+ {
+ if(element instanceof IWebServiceProject || element instanceof ILoadingWsProject)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+ }
+ if (element instanceof ILoadingDummy)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_LoadingDummyLabel;
+ }
+ if (element instanceof ILoadingCanceled)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_LoadingCanceledLabel;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_WebServicesLabel;
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_SeiLabel;
+ }
+
+ return super.getText(element);
+ }
+
+ public String getDescription(Object element)
+ {
+ if(element instanceof IWebService)
+ {
+ return ((IWebService)element).getName();
+ }
+ else if(element instanceof IServiceEndpointInterface)
+ {
+ return ((IServiceEndpointInterface)element).getName();
+ }
+ else if(element instanceof IWebServiceProject || element instanceof ILoadingWsProject)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_WebServicesLabel;
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_SeiLabel;
+ }
+ else if(element instanceof IWebMethod)
+ {
+ return ((IWebMethod)element).getName();
+ }
+
+ return super.getText(element);
+ }
+
+ public void fireLabelProviderChanged(Object element)
+ {
+ for (ILabelProviderListener labelProviderListener : labelProviderListeners) {
+ labelProviderListener.labelProviderChanged(new LabelProviderChangedEvent(this, element));
+ }
+ }
+
+ @Override
+ protected Image getDefaultImage(Object object)
+ {
+ // No dfault images
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java
new file mode 100755
index 0000000..fd4f630
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.jst.ws.jaxws.dom.ui.IDOMPropertyValue;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * Adapter factory for that creates adapter from {@link IDOMPropertyValue} to
+ * {@link IPropertySource} interface. This factory is registered in org.eclipse.core.runtime.adapters extension
+ * point and is called when object of type {@link IDOMPropertyValue} needs to be
+ * displayed or edited in property sheet.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("unchecked")
+public class DOMItemValuePropertySourceFactory implements IAdapterFactory
+{
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ assert adaptableObject instanceof IDOMPropertyValue;
+
+ final IDOMPropertyValue wrapper = (IDOMPropertyValue)adaptableObject;
+
+ return new PropertySource(wrapper.getEditableValue(), wrapper);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] {PropertySource.class};
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java
new file mode 100755
index 0000000..7a3343f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+public class DOMPropertyViewAdapterFactory implements IAdapterFactory
+{
+ private DOMAdapterFactoryContentProvider adapterFactory;
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ if (adapterType.isInstance(adaptableObject))
+ {
+ return adaptableObject;
+ }
+
+ if (adapterType == IPropertySourceProvider.class)
+ {
+ return getAdapterFactory();
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList()
+ {
+ return new Class[] {
+ DOMAdapterFactoryContentProvider.class,
+ };
+ }
+
+ protected DOMAdapterFactoryContentProvider getAdapterFactory()
+ {
+ if (adapterFactory == null) {
+ adapterFactory = new DOMAdapterFactoryContentProvider();
+ }
+
+ return adapterFactory;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java
new file mode 100755
index 0000000..262eaa6
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.resources.IProject;
+
+
+/**
+ * An interface presenting not loaded web service project. This interface is used
+ * to be added to the project explorer WS tree in cases when the project is relevant
+ * but it is not yet loaded by DOM loader.
+ *
+ * @author Georgi Vachkov
+ */
+public interface ILoadingWsProject
+{
+ /**
+ * @return the relevant project
+ */
+ public IProject getProject();
+
+ /**
+ * @return if the DOM loading has been canceled
+ */
+ public boolean isLoadCanceled();
+
+ /**
+ * Interface used to be added to the tree as a sub node of INotLoadedWsProject node
+ * and displayed with text "Loading...".
+ *
+ * @author Georgi Vachkov
+ */
+ public interface ILoadingDummy {};
+
+ public interface ILoadingCanceled {};
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java
new file mode 100755
index 0000000..04f6b4b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+
+public interface ISEIChildList extends Adapter
+{
+ public EList<IServiceEndpointInterface> getSEIChildList();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java
new file mode 100755
index 0000000..96381d8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+public interface IWebServiceChildList extends Adapter
+{
+ public EList<IWebService> getWSChildList();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java
new file mode 100755
index 0000000..5a9d2be
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jdt.ui.ProblemsLabelDecorator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+public class WebServiceProblemsDecorator extends ProblemsLabelDecorator
+{
+ /** Enum to represent different marker types */
+ public enum Severity {OK, ERROR, WARNING};
+
+ private DomUtil domUtil = DomUtil.INSTANCE;
+
+ @Override
+ protected int computeAdornmentFlags(Object obj)
+ {
+ final Severity severity = defineSeverity(obj);
+ if (severity == Severity.ERROR) {
+ return JavaElementImageDescriptor.ERROR;
+ }
+
+ if (severity == Severity.WARNING) {
+ return JavaElementImageDescriptor.WARNING;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Checks the object's resource for markers and defines the severity of the
+ * problem if any.
+ * @param obj
+ * @return the severity calculated.
+ */
+ protected Severity defineSeverity(final Object obj)
+ {
+ try
+ {
+ // process additional DOM objects needed for UI - IWebServiceChildList and ISEIChildList
+ if (obj instanceof IWebServiceChildList) {
+ return defineSeverityForEList(((IWebServiceChildList)obj).getWSChildList());
+ }
+
+ if (obj instanceof ISEIChildList) {
+ return defineSeverityForEList(((ISEIChildList)obj).getSEIChildList());
+ }
+
+ // do not process non DOM objects
+ if( !(obj instanceof EObject) ) {
+ return Severity.OK;
+ }
+
+ return defineSeverity((EObject) obj);
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+
+ return Severity.OK;
+ }
+
+ protected Severity defineSeverityForEList(final List<? extends EObject> list) throws CoreException
+ {
+ Severity severity = Severity.OK;
+ for (EObject eObject : list)
+ {
+ Severity tempSeverity = defineSeverity(eObject);
+ if (tempSeverity == Severity.ERROR) {
+ return Severity.ERROR;
+ }
+
+ if (tempSeverity==Severity.WARNING) {
+ severity = Severity.WARNING;
+ }
+ }
+
+ return severity;
+ }
+
+ protected Severity defineSeverity(final EObject eObject) throws CoreException
+ {
+ final IResource resource = Dom2ResourceMapper.INSTANCE.findResource(eObject);
+ if (resource!=null) {
+ return defineSeverity(eObject, resource);
+ }
+
+ return Severity.OK;
+ }
+
+ protected Severity defineSeverity(final EObject eObject, final IResource resource) throws CoreException
+ {
+ if (!resource.isAccessible()) {
+ return Severity.OK;
+ }
+
+ final int depth = (resource.getType()==IResource.PROJECT) ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO;
+ final IMarker[] markers = resource.findMarkers(DomValidationConstants.MARKER_ID, false, depth);
+ Severity severity = Severity.OK;
+ for (IMarker marker : markers)
+ {
+ if (!isRelevantFor(eObject, marker)) {
+ continue;
+ }
+
+ int tempSeverity = (Integer)marker.getAttribute(IMarker.SEVERITY);
+ if (tempSeverity==IMarker.SEVERITY_ERROR) {
+ return Severity.ERROR;
+ }
+
+ if(tempSeverity==IMarker.SEVERITY_WARNING) {
+ severity = Severity.WARNING;
+ }
+ }
+
+ if (severity == Severity.OK && (eObject instanceof IWebService))
+ {
+ // for bean with explicit interface we need to check the interface as well
+ // because it resides in another resource
+ final IServiceEndpointInterface sei = ((IWebService)eObject).getServiceEndpoint();
+ if (sei != null && !sei.isImplicit()) {
+ severity = defineSeverity(sei);
+ }
+ }
+
+ return severity;
+ }
+
+ /**
+ * Defines if <code>marker</code> is relevant for <code>eObject</code>.
+ * Only for web method and web parameter we need to define if the marker is relevant
+ * because they are not unique in the scope of the resource. For example if there is a
+ * marker set on the resource containing SEI, the SEI should be marked in any case
+ * while the method only in case when the error is specifically for this method or
+ * method parameter.
+ * @param eObject the object to be validated
+ * @param marker the resource marker
+ * @return <code>true</code> in case the marker is relevant for <code>eObject</code>
+ * @throws CoreException
+ */
+ protected boolean isRelevantFor(final EObject eObject, final IMarker marker) throws CoreException
+ {
+ switch (eObject.eClass().getClassifierID())
+ {
+ case DomPackage.IWEB_METHOD:
+ return isRelevantForMethod((IWebMethod)eObject, marker);
+ case DomPackage.IWEB_PARAM:
+ return isRelevant(domUtil.calcUniqueImpl(eObject), marker);
+ }
+
+ return true;
+ }
+
+ /**
+ * Defines if <code>marker</code> is relevant for <code>webMethod</code>.
+ * Checks if the marker is specifically for this method or some of it's parameters.
+ * @param webMethod the method to be checked
+ * @param marker the marker to be checked
+ * @return <code>true</code> in case marker is relevant
+ * @throws CoreException
+ */
+ protected boolean isRelevantForMethod(final IWebMethod webMethod, final IMarker marker) throws CoreException
+ {
+ if (isRelevant(domUtil.calcUniqueImpl(webMethod), marker)) {
+ return true;
+ }
+
+ for (IWebParam webParam : webMethod.getParameters())
+ {
+ if (isRelevant(domUtil.calcUniqueImpl(webParam), marker)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if marker's {@link DomValidationConstants#IMPLEMENTATION} attribute has same
+ * value as <code>implementation</code>.
+ * @param implementation the implementation signature
+ * @param marker the marker to be checked
+ * @return <code>true</code> in case marker is for this implementation
+ * @throws CoreException
+ */
+ protected boolean isRelevant(final String implementation, final IMarker marker) throws CoreException
+ {
+ final Object found = marker.getAttribute(DomValidationConstants.IMPLEMENTATION);
+ if (found != null && found.equals(implementation)) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java
new file mode 100755
index 0000000..0bf1369
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java
@@ -0,0 +1,509 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jst.javaee.ejb.MessageDrivenBean;
+import org.eclipse.jst.javaee.ejb.SessionBean;
+import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider;
+import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEjbSession;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.jst.ws.jaxws.utils.resources.ProjectManagementUtils;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+public class NavigateToImplementationAction extends SelectionListenerAction
+ implements IActionDelegate2 {
+ protected Object srcObject;
+
+ private IJavaProject project;
+
+ private StructuredViewer viewer;
+
+ protected NavigateToImplementationAction(StructuredViewer viewer) {
+ this(DomIntegrationMessages.OpenWSResourceAction_Name);
+
+ this.viewer = viewer;
+ }
+
+ protected NavigateToImplementationAction(String text) {
+ super(text);
+ }
+
+ @Override
+ public String getText()
+ {
+ if(srcObject instanceof SessionBean)
+ {
+ return DomIntegrationMessages.NavigateToImplementationAction_ShowInWebServicesAreaAction;
+ }
+ else
+ {
+ return DomIntegrationMessages.NavigateToImplementationAction_ShowInEJBAreaAction;
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean isEnabled = super.isEnabled()
+ && this.viewer instanceof TreeViewer
+ && this.project !=null
+ && ProjectManagementUtils.isEjb3Project(this.project.getProject().getName());
+
+ if(srcObject instanceof IWebService)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof SessionBean)
+ {
+ SessionBean sessionBean = ((SessionBean)srcObject);
+ IWebService webService = getWebService(sessionBean);
+ if (webService == null)
+ {
+ return false;
+ }
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IServiceEndpointInterface
+ && ((IServiceEndpointInterface)srcObject).isImplicit())
+ {
+ return isEnabled;
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ // TODO Auto-generated method stub
+ run();
+
+ }
+
+ /**
+ * The user has invoked this action
+ */
+ public void run() {
+ if (!isEnabled())
+ return;
+
+ ICompilationUnit cu = null;
+
+ if(srcObject instanceof SessionBean)
+ {
+ SessionBean sessionBean = ((SessionBean)srcObject);
+ String ejbClass = sessionBean.getEjbClass();
+ IWebService webService = getWebService(sessionBean);
+ if (webService == null)
+ {
+ return;
+ }
+
+ IServiceEndpointInterface sEI = webService.getServiceEndpoint();
+ boolean isImplicit = sEI.isImplicit();
+ String sEIClass;
+ if (!isImplicit){
+ String impl = sEI.getImplementation();
+ sEIClass = impl;
+ } else {
+ sEIClass = ejbClass;
+ }
+ try {
+ cu = project.findType(sEIClass).getCompilationUnit();
+ IResource resource = cu.getResource();
+ moveToSEINode(resource);
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ }
+ else
+ {
+ try {
+ cu = project.findType(
+ ((IJavaWebServiceElement) srcObject)
+ .getImplementation()).getCompilationUnit();
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ moveToEjbNode(cu.getResource());
+ }
+ }
+
+ /**
+ * Returns IWebService if sessionBean has been exposed as web service.
+ * @param sessionBean a session bean.
+ * @return IWebService if sessionBean has been exposed as web service. If the session bean has not been
+ * exposed as web service - returns null.
+ * @throws NullPointerException if sessionBean is null.
+ */
+ protected IWebService getWebService(final SessionBean sessionBean)
+ {
+ final IWsDOMRuntimeExtension domRuntime = getDomRuntime();
+ if (domRuntime == null) {
+ return null;
+ }
+
+ try {
+ final IDOM dom = domRuntime.getDOM();
+ if (dom == null) {
+ return null;
+ }
+
+ final IWebServiceProject webServiceProject = DomUtil.INSTANCE.findProjectByName(dom, this.project.getProject().getName());
+ return DomUtil.INSTANCE.findWsByImplName(webServiceProject, sessionBean.getEjbClass());
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return null;
+ }
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime() {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(Jee5WsDomRuntimeExtension.ID);
+ }
+
+ private void moveToSEINode(IResource resource)
+ {
+ TreeViewer treeViewer = (TreeViewer)this.viewer;
+ ISelection sel = null;
+
+ Object[] expandedObjects = treeViewer.getExpandedElements();
+
+ Object[] projectElements = ((ITreeContentProvider) treeViewer
+ .getContentProvider()).getChildren(this.project.getProject());
+ IWebServiceProject wsProject = null;
+
+ for (int ii = 0; ii < projectElements.length; ii++) {
+ if (projectElements[ii] instanceof IWebServiceProject) {
+ wsProject = (IWebServiceProject) projectElements[ii];
+ treeViewer.expandToLevel(wsProject, 2);
+ break;
+ }
+ }
+
+ if (wsProject == null)
+ return;
+
+ for(IServiceEndpointInterface sEI : wsProject.getServiceEndpointInterfaces())
+ {
+ try {
+ ICompilationUnit cu = project.findType(
+ ((IJavaWebServiceElement) sEI)
+ .getImplementation()).getCompilationUnit();
+
+ if(cu.getResource().equals(resource))
+ {
+ sel = new StructuredSelection(sEI);
+ TreePath treePath = getTreePathForSEI(treeViewer,
+ wsProject);
+ Object[] elementsToExpand = new Object[treePath
+ .getSegmentCount()];
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (notAlreadyExpanded(treePath.getSegment(jj),
+ expandedObjects)) {
+ elementsToExpand[jj] = treePath.getSegment(jj);
+ }
+ }
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (elementsToExpand[jj] != null) {
+ Object[] tmp = expandedObjects;
+ expandedObjects = new Object[expandedObjects.length + 1];
+
+ for (int kk = 0; kk < tmp.length; kk++) {
+ expandedObjects[kk] = tmp[kk];
+ }
+
+ expandedObjects[expandedObjects.length - 1] = elementsToExpand[jj];
+ }
+ }
+
+ break;
+ }
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ }
+ setExpandedElementsAndSelection(treeViewer, expandedObjects, sel);
+ }
+
+ private void moveToEjbNode(IResource resource) {
+ TreeViewer treeViewer = (TreeViewer)this.viewer;
+ ISelection sel = null;
+
+ Object[] expandedObjects = treeViewer.getExpandedElements();
+
+ Object[] projectElements = ((ITreeContentProvider) treeViewer
+ .getContentProvider()).getChildren(this.project.getProject());
+ GroupEJBProvider ejbProvider = null;
+ GroupEjbSession ejbSession = null;
+
+ for (int ii = 0; ii < projectElements.length; ii++) {
+ if (projectElements[ii] instanceof GroupEJBProvider) {
+ ejbProvider = (GroupEJBProvider) projectElements[ii];
+ treeViewer.expandToLevel(ejbProvider, 1);
+ break;
+ }
+ }
+
+ if (ejbProvider == null)
+ return;
+
+ for (Object ejbProviderChild : ejbProvider.getChildren()) {
+ if (ejbProviderChild instanceof GroupEjbSession) {
+ ejbSession = (GroupEjbSession) ejbProviderChild;
+ treeViewer.expandToLevel(ejbSession, 2);
+ }
+ }
+
+ if (ejbSession == null) {
+ return;
+ }
+
+ Object[] ejbs = treeViewer.getExpandedElements();
+
+ for (int ii = 0; ii < ejbs.length; ii++) {
+ if ((ejbs[ii] instanceof SessionBean)||(ejbs[ii] instanceof MessageDrivenBean)) {
+
+ IJavaProject javaProject = findJavaProject(ejbs[ii]);
+ IType t = null;
+ try {
+ if((ejbs[ii] instanceof SessionBean))
+ t = javaProject.findType(((SessionBean)ejbs[ii]).getEjbClass());
+ else
+ t = javaProject.findType(((MessageDrivenBean)ejbs[ii]).getEjbClass());
+ } catch (JavaModelException e) {
+ return;
+ }
+ IResource r = t.getResource();
+
+ if (r.equals(resource)) {
+ sel = new StructuredSelection(ejbs[ii]);
+ TreePath treePath = getTreePathForObject(treeViewer,
+ ejbs[ii]);
+ expandElements(expandedObjects, treePath);
+
+ break;
+ }
+ }
+ }
+
+ setExpandedElementsAndSelection(treeViewer, expandedObjects, sel);
+ }
+
+ protected IJavaProject findJavaProject(Object ejb)
+ {
+ IProject proj = ProjectUtilities.getProject(ejb);
+ return JavaCore.create(proj);
+ }
+
+ private void setExpandedElementsAndSelection(TreeViewer treeViewer, Object[] expandedObjects, ISelection sel)
+ {
+ treeViewer.setExpandedElements(expandedObjects);
+
+ if (sel != null) {
+ treeViewer.setSelection(sel, true);
+ }
+ }
+
+ private void expandElements(Object[] expandedObjects, TreePath treePath)
+ {
+
+ Object[] elementsToExpand = new Object[treePath.getSegmentCount()];
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++)
+ {
+ if (notAlreadyExpanded(treePath.getSegment(jj), expandedObjects))
+ {
+ elementsToExpand[jj] = treePath.getSegment(jj);
+ }
+ }
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (elementsToExpand[jj] != null) {
+ Object[] tmp = expandedObjects;
+ expandedObjects = new Object[expandedObjects.length + 1];
+
+ for (int kk = 0; kk < tmp.length; kk++) {
+ expandedObjects[kk] = tmp[kk];
+ }
+
+ expandedObjects[expandedObjects.length - 1] = elementsToExpand[jj];
+ }
+ }
+ }
+
+
+ private boolean notAlreadyExpanded(Object obj, Object[] expObjs) {
+ for (int ii = 0; ii < expObjs.length; ii++) {
+ if (expObjs[ii].equals(obj)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private TreePath getTreePathForSEI(TreeViewer treeViewer, IWebServiceProject wsProject)
+ {
+ TreePath[] treePaths = treeViewer.getExpandedTreePaths();
+
+ for (int ii = 0; ii < treePaths.length; ii++) {
+ if (treePaths[ii].getLastSegment() instanceof ISEIChildList
+ && contains(treePaths[ii], wsProject)) {
+ return treePaths[ii];
+ }
+ }
+ return null;
+ }
+
+ private boolean contains(TreePath treePath, IWebServiceProject wsProject)
+ {
+ for(int ii=0; ii<treePath.getSegmentCount(); ii++)
+ {
+ if(treePath.getSegment(ii).equals(wsProject))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ private TreePath getTreePathForObject(TreeViewer treeViewer, Object obj) {
+ TreePath[] treePaths = treeViewer.getExpandedTreePaths();
+
+ for (int ii = 0; ii < treePaths.length; ii++) {
+ if (treePaths[ii].getLastSegment().equals(obj)) {
+ return treePaths[ii];
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO HACK!
+ updateSelection((IStructuredSelection) selection);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IStructuredSelection selection,
+ IJavaProject project) {
+ super.selectionChanged(selection);
+
+ this.project = project;
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should
+ * override this method to react to the change. Returns true if the action
+ * should be enabled for this selection, and false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked.
+ * If the super method returns false, this method must also return false.
+ *
+ * @param sel
+ * the new structured selection
+ */
+ public boolean updateSelection(IStructuredSelection s) {
+ if (!super.updateSelection(s))
+ return false;
+
+ srcObject = s.getFirstElement();
+
+ return true;
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ // Dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ // init
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ runWithEvent(event);
+
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java
new file mode 100755
index 0000000..62f86dd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionListenerAction;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+public class OpenWSResourceAction extends SelectionListenerAction implements IActionDelegate2
+{
+ protected Object srcObject;
+
+ private IJavaProject project;
+
+ private IServiceEndpointInterface sei;
+ private DomUtil util = DomUtil.INSTANCE;
+
+ protected OpenWSResourceAction() {
+ this(DomIntegrationMessages.OpenWSResourceAction_Name);
+ }
+
+ protected OpenWSResourceAction(String text) {
+ super(text);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean isEnabled = super.isEnabled()
+ && this.project!=null;
+
+ if(srcObject instanceof IWebService)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IServiceEndpointInterface)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IWebMethod)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IWebParam)
+ {
+ return isEnabled;
+ }
+
+ return false;
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /**
+ * The user has invoked this action
+ */
+ public void run() {
+ if (!isEnabled())
+ return;
+
+ ICompilationUnit cu;
+ IWebMethod webMethod = null;
+ IWebParam webParam = null;
+
+ if(srcObject instanceof IWebMethod)
+ {
+ webMethod = (IWebMethod)srcObject;
+ srcObject = sei;
+ }
+ if(srcObject instanceof IWebParam)
+ {
+ webParam = (IWebParam)srcObject;
+ webMethod = (IWebMethod)webParam.eContainer();
+ srcObject = sei;
+ }
+
+ try {
+
+ cu = project.findType(((IJavaWebServiceElement) srcObject).getImplementation()).getCompilationUnit();
+
+ IWorkbenchPage page = getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ IEditorDescriptor desc = getWorkbench().getEditorRegistry().getDefaultEditor(cu.getResource().getName());
+
+ cu = getCUToOpen(cu, webMethod);
+ if (cu == null)
+ {
+ logger().logError("Unable to locate containing CU to open"); //$NON-NLS-1$
+ return;
+ }
+
+ IFile file = getWorkspace().getRoot().findFilesForLocation(cu.getResource().getLocation())[0];
+ IEditorPart editor = page.openEditor(new FileEditorInput(file), desc.getId());
+
+ IMarker marker = file.createMarker(IMarker.TEXT);
+ HashMap<String, Integer> map = new HashMap<String, Integer>();
+
+ map.put(IMarker.CHAR_START, getMarkerPosition(cu, webMethod, false));
+ map.put(IMarker.CHAR_END, getMarkerPosition(cu, webMethod, true));
+
+ marker.setAttributes(map);
+
+ IDE.gotoMarker(editor, marker);
+ } catch (PartInitException pie) {
+ logger().logError("Unable to open part editor", pie); //$NON-NLS-1$
+ } catch(CoreException ce) {
+ logger().logError(ce.getMessage(), ce);
+ }
+ }
+
+ private int getMarkerPosition(ICompilationUnit cu, IWebMethod webMethod, boolean endPos) throws JavaModelException
+ {
+ final IType[] types = cu.getTypes();
+ for (int ii = 0; ii < types.length; ii++)
+ {
+ if (webMethod == null)
+ {
+ return getPosition(types[ii], endPos);
+ }
+
+ final IMethod method = util.findMethod(types[ii], webMethod);
+ if (method==null) {
+ continue;
+ }
+
+ return getPosition(method, endPos);
+ }
+
+ return 0;
+ }
+
+ private int getPosition(IMember member, boolean endPos) throws JavaModelException
+ {
+ return member.getNameRange().getOffset() + ((endPos) ? member.getNameRange().getLength() : 0);
+ }
+
+ private ICompilationUnit getCUToOpen(ICompilationUnit cu, IWebMethod webMethod)
+ {
+ if (webMethod == null)
+ {
+ return cu;
+ }
+
+ try
+ {
+ final IType[] types = cu.getTypes();
+ for(int ii=0; ii<types.length; ii++)
+ {
+ IMethod method = util.findMethod(types[ii], webMethod);
+ if (method != null)
+ {
+ return types[ii].getCompilationUnit();
+ }
+ }
+
+ for(int ii=0; ii<types.length; ii++)
+ {
+ IType[] superIntfTypes = types[ii].newSupertypeHierarchy(null).getSuperInterfaces(types[ii]);
+
+ for(int jj=0; jj<superIntfTypes.length; jj++)
+ {
+ ICompilationUnit cuToOpen = getCUToOpen(superIntfTypes[jj].getCompilationUnit(), webMethod);
+
+ if(cuToOpen!=null)
+ {
+ return cuToOpen;
+ }
+ }
+
+ IType superClassType = types[ii].newSupertypeHierarchy(null).getSuperclass(types[ii]);
+
+ ICompilationUnit cuToOpen = getCUToOpen(superClassType.getCompilationUnit(), webMethod);
+
+ if(cuToOpen!=null)
+ {
+ return cuToOpen;
+ }
+ }
+ }
+ catch(JavaModelException jme)
+ {
+ logger().logError(jme.getMessage(), jme);
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ updateSelection((IStructuredSelection) selection);
+ }
+
+ public void selectionChanged(IStructuredSelection selection, IJavaProject project, IServiceEndpointInterface sei) {
+ super.selectionChanged(selection);
+
+ this.project = project;
+ this.sei = sei;
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should
+ * override this method to react to the change. Returns true if the action
+ * should be enabled for this selection, and false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked.
+ * If the super method returns false, this method must also return false.
+ *
+ * @param sel
+ * the new structured selection
+ */
+ public boolean updateSelection(IStructuredSelection s) {
+ if (!super.updateSelection(s))
+ return false;
+
+ srcObject = s.getFirstElement();
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ // Dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ // init
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ runWithEvent(event);
+
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+
+ private IWorkbench getWorkbench() {
+ return PlatformUI.getWorkbench();
+ }
+
+ private IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java
new file mode 100755
index 0000000..bdf8ddf
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonMenuConstants;
+
+
+public class WSActionProvider extends CommonActionProvider
+{
+ private OpenWSResourceAction openAction;
+
+ private NavigateToImplementationAction navigateAction;
+
+ @Override
+ public void fillActionBars(IActionBars actionBars)
+ {
+ if(openAction.isEnabled())
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAction);
+
+ if(navigateAction.isEnabled())
+ actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), navigateAction);
+ }
+
+ @Override
+ public void fillContextMenu(IMenuManager menu)
+ {
+ if (getContext()==null || getContext().getSelection().isEmpty())
+ return;
+
+ IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+ openAction.selectionChanged(selection);
+ navigateAction.selectionChanged(selection);
+ navigateAction.setText(navigateAction.getText());
+
+ if (openAction.isEnabled())
+ menu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openAction);
+
+ if(navigateAction.isEnabled())
+ menu.insertAfter(ICommonMenuConstants.GROUP_OPEN_WITH, navigateAction);
+ }
+
+ @Override
+ public void init(ICommonActionExtensionSite site) {
+ super.init(site);
+
+ openAction = new OpenWSResourceAction();
+ navigateAction = initNavigateAction(site);
+ }
+
+ protected NavigateToImplementationAction initNavigateAction(ICommonActionExtensionSite site)
+ {
+ return new NavigateToImplementationAction(site.getStructuredViewer());
+ }
+
+ @Override
+ public void setContext(ActionContext context) {
+ if (context != null && context.getSelection() instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection = (IStructuredSelection) context.getSelection();
+
+ if(selection instanceof ITreeSelection)
+ {
+ TreePath[] paths = ((ITreeSelection)selection).getPathsFor(selection.getFirstElement());
+ IProject project = null;
+
+ for(int ii=0; ii<paths.length; ii++)
+ {
+ TreePath path = paths[ii];
+ IServiceEndpointInterface sei = null;
+
+ for(int jj=0; jj<path.getSegmentCount(); jj++)
+ {
+ if(path.getSegment(jj) instanceof IServiceEndpointInterface)
+ {
+ sei = (IServiceEndpointInterface)path.getSegment(jj);
+ break;
+ }
+ }
+
+ for(int jj=0; jj<path.getSegmentCount(); jj++)
+ {
+ if(path.getSegment(jj) instanceof IProject)
+ {
+ project = (IProject)path.getSegment(jj);
+ openAction.selectionChanged(selection, getJavaProject(project), sei);
+ navigateAction.selectionChanged(selection, getJavaProject(project));
+ super.setContext(context);
+ return;
+ }
+ }
+ }
+ }
+
+ openAction.selectionChanged(selection);
+ navigateAction.selectionChanged(selection);
+ }
+
+ super.setContext(context);
+ }
+
+ protected IJavaProject getJavaProject(IProject project)
+ {
+ return JavaCore.create(project);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java
new file mode 100755
index 0000000..b5ec3a4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.validation;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+
+/**
+ * {@link IValidationContext} implementor. Acts as helper class for validation. Used
+ * by {@link DomValidationManager} to retrieve DOM model.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("restriction")
+public class DomValidationHelper extends WorkbenchContext
+{
+ /**
+ * Constructor - registers models that this helper will support. Registration is done
+ * by setting model 'symbolicName' and method to be called for this method to be retrieved
+ */
+ public DomValidationHelper()
+ {
+ registerModel("webServiceProject", "getWebServiceProject", new Class[] {String.class}); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Executed by {@link WorkbenchContext} when {@link WorkbenchContext#loadModel(String, Object[])} is called
+ * and finds the corresponding to {@link #getProject()} {@link IWebServiceProject}
+ *
+ * @param domId
+ * @return found {@link IWebServiceProject} or <code>null</code>
+ */
+ public IWebServiceProject getWebServiceProject(final String domId)
+ {
+ ContractChecker.nullCheckParam(domId, "domId"); //$NON-NLS-1$
+
+ final IWsDOMRuntimeExtension domRuntime = getDomRuntime(domId);
+ if (domRuntime == null) {
+ return null;
+ }
+
+ try {
+ final IDOM dom = domRuntime.getDOM();
+ if (dom==null) {
+ return null;
+ }
+
+ return DomUtil.INSTANCE.findProjectByName(dom, getProject().getName());
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return null;
+ }
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime(final String domId) {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(domId);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java
new file mode 100755
index 0000000..622f26c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.validation;
+
+import java.util.Collection;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.CustomDomItemProviderAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidatorFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+
+/**
+ * Registered to WST validation framework IValidator. Receives notifications for
+ * validation to be performed and calls registered DOM validators to perform the
+ * real validation.
+ *
+ * @author Georgi Vachkov
+ */
+public class DomValidationManager implements IValidatorJob
+{
+ public void cleanup(final IReporter reporter) {
+ // no resources for clean up
+ }
+
+ public void validate(final IValidationContext context, final IReporter reporter) {
+ validateInJob(context, reporter);
+ }
+
+ public IStatus validateInJob(final IValidationContext context, final IReporter reporter)
+ {
+ cleanMarkers((IProjectValidationContext) context);
+
+ IWebServiceProject wsProject;
+ for (IDomValidator validator : getValidators())
+ {
+ wsProject = (IWebServiceProject)context.loadModel("webServiceProject", new String []{validator.getSupportedDomRuntime()}); //$NON-NLS-1$
+ if (wsProject == null) {
+ continue;
+ }
+
+ validator.validate(wsProject);
+ refreshTree(wsProject);
+ }
+
+ return IValidatorJob.OK_STATUS;
+ }
+
+ public ISchedulingRule getSchedulingRule(final IValidationContext helper) {
+ return null;
+ }
+
+ protected void refreshTree(final IWebServiceProject wsProject)
+ {
+ final DOMAdapterFactoryLabelProvider labelProvider = labelProvider();
+ if (labelProvider == null) {
+ return;
+ }
+
+ Display.getDefault().asyncExec(new RefreshRunnable(labelProvider, wsProject));
+ }
+
+ protected DOMAdapterFactoryLabelProvider labelProvider()
+ {
+ return DomIntegrationPlugin.getDefault().getLabelProvider();
+ }
+
+ protected void cleanMarkers(IProjectValidationContext context)
+ {
+ try {
+ final IProject project = context.getProject();
+ if (project != null && project.isAccessible()) {
+ project.deleteMarkers(DomValidationConstants.MARKER_ID, true, IResource.DEPTH_INFINITE);
+ }
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+ }
+
+ protected Collection<IDomValidator> getValidators()
+ {
+ return DomValidatorFactory.INSTANCE.getRegisteredValidators();
+ }
+
+ /**
+ * Class that fires label changed event to the label provider to apply validation
+ * results in the displayed tree - i.e. decorate images
+ *
+ * @author Georgi Vachkov
+ */
+ protected class RefreshRunnable implements Runnable
+ {
+ private final DOMAdapterFactoryLabelProvider labelProvider;
+ private final IWebServiceProject wsProject;
+
+ public RefreshRunnable(final DOMAdapterFactoryLabelProvider labelProvider, final IWebServiceProject wsProject) {
+ this.labelProvider = labelProvider;
+ this.wsProject = wsProject;
+ }
+
+ public void run()
+ {
+ labelProvider.fireLabelProviderChanged(wsProject);
+
+ fireLabelProviderChanged(ISEIChildList.class);
+ fireLabelProviderChanged(IWebServiceChildList.class);
+
+ final TreeIterator<EObject> allChilds = wsProject.eAllContents();
+ while (allChilds.hasNext()) {
+ labelProvider.fireLabelProviderChanged(allChilds.next());
+ }
+ }
+
+ private void fireLabelProviderChanged(final Class<?> adapterClass)
+ {
+ final Adapter adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, adapterClass);
+ if (adapter == null) {
+ return;
+ }
+
+ labelProvider.fireLabelProviderChanged(adapter);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.classpath b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.project b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.project
new file mode 100755
index 0000000..7938766
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.runtime</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..9c1a950
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,42 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.runtime;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.ws.jaxws.utils,
+ org.eclipse.ui,
+ org.eclipse.emf.validation,
+ org.eclipse.jface.text,
+ org.eclipse.jst.j2ee,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.common.project.facet.core
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.jst.ws.jaxws.dom.runtime,
+ org.eclipse.jst.ws.jaxws.dom.runtime.api,
+ org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;x-friends:="org.eclipse.jst.ws.jaxws.dom.runtime.tests",
+ org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin;x-friends:="org.eclipse.jst.ws.jaxws.dom.runtime.tests",
+ org.eclipse.jst.ws.jaxws.dom.runtime.internal.util;x-friends:="org.eclipse.jst.ws.jaxws.dom.runtime.tests",
+ org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider;x-friends:="org.eclipse.jst.ws.jaxws.dom.runtime.tests",
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.impl,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state,
+ org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync,
+ org.eclipse.jst.ws.jaxws.dom.runtime.provider,
+ org.eclipse.jst.ws.jaxws.dom.runtime.registry,
+ org.eclipse.jst.ws.jaxws.dom.runtime.util,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam,
+ org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice
+Import-Package: javax.jws
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/about.html b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/about.html
new file mode 100644
index 0000000..8410afb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 15, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/build.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/build.properties
new file mode 100755
index 0000000..3aae249
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.properties
new file mode 100755
index 0000000..e5db512
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+###############################################################################
+# Language File for this Plugin
+###############################################################################
+
+# Generic Label and Description
+pluginName = WS Common Runtime
+DomValidatorsExtension_Name = DOM Validator
+Bundle-Name.0 = JAX-WS DOM runtime plug-in (Incubation)
+DomRuntimesExtension_Name = DOM Runtimes
+providerName = www.example.org
+ExtensionPoint-Name.3 = JEE5 DOM contribution
+ExtensionPoint-Name.5 = JEE5 DOM validation contribution
+category.name.0 = JEE5 DOM constraint provider
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.xml b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.xml
new file mode 100755
index 0000000..dbfa195
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/plugin.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ SAP AG - initial API and implementation
+ -->
+
+<plugin>
+
+ <extension-point id="domruntimes" name="%DomRuntimesExtension_Name" schema="schema/runtimes.exsd"/>
+ <extension-point id="domValidator" name="%DomValidatorsExtension_Name" schema="schema/domValidator.exsd"/>
+
+ <extension point="org.eclipse.ui.startup">
+ <startup class="org.eclipse.jst.ws.jaxws.dom.runtime.WsDomStartupParticipant"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri = "http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"
+ class = "org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage" />
+ </extension>
+
+
+ <extension
+ id="org.eclipse.jst.ws.jaxws.dom.jee5"
+ name="%ExtensionPoint-Name.3"
+ point="org.eclipse.jst.ws.jaxws.dom.runtime.domruntimes">
+ <implementation class="org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension"/>
+ <project_facet id="jst.ejb" version="3.0"/>
+ <project_facet id="jst.web" version="2.5"/>
+ </extension>
+ <extension
+ id="dom"
+ name="%ExtensionPoint-Name.5"
+ point="org.eclipse.jst.ws.jaxws.dom.runtime.domValidator">
+ <implementation class="org.eclipse.jst.ws.jaxws.dom.runtime.validation.JaxWsDomValidator"/>
+ </extension>
+
+ <!-- {{{ EMF validation contribution -->
+
+ <extension
+ point="org.eclipse.emf.validation.constraintProviders">
+ <category
+ name="%category.name.0"
+ id="org.eclipse.jst.ws.jaxws.dom.jee5"/>
+ <constraintProvider
+ cache="true"
+ class="org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsDynamicModelConstraintProvider">
+ <package namespaceUri="http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"/>
+ </constraintProvider>
+ </extension>
+ <extension
+ point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.jst.ws.jaxws.dom.jee5.domContext">
+ <enablement>
+ <or>
+ <instanceof
+ value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam">
+ </instanceof>
+ </or>
+ </enablement>
+ </clientContext>
+ <binding
+ context="org.eclipse.jst.ws.jaxws.dom.jee5.domContext"
+ category="org.eclipse.jst.ws.jaxws.dom.jee5"/>
+ </extension>
+ <extension point="org.eclipse.emf.validation.validationListeners">
+ <listener class="org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsProblemsReporter">
+ <clientContext id="org.eclipse.jst.ws.jaxws.dom.jee5.domContext"/>
+ </listener>
+ </extension>
+ <!-- }}} EMF validation contribution -->
+
+</plugin>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/domValidator.exsd b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/domValidator.exsd
new file mode 100755
index 0000000..c354381
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/domValidator.exsd
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.ws.jaxws.dom.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.ws.jaxws.dom.runtime" id="consumertype" name="Consumer Type Provider"/>
+ </appInfo>
+ <documentation>
+ Extension point for registering DOM validator factory that will instantiate.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="implementation"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="implementation">
+ <annotation>
+ <documentation>
+ Describes a consumertype
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/runtimes.exsd b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/runtimes.exsd
new file mode 100755
index 0000000..493eb25
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/schema/runtimes.exsd
@@ -0,0 +1,122 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.ws.jaxws.dom.runtime" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.ws.jaxws.dom.runtime" id="supportedruntimes" name="Supported Runtimes"/>
+ </appInfo>
+ <documentation>
+ Use this extension point to add support for a runtime in the WS DOM Tree.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="implementation"/>
+ <element ref="project_facet" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="implementation">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="project_facet">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/DomUtil.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/DomUtil.java
new file mode 100755
index 0000000..67d18cb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/DomUtil.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomSwitch;
+
+
+public class DomUtil
+{
+ public static final DomUtil INSTANCE = new DomUtil();
+
+ private final DomSwitch<String> implSwitch;
+
+ public DomUtil() {
+ implSwitch = createImplFinderSwitch();
+ }
+
+ public void setFeatureValue(final EObject object, final int featureId, final Object value)
+ {
+ final EStructuralFeature feature = object.eClass().getEStructuralFeature(featureId);
+ object.eSet(feature, value);
+ }
+
+ public Object getFeatureValue(final EObject object, final int featureId)
+ {
+ final EStructuralFeature feature = object.eClass().getEStructuralFeature(featureId);
+ return object.eGet(feature);
+ }
+
+ public void addToCollectionFeature(final EObject object, final int featureId, final Object value)
+ {
+ @SuppressWarnings("unchecked")
+ final Collection<Object> oldValue = (Collection<Object>) getFeatureValue(object, featureId);
+ oldValue.add(value);
+ }
+
+ public IWebServiceProject findProjectByName(IDOM dom, String name)
+ {
+ for (IWebServiceProject wsProject : dom.getWebServiceProjects())
+ {
+ if (wsProject.getName().equals(name))
+ {
+ return wsProject;
+ }
+ }
+ return null;
+ }
+
+ public IWebService findWsByImplName(IWebServiceProject wsProject, String name)
+ {
+ for (IWebService ws : wsProject.getWebServices())
+ {
+ if (ws.getImplementation().equals(name))
+ {
+ return ws;
+ }
+ }
+ return null;
+ }
+
+ public IServiceEndpointInterface findSeiByImplName(IWebServiceProject wsProject, String name)
+ {
+ for (IServiceEndpointInterface sei : wsProject.getServiceEndpointInterfaces())
+ {
+ if (sei.getImplementation().equals(name))
+ {
+ return sei;
+ }
+ }
+ return null;
+ }
+
+
+ public IWebMethod findWebMethodByImpl(IServiceEndpointInterface sei, String impl)
+ {
+ for (IWebMethod wm : sei.getWebMethods())
+ {
+ if (wm.getImplementation().equals(impl))
+ {
+ return wm;
+ }
+ }
+ return null;
+ }
+
+ public IMethod findMethod(final IType seiType, final IWebMethod webMethod) throws JavaModelException
+ {
+ for (IMethod method : seiType.getMethods())
+ {
+ if (webMethod.getImplementation().equals(calcImplementation(method))) {
+ return method;
+ }
+ }
+
+ return null;
+ }
+
+ public IJavaWebServiceElement findJavaWebServiceElemByImplName(IWebServiceProject wsProject, String name)
+ {
+ final IWebService ws = findWsByImplName(wsProject, name);
+ return ws == null ? findSeiByImplName(wsProject, name) : ws;
+ }
+
+ /**
+ * Calculates the method signature to be used as implementation in {@link IWebMethod}
+ * @param method
+ * @return calculated string
+ * @throws JavaModelException
+ */
+ public String calcImplementation(final IMethod method) throws JavaModelException
+ {
+ return method.getElementName() + method.getSignature();
+ }
+
+ /**
+ * Extract {@link IWebServiceProject} out of DOM object by recursively
+ * iterating parent objects.
+ * @param eObject
+ * @return the found project or <code>null</code> in case not found
+ */
+ public IWebServiceProject findWsProject(EObject eObject)
+ {
+ EObject parent = eObject;
+ while (parent!=null)
+ {
+ if (parent instanceof IWebServiceProject) {
+ return (IWebServiceProject)parent;
+ }
+
+ parent = parent.eContainer();
+ }
+
+ return null;
+ }
+
+ /**
+ * Defines if this SEI is part of outside-in web service
+ * @param sei
+ * @return true if there is a web service with wsdlLocation set to something different than <code>null</code>
+ */
+ public boolean isOutsideInWebService(final IServiceEndpointInterface sei)
+ {
+ if (sei == null) {
+ return false;
+ }
+
+ for (IWebService webService : sei.getImplementingWebServices()) {
+ if (webService.getWsdlLocation()!=null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Calculates unique implementation for DOM object in the scope of the resource in which
+ * they exist. Useful when you need to uniquely identify DOM object.
+ *
+ * @param eObject
+ * @return calculated implementation
+ */
+ public String calcUniqueImpl(final EObject eObject)
+ {
+ if (eObject.eClass().getClassifierID() == DomPackage.IWEB_PARAM)
+ {
+ final IWebParam wp = (IWebParam) eObject;
+ return ((IWebMethod)wp.eContainer()).getImplementation() + "[" + wp.getImplementation() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return extractImplementation(eObject);
+ }
+
+ /**
+ * Extracts the implementation property for DOM object without casting :-D.
+ *
+ * @param eObject
+ * @return the implementation
+ */
+ public String extractImplementation(final EObject eObject) {
+ return implSwitch.doSwitch(eObject);
+ }
+
+ private DomSwitch<String> createImplFinderSwitch()
+ {
+ return new DomSwitch<String>()
+ {
+ @Override
+ public String caseIWebService(IWebService ws) {
+ return ws.getImplementation();
+ }
+
+ @Override
+ public String caseIServiceEndpointInterface(IServiceEndpointInterface sei) {
+ return sei.getImplementation();
+ }
+
+ @Override
+ public String caseIWebMethod(IWebMethod wm) {
+ return wm.getImplementation();
+ }
+
+ @Override
+ public String caseIWebParam(IWebParam wp) {
+ return wp.getImplementation();
+ }
+
+ @Override
+ public String caseIWebServiceProject(IWebServiceProject wsProject) {
+ return wsProject.getName();
+ }
+ };
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/GeneralTypesNames.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/GeneralTypesNames.java
new file mode 100755
index 0000000..0c4bdbc
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/GeneralTypesNames.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+/**
+ * Class containing constatns with names of some general types used often in validation.
+ *
+ * @author Georgi Vachkov
+ *
+ */
+
+public interface GeneralTypesNames
+{
+ /** java.lang.Object */
+ public static final String JAVA_LANG_OBJECT = "java.lang.Object"; //$NON-NLS-1$
+
+ /** java.io.Serializable */
+ public static final String JAVA_IO_SERIALIZABLE = "java.io.Serializable"; //$NON-NLS-1$
+
+ /** java.rmi.Remote */
+ public static final String JAVA_RMI_REMOTE = "java.rmi.Remote"; //$NON-NLS-1$
+
+ /** java.lang.Throwable */
+ public static final String JAVA_LANG_THROWABLE = "java.lang.Throwable"; //$NON-NLS-1$
+
+ /** java.lang.Exception */
+ public static final String JAVA_LANG_EXCEPTION = "java.lang.Exception"; //$NON-NLS-1$
+
+ /** java.lang.Cloneable */
+ public static final String JAVA_LANG_CLONEABLE = "java.lang.Cloneable"; //$NON-NLS-1$
+
+ /** java.lang.Comparable */
+ public static final String JAVA_LANG_COMPARABLE = "java.lang.Comparable"; //$NON-NLS-1$
+
+ /** java.util.Map */
+ public static final String JAVA_UTIL_MAP = "java.util.Map"; //$NON-NLS-1$
+
+ /** java.util.Collection */
+ public static final String JAVA_UTIL_COLLECTION = "java.util.Collection"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/INamedExtensionInfo.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/INamedExtensionInfo.java
new file mode 100755
index 0000000..ce509af
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/INamedExtensionInfo.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+/**
+ * Interface representig and extention.
+ */
+public interface INamedExtensionInfo
+{
+
+ /**
+ * The unique ID to identify this consumer type when calling the <code>ProxyGeneratorFactory</code>, e.g. <code>jee/jaxws</code>
+ *
+ * @return non-empty string containing the ID
+ */
+ public abstract String getId();
+
+ /**
+ * A verbose name for the type of consumer, e.g. <code>JAX-WS</code>
+ *
+ * @return localized string used for the UI
+ */
+ public abstract String getName();
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyDefaults.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyDefaults.java
new file mode 100755
index 0000000..6cbcd10
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyDefaults.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Interface that provides default values for DOM object's properties.
+ * Usually this interface should be used by clients that need to revert some
+ * property value to the default one.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IPropertyDefaults
+{
+ /**
+ * Defines the default value for this <code>feature</code>.
+ *
+ * @param feature the feature representing the objects property type
+ * @return the default value. In case <code>null</code> is possible property value
+ * <code>null</code> might be returned
+ */
+ public Object getDefault(EStructuralFeature feature);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyState.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyState.java
new file mode 100755
index 0000000..e8c4e9b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/IPropertyState.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Interface for checking the state of some property for concrete DOM object.
+ * This interface should be used by DOM clients that need to know if some property
+ * can be changed - for example UI editor that needs to know if the property should
+ * be enabled for edit or disabled.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IPropertyState
+{
+ /**
+ * Defines if property is changeable.
+ * @return <code>true</code> in case property can be changed
+ */
+ public boolean isChangeable(EStructuralFeature feature);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/PrimitiveTypeHandler.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/PrimitiveTypeHandler.java
new file mode 100755
index 0000000..15127b2
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/PrimitiveTypeHandler.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Utility class used for some general primitive type checks/operations.
+ *
+ * @author Georgi Vachkov
+ *
+ */
+
+public class PrimitiveTypeHandler
+{
+ private static final String ARRAY_MARK = "[]"; //$NON-NLS-1$
+
+ private static final String VOID = "void"; //$NON-NLS-1$
+
+ private static Map<String, String> primitiveTypes = new HashMap<String, String>();
+
+ static
+ {
+ primitiveTypes.put("boolean", "java.lang.Boolean"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Boolean", "java.lang.Boolean"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("byte", "java.lang.Byte"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Byte", "java.lang.Byte"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("char", "java.lang.Character"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Character", "java.lang.Character"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("double", "java.lang.Double"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Double", "java.lang.Double"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("float", "java.lang.Float"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Float", "java.lang.Float"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("int", "java.lang.Integer"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Integer", "java.lang.Integer"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.String", "java.lang.String"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("long", "java.lang.Long"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Long", "java.lang.Long"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("short", "java.lang.Short"); //$NON-NLS-1$ //$NON-NLS-2$
+ primitiveTypes.put("java.lang.Short", "java.lang.Short"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns the object type for primitive type. Mapping between types:
+ *
+ * <pre>
+ * "boolean, "java.lang.Boolean"
+ * "java.lang.Boolean", "java.lang.Boolean"
+ * "byte", "java.lang.Byte"
+ * "java.lang.Byte", "java.lang.Byte"
+ * "char", "java.lang.Character"
+ * "java.lang.Character", "java.lang.Character"
+ * "double", "java.lang.Double"
+ * "java.lang.Double", "java.lang.Double"
+ * "float", "java.lang.Float"
+ * "java.lang.Float", "java.lang.Float"
+ * "int", "java.lang.Integer"
+ * "java.lang.Integer", "java.lang.Integer"
+ * "java.lang.String", "java.lang.String"
+ * "long", "java.lang.Long"
+ * "java.lang.Long", "java.lang.Long"
+ * "short", "java.lang.Short"
+ * "java.lang.Short", "java.lang.Short"
+ * </pre>
+ *
+ * @param typeName
+ * @return wrapper class name for <tt>typeName</tt>.
+ */
+ public static String getObjectTypeForPrimitiveType(String typeName)
+ {
+ return primitiveTypes.get(typeName);
+ }
+
+ /**
+ * @param typeName
+ * @return true if <tt>typeName</tt> is java primitive type.
+ */
+ public static boolean isJavaPrimitiveType(String typeName)
+ {
+ return (primitiveTypes.get(typeName) != null);
+ }
+
+ /**
+ * Checks if the <tt>typeName</tt> represents an array type.
+ *
+ * @param typeName
+ * @return true if <tt>typeName</tt> is array type
+ */
+ public static boolean isArrayType(String typeName)
+ {
+ return typeName.trim().endsWith(ARRAY_MARK);
+ }
+
+ /**
+ * Checks if <tt>typeName</tt> is void.
+ *
+ * @param typeName
+ * @return true if <tt>typeName</tt> is void.
+ */
+ public static boolean isVoidType(String typeName)
+ {
+ return typeName.trim().equals(VOID);
+ }
+
+ /**
+ * Retrieves the real type name from array type. Example:
+ *
+ * <pre>
+ * For type 'int[]' returns 'int'
+ * For type 'String[][]' returns 'String'
+ * </pre>
+ *
+ * @param typeName
+ * @return real type name
+ */
+ public static String getTypeFromArrayType(String typeName)
+ {
+ String name = typeName.trim().replaceAll(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ while (name.endsWith(ARRAY_MARK))
+ {
+ name = name.substring(0, name.length() - ARRAY_MARK.length());
+ }
+
+ return name;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/TypeResolver.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/TypeResolver.java
new file mode 100755
index 0000000..82418e6
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/TypeResolver.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+
+/**
+ * Utility class containing logic for resolving type names from IType object.
+ *
+ * @author Georgi Vachkov
+ */
+public class TypeResolver
+{
+ private static final String DOT = "."; //$NON-NLS-1$
+
+ private static final String QUOTE = "?"; //$NON-NLS-1$
+
+ /**
+ * Resolves <tt>typeName</tt> using <tt>type</tt>. In case when <tt>typeName</tt> contains generics declaration all types used in
+ * declaraion are returned.
+ *
+ * @param typeName
+ * @param type
+ * @return list of resolved types
+ * @throws JavaModelException
+ */
+ public static List<String> resolveTypes(String typeName, IType type) throws JavaModelException
+ {
+ List<String> names = new ArrayList<String>(1);
+ String realTypeName = Signature.toString(typeName);
+
+ if (hasGenerics(realTypeName))
+ {
+ names = getTypesFromGenerics(realTypeName, type);
+ } else
+ {
+ names.add(realTypeName);
+ }
+
+ List<String> resolvedNames = new ArrayList<String>(names.size());
+ for (String name : names)
+ {
+ String resolvedName = resolveType(name, type);
+
+ if (!resolvedName.equals(QUOTE))
+ {
+ resolvedNames.add(resolvedName);
+ }
+ }
+
+ return resolvedNames;
+ }
+
+ /**
+ * Retrieves real type in case type is present by generics.
+ *
+ * @param typeName
+ * @param declaringType
+ * @return the real type of the expression if <tt>typeName</tt> is an expression otherwise <tt>typeName</tt>
+ * @throws JavaModelException
+ */
+ private static String getType(String typeName, IType declaringType) throws JavaModelException
+ {
+ if (typeName.indexOf('?') > -1)
+ {
+ int pos = typeName.trim().lastIndexOf(' ');
+ if (pos > -1)
+ {
+ return TypeResolver.resolveType(typeName.substring(pos + 1), declaringType);
+ }
+ }
+
+ return typeName;
+ }
+
+ /**
+ * Gets the types used in generics declaration.
+ * @param typeName
+ * @param type the type containing resolved type
+ * @return list of type names.
+ * @throws JavaModelException
+ */
+ public static final List<String> getTypesFromGenerics(String typeName, IType type) throws JavaModelException
+ {
+ String name = typeName;
+ List<String> names= new ArrayList<String>();
+
+ int ltPos = -1;
+ int gtPos = -1;
+ while ((ltPos = name.indexOf('<')) > -1)
+ {
+ if ((gtPos = name.lastIndexOf('>')) == -1)
+ {
+ gtPos = name.length()-2;
+ }
+
+ String firstName = name.substring(0, ltPos) + name.substring(gtPos+1);
+ name = name.substring(ltPos+1, gtPos);
+
+ addName(firstName, names, type);
+ if (name.indexOf('<') == -1)
+ {
+ addName(name, names, type);
+ }
+ }
+
+ return names;
+ }
+
+ private static final void addName(final String name, final List<String> names, final IType type) throws JavaModelException
+ {
+ int comaPos = name.indexOf(',');
+ if( comaPos > -1)
+ {
+ names.add(name.substring(0, comaPos));
+ names.add(name.substring(comaPos+1));
+ }
+ else {
+ names.add(getType(name, type));
+ }
+ }
+
+ /**
+ * Resolves type.
+ *
+ * @param typeName
+ * @param type
+ * @return the resolved type name.
+ * @throws JavaModelException
+ */
+ public static String resolveType(final String typeName, final IType type) throws JavaModelException
+ {
+ String realTypeName = typeName;
+ if (PrimitiveTypeHandler.isArrayType(typeName))
+ {
+ return resolveType(PrimitiveTypeHandler.getTypeFromArrayType(typeName), type);
+ }
+
+ if (PrimitiveTypeHandler.isJavaPrimitiveType(realTypeName) || PrimitiveTypeHandler.isVoidType(realTypeName))
+ {
+ return realTypeName;
+ }
+
+ if (realTypeName.indexOf(DOT) > -1)
+ {
+ return realTypeName;
+ }
+
+ String[][] st = type.resolveType(realTypeName);
+ if (st != null)
+ {
+ if (st[0][0].length() == 0)
+ {
+ return st[0][1];
+ }
+
+ return st[0][0] + DOT + st[0][1];
+ }
+
+ if (realTypeName.startsWith(new String(new char[] { Signature.C_UNRESOLVED })))
+ {
+ return resolveType(realTypeName.substring(1, realTypeName.length()), type);
+ }
+
+ return realTypeName;
+ }
+
+ /**
+ * Checks whether <code>typeName</code> uses generics declaration. Example: for 'java.util.List<Strng>' the method will return true.
+ *
+ * @param typeName
+ * @return true is <tt>typeName</tt> contains generics declaration.
+ */
+ private static boolean hasGenerics(String typeName)
+ {
+ return (typeName.indexOf('<') > -1);
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/WsDomStartupParticipant.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/WsDomStartupParticipant.java
new file mode 100755
index 0000000..2a21001
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/WsDomStartupParticipant.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.ui.IStartup;
+
+/**
+ * Startup participant registered on IDE startup extension point
+ *
+ * @author Georgi Vachkov
+ */
+public class WsDomStartupParticipant implements IStartup
+{
+
+ /**
+ * Called by the Eclipse on workbench startup.
+ * Starts load for registered web service runtimes
+ */
+ public void earlyStartup()
+ {
+ Job job = new Job(JaxWsDomRuntimeMessages.WsDomStartupParticipant_Startup_Job_Message)
+ {
+ @Override
+ protected IStatus run(final IProgressMonitor monitor)
+ {
+ WsDOMRuntimeManager.instance().createDOMRuntimes(monitor);
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setUser(false);
+ job.setPriority(Job.LONG);
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ job.schedule();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomFactory.java
new file mode 100755
index 0000000..5a87613
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomFactory.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.ecore.EFactory;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage
+ * @generated
+ */
+public interface DomFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ DomFactory eINSTANCE = org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>IDOM</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IDOM</em>'.
+ * @generated
+ */
+ IDOM createIDOM();
+
+ /**
+ * Returns a new object of class '<em>IJava Web Service Element</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IJava Web Service Element</em>'.
+ * @generated
+ */
+ IJavaWebServiceElement createIJavaWebServiceElement();
+
+ /**
+ * Returns a new object of class '<em>IService Endpoint Interface</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IService Endpoint Interface</em>'.
+ * @generated
+ */
+ IServiceEndpointInterface createIServiceEndpointInterface();
+
+ /**
+ * Returns a new object of class '<em>IWeb Method</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IWeb Method</em>'.
+ * @generated
+ */
+ IWebMethod createIWebMethod();
+
+ /**
+ * Returns a new object of class '<em>IWeb Param</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IWeb Param</em>'.
+ * @generated
+ */
+ IWebParam createIWebParam();
+
+ /**
+ * Returns a new object of class '<em>IWeb Service</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IWeb Service</em>'.
+ * @generated
+ */
+ IWebService createIWebService();
+
+ /**
+ * Returns a new object of class '<em>IWeb Service Project</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IWeb Service Project</em>'.
+ * @generated
+ */
+ IWebServiceProject createIWebServiceProject();
+
+ /**
+ * Returns a new object of class '<em>IWeb Type</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>IWeb Type</em>'.
+ * @generated
+ */
+ IWebType createIWebType();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ DomPackage getDomPackage();
+
+} //DomFactory
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomPackage.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomPackage.java
new file mode 100755
index 0000000..d6aab07
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/DomPackage.java
@@ -0,0 +1,1372 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface DomPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "dom"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "org.eclipse.jst.ws.jaxws.dom.runtime"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ DomPackage eINSTANCE = org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IDOMImpl <em>IDOM</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IDOMImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIDOM()
+ * @generated
+ */
+ int IDOM = 0;
+
+ /**
+ * The feature id for the '<em><b>Web Service Projects</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IDOM__WEB_SERVICE_PROJECTS = 0;
+
+ /**
+ * The number of structural features of the '<em>IDOM</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IDOM_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl <em>IJava Web Service Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIJavaWebServiceElement()
+ * @generated
+ */
+ int IJAVA_WEB_SERVICE_ELEMENT = 1;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IJAVA_WEB_SERVICE_ELEMENT__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>IJava Web Service Element</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl <em>IService Endpoint Interface</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIServiceEndpointInterface()
+ * @generated
+ */
+ int ISERVICE_ENDPOINT_INTERFACE = 2;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTATION = IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__NAME = IJAVA_WEB_SERVICE_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>Implicit</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__IMPLICIT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Implementing Web Services</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Web Methods</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Target Namespace</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Style</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Use</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Parameter Style</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 6;
+
+ /**
+ * The number of structural features of the '<em>IService Endpoint Interface</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ISERVICE_ENDPOINT_INTERFACE_FEATURE_COUNT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl <em>IWeb Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebMethod()
+ * @generated
+ */
+ int IWEB_METHOD = 3;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__IMPLEMENTATION = IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__NAME = IJAVA_WEB_SERVICE_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>Parameters</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__PARAMETERS = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Excluded</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__EXCLUDED = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Style</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__SOAP_BINDING_STYLE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Use</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__SOAP_BINDING_USE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Soap Binding Parameter Style</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>IWeb Method</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_METHOD_FEATURE_COUNT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl <em>IWeb Param</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebParam()
+ * @generated
+ */
+ int IWEB_PARAM = 4;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__IMPLEMENTATION = IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__NAME = IJAVA_WEB_SERVICE_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__KIND = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Type Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__TYPE_NAME = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Part Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__PART_NAME = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Target Namespace</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__TARGET_NAMESPACE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Header</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM__HEADER = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>IWeb Param</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_PARAM_FEATURE_COUNT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl <em>IWeb Service</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebService()
+ * @generated
+ */
+ int IWEB_SERVICE = 5;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__IMPLEMENTATION = IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__NAME = IJAVA_WEB_SERVICE_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>Service Endpoint</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__SERVICE_ENDPOINT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Target Namespace</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__TARGET_NAMESPACE = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Port Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__PORT_NAME = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Wsdl Location</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE__WSDL_LOCATION = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The number of structural features of the '<em>IWeb Service</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE_FEATURE_COUNT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl <em>IWeb Service Project</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebServiceProject()
+ * @generated
+ */
+ int IWEB_SERVICE_PROJECT = 6;
+
+ /**
+ * The feature id for the '<em><b>Web Services</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE_PROJECT__WEB_SERVICES = 0;
+
+ /**
+ * The feature id for the '<em><b>Service Endpoint Interfaces</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE_PROJECT__NAME = 2;
+
+ /**
+ * The number of structural features of the '<em>IWeb Service Project</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_SERVICE_PROJECT_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebTypeImpl <em>IWeb Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebTypeImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebType()
+ * @generated
+ */
+ int IWEB_TYPE = 7;
+
+ /**
+ * The feature id for the '<em><b>Implementation</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_TYPE__IMPLEMENTATION = IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_TYPE__NAME = IJAVA_WEB_SERVICE_ELEMENT__NAME;
+
+ /**
+ * The number of structural features of the '<em>IWeb Type</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int IWEB_TYPE_FEATURE_COUNT = IJAVA_WEB_SERVICE_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind <em>Web Param Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getWebParamKind()
+ * @generated
+ */
+ int WEB_PARAM_KIND = 8;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle <em>SOAP Binding Style</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingStyle()
+ * @generated
+ */
+ int SOAP_BINDING_STYLE = 9;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse <em>SOAP Binding Use</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingUse()
+ * @generated
+ */
+ int SOAP_BINDING_USE = 10;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle <em>SOAP Binding Parameter Style</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingParameterStyle()
+ * @generated
+ */
+ int SOAP_BINDING_PARAMETER_STYLE = 11;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM <em>IDOM</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IDOM</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM
+ * @generated
+ */
+ EClass getIDOM();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM#getWebServiceProjects <em>Web Service Projects</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Web Service Projects</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM#getWebServiceProjects()
+ * @see #getIDOM()
+ * @generated
+ */
+ EReference getIDOM_WebServiceProjects();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement <em>IJava Web Service Element</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IJava Web Service Element</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement
+ * @generated
+ */
+ EClass getIJavaWebServiceElement();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement#getImplementation <em>Implementation</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Implementation</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement#getImplementation()
+ * @see #getIJavaWebServiceElement()
+ * @generated
+ */
+ EAttribute getIJavaWebServiceElement_Implementation();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement#getName()
+ * @see #getIJavaWebServiceElement()
+ * @generated
+ */
+ EAttribute getIJavaWebServiceElement_Name();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface <em>IService Endpoint Interface</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IService Endpoint Interface</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface
+ * @generated
+ */
+ EClass getIServiceEndpointInterface();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#isImplicit <em>Implicit</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Implicit</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#isImplicit()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EAttribute getIServiceEndpointInterface_Implicit();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getImplementingWebServices <em>Implementing Web Services</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Implementing Web Services</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getImplementingWebServices()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EReference getIServiceEndpointInterface_ImplementingWebServices();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getWebMethods <em>Web Methods</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Web Methods</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getWebMethods()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EReference getIServiceEndpointInterface_WebMethods();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getTargetNamespace <em>Target Namespace</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target Namespace</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getTargetNamespace()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EAttribute getIServiceEndpointInterface_TargetNamespace();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingStyle <em>Soap Binding Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingStyle()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EAttribute getIServiceEndpointInterface_SoapBindingStyle();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingUse <em>Soap Binding Use</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Use</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingUse()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EAttribute getIServiceEndpointInterface_SoapBindingUse();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Parameter Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingParameterStyle()
+ * @see #getIServiceEndpointInterface()
+ * @generated
+ */
+ EAttribute getIServiceEndpointInterface_SoapBindingParameterStyle();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod <em>IWeb Method</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IWeb Method</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod
+ * @generated
+ */
+ EClass getIWebMethod();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getParameters <em>Parameters</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Parameters</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getParameters()
+ * @see #getIWebMethod()
+ * @generated
+ */
+ EReference getIWebMethod_Parameters();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#isExcluded <em>Excluded</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Excluded</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#isExcluded()
+ * @see #getIWebMethod()
+ * @generated
+ */
+ EAttribute getIWebMethod_Excluded();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingStyle <em>Soap Binding Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingStyle()
+ * @see #getIWebMethod()
+ * @generated
+ */
+ EAttribute getIWebMethod_SoapBindingStyle();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingUse <em>Soap Binding Use</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Use</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingUse()
+ * @see #getIWebMethod()
+ * @generated
+ */
+ EAttribute getIWebMethod_SoapBindingUse();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Soap Binding Parameter Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingParameterStyle()
+ * @see #getIWebMethod()
+ * @generated
+ */
+ EAttribute getIWebMethod_SoapBindingParameterStyle();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam <em>IWeb Param</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IWeb Param</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam
+ * @generated
+ */
+ EClass getIWebParam();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getKind <em>Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Kind</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getKind()
+ * @see #getIWebParam()
+ * @generated
+ */
+ EAttribute getIWebParam_Kind();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getTypeName <em>Type Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Type Name</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getTypeName()
+ * @see #getIWebParam()
+ * @generated
+ */
+ EAttribute getIWebParam_TypeName();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getPartName <em>Part Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Part Name</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getPartName()
+ * @see #getIWebParam()
+ * @generated
+ */
+ EAttribute getIWebParam_PartName();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getTargetNamespace <em>Target Namespace</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target Namespace</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getTargetNamespace()
+ * @see #getIWebParam()
+ * @generated
+ */
+ EAttribute getIWebParam_TargetNamespace();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#isHeader <em>Header</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Header</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#isHeader()
+ * @see #getIWebParam()
+ * @generated
+ */
+ EAttribute getIWebParam_Header();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService <em>IWeb Service</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IWeb Service</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService
+ * @generated
+ */
+ EClass getIWebService();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getServiceEndpoint <em>Service Endpoint</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Service Endpoint</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getServiceEndpoint()
+ * @see #getIWebService()
+ * @generated
+ */
+ EReference getIWebService_ServiceEndpoint();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getTargetNamespace <em>Target Namespace</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target Namespace</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getTargetNamespace()
+ * @see #getIWebService()
+ * @generated
+ */
+ EAttribute getIWebService_TargetNamespace();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getPortName <em>Port Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Port Name</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getPortName()
+ * @see #getIWebService()
+ * @generated
+ */
+ EAttribute getIWebService_PortName();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getWsdlLocation <em>Wsdl Location</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Wsdl Location</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getWsdlLocation()
+ * @see #getIWebService()
+ * @generated
+ */
+ EAttribute getIWebService_WsdlLocation();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject <em>IWeb Service Project</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IWeb Service Project</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject
+ * @generated
+ */
+ EClass getIWebServiceProject();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getWebServices <em>Web Services</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Web Services</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getWebServices()
+ * @see #getIWebServiceProject()
+ * @generated
+ */
+ EReference getIWebServiceProject_WebServices();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getServiceEndpointInterfaces <em>Service Endpoint Interfaces</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Service Endpoint Interfaces</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getServiceEndpointInterfaces()
+ * @see #getIWebServiceProject()
+ * @generated
+ */
+ EReference getIWebServiceProject_ServiceEndpointInterfaces();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject#getName()
+ * @see #getIWebServiceProject()
+ * @generated
+ */
+ EAttribute getIWebServiceProject_Name();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType <em>IWeb Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>IWeb Type</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType
+ * @generated
+ */
+ EClass getIWebType();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind <em>Web Param Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Web Param Kind</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind
+ * @generated
+ */
+ EEnum getWebParamKind();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle <em>SOAP Binding Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>SOAP Binding Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @generated
+ */
+ EEnum getSOAPBindingStyle();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse <em>SOAP Binding Use</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>SOAP Binding Use</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @generated
+ */
+ EEnum getSOAPBindingUse();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle <em>SOAP Binding Parameter Style</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>SOAP Binding Parameter Style</em>'.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @generated
+ */
+ EEnum getSOAPBindingParameterStyle();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ DomFactory getDomFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IDOMImpl <em>IDOM</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IDOMImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIDOM()
+ * @generated
+ */
+ EClass IDOM = eINSTANCE.getIDOM();
+
+ /**
+ * The meta object literal for the '<em><b>Web Service Projects</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference IDOM__WEB_SERVICE_PROJECTS = eINSTANCE.getIDOM_WebServiceProjects();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl <em>IJava Web Service Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIJavaWebServiceElement()
+ * @generated
+ */
+ EClass IJAVA_WEB_SERVICE_ELEMENT = eINSTANCE.getIJavaWebServiceElement();
+
+ /**
+ * The meta object literal for the '<em><b>Implementation</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION = eINSTANCE.getIJavaWebServiceElement_Implementation();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IJAVA_WEB_SERVICE_ELEMENT__NAME = eINSTANCE.getIJavaWebServiceElement_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl <em>IService Endpoint Interface</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIServiceEndpointInterface()
+ * @generated
+ */
+ EClass ISERVICE_ENDPOINT_INTERFACE = eINSTANCE.getIServiceEndpointInterface();
+
+ /**
+ * The meta object literal for the '<em><b>Implicit</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ISERVICE_ENDPOINT_INTERFACE__IMPLICIT = eINSTANCE.getIServiceEndpointInterface_Implicit();
+
+ /**
+ * The meta object literal for the '<em><b>Implementing Web Services</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES = eINSTANCE.getIServiceEndpointInterface_ImplementingWebServices();
+
+ /**
+ * The meta object literal for the '<em><b>Web Methods</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS = eINSTANCE.getIServiceEndpointInterface_WebMethods();
+
+ /**
+ * The meta object literal for the '<em><b>Target Namespace</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE = eINSTANCE.getIServiceEndpointInterface_TargetNamespace();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Style</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE = eINSTANCE.getIServiceEndpointInterface_SoapBindingStyle();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Use</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE = eINSTANCE.getIServiceEndpointInterface_SoapBindingUse();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Parameter Style</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE = eINSTANCE.getIServiceEndpointInterface_SoapBindingParameterStyle();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl <em>IWeb Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebMethod()
+ * @generated
+ */
+ EClass IWEB_METHOD = eINSTANCE.getIWebMethod();
+
+ /**
+ * The meta object literal for the '<em><b>Parameters</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference IWEB_METHOD__PARAMETERS = eINSTANCE.getIWebMethod_Parameters();
+
+ /**
+ * The meta object literal for the '<em><b>Excluded</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_METHOD__EXCLUDED = eINSTANCE.getIWebMethod_Excluded();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Style</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_METHOD__SOAP_BINDING_STYLE = eINSTANCE.getIWebMethod_SoapBindingStyle();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Use</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_METHOD__SOAP_BINDING_USE = eINSTANCE.getIWebMethod_SoapBindingUse();
+
+ /**
+ * The meta object literal for the '<em><b>Soap Binding Parameter Style</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE = eINSTANCE.getIWebMethod_SoapBindingParameterStyle();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl <em>IWeb Param</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebParam()
+ * @generated
+ */
+ EClass IWEB_PARAM = eINSTANCE.getIWebParam();
+
+ /**
+ * The meta object literal for the '<em><b>Kind</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_PARAM__KIND = eINSTANCE.getIWebParam_Kind();
+
+ /**
+ * The meta object literal for the '<em><b>Type Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_PARAM__TYPE_NAME = eINSTANCE.getIWebParam_TypeName();
+
+ /**
+ * The meta object literal for the '<em><b>Part Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_PARAM__PART_NAME = eINSTANCE.getIWebParam_PartName();
+
+ /**
+ * The meta object literal for the '<em><b>Target Namespace</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_PARAM__TARGET_NAMESPACE = eINSTANCE.getIWebParam_TargetNamespace();
+
+ /**
+ * The meta object literal for the '<em><b>Header</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_PARAM__HEADER = eINSTANCE.getIWebParam_Header();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl <em>IWeb Service</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebService()
+ * @generated
+ */
+ EClass IWEB_SERVICE = eINSTANCE.getIWebService();
+
+ /**
+ * The meta object literal for the '<em><b>Service Endpoint</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference IWEB_SERVICE__SERVICE_ENDPOINT = eINSTANCE.getIWebService_ServiceEndpoint();
+
+ /**
+ * The meta object literal for the '<em><b>Target Namespace</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_SERVICE__TARGET_NAMESPACE = eINSTANCE.getIWebService_TargetNamespace();
+
+ /**
+ * The meta object literal for the '<em><b>Port Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_SERVICE__PORT_NAME = eINSTANCE.getIWebService_PortName();
+
+ /**
+ * The meta object literal for the '<em><b>Wsdl Location</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_SERVICE__WSDL_LOCATION = eINSTANCE.getIWebService_WsdlLocation();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl <em>IWeb Service Project</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebServiceProject()
+ * @generated
+ */
+ EClass IWEB_SERVICE_PROJECT = eINSTANCE.getIWebServiceProject();
+
+ /**
+ * The meta object literal for the '<em><b>Web Services</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference IWEB_SERVICE_PROJECT__WEB_SERVICES = eINSTANCE.getIWebServiceProject_WebServices();
+
+ /**
+ * The meta object literal for the '<em><b>Service Endpoint Interfaces</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES = eINSTANCE.getIWebServiceProject_ServiceEndpointInterfaces();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute IWEB_SERVICE_PROJECT__NAME = eINSTANCE.getIWebServiceProject_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebTypeImpl <em>IWeb Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebTypeImpl
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getIWebType()
+ * @generated
+ */
+ EClass IWEB_TYPE = eINSTANCE.getIWebType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind <em>Web Param Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getWebParamKind()
+ * @generated
+ */
+ EEnum WEB_PARAM_KIND = eINSTANCE.getWebParamKind();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle <em>SOAP Binding Style</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingStyle()
+ * @generated
+ */
+ EEnum SOAP_BINDING_STYLE = eINSTANCE.getSOAPBindingStyle();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse <em>SOAP Binding Use</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingUse()
+ * @generated
+ */
+ EEnum SOAP_BINDING_USE = eINSTANCE.getSOAPBindingUse();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle <em>SOAP Binding Parameter Style</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.DomPackageImpl#getSOAPBindingParameterStyle()
+ * @generated
+ */
+ EEnum SOAP_BINDING_PARAMETER_STYLE = eINSTANCE.getSOAPBindingParameterStyle();
+
+ }
+
+} //DomPackage
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IDOM.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IDOM.java
new file mode 100755
index 0000000..e94a88b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IDOM.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>IDOM</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM#getWebServiceProjects <em>Web Service Projects</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIDOM()
+ * @model
+ * @generated
+ */
+public interface IDOM extends EObject {
+ /**
+ * Returns the value of the '<em><b>Web Service Projects</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Web Service Projects</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Web Service Projects</em>' containment reference list.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIDOM_WebServiceProjects()
+ * @model containment="true" suppressedSetVisibility="true"
+ * @generated
+ */
+ EList<IWebServiceProject> getWebServiceProjects();
+
+} // IDOM
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IJavaWebServiceElement.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IJavaWebServiceElement.java
new file mode 100755
index 0000000..21200fa
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IJavaWebServiceElement.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @model
+ * * @author Hristo Sabev
+ *
+ */
+public interface IJavaWebServiceElement extends EObject
+{
+ /**
+ * @model changeable="true" suppressedSetVisibility="true" required="true"
+ * @return
+ */
+ public String getImplementation();
+
+ /**
+ * @model changeable="true" required="true"
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IServiceEndpointInterface.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IServiceEndpointInterface.java
new file mode 100755
index 0000000..3589d11
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IServiceEndpointInterface.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.common.util.EList;
+
+
+/**
+ * @model
+ * @author Hristo Sabev
+ *
+ */
+public interface IServiceEndpointInterface extends IJavaWebServiceElement
+{
+ /**
+ * @model changeable="true" suppressedSetVisibility="true" required="true"
+ * @return
+ */
+ public boolean isImplicit();
+
+ /**
+ * @model changeable="true" suppressedSetVisibility="true" required="true" containment="false" many="true" type="IWebService" opposite="serviceEndpoint"
+ * @return
+ */
+ public EList<IWebService> getImplementingWebServices();
+
+ /**
+ * @model changeable="true" suppressedSetVisibility="true" required="true" containment="true" many="true" type="IWebMethod"
+ * @return
+ */
+ public EList<IWebMethod> getWebMethods();
+
+ /**
+ * @model changeable="true" required="true"
+ */
+ public String getTargetNamespace();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getTargetNamespace <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Namespace</em>' attribute.
+ * @see #getTargetNamespace()
+ * @generated
+ */
+ void setTargetNamespace(String value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Style</b></em>' attribute.
+ * The default value is <code>"DOCUMENT"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Style</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see #setSoapBindingStyle(SOAPBindingStyle)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIServiceEndpointInterface_SoapBindingStyle()
+ * @model default="DOCUMENT" required="true"
+ * @generated
+ */
+ SOAPBindingStyle getSoapBindingStyle();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingStyle <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see #getSoapBindingStyle()
+ * @generated
+ */
+ void setSoapBindingStyle(SOAPBindingStyle value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Use</b></em>' attribute.
+ * The default value is <code>"LITERAL"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Use</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Use</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see #setSoapBindingUse(SOAPBindingUse)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIServiceEndpointInterface_SoapBindingUse()
+ * @model default="LITERAL" required="true"
+ * @generated
+ */
+ SOAPBindingUse getSoapBindingUse();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingUse <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Use</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see #getSoapBindingUse()
+ * @generated
+ */
+ void setSoapBindingUse(SOAPBindingUse value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Parameter Style</b></em>' attribute.
+ * The default value is <code>"WRAPPED"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Parameter Style</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Parameter Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see #setSoapBindingParameterStyle(SOAPBindingParameterStyle)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIServiceEndpointInterface_SoapBindingParameterStyle()
+ * @model default="WRAPPED" required="true"
+ * @generated
+ */
+ SOAPBindingParameterStyle getSoapBindingParameterStyle();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Parameter Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ */
+ void setSoapBindingParameterStyle(SOAPBindingParameterStyle value);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWSDOMRuntimeManager.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWSDOMRuntimeManager.java
new file mode 100755
index 0000000..ca39cb9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWSDOMRuntimeManager.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+
+public interface IWSDOMRuntimeManager
+{
+ /**
+ * Instantiates the DOM Runtimes if not already.
+ * @param progress monitor to track progress
+ */
+ public void createDOMRuntimes(IProgressMonitor monitor);
+
+ /**
+ * This method should return the DOM runtime instance corresponding to the runtime id
+ * and instantiate such DOM runtime instance if non existent at the
+ * moment of invocation of this method.
+ *
+ * @param runtimeId - string identifier of the runtime
+ * @return the DOM runtime instance. Null if runtime with such id is not registered
+ */
+ public IWsDOMRuntimeExtension getDOMRuntime(String runtimeId);
+
+ /**
+ *
+ * @return a list of all DOM Runtimes currently instantiated
+ */
+ public Collection<IWsDOMRuntimeExtension> getDOMRuntimes();
+
+ /**
+ * This method should reload all instances of DOM Runtimes.
+ *
+ */
+ public void reloadDOMRuntimes(IProgressMonitor monitor);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebMethod.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebMethod.java
new file mode 100755
index 0000000..070d385
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebMethod.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.common.util.EList;
+
+
+/**
+ * @model
+ * @author Hristo Sabev
+ */
+public interface IWebMethod extends IJavaWebServiceElement
+{
+ /**
+ * @model type="IWebParam" suppressedSetVisibility="true" many="true" containment="true" required="true"
+ * @return
+ */
+ EList<IWebParam> getParameters();
+
+ /**
+ * @model type="boolean" many="false" changeable="true" required="true"
+ */
+ boolean isExcluded();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#isExcluded <em>Excluded</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Excluded</em>' attribute.
+ * @see #isExcluded()
+ * @generated
+ */
+ void setExcluded(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Style</b></em>' attribute.
+ * The default value is <code>"DOCUMENT"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Style</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see #setSoapBindingStyle(SOAPBindingStyle)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebMethod_SoapBindingStyle()
+ * @model default="DOCUMENT" required="true"
+ * @generated
+ */
+ SOAPBindingStyle getSoapBindingStyle();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingStyle <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle
+ * @see #getSoapBindingStyle()
+ * @generated
+ */
+ void setSoapBindingStyle(SOAPBindingStyle value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Use</b></em>' attribute.
+ * The default value is <code>"LITERAL"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Use</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Use</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see #setSoapBindingUse(SOAPBindingUse)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebMethod_SoapBindingUse()
+ * @model default="LITERAL" required="true"
+ * @generated
+ */
+ SOAPBindingUse getSoapBindingUse();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingUse <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Use</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse
+ * @see #getSoapBindingUse()
+ * @generated
+ */
+ void setSoapBindingUse(SOAPBindingUse value);
+
+ /**
+ * Returns the value of the '<em><b>Soap Binding Parameter Style</b></em>' attribute.
+ * The default value is <code>"WRAPPED"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Soap Binding Parameter Style</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Soap Binding Parameter Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see #setSoapBindingParameterStyle(SOAPBindingParameterStyle)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebMethod_SoapBindingParameterStyle()
+ * @model default="WRAPPED" required="true"
+ * @generated
+ */
+ SOAPBindingParameterStyle getSoapBindingParameterStyle();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Soap Binding Parameter Style</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ */
+ void setSoapBindingParameterStyle(SOAPBindingParameterStyle value);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebParam.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebParam.java
new file mode 100755
index 0000000..f7696e5
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebParam.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+
+/**
+ *
+ * @author Hristo Sabev
+ *
+ * @model
+ */
+public interface IWebParam extends IJavaWebServiceElement
+{
+ /**
+ * @model required="true" many="false" suppressedSetVisibility="true"
+ * @return
+ */
+ String getTypeName();
+
+ /**
+ * Returns the value of the '<em><b>Part Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Part Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Part Name</em>' attribute.
+ * @see #setPartName(String)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebParam_PartName()
+ * @model required="true"
+ * @generated
+ */
+ String getPartName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getPartName <em>Part Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Part Name</em>' attribute.
+ * @see #getPartName()
+ * @generated
+ */
+ void setPartName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Target Namespace</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Namespace</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Namespace</em>' attribute.
+ * @see #setTargetNamespace(String)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebParam_TargetNamespace()
+ * @model required="true"
+ * @generated
+ */
+ String getTargetNamespace();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getTargetNamespace <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Namespace</em>' attribute.
+ * @see #getTargetNamespace()
+ * @generated
+ */
+ void setTargetNamespace(String value);
+
+ /**
+ * Returns the value of the '<em><b>Header</b></em>' attribute.
+ * The default value is <code>"false"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Header</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Header</em>' attribute.
+ * @see #setHeader(boolean)
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getIWebParam_Header()
+ * @model default="false" required="true"
+ * @generated
+ */
+ boolean isHeader();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#isHeader <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Header</em>' attribute.
+ * @see #isHeader()
+ * @generated
+ */
+ void setHeader(boolean value);
+
+ /**
+ * @model type="WebParamKind" required="true" many="false"
+ */
+ WebParamKind getKind();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam#getKind <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Kind</em>' attribute.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind
+ * @see #getKind()
+ * @generated
+ */
+ void setKind(WebParamKind value);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebService.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebService.java
new file mode 100755
index 0000000..6011fe3
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebService.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+
+/**
+ * @model
+ * @author Hristo Sabev
+ *
+ */
+public interface IWebService extends IJavaWebServiceElement
+{
+ /**
+ * @model suppressedSetVisibility="true" opposite="implementingWebServices" type="IServiceEndpointInterface"
+ * @return
+ */
+ public IServiceEndpointInterface getServiceEndpoint();
+
+ /**
+ * @model changeable="true" required="true"
+ */
+ public String getTargetNamespace();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getTargetNamespace <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Namespace</em>' attribute.
+ * @see #getTargetNamespace()
+ * @generated
+ */
+ void setTargetNamespace(String value);
+
+ /**
+ * @model changeable="true" required="true"
+ */
+ public String getPortName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getPortName <em>Port Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Port Name</em>' attribute.
+ * @see #getPortName()
+ * @generated
+ */
+ void setPortName(String value);
+
+ /**
+ * @model changeable="true" suppressedSetVisibility="true"
+ */
+ public String getWsdlLocation();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService#getWsdlLocation <em>Wsdl Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Wsdl Location</em>' attribute.
+ * @see #getWsdlLocation()
+ * @generated
+ */
+ void setWsdlLocation(String value);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebServiceProject.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebServiceProject.java
new file mode 100755
index 0000000..b41d5ee
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebServiceProject.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * @model
+ * @author Hristo Sabev
+ */
+public interface IWebServiceProject extends EObject
+{
+ /**
+ * @model type="IWebService" suppressedSetVisibility="true" many="true" containment="true"
+ * @return
+ */
+ public EList<IWebService> getWebServices();
+
+
+ /**
+ * @model type="IServiceEndpointInterface" suppressedSetVisibility="true" many="true" containment="true"
+ */
+ public EList<IServiceEndpointInterface> getServiceEndpointInterfaces();
+
+ /**
+ * @model suppressedSetVisibility="true" required="true"
+ */
+ public String getName();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebType.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebType.java
new file mode 100755
index 0000000..734da97
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWebType.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+
+/**
+ * @model
+ * @author Hristo Sabev
+ */
+public interface IWebType extends IJavaWebServiceElement {
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDOMRuntimeExtension.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDOMRuntimeExtension.java
new file mode 100755
index 0000000..f2b8050
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDOMRuntimeExtension.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+
+/**
+ * This interface should be implemented by all runtime which want to have DOM Tree
+ * representation on top of them.
+ *
+ * @author Georgi Hristov I036201
+ */
+public interface IWsDOMRuntimeExtension
+{
+ /**
+ * This method should instantiate the DOM instance for the runtime and loads the
+ * data into it. The method locks the workspace root during execution. If you call this
+ * method during loading (i.e. somebody already called it in different thread) the method
+ * will block until the load finishes instead of triggering DOM reload.
+ *
+ * @param monitor progress monitor to be used during loading, cancelling the load via monitor is supported
+ * @throws IOException in case the DOM loading is not able to read required data
+ * @throws WsDOMLoadCanceledException in case the loading was cancelled via provided
+ * <code>monitor</code>.
+ */
+ public void createDOM(IProgressMonitor monitor) throws IOException, WsDOMLoadCanceledException;
+
+ /**
+ * Adds a load listener to be notified in load events. In case the loading has already been started
+ * this listener's methods are called depending on the current state of the load.
+ * {@link IWsDomLoadListener#finished()} method is called in any case regardless of whether loading
+ * has been cancelled or not.
+ * @param listener
+ */
+ public void addLoadListener(IWsDomLoadListener listener);
+
+ /**
+ * Removes the listener from DOM loading listeners list
+ *
+ * @param listener
+ */
+ public void removeLoadListener(IWsDomLoadListener listener);
+
+ /**
+ * To get a handle to the DOM instance available for this runtime.
+ *
+ * @return the DOM instance or <code>null</code> in case the loading was not started yet or
+ * is not finished yet.
+ * @throws WsDOMLoadCanceledException in case loading has been called already but the load
+ * has been cancelled
+ */
+ public IDOM getDOM() throws WsDOMLoadCanceledException;
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDomLoadListener.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDomLoadListener.java
new file mode 100755
index 0000000..879b046
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/IWsDomLoadListener.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+
+
+/**
+ * Interface to be implemented by interested in DOM load process. Implementors can be added to
+ * the {@link IWsDOMRuntimeExtension} to receive notifications on load startup/finish
+ *
+ * @author Georgi Vachkov
+ */
+public interface IWsDomLoadListener
+{
+ /**
+ * Called by {@link IWsDOMRuntimeExtension} just before the DOM load start
+ */
+ public void started();
+
+ /**
+ * Called by {@link IWsDOMRuntimeExtension} when the DOM load has finished
+ */
+ public void finished();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingParameterStyle.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingParameterStyle.java
new file mode 100755
index 0000000..956855f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingParameterStyle.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>SOAP Binding Parameter Style</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getSOAPBindingParameterStyle()
+ * @model
+ * @generated
+ */
+public enum SOAPBindingParameterStyle implements Enumerator {
+ /**
+ * The '<em><b>WRAPPED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #WRAPPED_VALUE
+ * @generated
+ * @ordered
+ */
+ WRAPPED(0, "WRAPPED", "WRAPPED"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>BARE</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #BARE_VALUE
+ * @generated
+ * @ordered
+ */
+ BARE(1, "BARE", "BARE"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>WRAPPED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>WRAPPED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #WRAPPED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int WRAPPED_VALUE = 0;
+
+ /**
+ * The '<em><b>BARE</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>BARE</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #BARE
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int BARE_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>SOAP Binding Parameter Style</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final SOAPBindingParameterStyle[] VALUES_ARRAY =
+ new SOAPBindingParameterStyle[]
+ {
+ WRAPPED,
+ BARE,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>SOAP Binding Parameter Style</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<SOAPBindingParameterStyle> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>SOAP Binding Parameter Style</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingParameterStyle get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingParameterStyle result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Parameter Style</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingParameterStyle getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingParameterStyle result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Parameter Style</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingParameterStyle get(int value) {
+ switch (value)
+ {
+ case WRAPPED_VALUE: return WRAPPED;
+ case BARE_VALUE: return BARE;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private SOAPBindingParameterStyle(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //SOAPBindingParameterStyle
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingStyle.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingStyle.java
new file mode 100755
index 0000000..6082254
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingStyle.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>SOAP Binding Style</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getSOAPBindingStyle()
+ * @model
+ * @generated
+ */
+public enum SOAPBindingStyle implements Enumerator {
+ /**
+ * The '<em><b>DOCUMENT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #DOCUMENT_VALUE
+ * @generated
+ * @ordered
+ */
+ DOCUMENT(0, "DOCUMENT", "DOCUMENT"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>RPC</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #RPC_VALUE
+ * @generated
+ * @ordered
+ */
+ RPC(1, "RPC", "RPC"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>DOCUMENT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>DOCUMENT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #DOCUMENT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int DOCUMENT_VALUE = 0;
+
+ /**
+ * The '<em><b>RPC</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>RPC</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #RPC
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int RPC_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>SOAP Binding Style</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final SOAPBindingStyle[] VALUES_ARRAY =
+ new SOAPBindingStyle[]
+ {
+ DOCUMENT,
+ RPC,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>SOAP Binding Style</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<SOAPBindingStyle> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>SOAP Binding Style</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingStyle get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingStyle result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Style</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingStyle getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingStyle result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Style</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingStyle get(int value) {
+ switch (value)
+ {
+ case DOCUMENT_VALUE: return DOCUMENT;
+ case RPC_VALUE: return RPC;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private SOAPBindingStyle(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //SOAPBindingStyle
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingUse.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingUse.java
new file mode 100755
index 0000000..b35b180
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/SOAPBindingUse.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>SOAP Binding Use</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#getSOAPBindingUse()
+ * @model
+ * @generated
+ */
+public enum SOAPBindingUse implements Enumerator {
+ /**
+ * The '<em><b>LITERAL</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #LITERAL_VALUE
+ * @generated
+ * @ordered
+ */
+ LITERAL(0, "LITERAL", "LITERAL"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>ENCODED</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #ENCODED_VALUE
+ * @generated
+ * @ordered
+ */
+ ENCODED(1, "ENCODED", "ENCODED"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>LITERAL</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>LITERAL</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #LITERAL
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int LITERAL_VALUE = 0;
+
+ /**
+ * The '<em><b>ENCODED</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>ENCODED</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #ENCODED
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int ENCODED_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>SOAP Binding Use</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final SOAPBindingUse[] VALUES_ARRAY =
+ new SOAPBindingUse[]
+ {
+ LITERAL,
+ ENCODED,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>SOAP Binding Use</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<SOAPBindingUse> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>SOAP Binding Use</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingUse get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingUse result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Use</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingUse getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ SOAPBindingUse result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>SOAP Binding Use</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SOAPBindingUse get(int value) {
+ switch (value)
+ {
+ case LITERAL_VALUE: return LITERAL;
+ case ENCODED_VALUE: return ENCODED;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private SOAPBindingUse(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //SOAPBindingUse
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WebParamKind.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WebParamKind.java
new file mode 100755
index 0000000..092643c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WebParamKind.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * @model
+ * @author Hristo Sabev
+ *
+ */
+public enum WebParamKind implements Enumerator {/**@model*/IN(0, "IN", "IN"), /**@model*/INOUT(1, "INOUT", "INOUT"), /**@model*/OUT(2, "OUT", "OUT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+/**
+ * The '<em><b>IN</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>IN</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #IN
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int IN_VALUE = 0;
+/**
+ * The '<em><b>INOUT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>INOUT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #INOUT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int INOUT_VALUE = 1;
+/**
+ * The '<em><b>OUT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>OUT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #OUT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int OUT_VALUE = 2;
+/**
+ * An array of all the '<em><b>Web Param Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final WebParamKind[] VALUES_ARRAY =
+ new WebParamKind[]
+ {
+ IN,
+ INOUT,
+ OUT,
+ };
+/**
+ * A public read-only list of all the '<em><b>Web Param Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<WebParamKind> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+/**
+ * Returns the '<em><b>Web Param Kind</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static WebParamKind get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ WebParamKind result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+/**
+ * Returns the '<em><b>Web Param Kind</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static WebParamKind getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ WebParamKind result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+/**
+ * Returns the '<em><b>Web Param Kind</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static WebParamKind get(int value) {
+ switch (value)
+ {
+ case IN_VALUE: return IN;
+ case INOUT_VALUE: return INOUT;
+ case OUT_VALUE: return OUT;
+ }
+ return null;
+ }
+
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+/**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private WebParamKind(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+/**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMLoadCanceledException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMLoadCanceledException.java
new file mode 100755
index 0000000..671047b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMLoadCanceledException.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+
+/**
+ * Exception thrown in case the loading of WS DOM has been cancelled
+ *
+ * @author Georgi Vachkov
+ */
+public class WsDOMLoadCanceledException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+ private final String localizedMessage;
+
+ /**
+ * Constructs exception with ability to provide localized message
+ * @param message - the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method)
+ * @param localizedMessage - the localized message (which is saved for later retrieval
+ * by the {@link #getLocalizedMessage()} method)
+ *
+ * @throws NullPointerException - in case localised message is null
+ * */
+ public WsDOMLoadCanceledException(final String message, final String localizedMessage) {
+ super(message);
+ ContractChecker.nullCheckParam(localizedMessage, "localizedMessage"); //$NON-NLS-1$
+ this.localizedMessage = localizedMessage;
+ }
+
+ /**
+ * Returns localized message with which the exception was constructed.*/
+ @Override
+ public String getLocalizedMessage() {
+ return localizedMessage;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMRuntimeManager.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMRuntimeManager.java
new file mode 100755
index 0000000..06d4a6f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/api/WsDOMRuntimeManager.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.api;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.IWsDOMRuntimeInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.WsDOMRuntimeRegistry;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Factory class for instantiating DOM Runtimes and managing those instances.
+ *
+ * @author Georgi Hristov
+ *
+ */
+public class WsDOMRuntimeManager implements IWSDOMRuntimeManager
+{
+ private static WsDOMRuntimeManager instance = new WsDOMRuntimeManager();
+
+ private Map<String,IWsDOMRuntimeExtension> domRuntimes = new HashMap<String,IWsDOMRuntimeExtension>();
+
+ protected WsDOMRuntimeManager()
+ {
+ // singleton
+ }
+
+ public static IWSDOMRuntimeManager instance()
+ {
+ return instance;
+ }
+
+ /**
+ * Instantiates the DOM Runtimes if not already.
+ *
+ */
+ public synchronized void createDOMRuntimes(final IProgressMonitor monitor)
+ {
+ for (IWsDOMRuntimeInfo runtimeInfo : WsDOMRuntimeRegistry.getRegisteredRuntimesInfo()) {
+ createDOMRuntime(runtimeInfo, monitor);
+ }
+ }
+
+ protected IWsDOMRuntimeExtension createDOMRuntime(final IWsDOMRuntimeInfo runtimeInfo, final IProgressMonitor monitor)
+ {
+ final IWsDOMRuntimeExtension domRuntime = getDOMRuntime(runtimeInfo);
+ if (domRuntime == null) {
+ return null;
+ }
+
+ try {
+ domRuntime.createDOM(monitor);
+ }
+ catch (Exception unexpected) {
+ logger().logError("Unexpected Exception! Dom from runtime " + runtimeInfo.getName() + " will not be processed!", unexpected); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return domRuntime;
+ }
+
+ /**
+ * This method should return the DOM runtime instance corresponding to the descriptor object
+ * of type IRuntimeInfo and instantiate such DOM runtime instance if non existent at the
+ * moment of invocation of this method.
+ *
+ * @param runtimeInfo - descriptor of the DOM runtime to be instantiated and returned
+ * @return the DOM runtime instance
+ */
+ public IWsDOMRuntimeExtension getDOMRuntime(final IWsDOMRuntimeInfo runtimeInfo)
+ {
+ if (runtimeInfo == null) {
+ return null;
+ }
+
+ IWsDOMRuntimeExtension domRuntime = domRuntimes.get(runtimeInfo.getId());
+ if (domRuntime == null)
+ {
+ domRuntime = WsDOMRuntimeRegistry.instantiateRuntime(runtimeInfo);
+ if (domRuntime != null) {
+ synchronized(domRuntimes) {
+ domRuntimes.put(runtimeInfo.getId(), domRuntime);
+ }
+ }
+ }
+
+ return domRuntime;
+ }
+
+ /**
+ * This method should return the DOM runtime instance corresponding to the runtime id
+ * and instantiate such DOM runtime instance if non existent at the
+ * moment of invocation of this method.
+ *
+ * @param runtimeId - string identifier of the runtime
+ * @return the DOM runtime instance
+ */
+ public IWsDOMRuntimeExtension getDOMRuntime(final String runtimeId)
+ {
+ return getDOMRuntime(WsDOMRuntimeRegistry.getRuntimeInfo(runtimeId));
+ }
+
+ /**
+ *
+ * @return a list of all instantiated DOM Runtimes
+ */
+ public Collection<IWsDOMRuntimeExtension> getDOMRuntimes()
+ {
+ if (domRuntimes.size() == 0)
+ {
+ final Collection<IWsDOMRuntimeInfo> rtInfos = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+ for (IWsDOMRuntimeInfo runtimeInfo : rtInfos) {
+ getDOMRuntime(runtimeInfo);
+ }
+ }
+
+ return domRuntimes.values();
+ }
+
+ /**
+ * This method should reload all instances of DOM Runtimes.
+ *
+ */
+ public synchronized void reloadDOMRuntimes(final IProgressMonitor monitor)
+ {
+ synchronized(domRuntimes) {
+ domRuntimes = new HashMap<String,IWsDOMRuntimeExtension>();
+ }
+
+ createDOMRuntimes(monitor);
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore
new file mode 100755
index 0000000..0041eda
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="dom"
+ nsURI="http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore" nsPrefix="org.eclipse.jst.ws.jaxws.dom.runtime">
+ <eClassifiers xsi:type="ecore:EClass" name="IDOM">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="webServiceProjects" upperBound="-1"
+ eType="#//IWebServiceProject" containment="true" resolveProxies="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IJavaWebServiceElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="implementation" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IServiceEndpointInterface" eSuperTypes="#//IJavaWebServiceElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="implicit" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="implementingWebServices"
+ lowerBound="1" upperBound="-1" eType="#//IWebService" eOpposite="#//IWebService/serviceEndpoint">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="webMethods" lowerBound="1"
+ upperBound="-1" eType="#//IWebMethod" containment="true" resolveProxies="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetNamespace" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingStyle" lowerBound="1"
+ eType="#//SOAPBindingStyle" defaultValueLiteral="DOCUMENT"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingUse" lowerBound="1"
+ eType="#//SOAPBindingUse" defaultValueLiteral="LITERAL"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingParameterStyle"
+ lowerBound="1" eType="#//SOAPBindingParameterStyle" defaultValueLiteral="WRAPPED"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IWebMethod" eSuperTypes="#//IJavaWebServiceElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" lowerBound="1"
+ upperBound="-1" eType="#//IWebParam" containment="true" resolveProxies="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="excluded" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingStyle" lowerBound="1"
+ eType="#//SOAPBindingStyle" defaultValueLiteral="DOCUMENT"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingUse" lowerBound="1"
+ eType="#//SOAPBindingUse" defaultValueLiteral="LITERAL"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="soapBindingParameterStyle"
+ lowerBound="1" eType="#//SOAPBindingParameterStyle" defaultValueLiteral="WRAPPED"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IWebParam" eSuperTypes="#//IJavaWebServiceElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" eType="#//WebParamKind"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="typeName" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="partName" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetNamespace" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="header" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IWebService" eSuperTypes="#//IJavaWebServiceElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="serviceEndpoint" eType="#//IServiceEndpointInterface"
+ eOpposite="#//IServiceEndpointInterface/implementingWebServices">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetNamespace" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="portName" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="wsdlLocation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IWebServiceProject">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="webServices" upperBound="-1"
+ eType="#//IWebService" containment="true" resolveProxies="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="serviceEndpointInterfaces"
+ upperBound="-1" eType="#//IServiceEndpointInterface" containment="true" resolveProxies="false">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="suppressedSetVisibility" value="true"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IWebType" eSuperTypes="#//IJavaWebServiceElement"/>
+ <eClassifiers xsi:type="ecore:EEnum" name="WebParamKind">
+ <eLiterals name="IN"/>
+ <eLiterals name="INOUT" value="1"/>
+ <eLiterals name="OUT" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="SOAPBindingStyle">
+ <eLiterals name="DOCUMENT" literal="DOCUMENT"/>
+ <eLiterals name="RPC" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="SOAPBindingUse">
+ <eLiterals name="LITERAL"/>
+ <eLiterals name="ENCODED" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="SOAPBindingParameterStyle">
+ <eLiterals name="WRAPPED"/>
+ <eLiterals name="BARE" value="1"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ws.genmodel b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ws.genmodel
new file mode 100755
index 0000000..b4269ab
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/dom.ws.genmodel
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="org.eclipse.jst.ws.jaxws.dom.runtime/src"
+ editDirectory="org.eclipse.jst.ws.jaxws.dom.ui/src" editorDirectory="org.eclipse.jst.ws.jaxws.dom.runtime.editor/src"
+ modelPluginID="org.eclipse.jst.ws.jaxws.dom.runtime" modelName="Dom" editPluginClass="org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi"
+ editorPluginClass="org.eclipse.jst.ws.jaxws.dom.ui.navigator.generated.DomEditorPlugin"
+ nonNLSMarkers="true" testsDirectory="org.eclipse.jst.ws.jaxws.dom.runtime.tests/src"
+ importerID="org.eclipse.emf.importer.java" complianceLevel="5.0" copyrightFields="false"
+ providerRootExtendsClass="">
+ <foreignModel>@model</foreignModel>
+ <genPackages prefix="Dom" basePackage="org.eclipse.jst.ws.jaxws" disposableProviderFactory="true"
+ interfacePackageSuffix="runtime.api" metaDataPackageSuffix="runtime.api" classPackageSuffix="runtime.internal.impl"
+ utilityPackageSuffix="runtime.util" providerPackageSuffix="ui" generateExampleClass="false"
+ ecorePackage="dom.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="dom.ecore#//WebParamKind">
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//WebParamKind/IN"/>
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//WebParamKind/INOUT"/>
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//WebParamKind/OUT"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="dom.ecore#//SOAPBindingStyle">
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingStyle/DOCUMENT"/>
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingStyle/RPC"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="dom.ecore#//SOAPBindingUse">
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingUse/LITERAL"/>
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingUse/ENCODED"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="dom.ecore#//SOAPBindingParameterStyle">
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingParameterStyle/WRAPPED"/>
+ <genEnumLiterals ecoreEnumLiteral="dom.ecore#//SOAPBindingParameterStyle/BARE"/>
+ </genEnums>
+ <genClasses ecoreClass="dom.ecore#//IDOM">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference dom.ecore#//IDOM/webServiceProjects"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IJavaWebServiceElement">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IJavaWebServiceElement/implementation"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IJavaWebServiceElement/name"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IServiceEndpointInterface">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IServiceEndpointInterface/implicit"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference dom.ecore#//IServiceEndpointInterface/implementingWebServices"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference dom.ecore#//IServiceEndpointInterface/webMethods"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IServiceEndpointInterface/targetNamespace"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IServiceEndpointInterface/soapBindingStyle"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IServiceEndpointInterface/soapBindingUse"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IServiceEndpointInterface/soapBindingParameterStyle"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IWebMethod">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference dom.ecore#//IWebMethod/parameters"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebMethod/excluded"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebMethod/soapBindingStyle"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebMethod/soapBindingUse"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebMethod/soapBindingParameterStyle"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IWebParam">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebParam/kind"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebParam/typeName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebParam/partName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebParam/targetNamespace"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebParam/header"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IWebService">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference dom.ecore#//IWebService/serviceEndpoint"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebService/targetNamespace"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebService/portName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebService/wsdlLocation"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IWebServiceProject">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference dom.ecore#//IWebServiceProject/webServices"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference dom.ecore#//IWebServiceProject/serviceEndpointInterfaces"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dom.ecore#//IWebServiceProject/name"/>
+ </genClasses>
+ <genClasses ecoreClass="dom.ecore#//IWebType"/>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomFactoryImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomFactoryImpl.java
new file mode 100755
index 0000000..91d3a74
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomFactoryImpl.java
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DomFactoryImpl extends EFactoryImpl implements DomFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static DomFactory init() {
+ try
+ {
+ DomFactory theDomFactory = (DomFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"); //$NON-NLS-1$
+ if (theDomFactory != null)
+ {
+ return theDomFactory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new DomFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID())
+ {
+ case DomPackage.IDOM: return createIDOM();
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT: return createIJavaWebServiceElement();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE: return createIServiceEndpointInterface();
+ case DomPackage.IWEB_METHOD: return createIWebMethod();
+ case DomPackage.IWEB_PARAM: return createIWebParam();
+ case DomPackage.IWEB_SERVICE: return createIWebService();
+ case DomPackage.IWEB_SERVICE_PROJECT: return createIWebServiceProject();
+ case DomPackage.IWEB_TYPE: return createIWebType();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue) {
+ switch (eDataType.getClassifierID())
+ {
+ case DomPackage.WEB_PARAM_KIND:
+ return createWebParamKindFromString(eDataType, initialValue);
+ case DomPackage.SOAP_BINDING_STYLE:
+ return createSOAPBindingStyleFromString(eDataType, initialValue);
+ case DomPackage.SOAP_BINDING_USE:
+ return createSOAPBindingUseFromString(eDataType, initialValue);
+ case DomPackage.SOAP_BINDING_PARAMETER_STYLE:
+ return createSOAPBindingParameterStyleFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue) {
+ switch (eDataType.getClassifierID())
+ {
+ case DomPackage.WEB_PARAM_KIND:
+ return convertWebParamKindToString(eDataType, instanceValue);
+ case DomPackage.SOAP_BINDING_STYLE:
+ return convertSOAPBindingStyleToString(eDataType, instanceValue);
+ case DomPackage.SOAP_BINDING_USE:
+ return convertSOAPBindingUseToString(eDataType, instanceValue);
+ case DomPackage.SOAP_BINDING_PARAMETER_STYLE:
+ return convertSOAPBindingParameterStyleToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IDOM createIDOM() {
+ IDOMImpl idom = new IDOMImpl();
+ return idom;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IJavaWebServiceElement createIJavaWebServiceElement() {
+ IJavaWebServiceElementImpl iJavaWebServiceElement = new IJavaWebServiceElementImpl();
+ return iJavaWebServiceElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IServiceEndpointInterface createIServiceEndpointInterface() {
+ IServiceEndpointInterfaceImpl iServiceEndpointInterface = new IServiceEndpointInterfaceImpl();
+ return iServiceEndpointInterface;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebMethod createIWebMethod() {
+ IWebMethodImpl iWebMethod = new IWebMethodImpl();
+ return iWebMethod;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebParam createIWebParam() {
+ IWebParamImpl iWebParam = new IWebParamImpl();
+ return iWebParam;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebService createIWebService() {
+ IWebServiceImpl iWebService = new IWebServiceImpl();
+ return iWebService;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebServiceProject createIWebServiceProject() {
+ IWebServiceProjectImpl iWebServiceProject = new IWebServiceProjectImpl();
+ return iWebServiceProject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebType createIWebType() {
+ IWebTypeImpl iWebType = new IWebTypeImpl();
+ return iWebType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public WebParamKind createWebParamKindFromString(EDataType eDataType, String initialValue) {
+ WebParamKind result = WebParamKind.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertWebParamKindToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingStyle createSOAPBindingStyleFromString(EDataType eDataType, String initialValue) {
+ SOAPBindingStyle result = SOAPBindingStyle.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertSOAPBindingStyleToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingUse createSOAPBindingUseFromString(EDataType eDataType, String initialValue) {
+ SOAPBindingUse result = SOAPBindingUse.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertSOAPBindingUseToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingParameterStyle createSOAPBindingParameterStyleFromString(EDataType eDataType, String initialValue) {
+ SOAPBindingParameterStyle result = SOAPBindingParameterStyle.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertSOAPBindingParameterStyleToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomPackage getDomPackage() {
+ return (DomPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static DomPackage getPackage() {
+ return DomPackage.eINSTANCE;
+ }
+
+} //DomFactoryImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomPackageImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomPackageImpl.java
new file mode 100755
index 0000000..79588a7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/DomPackageImpl.java
@@ -0,0 +1,722 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DomPackageImpl extends EPackageImpl implements DomPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass idomEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iJavaWebServiceElementEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iServiceEndpointInterfaceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iWebMethodEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iWebParamEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iWebServiceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iWebServiceProjectEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass iWebTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum webParamKindEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum soapBindingStyleEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum soapBindingUseEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum soapBindingParameterStyleEEnum = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private DomPackageImpl() {
+ super(eNS_URI, DomFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this
+ * model, and for any others upon which it depends. Simple
+ * dependencies are satisfied by calling this method on all
+ * dependent packages before doing anything else. This method drives
+ * initialization for interdependent packages directly, in parallel
+ * with this package, itself.
+ * <p>Of this package and its interdependencies, all packages which
+ * have not yet been registered by their URI values are first created
+ * and registered. The packages are then initialized in two steps:
+ * meta-model objects for all of the packages are created before any
+ * are initialized, since one package's meta-model objects may refer to
+ * those of another.
+ * <p>Invocation of this method will not affect any packages that have
+ * already been initialized.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static DomPackage init() {
+ if (isInited) return (DomPackage)EPackage.Registry.INSTANCE.getEPackage(DomPackage.eNS_URI);
+
+ // Obtain or create and register package
+ DomPackageImpl theDomPackage = (DomPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof DomPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new DomPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theDomPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theDomPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theDomPackage.freeze();
+
+ return theDomPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIDOM() {
+ return idomEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIDOM_WebServiceProjects() {
+ return (EReference)idomEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIJavaWebServiceElement() {
+ return iJavaWebServiceElementEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIJavaWebServiceElement_Implementation() {
+ return (EAttribute)iJavaWebServiceElementEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIJavaWebServiceElement_Name() {
+ return (EAttribute)iJavaWebServiceElementEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIServiceEndpointInterface() {
+ return iServiceEndpointInterfaceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIServiceEndpointInterface_Implicit() {
+ return (EAttribute)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIServiceEndpointInterface_ImplementingWebServices() {
+ return (EReference)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIServiceEndpointInterface_WebMethods() {
+ return (EReference)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIServiceEndpointInterface_TargetNamespace() {
+ return (EAttribute)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIServiceEndpointInterface_SoapBindingStyle() {
+ return (EAttribute)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIServiceEndpointInterface_SoapBindingUse() {
+ return (EAttribute)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIServiceEndpointInterface_SoapBindingParameterStyle() {
+ return (EAttribute)iServiceEndpointInterfaceEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIWebMethod() {
+ return iWebMethodEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIWebMethod_Parameters() {
+ return (EReference)iWebMethodEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebMethod_Excluded() {
+ return (EAttribute)iWebMethodEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebMethod_SoapBindingStyle() {
+ return (EAttribute)iWebMethodEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebMethod_SoapBindingUse() {
+ return (EAttribute)iWebMethodEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebMethod_SoapBindingParameterStyle() {
+ return (EAttribute)iWebMethodEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIWebParam() {
+ return iWebParamEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebParam_Kind() {
+ return (EAttribute)iWebParamEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebParam_TypeName() {
+ return (EAttribute)iWebParamEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebParam_PartName() {
+ return (EAttribute)iWebParamEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebParam_TargetNamespace() {
+ return (EAttribute)iWebParamEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebParam_Header() {
+ return (EAttribute)iWebParamEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIWebService() {
+ return iWebServiceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIWebService_ServiceEndpoint() {
+ return (EReference)iWebServiceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebService_TargetNamespace() {
+ return (EAttribute)iWebServiceEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebService_PortName() {
+ return (EAttribute)iWebServiceEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebService_WsdlLocation() {
+ return (EAttribute)iWebServiceEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIWebServiceProject() {
+ return iWebServiceProjectEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIWebServiceProject_WebServices() {
+ return (EReference)iWebServiceProjectEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getIWebServiceProject_ServiceEndpointInterfaces() {
+ return (EReference)iWebServiceProjectEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIWebServiceProject_Name() {
+ return (EAttribute)iWebServiceProjectEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIWebType() {
+ return iWebTypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getWebParamKind() {
+ return webParamKindEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getSOAPBindingStyle() {
+ return soapBindingStyleEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getSOAPBindingUse() {
+ return soapBindingUseEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getSOAPBindingParameterStyle() {
+ return soapBindingParameterStyleEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomFactory getDomFactory() {
+ return (DomFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ idomEClass = createEClass(IDOM);
+ createEReference(idomEClass, IDOM__WEB_SERVICE_PROJECTS);
+
+ iJavaWebServiceElementEClass = createEClass(IJAVA_WEB_SERVICE_ELEMENT);
+ createEAttribute(iJavaWebServiceElementEClass, IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION);
+ createEAttribute(iJavaWebServiceElementEClass, IJAVA_WEB_SERVICE_ELEMENT__NAME);
+
+ iServiceEndpointInterfaceEClass = createEClass(ISERVICE_ENDPOINT_INTERFACE);
+ createEAttribute(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__IMPLICIT);
+ createEReference(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES);
+ createEReference(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS);
+ createEAttribute(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE);
+ createEAttribute(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE);
+ createEAttribute(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE);
+ createEAttribute(iServiceEndpointInterfaceEClass, ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE);
+
+ iWebMethodEClass = createEClass(IWEB_METHOD);
+ createEReference(iWebMethodEClass, IWEB_METHOD__PARAMETERS);
+ createEAttribute(iWebMethodEClass, IWEB_METHOD__EXCLUDED);
+ createEAttribute(iWebMethodEClass, IWEB_METHOD__SOAP_BINDING_STYLE);
+ createEAttribute(iWebMethodEClass, IWEB_METHOD__SOAP_BINDING_USE);
+ createEAttribute(iWebMethodEClass, IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE);
+
+ iWebParamEClass = createEClass(IWEB_PARAM);
+ createEAttribute(iWebParamEClass, IWEB_PARAM__KIND);
+ createEAttribute(iWebParamEClass, IWEB_PARAM__TYPE_NAME);
+ createEAttribute(iWebParamEClass, IWEB_PARAM__PART_NAME);
+ createEAttribute(iWebParamEClass, IWEB_PARAM__TARGET_NAMESPACE);
+ createEAttribute(iWebParamEClass, IWEB_PARAM__HEADER);
+
+ iWebServiceEClass = createEClass(IWEB_SERVICE);
+ createEReference(iWebServiceEClass, IWEB_SERVICE__SERVICE_ENDPOINT);
+ createEAttribute(iWebServiceEClass, IWEB_SERVICE__TARGET_NAMESPACE);
+ createEAttribute(iWebServiceEClass, IWEB_SERVICE__PORT_NAME);
+ createEAttribute(iWebServiceEClass, IWEB_SERVICE__WSDL_LOCATION);
+
+ iWebServiceProjectEClass = createEClass(IWEB_SERVICE_PROJECT);
+ createEReference(iWebServiceProjectEClass, IWEB_SERVICE_PROJECT__WEB_SERVICES);
+ createEReference(iWebServiceProjectEClass, IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES);
+ createEAttribute(iWebServiceProjectEClass, IWEB_SERVICE_PROJECT__NAME);
+
+ iWebTypeEClass = createEClass(IWEB_TYPE);
+
+ // Create enums
+ webParamKindEEnum = createEEnum(WEB_PARAM_KIND);
+ soapBindingStyleEEnum = createEEnum(SOAP_BINDING_STYLE);
+ soapBindingUseEEnum = createEEnum(SOAP_BINDING_USE);
+ soapBindingParameterStyleEEnum = createEEnum(SOAP_BINDING_PARAMETER_STYLE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ iServiceEndpointInterfaceEClass.getESuperTypes().add(this.getIJavaWebServiceElement());
+ iWebMethodEClass.getESuperTypes().add(this.getIJavaWebServiceElement());
+ iWebParamEClass.getESuperTypes().add(this.getIJavaWebServiceElement());
+ iWebServiceEClass.getESuperTypes().add(this.getIJavaWebServiceElement());
+ iWebTypeEClass.getESuperTypes().add(this.getIJavaWebServiceElement());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(idomEClass, org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM.class, "IDOM", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getIDOM_WebServiceProjects(), this.getIWebServiceProject(), null, "webServiceProjects", null, 0, -1, org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(iJavaWebServiceElementEClass, IJavaWebServiceElement.class, "IJavaWebServiceElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getIJavaWebServiceElement_Implementation(), ecorePackage.getEString(), "implementation", null, 1, 1, IJavaWebServiceElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIJavaWebServiceElement_Name(), ecorePackage.getEString(), "name", null, 1, 1, IJavaWebServiceElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(iServiceEndpointInterfaceEClass, IServiceEndpointInterface.class, "IServiceEndpointInterface", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getIServiceEndpointInterface_Implicit(), ecorePackage.getEBoolean(), "implicit", null, 1, 1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getIServiceEndpointInterface_ImplementingWebServices(), this.getIWebService(), this.getIWebService_ServiceEndpoint(), "implementingWebServices", null, 1, -1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getIServiceEndpointInterface_WebMethods(), this.getIWebMethod(), null, "webMethods", null, 1, -1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIServiceEndpointInterface_TargetNamespace(), ecorePackage.getEString(), "targetNamespace", null, 1, 1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIServiceEndpointInterface_SoapBindingStyle(), this.getSOAPBindingStyle(), "soapBindingStyle", "DOCUMENT", 1, 1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getIServiceEndpointInterface_SoapBindingUse(), this.getSOAPBindingUse(), "soapBindingUse", "LITERAL", 1, 1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getIServiceEndpointInterface_SoapBindingParameterStyle(), this.getSOAPBindingParameterStyle(), "soapBindingParameterStyle", "WRAPPED", 1, 1, IServiceEndpointInterface.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+
+ initEClass(iWebMethodEClass, IWebMethod.class, "IWebMethod", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getIWebMethod_Parameters(), this.getIWebParam(), null, "parameters", null, 1, -1, IWebMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebMethod_Excluded(), ecorePackage.getEBoolean(), "excluded", null, 1, 1, IWebMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebMethod_SoapBindingStyle(), this.getSOAPBindingStyle(), "soapBindingStyle", "DOCUMENT", 1, 1, IWebMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getIWebMethod_SoapBindingUse(), this.getSOAPBindingUse(), "soapBindingUse", "LITERAL", 1, 1, IWebMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getIWebMethod_SoapBindingParameterStyle(), this.getSOAPBindingParameterStyle(), "soapBindingParameterStyle", "WRAPPED", 1, 1, IWebMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+
+ initEClass(iWebParamEClass, IWebParam.class, "IWebParam", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getIWebParam_Kind(), this.getWebParamKind(), "kind", null, 1, 1, IWebParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebParam_TypeName(), ecorePackage.getEString(), "typeName", null, 1, 1, IWebParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebParam_PartName(), ecorePackage.getEString(), "partName", null, 1, 1, IWebParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebParam_TargetNamespace(), ecorePackage.getEString(), "targetNamespace", null, 1, 1, IWebParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebParam_Header(), ecorePackage.getEBoolean(), "header", "false", 1, 1, IWebParam.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+
+ initEClass(iWebServiceEClass, IWebService.class, "IWebService", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getIWebService_ServiceEndpoint(), this.getIServiceEndpointInterface(), this.getIServiceEndpointInterface_ImplementingWebServices(), "serviceEndpoint", null, 0, 1, IWebService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebService_TargetNamespace(), ecorePackage.getEString(), "targetNamespace", null, 1, 1, IWebService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebService_PortName(), ecorePackage.getEString(), "portName", null, 1, 1, IWebService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebService_WsdlLocation(), ecorePackage.getEString(), "wsdlLocation", null, 0, 1, IWebService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(iWebServiceProjectEClass, IWebServiceProject.class, "IWebServiceProject", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getIWebServiceProject_WebServices(), this.getIWebService(), null, "webServices", null, 0, -1, IWebServiceProject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getIWebServiceProject_ServiceEndpointInterfaces(), this.getIServiceEndpointInterface(), null, "serviceEndpointInterfaces", null, 0, -1, IWebServiceProject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getIWebServiceProject_Name(), ecorePackage.getEString(), "name", null, 1, 1, IWebServiceProject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(iWebTypeEClass, IWebType.class, "IWebType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+
+ // Initialize enums and add enum literals
+ initEEnum(webParamKindEEnum, WebParamKind.class, "WebParamKind"); //$NON-NLS-1$
+ addEEnumLiteral(webParamKindEEnum, WebParamKind.IN);
+ addEEnumLiteral(webParamKindEEnum, WebParamKind.INOUT);
+ addEEnumLiteral(webParamKindEEnum, WebParamKind.OUT);
+
+ initEEnum(soapBindingStyleEEnum, SOAPBindingStyle.class, "SOAPBindingStyle"); //$NON-NLS-1$
+ addEEnumLiteral(soapBindingStyleEEnum, SOAPBindingStyle.DOCUMENT);
+ addEEnumLiteral(soapBindingStyleEEnum, SOAPBindingStyle.RPC);
+
+ initEEnum(soapBindingUseEEnum, SOAPBindingUse.class, "SOAPBindingUse"); //$NON-NLS-1$
+ addEEnumLiteral(soapBindingUseEEnum, SOAPBindingUse.LITERAL);
+ addEEnumLiteral(soapBindingUseEEnum, SOAPBindingUse.ENCODED);
+
+ initEEnum(soapBindingParameterStyleEEnum, SOAPBindingParameterStyle.class, "SOAPBindingParameterStyle"); //$NON-NLS-1$
+ addEEnumLiteral(soapBindingParameterStyleEEnum, SOAPBindingParameterStyle.WRAPPED);
+ addEEnumLiteral(soapBindingParameterStyleEEnum, SOAPBindingParameterStyle.BARE);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //DomPackageImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IDOMImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IDOMImpl.java
new file mode 100755
index 0000000..8ae867c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IDOMImpl.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IDOM</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IDOMImpl#getWebServiceProjects <em>Web Service Projects</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IDOMImpl extends EObjectImpl implements IDOM {
+ /**
+ * The cached value of the '{@link #getWebServiceProjects() <em>Web Service Projects</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getWebServiceProjects()
+ * @generated
+ * @ordered
+ */
+ protected EList<IWebServiceProject> webServiceProjects;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IDOMImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IDOM;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IWebServiceProject> getWebServiceProjects() {
+ if (webServiceProjects == null)
+ {
+ webServiceProjects = new EObjectContainmentEList<IWebServiceProject>(IWebServiceProject.class, this, DomPackage.IDOM__WEB_SERVICE_PROJECTS);
+ }
+ return webServiceProjects;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ return ((InternalEList<?>)getWebServiceProjects()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ return getWebServiceProjects();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ getWebServiceProjects().clear();
+ getWebServiceProjects().addAll((Collection<? extends IWebServiceProject>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ getWebServiceProjects().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ return webServiceProjects != null && !webServiceProjects.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //IDOMImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IJavaWebServiceElementImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IJavaWebServiceElementImpl.java
new file mode 100755
index 0000000..d80c124
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IJavaWebServiceElementImpl.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IJava Web Service Element</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl#getImplementation <em>Implementation</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IJavaWebServiceElementImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IJavaWebServiceElementImpl extends EObjectImpl implements IJavaWebServiceElement {
+ /**
+ * The default value of the '{@link #getImplementation() <em>Implementation</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementation()
+ * @generated
+ * @ordered
+ */
+ protected static final String IMPLEMENTATION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getImplementation() <em>Implementation</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementation()
+ * @generated
+ * @ordered
+ */
+ protected String implementation = IMPLEMENTATION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IJavaWebServiceElementImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getImplementation() {
+ return implementation;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setImplementation(String newImplementation) {
+ String oldImplementation = implementation;
+ implementation = newImplementation;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, oldImplementation, implementation));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION:
+ return getImplementation();
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION:
+ setImplementation((String)newValue);
+ return;
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION:
+ setImplementation(IMPLEMENTATION_EDEFAULT);
+ return;
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION:
+ return IMPLEMENTATION_EDEFAULT == null ? implementation != null : !IMPLEMENTATION_EDEFAULT.equals(implementation);
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (implementation: "); //$NON-NLS-1$
+ result.append(implementation);
+ result.append(", name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //IJavaWebServiceElementImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IServiceEndpointInterfaceImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IServiceEndpointInterfaceImpl.java
new file mode 100755
index 0000000..8d0e51f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IServiceEndpointInterfaceImpl.java
@@ -0,0 +1,522 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IService Endpoint Interface</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#isImplicit <em>Implicit</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getImplementingWebServices <em>Implementing Web Services</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getWebMethods <em>Web Methods</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getTargetNamespace <em>Target Namespace</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getSoapBindingStyle <em>Soap Binding Style</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getSoapBindingUse <em>Soap Binding Use</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IServiceEndpointInterfaceImpl#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IServiceEndpointInterfaceImpl extends IJavaWebServiceElementImpl implements IServiceEndpointInterface {
+ /**
+ * The default value of the '{@link #isImplicit() <em>Implicit</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isImplicit()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean IMPLICIT_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isImplicit() <em>Implicit</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isImplicit()
+ * @generated
+ * @ordered
+ */
+ protected boolean implicit = IMPLICIT_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getImplementingWebServices() <em>Implementing Web Services</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getImplementingWebServices()
+ * @generated
+ * @ordered
+ */
+ protected EList<IWebService> implementingWebServices;
+
+ /**
+ * The cached value of the '{@link #getWebMethods() <em>Web Methods</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getWebMethods()
+ * @generated
+ * @ordered
+ */
+ protected EList<IWebMethod> webMethods;
+
+ /**
+ * The default value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_NAMESPACE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected String targetNamespace = TARGET_NAMESPACE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingStyle() <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingStyle()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingStyle SOAP_BINDING_STYLE_EDEFAULT = SOAPBindingStyle.DOCUMENT;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingStyle() <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingStyle()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingStyle soapBindingStyle = SOAP_BINDING_STYLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingUse() <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingUse()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingUse SOAP_BINDING_USE_EDEFAULT = SOAPBindingUse.LITERAL;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingUse() <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingUse()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingUse soapBindingUse = SOAP_BINDING_USE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingParameterStyle() <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingParameterStyle SOAP_BINDING_PARAMETER_STYLE_EDEFAULT = SOAPBindingParameterStyle.WRAPPED;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingParameterStyle() <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingParameterStyle soapBindingParameterStyle = SOAP_BINDING_PARAMETER_STYLE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IServiceEndpointInterfaceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isImplicit() {
+ return implicit;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setImplicit(boolean newImplicit) {
+ boolean oldImplicit = implicit;
+ implicit = newImplicit;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT, oldImplicit, implicit));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IWebService> getImplementingWebServices() {
+ if (implementingWebServices == null)
+ {
+ implementingWebServices = new EObjectWithInverseResolvingEList<IWebService>(IWebService.class, this, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT);
+ }
+ return implementingWebServices;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IWebMethod> getWebMethods() {
+ if (webMethods == null)
+ {
+ webMethods = new EObjectContainmentEList<IWebMethod>(IWebMethod.class, this, DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS);
+ }
+ return webMethods;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTargetNamespace(String newTargetNamespace) {
+ String oldTargetNamespace = targetNamespace;
+ targetNamespace = newTargetNamespace;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE, oldTargetNamespace, targetNamespace));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingStyle getSoapBindingStyle() {
+ return soapBindingStyle;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingStyle(SOAPBindingStyle newSoapBindingStyle) {
+ SOAPBindingStyle oldSoapBindingStyle = soapBindingStyle;
+ soapBindingStyle = newSoapBindingStyle == null ? SOAP_BINDING_STYLE_EDEFAULT : newSoapBindingStyle;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE, oldSoapBindingStyle, soapBindingStyle));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingUse getSoapBindingUse() {
+ return soapBindingUse;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingUse(SOAPBindingUse newSoapBindingUse) {
+ SOAPBindingUse oldSoapBindingUse = soapBindingUse;
+ soapBindingUse = newSoapBindingUse == null ? SOAP_BINDING_USE_EDEFAULT : newSoapBindingUse;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE, oldSoapBindingUse, soapBindingUse));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingParameterStyle getSoapBindingParameterStyle() {
+ return soapBindingParameterStyle;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingParameterStyle(SOAPBindingParameterStyle newSoapBindingParameterStyle) {
+ SOAPBindingParameterStyle oldSoapBindingParameterStyle = soapBindingParameterStyle;
+ soapBindingParameterStyle = newSoapBindingParameterStyle == null ? SOAP_BINDING_PARAMETER_STYLE_EDEFAULT : newSoapBindingParameterStyle;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE, oldSoapBindingParameterStyle, soapBindingParameterStyle));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getImplementingWebServices()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ return ((InternalEList<?>)getImplementingWebServices()).basicRemove(otherEnd, msgs);
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ return ((InternalEList<?>)getWebMethods()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT:
+ return isImplicit();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ return getImplementingWebServices();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ return getWebMethods();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ return getTargetNamespace();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE:
+ return getSoapBindingStyle();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE:
+ return getSoapBindingUse();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE:
+ return getSoapBindingParameterStyle();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT:
+ setImplicit((Boolean)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ getImplementingWebServices().clear();
+ getImplementingWebServices().addAll((Collection<? extends IWebService>)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ getWebMethods().clear();
+ getWebMethods().addAll((Collection<? extends IWebMethod>)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ setTargetNamespace((String)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE:
+ setSoapBindingStyle((SOAPBindingStyle)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE:
+ setSoapBindingUse((SOAPBindingUse)newValue);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE:
+ setSoapBindingParameterStyle((SOAPBindingParameterStyle)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT:
+ setImplicit(IMPLICIT_EDEFAULT);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ getImplementingWebServices().clear();
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ getWebMethods().clear();
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ setTargetNamespace(TARGET_NAMESPACE_EDEFAULT);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE:
+ setSoapBindingStyle(SOAP_BINDING_STYLE_EDEFAULT);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE:
+ setSoapBindingUse(SOAP_BINDING_USE_EDEFAULT);
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE:
+ setSoapBindingParameterStyle(SOAP_BINDING_PARAMETER_STYLE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT:
+ return implicit != IMPLICIT_EDEFAULT;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES:
+ return implementingWebServices != null && !implementingWebServices.isEmpty();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ return webMethods != null && !webMethods.isEmpty();
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ return TARGET_NAMESPACE_EDEFAULT == null ? targetNamespace != null : !TARGET_NAMESPACE_EDEFAULT.equals(targetNamespace);
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE:
+ return soapBindingStyle != SOAP_BINDING_STYLE_EDEFAULT;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE:
+ return soapBindingUse != SOAP_BINDING_USE_EDEFAULT;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE:
+ return soapBindingParameterStyle != SOAP_BINDING_PARAMETER_STYLE_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (implicit: "); //$NON-NLS-1$
+ result.append(implicit);
+ result.append(", targetNamespace: "); //$NON-NLS-1$
+ result.append(targetNamespace);
+ result.append(", soapBindingStyle: "); //$NON-NLS-1$
+ result.append(soapBindingStyle);
+ result.append(", soapBindingUse: "); //$NON-NLS-1$
+ result.append(soapBindingUse);
+ result.append(", soapBindingParameterStyle: "); //$NON-NLS-1$
+ result.append(soapBindingParameterStyle);
+ result.append(')');
+ return result.toString();
+ }
+
+ @Override
+ public EObject eContainer()
+ {
+ if (super.eContainer()!=null) {
+ return super.eContainer();
+ }
+
+ for (IWebService ws : getImplementingWebServices()) {
+ if (ws.eContainer()!=null) {
+ return ws.eContainer();
+ }
+ }
+
+ return null;
+ }
+
+} //IServiceEndpointInterfaceImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebMethodImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebMethodImpl.java
new file mode 100755
index 0000000..6bba49a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebMethodImpl.java
@@ -0,0 +1,397 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IWeb Method</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl#getParameters <em>Parameters</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl#isExcluded <em>Excluded</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl#getSoapBindingStyle <em>Soap Binding Style</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl#getSoapBindingUse <em>Soap Binding Use</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebMethodImpl#getSoapBindingParameterStyle <em>Soap Binding Parameter Style</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IWebMethodImpl extends IJavaWebServiceElementImpl implements IWebMethod {
+ /**
+ * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getParameters()
+ * @generated
+ * @ordered
+ */
+ protected EList<IWebParam> parameters;
+
+ /**
+ * The default value of the '{@link #isExcluded() <em>Excluded</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcluded()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean EXCLUDED_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isExcluded() <em>Excluded</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcluded()
+ * @generated
+ * @ordered
+ */
+ protected boolean excluded = EXCLUDED_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingStyle() <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingStyle()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingStyle SOAP_BINDING_STYLE_EDEFAULT = SOAPBindingStyle.DOCUMENT;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingStyle() <em>Soap Binding Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingStyle()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingStyle soapBindingStyle = SOAP_BINDING_STYLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingUse() <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingUse()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingUse SOAP_BINDING_USE_EDEFAULT = SOAPBindingUse.LITERAL;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingUse() <em>Soap Binding Use</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingUse()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingUse soapBindingUse = SOAP_BINDING_USE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSoapBindingParameterStyle() <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ * @ordered
+ */
+ protected static final SOAPBindingParameterStyle SOAP_BINDING_PARAMETER_STYLE_EDEFAULT = SOAPBindingParameterStyle.WRAPPED;
+
+ /**
+ * The cached value of the '{@link #getSoapBindingParameterStyle() <em>Soap Binding Parameter Style</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSoapBindingParameterStyle()
+ * @generated
+ * @ordered
+ */
+ protected SOAPBindingParameterStyle soapBindingParameterStyle = SOAP_BINDING_PARAMETER_STYLE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebMethodImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IWEB_METHOD;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IWebParam> getParameters() {
+ if (parameters == null)
+ {
+ parameters = new EObjectContainmentEList<IWebParam>(IWebParam.class, this, DomPackage.IWEB_METHOD__PARAMETERS);
+ }
+ return parameters;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isExcluded() {
+ return excluded;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setExcluded(boolean newExcluded) {
+ boolean oldExcluded = excluded;
+ excluded = newExcluded;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_METHOD__EXCLUDED, oldExcluded, excluded));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingStyle getSoapBindingStyle() {
+ return soapBindingStyle;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingStyle(SOAPBindingStyle newSoapBindingStyle) {
+ SOAPBindingStyle oldSoapBindingStyle = soapBindingStyle;
+ soapBindingStyle = newSoapBindingStyle == null ? SOAP_BINDING_STYLE_EDEFAULT : newSoapBindingStyle;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE, oldSoapBindingStyle, soapBindingStyle));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingUse getSoapBindingUse() {
+ return soapBindingUse;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingUse(SOAPBindingUse newSoapBindingUse) {
+ SOAPBindingUse oldSoapBindingUse = soapBindingUse;
+ soapBindingUse = newSoapBindingUse == null ? SOAP_BINDING_USE_EDEFAULT : newSoapBindingUse;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_METHOD__SOAP_BINDING_USE, oldSoapBindingUse, soapBindingUse));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SOAPBindingParameterStyle getSoapBindingParameterStyle() {
+ return soapBindingParameterStyle;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSoapBindingParameterStyle(SOAPBindingParameterStyle newSoapBindingParameterStyle) {
+ SOAPBindingParameterStyle oldSoapBindingParameterStyle = soapBindingParameterStyle;
+ soapBindingParameterStyle = newSoapBindingParameterStyle == null ? SOAP_BINDING_PARAMETER_STYLE_EDEFAULT : newSoapBindingParameterStyle;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE, oldSoapBindingParameterStyle, soapBindingParameterStyle));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ return getParameters();
+ case DomPackage.IWEB_METHOD__EXCLUDED:
+ return isExcluded();
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE:
+ return getSoapBindingStyle();
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_USE:
+ return getSoapBindingUse();
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE:
+ return getSoapBindingParameterStyle();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ getParameters().clear();
+ getParameters().addAll((Collection<? extends IWebParam>)newValue);
+ return;
+ case DomPackage.IWEB_METHOD__EXCLUDED:
+ setExcluded((Boolean)newValue);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE:
+ setSoapBindingStyle((SOAPBindingStyle)newValue);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_USE:
+ setSoapBindingUse((SOAPBindingUse)newValue);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE:
+ setSoapBindingParameterStyle((SOAPBindingParameterStyle)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ getParameters().clear();
+ return;
+ case DomPackage.IWEB_METHOD__EXCLUDED:
+ setExcluded(EXCLUDED_EDEFAULT);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE:
+ setSoapBindingStyle(SOAP_BINDING_STYLE_EDEFAULT);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_USE:
+ setSoapBindingUse(SOAP_BINDING_USE_EDEFAULT);
+ return;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE:
+ setSoapBindingParameterStyle(SOAP_BINDING_PARAMETER_STYLE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ return parameters != null && !parameters.isEmpty();
+ case DomPackage.IWEB_METHOD__EXCLUDED:
+ return excluded != EXCLUDED_EDEFAULT;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE:
+ return soapBindingStyle != SOAP_BINDING_STYLE_EDEFAULT;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_USE:
+ return soapBindingUse != SOAP_BINDING_USE_EDEFAULT;
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE:
+ return soapBindingParameterStyle != SOAP_BINDING_PARAMETER_STYLE_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (excluded: "); //$NON-NLS-1$
+ result.append(excluded);
+ result.append(", soapBindingStyle: "); //$NON-NLS-1$
+ result.append(soapBindingStyle);
+ result.append(", soapBindingUse: "); //$NON-NLS-1$
+ result.append(soapBindingUse);
+ result.append(", soapBindingParameterStyle: "); //$NON-NLS-1$
+ result.append(soapBindingParameterStyle);
+ result.append(')');
+ return result.toString();
+ }
+
+} //IWebMethodImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebParamImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebParamImpl.java
new file mode 100755
index 0000000..61504e9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebParamImpl.java
@@ -0,0 +1,389 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IWeb Param</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl#getKind <em>Kind</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl#getTypeName <em>Type Name</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl#getPartName <em>Part Name</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl#getTargetNamespace <em>Target Namespace</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebParamImpl#isHeader <em>Header</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IWebParamImpl extends IJavaWebServiceElementImpl implements IWebParam {
+ /**
+ * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected static final WebParamKind KIND_EDEFAULT = WebParamKind.IN;
+
+ /**
+ * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected WebParamKind kind = KIND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTypeName()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTypeName()
+ * @generated
+ * @ordered
+ */
+ protected String typeName = TYPE_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPartName() <em>Part Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPartName()
+ * @generated
+ * @ordered
+ */
+ protected static final String PART_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPartName() <em>Part Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPartName()
+ * @generated
+ * @ordered
+ */
+ protected String partName = PART_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_NAMESPACE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected String targetNamespace = TARGET_NAMESPACE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isHeader() <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isHeader()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean HEADER_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isHeader() <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isHeader()
+ * @generated
+ * @ordered
+ */
+ protected boolean header = HEADER_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebParamImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IWEB_PARAM;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public WebParamKind getKind() {
+ return kind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setKind(WebParamKind newKind) {
+ WebParamKind oldKind = kind;
+ kind = newKind == null ? KIND_EDEFAULT : newKind;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_PARAM__KIND, oldKind, kind));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTypeName(String newTypeName) {
+ String oldTypeName = typeName;
+ typeName = newTypeName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_PARAM__TYPE_NAME, oldTypeName, typeName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPartName() {
+ return partName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPartName(String newPartName) {
+ String oldPartName = partName;
+ partName = newPartName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_PARAM__PART_NAME, oldPartName, partName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTargetNamespace(String newTargetNamespace) {
+ String oldTargetNamespace = targetNamespace;
+ targetNamespace = newTargetNamespace;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_PARAM__TARGET_NAMESPACE, oldTargetNamespace, targetNamespace));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isHeader() {
+ return header;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setHeader(boolean newHeader) {
+ boolean oldHeader = header;
+ header = newHeader;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_PARAM__HEADER, oldHeader, header));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_PARAM__KIND:
+ return getKind();
+ case DomPackage.IWEB_PARAM__TYPE_NAME:
+ return getTypeName();
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ return getPartName();
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ return getTargetNamespace();
+ case DomPackage.IWEB_PARAM__HEADER:
+ return isHeader();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_PARAM__KIND:
+ setKind((WebParamKind)newValue);
+ return;
+ case DomPackage.IWEB_PARAM__TYPE_NAME:
+ setTypeName((String)newValue);
+ return;
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ setPartName((String)newValue);
+ return;
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ setTargetNamespace((String)newValue);
+ return;
+ case DomPackage.IWEB_PARAM__HEADER:
+ setHeader((Boolean)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_PARAM__KIND:
+ setKind(KIND_EDEFAULT);
+ return;
+ case DomPackage.IWEB_PARAM__TYPE_NAME:
+ setTypeName(TYPE_NAME_EDEFAULT);
+ return;
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ setPartName(PART_NAME_EDEFAULT);
+ return;
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ setTargetNamespace(TARGET_NAMESPACE_EDEFAULT);
+ return;
+ case DomPackage.IWEB_PARAM__HEADER:
+ setHeader(HEADER_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_PARAM__KIND:
+ return kind != KIND_EDEFAULT;
+ case DomPackage.IWEB_PARAM__TYPE_NAME:
+ return TYPE_NAME_EDEFAULT == null ? typeName != null : !TYPE_NAME_EDEFAULT.equals(typeName);
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ return PART_NAME_EDEFAULT == null ? partName != null : !PART_NAME_EDEFAULT.equals(partName);
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ return TARGET_NAMESPACE_EDEFAULT == null ? targetNamespace != null : !TARGET_NAMESPACE_EDEFAULT.equals(targetNamespace);
+ case DomPackage.IWEB_PARAM__HEADER:
+ return header != HEADER_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (kind: "); //$NON-NLS-1$
+ result.append(kind);
+ result.append(", typeName: "); //$NON-NLS-1$
+ result.append(typeName);
+ result.append(", partName: "); //$NON-NLS-1$
+ result.append(partName);
+ result.append(", targetNamespace: "); //$NON-NLS-1$
+ result.append(targetNamespace);
+ result.append(", header: "); //$NON-NLS-1$
+ result.append(header);
+ result.append(')');
+ return result.toString();
+ }
+
+} //IWebParamImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceImpl.java
new file mode 100755
index 0000000..4e845e1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceImpl.java
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IWeb Service</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl#getServiceEndpoint <em>Service Endpoint</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl#getTargetNamespace <em>Target Namespace</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl#getPortName <em>Port Name</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceImpl#getWsdlLocation <em>Wsdl Location</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IWebServiceImpl extends IJavaWebServiceElementImpl implements IWebService {
+ /**
+ * The cached value of the '{@link #getServiceEndpoint() <em>Service Endpoint</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getServiceEndpoint()
+ * @generated
+ * @ordered
+ */
+ protected IServiceEndpointInterface serviceEndpoint;
+
+ /**
+ * The default value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_NAMESPACE_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetNamespace()
+ * @generated
+ * @ordered
+ */
+ protected String targetNamespace = TARGET_NAMESPACE_EDEFAULT;
+ /**
+ * The default value of the '{@link #getPortName() <em>Port Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPortName()
+ * @generated
+ * @ordered
+ */
+ protected static final String PORT_NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getPortName() <em>Port Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPortName()
+ * @generated
+ * @ordered
+ */
+ protected String portName = PORT_NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getWsdlLocation() <em>Wsdl Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getWsdlLocation()
+ * @generated
+ * @ordered
+ */
+ protected static final String WSDL_LOCATION_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getWsdlLocation() <em>Wsdl Location</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getWsdlLocation()
+ * @generated
+ * @ordered
+ */
+ protected String wsdlLocation = WSDL_LOCATION_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebServiceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IWEB_SERVICE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IServiceEndpointInterface getServiceEndpoint() {
+ if (serviceEndpoint != null && serviceEndpoint.eIsProxy())
+ {
+ InternalEObject oldServiceEndpoint = (InternalEObject)serviceEndpoint;
+ serviceEndpoint = (IServiceEndpointInterface)eResolveProxy(oldServiceEndpoint);
+ if (serviceEndpoint != oldServiceEndpoint)
+ {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, oldServiceEndpoint, serviceEndpoint));
+ }
+ }
+ return serviceEndpoint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IServiceEndpointInterface basicGetServiceEndpoint() {
+ return serviceEndpoint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetServiceEndpoint(IServiceEndpointInterface newServiceEndpoint, NotificationChain msgs) {
+ IServiceEndpointInterface oldServiceEndpoint = serviceEndpoint;
+ serviceEndpoint = newServiceEndpoint;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, oldServiceEndpoint, newServiceEndpoint);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setServiceEndpoint(IServiceEndpointInterface newServiceEndpoint) {
+ if (newServiceEndpoint != serviceEndpoint)
+ {
+ NotificationChain msgs = null;
+ if (serviceEndpoint != null)
+ msgs = ((InternalEObject)serviceEndpoint).eInverseRemove(this, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES, IServiceEndpointInterface.class, msgs);
+ if (newServiceEndpoint != null)
+ msgs = ((InternalEObject)newServiceEndpoint).eInverseAdd(this, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES, IServiceEndpointInterface.class, msgs);
+ msgs = basicSetServiceEndpoint(newServiceEndpoint, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, newServiceEndpoint, newServiceEndpoint));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTargetNamespace(String newTargetNamespace) {
+ String oldTargetNamespace = targetNamespace;
+ targetNamespace = newTargetNamespace;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE__TARGET_NAMESPACE, oldTargetNamespace, targetNamespace));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPortName() {
+ return portName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPortName(String newPortName) {
+ String oldPortName = portName;
+ portName = newPortName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE__PORT_NAME, oldPortName, portName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getWsdlLocation() {
+ return wsdlLocation;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setWsdlLocation(String newWsdlLocation) {
+ String oldWsdlLocation = wsdlLocation;
+ wsdlLocation = newWsdlLocation;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE__WSDL_LOCATION, oldWsdlLocation, wsdlLocation));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ if (serviceEndpoint != null)
+ msgs = ((InternalEObject)serviceEndpoint).eInverseRemove(this, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES, IServiceEndpointInterface.class, msgs);
+ return basicSetServiceEndpoint((IServiceEndpointInterface)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ return basicSetServiceEndpoint(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ if (resolve) return getServiceEndpoint();
+ return basicGetServiceEndpoint();
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ return getTargetNamespace();
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ return getPortName();
+ case DomPackage.IWEB_SERVICE__WSDL_LOCATION:
+ return getWsdlLocation();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ setServiceEndpoint((IServiceEndpointInterface)newValue);
+ return;
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ setTargetNamespace((String)newValue);
+ return;
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ setPortName((String)newValue);
+ return;
+ case DomPackage.IWEB_SERVICE__WSDL_LOCATION:
+ setWsdlLocation((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ setServiceEndpoint((IServiceEndpointInterface)null);
+ return;
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ setTargetNamespace(TARGET_NAMESPACE_EDEFAULT);
+ return;
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ setPortName(PORT_NAME_EDEFAULT);
+ return;
+ case DomPackage.IWEB_SERVICE__WSDL_LOCATION:
+ setWsdlLocation(WSDL_LOCATION_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ return serviceEndpoint != null;
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ return TARGET_NAMESPACE_EDEFAULT == null ? targetNamespace != null : !TARGET_NAMESPACE_EDEFAULT.equals(targetNamespace);
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ return PORT_NAME_EDEFAULT == null ? portName != null : !PORT_NAME_EDEFAULT.equals(portName);
+ case DomPackage.IWEB_SERVICE__WSDL_LOCATION:
+ return WSDL_LOCATION_EDEFAULT == null ? wsdlLocation != null : !WSDL_LOCATION_EDEFAULT.equals(wsdlLocation);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (targetNamespace: "); //$NON-NLS-1$
+ result.append(targetNamespace);
+ result.append(", portName: "); //$NON-NLS-1$
+ result.append(portName);
+ result.append(", wsdlLocation: "); //$NON-NLS-1$
+ result.append(wsdlLocation);
+ result.append(')');
+ return result.toString();
+ }
+
+} //IWebServiceImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceProjectImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceProjectImpl.java
new file mode 100755
index 0000000..9b13f3e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebServiceProjectImpl.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IWeb Service Project</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl#getWebServices <em>Web Services</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl#getServiceEndpointInterfaces <em>Service Endpoint Interfaces</em>}</li>
+ * <li>{@link org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl.IWebServiceProjectImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IWebServiceProjectImpl extends EObjectImpl implements IWebServiceProject {
+ /**
+ * The cached value of the '{@link #getWebServices() <em>Web Services</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getWebServices()
+ * @generated
+ * @ordered
+ */
+ protected EList<IWebService> webServices;
+
+ /**
+ * The cached value of the '{@link #getServiceEndpointInterfaces() <em>Service Endpoint Interfaces</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getServiceEndpointInterfaces()
+ * @generated
+ * @ordered
+ */
+ protected EList<IServiceEndpointInterface> serviceEndpointInterfaces;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebServiceProjectImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IWEB_SERVICE_PROJECT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IWebService> getWebServices() {
+ if (webServices == null)
+ {
+ webServices = new EObjectContainmentEList<IWebService>(IWebService.class, this, DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES);
+ }
+ return webServices;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<IServiceEndpointInterface> getServiceEndpointInterfaces() {
+ if (serviceEndpointInterfaces == null)
+ {
+ serviceEndpointInterfaces = new EObjectContainmentEList<IServiceEndpointInterface>(IServiceEndpointInterface.class, this, DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES);
+ }
+ return serviceEndpointInterfaces;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.IWEB_SERVICE_PROJECT__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ return ((InternalEList<?>)getWebServices()).basicRemove(otherEnd, msgs);
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ return ((InternalEList<?>)getServiceEndpointInterfaces()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ return getWebServices();
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ return getServiceEndpointInterfaces();
+ case DomPackage.IWEB_SERVICE_PROJECT__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ getWebServices().clear();
+ getWebServices().addAll((Collection<? extends IWebService>)newValue);
+ return;
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ getServiceEndpointInterfaces().clear();
+ getServiceEndpointInterfaces().addAll((Collection<? extends IServiceEndpointInterface>)newValue);
+ return;
+ case DomPackage.IWEB_SERVICE_PROJECT__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ getWebServices().clear();
+ return;
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ getServiceEndpointInterfaces().clear();
+ return;
+ case DomPackage.IWEB_SERVICE_PROJECT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID)
+ {
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ return webServices != null && !webServices.isEmpty();
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ return serviceEndpointInterfaces != null && !serviceEndpointInterfaces.isEmpty();
+ case DomPackage.IWEB_SERVICE_PROJECT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //IWebServiceProjectImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebTypeImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebTypeImpl.java
new file mode 100755
index 0000000..51c598e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/impl/IWebTypeImpl.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.impl;
+
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>IWeb Type</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class IWebTypeImpl extends IJavaWebServiceElementImpl implements IWebType {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebTypeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DomPackage.Literals.IWEB_TYPE;
+ }
+
+} //IWebTypeImpl
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimeMessages.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimeMessages.java
new file mode 100755
index 0000000..89af113
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimeMessages.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JaxWsDomRuntimeMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.messages"; //$NON-NLS-1$
+
+ public static String AbstractClassNotImplementedException_Error_Message;
+ public static String ConstructorNotExposableException_Error_Message;
+ public static String EndpointTypeValidator_ERR_MSG_BINARYCLASS;
+ public static String EndpointTypeValidator_ERR_MSG_NOTCLASS;
+ public static String EndpointTypeValidator_ERR_MSG_ABSTRACT;
+ public static String EndpointTypeValidator_ERR_MSG_CONSTRUCTOR;
+ public static String EndpointTypeValidator_ERR_MSG_NOTPUBLIC;
+ public static String EndpointTypeValidator_ERR_MSG_FINAL;
+ public static String EndpointTypeValidator_ERR_MSG_HASFINALYZE;
+ public static String HasInadmisableInnerTypesException_Error_Message;
+ public static String InheritanceAndImplementationExecption_Error_Message;
+ public static String InterfacesNotSupportedException_Error_Message;
+ public static String MethodNotPublicException_Error_Message;
+ public static String MultipleImplementationException_Error_Message;
+ public static String RemoteObjectException_Error_Message;
+ public static String WsDomStartupParticipant_Startup_Job_Message;
+ public static String WorkspaceCUFinder_LOADING_CANCELED;
+ public static String JAXWS_DOM_LOADING;
+
+ public static String SeiImplementationValidator_METHOD_NOT_FOUND;
+ public static String SeiImplementationValidator_METHOD_HASDIFFERENT_EXCEPTIONS;
+ public static String SeiImplementationValidator_METHOD_NOT_PUBLIC;
+
+ public static String SeiValidator_NOT_COMPILATIONUNIT_MSG;
+ public static String SeiValidator_NOT_INTERFACE_MSG;
+ public static String SeiValidator_NOT_OUTER_MSG;
+ public static String SeiValidator_NOT_PUBLIC_MSG;
+ public static String TypeNotFoundException_Error_Message;
+ public static String TargetNsValidUriConstraint_URI_SYNTAX_ERROR;
+
+ public static String DomValidationConstraintDescriptor_WS_DOM_VALIDATION_CONSTRAINT;
+
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, JaxWsDomRuntimeMessages.class);
+ }
+
+ private JaxWsDomRuntimeMessages() {
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimePlugin.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimePlugin.java
new file mode 100755
index 0000000..a9f8fd8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/JaxWsDomRuntimePlugin.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JaxWsDomRuntimePlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxws.dom.runtime";
+
+ // The shared instance
+ private static JaxWsDomRuntimePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JaxWsDomRuntimePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JaxWsDomRuntimePlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/messages.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/messages.properties
new file mode 100755
index 0000000..d51975e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/plugin/messages.properties
@@ -0,0 +1,43 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+AbstractClassNotImplementedException_Error_Message=Abstract class {0} cannot be used as runtime class because it is not extended by non abstract class which is suitable for a runtime class
+ConstructorNotExposableException_Error_Message=Constructor {0} cannot be exposed as web service operation
+EndpointTypeValidator_ERR_MSG_BINARYCLASS = Class {0} is binary class and cannot be annotated
+EndpointTypeValidator_ERR_MSG_NOTCLASS = {0} is not a class
+EndpointTypeValidator_ERR_MSG_ABSTRACT = Class {0} is abstract
+EndpointTypeValidator_ERR_MSG_CONSTRUCTOR = Class {0} does not have a default constructor
+EndpointTypeValidator_ERR_MSG_NOTPUBLIC = Class {0} is not public and cannot be used as web service endpoint
+EndpointTypeValidator_ERR_MSG_FINAL = Class {0} is final and cannot be used as web service endpoint
+EndpointTypeValidator_ERR_MSG_HASFINALYZE = Class {0} contains finalize() method and cannot be used as web service endpoint
+HasInadmisableInnerTypesException_Error_Message=Class {0} has inner types that are not public and static
+InheritanceAndImplementationExecption_Error_Message=Class {0} extends {1} and implements custom interface (multiple inheritance is not allowed)
+InterfacesNotSupportedException_Error_Message={0} is a interface, and JAXB cannot handle interfaces
+MethodNotPublicException_Error_Message=Method {0} is not public and cannot be exposed as a web service operation
+MultipleImplementationException_Error_Message=Class {0} implements both interface {1} and interface {2} (multiple inheritance is not allowed)
+RemoteObjectException_Error_Message=Class {0} is a remote Object
+
+
+WsDomStartupParticipant_Startup_Job_Message =Loading Web Service DOM...
+WorkspaceCUFinder_LOADING_CANCELED=JAX-WS DOM loading canceled
+JAXWS_DOM_LOADING=Loading DOM for JAX-WS Web Services
+SeiImplementationValidator_METHOD_NOT_FOUND = Method {0} cannot be found in the implementation bean {1}. It is required that the bean implements all the methods of the specified service endpoint interface
+SeiImplementationValidator_METHOD_HASDIFFERENT_EXCEPTIONS = Method {0} in the implementation bean {1} is declared to throw exceptions that differ from exceptions thrown by the same method in the service endpoint interface
+SeiImplementationValidator_METHOD_NOT_PUBLIC= Method {0} in the implementation bean {1} is not public and therefore cannot be exposed as a web service operation
+
+
+SeiValidator_NOT_COMPILATIONUNIT_MSG = {0} is a binary interface and cannot annotated as a service endpoint interface
+SeiValidator_NOT_INTERFACE_MSG = {0} is not a interface and cannot be used as a service endpoint interface
+SeiValidator_NOT_OUTER_MSG = {0} is not a outer interface and cannot be used as a service endpoint interface
+SeiValidator_NOT_PUBLIC_MSG = {0} is not a public interface and cannot be used as a service endpoint interface
+TypeNotFoundException_Error_Message=Class {0} cannot be found
+
+DomValidationConstraintDescriptor_WS_DOM_VALIDATION_CONSTRAINT=WebService DOM validation constraint
+TargetNsValidUriConstraint_URI_SYNTAX_ERROR=URI syntax error at index {0} of input String ''{1}''. Reason: {2}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/NamedExtensionInfo.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/NamedExtensionInfo.java
new file mode 100755
index 0000000..97ca51f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/NamedExtensionInfo.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.util;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.INamedExtensionInfo;
+
+/**
+ * Implementation class for {@link INamedExtensionInfo}.
+ */
+public class NamedExtensionInfo implements INamedExtensionInfo
+{
+ private final String id;
+
+ private final String name;
+
+ protected NamedExtensionInfo(final String pId, final String pLabel)
+ {
+ this.id = pId;
+ this.name = pLabel;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/XpUtil.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/XpUtil.java
new file mode 100755
index 0000000..46422b1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/util/XpUtil.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.util;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+
+/**
+ * Utility class for working with extendion points.
+ */
+public final class XpUtil
+{
+ private static final String EXTENSION_NOT_PROPERLY_REGISTERED = "ConsumerType extension not properly registered (error in plugin.xml)"; //$NON-NLS-1$
+
+ /** */
+ public static final String XP_IMPLEMENTATION_ELEMENT = "implementation"; //$NON-NLS-1$
+
+ /** */
+ public static final String XP_IMPLEMENTATION_ELEMENT_CLASS_ATTR = "class"; //$NON-NLS-1$
+
+ /**
+ * Creates and returns a new instance of the executable extension.
+ *
+ * @param ext
+ * @return instance of extention implementation
+ */
+ public static Object instantiateImplementation(final IExtension ext)
+ {
+ for (IConfigurationElement el : ext.getConfigurationElements())
+ {
+ if (el.getName().equals(XP_IMPLEMENTATION_ELEMENT))
+ {
+ try
+ {
+ return el.createExecutableExtension(XP_IMPLEMENTATION_ELEMENT_CLASS_ATTR);
+ } catch (final CoreException e)
+ {
+ logger().logError("Unable to create extension", e); //$NON-NLS-1$
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ logger().logError(EXTENSION_NOT_PROPERLY_REGISTERED);
+ throw new RuntimeException(EXTENSION_NOT_PROPERLY_REGISTERED);
+ }
+
+ private static ILogger logger()
+ {
+ return new Logger();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeAdapter.java
new file mode 100755
index 0000000..66dc247
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeAdapter.java
@@ -0,0 +1,313 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.GeneralTypesNames;
+import org.eclipse.jst.ws.jaxws.dom.runtime.TypeResolver;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.TypeNotFoundException;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+/**
+ * TypeProxy represents a type in a way convienient for type checking.
+ *
+ * @author Georgi Vachkov
+ */
+public class TypeAdapter
+{
+ private final IType type;
+
+ private String superClassName;
+
+ /**
+ * Constructor.
+ *
+ * @param type
+ * @throws NullPointerException -
+ * in case <code>type</code> is null.
+ */
+ public TypeAdapter(IType type)
+ {
+ ContractChecker.nullCheckParam(type, "type");
+ this.type = type;
+ }
+
+ /**
+ * Checks for default constructor in analysed class.
+ *
+ * @return true if public constructor without paramethers exists or class does not have any constructor.
+ * @throws JavaModelException
+ */
+ public boolean hasDefaultConstructor() throws JavaModelException
+ {
+ boolean hasConstructor = false;
+ boolean isPublic = false;
+
+ for (IMethod method : type.getMethods())
+ {
+ isPublic = Flags.isPublic(method.getFlags());
+ if (method.isConstructor())
+ {
+ hasConstructor = true;
+ }
+
+ if (method.isConstructor() && isPublic && method.getParameterNames().length == 0)
+ {
+ return true;
+ }
+ }
+
+ return !hasConstructor;
+ }
+
+ /**
+ * Retrieves the direct super interfaces fully qualified names.
+ *
+ * @return list of interface names - in case no interfaces are implemented an empty array is returned
+ * @throws JavaModelException
+ */
+ public final List<String> getInterfaceNames() throws JavaModelException
+ {
+ String[] iNames = type.getSuperInterfaceNames();
+ List<String> interfaceNames = new ArrayList<String>(iNames.length);
+ for (String name : iNames)
+ {
+ String resolvedName = TypeResolver.resolveType(name, type);
+ interfaceNames.add(resolvedName);
+ }
+
+ return interfaceNames;
+ }
+
+ /**
+ * Checks if the class contains non static and non public inner classes.
+ *
+ * @return true if contains such
+ * @throws JavaModelException
+ */
+ public boolean hasNonStaticOrNonPublicInnerTypes() throws JavaModelException
+ {
+ for (IType t : type.getTypes())
+ {
+ int typeFlags = t.getFlags();
+ if (!Flags.isStatic(typeFlags) || !Flags.isPublic(typeFlags))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Retrieves the name of it's superclass
+ *
+ * @return returnes resolved super class name or null if not present
+ * @throws JavaModelException
+ */
+ public final String getSuperClassName() throws JavaModelException
+ {
+ if (type.getSuperclassName() != null && superClassName == null)
+ {
+ superClassName = TypeResolver.resolveType(type.getSuperclassName(), type);
+ }
+
+ return superClassName;
+ }
+
+ /**
+ * Resolves and creates an instance of TypeProxy for super class.
+ *
+ * @return returns instance of {@link TypeAdapter} for super class or null if not present
+ * @throws JavaModelException
+ * @throws TypeNotFoundException
+ */
+ public final TypeAdapter getSuperClassType() throws TypeNotFoundException, JavaModelException
+ {
+ if (getSuperClassName() == null)
+ return null;
+
+ return new TypeAdapter(TypeFactory.create(getSuperClassName(), getType()));
+ }
+
+ /**
+ * Defines if this class extends <tt>baseClassType</tt>
+ *
+ * @param baseClassType
+ * @return check if this class type extends <tt>baseClassType</tt>
+ * @throws TypeNotFoundException
+ * @throws JavaModelException
+ */
+ public boolean isExtending(String baseClassType) throws TypeNotFoundException, JavaModelException
+ {
+ String typeName = this.getQualifiedName();
+
+ // if we have arrived at object in the hierarchy, the type cannot be an exception
+ if (typeName.equals(GeneralTypesNames.JAVA_LANG_OBJECT))
+ {
+ return false;
+ }
+ // All exceptions inherit from Throwable
+ if (typeName.equals(baseClassType))
+ {
+ return true;
+ }
+
+ TypeAdapter parentType = getSuperClassType();
+ if (parentType != null)
+ {
+ return parentType.isExtending(baseClassType);
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if <code>type</code> implements interface <code>checkedInterfaceName</code>. Recursive check over the implemented interfaces is
+ * done which defines if some of the implemented in <code>type</code> interface is extending the specified interface.
+ *
+ * @param interfaceName
+ * @return true is this class type implements <tt>interfaceName</tt>
+ * @throws TypeNotFoundException
+ * @throws JavaModelException
+ */
+ public boolean isImplementing(final String interfaceName) throws TypeNotFoundException, JavaModelException
+ {
+ return isImplementing(this, interfaceName);
+ }
+
+ private boolean isImplementing(final TypeAdapter checkedType, final String checkedInterfaceName) throws TypeNotFoundException, JavaModelException
+
+ {
+ if (checkedType.getQualifiedName().equals(checkedInterfaceName))
+ return true;
+
+ for (String interfaceName : checkedType.getInterfaceNames())
+ {
+ TypeAdapter ta = new TypeAdapter(TypeFactory.create(interfaceName, checkedType.getType()));
+ if (isImplementing(ta, checkedInterfaceName))
+ {
+ return true;
+ }
+ }
+
+ // here use ep checker as seriablizable is not required in supertype
+ if (checkedType.getSuperClassName() != null)
+ {
+ TypeAdapter superClass = new TypeAdapter(TypeFactory.create(checkedType.getSuperClassName(), checkedType.getType()));
+ return isImplementing(superClass, checkedInterfaceName);
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the type fully qualified name
+ *
+ * @return not <tt>null</tt> string
+ */
+ public final String getQualifiedName()
+ {
+ return type.getFullyQualifiedName();
+ }
+
+ /**
+ * Returns the project name in which the type resides.
+ *
+ * @return not <tt>null</tt> string
+ */
+ public final String getProjectName()
+ {
+ return type.getJavaProject().getProject().getName();
+ }
+
+ /**
+ * Returns wrapped IType.
+ *
+ * @return IType instance
+ */
+ public final IType getType()
+ {
+ return type;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return type.getFullyQualifiedName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (obj.getClass() == TypeAdapter.class)
+ {
+ return (getQualifiedName().equals(((TypeAdapter) obj).getQualifiedName()));
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if the type is public.
+ *
+ * @return <tt>true</tt> if the class is public
+ * @throws JavaModelException
+ */
+ public boolean isPublic() throws JavaModelException
+ {
+ return Flags.isPublic(type.getFlags());
+ }
+
+ /**
+ * Checks if the type is final.
+ *
+ * @return <tt>true</tt> if the class is final
+ * @throws JavaModelException
+ */
+ public boolean isFinal() throws JavaModelException
+ {
+ return Flags.isFinal(type.getFlags());
+ }
+
+ /**
+ * Checks if the type is abstract.
+ *
+ * @return <tt>true</tt> if the class is abstract
+ * @throws JavaModelException
+ */
+ public boolean isAbstract() throws JavaModelException
+ {
+ return Flags.isAbstract(type.getFlags());
+ }
+
+ /**
+ * Checks if the type is an interface.
+ *
+ * @return <tt>true</tt> if the class is interface
+ * @throws JavaModelException
+ */
+ public boolean isInterface() throws JavaModelException
+ {
+ return type.isInterface();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeFactory.java
new file mode 100755
index 0000000..af4689b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeFactory.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.PrimitiveTypeHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.TypeNotFoundException;
+
+/**
+ * Factory for IType objects. Contains cache with already found types per project this way minimizing the time needed to obtain an IType instance for
+ * concreate type. Registers ResourceChangedListener to listen for changes in projects. If some resource in some projects has been changed the cache
+ * for this project is cleaned.
+ *
+ * @author Georgi Vachkov
+ */
+public class TypeFactory
+{
+ /**
+ * Analysed types cache.
+ */
+ private static Hashtable<String, Map<String, IType>> typesCache = new Hashtable<String, Map<String, IType>>();
+
+ private static TypeCache cache = null;
+
+ /**
+ * Creates TypeProxy instance for <code>qualifiedName</code> for the project with name <code>projectName</code>.
+ *
+ * @param projectName
+ * @param qualifiedName
+ * @return instance of IType in case type has been found
+ * @throws TypeNotFoundException
+ * if type with fully qualified name <tt>qualifiedName</tt> is not found
+ * @throws JavaModelException
+ */
+ public static IType create(String projectName, String qualifiedName) throws TypeNotFoundException, JavaModelException
+ {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+ return create(JavaCore.create(project), qualifiedName);
+ }
+
+ /**
+ * Finds IType object for <code>qualifiedName</code> for the project in which <code>type</code> resides.
+ *
+ * @param qualifiedName
+ * @param type
+ * @return instance of IType in case type has been found
+ * @throws TypeNotFoundException
+ * if type with fully qualified name <tt>qualifiedName</tt> is not found
+ * @throws JavaModelException
+ */
+ public static IType create(String qualifiedName, IType type) throws TypeNotFoundException, JavaModelException
+ {
+ return create(type.getJavaProject(), qualifiedName);
+ }
+
+ /**
+ * Finds IType object for <code>qualifiedName</code> type in <code>javaProject</code> project. On first steps tries to find this type in cache
+ * and if not found new instance is created.
+ *
+ * @param javaProject
+ * @param qualifiedName
+ * @return instance of IType in case type has been found
+ * @throws TypeNotFoundException
+ * if type with fully qualified name <tt>qualifiedName</tt> is not found
+ * @throws JavaModelException
+ */
+ private static IType create(IJavaProject javaProject, String qualifiedName) throws TypeNotFoundException, JavaModelException
+ {
+ String localQualifiedName = qualifiedName;
+
+ if (PrimitiveTypeHandler.isArrayType(localQualifiedName))
+ {
+ localQualifiedName = PrimitiveTypeHandler.getTypeFromArrayType(localQualifiedName);
+ }
+
+ if (PrimitiveTypeHandler.isJavaPrimitiveType(localQualifiedName))
+ {
+ localQualifiedName = PrimitiveTypeHandler.getObjectTypeForPrimitiveType(localQualifiedName);
+ }
+
+ if (cache == null)
+ {
+ cache = new TypeCache();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(cache);
+ }
+
+ IType type = cache.findType(localQualifiedName, javaProject);
+ if (type != null)
+ {
+ return type;
+ }
+
+ type = javaProject.findType(localQualifiedName);
+ if (type == null)
+ {
+ throw new TypeNotFoundException(localQualifiedName);
+ }
+
+ cache.addType(localQualifiedName, type, javaProject);
+
+ return type;
+ }
+
+ /**
+ * Caching functionality. All types that have been retrieved are cached. Caching is per project. Search is executen in followin way:<br>
+ * 1. Search for chache for the project. If cache is not found an empty cache is created.<br>
+ * 2. Type is searched in the projects cache and is returned. If a type is not found <code>null</code> is returned.
+ *
+ * @author Georgi Vachkov
+ */
+ private static class TypeCache implements IResourceChangeListener
+ {
+ public void resourceChanged(IResourceChangeEvent event)
+ {
+ if (event != null && event.getDelta() != null)
+ {
+ for (IResourceDelta children : event.getDelta().getAffectedChildren())
+ {
+ IResourceDelta rDelta = (IResourceDelta) children.getAdapter(IResourceDelta.class);
+ if (rDelta.getResource() != null && rDelta.getResource() instanceof IProject)
+ {
+ removeMapForProject(rDelta.getResource().getName());
+ }
+ }
+ }
+ }
+
+ protected IType findType(String qualifiedName, IJavaProject javaProject)
+ {
+ return getMapForProject(javaProject).get(qualifiedName);
+ }
+
+ protected void addType(String qualifiedName, IType type, IJavaProject javaProject)
+ {
+ getMapForProject(javaProject).put(qualifiedName, type);
+ }
+
+ private void removeMapForProject(String projectName)
+ {
+ typesCache.remove(projectName);
+ }
+
+ private Map<String, IType> getMapForProject(IJavaProject javaProject)
+ {
+ String projectName = javaProject.getProject().getName();
+ Map<String, IType> projectTypes = typesCache.get(projectName);
+ if (projectTypes == null)
+ {
+ projectTypes = new HashMap<String, IType>();
+ typesCache.put(projectName, projectTypes);
+ }
+
+ return projectTypes;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeKey.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeKey.java
new file mode 100755
index 0000000..3d2aa47
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/internal/validation/provider/TypeKey.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider;
+
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+/**
+ * Type key - represents type in context of project. Overrides hashCode() for usage in maps.
+ *
+ * @author Georgi Vachkov
+ *
+ */
+public class TypeKey
+{
+ private final String projectName;
+
+ private final String qualifiedTypeName;
+
+ /**
+ * Constructor.
+ *
+ * @param projectName
+ * @param qualifiedTypeName
+ * @throws NullPointerException
+ * in case some of the params is null.
+ */
+ public TypeKey(String projectName, String qualifiedTypeName)
+ {
+ ContractChecker.nullCheckParam(projectName, "projectName");
+ ContractChecker.nullCheckParam(qualifiedTypeName, "qualifiedTypeName");
+
+ this.projectName = projectName;
+ this.qualifiedTypeName = qualifiedTypeName;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return projectName.hashCode() + qualifiedTypeName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o instanceof TypeKey)
+ {
+ return ((TypeKey) o).hashCode() == hashCode();
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IAnnotationSerializer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IAnnotationSerializer.java
new file mode 100755
index 0000000..ac8eeee
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IAnnotationSerializer.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.emf.common.notify.Notification;
+
+/**
+ * This interface should be implemented by classes that intend to do serialization for
+ * DOM objects.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IAnnotationSerializer
+{
+ public void save(final Notification msg);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitFinder.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitFinder.java
new file mode 100755
index 0000000..3d6690e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitFinder.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+
+/**
+ * Implements a visitor pattern for traversing compilation unit. This interface does not define what set of compilation
+ * units will be traveresed. This could be a single java project, the whole workspace or just a given package. The set of
+ * traversed compilation units is left up to the implementation. Nevertheless as these compilation units are always contained
+ * inside a java project, the </c>ICompilationUnitHandler.handleProject(IJavaProject)</c> has to be called exactly once to
+ * notify the handler for each project being processed. The compilation unit handler will be first notified that the processing
+ * of given project has began and immediately after this it will be notified for all annotations in this project discovered by
+ * the given implementation.
+ * @author Hristo Sabev
+ *
+ */
+public interface ICompilationUnitFinder
+{
+ /**
+ * Starts the traversal of compilation units
+ * @param monitor - the progress monitor to be used for the traversal.
+ * @param cuHandler - compilation unit handler to be notified for a given project
+ * @throws CoreException - thrown if unexpected problem occurred while traversing annotations
+ */
+ public void find(IProgressMonitor monitor, ICompilationUnitHandler cuHandler) throws CoreException, WsDOMLoadCanceledException;
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitHandler.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitHandler.java
new file mode 100755
index 0000000..93a315c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/ICompilationUnitHandler.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+
+/**
+ * A listener for events isseud by an <c>ICompilationUnitFinder</c> instance during compilation unit traversals
+ *
+ * @author Hristo Sabev
+ *
+ */
+public interface ICompilationUnitHandler
+{
+ /**
+ * called by the <c>{@link ICompilationUnitFinder}</c> instance when it has started to traverse the annotation set. All calls to <c>handle(...)</c>
+ * methods is inside a started-finished block.
+ */
+ public void started();
+
+ /**
+ * called by the <c>{@link ICompilationUnitFinder}</c> instance when it has finished to traverse the annotation set.
+ */
+ public void finished();
+
+ /**
+ * Called when the <c>{@link ICompilationUnitFinder}</c> instance found a compilation unit. This method is awlays called after a call to <c>{@link #handle(JavaProject) handle(JavaProject)}</c>.
+ * The reported compilation unit is guaranteed to be found inside the <c>JavaProject</c> reported by the last call to <c>{@link#handle(JavaProject) handle(JavaProject)}</c>.
+ * This method will be called exactly once for each compilation unit
+ *
+ * @param cu -
+ * the compilation unit found by the finder
+ */
+ public void handle(ICompilationUnit cu);
+
+ /**
+ * Called when the <c>{@link ICompilationUnitFinder}</c> instance found a java project. This method is always called before the <c>{@link #handle(ICompilationUnit)}</c>
+ * for any compilation unit found in this project. This method will be called exactly once for each found project.
+ *
+ * @param jprj -
+ * the java project found by the finder
+ */
+ public void handle(IJavaProject jprj);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IModelElementSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IModelElementSynchronizer.java
new file mode 100755
index 0000000..e00fc5f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IModelElementSynchronizer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+
+public interface IModelElementSynchronizer
+{
+ public DomUtil util();
+ public ServiceModelData serviceData();
+ public ILogger logger();
+ public IDOM getDomBeingLoaded();
+ public DomFactory domFactory();
+ public IJavaModel javaModel();
+ public JaxWsWorkspaceResource resource();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IProjectSelector.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IProjectSelector.java
new file mode 100755
index 0000000..b5ad5fd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/IProjectSelector.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.jdt.core.IJavaProject;
+
+/**
+ * Specifies what java projects will be traversed by a given <c>ICompilationUnitFinder</c> instance. If any of the registered
+ * selectors approved the project i.e. <c>IProjectSelector.approve(IJavaProject)</c> returned true, then this project will
+ * be traversed. I.e. the project needs to be rejected by all the selectors in order not to be traversed.
+ *
+ * An implementation of this interface should reject a project that it has no knowledge about.
+ * @author Hristo Sabev
+ *
+ */
+public interface IProjectSelector
+{
+ /**
+ * Approves the specified project for traversal
+ * @param prj - the project to approve or reject
+ * @return - true if the project should be traversed according to this selector, false otherwise.
+ */
+ public boolean approve(IJavaProject prj);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsDefaultsCalculator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsDefaultsCalculator.java
new file mode 100755
index 0000000..db9d77e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsDefaultsCalculator.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Contains utility methods for calculating default values of some attributes/properties in
+ * annotations and DOM objects.
+ *
+ * @author Georgi Vachkov
+ */
+public class JaxWsDefaultsCalculator
+{
+ private static final String ARG = "arg"; //$NON-NLS-1$
+ private static final String RETURN = "return"; //$NON-NLS-1$
+ private static final String RESPONSE = "Response"; //$NON-NLS-1$
+
+ /**
+ * Defines the SOAPBindingStyle. If there is a value for style attribute in <code>sbAnnotation</code> returns that value
+ * otherwise returns the default value for this attribute.
+ * @param sbAnnotation
+ * @return the style
+ */
+ public SOAPBindingStyle defineSBStyle(final IAnnotation<? extends IJavaElement> sbAnnotation)
+ {
+ final String value = sbAnnotation!=null ? sbAnnotation.getPropertyValue(SBAnnotationFeatures.STYLE_ATTRIBUTE) : null;
+ if (value!=null && SBAnnotationFeatures.SB_STYLE_RPC.endsWith(value.trim())) {
+ return SOAPBindingStyle.RPC;
+ }
+
+ return SOAPBindingStyle.DOCUMENT;
+ }
+
+ /**
+ * Defines the SOAPBindingUse. If there is a value for use attribute in <code>sbAnnotation</code> returns that value
+ * otherwise returns the default value for this attribute.
+ * @param sbAnnotation
+ * @return the style
+ */
+ public SOAPBindingUse defineSBUse(final IAnnotation<? extends IJavaElement> sbAnnotation) {
+ final String value = sbAnnotation!=null ? sbAnnotation.getPropertyValue(SBAnnotationFeatures.USE_ATTRIBUTE) : null;
+ if(value!=null && SBAnnotationFeatures.SB_USE_ENCODED.endsWith(value.trim())) {
+ return SOAPBindingUse.ENCODED;
+ }
+
+ return SOAPBindingUse.LITERAL;
+ }
+
+ /**
+ * Defines the SOAPBindingUse. If there is a value for parameterStyle attribute in <code>sbAnnotation</code>
+ * returns that value otherwise returns the default value for this attribute.
+ * @param sbAnnotation
+ * @return the style
+ */
+ public SOAPBindingParameterStyle defineSBParameterStyle(final IAnnotation<? extends IJavaElement> sbAnnotation)
+ {
+ final String value = sbAnnotation!=null ? sbAnnotation.getPropertyValue(SBAnnotationFeatures.PARAMETER_STYLE_ATTRIBUTE) : null;
+ if (value!=null && SBAnnotationFeatures.SB_PARAMETER_STYLE_BARE.endsWith(value.trim())) {
+ return SOAPBindingParameterStyle.BARE;
+ }
+
+ return SOAPBindingParameterStyle.WRAPPED;
+ }
+
+ /**
+ * Defines the default operation parameter name according to JSR-181 point 4.4 - WebParam name
+ * attribute
+ * @param webMethod the method holding the parameter
+ * @param paramPosition the parameter position in method arguments list starting with 0
+ * @return calculated name
+ */
+ public String calcWebParamDefaultName(final IWebMethod webMethod, final int paramPosition)
+ {
+ if(webMethod.getSoapBindingStyle()==SOAPBindingStyle.DOCUMENT &&
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.BARE)
+ {
+ return webMethod.getName();
+ }
+
+ return ARG + paramPosition;
+ }
+
+ /**
+ * Defines the default operation parameter name according to JSR-181 point 4.4 - WebParam name
+ * attribute
+ * @param webParam
+ * @return
+ */
+ public String calcWebParamDefaultName(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ return calcWebParamDefaultName(webMethod, getParamPosition(webMethod, webParam));
+ }
+
+ /**
+ * Calculates the position of <code>param</code> in <code>method</code> signature starting from 0
+ * @param webMethod
+ * @param param
+ * @return the param position
+ * @throws IllegalArgumentException in case <code>webMethod</code> does not contain <code>param</code>
+ */
+ protected int getParamPosition(final IWebMethod webMethod, final IWebParam param)
+ {
+ int position = 0;
+ for (IWebParam webParam : webMethod.getParameters())
+ {
+ if (webParam.getImplementation().equals("return")) {//$NON-NLS-1$
+ continue;
+ }
+
+ if (webParam==param) {
+ return position;
+ }
+
+ position++;
+ }
+
+ throw new IllegalStateException("Parameter[" + param.getImplementation() + "] was not found in method [" + webMethod.getImplementation() + "]");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+
+ /**
+ * Defines the default operation parameter name according to JSR-181 point 4.4 - WebParam target NS.
+ * @param webMethod the method holding the parameter
+ * @param webParam
+ * @return calculated NS
+ */
+ public String calcWebParamDefaultTargetNS(final IWebMethod webMethod, final IWebParam webParam)
+ {
+ if(webMethod.getSoapBindingStyle()==SOAPBindingStyle.DOCUMENT &&
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.WRAPPED &&
+ !webParam.isHeader())
+ {
+ return "";//$NON-NLS-1$
+ }
+
+ return ((IServiceEndpointInterface)webMethod.eContainer()).getTargetNamespace();
+ }
+
+ /**
+ * @return the default kind for web parameters - returns {@link WebParamKind#IN}
+ */
+ public WebParamKind getDefaultParamKind() {
+ return WebParamKind.IN;
+ }
+
+ /**
+ * @return false because the default value for WebParam(header) is false
+ */
+ public boolean getDefaultParamInHedaer() {
+ return false;
+ }
+
+ /**
+ * Defines the default operation parameter name according to JSR-181 point 4.5 - WebResult name.
+ * @param webMethod the method holding the parameter
+ * @return calculated name
+ */
+ public String calcWebResultDefaultName(final IWebMethod webMethod)
+ {
+ if(webMethod.getSoapBindingStyle()==SOAPBindingStyle.DOCUMENT &&
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.BARE)
+ {
+ return webMethod.getName() + RESPONSE;
+ }
+
+ return RETURN;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsWorkspaceResource.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsWorkspaceResource.java
new file mode 100755
index 0000000..1095cde
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/JaxWsWorkspaceResource.java
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.SerializerAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync.InitialModelSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync.OnEventModelSynchronizer;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+import org.eclipse.jst.ws.jaxws.utils.facets.FacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.facets.IFacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Represents the resource for JAX-WS web service DOM model. This class is responsible for loading the
+ * model. It is capable to use {@link IProgressMonitor} to track progress and cancel requests.
+ *
+ * @author
+ */
+public class JaxWsWorkspaceResource extends NonStreamResource
+{
+ private final IJavaModel javaModel;
+ private final ServiceModelData serviceData;
+ private final OnEventModelSynchronizer modelSynchronizer;
+ private final SerializerAdapterFactory serializerFactory;
+
+ private IProgressMonitor monitor;
+
+ private boolean saveEnabled;
+ private boolean loadCnaceled;
+
+ /**
+ * Constructor
+ * @param javaModel
+ */
+ public JaxWsWorkspaceResource(final IJavaModel javaModel)
+ {
+ this.javaModel = javaModel;
+ serviceData = new ServiceModelData();
+ modelSynchronizer = new OnEventModelSynchronizer(this, serviceData);
+ saveEnabled = true;
+ serializerFactory = new SerializerAdapterFactory(this);
+ }
+
+ /**
+ * Set progress monitor in case the processing progress should be tracked and
+ * also in case it is expected that the processing can be canceled
+ * @param pm the monitor - can be <code>null</code>
+ */
+ public void setProgressMonitor(IProgressMonitor pm)
+ {
+ this.monitor = pm;
+ }
+
+ /**
+ * @return the loaded DOM in case it is successfully loaded. This method will return <code>null</code>
+ * in case loading has not been started at all or in case loading has been canceled. To check if the
+ * loading has been canceled call isLoadingCanceled().
+ */
+ public IDOM getDOM()
+ {
+ if (getContents().size() == 0) {
+ return null;
+ }
+
+ return (IDOM) getContents().get(0);
+ }
+
+ /**
+ * Adds listener for changes to Java elements in order to keep the model in sync
+ * with these changes
+ */
+ public void startSynchronizing()
+ {
+ JavaCore.addElementChangedListener(modelSynchronizer, ElementChangedEvent.POST_RECONCILE | ElementChangedEvent.POST_CHANGE);
+ }
+
+ /**
+ * Removes listener for changes to Java elements. Keep in mind that after calling
+ * this method changes in java elements will not be reflected in DOM model
+ */
+ public void stopSynchronizing()
+ {
+ JavaCore.removeElementChangedListener(modelSynchronizer);
+ }
+
+ /**
+ * @return the logger to use when some event needs to be logged
+ */
+ public ILogger logger()
+ {
+ return new Logger();
+ }
+
+ /**
+ * @return the java model
+ */
+ public IJavaModel javaModel()
+ {
+ return javaModel;
+ }
+
+ @Override
+ protected void doLoad(final Map<?, ?> options) throws IOException
+ {
+ loadCnaceled = false;
+ getContents().clear();
+
+ final IWorkspaceRunnable runnable = new IWorkspaceRunnable()
+ {
+ public void run(final IProgressMonitor subMonitor) throws CoreException
+ {
+ try
+ {
+ new InitialModelSynchronizer(JaxWsWorkspaceResource.this, serviceData).load(options, subMonitor);
+ }
+ catch (WsDOMLoadCanceledException e) {
+ loadCnaceled = true;
+ logger().logError("JAX WS Web Services DOM loading has been canceled by the user, some JAX WS Web Services functionalities won't be available", e); //$NON-NLS-1$
+ }
+ }
+ };
+
+ try {
+ javaModel().getWorkspace().run(runnable, monitor);
+ }
+ catch (CoreException ce) {
+ throw new IOWrappedException(ce);
+ }
+ }
+
+ @Override
+ protected void doSave(Map<?, ?> options) throws IOException {
+ // no processing needed
+ }
+
+ protected IElementChangedListener getSynchronizingListener() {
+ return modelSynchronizer;
+ }
+
+ /**
+ * Creates compilation unit finder that crawls through javaModel and calls
+ * compilation unit handler to process available CU's
+ * @param jModel
+ * @param projectSelectors
+ * @return non <code>null</code> {@link ICompilationUnitFinder} instance
+ */
+ public ICompilationUnitFinder newCompilationUnitFinder(final IJavaModel jModel, final IProjectSelector[] projectSelectors)
+ {
+ return new WorkspaceCUFinder(jModel, projectSelectors);
+ }
+
+ /**
+ * Approves that <code>prj</code> is JAX-WS web service enabled
+ * @param prj
+ * @return <code>true</code> in case this project might contain JAX-WS web services
+ */
+ public boolean approveProject(final IJavaProject prj)
+ {
+ final IFacetUtils facetUtils = new FacetUtils();
+ try {
+ return facetUtils.hasFacetWithVersion(prj.getProject(), FacetUtils.EJB_30_FACET_VERSION, FacetUtils.EJB_30_FACET_ID, true)
+ || facetUtils.hasFacetWithVersion(prj.getProject(), FacetUtils.WEB_25_FACET_VERSION, FacetUtils.WEB_25_FACET_ID, true);
+ } catch (CoreException ce)
+ {
+ logger().logError("Unable to read facet on project " + prj.getElementName() + ". Any Web Service elements in this project will not be shown in the navigation tree", ce); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ }
+ }
+
+ /**
+ * Creates new instance of {@link IAnnotationInspector} for <code>type</code>
+ * @param type
+ * @return non <code>null</code> inspector
+ */
+ public IAnnotationInspector newAnnotationInspector(final IType type)
+ {
+ return AnnotationFactory.createAnnotationInspector(type);
+ }
+
+ /**
+ * @return non empty array of projects selectors responsible for filtering processed projects
+ */
+ public IProjectSelector[] getProjectSelectors()
+ {
+ return new IProjectSelector[] { new IProjectSelector()
+ {
+ public boolean approve(IJavaProject prj)
+ {
+ return approveProject(prj);
+ }
+ } };
+ }
+
+ /**
+ * @return the serializer factory used to adapt DOM objects with serializer adapters
+ */
+ public SerializerAdapterFactory getSerializerFactory() {
+ return serializerFactory;
+ }
+
+ /**
+ * @return <code>true</code> if the saving is enabled
+ */
+ public boolean isSaveEnabled() {
+ return saveEnabled;
+ }
+
+ /**
+ * call this method to enable saving of model objects to underlying resources
+ */
+ synchronized public void enableSaving() {
+ this.saveEnabled = true;
+ }
+
+ /**
+ * call this method to disable saving of model objects to underlying resources
+ */
+ synchronized public void disableSaving() {
+ this.saveEnabled = false;
+ }
+
+ /**
+ * @return <code>true</code> in case the load of DOM model has been canceled
+ */
+ public boolean isLoadCnaceled() {
+ return loadCnaceled;
+ }
+
+ /**
+ * Holds model data helpful in model processing
+ */
+ public class ServiceModelData
+ {
+ private Map<IWebService, String> ws2sei = new HashMap<IWebService, String>();
+
+ private Map<String, Collection<IWebService>> sei2ws = new HashMap<String, Collection<IWebService>>();
+
+ private Map<String, Collection<ICompilationUnit>> type2inherited = new HashMap<String, Collection<ICompilationUnit>>();
+
+ public void map(IWebService ws, String seiImpl)
+ {
+ ws2sei.put(ws, seiImpl);
+ getImplementingWs(seiImpl).add(ws);
+ }
+
+ String getSeiImpl(IWebService ws)
+ {
+ return ws2sei.get(ws);
+ }
+
+ public Collection<IWebService> getImplementingWs(String seiIml)
+ {
+ Collection<IWebService> wss = sei2ws.get(seiIml);
+ if (wss == null)
+ {
+ wss = new ArrayList<IWebService>();
+ sei2ws.put(seiIml, wss);
+ }
+ return wss;
+ }
+
+ public void unmap(IWebService ws)
+ {
+ final String sei = ws2sei.remove(ws);
+ final Collection<IWebService> implementingWebServices = getImplementingWs(sei);
+ implementingWebServices.remove(ws);
+ if (implementingWebServices.size() == 0)
+ {
+ sei2ws.remove(sei);
+ }
+ }
+
+ public void recordHierarchy(String fqName, Collection<ICompilationUnit> inheritedTypes)
+ {
+ type2inherited.put(fqName, inheritedTypes);
+ }
+
+ /**
+ * @param fqName the fully qualified class name
+ * @return collection of classes that are super for class <code>fqName</code>
+ */
+ public Collection<ICompilationUnit> getHierarchy(String fqName)
+ {
+ return type2inherited.get(fqName);
+ }
+
+ /**
+ * Clears recorder hierarchy for class with FQName <code>fqName</code>
+ * @param fqName
+ */
+ public void clearHierarchy(String fqName)
+ {
+ type2inherited.remove(fqName);
+ }
+
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/Jee5WsDomRuntimeExtension.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/Jee5WsDomRuntimeExtension.java
new file mode 100755
index 0000000..8f12d2c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/Jee5WsDomRuntimeExtension.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+public class Jee5WsDomRuntimeExtension implements IWsDOMRuntimeExtension
+{
+ public static final String ID = "org.eclipse.jst.ws.jaxws.dom.jee5";//$NON-NLS-1$
+
+ private List<IWsDomLoadListener> listeners = new ArrayList<IWsDomLoadListener>();
+ private JaxWsWorkspaceResource workspaceResource;
+ private boolean finished;
+ private boolean started;
+
+ public void createDOM(final IProgressMonitor monitor) throws IOException, WsDOMLoadCanceledException
+ {
+ Job.getJobManager().beginRule(ResourcesPlugin.getWorkspace().getRoot(), monitor);
+ try {
+ if (workspaceResource == null || workspaceResource.isLoadCnaceled()) {
+ performLoad(monitor);
+ }
+ } finally {
+ Job.getJobManager().endRule(ResourcesPlugin.getWorkspace().getRoot());
+ }
+ }
+
+ private void performLoad(final IProgressMonitor monitor) throws IOException, WsDOMLoadCanceledException
+ {
+ workspaceResource = createResource();
+ workspaceResource.setProgressMonitor(monitor);
+ try {
+ started();
+ workspaceResource.load(null);
+ if (workspaceResource.isLoadCnaceled()) {
+ throw createCanceledException();
+ }
+ } finally {
+ finished();
+ }
+
+ workspaceResource.startSynchronizing();
+ }
+
+ public IDOM getDOM() throws WsDOMLoadCanceledException
+ {
+ if (workspaceResource == null) {
+ return null;
+ }
+
+ if (workspaceResource.isLoadCnaceled()) {
+ throw createCanceledException();
+ }
+
+ return workspaceResource.getDOM();
+ }
+
+ public void addLoadListener(IWsDomLoadListener listener)
+ {
+ nullCheckParam(listener, "listener");//$NON-NLS-1$
+
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+
+ if (started) {
+ listener.started();
+ }
+
+ if (finished) {
+ listener.finished();
+ }
+ }
+
+ public void removeLoadListener(IWsDomLoadListener listener)
+ {
+ nullCheckParam(listener, "listener");//$NON-NLS-1$
+
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ protected IJavaModel javaModel() {
+ return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ protected JaxWsWorkspaceResource createResource() {
+ return new JaxWsWorkspaceResource(javaModel());
+ }
+
+ protected void finished()
+ {
+ finished = true;
+ for (IWsDomLoadListener listener : listeners) {
+ listener.finished();
+ }
+ }
+
+ protected void started()
+ {
+ started = true;
+ finished = false;
+ for (IWsDomLoadListener listener : listeners) {
+ listener.started();
+ }
+ }
+
+ private WsDOMLoadCanceledException createCanceledException() {
+ return new WsDOMLoadCanceledException("JAX-WS DOM loading canceled", JaxWsDomRuntimeMessages.WorkspaceCUFinder_LOADING_CANCELED); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/NonStreamResource.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/NonStreamResource.java
new file mode 100755
index 0000000..8f6a5ae
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/NonStreamResource.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
+
+public abstract class NonStreamResource extends ResourceImpl {
+
+ /**
+ * Since this Resource is not stream based, this method should never be called.
+ * If called it will throw <c>UnsupportedException</c>
+ * @param arg0 - ignorred
+ */
+ @Override
+ protected final void doLoad(InputStream inputStream, Map<?,?> options) throws IOException {
+ super.doLoad(inputStream, options);
+ }
+
+ /**
+ * Since this Resource is not stream based, this method should never be called.
+ * If called it will throw <c>UnsupportedException</c>
+ * @param arg0 - ignorred
+ */
+ @Override
+ protected final void doSave(OutputStream arg0, Map<?,?> arg1) throws IOException {
+ super.doSave(arg0, arg1);
+ }
+
+ /**
+ * Allwasy throws <c>UnsupportedOperationException</c>. Streams are not supported by this resource.
+ * @return nothing. this method allways throws <c>UnsupportedOperationException</c>
+ */
+ @Override
+ protected final boolean isContentZipEntry(ZipEntry arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Since this resource doesn't support streams this method should never be called. Allwasy throws <c>UnsupportedOperationException</c>.
+ * @return nothing. this method allways throws <c>UnsupportedOperationException</c>
+ */
+ @Override
+ protected final ZipEntry newContentZipEntry() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Since this resource doesn't support streams this method should never be called. Allwasy throws <c>UnsupportedOperationException</c>.
+ * @return nothing. this method allways throws <c>UnsupportedOperationException</c>
+ */
+ @Override
+ protected final boolean useZip() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void load(Map<?,?> options) throws IOException {
+
+ if (!isLoaded()) {
+ Notification notification = setLoaded(true);
+ isLoading = true;
+ if (errors != null) {
+ errors.clear();
+ }
+ if (warnings != null) {
+ warnings.clear();
+ }
+ try {
+ Map<?,?> mergedOptions = mergeMaps(options, defaultLoadOptions);
+ doLoad(mergedOptions);
+ } finally {
+
+ isLoading = false;
+ if (notification != null) {
+ eNotify(notification);
+ }
+ setModified(false);
+ }
+ }
+ }
+
+ /**
+ * Called to load the resource using no streams.
+ *
+ * @param options - options supplied by the caller. This metod will ignore any options that it doesn't recognize. The keys and the values can be arbitrary objects.
+ * @throws IOException - thrown if error occurred while loading the content of this resource
+ */
+ abstract protected void doLoad(Map<?,?> options) throws IOException;
+
+ @Override
+ public final void save(Map<?,?> options) throws IOException {
+ if (errors != null)
+ {
+ errors.clear();
+ }
+ if (warnings != null)
+ {
+ warnings.clear();
+ }
+ Map<?,?> mergedOptions = mergeMaps(options, defaultSaveOptions);
+ doSave(mergedOptions);
+ setModified(false);
+ }
+
+ /**
+ * Called to save the resource using no streams.
+ * @param options - options supplied by the caller. This metod will ignore any options that it doesn't recognize. The keys and the values can be arbitrary objects.
+ * @throws IOException - if problem during the saving occurred.
+ */
+ protected abstract void doSave(Map<?,?> options) throws IOException;
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/SBAnnotationFeatures.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/SBAnnotationFeatures.java
new file mode 100755
index 0000000..3a81fb7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/SBAnnotationFeatures.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+/**
+ * Contains SOAPBinding annotation name, attributes and possible values
+ *
+ * @author Georgi Vachkov
+ */
+public class SBAnnotationFeatures
+{
+ public static final String SB_ANNOTATION = "javax.jws.soap.SOAPBinding";//$NON-NLS-1$
+ public static final String STYLE_ATTRIBUTE = "style";//$NON-NLS-1$
+ public static final String USE_ATTRIBUTE = "use";//$NON-NLS-1$
+ public static final String PARAMETER_STYLE_ATTRIBUTE = "parameterStyle";//$NON-NLS-1$
+
+ public static final String SB_STYLE_DOCUMENT = SB_ANNOTATION + ".Style.DOCUMENT";//$NON-NLS-1$
+ public static final String SB_STYLE_RPC = SB_ANNOTATION + ".SOAPBinding.Style.RPC";//$NON-NLS-1$
+
+ public static final String SB_USE_LITERAL = SB_ANNOTATION + ".Use.LITERAL";//$NON-NLS-1$
+ public static final String SB_USE_ENCODED = SB_ANNOTATION + ".Use.ENCODED";//$NON-NLS-1$
+
+ public static final String SB_PARAMETER_STYLE_BARE = SB_ANNOTATION + ".ParameterStyle.BARE";//$NON-NLS-1$
+ public static final String SB_PARAMETER_STYLE_WRAPPED = SB_ANNOTATION + ".ParameterStyle.WRAPPED";//$NON-NLS-1$
+
+
+ private SBAnnotationFeatures() {
+ // no instance of this class allowed
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WMAnnotationFeatures.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WMAnnotationFeatures.java
new file mode 100755
index 0000000..14989cf
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WMAnnotationFeatures.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+public final class WMAnnotationFeatures
+{
+
+ public static final String WM_ANNOTATION = "javax.jws.WebMethod";//$NON-NLS-1$
+
+ public static final String WM_NAME_ATTRIBUTE = "operationName";//$NON-NLS-1$
+
+ public static final String WM_EXCLUDED_ATTRIBUTE = "exclude";//$NON-NLS-1$
+
+ private WMAnnotationFeatures()
+ {
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WPAnnotationFeatures.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WPAnnotationFeatures.java
new file mode 100755
index 0000000..47c32f7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WPAnnotationFeatures.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+
+/**
+ * Class that holds information on javax.jws.WebParam annotation name and attribute names.
+ *
+ * @author Georgi Vachkov
+ */
+final public class WPAnnotationFeatures
+{
+ public static final String WP_ANNOTATION = "javax.jws.WebParam";//$NON-NLS-1$
+ public static final String NAME_ATTRIBUTE = "name";//$NON-NLS-1$
+ public static final String PART_NAME_ATTRIBUTE = "partName";//$NON-NLS-1$
+ public static final String TARGET_NAMESPACE_ATTRIBUTE = "targetNamespace";//$NON-NLS-1$
+ public static final String MODE_ATTRIBUTE = "mode";//$NON-NLS-1$
+ public static final String HEADER_ATTRIBUTE = "header";//$NON-NLS-1$
+
+ public static final String WEB_PARAM_MODE = "javax.jws.WebParam.Mode";//$NON-NLS-1$
+ public static final String WEB_PARAM_MODE_IN = WEB_PARAM_MODE + ".IN";//$NON-NLS-1$
+ public static final String WEB_PARAM_MODE_OUT = WEB_PARAM_MODE + ".OUT";//$NON-NLS-1$
+ public static final String WEB_PARAM_MODE_INOUT = WEB_PARAM_MODE + ".INOUT";//$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WSAnnotationFeatures.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WSAnnotationFeatures.java
new file mode 100755
index 0000000..09f15f0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WSAnnotationFeatures.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+final public class WSAnnotationFeatures
+{
+ private WSAnnotationFeatures()
+ {
+ }
+ public static final String WS_ANNOTATION = "javax.jws.WebService";//$NON-NLS-1$
+ public static final String NAME_ATTRIBUTE = "name";//$NON-NLS-1$
+ public static final String ENDPOINT_INTERFACE_ATTRIBUTE = "endpointInterface";//$NON-NLS-1$
+ public static final String SERVICE_NAME_ATTRIBUTE = "serviceName";//$NON-NLS-1$
+ public static final String WSDL_LOCATION_ATTRIBUTE = "wsdlLocation";//$NON-NLS-1$
+ public static final String TARGET_NAMESPACE_ATTRIBUTE = "targetNamespace";//$NON-NLS-1$
+ public static final String PORT_NAME_ATTRIBUTE = "portName"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WorkspaceCUFinder.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WorkspaceCUFinder.java
new file mode 100755
index 0000000..9dc8f36
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/WorkspaceCUFinder.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+public class WorkspaceCUFinder implements ICompilationUnitFinder
+{
+ private final IJavaModel javaModel;
+ private final IProjectSelector[] selectors;
+
+ public WorkspaceCUFinder(IJavaModel javaModel, IProjectSelector[] selectors) {
+ if (javaModel == null) {
+ throw new NullPointerException("javaModel");//$NON-NLS-1$
+ }
+ this.javaModel = javaModel;
+ if (selectors == null) {
+ throw new NullPointerException("selector");//$NON-NLS-1$
+ }
+ this.selectors = selectors;
+ }
+
+ public void find(final IProgressMonitor monitor, final ICompilationUnitHandler cuHandler) throws CoreException, WsDOMLoadCanceledException
+ {
+ cuHandler.started();
+ if (monitor != null) {
+ monitor.beginTask(JaxWsDomRuntimeMessages.JAXWS_DOM_LOADING, assumeWork());
+ }
+ try {
+ for (IJavaProject prj : javaModel.getJavaProjects())
+ {
+ if (monitor!=null && monitor.isCanceled()) {
+ throw new WsDOMLoadCanceledException("JAX-WS DOM loading canceled", JaxWsDomRuntimeMessages.WorkspaceCUFinder_LOADING_CANCELED); //$NON-NLS-1$
+ }
+
+ if (approve(prj))
+ {
+ cuHandler.handle(prj);
+ parseProject(prj, monitor, cuHandler);
+ }
+ }
+ cuHandler.finished();
+ } finally {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+ }
+
+ protected int assumeWork() throws CoreException, WsDOMLoadCanceledException
+ {
+ final CountingCUHandler countingHandler = new CountingCUHandler();
+ for (IJavaProject prj : javaModel.getJavaProjects()) {
+ if (approve(prj)) {
+ parseProject(prj, new NullProgressMonitor(), countingHandler);
+ }
+ }
+
+ return countingHandler.count;
+ }
+
+ private void parseProject(final IJavaProject prj, final IProgressMonitor monitor, final ICompilationUnitHandler cuHandler) throws JavaModelException, WsDOMLoadCanceledException
+ {
+ for (IPackageFragment packageFragment : prj.getPackageFragments())
+ {
+ if (packageFragment.getKind() != IPackageFragmentRoot.K_SOURCE) {
+ continue;
+ }
+
+ for (ICompilationUnit cu : packageFragment.getCompilationUnits())
+ {
+ if (monitor!=null && monitor.isCanceled()) {
+ throw new WsDOMLoadCanceledException("JAX-WS DOM loading canceled",JaxWsDomRuntimeMessages.WorkspaceCUFinder_LOADING_CANCELED); //$NON-NLS-1$
+ }
+
+ cuHandler.handle(cu);
+
+ if (monitor != null) {
+ monitor.worked(1);
+ }
+ }
+ }
+ }
+
+ private boolean approve(IJavaProject prj) {
+ for (IProjectSelector selector : selectors) {
+ if (selector.approve(prj)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * This handler counts the compilation units
+ *
+ * @author Georgi Vachkov
+ */
+ protected class CountingCUHandler implements ICompilationUnitHandler
+ {
+ private int count;
+
+ public void started() {
+ count = 0;
+ }
+
+ public void handle(ICompilationUnit cu) {
+ count++;
+ }
+
+ public void finished() { /* no processing needed */ }
+ public void handle(IJavaProject jprj) { /* no processing needed */ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/AnnotationAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/AnnotationAdapterFactory.java
new file mode 100755
index 0000000..feafaf3
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/AnnotationAdapterFactory.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.impl.AnnotationAdapter;
+
+/**
+ * Factory that adapts DOM objects to {@link IAnnotationAdapter} interface.
+ *
+ * @author Georgi Vachkov
+ */
+public class AnnotationAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * Singleton - use this static instance to adapt objects
+ */
+ public static final AnnotationAdapterFactory INSTANCE = new AnnotationAdapterFactory();
+
+ private AnnotationAdapterFactory() {
+ // singleton
+ }
+
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return type == IAnnotationAdapter.class;
+ }
+
+ @Override
+ protected Adapter createAdapter(Notifier target)
+ {
+ return new AnnotationAdapter();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/IAnnotationAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/IAnnotationAdapter.java
new file mode 100755
index 0000000..df42752
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/IAnnotationAdapter.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Adapter that holds location information for the annotations applied on the
+ * java artifact/s which is represent by the DOM object adapted to this interface.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IAnnotationAdapter
+{
+ /**
+ * Provides the {@link IAnnotation} for annotation with <code>annFQName</code>.
+ * @param annFQName the fully qualified name of the annotation
+ * @return locator instance or <code>null</code> if not existing
+ */
+ public IAnnotation<? extends IJavaElement> getAnnotation(String annFQName);
+
+ /**
+ * Adds annotation to the list of used annotations.
+ * <code>annotation</code> can be <code>null</code> then the locator for this annotation
+ * is removed.
+ * @param annFQName the fully qualified name of the annotation
+ * @param annotation th annotation instance
+ */
+ public void addAnnotation(String annFQName, IAnnotation<? extends IJavaElement> annotation);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/impl/AnnotationAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/impl/AnnotationAdapter.java
new file mode 100755
index 0000000..9d6fbb8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/annotation/impl/AnnotationAdapter.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+/**
+ * Implementation of {@link ILocatorAdapter}.
+ *
+ * @author Georgi Vachkov
+ */
+public class AnnotationAdapter extends AdapterImpl implements IAnnotationAdapter
+{
+ private final Map<String, IAnnotation<? extends IJavaElement>> annotationLocators;
+
+ /**
+ * Constructor
+ */
+ public AnnotationAdapter() {
+ annotationLocators = new HashMap<String, IAnnotation<? extends IJavaElement>>();
+ }
+
+ public IAnnotation<? extends IJavaElement> getAnnotation(final String annotationFQName)
+ {
+ nullCheckParam(annotationFQName, "annotationFQName");//$NON-NLS-1$
+ return annotationLocators.get(annotationFQName);
+ }
+
+ public void addAnnotation(final String annFQName, final IAnnotation<? extends IJavaElement> annotation)
+ {
+ nullCheckParam(annFQName, "annFQName");//$NON-NLS-1$
+ annotationLocators.put(annFQName, annotation);
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IAnnotationAdapter.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/MethodPropertyDefaultsAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/MethodPropertyDefaultsAdapter.java
new file mode 100755
index 0000000..f3b74b9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/MethodPropertyDefaultsAdapter.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+
+/**
+ * Adapter that gives default values for {@link IWebMethod} objects
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodPropertyDefaultsAdapter extends AdapterImpl implements IPropertyDefaults
+{
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyDefaults.class == type;
+ }
+
+ public Object getDefault(final EStructuralFeature feature)
+ {
+ final IWebMethod webMethod = (IWebMethod)getTarget();
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_METHOD__NAME:
+ return getMethodName(webMethod);
+ }
+
+ return webMethod.eGet(feature);
+ }
+
+ private String getMethodName(final IWebMethod webMethod)
+ {
+ int pos = webMethod.getImplementation().indexOf('(');
+ if (pos > -1) {
+ return webMethod.getImplementation().substring(0, pos);
+ }
+
+ return webMethod.getImplementation();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/ParameterPropertyDefaultsAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/ParameterPropertyDefaultsAdapter.java
new file mode 100755
index 0000000..cbb9e1a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/ParameterPropertyDefaultsAdapter.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsDefaultsCalculator;
+
+/**
+ * Class that defines which properties for {@link IWebParam} are editable
+ *
+ * @author Georgi Vachkov
+ */
+public class ParameterPropertyDefaultsAdapter extends AdapterImpl implements IPropertyDefaults
+{
+ private final JaxWsDefaultsCalculator defCalc = new JaxWsDefaultsCalculator();
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyDefaults.class == type;
+ }
+
+ public Object getDefault(EStructuralFeature feature)
+ {
+ assert getTarget() instanceof IWebParam;
+
+ final IWebParam webParam = (IWebParam)getTarget();
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_PARAM__NAME:
+ return defCalc().calcWebParamDefaultName(webParam);
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ return defCalc().calcWebParamDefaultName(webParam);
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ return defCalc().calcWebParamDefaultTargetNS((IWebMethod)webParam.eContainer(), webParam);
+ case DomPackage.IWEB_PARAM__HEADER:
+ return defCalc().getDefaultParamInHedaer();
+ case DomPackage.IWEB_PARAM__KIND:
+ return defCalc().getDefaultParamKind();
+ }
+
+ return webParam.eGet(feature);
+ }
+
+ protected JaxWsDefaultsCalculator defCalc() {
+ return defCalc;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/PropertyDefaultsAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/PropertyDefaultsAdapterFactory.java
new file mode 100755
index 0000000..c82be5f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/PropertyDefaultsAdapterFactory.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomAdapterFactory;
+
+/**
+ * Adapter factory for adapters implementing {@link IPropertyState} interface.
+ *
+ * @author Georgi Vachkov
+ */
+public class PropertyDefaultsAdapterFactory extends DomAdapterFactory
+{
+ /**
+ * Singleton instance for this adapter factory
+ */
+ public static final PropertyDefaultsAdapterFactory INSTANCE = new PropertyDefaultsAdapterFactory();
+
+ @Override
+ public boolean isFactoryForType(Object object) {
+ return IPropertyDefaults.class == object;
+ }
+
+ @Override
+ public Adapter createIWebServiceAdapter() {
+ return new WsPropertyDefaultsAdapter();
+ }
+
+ @Override
+ public Adapter createIServiceEndpointInterfaceAdapter() {
+ return new SeiPropertyDefaultsAdapter();
+ }
+
+ @Override
+ public Adapter createIWebMethodAdapter() {
+ return new MethodPropertyDefaultsAdapter();
+ }
+
+ @Override
+ public Adapter createIWebParamAdapter(){
+ return new ParameterPropertyDefaultsAdapter();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/SeiPropertyDefaultsAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/SeiPropertyDefaultsAdapter.java
new file mode 100755
index 0000000..29cca7a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/SeiPropertyDefaultsAdapter.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+
+/**
+ * Adapter that provides default values for {@link IServiceEndpointInterface} properties
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiPropertyDefaultsAdapter extends AdapterImpl implements IPropertyDefaults
+{
+ public Object getDefault(EStructuralFeature feature)
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)getTarget();
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__NAME:
+ return JaxWsUtils.getDefaultPorttypeName(sei.getImplementation());
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ return JaxWsUtils.composeJaxWsTargetNamespaceByFQName(sei.getImplementation());
+ }
+
+ return sei.eGet(feature);
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyDefaults.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/WsPropertyDefaultsAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/WsPropertyDefaultsAdapter.java
new file mode 100755
index 0000000..07ac941
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/defaults/WsPropertyDefaultsAdapter.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+
+public class WsPropertyDefaultsAdapter extends AdapterImpl implements IPropertyDefaults
+{
+ public Object getDefault(EStructuralFeature feature)
+ {
+ final IWebService ws = (IWebService)getTarget();
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_SERVICE__NAME:
+ return JaxWsUtils.getDefaultServiceName(ws.getImplementation());
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ return JaxWsUtils.getDefaultPortName(ws.getImplementation());
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ return JaxWsUtils.composeJaxWsTargetNamespaceByFQName(ws.getImplementation());
+ }
+
+ return ws.eGet(feature);
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyDefaults.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/AbstractSerializerAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/AbstractSerializerAdapter.java
new file mode 100755
index 0000000..3016816
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/AbstractSerializerAdapter.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsDefaultsCalculator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.ParamValueComparator;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Base class for DOM adapters that listen to changes in DOM objects and applies it
+ * to the underlying java class. Extenders should implement <code>getAnnotation()</code>
+ * method to provide the {@link IAnnotation} instance to be saved to java class.
+ *
+ * @author Georgi Vachkov
+ */
+public abstract class AbstractSerializerAdapter extends AdapterImpl implements IAnnotationSerializer
+{
+ private final JaxWsWorkspaceResource resource;
+ private final DomUtil util = new DomUtil();
+ private final JaxWsDefaultsCalculator defCalc = new JaxWsDefaultsCalculator();
+
+ /**
+ * Constructor
+ * @param resource
+ * @throws NullPointerException in case <code>resource</code> is <code>null</code>
+ */
+ public AbstractSerializerAdapter(final JaxWsWorkspaceResource resource)
+ {
+ ContractChecker.nullCheckParam(resource, "resource");//$NON-NLS-1$
+
+ this.resource = resource;
+ }
+
+ @Override
+ public void notifyChanged(final Notification msg)
+ {
+ if (!resource.isSaveEnabled() || msg.isTouch()) {
+ return;
+ }
+
+ if (msg.getEventType() != Notification.SET && msg.getEventType() != Notification.UNSET) {
+ return;
+ }
+
+ if (checkValue(msg)) {
+ save(msg);
+ }
+ }
+
+ /**
+ * Default value check - works only for String values, trims the
+ * new value checks for <code>null</code> and if it is not null puts the
+ * value to the object and returns <code>true</code> otherwise <code>false</code>
+ * @param msg
+ * @return <code>true</code> in case the value is valid
+ */
+ protected boolean checkValue(final Notification msg)
+ {
+ EObject obj = (EObject)getTarget();
+ final String newValue = getNewStringValue(msg);
+ if (newValue==null) {
+ return revertValue(obj, msg);
+ }
+
+ // this call is needed cause newValue might be trimmed
+ putValue(obj, (EStructuralFeature)msg.getFeature(), newValue);
+ return true;
+ }
+
+ public void save(final Notification msg)
+ {
+ boolean processed = false;
+ try {
+ final IAnnotation<? extends IJavaElement> annotation = getAnnotation();
+ if (annotation == null) {
+ return;
+ }
+
+ if (annotation.getParamValuePairs().size()==0 && !isAnnotationRequired()) {
+ getAnnotationWriter().remove(annotation);
+ } else {
+ getAnnotationWriter().update(annotation);
+ }
+ processed = true;
+ }
+ catch (AnnotationGeneratorException e) {
+ logger().logError(e.getMessage(), e);
+ }
+ catch (CoreException e) {
+ logger().logError(e.getMessage(), e);
+ }
+ finally {
+ if(!processed) {
+ revertValue((EObject)getTarget(), msg);
+ }
+ }
+ }
+
+ protected abstract IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException;
+ protected abstract boolean isAnnotationRequired();
+
+ @Override
+ public boolean isAdapterForType(Object type)
+ {
+ return IAnnotationSerializer.class==type;
+ }
+
+ protected JaxWsWorkspaceResource resource() {
+ return resource;
+ }
+
+ protected DomUtil util() {
+ return util;
+ }
+
+ protected JaxWsDefaultsCalculator defCalc() {
+ return defCalc;
+ }
+
+ protected AnnotationWriter getAnnotationWriter()
+ {
+ return AnnotationWriter.getInstance();
+ }
+
+ protected IParamValuePair createParamValue(String param, String value)
+ {
+ final IValue iValue = AnnotationFactory.createStringValue(value);
+ return AnnotationFactory.createParamValuePairValue(param, iValue);
+ }
+
+ protected IParamValuePair createParamValue(String param, boolean value)
+ {
+ final IValue iValue = AnnotationFactory.createBooleanValue(value);
+ return AnnotationFactory.createParamValuePairValue(param, iValue);
+ }
+
+ protected IType findType(final EObject object, final String typeFQName) throws JavaModelException
+ {
+ EObject webProject = object.eContainer();
+ while(!(webProject instanceof IWebServiceProject) && webProject!=null) {
+ webProject = webProject.eContainer();
+ }
+
+ if (webProject==null) {
+ return null;
+ }
+
+ final String projectName = ((IWebServiceProject)webProject).getName();
+ final IJavaProject javaProject = resource.javaModel().getJavaProject(projectName);
+ return javaProject.findType(typeFQName);
+ }
+
+ /**
+ * Reads the new string value from <code>msg</code>.
+ * @param msg
+ * @return <code>null</code> if the value is empty string or <code>null</code>, otherwise the trimmed string value.
+ */
+ protected String getNewStringValue(final Notification msg)
+ {
+ final String newValue = (msg.getNewStringValue() == null) ? null : msg.getNewStringValue().trim();
+ if (newValue != null && newValue.length() > 0) {
+ return newValue;
+ }
+
+ return null;
+ }
+
+ /**
+ * Reverts the current value for the changed feature to the old value and returns <code>false</code>
+ * @param obj the object to be reverted
+ * @param msg the message
+ * @return always returns false
+ */
+ protected boolean revertValue(final EObject obj, final Notification msg)
+ {
+ putValue(obj, (EStructuralFeature)msg.getFeature(), msg.getOldValue());
+ return false;
+ }
+
+ /**
+ * Puts the <code>newValue</code> to the changed feature.
+ * @param obj the object to be updated
+ * @param msg the notification message
+ * @param newValue the new value to be put
+ */
+ protected void putValue(final EObject obj, final EStructuralFeature feature, final Object newValue)
+ {
+ try {
+ obj.eSetDeliver(false);
+ obj.eSet(feature, newValue);
+ } finally {
+ obj.eSetDeliver(true);
+ }
+ }
+
+ protected TreeSet<IParamValuePair> createParamValueSortedTreeSet()
+ {
+ return new TreeSet<IParamValuePair>(new ParamValueComparator());
+ }
+
+ private ILogger logger()
+ {
+ return new Logger();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/MethodSerializerAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/MethodSerializerAdapter.java
new file mode 100755
index 0000000..2875f7f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/MethodSerializerAdapter.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * Adapter for {@link IWebMethod} serialization. Listens for property change notifications and
+ * serializes the new object content to the underlying java class.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodSerializerAdapter extends AbstractSerializerAdapter
+{
+ /**
+ * Constructor
+ * @param resource the DOM resource
+ */
+ public MethodSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return false;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException
+ {
+ assert getTarget() instanceof IWebMethod;
+
+ final IWebMethod webMethod = (IWebMethod)getTarget();
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)webMethod.eContainer();
+ if (sei == null) {
+ return null;
+ }
+ final IType seiType = findType(sei, sei.getImplementation());
+ final IMethod method = util().findMethod(seiType, webMethod);
+ if (method==null) {
+ throw new IllegalStateException("IMethod for DOM method was not found");//$NON-NLS-1$
+ }
+
+ return AnnotationFactory.createAnnotation(WMAnnotationFeatures.WM_ANNOTATION, method, defineParamValues(webMethod, method));
+ }
+
+ private Set<IParamValuePair> defineParamValues(final IWebMethod webMethod, final IMethod method)
+ {
+ final Set<IParamValuePair> paramValuePairs = createParamValueSortedTreeSet();
+ if (webMethod.getName()!=null && !webMethod.getName().equals(method.getElementName())) {
+ paramValuePairs.add(createParamValue(WMAnnotationFeatures.WM_NAME_ATTRIBUTE, webMethod.getName()));
+ }
+
+ if (webMethod.isExcluded()) {
+ paramValuePairs.add(createParamValue(WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE, true));
+ }
+
+ return paramValuePairs;
+ }
+
+ @Override
+ protected boolean checkValue(final Notification msg)
+ {
+ final EStructuralFeature feature = (EStructuralFeature)msg.getFeature();
+ if (feature.getFeatureID()!=DomPackage.ISERVICE_ENDPOINT_INTERFACE__NAME) {
+ return false;
+ }
+
+ if (!super.checkValue(msg)) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/ParameterSerializerAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/ParameterSerializerAdapter.java
new file mode 100755
index 0000000..de7b1a7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/ParameterSerializerAdapter.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.HEADER_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.PART_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Class that serializes {@link IWebParam} objects to WebParam annotation in underlying java
+ * class. Checks the attribute values and omits the defaults.
+ *
+ * @author Georgi Vachkov
+ */
+public class ParameterSerializerAdapter extends AbstractSerializerAdapter
+{
+ private final Jee5DomUtils jee5Utils = Jee5DomUtils.getInstance();
+
+ /**
+ * Constructor
+ * @param resource
+ */
+ public ParameterSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ @Override
+ public void notifyChanged(final Notification msg)
+ {
+ if (!resource().isSaveEnabled()) {
+ return;
+ }
+
+ final EStructuralFeature feature = (EStructuralFeature)msg.getFeature();
+ if (feature.getFeatureID()==DomPackage.ISERVICE_ENDPOINT_INTERFACE__NAME)
+ {
+ try {
+ changePartName(msg);
+ }
+ catch (JavaModelException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+ }
+
+ super.notifyChanged(msg);
+ }
+
+ private void changePartName(final Notification msg) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)getTarget();
+ if (jee5Utils.isPartNameUsed(webParam))
+ {
+ final IAnnotationAdapter annAdapter = (IAnnotationAdapter )AnnotationAdapterFactory.INSTANCE.adapt(webParam, IAnnotationAdapter.class);
+ final IAnnotation<? extends IJavaElement> ann = annAdapter.getAnnotation(WPAnnotationFeatures.WP_ANNOTATION);
+ if (ann!=null && ann.getPropertyValue(WPAnnotationFeatures.PART_NAME_ATTRIBUTE)!=null) {
+ return;
+ }
+ }
+
+ if (checkValue(msg)) {
+ putValue(webParam, DomPackage.Literals.IWEB_PARAM__PART_NAME, msg.getNewValue());
+ }
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return false;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)getTarget();
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ if (webMethod==null || webMethod.eContainer()==null) {
+ return null;
+ }
+
+ final IType seiType = findType(webMethod, ((IServiceEndpointInterface)webMethod.eContainer()).getImplementation());
+ final IMethod method = util().findMethod(seiType, webMethod);
+
+ return AnnotationFactory.createAnnotation(WP_ANNOTATION,
+ method.getTypeParameter(webParam.getImplementation()),
+ defineParamValues(webParam, webMethod));
+ }
+
+ protected Set<IParamValuePair> defineParamValues(final IWebParam webParam, final IWebMethod webMethod)
+ {
+ final Set<IParamValuePair> valuePairs = createParamValueSortedTreeSet();
+
+ if (webParam.getKind()!=WebParamKind.IN) {
+ valuePairs.add(createModeValuePair(webParam));
+ }
+
+ if (webParam.isHeader()) {
+ valuePairs.add(createParamValue(HEADER_ATTRIBUTE, true));
+ }
+
+ final String defName = defCalc().calcWebParamDefaultName(webParam);
+ if (jee5Utils.isNameRequired(webParam) ||
+ (!webParam.getName().equals(defName) && jee5Utils.isNameUsed(webParam)))
+ {
+ valuePairs.add(createParamValue(NAME_ATTRIBUTE, webParam.getName()));
+ }
+
+ if (jee5Utils.isPartNameUsed(webParam) && !webParam.getPartName().equals(defName)) {
+ valuePairs.add(createParamValue(PART_NAME_ATTRIBUTE, webParam.getPartName()));
+ }
+
+ if (webParam.getTargetNamespace()!=null)
+ {
+ final String defNs = defCalc().calcWebParamDefaultTargetNS(webMethod, webParam);
+ if (webParam.getTargetNamespace().trim().length() != 0 && !webParam.getTargetNamespace().equals(defNs)) {
+ valuePairs.add(createParamValue(TARGET_NAMESPACE_ATTRIBUTE, webParam.getTargetNamespace()));
+ }
+ }
+
+ return valuePairs;
+ }
+
+ protected IParamValuePair createModeValuePair(final IWebParam webParam)
+ {
+ IValue value = null;
+ switch (webParam.getKind())
+ {
+ case OUT:
+ value = AnnotationFactory.createQualifiedNameValue(WPAnnotationFeatures.WEB_PARAM_MODE_OUT);
+ break;
+ case INOUT:
+ value = AnnotationFactory.createQualifiedNameValue(WPAnnotationFeatures.WEB_PARAM_MODE_INOUT);
+ break;
+ default:
+ return null;
+ }
+
+ return AnnotationFactory.createParamValuePairValue(WPAnnotationFeatures.MODE_ATTRIBUTE, value);
+ }
+
+ protected boolean hasParamWithSameName(final IWebParam param, final String newName)
+ {
+ final IWebMethod webMethod = (IWebMethod)param.eContainer();
+ for (IWebParam webParam : webMethod.getParameters())
+ {
+ if(webParam==param) {
+ continue;
+ }
+
+ if(webParam.getName().equals(newName)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ protected boolean checkValue(final Notification msg)
+ {
+ if(((EStructuralFeature)msg.getFeature()).getFeatureID()==DomPackage.IWEB_PARAM__TARGET_NAMESPACE) {
+ return true;
+ }
+
+ return super.checkValue(msg);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SeiSerializerAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SeiSerializerAdapter.java
new file mode 100755
index 0000000..a3bba49
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SeiSerializerAdapter.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import java.util.Set;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * Adapter that on {@link IWebService} object change saves the annotation to
+ * the underlying compilation unit. Uses {@link JaxWsWorkspaceResource} to define
+ * if save operation is enabled.
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiSerializerAdapter extends AbstractSerializerAdapter
+{
+ /**
+ * Constructor
+ * @param resource
+ */
+ public SeiSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return true;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException
+ {
+ assert getTarget() instanceof IServiceEndpointInterface;
+
+ return createIAnnotation((IServiceEndpointInterface)getTarget(), resource().javaModel());
+ }
+
+ protected IAnnotation<? extends IJavaElement> createIAnnotation(final IServiceEndpointInterface sei, final IJavaModel javaModel) throws JavaModelException
+ {
+ nullCheckParam(sei, "sei");//$NON-NLS-1$
+ nullCheckParam(javaModel, "javaModel");//$NON-NLS-1$
+
+ if (sei.isImplicit())
+ {
+ if (sei.getImplementingWebServices().size() == 0) {
+ // the implicit SEI has already been removed from the project
+ return null;
+ }
+
+ return new WsSerializerAdapter(resource()).createIAnnotation(sei.getImplementingWebServices().get(0), javaModel);
+ }
+
+ final IType type = findType(sei, sei.getImplementation());
+ if (type == null) {
+ // the explicit SEI has already been removed from the project
+ return null;
+ }
+
+ final Set<IParamValuePair> paramValuePairs = createParamValueSortedTreeSet();
+
+ if (sei.getName()!=null && !sei.getName().equals(JaxWsUtils.getDefaultPorttypeName(sei.getImplementation()))) {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.NAME_ATTRIBUTE, sei.getName()));
+ }
+ if (sei.getTargetNamespace()!=null && !sei.getTargetNamespace().equals(JaxWsUtils.composeJaxWsTargetNamespaceByPackage(type.getPackageFragment().getElementName()))) {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE, sei.getTargetNamespace()));
+ }
+
+ return AnnotationFactory.createAnnotation(WSAnnotationFeatures.WS_ANNOTATION, type, paramValuePairs);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SerializerAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SerializerAdapterFactory.java
new file mode 100755
index 0000000..34fbb3c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/SerializerAdapterFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomAdapterFactory;
+/**
+ * Factory for serialization adapters. This factory is instantiated on construction by
+ * {@link JaxWsWorkspaceResource} and it is recommended that you use the same instance
+ * in case you need this factory.
+ *
+ * @author Georgi Vachkov
+ */
+public class SerializerAdapterFactory extends DomAdapterFactory
+{
+ private final JaxWsWorkspaceResource resource;
+
+ /**
+ * Constructor
+ * @param resource
+ * @throws NullPointerException in case <code>resource</code> is <code>null</code>
+ */
+ public SerializerAdapterFactory(final JaxWsWorkspaceResource resource)
+ {
+ nullCheckParam(resource, "resource");//$NON-NLS-1$
+ this.resource = resource;
+ }
+
+ @Override
+ public Adapter createIWebServiceAdapter() {
+ return new WsSerializerAdapter(resource);
+ }
+
+ @Override
+ public Adapter createIServiceEndpointInterfaceAdapter() {
+ return new SeiSerializerAdapter(resource);
+ }
+
+ @Override
+ public Adapter createIWebMethodAdapter() {
+ return new MethodSerializerAdapter(resource);
+ }
+
+ @Override
+ public Adapter createIWebParamAdapter() {
+ return new ParameterSerializerAdapter(resource);
+ }
+
+ @Override
+ public boolean isFactoryForType(Object type)
+ {
+ return IAnnotationSerializer.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/WsSerializerAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/WsSerializerAdapter.java
new file mode 100755
index 0000000..de1d5c1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/serializer/WsSerializerAdapter.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer;
+
+import java.util.Set;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+/**
+ * Adapter that on {@link IWebService} object change saves the annotation to
+ * the underlying compilation unit. Uses {@link JaxWsWorkspaceResource} to define
+ * if save operation is enabled.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsSerializerAdapter extends AbstractSerializerAdapter
+{
+ /**
+ * Constructor
+ * @param resource
+ */
+ public WsSerializerAdapter(JaxWsWorkspaceResource resource)
+ {
+ super(resource);
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return true;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException
+ {
+ assert getTarget() instanceof IWebService;
+
+ return createIAnnotation((IWebService)getTarget(), resource().javaModel());
+ }
+
+ protected IAnnotation<? extends IJavaElement> createIAnnotation(final IWebService ws, final IJavaModel javaModel) throws JavaModelException
+ {
+ nullCheckParam(ws, "ws");//$NON-NLS-1$
+ nullCheckParam(javaModel, "javaModel");//$NON-NLS-1$
+
+ final IType type = findType(ws, ws.getImplementation());
+ if (type==null) {
+ return null;
+ }
+
+ final Set<IParamValuePair> paramValuePairs = createParamValueSortedTreeSet();
+
+ final IServiceEndpointInterface sei = ws.getServiceEndpoint();
+ if (sei!=null)
+ {
+ if (sei.isImplicit())
+ {
+ String seiName = sei.getName();
+ if (!JaxWsUtils.getDefaultPorttypeName(sei.getImplementation()).equals(seiName)) {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.NAME_ATTRIBUTE, ws.getServiceEndpoint().getName()));
+ }
+ } else {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE, ws.getServiceEndpoint().getImplementation()));
+ }
+ }
+
+ if (ws.getName()!=null &&
+ !ws.getName().equals(JaxWsUtils.getDefaultServiceName(ws.getImplementation())))
+ {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE, ws.getName()));
+ }
+ if (ws.getPortName()!=null &&
+ !ws.getPortName().equals(JaxWsUtils.getDefaultPortName(ws.getImplementation())))
+ {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.PORT_NAME_ATTRIBUTE, ws.getPortName()));
+ }
+ if (ws.getTargetNamespace()!=null &&
+ !ws.getTargetNamespace().equals(JaxWsUtils.composeJaxWsTargetNamespaceByPackage(type.getPackageFragment().getElementName())))
+ {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE, ws.getTargetNamespace()));
+ }
+ if (ws.getWsdlLocation()!=null) {
+ paramValuePairs.add(createParamValue(WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE, ws.getWsdlLocation()));
+ }
+
+ return AnnotationFactory.createAnnotation(WSAnnotationFeatures.WS_ANNOTATION, type, paramValuePairs);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/MethodPropertyStateAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/MethodPropertyStateAdapter.java
new file mode 100755
index 0000000..9fa8583
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/MethodPropertyStateAdapter.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+/**
+ * Defines the state of web method properties. In case the method is part of
+ * outside-in web service all properties are immutable.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodPropertyStateAdapter extends AdapterImpl implements IPropertyState
+{
+ public boolean isChangeable(EStructuralFeature feature)
+ {
+ final IWebMethod method = (IWebMethod)getTarget();
+ if (isOutideInWs(method)) {
+ return false;
+ }
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_METHOD__NAME:
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean isOutideInWs(final IWebMethod method)
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)method.eContainer();
+ if (sei==null) {
+ return false;
+ }
+
+ for (IWebService webService : sei.getImplementingWebServices()) {
+ if (webService.getWsdlLocation()!=null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyState.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/ParameterPropertyStateAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/ParameterPropertyStateAdapter.java
new file mode 100755
index 0000000..202ea73
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/ParameterPropertyStateAdapter.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+
+/**
+ * Class that defines which properties for {@link IWebParam} are editable
+ *
+ * @author Georgi Vachkov
+ */
+public class ParameterPropertyStateAdapter extends AdapterImpl implements IPropertyState
+{
+ public boolean isChangeable(EStructuralFeature feature)
+ {
+ assert getTarget() instanceof IWebParam;
+
+ final IWebParam webParam = (IWebParam)getTarget();
+ if (webParam.getImplementation().equals("return")) {//$NON-NLS-1$
+ return false;
+ }
+
+ if (isOutsideInWebService(webParam)) {
+ return false;
+ }
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_PARAM__NAME:
+ return isNameChangeable(webParam);
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ return isPartNameChangeable(webParam);
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ return isTargetNSChangeable(webParam);
+ }
+
+ return false;
+ }
+
+ protected boolean isPartNameChangeable(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+
+ return (webMethod.getSoapBindingStyle()==SOAPBindingStyle.RPC &&
+ webMethod.getSoapBindingUse()==SOAPBindingUse.LITERAL &&
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.WRAPPED);
+ }
+
+ protected boolean isNameChangeable(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ if (isDocumentLiteralWrapped(webMethod)) {
+ return true;
+ }
+
+ if (Jee5DomUtils.getInstance().isNameRequired(webParam)) {
+ return true;
+ }
+
+ return webParam.isHeader();
+ }
+
+ protected boolean isTargetNSChangeable(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ if (isDocumentLiteralWrapped(webMethod)) {
+ return true;
+ }
+
+ return webParam.isHeader();
+ }
+
+ protected boolean isDocumentLiteralWrapped(final IWebMethod webMethod)
+ {
+ return !(webMethod.getSoapBindingStyle()==SOAPBindingStyle.RPC ||
+ webMethod.getSoapBindingUse()==SOAPBindingUse.ENCODED ||
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.BARE);
+ }
+
+ protected boolean isOutsideInWebService(final IWebParam webParam)
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)webParam.eContainer().eContainer();
+ return DomUtil.INSTANCE.isOutsideInWebService(sei);
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyState.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/PropertyStateAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/PropertyStateAdapterFactory.java
new file mode 100755
index 0000000..75785f7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/PropertyStateAdapterFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomAdapterFactory;
+
+/**
+ * Adapter factory for adapters implementing {@link IPropertyState} interface.
+ *
+ * @author Georgi Vachkov
+ */
+public class PropertyStateAdapterFactory extends DomAdapterFactory
+{
+ /**
+ * Singleton instance for this adapter factory
+ */
+ public static final PropertyStateAdapterFactory INSTANCE = new PropertyStateAdapterFactory();
+
+ @Override
+ public boolean isFactoryForType(Object object) {
+ return IPropertyState.class == object;
+ }
+
+ @Override
+ public Adapter createIWebServiceAdapter() {
+ return new WsPropertyStateAdapter();
+ }
+
+ @Override
+ public Adapter createIServiceEndpointInterfaceAdapter() {
+ return new SeiPropertyStateAdapter();
+ }
+
+ @Override
+ public Adapter createIWebMethodAdapter() {
+ return new MethodPropertyStateAdapter();
+ }
+
+ @Override
+ public Adapter createIWebParamAdapter(){
+ return new ParameterPropertyStateAdapter();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/SeiPropertyStateAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/SeiPropertyStateAdapter.java
new file mode 100755
index 0000000..6bcc6c4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/SeiPropertyStateAdapter.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+/**
+ * {@link IPropertyState} adapter for {@link IServiceEndpointInterface} objects.
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiPropertyStateAdapter extends AdapterImpl implements IPropertyState
+{
+ public boolean isChangeable(EStructuralFeature feature)
+ {
+ if (!(getTarget() instanceof IServiceEndpointInterface)) {
+ return false;
+ }
+
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)getTarget();
+ if (isOutsideInWs(sei)) {
+ return false;
+ }
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__NAME:
+ return true;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ return !sei.isImplicit();
+ }
+
+ return false;
+ }
+
+ protected boolean isOutsideInWs(IServiceEndpointInterface sei)
+ {
+ for (IWebService webService : sei.getImplementingWebServices()) {
+ if (webService.getWsdlLocation()!=null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyState.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/WsPropertyStateAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/WsPropertyStateAdapter.java
new file mode 100755
index 0000000..c703eb8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/state/WsPropertyStateAdapter.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+/**
+ * {@link IPropertyState} adapter for {@link IWebService} objects.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsPropertyStateAdapter extends AdapterImpl implements IPropertyState
+{
+ public boolean isChangeable(final EStructuralFeature feature)
+ {
+ if (!(getTarget() instanceof IWebService)) {
+ return false;
+ }
+
+ if (isOutsideInWs((IWebService)getTarget())) {
+ return false;
+ }
+
+ switch(feature.getFeatureID())
+ {
+ case DomPackage.IWEB_SERVICE__NAME:
+ return true;
+ case DomPackage.IWEB_SERVICE__PORT_NAME:
+ return true;
+ case DomPackage.IWEB_SERVICE__TARGET_NAMESPACE:
+ return true;
+ }
+
+ return false;
+ }
+
+ protected boolean isOutsideInWs(final IWebService ws)
+ {
+ return ws.getWsdlLocation() != null;
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return IPropertyState.class == type;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractMethodSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractMethodSynchronizer.java
new file mode 100755
index 0000000..45d3d2b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractMethodSynchronizer.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.SBAnnotationFeatures.SB_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_NAME_ATTRIBUTE;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.SBAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+
+public abstract class AbstractMethodSynchronizer extends ElementSynchronizerImpl
+{
+ private ParameterSynchronizer parameterSynchronizer = new ParameterSynchronizer(this);
+
+ protected interface IMethodVisitor
+ {
+ void visit(IMethod method, IAnnotationInspector inspector) throws JavaModelException;
+ }
+
+ public AbstractMethodSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ }
+
+ protected abstract void visitExposableMethods(IMethodVisitor visitor, ITypeHierarchy hierarchy, IAnnotationInspector inspector) throws JavaModelException;
+
+ public void synchronizeMethods(final IServiceEndpointInterface sei, final IType seiType, final IAnnotationInspector inspector) throws JavaModelException
+ {
+ final Collection<IWebMethod> mergedMethods = new LinkedList<IWebMethod>();
+ final ITypeHierarchy hierarchy = seiType.newSupertypeHierarchy(null);
+ final IMethodVisitor visitor = new IMethodVisitor()
+ {
+ public void visit(IMethod method, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IWebMethod wm = obtainInstance(sei, method);
+ if (mergedMethods.contains(wm))
+ {
+ /**
+ * check whether this method has been processed in some of the child classes. If so
+ * skip it and continue. Only the method in the last child declaring this method needs
+ * to be processed because each child is overriding the properties for the every overriden
+ * method.
+ */
+ return;
+ }
+ mergeMethod(wm, method, inspector);
+ mergedMethods.add(wm);
+ }
+ };
+ visitExposableMethods(visitor, hierarchy, inspector);
+ removeLeftMethods(sei, mergedMethods);
+
+ }
+
+ private IWebMethod obtainInstance(IServiceEndpointInterface sei, IMethod method) throws JavaModelException
+ {
+ for (IWebMethod wm : sei.getWebMethods())
+ {
+ if (util().calcImplementation(method).equals(wm.getImplementation()))
+ {
+ return wm;
+ }
+ }
+ final IWebMethod newWebMethod = domFactory().createIWebMethod();
+ sei.getWebMethods().add(newWebMethod);
+ util().setFeatureValue(newWebMethod, DomPackage.IWEB_METHOD__IMPLEMENTATION, util().calcImplementation(method));
+ return newWebMethod;
+ }
+
+ private void mergeMethod(IWebMethod wm, IMethod m, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IAnnotation<IMethod> wmAnnotation = inspector.inspectMethod(m, WM_ANNOTATION);
+ final boolean excluded;
+ final String name;
+ if (wmAnnotation == null)
+ {
+ excluded = false;
+ name = m.getElementName();
+ } else
+ {
+ excluded = wmAnnotation.getPropertyValue(WM_EXCLUDED_ATTRIBUTE) == null ? false : Boolean.parseBoolean(wmAnnotation
+ .getPropertyValue(WM_EXCLUDED_ATTRIBUTE));
+ name = wmAnnotation.getPropertyValue(WM_NAME_ATTRIBUTE) == null ? m.getElementName() : wmAnnotation.getPropertyValue(WM_NAME_ATTRIBUTE);
+ }
+ if (!name.equals(wm.getName()))
+ {
+ util().setFeatureValue(wm, DomPackage.IWEB_METHOD__NAME, name);
+ }
+ if (excluded != wm.isExcluded())
+ {
+ util().setFeatureValue(wm, DomPackage.IWEB_METHOD__EXCLUDED, excluded);
+ }
+ mergeSoapBinding(wm, m, inspector);
+ parameterSynchronizer.synchronizeParameters(wm, m, inspector);
+
+ resource().getSerializerFactory().adapt(wm, IAnnotationSerializer.class);
+ adaptToLocationInterface(wm, WM_ANNOTATION, wmAnnotation);
+ }
+
+ private void mergeSoapBinding(final IWebMethod webMethod, final IMethod method, final IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IAnnotation<IMethod> sbAnnotation = inspector.inspectMethod(method, SB_ANNOTATION);
+ final IAnnotation<IType> seiSbAnnotation = inspector.inspectType(SB_ANNOTATION);
+
+ final SOAPBindingStyle style = defineSBStyle(sbAnnotation, seiSbAnnotation);
+ if (webMethod.getSoapBindingStyle() != style) {
+ webMethod.setSoapBindingStyle(style);
+ }
+
+ final SOAPBindingUse use = defineSBUse(sbAnnotation, seiSbAnnotation);
+ if (webMethod.getSoapBindingUse() != use) {
+ webMethod.setSoapBindingUse(use);
+ }
+
+ final SOAPBindingParameterStyle paramStyle =defineSBParameterStyle(sbAnnotation, seiSbAnnotation);
+ if (webMethod.getSoapBindingParameterStyle() != paramStyle) {
+ webMethod.setSoapBindingParameterStyle(paramStyle);
+ }
+
+ adaptToLocationInterface(webMethod, SB_ANNOTATION, sbAnnotation);
+ }
+
+ private SOAPBindingStyle defineSBStyle(final IAnnotation<IMethod> methodSBAnnotation, final IAnnotation<IType> seiSbAnnotation)
+ {
+ final String value = methodSBAnnotation!=null ? methodSBAnnotation.getPropertyValue(SBAnnotationFeatures.STYLE_ATTRIBUTE) : null;
+ if(value==null) {
+ return defCalc().defineSBStyle(seiSbAnnotation);
+ }
+
+ if (SBAnnotationFeatures.SB_STYLE_RPC.endsWith(value)) {
+ return SOAPBindingStyle.RPC;
+ }
+
+ if(SBAnnotationFeatures.SB_STYLE_DOCUMENT.endsWith(value)) {
+ return SOAPBindingStyle.DOCUMENT;
+ }
+
+ return defCalc().defineSBStyle(seiSbAnnotation);
+ }
+
+ private SOAPBindingUse defineSBUse(final IAnnotation<IMethod> methodSBAnnotation, final IAnnotation<IType> seiSbAnnotation)
+ {
+ final String value = methodSBAnnotation!=null ? methodSBAnnotation.getPropertyValue(SBAnnotationFeatures.USE_ATTRIBUTE) : null;
+ if (value==null) {
+ return defCalc().defineSBUse(seiSbAnnotation);
+ }
+
+ if (SBAnnotationFeatures.SB_USE_ENCODED.endsWith(value)) {
+ return SOAPBindingUse.ENCODED;
+ }
+
+ if (SBAnnotationFeatures.SB_USE_LITERAL.endsWith(value)) {
+ return SOAPBindingUse.LITERAL;
+ }
+
+ return defCalc().defineSBUse(seiSbAnnotation);
+ }
+
+ private SOAPBindingParameterStyle defineSBParameterStyle(final IAnnotation<IMethod> methodSBAnnotation, final IAnnotation<IType> seiSbAnnotation)
+ {
+ final String value = methodSBAnnotation!=null ? methodSBAnnotation.getPropertyValue(SBAnnotationFeatures.PARAMETER_STYLE_ATTRIBUTE) : null;
+ if (value==null) {
+ return defCalc().defineSBParameterStyle(seiSbAnnotation);
+ }
+
+ if (SBAnnotationFeatures.SB_PARAMETER_STYLE_BARE.endsWith(value)) {
+ return SOAPBindingParameterStyle.BARE;
+ }
+
+ if (SBAnnotationFeatures.SB_PARAMETER_STYLE_WRAPPED.endsWith(value)) {
+ return SOAPBindingParameterStyle.WRAPPED;
+ }
+
+ return defCalc().defineSBParameterStyle(seiSbAnnotation);
+ }
+
+ private void removeLeftMethods(IServiceEndpointInterface sei, Collection<IWebMethod> mergedMethods)
+ {
+ final Iterator<IWebMethod> iter = sei.getWebMethods().iterator();
+ while (iter.hasNext())
+ {
+ if (!mergedMethods.contains(iter.next()))
+ {
+ iter.remove();
+ }
+ }
+ }
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractModelSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractModelSynchronizer.java
new file mode 100755
index 0000000..ac2333d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/AbstractModelSynchronizer.java
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+
+public abstract class AbstractModelSynchronizer implements IModelElementSynchronizer
+{
+ private final SeiSynchronizer seiLoader;
+
+ private final WsSynchronizer wsLoader;
+
+ private final JaxWsWorkspaceResource resource;
+
+ private IDOM domBeingLoaded;
+
+ private final ServiceModelData serviceData;
+
+ private final DomUtil util;
+
+ public AbstractModelSynchronizer(JaxWsWorkspaceResource resource, ServiceModelData serviceData)
+ {
+ this.resource = resource;
+ this.util = new DomUtil();
+ this.serviceData = serviceData;
+ this.seiLoader = new SeiSynchronizer(this);
+ this.wsLoader = new WsSynchronizer(this);
+ }
+
+ public DomFactory domFactory()
+ {
+ return DomFactory.eINSTANCE;
+ }
+
+ public IDOM getDomBeingLoaded()
+ {
+ if (domBeingLoaded == null)
+ {
+ domBeingLoaded = domFactory().createIDOM();
+ }
+ return domBeingLoaded;
+ }
+
+ public IJavaModel javaModel()
+ {
+ return resource.javaModel();
+ }
+
+ public ILogger logger()
+ {
+ return resource.logger();
+ }
+
+ public JaxWsWorkspaceResource resource()
+ {
+ return resource;
+ }
+
+ public ServiceModelData serviceData()
+ {
+ return serviceData;
+ }
+
+ public DomUtil util()
+ {
+ return util;
+ }
+
+ protected void processCompilationUnit(final IWebServiceProject wsProject, final ICompilationUnit cu) throws JavaModelException
+ {
+ try {
+ resource.disableSaving();
+
+ if (cu.findPrimaryType() == null || !(cu.findPrimaryType().isInterface() || cu.findPrimaryType().isClass()))
+ {
+ if (logger().isDebug())
+ {
+ logger().logDebug("no primary type in compilation unit" + cu.getPath().toOSString());//$NON-NLS-1$
+ }
+ return;
+ }
+
+ final IAnnotationInspector inspector = resource().newAnnotationInspector(cu.findPrimaryType());
+ final IAnnotation<IType> wsAnnotation = inspector.inspectType(WS_ANNOTATION);
+ if (wsAnnotation == null)
+ {
+ if (logger().isDebug())
+ {
+ logger().logDebug("no " + WS_ANNOTATION + " annotation found on type " + cu.findPrimaryType().getFullyQualifiedName());//$NON-NLS-1$//$NON-NLS-2$
+ }
+ return;
+ }
+
+ recordHierarchy(cu.findPrimaryType());
+
+ if (wsAnnotation.getAppliedElement().isInterface())
+ {
+ // handle class changed to interface
+ removeWsModelElements(wsProject, wsAnnotation.getAppliedElement().getFullyQualifiedName(), false);
+
+ seiLoader.synchronizeInterface(wsProject, wsAnnotation, inspector);
+ } else if (wsAnnotation.getAppliedElement().isClass())
+ {
+ // handle interface changed to class
+ removeSeiModelElements(wsProject, wsAnnotation.getAppliedElement().getFullyQualifiedName(), false, true);
+
+ // if the annotation has changed and endpointInterface has been added the existing
+ // SEI in the project should be removed
+ final IWebService ws = wsLoader.synchronizeWebService(wsProject, wsAnnotation, inspector);
+ if (ws!=null && (ws.getServiceEndpoint()==null || !ws.getServiceEndpoint().isImplicit())) {
+ removeSeiModelElements(wsProject, ws.getImplementation(), false, false);
+ }
+ } else
+ {
+ if (logger().isDebug())
+ {
+ logger().logDebug("annotation " + WS_ANNOTATION + " is put on type "//$NON-NLS-1$//$NON-NLS-2$
+ + wsAnnotation.getAppliedElement().getFullyQualifiedName()
+ + "which is neither interface, nor a class. Ignorring!");//$NON-NLS-1$
+ }
+ }
+ } finally {
+ resource.enableSaving();
+ }
+ }
+
+ /**
+ * Removes web services from the model.
+ * @param wsProject
+ * @param implBaseName
+ */
+ protected void removeWsModelElements(final IWebServiceProject wsProject, final String implBaseName, final boolean isForPackage)
+ {
+ final Iterator<IWebService> wsIter = wsProject.getWebServices().iterator();
+ while (wsIter.hasNext())
+ {
+ final IWebService ws = wsIter.next();
+ if (ws.getImplementation().equals(implBaseName) ||
+ (isForPackage && ws.getImplementation().startsWith(implBaseName)))
+ {
+ serviceData().clearHierarchy(ws.getImplementation());
+ wsIter.remove();
+ if (ws.getServiceEndpoint() != null)
+ {
+ ws.getServiceEndpoint().getImplementingWebServices().remove(ws);
+ }
+ serviceData().unmap(ws);
+ }
+ }
+ }
+
+ /**
+ * Removes SEI's with <code>implBaseName</code> implementation from the model.
+ * @param wsProject
+ * @param implBaseName
+ * @param onlyExplicit if <code>true</code> implicit interfaces are not removed from model, otherwise both are removed.
+ */
+ protected void removeSeiModelElements(final IWebServiceProject wsProject, final String implBaseName, final boolean isForPackage, final boolean onlyExplicit)
+ {
+ final Iterator<IServiceEndpointInterface> seiIter = wsProject.getServiceEndpointInterfaces().iterator();
+ while (seiIter.hasNext())
+ {
+ final IServiceEndpointInterface sei = seiIter.next();
+ if (sei.getImplementation().equals(implBaseName) ||
+ (isForPackage && sei.getImplementation().startsWith(implBaseName)))
+ {
+ if ((onlyExplicit && sei.isImplicit())) {
+ continue;
+ }
+ serviceData().clearHierarchy(sei.getImplementation());
+ sei.getImplementingWebServices().clear();
+ seiIter.remove();
+ }
+ }
+ }
+
+ void recordHierarchy(IType type) throws JavaModelException
+ {
+ final Collection<ICompilationUnit> compilationUnits = new LinkedList<ICompilationUnit>();
+
+ for (IType superType : type.newSupertypeHierarchy(null).getAllSupertypes(type)) {
+ compilationUnits.add(superType.getCompilationUnit());
+ }
+
+ serviceData().recordHierarchy(type.getFullyQualifiedName(), compilationUnits);
+ }
+
+
+ protected IWebServiceProject createProject(final IJavaProject jprj)
+ {
+ final IWebServiceProject thisProject = domFactory().createIWebServiceProject();
+ util().setFeatureValue(thisProject, DomPackage.IWEB_SERVICE_PROJECT__NAME, jprj.getElementName());
+
+ util().addToCollectionFeature(getDomBeingLoaded(), DomPackage.IDOM__WEB_SERVICE_PROJECTS, thisProject);
+ return thisProject;
+ }
+
+ protected class LoaderCompilationUnitHandler implements ICompilationUnitHandler
+ {
+ public void started()
+ {
+ }
+
+ public void finished()
+ {
+ resource().getContents().add(getDomBeingLoaded());
+ }
+
+ protected IWebServiceProject wsProject;
+
+ public void handle(final IJavaProject jprj)
+ {
+ wsProject = createProject(jprj);
+ }
+
+ public void handle(final ICompilationUnit cu)
+ {
+ try
+ {
+ processCompilationUnit(wsProject, cu);
+ } catch (JavaModelException jme)
+ {
+ logger().logError("Unable to parse the content of compilation unit" + cu.getPath().toOSString(), jme); //$NON-NLS-1$
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ElementSynchronizerImpl.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ElementSynchronizerImpl.java
new file mode 100755
index 0000000..0f81949
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ElementSynchronizerImpl.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsDefaultsCalculator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+
+class ElementSynchronizerImpl implements IModelElementSynchronizer
+{
+
+ private final IModelElementSynchronizer parent;
+ private final DomUtil util;
+ private final JaxWsDefaultsCalculator defaultsCalculator;
+
+ ElementSynchronizerImpl(IModelElementSynchronizer parent)
+ {
+ this.parent = parent;
+ util = new DomUtil();
+ defaultsCalculator = new JaxWsDefaultsCalculator();
+ }
+
+ public DomUtil util() {
+ return util;
+ }
+
+ public JaxWsDefaultsCalculator defCalc() {
+ return defaultsCalculator;
+ }
+
+ public ServiceModelData serviceData()
+ {
+ return parent.serviceData();
+ }
+
+ public ILogger logger()
+ {
+ return parent.logger();
+ }
+
+ public IDOM getDomBeingLoaded()
+ {
+ return parent.getDomBeingLoaded();
+ }
+
+ public DomFactory domFactory()
+ {
+ return parent.domFactory();
+ }
+
+ public IJavaModel javaModel()
+ {
+ return parent.javaModel();
+ }
+
+ public JaxWsWorkspaceResource resource()
+ {
+ return parent.resource();
+ }
+
+ public void adaptToLocationInterface(final EObject object, final String annFQName, final IAnnotation<? extends IJavaElement> annotation)
+ {
+ final IAnnotationAdapter locator = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(object, IAnnotationAdapter.class);
+ locator.addAnnotation(annFQName, annotation);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/InitialModelSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/InitialModelSynchronizer.java
new file mode 100755
index 0000000..4bb01b9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/InitialModelSynchronizer.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+
+public class InitialModelSynchronizer extends AbstractModelSynchronizer
+{
+ public InitialModelSynchronizer(JaxWsWorkspaceResource resource, ServiceModelData serviceData)
+ {
+ super(resource, serviceData);
+ }
+
+ public void load(Map<?,?> options, IProgressMonitor monitor) throws CoreException, WsDOMLoadCanceledException
+ {
+ try {
+ resource().disableSaving();
+ resource().newCompilationUnitFinder(resource().javaModel(), resource().getProjectSelectors()).
+ find(monitor, new LoaderCompilationUnitHandler());
+ } finally {
+ resource().enableSaving();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/OnEventModelSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/OnEventModelSynchronizer.java
new file mode 100755
index 0000000..72ece1e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/OnEventModelSynchronizer.java
@@ -0,0 +1,416 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitFinder;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WorkspaceCUFinder;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+public class OnEventModelSynchronizer extends AbstractModelSynchronizer implements IElementChangedListener
+{
+
+ @Override
+ public IDOM getDomBeingLoaded()
+ {
+ return resource().getDOM();
+ }
+
+ public OnEventModelSynchronizer(JaxWsWorkspaceResource resource, ServiceModelData serviceData)
+ {
+ super(resource, serviceData);
+ }
+
+ public void elementChanged(final ElementChangedEvent event)
+ {
+ try
+ {
+ if (logger().isDebug())
+ {
+ logger().logDebug("ElementChangedEvent has been delivered. Event details: " + event.toString());//$NON-NLS-1$
+ }
+
+ // no processing if DOM load has been canceled
+ if (resource().isLoadCnaceled()) {
+ return;
+ }
+
+ resource().disableSaving();
+
+ // handles ElementChangedEvent.POST_RECONCILE - the case when the editor sends reconcile event
+ if (event.getType() == ElementChangedEvent.POST_RECONCILE)
+ {
+ handleReconcileEvent(event);
+ }
+
+ // handles ElementChangedEvent.POST_CHANGE - the case when the compilation unit has been changed
+ if (event.getDelta().getElement() != resource().javaModel())
+ {
+ return;
+ }
+
+ assert (event.getDelta().getFlags() & (IJavaElementDelta.F_CHILDREN | IJavaElementDelta.F_CONTENT)) != 0;
+ for (IJavaElementDelta child : event.getDelta().getAffectedChildren())
+ {
+ if (child.getElement() instanceof IJavaProject)
+ {
+ handleChangedProject(child);
+ }
+ }
+ }
+ catch (CoreException ce) {
+ logger().logError("Unable to synchronize Web Service model upon java element delta "+ event.getDelta(), ce); //$NON-NLS-1$
+ }
+ catch (WsDOMLoadCanceledException e) {
+ logger().logError("Unable to synchronize Web Service model upon java element delta " + event.getDelta(), e); //$NON-NLS-1$
+ }
+ finally {
+ resource().enableSaving();
+ }
+ }
+
+ protected void handleReconcileEvent(final ElementChangedEvent event) throws JavaModelException
+ {
+ if(!(event.getDelta().getElement() instanceof ICompilationUnit )) {
+ return;
+ }
+
+ int requiredFlags = IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_CHILDREN;
+
+ if ((event.getDelta().getFlags() & requiredFlags) == 0) {
+ return;
+ }
+
+ final ICompilationUnit cu = (ICompilationUnit)event.getDelta().getElement();
+ if (!resource().approveProject(cu.getJavaProject())) {
+ return;
+ }
+
+ if (isJavaResource(cu)) {
+ handleChangedContentCompilationUnit(cu);
+ }
+ }
+
+ private boolean isJavaResource(ICompilationUnit cu) throws JavaModelException
+ {
+ IJavaElement javaElement = cu;
+ while ((javaElement = javaElement.getParent()) != null)
+ {
+ if (!javaElement.exists()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ void handleChangedProject(IJavaElementDelta projectDelta) throws CoreException, WsDOMLoadCanceledException
+ {
+ assert (projectDelta.getElement() instanceof IJavaProject);
+
+ if ((((projectDelta.getFlags() & IJavaElementDelta.F_CLOSED) != 0) || projectDelta.getKind() == IJavaElementDelta.REMOVED)
+ && null != util().findProjectByName(getDomBeingLoaded(), projectDelta.getElement().getElementName()))
+ {
+ //if the project has been closed then it's facet's could not be read. Thus the approve method
+ //will always return false. That's why we check if the project has already been in the
+ handleClosedProject(projectDelta);
+ }
+ if (!resource().approveProject((IJavaProject)projectDelta.getElement()))
+ {
+ return;
+ }
+ if (((projectDelta.getFlags() & IJavaElementDelta.F_OPENED) != 0) || projectDelta.getKind() == IJavaElementDelta.ADDED)
+ {
+ handleOpenedProject(projectDelta);
+ }
+
+ for (IJavaElementDelta childDelta : projectDelta.getAffectedChildren())
+ {
+ if (!(childDelta.getElement() instanceof IPackageFragmentRoot))
+ {
+ continue;
+ }
+ if ((childDelta.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0)
+ {
+ handleClosedProject(projectDelta);
+ handleOpenedProject(projectDelta);
+ }
+ if ((childDelta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0)
+ {
+ handleClosedProject(projectDelta);
+ handleOpenedProject(projectDelta);
+ }
+ if ((childDelta.getFlags() & IJavaElementDelta.F_CHILDREN) != 0)
+ {
+ recursevilyHandleRemovedPackages(childDelta);
+ recursevilyHandleAddedPackages(childDelta);
+ recursevilyHandleCompilationUnits(childDelta);
+ }
+ }
+ }
+
+ protected void recursevilyHandleAddedPackages(IJavaElementDelta rootDelta) throws JavaModelException
+ {
+ final IWebServiceProject wsPrj = findProjectByDelta(rootDelta);
+ if (wsPrj == null) {
+ return;
+ }
+
+ for (IJavaElementDelta childDelta : rootDelta.getAffectedChildren())
+ {
+ if (childDelta.getElement() instanceof IPackageFragment && childDelta.getKind() == IJavaElementDelta.ADDED)
+ {
+ for (ICompilationUnit cu : ((IPackageFragment)childDelta.getElement()).getCompilationUnits())
+ {
+ processCompilationUnit(wsPrj, cu);
+ }
+ recursevilyHandleAddedPackages(childDelta);
+ }
+ }
+ }
+
+ protected IWebServiceProject findProjectByDelta(IJavaElementDelta rootDelta) {
+ return util().findProjectByName(getDomBeingLoaded(), rootDelta.getElement().getJavaProject().getElementName());
+ }
+
+ private void recursevilyHandleRemovedPackages(IJavaElementDelta rootDelta) throws JavaModelException
+ {
+
+ for (IJavaElementDelta childDelta : rootDelta.getAffectedChildren())
+ {
+ if (childDelta.getElement() instanceof IPackageFragment)
+ {
+ if (childDelta.getKind() == IJavaElementDelta.REMOVED)
+ {
+ final IWebServiceProject wsPrj = findProjectByDelta(rootDelta);
+ if (wsPrj != null) {
+ removeModelElements(wsPrj, childDelta.getElement().getElementName(), true);
+ }
+ } else
+ {
+ recursevilyHandleRemovedPackages(childDelta);
+ }
+ }
+ }
+ }
+
+ private void handleOpenedProject(IJavaElementDelta projectDelta) throws CoreException, WsDOMLoadCanceledException
+ {
+ assert projectDelta.getElement() instanceof IJavaProject;
+ final IJavaProject changedProject = (IJavaProject) projectDelta.getElement();
+ newProjectCUFinder(changedProject).find(null, new LoaderCompilationUnitHandler());
+ }
+
+ private void handleClosedProject(IJavaElementDelta projectDelta) throws CoreException
+ {
+ assert projectDelta.getElement() instanceof IJavaProject;
+ final IWebServiceProject wsPrj = util().findProjectByName(getDomBeingLoaded(), projectDelta.getElement().getElementName());
+ if (wsPrj==null) {
+ return;
+ }
+
+ for (IServiceEndpointInterface sei : wsPrj.getServiceEndpointInterfaces())
+ {
+ sei.getImplementingWebServices().clear();
+ }
+ for (IWebService ws : wsPrj.getWebServices())
+ {
+ serviceData().unmap(ws);
+ }
+ getDomBeingLoaded().getWebServiceProjects().remove(wsPrj);
+ }
+
+ private ICompilationUnitFinder newProjectCUFinder(final IJavaProject prj)
+ {
+ return new WorkspaceCUFinder(resource().javaModel(), new IProjectSelector[] { new IProjectSelector()
+ {
+ public boolean approve(IJavaProject toApprove)
+ {
+ return prj.getElementName().equals(toApprove.getElementName());
+ }
+ } });
+ }
+
+ // handles compilation units - skips working copies
+ private void recursevilyHandleCompilationUnits(IJavaElementDelta delta)
+ {
+ if (delta.getElement() instanceof ICompilationUnit)
+ {
+ final ICompilationUnit cu = (ICompilationUnit) delta.getElement();
+ if (util().findProjectByName(getDomBeingLoaded(), cu.getJavaProject().getElementName())==null)
+ {
+ return;
+ }
+
+ try
+ {
+ if (delta.getKind() == IJavaElementDelta.ADDED && (delta.getFlags() & IJavaElementDelta.F_MOVED_FROM) == 0)
+ {
+ handleAddedCompilationUnit(cu);
+ }
+ if (delta.getKind() == IJavaElementDelta.REMOVED && (delta.getFlags() & IJavaElementDelta.F_MOVED_TO) == 0)
+ {
+ handleRemovedCompilationUnit(cu);
+ }
+ if (delta.getKind() == IJavaElementDelta.REMOVED && (delta.getFlags() & IJavaElementDelta.F_MOVED_TO) != 0)
+ {
+ handleMovedToCompilationUnit(cu, (ICompilationUnit) delta.getMovedToElement());
+ }
+ if (delta.getKind() == IJavaElementDelta.CHANGED &&
+ ((delta.getFlags() & IJavaElementDelta.F_PRIMARY_RESOURCE) != 0) ||
+ ((delta.getFlags() & IJavaElementDelta.F_PRIMARY_WORKING_COPY) != 0))
+ {
+ handleChangedContentCompilationUnit(cu);
+ }
+ } catch (JavaModelException jme)
+ {
+ logger().logError("Unable to parse the content of compilation unit" + delta.getElement(), jme); //$NON-NLS-1$
+ }
+ } else
+ {
+ for (IJavaElementDelta childDelta : delta.getAffectedChildren())
+ {
+ recursevilyHandleCompilationUnits(childDelta);
+ }
+ }
+ }
+
+ private void handleChangedContentCompilationUnit(ICompilationUnit cu) throws JavaModelException
+ {
+ final IType type = cu.findPrimaryType();
+ final IAnnotation<IType> annotation = type==null ? null : resource().newAnnotationInspector(type).inspectType(WS_ANNOTATION);
+ if (type == null || annotation == null)
+ {
+ updateSubclassingWSElements(cu);
+ handleRemovedCompilationUnit(cu);
+ } else
+ {
+ final IWebServiceProject wsProject = util().findProjectByName(getDomBeingLoaded(), cu.getJavaProject().getElementName());
+ assert wsProject != null;
+ processCompilationUnit(wsProject, cu);
+ }
+ }
+
+ private void updateSubclassingWSElements(ICompilationUnit cu) throws JavaModelException
+ {
+ for (IWebServiceProject wsPrj : getDomBeingLoaded().getWebServiceProjects())
+ {
+ final IJavaProject javaPrj = javaModel().getJavaProject(wsPrj.getName());
+ for (IServiceEndpointInterface sei : wsPrj.getServiceEndpointInterfaces())
+ {
+ if(serviceData().getHierarchy(sei.getImplementation())==null) {
+ continue;
+ }
+ if (serviceData().getHierarchy(sei.getImplementation()).contains(cu))
+ {
+ processCompilationUnit(wsPrj, javaPrj.findType(sei.getImplementation()).getCompilationUnit());
+ }
+ }
+ for (IWebService ws : wsPrj.getWebServices())
+ {
+ if(serviceData().getHierarchy(ws.getImplementation())==null) {
+ continue;
+ }
+ if (serviceData().getHierarchy(ws.getImplementation()).contains(cu))
+ {
+ processCompilationUnit(wsPrj, javaPrj.findType(ws.getImplementation()).getCompilationUnit());
+ }
+ }
+ }
+ }
+
+ private void handleAddedCompilationUnit(ICompilationUnit addedCU) throws JavaModelException
+ {
+ final IWebServiceProject wsPrj = util().findProjectByName(getDomBeingLoaded(), addedCU.getJavaProject().getElementName());
+ this.processCompilationUnit(wsPrj, addedCU);
+ }
+
+ void handleMovedToCompilationUnit(ICompilationUnit fromCU, ICompilationUnit toCU) throws JavaModelException
+ {
+ final IJavaWebServiceElement wsElem = guessContainedWSElement(fromCU);
+ if (wsElem == null)
+ {
+ return;
+ }
+
+ final boolean fqNameChanged = !toCU.getElementName().equals(fromCU.getElementName())
+ || !toCU.getParent().getElementName().equals(fromCU.getParent().getElementName());
+ if (fqNameChanged)
+ {
+ handleRemovedCompilationUnit(fromCU);
+ handleAddedCompilationUnit(toCU);
+ } else
+ // then assume that the project only has changed.
+ {
+ final IWebServiceProject toPrj = util().findProjectByName(getDomBeingLoaded(), toCU.getJavaProject().getElementName());
+ if (wsElem instanceof IWebService)
+ {
+ toPrj.getWebServices().add((IWebService) wsElem);
+ } else
+ {
+ toPrj.getServiceEndpointInterfaces().add((IServiceEndpointInterface) wsElem);
+ }
+ }
+ }
+
+ private void handleRemovedCompilationUnit(ICompilationUnit remCU) throws JavaModelException
+ {
+ final IWebServiceProject wsPrj = util().findProjectByName(getDomBeingLoaded(), remCU.getJavaProject().getElementName());
+ removeModelElements(wsPrj, guessPrimaryTypeName(remCU), false);
+ }
+
+ private void removeModelElements(IWebServiceProject wsPrj, String implBaseName, boolean isForPackage) throws JavaModelException
+ {
+ if (wsPrj == null) {
+ return;
+ }
+ removeWsModelElements(wsPrj, implBaseName, isForPackage);
+ removeSeiModelElements(wsPrj, implBaseName, isForPackage, false);
+ }
+
+ private IJavaWebServiceElement guessContainedWSElement(ICompilationUnit cu)
+ {
+ final IWebServiceProject wsPrj = util().findProjectByName(getDomBeingLoaded(), cu.getJavaProject().getElementName());
+ return util().findJavaWebServiceElemByImplName(wsPrj, guessPrimaryTypeName(cu));
+ }
+
+ protected String guessPrimaryTypeName(ICompilationUnit cu)
+ {
+ final String parentName = cu.getParent().getElementName();
+ final StringBuilder assumedPrimaryTypeName = new StringBuilder();
+ if (parentName.length() > 0) {
+ assumedPrimaryTypeName .append(parentName).append('.');
+ }
+ return assumedPrimaryTypeName.append(cu.getElementName()).
+ delete(assumedPrimaryTypeName.lastIndexOf(".java"), assumedPrimaryTypeName.length()).toString();//$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ParameterSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ParameterSynchronizer.java
new file mode 100755
index 0000000..655903d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/ParameterSynchronizer.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.HEADER_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.MODE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.PART_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+/**
+ * Class that synchronizes the parameters for {@link IWebMethod} object;
+ *
+ * @author
+ */
+public class ParameterSynchronizer extends ElementSynchronizerImpl
+{
+ private static final String RETURN_PARAM_NAME = "return";//$NON-NLS-1$
+ private static final String HOLDER_CLASS_NAME = "Holder"; //$NON-NLS-1$
+ private static final String HOLDER_CLASS_FQNAME = "javax.xml.ws.Holder";//$NON-NLS-1$
+
+ public ParameterSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ }
+
+ public void synchronizeParameters(IWebMethod wm, IMethod method, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final Collection<IWebParam> mergedParams = new LinkedList<IWebParam>();
+ if (!Signature.SIG_VOID.equals(method.getReturnType()))
+ {
+ final IWebParam retParam = obtainInstance(wm, RETURN_PARAM_NAME);
+ mergeParam(retParam, 0, wm, method, method.getReturnType(), inspector);
+ mergedParams.add(retParam);
+ }
+ final String[] names = method.getParameterNames();
+ final String[] typeSignatures = method.getParameterTypes();
+ for (int i = 0; i < names.length; i++)
+ {
+ final IWebParam param = obtainInstance(wm, names[i]);
+ mergeParam(param, i, wm, method, typeSignatures[i], inspector);
+ mergedParams.add(param);
+ }
+ wm.getParameters().retainAll(mergedParams);
+ }
+
+ private void mergeParam(IWebParam webParam, int pos, IWebMethod webMethod, IMethod method, String typeSign, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final ITypeParameter typeParam = method.getTypeParameter(webParam.getImplementation());
+ assert typeParam!= null;
+
+ final IAnnotation<ITypeParameter> wpAnnotation = isWebResult(webParam) ? null : inspector.inspectParam(typeParam, WP_ANNOTATION);
+
+ if (! typeSign.equals(webParam.getTypeName())) {
+ util().setFeatureValue(webParam, DomPackage.IWEB_PARAM__TYPE_NAME, typeSign);
+ }
+
+ final WebParamKind kind = isWebResult(webParam) ? WebParamKind.OUT : calcKind(wpAnnotation, method, typeSign);
+ if (!kind.equals(webParam.getKind())) {
+ webParam.setKind(kind);
+ }
+
+ final boolean isHeader = calcHeader(wpAnnotation);
+ if (webParam.isHeader() ^ isHeader) {
+ webParam.setHeader(isHeader);
+ }
+
+ final String name = isWebResult(webParam) ? defCalc().calcWebResultDefaultName(webMethod) : calcName(wpAnnotation, webMethod, pos);
+ if (!name.equals(webParam.getName())) {
+ webParam.setName(name);
+ }
+
+ final String partName = calcPartName(wpAnnotation, name);
+ if (!partName.equals(webParam.getPartName())) {
+ webParam.setPartName(partName);
+ }
+
+ final String targetNamespace = calcTargetNamespace(wpAnnotation, webMethod, webParam);
+ if (!targetNamespace.equals(webParam.getTargetNamespace())) {
+ webParam.setTargetNamespace(targetNamespace);
+ }
+
+ resource().getSerializerFactory().adapt(webParam, IAnnotationSerializer.class);
+ adaptToLocationInterface(webParam, WP_ANNOTATION, wpAnnotation);
+ }
+
+ private boolean isWebResult(final IWebParam param)
+ {
+ return param.getImplementation().equals(RETURN_PARAM_NAME);
+ }
+
+ protected String resolveFullyQualifiedName(final IMethod method, final String typeSignature) throws JavaModelException, IllegalArgumentException
+ {
+ if (Signature.getTypeSignatureKind(typeSignature) == Signature.BASE_TYPE_SIGNATURE)
+ {
+ return Signature.toString(typeSignature);
+ }
+
+ final String[][] resolvedTypes = method.getDeclaringType().resolveType(Signature.toString(typeSignature));
+ if (resolvedTypes == null)
+ {
+ return "";//$NON-NLS-1$
+ }
+ final String pack = resolvedTypes[0][0];
+ final String className = resolvedTypes[0][1];
+ if (pack != null && pack.length() != 0)
+ {
+ return pack + "." + className;//$NON-NLS-1$
+ } else
+ {
+ return className;
+ }
+ }
+
+ protected WebParamKind calcKind(final IAnnotation<ITypeParameter> parmAnnotation, final IMethod method, final String typeSignature) throws JavaModelException, IllegalArgumentException
+ {
+ if (parmAnnotation != null && parmAnnotation.getPropertyValue(MODE_ATTRIBUTE) != null)
+ {
+ final String mode = parmAnnotation.getPropertyValue(MODE_ATTRIBUTE);
+ if (WPAnnotationFeatures.WEB_PARAM_MODE_INOUT.endsWith(mode))
+ {
+ return WebParamKind.INOUT;
+ }
+ if (WPAnnotationFeatures.WEB_PARAM_MODE_IN.endsWith(mode))
+ {
+ return WebParamKind.IN;
+ }
+ if (WPAnnotationFeatures.WEB_PARAM_MODE_OUT.endsWith(mode))
+ {
+ return WebParamKind.OUT;
+ }
+ }
+
+ if (isPossiblyHolderClass(typeSignature)) {
+ final String typeFQName = resolveFullyQualifiedName(method, typeSignature);
+ if (typeFQName.startsWith(HOLDER_CLASS_FQNAME)) {
+ return WebParamKind.INOUT;
+ }
+ }
+
+ return WebParamKind.IN;
+ }
+
+ /**
+ * Added due to performance issues CSN 0120061532 0002256925 2009.
+ * The idea is that before calling {@link #resolveFullyQualifiedName(IMethod, String)}
+ * we check if the class is potentially Holder.
+ */
+ private boolean isPossiblyHolderClass(final String typeSignature) {
+ final String erasuteTypeName = Signature.getSignatureSimpleName(Signature.getTypeErasure(typeSignature));
+ if (HOLDER_CLASS_NAME.equals(erasuteTypeName)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private String calcName(IAnnotation<ITypeParameter> parmAnnotation, IWebMethod webMethod, int paramPosition)
+ {
+ if (parmAnnotation != null && parmAnnotation.getPropertyValue(NAME_ATTRIBUTE) != null) {
+ return parmAnnotation.getPropertyValue(NAME_ATTRIBUTE);
+ }
+
+ return defCalc().calcWebParamDefaultName(webMethod, paramPosition);
+ }
+
+ private String calcPartName(final IAnnotation<ITypeParameter> wpAnnotation, final String name)
+ {
+ if (wpAnnotation!=null && wpAnnotation.getPropertyValue(PART_NAME_ATTRIBUTE)!=null) {
+ return wpAnnotation.getPropertyValue(PART_NAME_ATTRIBUTE);
+ }
+
+ return name;
+ }
+
+ private boolean calcHeader(final IAnnotation<ITypeParameter> wpAnnotation)
+ {
+ if (wpAnnotation!=null && wpAnnotation.getPropertyValue(HEADER_ATTRIBUTE)!=null) {
+ return Boolean.parseBoolean(wpAnnotation.getPropertyValue(HEADER_ATTRIBUTE));
+ }
+
+ return false;
+ }
+
+ private String calcTargetNamespace(final IAnnotation<ITypeParameter> wpAnnotation, final IWebMethod webMethod, final IWebParam webParam)
+ {
+ if (wpAnnotation!=null && wpAnnotation.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE)!=null) {
+ return wpAnnotation.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE);
+ }
+
+ return defCalc().calcWebParamDefaultTargetNS(webMethod, webParam);
+ }
+
+ private IWebParam obtainInstance(IWebMethod wm, String impl)
+ {
+ final IWebParam existing = findWebParamByImplName(wm, impl);
+ if (existing != null)
+ {
+ return existing;
+ }
+ final IWebParam newParam = domFactory().createIWebParam();
+ util().setFeatureValue(newParam, DomPackage.IWEB_PARAM__IMPLEMENTATION, impl);
+ wm.getParameters().add(newParam);
+ return newParam;
+ }
+
+ private IWebParam findWebParamByImplName(final IWebMethod wm, final String impl)
+ {
+ for (IWebParam param : wm.getParameters())
+ {
+ if (impl.equals(param.getImplementation()))
+ {
+ return param;
+ }
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMerger.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMerger.java
new file mode 100755
index 0000000..a0ce821
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMerger.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.SBAnnotationFeatures.SB_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+/**
+ * Synchronizer that merges content of {@link IServiceEndpointInterface} with the current content of
+ * the class implementing it.
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiMerger extends ElementSynchronizerImpl
+{
+ private AbstractMethodSynchronizer methodSynchronizer;
+
+ /**
+ * Constructor
+ * @param parent
+ * @param methodSync the synchronizer that takes care for the SEI methods
+ */
+ public SeiMerger(IModelElementSynchronizer parent, AbstractMethodSynchronizer methodSync)
+ {
+ super(parent);
+ nullCheckParam(methodSync);
+ this.methodSynchronizer = methodSync;
+ }
+
+ protected void merge(IServiceEndpointInterface sei, IAnnotation<IType> wsAnnotation, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final String seiName = wsAnnotation.getPropertyValue(NAME_ATTRIBUTE) == null ?
+ JaxWsUtils.getDefaultPorttypeName(wsAnnotation.getAppliedElement().getFullyQualifiedName()) : wsAnnotation.getPropertyValue(NAME_ATTRIBUTE);
+
+ if (!seiName.equals(sei.getName())) {
+ util().setFeatureValue(sei, DomPackage.ISERVICE_ENDPOINT_INTERFACE__NAME, seiName);
+ }
+
+ // add targetNamespace
+ final String targetNs = extractTargetNamespace(wsAnnotation);
+ if (!targetNs.equals(sei.getTargetNamespace())) {
+ util().setFeatureValue(sei, DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE, targetNs);
+ }
+
+ mergeSoapBinding(sei, inspector);
+ methodSynchronizer.synchronizeMethods(sei, wsAnnotation.getAppliedElement(), inspector);
+
+ adaptToLocationInterface(sei, WS_ANNOTATION, wsAnnotation);
+ }
+
+ private String extractTargetNamespace(final IAnnotation<IType> wsAnnotation)
+ {
+ // add targetNamespace
+ final String targetNs = wsAnnotation.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE);
+ if (targetNs==null) {
+ return JaxWsUtils.composeJaxWsTargetNamespaceByPackage(wsAnnotation.getAppliedElement().getPackageFragment().getElementName());
+ }
+
+ return targetNs;
+ }
+
+ private void mergeSoapBinding(final IServiceEndpointInterface sei, final IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IAnnotation<IType> sbAnnotation = inspector.inspectType(SB_ANNOTATION);
+
+ final SOAPBindingStyle style = defCalc().defineSBStyle(sbAnnotation);
+ if (sei.getSoapBindingStyle() != style) {
+ sei.setSoapBindingStyle(style);
+ }
+
+ final SOAPBindingUse use = defCalc().defineSBUse(sbAnnotation);
+ if (sei.getSoapBindingUse() != use) {
+ sei.setSoapBindingUse(use);
+ }
+
+ final SOAPBindingParameterStyle paramStyle = defCalc().defineSBParameterStyle(sbAnnotation);
+ if (sei.getSoapBindingParameterStyle() != paramStyle) {
+ sei.setSoapBindingParameterStyle(paramStyle);
+ }
+
+ adaptToLocationInterface(sei, SB_ANNOTATION, sbAnnotation);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMethodSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMethodSynchronizer.java
new file mode 100755
index 0000000..c354f58
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiMethodSynchronizer.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+class SeiMethodSynchronizer extends AbstractMethodSynchronizer
+{
+
+ public SeiMethodSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ }
+
+ @Override
+ protected void visitExposableMethods(IMethodVisitor visitor, ITypeHierarchy hierarchy, IAnnotationInspector inspector) throws JavaModelException
+ {
+ visitRecursively(visitor, hierarchy.getType(), hierarchy, inspector);
+ }
+
+ private void visitRecursively(IMethodVisitor visitor, IType type, ITypeHierarchy hierarchy, IAnnotationInspector inspector) throws JavaModelException
+ {
+ for (IMethod method : type.getMethods())
+ {
+ visitor.visit(method, inspector);
+ }
+
+ for (IType superIntf : hierarchy.getSuperInterfaces(type))
+ {
+ visitRecursively(visitor, superIntf, hierarchy, resource().newAnnotationInspector(superIntf));
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiSynchronizer.java
new file mode 100755
index 0000000..98efa72
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/SeiSynchronizer.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+/**
+ * Synchronizer for explicit {@link IServiceEndpointInterface} instance. Updates the DOM instance to the current
+ * SEI implementation class by reading relevant annotations and
+ *
+ * @author
+ */
+public class SeiSynchronizer extends ElementSynchronizerImpl
+{
+ private final SeiMerger seiMerger;
+
+ SeiSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ seiMerger = new SeiMerger(this, new SeiMethodSynchronizer(this));
+ }
+
+ /* IServiceEndpointInterface */
+ void synchronizeInterface(IWebServiceProject wsProject, IAnnotation<IType> wsAnnotation, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IServiceEndpointInterface sei = obtainInstance(wsProject, wsAnnotation.getAppliedElement().getFullyQualifiedName());
+ seiMerger.merge(sei, wsAnnotation, inspector);
+ resolveWsRefsToThisSei(sei);
+ resource().getSerializerFactory().adapt(sei, IAnnotationSerializer.class);
+ }
+
+ private IServiceEndpointInterface obtainInstance(IWebServiceProject wsProject, String implName)
+ {
+ IServiceEndpointInterface sei = null;
+ for (IServiceEndpointInterface existing : wsProject.getServiceEndpointInterfaces())
+ {
+ if (existing.getImplementation().equals(implName)) {
+ sei = existing;
+ }
+ }
+
+ if (sei==null)
+ {
+ sei = domFactory().createIServiceEndpointInterface();
+ util().setFeatureValue(sei, DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, implName);
+ wsProject.getServiceEndpointInterfaces().add(sei);
+ }
+
+ util().setFeatureValue(sei, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT, false);
+
+ return sei;
+ }
+
+ private void resolveWsRefsToThisSei(IServiceEndpointInterface sei)
+ {
+ for (IWebService ws : serviceData().getImplementingWs(sei.getImplementation()))
+ {
+ if (ws.getServiceEndpoint() != sei)
+ {
+ util().setFeatureValue(ws, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, sei);
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WSMethodSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WSMethodSynchronizer.java
new file mode 100755
index 0000000..90934ec
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WSMethodSynchronizer.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+public class WSMethodSynchronizer extends AbstractMethodSynchronizer
+{
+
+ public WSMethodSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ }
+
+ @Override
+ protected void visitExposableMethods(IMethodVisitor visitor, ITypeHierarchy hierarchy, IAnnotationInspector inspector) throws JavaModelException
+ {
+ visitRecursively(visitor, hierarchy.getType(), hierarchy, inspector);
+ }
+
+ private void visitRecursively(IMethodVisitor visitor, IType type, ITypeHierarchy hierarchy, IAnnotationInspector inspector) throws JavaModelException
+ {
+ if (type == null)
+ {
+ return;
+ }
+
+ assert type.isClass();
+ final boolean isWebService = inspector.inspectType(WS_ANNOTATION) != null;
+ for (IMethod method : type.getMethods())
+ {
+ if(method.isConstructor())
+ {
+ // Constructors can never take part in the porttype
+ continue;
+ }
+
+ final IAnnotation<IMethod> wmAnnotation = inspector.inspectMethod(method, WM_ANNOTATION);
+ final boolean isExcludedWithAnnotation = wmAnnotation == null ? false : "true".equals(wmAnnotation//$NON-NLS-1$
+ .getPropertyValue(WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE));
+ if (Modifier.isPublic(method.getFlags()) && !isExcludedWithAnnotation && (isWebService || wmAnnotation != null))
+ {
+ visitor.visit(method, inspector);
+ }
+ }
+
+ final IType superType = hierarchy.getSuperclass(type);
+ if (superType!=null) {
+ visitRecursively(visitor, superType, hierarchy, resource().newAnnotationInspector(superType));
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WsSynchronizer.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WsSynchronizer.java
new file mode 100755
index 0000000..cd7269c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/persistence/sync/WsSynchronizer.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.PORT_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+public class WsSynchronizer extends ElementSynchronizerImpl
+{
+ private final SeiMerger seiMerger;
+
+ public WsSynchronizer(IModelElementSynchronizer parent)
+ {
+ super(parent);
+ this.seiMerger = new SeiMerger(this, new WSMethodSynchronizer(this));
+ }
+
+ private IWebService obtainInstance(IWebServiceProject wsProject, String implName)
+ {
+ for (IWebService ws : wsProject.getWebServices())
+ {
+ if (ws.getImplementation().equals(implName))
+ {
+ return ws;
+ }
+ }
+ final IWebService newWs = DomFactory.eINSTANCE.createIWebService();
+ util().setFeatureValue(newWs, DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, implName);
+ util().addToCollectionFeature(wsProject, DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES, newWs);
+
+ return newWs;
+ }
+
+ public IWebService synchronizeWebService(IWebServiceProject wsProject, IAnnotation<IType> wsAnnotation, IAnnotationInspector inspector) throws JavaModelException
+ {
+ final IWebService ws = obtainInstance(wsProject, wsAnnotation.getAppliedElement().getFullyQualifiedName());
+ mergeWebService(ws, wsProject, wsAnnotation, inspector);
+
+ resource().getSerializerFactory().adapt(ws, IAnnotationSerializer.class);
+ adaptToLocationInterface(ws, WS_ANNOTATION, wsAnnotation);
+
+ return ws;
+ }
+
+ private void mergeWebService(IWebService toMerge, IWebServiceProject wsProject, IAnnotation<IType> wsAnnotation, IAnnotationInspector inspector) throws JavaModelException
+ {
+ // add serviceName name
+ final String wsName = wsAnnotation.getPropertyValue(SERVICE_NAME_ATTRIBUTE) == null ?
+ JaxWsUtils.getDefaultServiceName(wsAnnotation.getAppliedElement().getFullyQualifiedName()) :
+ wsAnnotation.getPropertyValue(SERVICE_NAME_ATTRIBUTE);
+
+ if (!wsName.equals(toMerge.getName()))
+ {
+ util().setFeatureValue(toMerge, DomPackage.IWEB_SERVICE__NAME, wsName);
+ }
+
+ // add targetNamespace
+ final String targetNs = extractTargetNamespace(wsAnnotation);
+ if (!targetNs.equals(toMerge.getTargetNamespace())) {
+ util().setFeatureValue(toMerge, DomPackage.IWEB_SERVICE__TARGET_NAMESPACE, targetNs);
+ }
+
+ // add portName
+ final String portName = wsAnnotation.getPropertyValue(PORT_NAME_ATTRIBUTE)==null ?
+ JaxWsUtils.getDefaultPortName(wsAnnotation.getAppliedElement().getFullyQualifiedName()) :
+ wsAnnotation.getPropertyValue(PORT_NAME_ATTRIBUTE);
+
+ if (!portName.equals(toMerge.getPortName())) {
+ toMerge.setPortName(portName);
+ }
+
+ // add wsdlLocation
+ toMerge.setWsdlLocation(wsAnnotation.getPropertyValue(WSDL_LOCATION_ATTRIBUTE));
+
+ // add endpointInterface
+ final String newSeiImpl = wsAnnotation.getPropertyValue(ENDPOINT_INTERFACE_ATTRIBUTE);
+ if (newSeiImpl == null)
+ {
+ mergeImplicitInterface(obtainImplicitInterfaceInstance(wsProject, toMerge, wsAnnotation), wsAnnotation, inspector);
+ } else
+ {
+ if (toMerge.getServiceEndpoint() == null || !toMerge.getServiceEndpoint().getImplementation().equals(newSeiImpl))
+ {
+ serviceData().map(toMerge, newSeiImpl);
+ resolveInterface(toMerge, wsProject, wsAnnotation.getPropertyValue(ENDPOINT_INTERFACE_ATTRIBUTE));
+ }
+ }
+ }
+
+ private IServiceEndpointInterface obtainImplicitInterfaceInstance(IWebServiceProject wsProject, IWebService ws, IAnnotation<IType> wsAnnotation)
+ {
+ if (ws.getServiceEndpoint() != null && ws.getServiceEndpoint().isImplicit())
+ {
+ return ws.getServiceEndpoint();
+ }
+
+ final IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ util().setFeatureValue(sei, DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT, true);
+ util().setFeatureValue(sei, DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, wsAnnotation.getAppliedElement().getFullyQualifiedName());
+ util().setFeatureValue(ws, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, sei);
+
+ wsProject.getServiceEndpointInterfaces().add(sei);
+
+ return sei;
+ }
+
+ private void mergeImplicitInterface(IServiceEndpointInterface sei, IAnnotation<IType> wsAnnotation, IAnnotationInspector inspector) throws JavaModelException
+ {
+ seiMerger.merge(sei, wsAnnotation, inspector);
+ resource().getSerializerFactory().adapt(sei, IAnnotationSerializer.class);
+ }
+
+ private String extractTargetNamespace(final IAnnotation<IType> wsAnnotation)
+ {
+ // add targetNamespace
+ final String targetNs = wsAnnotation.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE);
+ if (targetNs==null) {
+ return JaxWsUtils.composeJaxWsTargetNamespaceByPackage(wsAnnotation.getAppliedElement().getPackageFragment().getElementName());
+ }
+
+ return targetNs;
+ }
+
+ private void resolveInterface(IWebService ws, IWebServiceProject preffered, String implementation)
+ {
+ IServiceEndpointInterface resolved = null;
+ for (IWebServiceProject prj : getDomBeingLoaded().getWebServiceProjects())
+ {
+ for (IServiceEndpointInterface sei : prj.getServiceEndpointInterfaces())
+ {
+ if (sei.getImplementation().equals(implementation))
+ {
+ resolved = sei;
+ if (preffered.equals(prj))
+ {
+ break;
+ } else
+ {
+ resolved = sei;
+ }
+ }
+ }
+ }
+
+ util().setFeatureValue(ws, DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT, resolved);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMetadata.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMetadata.java
new file mode 100755
index 0000000..7864c26
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMetadata.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.provider;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationPropertyContainer;
+
+/**
+ * Represents metadata for an endpoint. Contains information about the name and namespace of the endpoint. Contains exposed operations. This interface
+ * is intended to be used as input data for implementors of {@link IEndpointGenerator}.
+ *
+ * @author Plamen Pavlov
+ */
+public interface IEndpointMetadata
+{
+ /**
+ * @return The name of enpoint.
+ */
+ public String getName();
+
+ /**
+ * @return The package/namespace of the endpoint.
+ */
+ public String getPackage();
+
+ /**
+ * @return the name of the service representing this endpoint
+ */
+ public String getServiceName();
+
+ /**
+ * Sets the name of the wsdl:service representing this endpoint.
+ *
+ * @param serviceName
+ */
+ public void setServiceName(String serviceName);
+
+ /**
+ * @return the name of the wsdl:port referencing this endpoint which this
+ */
+ public String getPortName();
+
+ /**
+ * Sets the name of the wsdl:port referencing this endpoint which this
+ *
+ * @param portName
+ */
+ public void setPortName(String portName);
+
+ /**
+ * @return the wsdl location in case this endpoint is generated from wsdl otherwise <tt>null</tt>
+ */
+ public String getWsdlLocation();
+
+ /**
+ * Sets the wsdl location in case this endpoint is generated from wsdl
+ *
+ * @param wsdlLocation
+ * location
+ */
+ public void setWsdlLocation(String wsdlLocation);
+
+ /**
+ * @return the namespace URI
+ */
+ public String getNamespaceURI();
+
+ /**
+ * sets the namespace URI
+ *
+ * @param namespaceURI
+ */
+ public void setNamespaceURI(String namespaceURI);
+
+ /**
+ * @return the name of the Service Endpoint Interface containing WebService methods that will be implemented by this endpoint implementation. This
+ * method can return <tt>null</tt>
+ */
+ public String getSEIName();
+
+ /**
+ * Sets the Service Endpoint Interface referenced by this endpoint.
+ *
+ * @param seiName
+ * @throws NullPointerException
+ * in case <tt>seiName</tt> is null
+ * @throws IllegalArgumentException
+ * in case <tt>seiName</tt> is empty string
+ */
+ public void setSEIName(String seiName);
+
+ /**
+ * @return The fully qualified name of endpoint.
+ */
+ public String getFullyQualifiedName();
+
+ /**
+ * @return list of added methods
+ */
+ public List<IEndpointMethod> getMethods();
+
+ /**
+ * Creates an empty instance of {@link IEndpointMethod} with <tt>name</tt> and <tt>returnTypeFQName</tt> and adds it to the set of available
+ * methods.
+ *
+ * @param name
+ * @param returnTypeFQName
+ * @return created IEndpointMethod for added method
+ */
+ public IEndpointMethod addMethod(String name, String returnTypeFQName);
+
+ /**
+ * Adds {@link IAnnotationPropertyContainer} to the {@link IEndpointMetadata} descriptor.
+ *
+ * @param annotationsContainer - Container, which will be added.
+ *
+ */
+ public void addAnnotationsContainer(final IAnnotationPropertyContainer annotationsContainer);
+
+ /**
+ * Returns Set with {@link IAnnotationPropertyContainer} related to the {@link IEndpointMetadata} descriptor.
+ *
+ * @return Set with {@link IAnnotationPropertyContainer}.
+ */
+ public Set<IAnnotationPropertyContainer> getAnnotationsContainer();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMethod.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMethod.java
new file mode 100755
index 0000000..ad21cf0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IEndpointMethod.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.provider;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationPropertyContainer;
+
+/**
+ * An interface representing method in endpoint.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IEndpointMethod
+{
+ /**
+ * @return the method name
+ */
+ public String getName();
+
+ /**
+ * @return the returnFQName
+ */
+ public String getReturnType();
+
+ /**
+ * @param returnTypeFQName
+ * sets the return type
+ */
+ public void setReturnType(String returnTypeFQName);
+
+ /**
+ * @return human readable method representation
+ */
+ public String getSignature();
+
+ /**
+ * @return set of thrown exceptions
+ */
+ public Set<String> getExceptions();
+
+ /**
+ * @param exceptionFQName
+ * add thrown exception to the method
+ */
+ public void addException(String exceptionFQName);
+
+ /**
+ * @return list of method params on the order they appear in method
+ */
+ public List<IMethodParameter> getParameters();
+
+ /**
+ * creates new param ans adds it to the end of parameters list.
+ *
+ * @param type fully qualified type name
+ * @param name parameter name
+ * @return {@link IMethodParameter} creates
+ */
+ public IMethodParameter addParameter(String type, String name);
+
+ /**
+ * Adds {@link IAnnotationPropertyContainer} to the {@link IEndpointMethod} descriptor.
+ *
+ * @param annotationsContainer - Container, which will be added.
+ *
+ */
+ public void addAnnotationsContainer(final IAnnotationPropertyContainer annotationsContainer);
+
+ /**
+ * Returns Set with {@link IAnnotationPropertyContainer} related to the {@link IEndpointMethod} descriptor.
+ *
+ * @return Set with {@link IAnnotationPropertyContainer}.
+ */
+ public Set<IAnnotationPropertyContainer> getAnnotationsContainer();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IMethodParameter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IMethodParameter.java
new file mode 100755
index 0000000..8e73e46
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/provider/IMethodParameter.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.provider;
+
+/**
+ * Interface representing parameter in method
+ *
+ * @author Georgi Vachkov
+ *
+ */
+public interface IMethodParameter
+{
+ /**
+ * @return the parameter name
+ */
+ public String getName();
+
+ /**
+ * @return parameter fully qualified name
+ */
+ public String getType();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/IWsDOMRuntimeInfo.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/IWsDOMRuntimeInfo.java
new file mode 100755
index 0000000..af8cb07
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/IWsDOMRuntimeInfo.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.registry;
+
+import java.util.Map;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.INamedExtensionInfo;
+
+/**
+ * Defines the information structure which should be instantiated upon reading contributors
+ * to the Supported Runtime extension point.
+ *
+ * @author Georgi Hristov I036201
+ *
+ */
+public interface IWsDOMRuntimeInfo extends INamedExtensionInfo
+{
+ /**
+ *
+ * @return the map of project facets relevant for a particular runtime where the key is
+ * the project facet id and the value is the version of the project facet if specified.
+ */
+ public abstract Map<String, String> getProjectFacets();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/WsDOMRuntimeRegistry.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/WsDOMRuntimeRegistry.java
new file mode 100755
index 0000000..f3fc21e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/registry/WsDOMRuntimeRegistry.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.registry;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.util.NamedExtensionInfo;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ *
+ *
+ * @author Georgi Hristov I036201
+ *
+ */
+public class WsDOMRuntimeRegistry
+{
+ private static final class RuntimeInfo extends NamedExtensionInfo implements IWsDOMRuntimeInfo
+ {
+ private Map<String, String> projectFacets;
+
+ RuntimeInfo(final String pId, final String pLabel, final Map<String, String> projectFacets)
+ {
+ super(pId, pLabel);
+
+ this.projectFacets = projectFacets;
+ }
+
+ public Map<String,String> getProjectFacets()
+ {
+ return this.projectFacets;
+ }
+ }
+
+ /** The ID of the extension point for a supported runtime */
+ private static final String RUNTIME_XP = JaxWsDomRuntimePlugin.PLUGIN_ID + ".domruntimes"; //$NON-NLS-1$
+
+ /** Error message displayed when extension point not properly defined */
+ public static final String EXTENSION_NOT_PROPERLY_REGISTERED = "Registered runtime extension not properly registered (error in plugin.xml)"; //$NON-NLS-1$
+
+ private static final String XP_IMPLEMENTATION_ELEMENT = "implementation"; //$NON-NLS-1$
+
+ private static final String XP_PROJECT_FACET_ELEMENT = "project_facet"; //$NON-NLS-1$
+
+ private static final String XP_PROJECT_FACET_ID = "id"; //$NON-NLS-1$
+
+ private static final String XP_PROJECT_FACET_VERSION = "version"; //$NON-NLS-1$
+
+ private static final String XP_IMPLEMENTATION_ELEMENT_CLASS_ATTR = "class"; //$NON-NLS-1$
+
+ /**
+ * Creates and returns a new instance of the executable extension.
+ *
+ * @param info the descriptor object built during extension point load
+ * @return instance of runtime extension implementation
+ */
+ public static IWsDOMRuntimeExtension instantiateRuntime(final IWsDOMRuntimeInfo info)
+ {
+ final IExtension ext = findExtension(info);
+
+ if(ext==null)
+ {
+ logger().logError(EXTENSION_NOT_PROPERLY_REGISTERED);
+ return null;
+ }
+
+ for (IConfigurationElement el : ext.getConfigurationElements())
+ {
+ if (el.getName().equals(XP_IMPLEMENTATION_ELEMENT))
+ {
+ try
+ {
+ return (IWsDOMRuntimeExtension) el.createExecutableExtension(XP_IMPLEMENTATION_ELEMENT_CLASS_ATTR);
+ }
+ catch (final CoreException e)
+ {
+ logger().logError("Unable to create extension", e); //$NON-NLS-1$
+ return null;
+
+ }
+ catch (final ClassCastException e)
+ {
+ logger().logError("Implementation class does not implement proper interface", e); //$NON-NLS-1$
+ return null;
+ }
+ }
+ }
+
+ logger().logError(EXTENSION_NOT_PROPERLY_REGISTERED);
+ throw new RuntimeException(EXTENSION_NOT_PROPERLY_REGISTERED);
+ }
+
+ /**
+ * Locates the extension point contribution definition for this particular runtime.
+ *
+ * @param info the descriptor object built during extension point load
+ * @return instance of contribution definition
+ */
+ public static IExtension findExtension(final IWsDOMRuntimeInfo info)
+ {
+ if(info!=null)
+ {
+ final IExtension[] exts = Platform.getExtensionRegistry().getExtensionPoint(RUNTIME_XP).getExtensions();
+
+ for (int i = 0; i < exts.length; i++)
+ {
+ if (exts[i].getSimpleIdentifier().equals(info.getId()))
+ {
+ return exts[i];
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the registered runtimes.
+ *
+ * @return set of information records for the registered runtimes
+ */
+ public static Collection<IWsDOMRuntimeInfo> getRegisteredRuntimesInfo()
+ {
+ final IExtension[] exts = Platform.getExtensionRegistry().getExtensionPoint(RUNTIME_XP).getExtensions();
+ final Collection<IWsDOMRuntimeInfo> runtimeDescriptors = new ArrayList<IWsDOMRuntimeInfo>(exts.length);
+
+ for (int i = 0; i < exts.length; i++)
+ {
+ HashMap<String,String> projectFacets = new HashMap<String,String>();
+
+ for (IConfigurationElement el : exts[i].getConfigurationElements())
+ {
+ if (el.getName().equals(XP_PROJECT_FACET_ELEMENT))
+ {
+ projectFacets.put(el.getAttribute(XP_PROJECT_FACET_ID),el.getAttribute(XP_PROJECT_FACET_VERSION));
+ }
+ }
+
+
+ runtimeDescriptors.add(new RuntimeInfo(exts[i].getSimpleIdentifier(), exts[i].getLabel(), projectFacets));
+ }
+
+ return runtimeDescriptors;
+ }
+
+ /**
+ * Returns the runtime descriptor object corresponding to this runtime id.
+ *
+ * @param runtimeId the identifier of the runtime
+ * @return descriptor object for the needed runtime
+ */
+ public static IWsDOMRuntimeInfo getRuntimeInfo(final String runtimeId)
+ {
+ Iterator<IWsDOMRuntimeInfo> registeredRuntime = getRegisteredRuntimesInfo().iterator();
+
+ while(registeredRuntime.hasNext())
+ {
+ IWsDOMRuntimeInfo runtimeInfo = registeredRuntime.next();
+
+ if(runtimeInfo.getId().equals(runtimeId))
+ {
+ return runtimeInfo;
+ }
+ }
+
+ return null;
+ }
+
+ private static ILogger logger()
+ {
+ return new Logger();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Dom2ResourceMapper.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Dom2ResourceMapper.java
new file mode 100755
index 0000000..2ef2526
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Dom2ResourceMapper.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+
+/**
+ * Class that takes care for mapping DOM objects to Eclipse resources.
+ *
+ * @author Georgi Vachkov
+ */
+public class Dom2ResourceMapper
+{
+ /** the singleton instance */
+ public static final Dom2ResourceMapper INSTANCE = new Dom2ResourceMapper();
+
+ private DomSwitch<String> implClassFinderSwitch;
+
+ /**
+ * Singleton Constructor
+ */
+ private Dom2ResourceMapper() {
+ this.implClassFinderSwitch = createImplFinderSwitch();
+ }
+
+ /**
+ * Finds underlying {@link IResource} for this DOM object
+ * @param eObject the DOM object
+ * @return found resource or <code>null</code>
+ * @throws JavaModelException
+ */
+ public IResource findResource(final EObject eObject) throws JavaModelException
+ {
+ ContractChecker.nullCheckParam(eObject);
+ switch (eObject.eClass().getClassifierID())
+ {
+ case DomPackage.IWEB_SERVICE:
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE:
+ case DomPackage.IWEB_METHOD:
+ case DomPackage.IWEB_PARAM:
+ final IType type = findType(eObject);
+ return type==null ? null : type.getResource();
+ case DomPackage.IWEB_SERVICE_PROJECT:
+ return findProject((IWebServiceProject)eObject);
+ }
+
+ return null;
+ }
+
+ /**
+ * Finds IProject instance for the web service project represented by <code>wsProject</code>
+ * @param wsProject the project DOM object
+ * @return found resource or <code>null</code>
+ */
+ public IProject findProject(final IWebServiceProject wsProject)
+ {
+ if (wsProject == null) {
+ return null;
+ }
+
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(wsProject.getName());
+ }
+
+ /**
+ * Finds underlying {@link IType} instance for this <code>eObject</code>
+ * @param eObject the DOM object
+ * @return the IType containing this <code>eObject</code> or <code>null</code>
+ * @throws JavaModelException
+ */
+ public IType findType(final EObject eObject) throws JavaModelException
+ {
+ ContractChecker.nullCheckParam(eObject);
+
+ final IProject project = findProject(DomUtil.INSTANCE.findWsProject(eObject));
+ final IJavaProject javaProject = JavaCore.create(project);
+ final String fqName = implClassFinderSwitch.doSwitch(eObject);
+ if (javaProject==null || fqName == null) {
+ return null;
+ }
+
+ return javaProject.findType(fqName);
+ }
+
+ private DomSwitch<String> createImplFinderSwitch()
+ {
+ return new DomSwitch<String>()
+ {
+ @Override
+ public String caseIWebService(IWebService ws) {
+ return ws.getImplementation();
+ }
+
+ @Override
+ public String caseIServiceEndpointInterface(IServiceEndpointInterface sei) {
+ return sei == null ? null : sei.getImplementation();
+ }
+
+ @Override
+ public String caseIWebMethod(IWebMethod wm) {
+ return wm == null ? null : caseIServiceEndpointInterface((IServiceEndpointInterface) wm.eContainer());
+ }
+
+ @Override
+ public String caseIWebParam(IWebParam wp) {
+ return caseIWebMethod((IWebMethod)wp.eContainer());
+ }
+ };
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomAdapterFactory.java
new file mode 100755
index 0000000..1fb53cd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomAdapterFactory.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage
+ * @generated
+ */
+public class DomAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static DomPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomAdapterFactory() {
+ if (modelPackage == null)
+ {
+ modelPackage = DomPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DomSwitch<Adapter> modelSwitch =
+ new DomSwitch<Adapter>()
+ {
+ @Override
+ public Adapter caseIDOM(IDOM object)
+ {
+ return createIDOMAdapter();
+ }
+ @Override
+ public Adapter caseIJavaWebServiceElement(IJavaWebServiceElement object)
+ {
+ return createIJavaWebServiceElementAdapter();
+ }
+ @Override
+ public Adapter caseIServiceEndpointInterface(IServiceEndpointInterface object)
+ {
+ return createIServiceEndpointInterfaceAdapter();
+ }
+ @Override
+ public Adapter caseIWebMethod(IWebMethod object)
+ {
+ return createIWebMethodAdapter();
+ }
+ @Override
+ public Adapter caseIWebParam(IWebParam object)
+ {
+ return createIWebParamAdapter();
+ }
+ @Override
+ public Adapter caseIWebService(IWebService object)
+ {
+ return createIWebServiceAdapter();
+ }
+ @Override
+ public Adapter caseIWebServiceProject(IWebServiceProject object)
+ {
+ return createIWebServiceProjectAdapter();
+ }
+ @Override
+ public Adapter caseIWebType(IWebType object)
+ {
+ return createIWebTypeAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM <em>IDOM</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM
+ * @generated
+ */
+ public Adapter createIDOMAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement <em>IJava Web Service Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement
+ * @generated
+ */
+ public Adapter createIJavaWebServiceElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface <em>IService Endpoint Interface</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface
+ * @generated
+ */
+ public Adapter createIServiceEndpointInterfaceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod <em>IWeb Method</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod
+ * @generated
+ */
+ public Adapter createIWebMethodAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam <em>IWeb Param</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam
+ * @generated
+ */
+ public Adapter createIWebParamAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService <em>IWeb Service</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService
+ * @generated
+ */
+ public Adapter createIWebServiceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject <em>IWeb Service Project</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject
+ * @generated
+ */
+ public Adapter createIWebServiceProjectAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType <em>IWeb Type</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType
+ * @generated
+ */
+ public Adapter createIWebTypeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+ @Override
+ public Adapter adapt(Notifier target, Object type)
+ {
+ synchronized (target) {
+ return super.adapt(target, type);
+ }
+ }
+
+} //DomAdapterFactory
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomSwitch.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomSwitch.java
new file mode 100755
index 0000000..8952148
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/DomSwitch.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage
+ * @generated
+ */
+public class DomSwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static DomPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomSwitch() {
+ if (modelPackage == null)
+ {
+ modelPackage = DomPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID)
+ {
+ case DomPackage.IDOM:
+ {
+ IDOM idom = (IDOM)theEObject;
+ T result = caseIDOM(idom);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT:
+ {
+ IJavaWebServiceElement iJavaWebServiceElement = (IJavaWebServiceElement)theEObject;
+ T result = caseIJavaWebServiceElement(iJavaWebServiceElement);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE:
+ {
+ IServiceEndpointInterface iServiceEndpointInterface = (IServiceEndpointInterface)theEObject;
+ T result = caseIServiceEndpointInterface(iServiceEndpointInterface);
+ if (result == null) result = caseIJavaWebServiceElement(iServiceEndpointInterface);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IWEB_METHOD:
+ {
+ IWebMethod iWebMethod = (IWebMethod)theEObject;
+ T result = caseIWebMethod(iWebMethod);
+ if (result == null) result = caseIJavaWebServiceElement(iWebMethod);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IWEB_PARAM:
+ {
+ IWebParam iWebParam = (IWebParam)theEObject;
+ T result = caseIWebParam(iWebParam);
+ if (result == null) result = caseIJavaWebServiceElement(iWebParam);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IWEB_SERVICE:
+ {
+ IWebService iWebService = (IWebService)theEObject;
+ T result = caseIWebService(iWebService);
+ if (result == null) result = caseIJavaWebServiceElement(iWebService);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IWEB_SERVICE_PROJECT:
+ {
+ IWebServiceProject iWebServiceProject = (IWebServiceProject)theEObject;
+ T result = caseIWebServiceProject(iWebServiceProject);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DomPackage.IWEB_TYPE:
+ {
+ IWebType iWebType = (IWebType)theEObject;
+ T result = caseIWebType(iWebType);
+ if (result == null) result = caseIJavaWebServiceElement(iWebType);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IDOM</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IDOM</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIDOM(IDOM object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IJava Web Service Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IJava Web Service Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIJavaWebServiceElement(IJavaWebServiceElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IService Endpoint Interface</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IService Endpoint Interface</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIServiceEndpointInterface(IServiceEndpointInterface object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IWeb Method</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IWeb Method</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIWebMethod(IWebMethod object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IWeb Param</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IWeb Param</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIWebParam(IWebParam object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IWeb Service</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IWeb Service</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIWebService(IWebService object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IWeb Service Project</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IWeb Service Project</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIWebServiceProject(IWebServiceProject object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>IWeb Type</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>IWeb Type</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIWebType(IWebType object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //DomSwitch
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Jee5DomUtils.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Jee5DomUtils.java
new file mode 100755
index 0000000..7455d79
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/Jee5DomUtils.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Utility for some specification specific logics that are frequently used
+ * while dealing with DOM objects.
+ *
+ * @author Georgi Vachkov
+ */
+public class Jee5DomUtils
+{
+ /** the singleton instance */
+ private static Jee5DomUtils instance;
+
+ private Jee5DomUtils() {
+ // singleton
+ }
+
+ /**
+ * Method that decides if the attribute 'partName' is used at all according
+ * to JSR-181 section 4.4.1 - attribute 'partName' column 'meaning'.
+ * @param webParam the webParam to be checked
+ * @return <code>true</code> in case partName is used
+ */
+ public boolean isPartNameUsed(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+
+ return webMethod.getSoapBindingStyle()==SOAPBindingStyle.RPC ||
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.BARE;
+ }
+
+ /**
+ * Method that decides is the attribute 'name' is used at all
+ * according to JSR-181 section 4.4.1 - attribute 'name' column 'meaning'
+ * @param webParam
+ * @return return <code>true</code> in case name is used
+ */
+ public boolean isNameUsed(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ if( webMethod.getSoapBindingStyle()==SOAPBindingStyle.DOCUMENT || webParam.isHeader() ) {
+ return true;
+ }
+
+ final IAnnotation<? extends IJavaElement> annotation = findAnnotation(webParam, WP_ANNOTATION);
+ if (annotation==null) {
+ return false;
+ }
+
+ return annotation.getPropertyValue(WPAnnotationFeatures.PART_NAME_ATTRIBUTE)==null;
+ }
+
+ /**
+ * Helper method to extract annotation with fully qualified name <code>annFQName</code>
+ * @param eObject the object to search in
+ * @param annFQName the FQ name of searched annotation
+ * @return found annotation or <code>null</code>
+ */
+ public IAnnotation<? extends IJavaElement> findAnnotation(final EObject eObject, final String annFQName)
+ {
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(eObject, IAnnotationAdapter.class);
+ if (adapter!=null) {
+ return adapter.getAnnotation(annFQName);
+ }
+
+ return null;
+ }
+
+ /**
+ * Method that decides if the param name is required to be put in the annotation according
+ * to JSR-181 section 4.4.1 - attribute 'name' column 'meaning'.
+ * @param webParam
+ * @return <code>true</code> if the name attribute should be put on annotation
+ */
+ public boolean isNameRequired(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+
+ if (webMethod.getSoapBindingStyle()==SOAPBindingStyle.DOCUMENT &&
+ webMethod.getSoapBindingParameterStyle()==SOAPBindingParameterStyle.BARE &&
+ (webParam.getKind()==WebParamKind.INOUT || webParam.getKind()==WebParamKind.OUT)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return the singleton instance
+ */
+ public static Jee5DomUtils getInstance()
+ {
+ if (instance == null) {
+ instance = new Jee5DomUtils();
+ }
+
+ return instance;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/LocatorExtractor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/LocatorExtractor.java
new file mode 100755
index 0000000..aa361cc
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/LocatorExtractor.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+
+/**
+ * Class that extracts {@link ILocator} out of DOM object
+ *
+ * @author Georgi Vachkov
+ */
+public class LocatorExtractor
+{
+ private static LocatorExtractor instance;
+
+ private LocatorExtractor() {
+ // singleton instance
+ }
+
+ /**
+ * Extracts the {@link ILocator}
+ * @param eObject
+ * @return {@link ILocator} instance or <code>null</code> in case the {@link IJavaElement}
+ * cannot be found for this <code>eObject</code>.
+ * @throws JavaModelException
+ * @throws BadLocationException
+ * @throws IllegalArgumentException in case <code>eObject</code> is DOM object for which
+ * this method is not implemented
+ */
+ public ILocator find(final EObject eObject) throws JavaModelException, BadLocationException
+ {
+ final IType seiType = findIType(eObject);
+ if (seiType == null) {
+ return null;
+ }
+
+ switch(eObject.eClass().getClassifierID())
+ {
+ case DomPackage.IWEB_METHOD:
+ return getLocatorForMethod(seiType, (IWebMethod)eObject);
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE:
+ return getPosition(seiType);
+ case DomPackage.IWEB_SERVICE:
+ return getPosition(seiType);
+ case DomPackage.IWEB_PARAM:
+ return getLocatorForMethod(seiType, (IWebMethod)eObject.eContainer());
+ }
+
+ throw new IllegalArgumentException("Unknown object type");//$NON-NLS-1$
+ }
+
+ private ILocator getLocatorForMethod(final IType seiType, final IWebMethod webMethod) throws JavaModelException, BadLocationException
+ {
+ final IMethod method = DomUtil.INSTANCE.findMethod(seiType, webMethod);
+ if (method!=null) {
+ return getPosition(method);
+ }
+
+ return null;
+ }
+
+ private IType findIType(final EObject eObject) throws JavaModelException {
+ return Dom2ResourceMapper.INSTANCE.findType(eObject);
+ }
+
+ private ILocator getPosition(final IMember member) throws JavaModelException, BadLocationException
+ {
+ final int offset = member.getNameRange().getOffset();
+ final int length = member.getNameRange().getLength();
+ final int lineNumber = getLineNumber(member);
+
+ return new ILocator()
+ {
+ public int getStartPosition() {
+ return offset;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public int getLineNumber() {
+ return lineNumber;
+ }
+ };
+ }
+
+ private int getLineNumber(final IMember member) throws JavaModelException, BadLocationException
+ {
+ final IDocument doc = new Document(member.getCompilationUnit().getBuffer().getContents());
+
+ return doc.getLineOfOffset(member.getNameRange().getOffset()) + 1;
+ }
+
+ /**
+ * @return the singleton instance
+ */
+ public static LocatorExtractor getInstance()
+ {
+ if (instance==null) {
+ instance = new LocatorExtractor();
+ }
+
+ return instance;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/ParamValueComparator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/ParamValueComparator.java
new file mode 100755
index 0000000..4e77245
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/util/ParamValueComparator.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.util;
+
+import java.util.Comparator;
+import java.util.TreeSet;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * Class that compares {@link IParamValuePair} by property name. Intended to be used when
+ * creating a {@link TreeSet} for annotation properties.
+ *
+ * @author Georgi Vachkov
+ */
+public class ParamValueComparator implements Comparator<IParamValuePair>
+{
+ public enum Order {Normal, Reversed};
+
+ private final Order order;
+
+ public ParamValueComparator() {
+ order = Order.Normal;
+ }
+
+ public ParamValueComparator(final Order order) {
+ this.order = order;
+ }
+
+
+ public int compare(IParamValuePair o1, IParamValuePair o2)
+ {
+ if(order==Order.Normal) {
+ return o1.getParam().compareTo(o2.getParam());
+ }
+
+ return o2.getParam().compareTo(o1.getParam());
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/AbstractValidationConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/AbstractValidationConstraint.java
new file mode 100755
index 0000000..3b465ae
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/AbstractValidationConstraint.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.model.ModelConstraint;
+import org.eclipse.emf.validation.service.IConstraintDescriptor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.LocatorExtractor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl.ConstraintStatusExtended;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl.ProblemLocation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Base class to be used by other DOM constraints. Provides useful methods for
+ * creating {@link IConstraintStatus} during validation, extraction of
+ * error location etc.
+ *
+ * @author Georgi Vachkov
+ */
+public abstract class AbstractValidationConstraint extends ModelConstraint
+{
+ private ILogger logger;
+ private Jee5DomUtils jee5DomUtil;
+
+ /**
+ * Constructor
+ * @param descriptor - the {@link IConstraintDescriptor} for the specific constraint
+ * should not be <code>null</code>
+ */
+ public AbstractValidationConstraint(IConstraintDescriptor descriptor) {
+ super(descriptor);
+
+ nullCheckParam(descriptor, "descriptor");//$NON-NLS-1$
+ logger = new Logger();
+ jee5DomUtil = Jee5DomUtils.getInstance();
+ }
+
+ /**
+ * Abstract method called when the real validation have to take place. Override
+ * this method and implement your validation logic.
+ * @param ctx the validation context
+ * @return the status of your validation
+ * @throws CoreException
+ */
+ protected abstract IStatus doValidate(IValidationContext ctx) throws CoreException;
+
+ public IStatus validate(IValidationContext ctx)
+ {
+ try {
+ return doValidate(ctx);
+ } catch (CoreException e) {
+ logger().logError(e.getMessage(), e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Creates OK status
+ * @param object the validated object
+ * @return {@link IConstraintStatus} instance with severity {@link IStatus#OK}
+ * @throws JavaModelException
+ */
+ protected IConstraintStatusExtended createOkStatus(EObject object) throws JavaModelException
+ {
+ return new ConstraintStatusExtended(this, object, IStatus.OK, 0, "", new HashSet<IProblemLocation>(0));//$NON-NLS-1$
+ }
+
+ /**
+ * Creates {@link IConstraintStatus} instance with severity depending on the severity defined by
+ * {@link IConstraintDescriptor#getSeverity()}.
+ * @param object the validated object
+ * @param message the message to be displayed
+ * @param annFQName the fully qualified name on the annotation validated
+ * @param attributeName the name of the attribute validated
+ * @return created object
+ * @throws JavaModelException
+ */
+ protected IConstraintStatusExtended createStatus(EObject object, String message, String annFQName, String attributeName) throws JavaModelException
+ {
+ return createStatus(object, message, getLocator(object, annFQName, attributeName));
+ }
+
+ protected IConstraintStatusExtended createStatus(final EObject object, final String message, final IProblemLocation locator)
+ {
+ final Set<IProblemLocation> problems = new HashSet<IProblemLocation>(1);
+ problems.add(locator);
+
+ return new ConstraintStatusExtended(this, object, message, problems);
+ }
+
+ /**
+ * Creates {@link IProblemLocation} instance out of {@link EObject} instance.
+ * Defines which is the {@link IResource} containing this DOM object and tries to
+ * extract {@link ILocator}.
+ * @param eObject
+ * @param annFQName
+ * @param attributeName
+ * @return created location
+ * @throws JavaModelException
+ */
+ protected IProblemLocation getLocator(EObject eObject, String annFQName, String attributeName) throws JavaModelException
+ {
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(eObject, IAnnotationAdapter.class);
+ final IAnnotation<? extends IJavaElement> annotation = annFQName==null ? null : adapter.getAnnotation(annFQName);
+ if (annotation==null) {
+ return new ProblemLocation(findResource(eObject), getLocatorForImplementation(eObject));
+ }
+
+ ILocator locator = null;
+ if (attributeName != null) {
+ locator = getLocatorForAttributeValue(annotation, attributeName);
+ }
+
+ if (locator == null) {
+ locator = annotation.getLocator();
+ }
+
+ return new ProblemLocation(annotation.getAppliedElement().getResource(), locator);
+ }
+
+ protected ILocator getLocatorForAttributeValue(IAnnotation<? extends IJavaElement> annotation, String attributeName)
+ {
+ for (IParamValuePair pair : annotation.getParamValuePairs())
+ {
+ if(pair.getParam().equals(attributeName)) {
+ return pair.getValue().getLocator();
+ }
+ }
+
+ return null;
+ }
+
+ protected ILocator getLocatorForImplementation(final EObject eObject) throws JavaModelException {
+ try {
+ return LocatorExtractor.getInstance().find(eObject);
+ } catch (BadLocationException e) {
+ logger().logError(e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ protected IResource findResource(EObject eObject) throws JavaModelException {
+ return Dom2ResourceMapper.INSTANCE.findResource(eObject);
+ }
+
+ protected IAnnotation<? extends IJavaElement> findAnnotation(final EObject eObject, final String annFQName)
+ {
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(eObject, IAnnotationAdapter.class);
+ return adapter.getAnnotation(annFQName);
+ }
+
+ protected ILogger logger() {
+ return logger;
+ }
+
+ protected Jee5DomUtils jee5DomUtil() {
+ return jee5DomUtil;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidationConstraintDescriptor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidationConstraintDescriptor.java
new file mode 100755
index 0000000..4070653
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidationConstraintDescriptor.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.CategoryManager;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.service.AbstractConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+public abstract class DomValidationConstraintDescriptor extends AbstractConstraintDescriptor
+{
+ public DomValidationConstraintDescriptor() {
+ addCategory(CategoryManager.getInstance().getCategory("org.eclipse.jst.ws.jaxws.dom.jee5"));//$NON-NLS-1$
+ }
+
+ public String getBody() {
+ return null;
+ }
+
+ public String getDescription() {
+ return JaxWsDomRuntimeMessages.DomValidationConstraintDescriptor_WS_DOM_VALIDATION_CONSTRAINT;
+ }
+
+ public EvaluationMode<EObject> getEvaluationMode() {
+ return EvaluationMode.BATCH;
+ }
+
+ public String getMessagePattern() {
+ return null;
+ }
+
+ public String getName() {
+ return JaxWsDomRuntimeMessages.DomValidationConstraintDescriptor_WS_DOM_VALIDATION_CONSTRAINT;
+ }
+
+ public boolean targetsEvent(Notification notification) {
+ return true;
+ }
+
+ public boolean targetsTypeOf(EObject object) {
+ return true;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidatorFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidatorFactory.java
new file mode 100755
index 0000000..7764b9d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/DomValidatorFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.util.XpUtil;
+
+/**
+ * Singleton factory used to instantiate registered DOM validators.
+ *
+ * @author Georgi Vachkov
+ */
+public class DomValidatorFactory
+{
+ /** The extension point ID */
+ public static final String DOM_VALIDATION_XP = "org.eclipse.jst.ws.jaxws.dom.runtime.domValidator"; //$NON-NLS-1$
+
+ /** Factory's singleton instance */
+ public static final DomValidatorFactory INSTANCE = new DomValidatorFactory();
+
+ private DomValidatorFactory() {
+ // singleton
+ }
+
+ /**
+ * Extracts all registered DOM validators.
+ * @return collection of all registered DOM validators
+ */
+ public Collection<IDomValidator> getRegisteredValidators()
+ {
+ final List<IDomValidator> validators = new ArrayList<IDomValidator>();
+ final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DOM_VALIDATION_XP);
+ for (IExtension extension : extensionPoint.getExtensions()) {
+ validators.add(((IDomValidator) XpUtil.instantiateImplementation(extension)));
+ }
+
+ return validators;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IConstraintStatusExtended.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IConstraintStatusExtended.java
new file mode 100755
index 0000000..eb7c656
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IConstraintStatusExtended.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import java.util.Set;
+
+import org.eclipse.emf.validation.model.IConstraintStatus;
+
+/**
+ * Extended constraint status which carries information about the problem location
+ * @author Danail Branekov
+ */
+public interface IConstraintStatusExtended extends IConstraintStatus
+{
+ /**
+ * Gets the set of the problem locations. The result is an unmodifiable set
+ * @return set of problem locations; empty set if none
+ */
+ public Set<IProblemLocation> getProblemLocations();
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IDomValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IDomValidator.java
new file mode 100755
index 0000000..b9266a9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IDomValidator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Implement this interface if you intend to implement specific DOM runtime validation.
+ * You need to register the validator using org.eclipse.jst.ws.jaxws.dom.runtime.domValidator
+ * extension point and specify for which DOM runtime version it will be relevant.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IDomValidator
+{
+ /**
+ * Called when validation is triggered - for details see WST validation framework and
+ * DomValidationManager.
+ * @param object object to be validated
+ * @return the validation results
+ */
+ public IStatus validate(EObject object);
+
+ /**
+ * Here you must return the DOM runtime ID which this validator supports
+ * @return DOM runtime ID
+ */
+ public String getSupportedDomRuntime();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IProblemLocation.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IProblemLocation.java
new file mode 100755
index 0000000..220ca5a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/IProblemLocation.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+/**
+ * Interface that provides information on where the problem marker should be set/removed
+ *
+ * @author Georgi Vachkov
+ */
+public interface IProblemLocation
+{
+ /**
+ * The resource on which the marker to be set or removed
+ * @return not <code>null</code> {@link IResource} instance
+ */
+ public IResource getResource();
+
+ /**
+ * The exact location in code where the marker to be put
+ * @return the {@link ILocator} instance to define the start char and length of text
+ * to be underlined by the marker. This method might return <code>null</code> in case
+ * location info is not relevant - for example when marker just needs to be removed.
+ */
+ public ILocator getLocator();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/JaxWsDomValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/JaxWsDomValidator.java
new file mode 100755
index 0000000..92a5860
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/JaxWsDomValidator.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ITraversalStrategy;
+import org.eclipse.emf.validation.service.ModelValidationService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension;
+
+/**
+ * JAX-WS runtime DOM validator. Registered to the validation framework
+ * to contribute the validation process.
+ *
+ * @author Georgi Vachkov
+ */
+public class JaxWsDomValidator implements IDomValidator
+{
+ public IStatus validate(EObject object)
+ {
+ final IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ validator.setReportSuccesses(true);
+ validator.getConstraintFilters();
+ validator.setTraversalStrategy(new ITraversalStrategy.Recursive());
+
+ validator.validate(object, null);
+
+ return Status.OK_STATUS;
+ }
+
+ public String getSupportedDomRuntime() {
+ return Jee5WsDomRuntimeExtension.ID;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsDynamicModelConstraintProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsDynamicModelConstraintProvider.java
new file mode 100755
index 0000000..49b64a0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsDynamicModelConstraintProvider.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.IModelConstraint;
+import org.eclipse.emf.validation.service.IModelConstraintProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomSwitch;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei.SeiConstraintProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod.WmConstraintProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam.WpConstraintProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice.WsConstraintProvider;
+
+public class WsDynamicModelConstraintProvider implements IModelConstraintProvider
+{
+ private final DomSwitch<Collection<IModelConstraint>> domSwitch;
+ private final WsConstraintProvider wsProvider;
+ private final SeiConstraintProvider seiProvider;
+ private final WmConstraintProvider wmProvider;
+ private final WpConstraintProvider wpProvider;
+
+
+ public WsDynamicModelConstraintProvider()
+ {
+ domSwitch = createDomSwitch();
+ wsProvider = new WsConstraintProvider();
+ seiProvider = new SeiConstraintProvider();
+ wmProvider = new WmConstraintProvider();
+ wpProvider = new WpConstraintProvider();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection getBatchConstraints(EObject eObject, Collection constraints)
+ {
+ final Collection<IModelConstraint> modelConstraints = domSwitch.doSwitch(eObject);
+ if (modelConstraints!=null) {
+ constraints.addAll(modelConstraints);
+ }
+
+ return constraints;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection getLiveConstraints(Notification arg0, Collection constraints) {
+ return constraints;
+ }
+
+ private DomSwitch<Collection<IModelConstraint>> createDomSwitch()
+ {
+ return new DomSwitch<Collection<IModelConstraint>>()
+ {
+ public Collection<IModelConstraint> caseIWebService(IWebService object) {
+ return wsProvider.getConstraints();
+ }
+
+ @Override
+ public Collection<IModelConstraint> caseIServiceEndpointInterface(IServiceEndpointInterface object) {
+ return seiProvider.getConstraints();
+ }
+
+ @Override
+ public Collection<IModelConstraint> caseIWebMethod(IWebMethod object) {
+ return wmProvider.getConstraints();
+ }
+
+ @Override
+ public Collection<IModelConstraint> caseIWebParam(IWebParam object) {
+ return wpProvider.getConstraints();
+ }
+ };
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsProblemsReporter.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsProblemsReporter.java
new file mode 100755
index 0000000..0cdb38a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/WsProblemsReporter.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IValidationListener;
+import org.eclipse.emf.validation.service.ValidationEvent;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * Problems reporter. Listens to validation events and reports errors.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsProblemsReporter implements IValidationListener
+{
+ /** The validation marker ID */
+ public static final String MARKER_ID = DomValidationConstants.MARKER_ID;
+
+
+ public void validationOccurred(ValidationEvent event)
+ {
+ final List<IConstraintStatus> list = event.getValidationResults();
+ for (IConstraintStatus cStatus : list)
+ {
+ assert cStatus instanceof IConstraintStatusExtended;
+
+ if (cStatus.isOK()) {
+ continue;
+ }
+
+ processStatus(cStatus);
+ }
+ }
+
+ private void processStatus(final IConstraintStatus status)
+ {
+ if (!(status instanceof IConstraintStatusExtended)) {
+ return;
+ }
+
+ try {
+ final IProblemLocation locator = ((IConstraintStatusExtended)status).getProblemLocations().iterator().next();
+ final IMarker marker = locator.getResource().createMarker(MARKER_ID);
+ if (locator.getLocator() != null)
+ {
+ marker.setAttribute(IMarker.CHAR_START, locator.getLocator().getStartPosition());
+ marker.setAttribute(IMarker.CHAR_END, locator.getLocator().getStartPosition() + locator.getLocator().getLength());
+ marker.setAttribute(IMarker.LINE_NUMBER, locator.getLocator().getLineNumber());
+ }
+ marker.setAttribute(IMarker.MESSAGE, status.getMessage());
+ marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
+ marker.setAttribute(IMarker.SEVERITY, getMarkerSeverity(status.getSeverity()));
+ marker.setAttribute(IMarker.SOURCE_ID, status.getConstraint().getDescriptor().getId());
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, DomUtil.INSTANCE.calcUniqueImpl(status.getTarget()));
+ }
+ catch (CoreException e) {
+ logger().logError(e.getMessage(), e);
+ }
+ }
+
+ private int getMarkerSeverity(int statusSeverity)
+ {
+ switch(statusSeverity)
+ {
+ case IStatus.INFO: return IMarker.SEVERITY_INFO;
+ case IStatus.WARNING: return IMarker.SEVERITY_WARNING;
+ default:
+ return IMarker.SEVERITY_ERROR;
+ }
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ConstraintStatusExtended.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ConstraintStatusExtended.java
new file mode 100755
index 0000000..e41ea0a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ConstraintStatusExtended.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.ConstraintStatus;
+import org.eclipse.emf.validation.model.IModelConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IConstraintStatusExtended;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IProblemLocation;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+/**
+ * Extended constraint status which carries information about the problem location
+ * @author Danail Branekov
+ */
+public class ConstraintStatusExtended extends ConstraintStatus implements IConstraintStatusExtended
+{
+ private final Set<IProblemLocation> problemLocations;
+
+ /**
+ * Constructs a <code>ConstraintStatusExtended</code> instance with empty result locus
+ * @param constraint
+ * @param target
+ * @param severity
+ * @param code
+ * @param message
+ * @param problemLocations a set of problem locations or empty set if none; cannot be null.<br>
+ *
+ * @see ConstraintStatus#ConstraintStatus(IModelConstraint, EObject, int, int, String, Set)
+ */
+ public ConstraintStatusExtended(final IModelConstraint constraint, final EObject target, final int severity, final int code, final String message, final Set<IProblemLocation> problemLocations)
+ {
+ super(constraint, target, severity, code, message, new HashSet<EObject>());
+ ContractChecker.nullCheckParam(problemLocations, "problemLocation");//$NON-NLS-1$
+ this.problemLocations = problemLocations;
+ }
+
+ /**
+ * Constructs a <code>ConstraintStatusExtended</code> instance with empty result locus
+ * @param constraint
+ * @param target
+ * @param message
+ * @param problemLocations a set of problem locations or empty set if none; cannot be null.<br>
+ *
+ * @see ConstraintStatus#ConstraintStatus(IModelConstraint, EObject, String, Set)
+ */
+ public ConstraintStatusExtended(final IModelConstraint constraint, final EObject target, final String message, final Set<IProblemLocation> problemLocations)
+ {
+ super(constraint, target, message, new HashSet<EObject>());
+ this.problemLocations = problemLocations;
+ }
+
+ public Set<IProblemLocation> getProblemLocations()
+ {
+ return Collections.unmodifiableSet(this.problemLocations);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ProblemLocation.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ProblemLocation.java
new file mode 100755
index 0000000..9a54775
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/impl/ProblemLocation.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IProblemLocation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+
+public class ProblemLocation implements IProblemLocation
+{
+ private final IResource resource;
+ private final ILocator locator;
+
+ public ProblemLocation(IResource resource, ILocator locator)
+ {
+ nullCheckParam(resource, "resource");//$NON-NLS-1$
+
+ this.resource = resource;
+ this.locator = locator;
+ }
+
+ public ILocator getLocator() {
+ return locator;
+ }
+
+ public IResource getResource() {
+ return resource;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.java
new file mode 100755
index 0000000..ab4c1a4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ValidationMessages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages"; //$NON-NLS-1$
+
+ public static String BottomUpProviderGenerator_FailedtoAnnotate;
+
+ public static String BottomUpProviderGenerator_FailedToCollectMethods;
+
+ public static String BottomUpProviderGenerator_MethodNotSupported;
+
+ public static String BottomUpProviderGenerator_ProjectNotAccesible;
+
+ public static String Ejb3TopDownProviderGenerator_InconsistentMetadata;
+
+ public static String Ejb3TopDownProviderGenerator_InternalErrorInterface;
+
+ public static String Ejb3TopDownProviderGenerator_InternalErrorOperation;
+
+ public static String Ejb3TopDownProviderGenerator_InvalidInterfaceMapping;
+
+ public static String Ejb3TopDownProviderGenerator_MappingsEmpty;
+
+ public static String ProxyWorkaround_UnableToDeleteProxy;
+
+ public static String ProxyWorkaround_UnableToRenameProxy;
+
+ public static String Wsdl2JavaGenerator_ErrorDuringGeneration;
+
+ public static String Wsdl2JavaGenerator_IncorrectURL;
+
+ public static String Wsdl2JavaGenerator_PathInappropriate;
+
+ public static String Wsdl2JavaGenerator_WSDLDownloadException;
+
+ /** Message for not existing SEI */
+ public static String WsValidation_SeiDoesNotExists;
+
+ /** Message for non existing WSDL referenced by wsdlLocation */
+ public static String WsValidation_WsdlDoesNotExists;
+
+ /** On SEI portName, serviceName and endpointInterface should not be used */
+ public static String SeiValidation_RedundantAttributes;
+
+ /** Message for already existing method name in SEI */
+ public static String WebMethodValidation_NameExists;
+
+ /** Message for excluded methods inside SEI */
+ public static String WebMethodValidation_MethodShouldNotBeExcluded;
+
+ /** Excluded method should contain only exclude attribute */
+ public static String WebMethodValidation_ExcludedHasOtherAttributes;
+
+ /** Message for used 'name' attribute while SEI is referenced */
+ public static String WsValidation_NameShouldNotBeUsedWithSei;
+
+ /** Message for duplicated web parameter name */
+ public static String WebParamValidation_NameExists;
+
+ /** Attribute 'name' is not needed due to current SOAPBinding configuration */
+ public static String WebParamValidation_NameRedundant;
+
+ /** Attribute 'name' is required */
+ public static String WebParamValidation_NameRequired;
+
+ public static String WsValidation_WsAnnotationOnNonSessionBean_Error;
+
+
+ static
+ {
+ NLS.initializeMessages(BUNDLE_NAME, ValidationMessages.class);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.properties
new file mode 100755
index 0000000..ec783a0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/messages/ValidationMessages.properties
@@ -0,0 +1,40 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+BottomUpProviderGenerator_FailedtoAnnotate=Failed to annotate class
+BottomUpProviderGenerator_FailedToCollectMethods=Failed to collect supported methods
+BottomUpProviderGenerator_MethodNotSupported=Method {0} is not in the supported. Web Service annotations could not be added to endpoint
+BottomUpProviderGenerator_ProjectNotAccesible=The project containing the IType provided should be accessible
+Ejb3TopDownProviderGenerator_InconsistentMetadata=Generated IProviderMetadata should contains IEndpoinMetada
+Ejb3TopDownProviderGenerator_InternalErrorInterface=Internal error, could not find relation between InterfaceMapping: {0} and Configuration entities
+Ejb3TopDownProviderGenerator_InternalErrorOperation=Internal error, could not find relation between OperationMapping: {0} and Configuration entities inside InterfaceData: {1}
+Ejb3TopDownProviderGenerator_InvalidInterfaceMapping=Returned interface mappings could not be null or empty array
+Ejb3TopDownProviderGenerator_MappingsEmpty=Returned opperation mappings for interface mapping {0} could not be null or empty array
+ProxyWorkaround_UnableToDeleteProxy=Unable to delete original proxy source file: {0}
+ProxyWorkaround_UnableToRenameProxy=Unable to rename patched proxy source file to its original name: {0}
+
+Wsdl2JavaGenerator_ErrorDuringGeneration=Error during WSDL to Java generation
+Wsdl2JavaGenerator_IncorrectURL=Incorrect WSDL URL syntax
+Wsdl2JavaGenerator_PathInappropriate=Path of the file {0} isn't appropriate to build an URL
+Wsdl2JavaGenerator_WSDLDownloadException=Exception ocured during WSDL download
+WsValidation_SeiDoesNotExists = The specified service endpoint interface {0} does not exists or not annotated correctly
+WsValidation_WsdlDoesNotExists = The specified WSDL is incorrect, URL parsing error: {0}
+WsValidation_NameShouldNotBeUsedWithSei = Name attribute should not be used if SEI is referenced via endpointInterface attribute
+WsValidation_WsAnnotationOnNonSessionBean_Error = @WebService annotation in EJB modules can be only used on session beans
+
+SeiValidation_RedundantAttributes = @WebService annotation should not include attributes portName, serviceName, endpointInterface and wsdlLocation when used on service endpoint interface
+
+WebMethodValidation_NameExists = Web method with name {0} already exists
+WebMethodValidation_MethodShouldNotBeExcluded = Service endpoint interface methods cannot be excluded
+WebMethodValidation_ExcludedHasOtherAttributes = Excluded Web method should not contain attributes other than exclude attribute
+
+WebParamValidation_NameExists = Web parameter with name {0} already exists
+WebParamValidation_NameRedundant= Name attribute is not used if SOAPBinding.Style is RPC and partName is present
+WebParamValidation_NameRequired = A name should be specified if the operation is document style, the parameter style is BARE, and the mode is OUT or INOUT
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/EndpointTypeValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/EndpointTypeValidator.java
new file mode 100755
index 0000000..6cbbd98
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/EndpointTypeValidator.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeAdapter;
+
+/**
+ * Provides type validation for class intedent to be used as an endpoint in
+ * WebService.
+ *
+ * @author Georgi Vachkov
+ */
+
+public class EndpointTypeValidator {
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
+ private static final String FINALYZE_METHOD_NAME = "finalize"; //$NON-NLS-1$
+
+ /**
+ * Validates <tt>type</tt> if is cappable to be used as endpoint. Type used
+ * as Endpoint should fulfil following requirements:
+ *
+ * <pre>
+ * 1. Must be a source type
+ * 2. Must be public
+ * 3. Should not be an interface
+ * 4. Should not be an abstract class
+ * 5. Should not be final
+ * 6. Should provide default constructor
+ * 7. Should not declare finalyze() method
+ * </pre>
+ *
+ * @param type
+ * @return IStatus object - in case <tt>type</tt> can be used as endpoint
+ * the {@link IStatus#getSeverity()} will return {@link IStatus#OK},
+ * else {@link IStatus#ERROR} is returned and
+ * {@link IStatus#getMessage()} will return readable message
+ * describing the condition that is not fulfiled.
+ * @throws JavaModelException
+ */
+ public IStatus validate(IType type) throws JavaModelException {
+ TypeAdapter typeAdapter = new TypeAdapter(type);
+ String typeName = typeAdapter.getQualifiedName();
+
+ if (type.isBinary()) {
+ return prepareStatus(
+ MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_BINARYCLASS,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} is binary class and cannot be annotated", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (!typeAdapter.isPublic()) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_NOTPUBLIC,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} is not public and cannot be used as web service endpoint", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (!typeAdapter.getType().isClass()) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_NOTCLASS,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "{0} is not a class", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (typeAdapter.isAbstract()) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_ABSTRACT,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} is abstract", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (typeAdapter.isFinal()) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_FINAL,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} is final and cannot be used as web service endpoint", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (!typeAdapter.hasDefaultConstructor()) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_CONSTRUCTOR,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} does not have a default constructor", //$NON-NLS-1$
+ typeName)));
+ }
+
+ if (hasFinalyzeMethod(type)) {
+ return prepareStatus(MessageFormat
+ .format(
+ JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_HASFINALYZE,
+ typeName),
+ new IllegalArgumentException(
+ MessageFormat
+ .format(
+ "Class {0} contains finalize() method and cannot be used as web service endpoint", //$NON-NLS-1$
+ typeName)));
+ }
+
+ return prepareStatus(null, null);
+ }
+
+ /**
+ * Checks if type contains finalyze() method
+ *
+ * @param type
+ * @return <tt>true</tt> if has finalyze method
+ */
+ private boolean hasFinalyzeMethod(IType type) {
+ IMethod method = type.getMethod(FINALYZE_METHOD_NAME, new String[0]);
+ if (method == null) {
+ return false;
+ }
+
+ if (method.exists()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Prepares IStatus instance. If <code>errorMessage</code> is
+ * <code>null</code> IStatus.OK is set to the IStatus object else the status
+ * is IStatus.ERROR.
+ *
+ * @param errorMessage
+ * the message to be used
+ * @return always returns an valid IMethodAudit instance.
+ */
+ private IStatus prepareStatus(String localizedMessage, Throwable excepion) {
+ IStatus status = new Status((localizedMessage == null) ? IStatus.OK
+ : IStatus.ERROR, JaxWsDomRuntimePlugin.PLUGIN_ID, IStatus.OK,
+ (localizedMessage == null) ? EMPTY : localizedMessage, excepion);
+
+ return status;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/MethodValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/MethodValidator.java
new file mode 100755
index 0000000..ec9d406
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/MethodValidator.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.PrimitiveTypeHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.TypeResolver;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.ConstructorNotExposableException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InadmissableTypeException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.MethodNotPublicException;
+
+/**
+ * Performes method validation by validating types used. Types are cached between different invocations of check(IMethod method) for better
+ * performance.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodValidator
+{
+ private final static String EMPTY = ""; //$NON-NLS-1$
+
+ private final RuntimeTypeValidator validator;
+
+ /**
+ * Constructor.
+ */
+ public MethodValidator()
+ {
+ validator = new RuntimeTypeValidator();
+ }
+
+ /**
+ * Performs check on types used in method. Checks return types, paramether types and exception types. Stops validation on the first error. An
+ * IStatus object containing information on the result of the check is returned.
+ *
+ * @param method
+ * @return IStatus with severity IStatus.OK if the method can be exposed, or IStatus.ERROR including error message decribing the problem.
+ * @throws NullPointerException -
+ * in case <code>method</code> is null
+ * @throws JavaModelException
+ */
+ public IStatus check(IMethod method) throws JavaModelException
+ {
+ if (method.isConstructor()) {
+ return prepareStatus(new ConstructorNotExposableException(method.getElementName()));
+ }
+
+ final IType declaringType = method.getDeclaringType();
+
+ if (!Flags.isPublic(method.getFlags()) && !declaringType.isInterface()) {
+ return prepareStatus(new MethodNotPublicException(method.getElementName()));
+ }
+
+ try
+ {
+ // Handle return type
+ validateRuntimeClass(method.getReturnType(), declaringType);
+
+ // Handle input parameters and there types
+ for (String paramTypeName : method.getParameterTypes())
+ {
+ validateRuntimeClass(paramTypeName, declaringType);
+ }
+
+ // handle exception types
+ for (String exceptionTypeName : method.getExceptionTypes())
+ {
+ validateException(exceptionTypeName, declaringType);
+ }
+
+ return prepareStatus(null);
+ } catch (InadmissableTypeException e)
+ {
+ return prepareStatus(e);
+ }
+ }
+
+ /**
+ * Validates <code>typeName</code>. On first steps type is resolved and all resolved types are validated one by one. The resolved types can be
+ * more than one in case the type declaration uses generics. Validation propagates the exceptions thrown by RuntimeTypeValidator.
+ *
+ * @param typeName
+ * @param declaringType
+ * @throws JavaModelException
+ * @throws InadmissableTypeException
+ */
+ private void validateRuntimeClass(String typeName, IType declaringType) throws JavaModelException, InadmissableTypeException
+ {
+ Collection<String> names = TypeResolver.resolveTypes(typeName, declaringType);
+ for (String name : names)
+ {
+ if (PrimitiveTypeHandler.isVoidType(name))
+ {
+ continue;
+ }
+
+ validator.validate(TypeFactory.create(name, declaringType));
+ }
+ }
+
+ /**
+ * Validates if <tt>exceptionType</tt> is a valid exception type for WS operation
+ *
+ * @param exceptionType -
+ * exception type name
+ * @param declaringType -
+ * type in which it is used
+ * @throws JavaModelException
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ private void validateException(final String exceptionType, final IType declaringType) throws InadmissableTypeException, JavaModelException
+ {
+ String exFQName = TypeResolver.resolveType(Signature.toString(exceptionType), declaringType);
+
+ validator.validate(TypeFactory.create(exFQName, declaringType));
+ }
+
+ /**
+ * Prepares IMethodAudit instance for <code>method</code>. If <code>throwable</code> is <code>null</code> IStatus.OK is set to the IStatus
+ * object contained in returned IMethodAudit instance else IStatus.ERROR is set.
+ *
+ * @param throwable
+ * @return always returns an valid IMethodAudit instance.
+ */
+ private IStatus prepareStatus(Throwable throwable)
+ {
+ IStatus status = new Status((throwable == null) ? IStatus.OK : IStatus.ERROR, JaxWsDomRuntimePlugin.PLUGIN_ID, IStatus.OK,
+ (throwable == null) ? EMPTY : throwable.getLocalizedMessage(), throwable);
+
+ return status;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/RuntimeTypeValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/RuntimeTypeValidator.java
new file mode 100755
index 0000000..6edb12b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/RuntimeTypeValidator.java
@@ -0,0 +1,425 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.util.Collection;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.GeneralTypesNames;
+import org.eclipse.jst.ws.jaxws.dom.runtime.PrimitiveTypeHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.TypeResolver;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.AbstractClassNotImplementedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InadmissableTypeException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InterfacesNotSupportedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.NoDefaultConstructorException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.TypeNotFoundException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+/**
+ * Provides type validation for class intedent to be used as an runtime classes in WebService.Runtime classes should fulfil following requirements:<br>
+ * <ul>
+ * 1. Should provide default constructor<br>
+ * 2. Should not implement java.rmi.Remote<br>
+ * 3. If it is a java.* type should be one of allowed java types<br>
+ * 4. Class should not contain inner classes that are not public static.<br>
+ * 5. Should not have 'multy inheritance'. This means if class extends class other than java.lang.Object it should not implement interface. In oposite
+ * if the class extends java.lang.Object it should implement only one interface. Following interfaces are not checked:<br>
+ * <br>
+ *
+ * <ul>
+ * java.lang.Comparable<br>
+ * java.lang.Clonable<br>
+ * java.io.Serializable
+ * </ul>
+ * </ul>
+ *
+ * @author Georgi Vachkov
+ */
+public class RuntimeTypeValidator extends TypeValidator
+{
+ private static final String XML_TRANSIENT_ANNOTATION = "javax.xml.bind.annotation.XmlTransient"; //$NON-NLS-1$
+ private static final String XML_TRANSIENT_ANNOTATION_SHORT = "XmlTransient"; //$NON-NLS-1$
+
+ private static final String XML_TYPE_ANNOTATION = "javax.xml.bind.annotation.XmlType"; //$NON-NLS-1$
+ private static final String WEB_FAULT_ANNOTATION = "javax.xml.ws.WebFault"; //$NON-NLS-1$
+
+ private static final String GET = "get"; //$NON-NLS-1$
+ private static final String OBJECT_FACTORY = "ObjectFactory"; //$NON-NLS-1$
+
+
+ // private static final String SET = "set";
+
+
+ private IAnnotationInspector annotationInspector = null;
+
+ /**
+ * Provides type validation for class intedent to be used as an runtime classes in WebService.Runtime classes should fulfil following
+ * requirements:<br>
+ * <ul>
+ * 1. Should provide default constructor<br>
+ * 2. Should not implement java.rmi.Remote<br>
+ * 3. If it is a java.* type should be one of allowed java types<br>
+ * 4. Class should not contain inner classes that are not public static.<br>
+ * 5. Should not have 'multy inheritance'. This means if class extends class other than java.lang.Object it should not implement interface. In
+ * oposite if the class extends java.lang.Object it should implement only one interface. Following interfaces are not checked:<br>
+ * <br>
+ *
+ * <ul>
+ * java.lang.Comparable<br>
+ * java.lang.Clonable<br>
+ * java.io.Serializable
+ * </ul>
+ * </ul>
+ *
+ * @param type -
+ * checked type
+ * @throws JavaModelException
+ * @throws InadmissableTypeException
+ * @see TypeValidator for list of allowed java types.
+ */
+ @Override
+ protected void doValidate(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ final String typeName = type.getQualifiedName();
+
+ // check for types from java.* packages
+ if (isJavaType(typeName))
+ {
+ if (isAllowedJavaType(typeName))
+ {
+ return;
+ }
+ }
+
+ if (Flags.isEnum(type.getType().getFlags()))
+ {
+ return;
+ }
+
+ if (isXmlAnnotated(type.getType()))
+ {
+ return;
+ }
+
+ if (hasObjectFactoryMethod(type.getType())) {
+ return;
+ }
+
+ if (type.isInterface())
+ {
+ throw new InterfacesNotSupportedException(typeName);
+ }
+
+ if (isExtendingCollectionOrMap(type))
+ {
+ return;
+ }
+
+ if (!type.hasDefaultConstructor())
+ {
+ throw new NoDefaultConstructorException(typeName);
+ }
+
+ checkRemoteNotImplemented(type);
+ checkMultipleInheritance(type);
+ checkForInadmissableInnerClasses(type);
+ checkAbstractNotImplemented(type);
+ checkPublicAttributes(type);
+ checkTypesUsedInProperties(type);
+ }
+
+ private boolean hasObjectFactoryMethod(final IType type) throws JavaModelException
+ {
+ if (type.getJavaProject()==null) {
+ return false;
+ }
+
+ final String pack = type.getPackageFragment().getElementName();
+ final String objectFactoryFQName = pack.length()==0 ? OBJECT_FACTORY : pack + '.' + OBJECT_FACTORY;
+
+ final IType objectFactory = type.getJavaProject().findType(objectFactoryFQName);
+ if (objectFactory == null) {
+ return false;
+ }
+
+ if (containsCreateMethod(objectFactory, type)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean containsCreateMethod(final IType objectFactory, final IType type) throws JavaModelException
+ {
+ for (IMethod method : objectFactory.getMethods())
+ {
+ if (method.isConstructor()) {
+ continue;
+ }
+
+ for (String name : TypeResolver.resolveTypes(method.getReturnType(), type)) {
+ if (type.getFullyQualifiedName().equals(name)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if <code>type</code> is annotated with annotation affecting mapping to XML.
+ * Always returns false in case <code>type</code> is binary class.
+ *
+ * @param type
+ * @return
+ * @throws JavaModelException
+ */
+ private boolean isXmlAnnotated(IType type) throws JavaModelException
+ {
+ if (type.isBinary()) {
+ return false;
+ }
+
+ annotationInspector = AnnotationFactory.createAnnotationInspector(type);
+ IAnnotation<IType> typeAnnotation = annotationInspector.inspectType(XML_TYPE_ANNOTATION);
+ if (typeAnnotation!=null) {
+ return true;
+ }
+
+ typeAnnotation = annotationInspector.inspectType(WEB_FAULT_ANNOTATION);
+ if (typeAnnotation!=null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Performs check on public member variables of type. 1. Checks if the type is a java API class whether it is supported. 2. If is other type
+ * perform rutime class check using validate(TypeProxy type) method.
+ *
+ * @see RuntimeTypeValidator - checkType(TypeProxy type) method.
+ * @param type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ private void checkPublicAttributes(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ IType iType = type.getType();
+ for (IField field : iType.getFields())
+ {
+ if (Flags.isPublic(field.getFlags()))
+ {
+ resolveAndCheckType(field.getTypeSignature(), iType);
+ }
+ }
+ }
+
+ /**
+ * Check if the <code>type</code> implements {@link java.util.Collection} or {@link java.util.Map}
+ *
+ * @param type
+ * @return true - if implements {@link java.util.Collection} or {@link java.util.Map}
+ * @throws TypeNotFoundException
+ * @throws JavaModelException
+ */
+ private boolean isExtendingCollectionOrMap(TypeAdapter type) throws TypeNotFoundException, JavaModelException
+ {
+ if (type.isImplementing(GeneralTypesNames.JAVA_UTIL_COLLECTION))
+ {
+ return true;
+ }
+
+ if (type.isImplementing(GeneralTypesNames.JAVA_UTIL_MAP))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks types used as return value, parameter types.
+ *
+ * @param type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ private void checkTypesUsedInProperties(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ IType iType = type.getType();
+ for (IMethod method : iType.getMethods())
+ {
+ // Constructors are not validated
+ if (method.isConstructor() || isXmlTransient(method))
+ {
+ continue;
+ }
+
+ // only getters are validated
+ if (!isGetter(method))
+ {// || !findSetter(method)) {
+ return;
+ }
+
+ resolveAndCheckType(method.getReturnType(), method.getDeclaringType());
+ }
+ }
+
+ private boolean isGetter(final IMethod method)
+ {
+ return method.getElementName().startsWith(GET);
+ }
+
+ private boolean isXmlTransient(IMethod method) throws JavaModelException
+ {
+ if (method.getDeclaringType().isBinary())
+ {
+ return false;
+ }
+
+ annotationInspector = AnnotationFactory.createAnnotationInspector(method.getDeclaringType());
+ Collection<IAnnotation<IMethod>> methodAnnotations = annotationInspector.inspectMethod(method);
+ boolean result = false;
+ for (IAnnotation<IMethod> methodAnnotation : methodAnnotations)
+ {
+ if(methodAnnotation.getAnnotationName().equals(XML_TRANSIENT_ANNOTATION) ||
+ methodAnnotation.getAnnotationName().equals(XML_TRANSIENT_ANNOTATION_SHORT))
+ {
+ result = true;
+ }
+
+ }
+
+ return result;
+ }
+
+ /**
+ * Provides type check with type resolving.
+ *
+ * @param typeName
+ * @param type
+ * @throws JavaModelException
+ * @throws TypeNotFoundException
+ * @throws InadmissableTypeException
+ */
+ private void resolveAndCheckType(String typeName, IType type) throws JavaModelException, TypeNotFoundException, InadmissableTypeException
+ {
+ for (String resolvedType : TypeResolver.resolveTypes(typeName, type))
+ {
+ if (PrimitiveTypeHandler.isVoidType(resolvedType))
+ {
+ continue;
+ }
+
+ if (isJavaType(resolvedType) && isAllowedJavaType(resolvedType))
+ {
+ continue;
+ }
+
+ validateInternal(new TypeAdapter(TypeFactory.create(resolvedType, type)));
+ }
+ }
+
+ /**
+ * Validates if <code>type</code> is abstract class whether it is implemented by some class capable for runtime class.
+ *
+ * @param type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ private void checkAbstractNotImplemented(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ // check for implementor for abstract class
+ if (type.isAbstract() && !isImplemented(type.getType()))
+ {
+ throw new AbstractClassNotImplementedException(type.getQualifiedName());
+ }
+ }
+
+ /**
+ * Checks whether <code>base</code> class has some non abstract implementor which is capable for runtime class.
+ *
+ * @param base
+ * checked type
+ * @throws JavaModelException
+ */
+ private boolean isImplemented(IType base) throws JavaModelException
+ {
+ if (base.getFullyQualifiedName().equals(GeneralTypesNames.JAVA_LANG_OBJECT)
+ || base.getFullyQualifiedName().equals(GeneralTypesNames.JAVA_IO_SERIALIZABLE))
+ {
+ return true;
+ }
+
+ ITypeHierarchy typeHierarchy = base.newTypeHierarchy(null);
+ IType[] classes = typeHierarchy.getAllSubtypes(base);
+
+ IType classCandidate = null;
+ for (int i = 0; i < classes.length; i++)
+ {
+ classCandidate = classes[i];
+
+ if (canBeUsedAsRTClass(classCandidate))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if given type is suitable for class/interface implementor. Class should not be abstract, interface and should comply to the rules defined
+ * in checkType documentation.
+ *
+ * @see RuntimeTypeValidator - checkType(TypeProxy type) method.
+ * @param type -
+ * checked type
+ * @throws JavaModelException
+ */
+ private boolean canBeUsedAsRTClass(IType type) throws JavaModelException
+ {
+ int flags = type.getFlags();
+
+ if (!type.isClass() || Flags.isAbstract(flags))
+ {
+ return false;
+ }
+
+ if (Flags.isInterface(flags) || type.isAnonymous())
+ {
+ return false;
+ }
+
+ // check sub type if it is allowed as rt classes
+ try
+ {
+ TypeAdapter tp = new TypeAdapter(type);
+ validateInternal(tp);
+ } catch (InadmissableTypeException e)
+ {
+ // $JL-EXC$
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiImplementationValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiImplementationValidator.java
new file mode 100755
index 0000000..36cd077
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiImplementationValidator.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.TypeResolver;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+/**
+ * Validates SEI against implementation bean.
+ *
+ * @author Georgi Vachkov
+ */
+
+public class SeiImplementationValidator
+{
+ private final IType seiType;
+
+ /**
+ * Constructor.
+ *
+ * @param seiType
+ * @throws NullPointerException in case <code>seiType</code> is <code>null</code>
+ * @throws IllegalArgumentException in case <code>seiType</code> is not a interface
+ * @throws JavaModelException
+ */
+ public SeiImplementationValidator(final IType seiType) throws JavaModelException
+ {
+ ContractChecker.nullCheckParam(seiType);
+
+ if (!seiType.isInterface()) {
+ throw new IllegalArgumentException("seiType should be interface"); //$NON-NLS-1$
+ }
+
+ this.seiType = seiType;
+ }
+
+ /**
+ * Validates provided in constructor SEI against <tt>beanType</tt>. The <tt>beanType</tt> should implement all
+ *
+ * @param beanType
+ * @return status object with set severity and message
+ * @throws JavaModelException
+ */
+ public IStatus validate(final IType beanType) throws JavaModelException
+ {
+ final String beanFQName = beanType.getFullyQualifiedName();
+ if (implementsSEI(beanType))
+ {
+ return prepareStatus(null, null);
+ }
+
+ for (IMethod seiMethod : collectInterfaceMethods(seiType))
+ {
+ IMethod beanMethod = findMethodInBean(seiMethod, beanType);
+ if (beanMethod == null)
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiImplementationValidator_METHOD_NOT_FOUND, formatMethodSignature(seiMethod), beanFQName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "Method {0} cannot be found in the implementation bean {1}. It is required that the bean implements all the methods of the specified service endpoint interface", //$NON-NLS-1$
+ beanFQName)));
+ }
+
+ if (!Flags.isPublic(beanMethod.getFlags()))
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiImplementationValidator_METHOD_NOT_PUBLIC, formatMethodSignature(seiMethod), beanFQName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ " Method {0} in the implementation bean {1} is not public and therefore cannot be exposed as a web service operation", //$NON-NLS-1$
+ beanFQName)));
+ }
+
+ if (!hasSameExceptions(seiMethod, beanMethod))
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiImplementationValidator_METHOD_HASDIFFERENT_EXCEPTIONS, formatMethodSignature(seiMethod), beanFQName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "Method {0} in the implementation bean {1} is declared to throw exceptions that differ from exceptions thrown by the same method in the service endpoint interface", //$NON-NLS-1$
+ beanFQName)));
+ }
+ }
+
+ return prepareStatus(null, null);
+ }
+
+ private boolean implementsSEI(final IType beanType) throws JavaModelException
+ {
+ for (String interfaceName : beanType.getSuperInterfaceNames())
+ {
+ String interfaceFQName = TypeResolver.resolveType(interfaceName, beanType);
+ if (interfaceFQName.equals(seiType.getFullyQualifiedName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private IMethod findMethodInBean(final IMethod seiMethod, final IType beanType) throws JavaModelException
+ {
+ for (IMethod beanMethod : beanType.getMethods())
+ {
+ if (!seiMethod.getElementName().equals(beanMethod.getElementName()))
+ {
+ continue;
+ }
+
+ if (hasSameReturnType(seiMethod, beanMethod) && hasSameParams(seiMethod, beanMethod))
+ {
+ return beanMethod;
+ }
+ }
+
+ if (beanType.getSuperclassName() == null)
+ {
+ return null;
+ }
+
+ final String superTypeName = TypeResolver.resolveType(beanType.getSuperclassName(), beanType);
+
+ return findMethodInBean(seiMethod, beanType.getJavaProject().findType(superTypeName));
+ }
+
+ private boolean hasSameReturnType(final IMethod seiMethod, final IMethod beanMethod) throws JavaModelException
+ {
+ final List<String> seiRetType = TypeResolver.resolveTypes(seiMethod.getReturnType(), seiMethod.getDeclaringType());
+ final List<String> beanRetType = TypeResolver.resolveTypes(beanMethod.getReturnType(), beanMethod.getDeclaringType());
+
+ if (!areSameTypes(seiRetType, beanRetType))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean hasSameParams(final IMethod seiMethod, final IMethod beanMethod) throws JavaModelException
+ {
+ final String[] seiParamTypes = seiMethod.getParameterTypes();
+ final String[] beanParamTypes = beanMethod.getParameterTypes();
+ if (seiParamTypes.length != beanParamTypes.length)
+ {
+ return false;
+ }
+
+ List<String> seiParamType = null;
+ List<String> beanParamType = null;
+ for (int i = 0; i < seiParamTypes.length; i++)
+ {
+ seiParamType = TypeResolver.resolveTypes(seiParamTypes[i], seiMethod.getDeclaringType());
+ beanParamType = TypeResolver.resolveTypes(beanParamTypes[i], beanMethod.getDeclaringType());
+
+ if (!areSameTypes(seiParamType, beanParamType))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean areSameTypes(final List<String> seiTypeNames, final List<String> beanTypeNames)
+ {
+ if (seiTypeNames.size() != beanTypeNames.size())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < seiTypeNames.size(); i++)
+ {
+ if (!seiTypeNames.get(i).equals(beanTypeNames.get(i)))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private List<IMethod> collectInterfaceMethods(final IType type) throws JavaModelException
+ {
+ final List<IMethod> allMethods = new ArrayList<IMethod>();
+ Collections.addAll(allMethods, type.getMethods());
+
+ for (String superInterfaceName : type.getSuperInterfaceNames())
+ {
+ String superFQName = TypeResolver.resolveType(superInterfaceName, type);
+ IType superType = type.getJavaProject().findType(superFQName, (IProgressMonitor) null);
+
+ assert (superType != null);
+
+ allMethods.addAll(collectInterfaceMethods(superType));
+ }
+
+ return allMethods;
+ }
+
+ private boolean hasSameExceptions(IMethod seiMethod, IMethod beanMethod) throws JavaModelException
+ {
+ if (seiMethod.getExceptionTypes().length != beanMethod.getExceptionTypes().length)
+ {
+ return false;
+ }
+
+ final Set<String> seiExceptions = getResolvedExceptions(seiMethod);
+ final IType beanType = beanMethod.getDeclaringType();
+ for (String beanEx : beanMethod.getExceptionTypes())
+ {
+ String resolvedName = TypeResolver.resolveType(Signature.toString(beanEx), beanType);
+ if (!seiExceptions.contains(resolvedName))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private Set<String> getResolvedExceptions(IMethod method) throws JavaModelException
+ {
+ final Set<String> exceptionsFQNs = new HashSet<String>(method.getExceptionTypes().length);
+ final IType declaringType = method.getDeclaringType();
+
+ for (String exception : method.getExceptionTypes())
+ {
+ exceptionsFQNs.add(TypeResolver.resolveType(Signature.toString(exception), declaringType));
+ }
+
+ return exceptionsFQNs;
+ }
+
+ private String formatMethodSignature(final IMethod method) throws JavaModelException
+ {
+ final StringBuffer name = new StringBuffer(Signature.toString(method.getSignature(), method.getElementName(), method.getParameterNames(),
+ true, false));
+ name.append(" : "); //$NON-NLS-1$
+ name.append(Signature.toString(method.getReturnType()));
+
+ return name.toString();
+ }
+
+ private IStatus prepareStatus(String msg, Throwable cause)
+ {
+ return new Status((msg == null) ? IStatus.OK : IStatus.ERROR, JaxWsDomRuntimePlugin.PLUGIN_ID, IStatus.OK, msg == null ? "" : msg, cause); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiValidator.java
new file mode 100755
index 0000000..497ad49
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/SeiValidator.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.TypeResolver;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+
+/**
+ * Interface validator - checks if supplied type is applicable for Service Endpoint Interface (SEI).
+ *
+ * @author Georgi Vachkov
+ */
+
+public class SeiValidator
+{
+
+ private final MethodValidator methodValidator;
+
+ /**
+ * Constructor.
+ */
+ public SeiValidator()
+ {
+ methodValidator = new MethodValidator();
+ }
+
+ /**
+ * <pre>
+ * Validates <tt>type</tt> if it is applicable for Service Entdpoint Interface.
+ *
+ * 1. <tt>type</tt> must be interface
+ * 2. <tt>type</tt> must be outer
+ * 3. <tt>type</tt> must be public
+ * 4. all <tt>type</tt> methods must be exposable according to the rules in {@link MethodValidator}
+ * </pre>
+ *
+ * @param type validated type
+ * @return IStatus object with status {@link IStatus#OK} in case <tt>type</tt> is applicable for SEI or {@link IStatus#ERROR} in case type is
+ * not applicable with some human readble explanation of the problem.
+ * @throws NullPointerException in case <tt>type</tt> is null.
+ * @throws JavaModelException
+ */
+ public IStatus validate(IType type) throws JavaModelException
+ {
+ String seiName = type.getFullyQualifiedName();
+ if (!type.isInterface())
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiValidator_NOT_INTERFACE_MSG, seiName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "{0} is not a interface and cannot be used as a service endpoint interface", //$NON-NLS-1$
+ seiName)));
+ }
+
+ if (type.isBinary())
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiValidator_NOT_COMPILATIONUNIT_MSG, seiName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "{0} is a binary interface and cannot annotated as a service endpoint interface", //$NON-NLS-1$
+ seiName)));
+ }
+
+ if (type.isMember())
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiValidator_NOT_OUTER_MSG, seiName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "{0} is not a outer interface and cannot be used as a service endpoint interface", //$NON-NLS-1$
+ seiName)));
+ }
+
+ if (!Flags.isPublic(type.getFlags()))
+ {
+ return prepareStatus(MessageFormat.format(JaxWsDomRuntimeMessages.SeiValidator_NOT_PUBLIC_MSG, seiName),
+ new IllegalArgumentException(
+ MessageFormat.format(
+ "{0} is not a public interface and cannot be used as a service endpoint interface", //$NON-NLS-1$
+ seiName)));
+ }
+
+ return validateMethods(type);
+ }
+
+ private IStatus validateMethods(IType type) throws JavaModelException
+ {
+ IStatus status;
+ for (IMethod method : type.getMethods())
+ {
+ status = methodValidator.check(method);
+ if (status.getSeverity() != IStatus.OK)
+ {
+ return status;
+ }
+ }
+
+ for (String superInterfaceName : type.getSuperInterfaceNames())
+ {
+ String superFQName = TypeResolver.resolveType(superInterfaceName, type);
+ IType superType = type.getJavaProject().findType(superFQName);
+
+ assert (superType != null);
+
+ status = validateMethods(superType);
+ if (status.getSeverity() != IStatus.OK)
+ {
+ return status;
+ }
+ }
+
+ return prepareStatus(null, null);
+ }
+
+ private IStatus prepareStatus(String msg, Throwable cause)
+ {
+ return new Status((msg == null) ? IStatus.OK : IStatus.ERROR, JaxWsDomRuntimePlugin.PLUGIN_ID, IStatus.OK, msg == null ? "" : msg, cause); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/TypeValidator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/TypeValidator.java
new file mode 100755
index 0000000..761195c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/TypeValidator.java
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.GeneralTypesNames;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeKey;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.HasInadmisableInnerTypesException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InadmissableTypeException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InheritanceAndImplementationExecption;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.MultipleImplementationException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.RemoteObjectException;
+
+/**
+ * Provides set of general validation methods which can be reused by subclasses.
+ *
+ * @i036509
+ */
+public abstract class TypeValidator
+{
+ // there are types from the java.* packages that are supported by the runtime
+ // and are known to it without analysis of there structure, therefore they are
+ // stored as elementaries.
+ private static final Set<String> JAVA_TYPES = new HashSet<String>(); // $JL-COLLECTION$
+
+ // for these java.* types attributes are resolved, i.e they are stored as
+ // structure if they contain fields.
+ private static final Set<String> ANALYSED_JAVA_TYPES = new HashSet<String>(); // $JL-COLLECTION$
+
+ // these types are allowed to be used in case of multy inheritance
+ private static final Set<String> ALLOWED_IN_MULTYINHERITANCE = new HashSet<String>(); // $JL-COLLECTION$
+
+ private Map<TypeKey, IStatus> statusMap = new HashMap<TypeKey, IStatus>();
+
+ // cache of already analyzed types
+ private Set<TypeKey> analyzed = new HashSet<TypeKey>();
+
+ static
+ {
+ // There are types from the java.* packages that are supported by the runtime
+ // and are known to it without analysis of there structure, therefore they are
+ // stored as elementaries.
+
+ // Date/Time Specific Types
+ JAVA_TYPES.add("java.util.Calendar"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.Date"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.GregorianCalendar"); //$NON-NLS-1$
+ JAVA_TYPES.add("javax.xml.datatype.XMLGregorianCalendar"); //$NON-NLS-1$
+
+ // Array Based Types
+ JAVA_TYPES.add("java.util.ArrayList"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.HashSet"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.LinkedList"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.List"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.Stack"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.Vector"); //$NON-NLS-1$
+
+ // Others
+ JAVA_TYPES.add("java.math.BigDecimal"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.math.BigInteger"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Object"); //$NON-NLS-1$
+ JAVA_TYPES.add("javax.xml.namespace.QName"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.UUID"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.net.URI"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.awt.Image"); //$NON-NLS-1$
+ JAVA_TYPES.add("javax.xml.datatype.Duration"); //$NON-NLS-1$
+ JAVA_TYPES.add("javax.xml.transform.Source"); //$NON-NLS-1$
+ JAVA_TYPES.add("javax.activation.DataHandler"); //$NON-NLS-1$
+
+ // Java primitive type wrapper classes
+ JAVA_TYPES.add("java.lang.String"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Boolean"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Integer"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Character"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Float"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Byte"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Double"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Long"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Short"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Void"); //$NON-NLS-1$
+
+ JAVA_TYPES.add("java.rmi.RemoteException"); //$NON-NLS-1$
+
+ JAVA_TYPES.add("java.io.Serializable"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Cloneable"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.lang.Comparable"); //$NON-NLS-1$
+
+ JAVA_TYPES.add("java.util.Map"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.HashMap"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.Hashtable"); //$NON-NLS-1$
+ JAVA_TYPES.add("java.util.Collection"); //$NON-NLS-1$
+
+ // For these java.* types attributes are resolved, i.e they are stored as
+ // structure if they contain fields.
+ ANALYSED_JAVA_TYPES.add("java.lang.Exception"); //$NON-NLS-1$
+ ANALYSED_JAVA_TYPES.add("java.lang.Throwable"); //$NON-NLS-1$
+ ANALYSED_JAVA_TYPES.add("java.lang.StackTraceElement"); //$NON-NLS-1$
+
+ ALLOWED_IN_MULTYINHERITANCE.add(GeneralTypesNames.JAVA_LANG_CLONEABLE); // $NON-NLS$
+ ALLOWED_IN_MULTYINHERITANCE.add(GeneralTypesNames.JAVA_IO_SERIALIZABLE); // $NON-NLS$
+ ALLOWED_IN_MULTYINHERITANCE.add(GeneralTypesNames.JAVA_LANG_COMPARABLE); // $NON-NLS$
+ }
+
+ protected abstract void doValidate(TypeAdapter type) throws InadmissableTypeException, JavaModelException;
+
+ /**
+ * Validates <code>type</code>. The first step is tho check the cache if this type has been checked already. If yes the previuos validation
+ * result is returned if no a check is performed and the result is chached. Internally calls doValidate(type) which should be implemented by
+ * extending classes.
+ *
+ * @param type -
+ * checked type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ public void validate(IType type) throws InadmissableTypeException, JavaModelException
+ {
+ analyzed.clear();
+ validateInternal(new TypeAdapter(type));
+ }
+
+ /**
+ * Validates <code>type</code>. The first step is tho check the cache if this type has been checked already. If yes the previuos validation
+ * result is returned if no a check is performed and the result is chached. Internally calls doValidate(type) which should be implemented by
+ * extending classes.
+ *
+ * @param type -
+ * checked type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ protected void validateInternal(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ final TypeKey key = new TypeKey(type.getProjectName(), type.getQualifiedName());
+
+ // check for circular type check
+ if (analyzed.contains(key))
+ {
+ return;
+ }
+
+ analyzed.add(key);
+
+ final IStatus status = statusMap.get(key);
+ if (status != null)
+ {
+ if (status.getSeverity() == IStatus.OK)
+ {
+ return;
+ }
+
+ throw (InadmissableTypeException) status.getException();
+ }
+
+ try
+ {
+ doValidate(type);
+ statusMap.put(key, prepareStatus(null));
+ } catch (InadmissableTypeException e)
+ {
+ statusMap.put(key, prepareStatus(e));
+ throw e;
+ }
+ }
+
+ /**
+ * if <code>throwable</code> is null prepares status with severity IStatus.OK and empty message. If <code>throwable</code> is not null
+ * prepares status with severity IStatus.ERROR and message the contained in <code>throwable</code> error message.
+ *
+ * @param throwable
+ * @return IStatus with severity IStatus.OK if <tt>throwable</tt> is null , or IStatus.ERROR including error message decribing the problem.
+ */
+ private IStatus prepareStatus(Throwable throwable)
+ {
+ final IStatus status = new Status((throwable == null) ? IStatus.OK : IStatus.ERROR, JaxWsDomRuntimePlugin.PLUGIN_ID, IStatus.OK,
+ (throwable == null) ? "" : throwable.getMessage(), //$NON-NLS-1$
+ throwable);
+
+ return status;
+ }
+
+ /**
+ * Defines if <code>typeName</code> one form java.* or javax.* packages.
+ *
+ * @param typeName
+ * @return <tt>true</tt> if <tt>typeName</tt> is from java standard classes.
+ */
+ protected boolean isJavaType(String typeName)
+ {
+ return typeName.startsWith("java.") //$NON-NLS-1$
+ || typeName.startsWith("javax."); //$NON-NLS-1$
+ }
+
+ /**
+ * Defines if <code>typeName</code> is allowed java type. The list of allowed java types can be found in static section of this class.
+ *
+ * @param typeName
+ * @return <tt>true</tt> if <tt>typeName</tt> is allowed to be used in Web Service.
+ */
+ protected boolean isAllowedJavaType(String typeName)
+ {
+ return JAVA_TYPES.contains(typeName) || ANALYSED_JAVA_TYPES.contains(typeName);
+ }
+
+ /**
+ * Checks if <code>type</code> implements java.rmi.Remote interface.
+ *
+ * @param type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ protected void checkRemoteNotImplemented(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ if (type.isImplementing(GeneralTypesNames.JAVA_RMI_REMOTE))
+ {
+ throw new RemoteObjectException(type.getQualifiedName());
+ }
+ }
+
+ /**
+ * Checks if <code>type</code> implements multiple interfaces. Classes that extend class other than java.lang.Object should not implement any
+ * interface. Classes that extend java.lang.Object can implement only one interface.<br>
+ * <br>
+ * Note: The following interfaces are skipped from check:<br>
+ * <ul>
+ * java.io.Serializble<br>
+ * java.lang.Clonable<br>
+ * java.lang.Comparable<br>
+ * </ul>
+ *
+ * @param type
+ * @throws InadmissableTypeException
+ * @throws JavaModelException
+ */
+ protected void checkMultipleInheritance(TypeAdapter type) throws InadmissableTypeException, JavaModelException
+ {
+ List<String> interfaceNames = type.getInterfaceNames();
+ final String superClassName = type.getSuperClassName();
+ if (superClassName == null || superClassName.equals(GeneralTypesNames.JAVA_LANG_OBJECT)
+ || superClassName.equals(GeneralTypesNames.JAVA_LANG_EXCEPTION))
+ {
+ if (!checkInterfaceImplementationCount(interfaceNames, 1))
+ {
+ throw new MultipleImplementationException(type.getQualifiedName(), interfaceNames.get(0), interfaceNames.get(1));
+ }
+ } else
+ {
+ if (!checkInterfaceImplementationCount(interfaceNames, 0))
+ {
+ throw new InheritanceAndImplementationExecption(type.getQualifiedName(), superClassName);
+ }
+
+ checkMultipleInheritance(type.getSuperClassType());
+ }
+ }
+
+ /**
+ * Checks if <code>interfaceNames</code> are more than <code>maxAllowed</code> interfaces. Note: The following interfaces are skipped from
+ * check:<br>
+ * <ul>
+ * java.io.Serializble<br>
+ * java.lang.Clonable<br>
+ * java.lang.Comparable<br>
+ * </ul>
+ *
+ * @param interfaceNames
+ * @param maxAllowed -
+ * number of maximum allowed implementations
+ */
+ protected boolean checkInterfaceImplementationCount(List<String> interfaceNames, int maxAllowed)
+ {
+ if (interfaceNames == null || interfaceNames.size() == 0)
+ {
+ return true;
+ }
+
+ int noneAllowedInterfaceCount = 0;
+ for (String interfaceName : interfaceNames)
+ {
+ if (ALLOWED_IN_MULTYINHERITANCE.contains(interfaceName))
+ {
+ continue;
+ }
+
+ noneAllowedInterfaceCount++;
+ if (noneAllowedInterfaceCount > maxAllowed)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Inadmissable are member classes that are not "public static".
+ *
+ * @param type
+ * @throws HasInadmisableInnerTypesException
+ * @throws JavaModelException
+ */
+ protected void checkForInadmissableInnerClasses(TypeAdapter type) throws HasInadmisableInnerTypesException, JavaModelException
+ {
+ if (type.hasNonStaticOrNonPublicInnerTypes())
+ {
+ throw new HasInadmisableInnerTypesException(type.getQualifiedName());
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/AbstractClassNotImplementedException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/AbstractClassNotImplementedException.java
new file mode 100755
index 0000000..3404c4f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/AbstractClassNotImplementedException.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used when a RT class is abstract and is not implemented.
+ *
+ * @author Georgi Vachkov
+ */
+public class AbstractClassNotImplementedException extends InadmissableTypeException
+{
+
+ private static final long serialVersionUID = -5871458329068966581L;
+
+ /**
+ * Construction.
+ *
+ * @param classFQName
+ */
+ public AbstractClassNotImplementedException(String classFQName)
+ {
+ super(MessageFormat.format("Abstract class {0} cannot be used as runtime class because it is not extended by non abstract class which is suitable for a runtime class", classFQName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.AbstractClassNotImplementedException_Error_Message, classFQName));
+
+
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/ConstructorNotExposableException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/ConstructorNotExposableException.java
new file mode 100755
index 0000000..5358ba0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/ConstructorNotExposableException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used to describe that the constructor cannot be exposed in WS.
+ *
+ * @author Georgi Vachkov
+ */
+public class ConstructorNotExposableException extends MethodNotExposableException
+{
+
+ private static final long serialVersionUID = 4504742824495057956L;
+
+ /**
+ * Constructor
+ *
+ * @param methodName
+ */
+ public ConstructorNotExposableException(String methodName)
+ {
+ super(MessageFormat.format("Constructor {0} cannot be exposed as web service operation", methodName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.ConstructorNotExposableException_Error_Message, methodName));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/HasInadmisableInnerTypesException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/HasInadmisableInnerTypesException.java
new file mode 100755
index 0000000..ae1c352
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/HasInadmisableInnerTypesException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used in case when an RT class contains inner class that does not fulfil the requirements.
+ *
+ * @author Georgi Vachkov
+ */
+public class HasInadmisableInnerTypesException extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Constructor. Creates meaningfull message using <tt>className</tt>
+ *
+ * @param className
+ */
+ public HasInadmisableInnerTypesException(String className)
+ {
+ super(MessageFormat.format("Class {0} has inner types that are not public and static", className) //$NON-NLS-1$
+ ,
+ MessageFormat.format(JaxWsDomRuntimeMessages.HasInadmisableInnerTypesException_Error_Message, className));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InadmissableTypeException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InadmissableTypeException.java
new file mode 100755
index 0000000..4648230
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InadmissableTypeException.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+/**
+ * Abstract class for exceptions in type validation.
+ *
+ * @author Georgi Vachkov
+ */
+public abstract class InadmissableTypeException extends Exception
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+ final String localizedMessage;
+
+ /**
+ * Constructor.
+ *
+ * @param reason -
+ * the error mesage
+ */
+ public InadmissableTypeException(String reason, String localizedMessage)
+ {
+ super(reason);
+ this.localizedMessage = localizedMessage;
+ }
+
+ @Override
+ public String getLocalizedMessage() {
+ return localizedMessage;
+ }
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InheritanceAndImplementationExecption.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InheritanceAndImplementationExecption.java
new file mode 100755
index 0000000..999e4ae
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InheritanceAndImplementationExecption.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used in RT validation when an RT class has multy inheritance via extention and implementation.
+ */
+public class InheritanceAndImplementationExecption extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Construction.
+ *
+ * @param className
+ * @param interfaceName
+ */
+ public InheritanceAndImplementationExecption(String className, String interfaceName)
+ {
+ super(MessageFormat.format("Class {0} extends {1} and implements custom interface (multiple inheritance is not allowed)", className, interfaceName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.InheritanceAndImplementationExecption_Error_Message, className, interfaceName));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InterfacesNotSupportedException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InterfacesNotSupportedException.java
new file mode 100755
index 0000000..a270c4d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/InterfacesNotSupportedException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used when an interface is used as RT class.
+ *
+ * @author Georgi Vachkov
+ */
+public class InterfacesNotSupportedException extends InadmissableTypeException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construction.
+ *
+ * @param interfaceFQName
+ */
+ public InterfacesNotSupportedException(String interfaceFQName)
+ {
+ super(MessageFormat.format("{0} is a interface, and JAXB cannot handle interfaces", interfaceFQName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.InterfacesNotSupportedException_Error_Message, interfaceFQName));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotExposableException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotExposableException.java
new file mode 100755
index 0000000..d9ba663
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotExposableException.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+/**
+ * Exception used when a method cannot be exposed as WS.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodNotExposableException extends Exception {
+
+ private static final long serialVersionUID = 406641585441090966L;
+
+ private final String localizedMessage;
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * @param localizedMessage
+ */
+ public MethodNotExposableException(String message, String localizedMessage) {
+ super(message);
+ this.localizedMessage = localizedMessage;
+ }
+
+ /**
+ * Provides localized message of exception
+ * */
+ @Override
+ public String getLocalizedMessage() {
+ return localizedMessage;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotPublicException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotPublicException.java
new file mode 100755
index 0000000..6f55048
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MethodNotPublicException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Used when an method is not public and that is why it cannot be exposed as WS.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodNotPublicException extends MethodNotExposableException
+{
+ private static final long serialVersionUID = -4792342187698558687L;
+
+ /**
+ * Constructor.
+ *
+ * @param methodName
+ */
+ public MethodNotPublicException(String methodName)
+ {
+ super(MessageFormat.format("Method {0} is not public and cannot be exposed as a web service operation", methodName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.MethodNotPublicException_Error_Message , methodName));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MultipleImplementationException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MultipleImplementationException.java
new file mode 100755
index 0000000..aaf759e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/MultipleImplementationException.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception used in case RT class implements more that 1 interface wich is not allowed.
+ *
+ * @author Georgi Vachkov
+ */
+public class MultipleImplementationException extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Construstor.
+ *
+ * @param className -
+ * RT class name
+ * @param interface1 -
+ * implemented interface 1
+ * @param interface2 -
+ * implemented interface 2
+ */
+ public MultipleImplementationException(String className, String interface1, String interface2)
+ {
+ super(MessageFormat.format("Class {0} implements both interface {1} and interface {2} (multiple inheritance is not allowed)", className, interface1, interface2), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.MultipleImplementationException_Error_Message, className, interface1, interface2));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/NoDefaultConstructorException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/NoDefaultConstructorException.java
new file mode 100755
index 0000000..3fbe0d9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/NoDefaultConstructorException.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception for RT class when there is no default constructor in class.
+ *
+ * @author Georgi Vachkov
+ */
+public class NoDefaultConstructorException extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Constructor
+ *
+ * @param typeName -
+ * the name of RT class
+ */
+ public NoDefaultConstructorException(String typeName)
+ {
+ super(MessageFormat.format("Class {0} does not have a default constructor", typeName), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.EndpointTypeValidator_ERR_MSG_CONSTRUCTOR, typeName));
+
+
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/RemoteObjectException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/RemoteObjectException.java
new file mode 100755
index 0000000..7a6ca0c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/RemoteObjectException.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Exception wich is used to define that the RT class implements java.rmi.Remote
+ *
+ * @author Georgi Vachkov
+ */
+public class RemoteObjectException extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Constructor.
+ *
+ * @param className -
+ * RT class
+ */
+ public RemoteObjectException(String className)
+ {
+ super(MessageFormat.format("Class {0} is a remote Object", className), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.RemoteObjectException_Error_Message, className));
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/TypeNotFoundException.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/TypeNotFoundException.java
new file mode 100755
index 0000000..38f8c9d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/provider/exceptions/TypeNotFoundException.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+
+/**
+ * Class used when type is searched to define that the class was not found.
+ *
+ * @author Georgi Vachkov
+ *
+ */
+public class TypeNotFoundException extends InadmissableTypeException
+{
+ static final long serialVersionUID = System.currentTimeMillis();
+
+ /**
+ * Constructor.
+ *
+ * @param className -
+ * the name of the class that is not found
+ */
+ public TypeNotFoundException(String className)
+ {
+ super(MessageFormat.format("Class {0} cannot be found", className), //$NON-NLS-1$
+ MessageFormat.format(JaxWsDomRuntimeMessages.TypeNotFoundException_Error_Message, className));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/RedundantAttributesConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/RedundantAttributesConstraint.java
new file mode 100755
index 0000000..4775c36
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/RedundantAttributesConstraint.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.PORT_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Checks if WebService annotation set on SEI contains portName, serviceName or endpointInterface attributes.
+ * According to jst-181, point 3.2 sub-point 6 this is not allowed.
+ *
+ * @author Georgi Vachkov
+ */
+public class RedundantAttributesConstraint extends AbstractValidationConstraint
+{
+ private static final String [] REDUNDANT_ATTRIBUTES = {PORT_NAME_ATTRIBUTE, SERVICE_NAME_ATTRIBUTE, ENDPOINT_INTERFACE_ATTRIBUTE, WSDL_LOCATION_ATTRIBUTE};
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public RedundantAttributesConstraint() {
+ super(new SeiConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)ctx.getTarget();
+ if (sei.isImplicit()) {
+ return createOkStatus(sei);
+ }
+
+ if (containsRedundantAttribute(sei)) {
+ return createStatus(sei, ValidationMessages.SeiValidation_RedundantAttributes, WS_ANNOTATION, null);
+ }
+
+ return createOkStatus(sei);
+ }
+
+ protected boolean containsRedundantAttribute(final IServiceEndpointInterface sei)
+ {
+ final IAnnotation<? extends IJavaElement> annotation = findAnnotation(sei, WS_ANNOTATION);
+ if (annotation == null) {
+ return false;
+ }
+
+ for (String redundantAttribute : REDUNDANT_ATTRIBUTES) {
+ if (annotation.getPropertyValue(redundantAttribute)!=null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiClassCorrectConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiClassCorrectConstraint.java
new file mode 100755
index 0000000..8df847a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiClassCorrectConstraint.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.SeiValidator;
+
+/**
+ * Checks the SEI underling interface if is capable to be used as SEI according to
+ * jsr-181 point 3.2
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiClassCorrectConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public SeiClassCorrectConstraint()
+ {
+ super(new SeiConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final SeiValidator validator = new SeiValidator();
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)ctx.getTarget();
+ if (sei.isImplicit()) {
+ return createOkStatus(sei);
+ }
+
+ final IType seiType = Dom2ResourceMapper.INSTANCE.findType(sei);
+ if (seiType == null) {
+ return createOkStatus(sei);
+ }
+
+ final IStatus status = validator.validate(seiType);
+ if (!status.isOK()) {
+ return createStatus(sei, status.getMessage(), WS_ANNOTATION, null);
+ }
+
+ return createOkStatus(sei);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintDescriptor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintDescriptor.java
new file mode 100755
index 0000000..feb3df8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintDescriptor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidationConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+/**
+ * The constraint descriptor for SEI validation constraints
+ *
+ * @author Georgi Vachkov
+ */
+class SeiConstraintDescriptor extends DomValidationConstraintDescriptor
+{
+ public String getId() {
+ return DomValidationConstants.SEI_CONSTRAINT_ID;
+ }
+
+ public String getPluginId() {
+ return JaxWsDomRuntimePlugin.PLUGIN_ID;
+ }
+
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.ERROR;
+ }
+
+ public int getStatusCode() {
+ return -28;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintProvider.java
new file mode 100755
index 0000000..a6c3614
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiConstraintProvider.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.validation.model.IModelConstraint;
+
+/**
+ * Constraint provider for SEI DOM objects
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiConstraintProvider
+{
+ private Set<IModelConstraint> constraints;
+
+ /**
+ * @return constraints related to SEI
+ */
+ public Collection<IModelConstraint> getConstraints()
+ {
+ if (constraints==null)
+ {
+ constraints = new HashSet<IModelConstraint>();
+ constraints.add(new SeiNameInNCNameConstraint());
+ constraints.add(new TargetNsValidUriConstraint());
+ constraints.add(new RedundantAttributesConstraint());
+ constraints.add(new SeiClassCorrectConstraint());
+ }
+
+ return constraints;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiNameInNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiNameInNCNameConstraint.java
new file mode 100755
index 0000000..622642a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/SeiNameInNCNameConstraint.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Checks if 'name' attribute is valid NCName
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiNameInNCNameConstraint extends AbstractValidationConstraint
+{
+ public SeiNameInNCNameConstraint() {
+ super(new SeiConstraintDescriptor());
+ }
+
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)ctx.getTarget();
+ final IStatus status = WsdlNamesValidator.validateNCName2(NAME_ATTRIBUTE, sei.getName());
+ if (!status.isOK()) {
+ return createStatus(sei, status.getMessage(), WS_ANNOTATION, NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(sei);
+ }
+}
+
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/TargetNsValidUriConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/TargetNsValidUriConstraint.java
new file mode 100755
index 0000000..a634730
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/sei/TargetNsValidUriConstraint.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.sei;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+
+/**
+ * Checks if the 'targetNamesoace' attribute in WebService annotation is valid URI
+ *
+ * @author Georgi Vachkov
+ */
+public class TargetNsValidUriConstraint extends AbstractValidationConstraint
+{
+ public TargetNsValidUriConstraint() {
+ super(new SeiConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)ctx.getTarget();
+ try {
+ new URI(sei.getTargetNamespace());
+ } catch (URISyntaxException e) {
+ return createStatus(sei, JaxWsDomRuntimeMessages.bind(
+ JaxWsDomRuntimeMessages.TargetNsValidUriConstraint_URI_SYNTAX_ERROR,
+ new Object[] {e.getIndex(), e.getInput(), e.getReason()}),
+ WS_ANNOTATION, TARGET_NAMESPACE_ATTRIBUTE);
+ }
+
+ return createOkStatus(sei);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/MethodNotExcludedInSeiConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/MethodNotExcludedInSeiConstraint.java
new file mode 100755
index 0000000..97f0eaa
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/MethodNotExcludedInSeiConstraint.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+
+/**
+ * Checks if there is a <b>exclude=true</b> attribute in WebMetod annotation in SEI.
+ * According to jsr-181 section 4.2.1 attribute <b>exclude</b> this is not allowed.
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodNotExcludedInSeiConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public MethodNotExcludedInSeiConstraint() {
+ super(new WmConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebMethod wm = (IWebMethod)ctx.getTarget();
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)wm.eContainer();
+
+ if (wm.isExcluded() && !sei.isImplicit())
+ {
+ return createStatus(wm, ValidationMessages.WebMethodValidation_MethodShouldNotBeExcluded, WM_ANNOTATION, WM_EXCLUDED_ATTRIBUTE);
+ }
+
+ return createOkStatus(wm);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsNCNameConstraint.java
new file mode 100755
index 0000000..fbe4524
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsNCNameConstraint.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_NAME_ATTRIBUTE;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Checks if <b>operationName</b> is valid NCName.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsNCNameConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsNCNameConstraint() {
+ super(new WmConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebMethod wm = (IWebMethod)ctx.getTarget();
+ if(!wm.isExcluded())
+ {
+ final IStatus status = WsdlNamesValidator.validateNCName2(WM_NAME_ATTRIBUTE, wm.getName());
+ if (!status.isOK()) {
+ return createStatus(wm, status.getMessage(), WM_ANNOTATION, WM_NAME_ATTRIBUTE);
+ }
+ }
+
+ return createOkStatus(wm);
+ }
+}
+
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsUniqueConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsUniqueConstraint.java
new file mode 100755
index 0000000..18c426c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/NameIsUniqueConstraint.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_NAME_ATTRIBUTE;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+
+/**
+ * Checks if the <b>operationName</b> attribute is unique in the scope of
+ * SEI methods. According to WSDL specification operations should have different
+ * names e.g. overloading is not supported.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsUniqueConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsUniqueConstraint() {
+ super(new WmConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebMethod webMethod = (IWebMethod)ctx.getTarget();
+ if (!webMethod.isExcluded() && !isNameUnique(webMethod))
+ {
+ final String msg = ValidationMessages.bind(ValidationMessages.WebMethodValidation_NameExists, webMethod.getName());
+ return createStatus(webMethod, msg, WM_ANNOTATION, WM_NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(webMethod);
+ }
+
+ protected boolean isNameUnique(final IWebMethod webMethod)
+ {
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)webMethod.eContainer();
+ for(IWebMethod wm : sei.getWebMethods())
+ {
+ if (wm==webMethod || wm.isExcluded()) {
+ continue;
+ }
+
+ if (wm.getName().equals(webMethod.getName())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/RedundantAttributesConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/RedundantAttributesConstraint.java
new file mode 100755
index 0000000..dc631ef
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/RedundantAttributesConstraint.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+
+import javax.jws.WebMethod;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Check if in {@link WebMethod} annotation where <b>exclude=true</b> no other attributes
+ * are used. According to jsr-181 - point 4.2.1, exclude attribute description this is not
+ * allowed.
+ *
+ * @author Georgi Vachkov
+ */
+public class RedundantAttributesConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public RedundantAttributesConstraint() {
+ super(new WmConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebMethod webMethod = (IWebMethod)ctx.getTarget();
+ final IServiceEndpointInterface sei = (IServiceEndpointInterface)webMethod.eContainer();
+
+ // if the method is not excluded we do not need this check
+ if (!webMethod.isExcluded() || !sei.isImplicit()) {
+ return createOkStatus(webMethod);
+ }
+
+ if (containsOtherAttributes(webMethod)) {
+ return createStatus(webMethod, ValidationMessages.WebMethodValidation_ExcludedHasOtherAttributes, WM_ANNOTATION, null);
+ }
+
+ return createOkStatus(webMethod);
+ }
+
+ protected boolean containsOtherAttributes(final IWebMethod webMethod)
+ {
+ final IAnnotation<? extends IJavaElement> annotation = jee5DomUtil().findAnnotation(webMethod, WM_ANNOTATION);
+ if (annotation==null) {
+ return false;
+ }
+
+ if (annotation.getParamValuePairs().size() > 1) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintDescriptor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintDescriptor.java
new file mode 100755
index 0000000..9a50372
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintDescriptor.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidationConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+class WmConstraintDescriptor extends DomValidationConstraintDescriptor
+{
+ public String getId() {
+ return DomValidationConstants.WM_CONSTRAINT_ID;
+ }
+
+ public String getPluginId() {
+ return JaxWsDomRuntimePlugin.PLUGIN_ID;
+ }
+
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.ERROR;
+ }
+
+ public int getStatusCode() {
+ return -27;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintProvider.java
new file mode 100755
index 0000000..dac9339
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webmethod/WmConstraintProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webmethod;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.validation.model.IModelConstraint;
+
+public class WmConstraintProvider
+{
+ private Set<IModelConstraint> constraints;;
+
+ public Collection<IModelConstraint> getConstraints()
+ {
+ if (constraints == null)
+ {
+ constraints = new HashSet<IModelConstraint>();
+ constraints.add(new NameIsNCNameConstraint());
+ constraints.add(new NameIsUniqueConstraint());
+ constraints.add(new RedundantAttributesConstraint());
+ constraints.add(new MethodNotExcludedInSeiConstraint());
+ }
+
+ return constraints;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsNCNameConstraint.java
new file mode 100755
index 0000000..f73c1e4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsNCNameConstraint.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Check if name attribute of {@link WebParam} annotation is correct NCName.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsNCNameConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsNCNameConstraint() {
+ super(new WpConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(webParam.getImplementation()) || !isNameUsed(webParam)) {
+ return createOkStatus(webParam);
+ }
+
+ final IStatus status = WsdlNamesValidator.validateNCName2(NAME_ATTRIBUTE, webParam.getName());
+ if (!status.isOK()) {
+ return createStatus(webParam, status.getMessage(), WP_ANNOTATION, NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(webParam);
+ }
+
+ protected boolean isNameUsed(final IWebParam webParam)
+ {
+ return Jee5DomUtils.getInstance().isNameUsed(webParam);
+ }
+}
+
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRedundantConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRedundantConstraint.java
new file mode 100755
index 0000000..6d8b0a1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRedundantConstraint.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Check if name attribute of {@link WebParam} annotation is redundant.
+ * See {@link Jee5DomUtils#isNameUsed(IWebParam)}.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsRedundantConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsRedundantConstraint() {
+ super(new NameRedundantConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(webParam.getImplementation())) {
+ return createOkStatus(webParam);
+ }
+
+ final IAnnotation<? extends IJavaElement> annotation = jee5DomUtil().findAnnotation(webParam, WP_ANNOTATION);
+ if (annotation!=null && annotation.getPropertyValue(WPAnnotationFeatures.NAME_ATTRIBUTE)!=null)
+ {
+ if (!jee5DomUtil().isNameUsed(webParam)) {
+ return createStatus(webParam, ValidationMessages.WebParamValidation_NameRedundant, WP_ANNOTATION, NAME_ATTRIBUTE);
+ }
+ }
+
+ return createOkStatus(webParam);
+ }
+
+ protected static class NameRedundantConstraintDescriptor extends WpConstraintDescriptor
+ {
+ @Override
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.WARNING;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRequiredConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRequiredConstraint.java
new file mode 100755
index 0000000..3866b51
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsRequiredConstraint.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Check if name attribute of {@link WebParam} annotation is required.
+ * See {@link Jee5DomUtils#isNameRequired(IWebParam)} for more details.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsRequiredConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsRequiredConstraint() {
+ super(new WpConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(webParam.getImplementation())) {
+ return createOkStatus(webParam);
+ }
+
+ final IAnnotation<? extends IJavaElement> annotation = jee5DomUtil().findAnnotation(webParam, WP_ANNOTATION);
+ if (annotation==null) {
+ return createOkStatus(webParam);
+ }
+
+ if (jee5DomUtil().isNameRequired(webParam) && annotation.getPropertyValue(NAME_ATTRIBUTE)==null) {
+ return createStatus(webParam, ValidationMessages.WebParamValidation_NameRequired, WP_ANNOTATION, null);
+ }
+
+ return createOkStatus(webParam);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsUniqueConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsUniqueConstraint.java
new file mode 100755
index 0000000..4478581
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/NameIsUniqueConstraint.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+
+/**
+ * Check if name attribute of {@link WebParam} annotation is unique in the scope of
+ * the method.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameIsUniqueConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameIsUniqueConstraint() {
+ super(new WpConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(webParam.getImplementation())) {
+ return createOkStatus(webParam);
+ }
+
+ if (!isNameUnique(webParam))
+ {
+ final String msg = ValidationMessages.bind(ValidationMessages.WebParamValidation_NameExists, webParam.getName());
+ return createStatus(webParam, msg, WP_ANNOTATION, NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(webParam);
+ }
+
+ protected boolean isNameUnique(final IWebParam webParam)
+ {
+ final IWebMethod webMethod = (IWebMethod)webParam.eContainer();
+ for (IWebParam wp : webMethod.getParameters())
+ {
+ if (wp==webParam) {
+ continue;
+ }
+
+ if (wp.getName().equals(webParam.getName())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/PartNameIsNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/PartNameIsNCNameConstraint.java
new file mode 100755
index 0000000..eff485b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/PartNameIsNCNameConstraint.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.PART_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Jee5DomUtils;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Check if partName attribute of {@link WebParam} annotation is correct NCName.
+ *
+ * @author Georgi Vachkov
+ */
+public class PartNameIsNCNameConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public PartNameIsNCNameConstraint() {
+ super(new WpConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam webParam = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(webParam.getImplementation()) || !Jee5DomUtils.getInstance().isPartNameUsed(webParam)) {
+ return createOkStatus(webParam);
+ }
+
+ final IStatus status = WsdlNamesValidator.validateNCName2(PART_NAME_ATTRIBUTE, webParam.getPartName());
+ if (!status.isOK()) {
+ return createStatus(webParam, status.getMessage(), WP_ANNOTATION, PART_NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(webParam);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/TargetNsValidUriConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/TargetNsValidUriConstraint.java
new file mode 100755
index 0000000..a5f520e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/TargetNsValidUriConstraint.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.jws.WebParam;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+
+/**
+ * Check if targetNamespace attribute of {@link WebParam} annotation is correct URI.
+ *
+ * @author Georgi Vachkov
+ */
+public class TargetNsValidUriConstraint extends AbstractValidationConstraint
+{
+ private static final String RETURN = "return";//$NON-NLS-1$
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public TargetNsValidUriConstraint() {
+ super(new WpConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebParam wp = (IWebParam)ctx.getTarget();
+ if (RETURN.equals(wp.getImplementation())) {
+ return createOkStatus(wp);
+ }
+
+ try {
+ new URI(wp.getTargetNamespace());
+ } catch (URISyntaxException e) { // $JL-EXC$
+ return createStatus(wp, JaxWsDomRuntimeMessages.bind(
+ JaxWsDomRuntimeMessages.TargetNsValidUriConstraint_URI_SYNTAX_ERROR,
+ new Object[] {e.getIndex(), e.getInput(), e.getReason()}), WP_ANNOTATION, TARGET_NAMESPACE_ATTRIBUTE);
+ }
+
+ return createOkStatus(wp);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintDescriptor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintDescriptor.java
new file mode 100755
index 0000000..ea22245
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintDescriptor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidationConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+/**
+ * The constraint descriptor for WebParam validation constraints
+ *
+ * @author Georgi Vachkov
+ */
+class WpConstraintDescriptor extends DomValidationConstraintDescriptor
+{
+ public String getId() {
+ return DomValidationConstants.WP_CONSTRAINT_ID;
+ }
+
+ public String getPluginId() {
+ return JaxWsDomRuntimePlugin.PLUGIN_ID;
+ }
+
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.ERROR;
+ }
+
+ public int getStatusCode() {
+ return -29;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintProvider.java
new file mode 100755
index 0000000..4028c4b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webparam/WpConstraintProvider.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webparam;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.validation.model.IModelConstraint;
+
+/**
+ * Constraint provider for validation of webPram. Collects all
+ * constraints for WebParam annotation and returns them as collection.
+ *
+ * @author Georgi Vachkov
+ */
+public class WpConstraintProvider
+{
+ private Set<IModelConstraint> constraints;
+
+ public Collection<IModelConstraint> getConstraints()
+ {
+ if (constraints == null)
+ {
+ constraints = new HashSet<IModelConstraint>();
+ constraints.add(new NameIsNCNameConstraint());
+ constraints.add(new NameIsUniqueConstraint());
+ constraints.add(new NameIsRedundantConstraint());
+ constraints.add(new NameIsRequiredConstraint());
+ constraints.add(new PartNameIsNCNameConstraint());
+ constraints.add(new TargetNsValidUriConstraint());
+ }
+
+ return constraints;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointCorrectConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointCorrectConstraint.java
new file mode 100755
index 0000000..c0f154f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointCorrectConstraint.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.EndpointTypeValidator;
+
+/**
+ * Checks the endpoint class if it is capable to be used as service implementation bean
+ * according to jsr-181 section 3.1
+ *
+ * @author Georgi Vachkov
+ */
+public class EndpointCorrectConstraint extends AbstractValidationConstraint
+{
+ private final EndpointTypeValidator validator;
+
+ /**
+ * Constructor - no specific processing here
+ */
+ public EndpointCorrectConstraint()
+ {
+ super(new WsConstraintDescriptor());
+ validator = new EndpointTypeValidator();
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService) ctx.getTarget();
+ final IType wsType = Dom2ResourceMapper.INSTANCE.findType(ws);
+ if (wsType==null) {
+ return createOkStatus(ws);
+ }
+
+ final IStatus status = validator.validate(wsType);
+ if (!status.isOK()) {
+ return createStatus(ws, status.getMessage(), WS_ANNOTATION, null);
+ }
+
+ return createOkStatus(ws);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointImplementsSeiConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointImplementsSeiConstraint.java
new file mode 100755
index 0000000..8f46386
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointImplementsSeiConstraint.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.SeiImplementationValidator;
+
+/**
+ * Validates if the WebService implementation bean implements methods from
+ * referenced service endpoint interface
+ *
+ * @author Georgi Vachkov
+ */
+public class EndpointImplementsSeiConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public EndpointImplementsSeiConstraint()
+ {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService) ctx.getTarget();
+
+ if (ws.getServiceEndpoint()==null || ws.getServiceEndpoint().isImplicit()) {
+ return createOkStatus(ws);
+ }
+
+ final IType wsType = findType(ws);
+ final IType seiType = findType(ws.getServiceEndpoint());
+
+ if (wsType==null || seiType==null) {
+ return createOkStatus(ws);
+ }
+
+ final SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ final IStatus status = validator.validate(wsType);
+ if (!status.isOK()) {
+ return createStatus(ws, status.getMessage(), WS_ANNOTATION, ENDPOINT_INTERFACE_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+
+ protected IType findType(final EObject eObject) throws JavaModelException {
+ return Dom2ResourceMapper.INSTANCE.findType(eObject);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointInterfaceExistsConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointInterfaceExistsConstraint.java
new file mode 100755
index 0000000..8f49eb9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointInterfaceExistsConstraint.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Checks if referenced by endpoint SEI exists in the project.
+ *
+ * @author Georgi Vachkov
+ */
+public class EndpointInterfaceExistsConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public EndpointInterfaceExistsConstraint() {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService)ctx.getTarget();
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(ws, IAnnotationAdapter.class);
+ final IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation(WS_ANNOTATION);
+ if (annotation == null) {
+ return createOkStatus(ws);
+ }
+
+ final String seiFQName = annotation.getPropertyValue(ENDPOINT_INTERFACE_ATTRIBUTE);
+ if (seiFQName == null) {
+ return createOkStatus(ws);
+ }
+
+ if (ws.getServiceEndpoint()==null) {
+ final String msg = ValidationMessages.bind(ValidationMessages.WsValidation_SeiDoesNotExists, seiFQName);
+ return createStatus(ws, msg, WS_ANNOTATION, ENDPOINT_INTERFACE_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointIsSessionBeanConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointIsSessionBeanConstraint.java
new file mode 100755
index 0000000..76b2ac0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/EndpointIsSessionBeanConstraint.java
@@ -0,0 +1,79 @@
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.javaee.ejb.SessionBean;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.facets.FacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.facets.IFacetUtils;
+
+/**
+ * Constraint for validating whether a class in a EJB module annotated with the "@WebService" annotation is a session bean
+ *
+ * @author Danail Branekov
+ */
+public class EndpointIsSessionBeanConstraint extends AbstractValidationConstraint
+{
+ public EndpointIsSessionBeanConstraint()
+ {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws CoreException
+ {
+ final IWebService ws = (IWebService) ctx.getTarget();
+ final IType wsType = Dom2ResourceMapper.INSTANCE.findType(ws);
+ if (wsType == null || wsType.getResource() == null)
+ {
+ return createOkStatus(ws);
+ }
+
+ final IProject project = wsType.getResource().getProject();
+ if (!facetUtils().hasFacetWithVersion(project, IFacetUtils.EJB_30_FACET_VERSION, IFacetUtils.EJB_30_FACET_ID))
+ {
+ return createOkStatus(ws);
+ }
+
+ if (!isSessionBean(wsType))
+ {
+ return createStatus(ws, ValidationMessages.WsValidation_WsAnnotationOnNonSessionBean_Error, WSAnnotationFeatures.WS_ANNOTATION, null);
+ }
+
+ return createOkStatus(ws);
+
+ }
+
+ private IFacetUtils facetUtils()
+ {
+ return new FacetUtils();
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isSessionBean(final IType endpointType)
+ {
+ final IModelProvider provider = ModelProviderManager.getModelProvider(endpointType.getResource().getProject());
+ final Object modelObject = provider.getModelObject();
+ final List<SessionBean> sessionBeans = ((org.eclipse.jst.javaee.ejb.EJBJar) modelObject).getEnterpriseBeans().getSessionBeans();
+ for (SessionBean bean : sessionBeans)
+ {
+ if (bean.getEjbClass().equals(endpointType.getFullyQualifiedName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/NameRedundantConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/NameRedundantConstraint.java
new file mode 100755
index 0000000..b8dc37e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/NameRedundantConstraint.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Checks if there is a name attribute on ednpoint that references SEI.
+ * According to jsr-181 point 3.1 subpoint 5.
+ *
+ * @author Georgi Vachkov
+ */
+public class NameRedundantConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public NameRedundantConstraint() {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService)ctx.getTarget();
+ if (ws.getServiceEndpoint()!=null && ws.getServiceEndpoint().isImplicit()) {
+ return createOkStatus(ws);
+ }
+
+ if (hasNameAttribute(ws)) {
+ return createStatus(ws, ValidationMessages.WsValidation_NameShouldNotBeUsedWithSei, WS_ANNOTATION, NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+
+ protected boolean hasNameAttribute(final IWebService webService)
+ {
+ final IAnnotation<? extends IJavaElement> annotation = findAnnotation(webService, WS_ANNOTATION);
+ if (annotation==null) {
+ return false;
+ }
+
+ return annotation.getPropertyValue(NAME_ATTRIBUTE)!=null;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/PortNameIsNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/PortNameIsNCNameConstraint.java
new file mode 100755
index 0000000..36b5273
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/PortNameIsNCNameConstraint.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.PORT_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Checks if portName attribute of WebService annotation is valid NCName
+ *
+ * @author Georgi Vachkov
+ */
+public class PortNameIsNCNameConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public PortNameIsNCNameConstraint() {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService)ctx.getTarget();
+ final IStatus status = WsdlNamesValidator.validateNCName2(PORT_NAME_ATTRIBUTE, ws.getPortName());
+ if (!status.isOK()) {
+ return createStatus(ws, status.getMessage(), WS_ANNOTATION, PORT_NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/ServiceNameIsNCNameConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/ServiceNameIsNCNameConstraint.java
new file mode 100755
index 0000000..a79dba0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/ServiceNameIsNCNameConstraint.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.utils.WsdlNamesValidator;
+
+/**
+ * Checks if serviceName attribute of WebService annotation is valid NCName
+ *
+ * @author Georgi Vachkov
+ */
+public class ServiceNameIsNCNameConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public ServiceNameIsNCNameConstraint() {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(final IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService)ctx.getTarget();
+ final IStatus status = WsdlNamesValidator.validateNCName2(SERVICE_NAME_ATTRIBUTE, ws.getName());
+ if (!status.isOK()) {
+ return createStatus(ws, status.getMessage(), WS_ANNOTATION, SERVICE_NAME_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/TargetNsValidUriConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/TargetNsValidUriConstraint.java
new file mode 100755
index 0000000..fd15c89
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/TargetNsValidUriConstraint.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimeMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+
+/**
+ * Checks if targetNamespace attribute of WebService annotation is valid URI
+ *
+ * @author Georgi Vachkov
+ */
+public class TargetNsValidUriConstraint extends AbstractValidationConstraint
+{
+ /**
+ * Constructor - no specific processing here
+ */
+ public TargetNsValidUriConstraint() {
+ super(new WsConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ {
+ final IWebService ws = (IWebService)ctx.getTarget();
+ try {
+ new URI(ws.getTargetNamespace());
+ } catch (URISyntaxException e) { // $JL-EXC$
+ return createStatus(ws, JaxWsDomRuntimeMessages.bind(
+ JaxWsDomRuntimeMessages.TargetNsValidUriConstraint_URI_SYNTAX_ERROR,
+ new Object[] {e.getIndex(), e.getInput(), e.getReason()})
+ , WS_ANNOTATION, TARGET_NAMESPACE_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintDescriptor.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintDescriptor.java
new file mode 100755
index 0000000..5d28cb9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintDescriptor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.plugin.JaxWsDomRuntimePlugin;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidationConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+/**
+ * The constraint descriptor for WS constraints
+ *
+ * @author Georgi Vachkov
+ */
+class WsConstraintDescriptor extends DomValidationConstraintDescriptor
+{
+ public String getId() {
+ return DomValidationConstants.WS_CONSTRAINT_ID;
+ }
+
+ public String getPluginId() {
+ return JaxWsDomRuntimePlugin.PLUGIN_ID;
+ }
+
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.ERROR;
+ }
+
+ public int getStatusCode() {
+ return -26;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintProvider.java
new file mode 100755
index 0000000..279c2ad
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsConstraintProvider.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.validation.model.IModelConstraint;
+
+/**
+ * The constraint provider for WebService objects
+ *
+ * @author Georgi Vachkov
+ */
+public class WsConstraintProvider
+{
+ private Set<IModelConstraint> constraints;;
+
+ public Collection<IModelConstraint> getConstraints()
+ {
+ if (constraints == null)
+ {
+ constraints = new HashSet<IModelConstraint>();
+ constraints.add(new ServiceNameIsNCNameConstraint());
+ constraints.add(new PortNameIsNCNameConstraint());
+ constraints.add(new TargetNsValidUriConstraint());
+ constraints.add(new EndpointInterfaceExistsConstraint());
+ constraints.add(new WsdlLocationCorrectConstraint());
+ constraints.add(new NameRedundantConstraint());
+ constraints.add(new EndpointCorrectConstraint());
+ constraints.add(new EndpointImplementsSeiConstraint());
+ constraints.add(new EndpointIsSessionBeanConstraint());
+ }
+
+ return constraints;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsdlLocationCorrectConstraint.java b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsdlLocationCorrectConstraint.java
new file mode 100755
index 0000000..64a4509
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.runtime/src/org/eclipse/jst/ws/jaxws/dom/runtime/validation/webservice/WsdlLocationCorrectConstraint.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.validation.webservice;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+/**
+ * Checks if the WSDL location contains valid value.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsdlLocationCorrectConstraint extends AbstractValidationConstraint
+{
+ public WsdlLocationCorrectConstraint() {
+ super(new WarningConstraintDescriptor());
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException
+ { final IWebService ws = (IWebService)ctx.getTarget();
+ final IAnnotation<? extends IJavaElement> annotation = findAnnotation(ws, WS_ANNOTATION);
+ if (annotation==null || annotation.getPropertyValue(WSDL_LOCATION_ATTRIBUTE)==null) {
+ return createOkStatus(ws);
+ }
+
+ if (checkWsdlLocationInProject(ws)) {
+ return createOkStatus(ws);
+ }
+
+ return checkWsdlUrl(ws, annotation.getPropertyValue(WSDL_LOCATION_ATTRIBUTE));
+ }
+
+ protected IStatus checkWsdlUrl(final IWebService ws, final String wsdlUrl) throws JavaModelException
+ {
+ try {
+ new URL(wsdlUrl);
+ }
+ catch (MalformedURLException e) { // $JL-EXC$
+ String msg = ValidationMessages.bind(ValidationMessages.WsValidation_WsdlDoesNotExists,
+ e.getLocalizedMessage());
+ return createStatus(ws, msg, WS_ANNOTATION, WSDL_LOCATION_ATTRIBUTE);
+ }
+
+ return createOkStatus(ws);
+ }
+
+ protected boolean checkWsdlLocationInProject(final IWebService webService) throws JavaModelException
+ {
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(webService, IAnnotationAdapter.class);
+ final IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation(WS_ANNOTATION);
+ if (annotation==null) {
+ return true;
+ }
+
+ final String wsdlLocation = annotation.getPropertyValue(WSDL_LOCATION_ATTRIBUTE);
+ if (wsdlLocation == null) {
+ return true;
+ }
+
+ if (wsdlLocation.trim().length()==0) {
+ return false;
+ }
+
+ return findFile(webService, wsdlLocation);
+ }
+
+ protected boolean findFile(final IWebService webService, final String file) throws JavaModelException
+ {
+ final IProject project = Dom2ResourceMapper.INSTANCE.findProject((IWebServiceProject)webService.eContainer());
+ IResource resource = project.findMember(file);
+ if (resource!=null) {
+ return true;
+ }
+
+ final IJavaProject javaProject = JavaCore.create(project);
+ for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots())
+ {
+ if (root.getResource()==null) {
+ continue;
+ }
+
+ if (root.getResource().getType()==IResource.FOLDER) {
+ if (((IFolder) root.getResource()).findMember(file) != null) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected static class WarningConstraintDescriptor extends WsConstraintDescriptor
+ {
+ @Override
+ public ConstraintSeverity getSeverity() {
+ return ConstraintSeverity.WARNING;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.classpath b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.project b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.project
new file mode 100755
index 0000000..9784ac9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..c0bb2b4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Jun 23 10:38:22 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..2bcd2b5
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.ui;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi$Implementation
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.jst.ws.jaxws.dom.ui,
+ org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jst.ws.jaxws.dom.runtime;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.ws.jaxws.utils,
+ org.eclipse.jface
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/about.html b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/about.html
new file mode 100644
index 0000000..8410afb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 15, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/build.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/build.properties
new file mode 100755
index 0000000..2d184ee
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI.gif
new file mode 100755
index 0000000..21325ca
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI_Group.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI_Group.gif
new file mode 100755
index 0000000..9afcc01
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/SEI_Group.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Method.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Method.gif
new file mode 100755
index 0000000..5818a30
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Method.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_In.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_In.gif
new file mode 100755
index 0000000..fe6b349
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_In.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_Out.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_Out.gif
new file mode 100755
index 0000000..bd0918c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Param_Out.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service.gif
new file mode 100755
index 0000000..5216b3f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Group.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Group.gif
new file mode 100755
index 0000000..8b4814c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Group.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Item_Provider.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Item_Provider.gif
new file mode 100755
index 0000000..8fb844f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/Web_Service_Item_Provider.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/error_obj.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/error_obj.gif
new file mode 100755
index 0000000..0bc6068
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/error_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIDOM_webServiceProjects_IWebServiceProject.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIDOM_webServiceProjects_IWebServiceProject.gif
new file mode 100755
index 0000000..4c76674
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIDOM_webServiceProjects_IWebServiceProject.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIServiceEndpointInterface_webMethods_IWebMethod.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIServiceEndpointInterface_webMethods_IWebMethod.gif
new file mode 100755
index 0000000..95f5a8c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIServiceEndpointInterface_webMethods_IWebMethod.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebMethod_parameters_IWebParam.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebMethod_parameters_IWebParam.gif
new file mode 100755
index 0000000..03d63cb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebMethod_parameters_IWebParam.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_serviceEndpointInterfaces_IServiceEndpointInterface.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_serviceEndpointInterfaces_IServiceEndpointInterface.gif
new file mode 100755
index 0000000..361b182
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_serviceEndpointInterfaces_IServiceEndpointInterface.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_webServices_IWebService.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_webServices_IWebService.gif
new file mode 100755
index 0000000..9120d10
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/ctool16/CreateIWebServiceProject_webServices_IWebService.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IDOM.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IDOM.gif
new file mode 100755
index 0000000..420eee1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IDOM.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IJavaWebServiceElement.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IJavaWebServiceElement.gif
new file mode 100755
index 0000000..ea58a65
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IJavaWebServiceElement.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IServiceEndpointInterface.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IServiceEndpointInterface.gif
new file mode 100755
index 0000000..33a997a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IServiceEndpointInterface.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebMethod.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebMethod.gif
new file mode 100755
index 0000000..a17dc7d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebMethod.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebParam.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebParam.gif
new file mode 100755
index 0000000..8a5c70c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebParam.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebService.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebService.gif
new file mode 100755
index 0000000..53500da
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebService.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebServiceProject.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebServiceProject.gif
new file mode 100755
index 0000000..498364f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebServiceProject.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebType.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebType.gif
new file mode 100755
index 0000000..c00aedf
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/full/obj16/IWebType.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/warning_obj.gif b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/warning_obj.gif
new file mode 100755
index 0000000..2b2e50f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/icons/warning_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.properties
new file mode 100755
index 0000000..585ea87
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.properties
@@ -0,0 +1,84 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_IDOM_type = IDOM
+_UI_IJavaWebServiceElement_type = Java Web Service Element
+_UI_IServiceEndpointInterface_type = Service Endpoint Interface
+_UI_IWebService_type = Web Service
+_UI_IWebServiceProject_type = Web Service Project
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_IDOM_webServiceProjects_feature = Web Service Projects
+_UI_IJavaWebServiceElement_javaImplementation_feature = Java Implementation
+_UI_IServiceEndpointInterface_name_feature = Name
+_UI_IServiceEndpointInterface_implicit_feature = Implicit
+_UI_IServiceEndpointInterface_implementingWebServices_feature = Implementing Web Services
+_UI_IServiceEndpointInterface_targetNamespace_feature = Target Namespace
+_UI_IServiceEndpointInterface_soapBinding = SOAP Binding
+_UI_IWebService_name_feature = Name
+_UI_IWebService_serviceEndpoint_feature = Service Endpoint
+_UI_IWebService_targetNamespace_feature = Target Namespace
+_UI_IWebService_portName_feature = Port Name
+_UI_IWebService_wsdlLocation_feature = WSDL Location
+_UI_IWebServiceProject_webServices_feature = Web Services
+_UI_IWebServiceProject_serviceEndpointInterfaces_feature = Service Endpoint Interfaces
+_UI_IWebServiceProject_name_feature = Name
+_UI_Unknown_feature = Unspecified
+
+_UI_WebServiceAnnotationCategory = General (WebService annotation)
+_UI_WebMethodAnnotationCategory = General (WebMethod annotation)
+_UI_WebParamAnnotationCategory = General (WebParam annotation)
+
+_UI_IJavaWebServiceElement_implementation_feature = Java representation
+_UI_IWebMethod_type = Web Method
+_UI_IWebParam_type = Web Param
+_UI_IWebType_type = Web Type
+_UI_IJavaWebServiceElement_name_feature = Name
+_UI_IWebMethod_excluded_feature = Excluded
+_UI_IWebParam_kind_feature = Mode
+_UI_IServiceEndpointInterface_webMethods_feature = Web Methods
+_UI_IWebMethod_parameters_feature = Parameters
+_UI_IWebParam_typeName_feature = Type Name
+_UI_IWebParam_partName_feature = Part Name
+_UI_IWebParam_targetNamespace_feature = Target Namespace
+_UI_IWebParam_header_feature = Header
+_UI_IServiceEndpointInterface_soapBindingStyle_feature = Style
+_UI_IServiceEndpointInterface_soapBindingUse_feature = Use
+_UI_IServiceEndpointInterface_soapBindingParameterStyle_feature = Parameter Style
+_UI_IWebMethod_soapBindingStyle_feature = Style
+_UI_IWebMethod_soapBindingUse_feature = Use
+_UI_IWebMethod_soapBindingParameterStyle_feature = Parameter Style
+
+
+Bundle-Name.0 = JAX-WS DOM UI Plug-in (Incubation)
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.xml b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.xml
new file mode 100755
index 0000000..f94d68f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ SAP AG - initial API and implementation
+ -->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri="http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"
+ class="org.eclipse.jst.ws.jaxws.dom.ui.DomItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/DomItemProviderAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/DomItemProviderAdapterFactory.java
new file mode 100755
index 0000000..b923563
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/DomItemProviderAdapterFactory.java
@@ -0,0 +1,375 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.DomAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DomItemProviderAdapterFactory extends DomAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IDOMItemProvider idomItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIDOMAdapter() {
+ if (idomItemProvider == null) {
+ idomItemProvider = new IDOMItemProvider(this);
+ }
+
+ return idomItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IJavaWebServiceElementItemProvider iJavaWebServiceElementItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIJavaWebServiceElementAdapter() {
+ if (iJavaWebServiceElementItemProvider == null) {
+ iJavaWebServiceElementItemProvider = new IJavaWebServiceElementItemProvider(this);
+ }
+
+ return iJavaWebServiceElementItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IServiceEndpointInterfaceItemProvider iServiceEndpointInterfaceItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIServiceEndpointInterfaceAdapter() {
+ if (iServiceEndpointInterfaceItemProvider == null) {
+ iServiceEndpointInterfaceItemProvider = new IServiceEndpointInterfaceItemProvider(this);
+ }
+
+ return iServiceEndpointInterfaceItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebMethodItemProvider iWebMethodItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIWebMethodAdapter() {
+ if (iWebMethodItemProvider == null) {
+ iWebMethodItemProvider = new IWebMethodItemProvider(this);
+ }
+
+ return iWebMethodItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebParamItemProvider iWebParamItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIWebParamAdapter() {
+ if (iWebParamItemProvider == null) {
+ iWebParamItemProvider = new IWebParamItemProvider(this);
+ }
+
+ return iWebParamItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebServiceItemProvider iWebServiceItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIWebServiceAdapter() {
+ if (iWebServiceItemProvider == null) {
+ iWebServiceItemProvider = new IWebServiceItemProvider(this);
+ }
+
+ return iWebServiceItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebServiceProjectItemProvider iWebServiceProjectItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIWebServiceProjectAdapter() {
+ if (iWebServiceProjectItemProvider == null) {
+ iWebServiceProjectItemProvider = new IWebServiceProjectItemProvider(this);
+ }
+
+ return iWebServiceProjectItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWebTypeItemProvider iWebTypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIWebTypeAdapter() {
+ if (iWebTypeItemProvider == null) {
+ iWebTypeItemProvider = new IWebTypeItemProvider(this);
+ }
+
+ return iWebTypeItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (idomItemProvider != null) idomItemProvider.dispose();
+ if (iJavaWebServiceElementItemProvider != null) iJavaWebServiceElementItemProvider.dispose();
+ if (iServiceEndpointInterfaceItemProvider != null) iServiceEndpointInterfaceItemProvider.dispose();
+ if (iWebMethodItemProvider != null) iWebMethodItemProvider.dispose();
+ if (iWebParamItemProvider != null) iWebParamItemProvider.dispose();
+ if (iWebServiceItemProvider != null) iWebServiceItemProvider.dispose();
+ if (iWebServiceProjectItemProvider != null) iWebServiceProjectItemProvider.dispose();
+ if (iWebTypeItemProvider != null) iWebTypeItemProvider.dispose();
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMItemProvider.java
new file mode 100755
index 0000000..00e1cd4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMItemProvider.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IDOMItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IDOMItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DomPackage.Literals.IDOM__WEB_SERVICE_PROJECTS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns IDOM.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/IDOM")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_IDOM_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IDOM.class)) {
+ case DomPackage.IDOM__WEB_SERVICE_PROJECTS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DomPackage.Literals.IDOM__WEB_SERVICE_PROJECTS,
+ DomFactory.eINSTANCE.createIWebServiceProject()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMPropertyValue.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMPropertyValue.java
new file mode 100755
index 0000000..7862b01
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IDOMPropertyValue.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+
+/**
+ * Interface representing property value. This interface is used to identify property values for WS DOM objects.
+ *
+ * @author Georgi Vachkov
+ */
+public interface IDOMPropertyValue extends IItemPropertySource
+{
+ public Object getEditableValue();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IJavaWebServiceElementItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IJavaWebServiceElementItemProvider.java
new file mode 100755
index 0000000..84dbb8f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IJavaWebServiceElementItemProvider.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.impl.DOMItemPropertyProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IJavaWebServiceElementItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IJavaWebServiceElementItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addImplementationPropertyDescriptor(object);
+ addNamePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Implementation feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addImplementationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IJavaWebServiceElement_implementation_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IJavaWebServiceElement_implementation_feature", "_UI_IJavaWebServiceElement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IJavaWebServiceElement_name_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IJavaWebServiceElement_name_feature", "_UI_IJavaWebServiceElement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This method defines at which category the name should go to. Extender of
+ * this class should override it if wants the name to be separated in different
+ * than default category.
+ *
+ * @return the default implementation returns <code>null</code>
+ */
+ public String getNameCategory() {
+ return null;
+ }
+
+ /**
+ * This returns IJavaWebServiceElement.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/IJavaWebServiceElement")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IJavaWebServiceElement)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IJavaWebServiceElement_type") : //$NON-NLS-1$
+ getString("_UI_IJavaWebServiceElement_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IJavaWebServiceElement.class)) {
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION:
+ case DomPackage.IJAVA_WEB_SERVICE_ELEMENT__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IServiceEndpointInterfaceItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IServiceEndpointInterfaceItemProvider.java
new file mode 100755
index 0000000..f88bc41
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IServiceEndpointInterfaceItemProvider.java
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.impl.DOMItemPropertyProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IServiceEndpointInterfaceItemProvider
+ extends IJavaWebServiceElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IServiceEndpointInterfaceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
+ {
+ itemPropertyDescriptors = null;
+
+ super.getPropertyDescriptors(object);
+
+ addImplicitPropertyDescriptor(object);
+ addImplementingWebServicesPropertyDescriptor(object);
+ addTargetNamespacePropertyDescriptor(object);
+ addSoapBindingStylePropertyDescriptor(object);
+ addSoapBindingUsePropertyDescriptor(object);
+ addSoapBindingParameterStylePropertyDescriptor(object);
+
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Implicit feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addImplicitPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_implicit_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_implicit_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Implementing Web Services feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addImplementingWebServicesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_implementingWebServices_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_implementingWebServices_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLEMENTING_WEB_SERVICES,
+ false,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target Namespace feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addTargetNamespacePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_targetNamespace_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_targetNamespace_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Style feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingStylePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_soapBindingStyle_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_soapBindingStyle_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Use feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingUsePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_soapBindingUse_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_soapBindingUse_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Parameter Style feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingParameterStylePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IServiceEndpointInterface_soapBindingParameterStyle_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IServiceEndpointInterface_soapBindingParameterStyle_feature", "_UI_IServiceEndpointInterface_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns IServiceEndpointInterface.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, Images.INSTANCE.getImage(Images.IMG_SEI));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IServiceEndpointInterface)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IServiceEndpointInterface_type") : //$NON-NLS-1$
+ label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IServiceEndpointInterface.class)) {
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT:
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE:
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_STYLE:
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_USE:
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__SOAP_BINDING_PARAMETER_STYLE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case DomPackage.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__WEB_METHODS,
+ DomFactory.eINSTANCE.createIWebMethod()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+ @Override
+ public String getNameCategory()
+ {
+ return getString("_UI_WebServiceAnnotationCategory"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebMethodItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebMethodItemProvider.java
new file mode 100755
index 0000000..7800540
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebMethodItemProvider.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IWebMethodItemProvider extends IJavaWebServiceElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebMethodItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
+ {
+ if (itemPropertyDescriptors != null) {
+ return itemPropertyDescriptors;
+ }
+
+ super.getPropertyDescriptors(object);
+
+ addExcludedPropertyDescriptor(object);
+ addSoapBindingStylePropertyDescriptor(object);
+ addSoapBindingUsePropertyDescriptor(object);
+ addSoapBindingParameterStylePropertyDescriptor(object);
+
+ return itemPropertyDescriptors;
+ }
+
+ @Override
+ protected void addImplementationPropertyDescriptor(Object object)
+ {
+ itemPropertyDescriptors.add(
+ new ItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IJavaWebServiceElement_implementation_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IJavaWebServiceElement_implementation_feature", "_UI_IJavaWebServiceElement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null)
+ {
+
+ @Override
+ protected Object getValue(EObject object, EStructuralFeature feature)
+ {
+ String returnString = ""; //$NON-NLS-1$
+ String parameters = ""; //$NON-NLS-1$
+ IWebMethod webMethod = (IWebMethod)getTarget();
+
+ for(IWebParam webParam : webMethod.getParameters())
+ {
+ if(webParam.getName().equals("return")) //$NON-NLS-1$
+ {
+ returnString = getTypeName(webParam.getTypeName()) + " "; //$NON-NLS-1$
+ }
+ else
+ {
+ parameters = parameters + getTypeName(webParam.getTypeName()) + ", "; //$NON-NLS-1$
+ }
+ }
+
+ if (parameters.length() > 0) {
+ parameters = parameters.substring(0, parameters.lastIndexOf(','));
+ }
+
+ String methodName = webMethod.getImplementation();
+ int pos = methodName.indexOf('(');
+ if (pos > -1) {
+ methodName = methodName.substring(0, pos);
+ }
+
+ return returnString + methodName + '(' + parameters + ')';
+ }
+
+ protected String getTypeName(String typeName)
+ {
+ return typeName.substring(typeName.lastIndexOf('.') + 1);
+ }
+ });
+ }
+
+ /**
+ * This adds a property descriptor for the Excluded feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addExcludedPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebMethod_excluded_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebMethod_excluded_feature", "_UI_IWebMethod_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_METHOD__EXCLUDED,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Style feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingStylePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebMethod_soapBindingStyle_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebMethod_soapBindingStyle_feature", "_UI_IWebMethod_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_STYLE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Use feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingUsePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebMethod_soapBindingUse_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebMethod_soapBindingUse_feature", "_UI_IWebMethod_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_USE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Soap Binding Parameter Style feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addSoapBindingParameterStylePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebMethod_soapBindingParameterStyle_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebMethod_soapBindingParameterStyle_feature", "_UI_IWebMethod_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getString("_UI_IServiceEndpointInterface_soapBinding"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DomPackage.Literals.IWEB_METHOD__PARAMETERS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns Web_Method.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, Images.INSTANCE.getImage(Images.IMG_WEB_METHOD));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IWebMethod)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IWebMethod_type") : //$NON-NLS-1$
+ label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IWebMethod.class)) {
+ case DomPackage.IWEB_METHOD__EXCLUDED:
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_STYLE:
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_USE:
+ case DomPackage.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case DomPackage.IWEB_METHOD__PARAMETERS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DomPackage.Literals.IWEB_METHOD__PARAMETERS,
+ DomFactory.eINSTANCE.createIWebParam()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+ @Override
+ public String getNameCategory()
+ {
+ return getString("_UI_WebMethodAnnotationCategory"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebParamItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebParamItemProvider.java
new file mode 100755
index 0000000..b075bad
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebParamItemProvider.java
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.impl.DOMItemPropertyProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IWebParamItemProvider
+ extends IJavaWebServiceElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebParamItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors != null) {
+ return itemPropertyDescriptors;
+ }
+
+ super.getPropertyDescriptors(object);
+
+ addKindPropertyDescriptor(object);
+ addTypeNamePropertyDescriptor(object);
+ addPartNamePropertyDescriptor(object);
+ addTargetNamespacePropertyDescriptor(object);
+ addHeaderPropertyDescriptor(object);
+
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Kind feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_kind_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_kind_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__KIND,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Type Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addTypeNamePropertyDescriptorOld(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_typeName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_typeName_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__TYPE_NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ protected void addTypeNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new ItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_typeName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_typeName_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__TYPE_NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null)
+ {
+ @Override
+ protected Object getValue(EObject object, EStructuralFeature feature)
+ {
+ String typeName = null;
+
+ final Object typeSignature = super.getValue(object, feature);
+ if (typeSignature != null)
+ {
+ typeName = Signature.toString(typeSignature.toString());
+ }
+
+ return typeName;
+ }
+ });
+ }
+
+ /**
+ * This adds a property descriptor for the Part Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addPartNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_partName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_partName_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__PART_NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target Namespace feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addTargetNamespacePropertyDescriptor(Object object) {
+ final IPropertyState state = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(object, IPropertyState.class);
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_targetNamespace_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_targetNamespace_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE,
+ (state==null) ? false : state.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE),
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Header feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addHeaderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebParam_header_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebParam_header_feature", "_UI_IWebParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_PARAM__HEADER,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This returns Web_Param.gif.
+ */
+ @Override
+ public Object getImage(Object object)
+ {
+ String imageName = Images.IMG_WEB_PARAM_IN;
+
+ if ((object instanceof IWebParam) && ((IWebParam) object).getImplementation().equals("return")) //$NON-NLS-1$
+ {
+ imageName = Images.IMG_WEB_PARAM_OUT;
+ }
+
+ return overlayImage(object, Images.INSTANCE.getImage(imageName));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ */
+ @Override
+ public String getText(Object object)
+ {
+ return ((IWebParam)object).getName();
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IWebParam.class)) {
+ case DomPackage.IWEB_PARAM__KIND:
+ case DomPackage.IWEB_PARAM__TYPE_NAME:
+ case DomPackage.IWEB_PARAM__PART_NAME:
+ case DomPackage.IWEB_PARAM__TARGET_NAMESPACE:
+ case DomPackage.IWEB_PARAM__HEADER:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+ @Override
+ public String getNameCategory()
+ {
+ return getString("_UI_WebParamAnnotationCategory"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceItemProvider.java
new file mode 100755
index 0000000..c894082
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceItemProvider.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.impl.DOMItemPropertyProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IWebServiceItemProvider
+ extends IJavaWebServiceElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebServiceItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+
+ if (itemPropertyDescriptors != null) {
+ return itemPropertyDescriptors;
+ }
+
+ super.getPropertyDescriptors(object);
+
+ addServiceEndpointPropertyDescriptor(object);
+ addTargetNamespacePropertyDescriptor(object);
+ addPortNamePropertyDescriptor(object);
+ addWsdlLocationPropertyDescriptor(object);
+
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Service Endpoint feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addServiceEndpointPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebService_serviceEndpoint_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebService_serviceEndpoint_feature", "_UI_IWebService_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_SERVICE__SERVICE_ENDPOINT,
+ false,
+ false,
+ true,
+ null,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target Namespace feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addTargetNamespacePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebService_targetNamespace_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebService_targetNamespace_feature", "_UI_IWebService_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_SERVICE__TARGET_NAMESPACE,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Port Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addPortNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (new DOMItemPropertyProvider
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebService_portName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebService_portName_feature", "_UI_IWebService_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_SERVICE__PORT_NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Wsdl Location feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addWsdlLocationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebService_wsdlLocation_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebService_wsdlLocation_feature", "_UI_IWebService_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_SERVICE__WSDL_LOCATION,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ getNameCategory(),
+ null));
+ }
+
+ /**
+ * This returns IWebService.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, Images.INSTANCE.getImage(Images.IMG_WEB_SERVICE));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IWebService)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IWebService_type") : //$NON-NLS-1$
+ label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IWebService.class)) {
+ case DomPackage.IWEB_SERVICE__SERVICE_ENDPOINT:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, true));
+ return;
+ }
+
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+ @Override
+ public String getNameCategory()
+ {
+ return getString("_UI_WebServiceAnnotationCategory"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceProjectItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceProjectItemProvider.java
new file mode 100755
index 0000000..5681e7a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebServiceProjectItemProvider.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IWebServiceProjectItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebServiceProjectItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addNamePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IWebServiceProject_name_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_IWebServiceProject_name_feature", "_UI_IWebServiceProject_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ DomPackage.Literals.IWEB_SERVICE_PROJECT__NAME,
+ false,
+ false,
+ false,
+ ItemPropertyDescriptor.TEXT_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DomPackage.Literals.IWEB_SERVICE_PROJECT__WEB_SERVICES);
+ childrenFeatures.add(DomPackage.Literals.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns IWebServiceProject.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, Images.INSTANCE.getImage(Images.IMG_DOM_WS_PROVIDER));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IWebServiceProject)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IWebServiceProject_type") : //$NON-NLS-1$
+ getString("_UI_IWebServiceProject_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IWebServiceProject.class)) {
+ case DomPackage.IWEB_SERVICE_PROJECT__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case DomPackage.IWEB_SERVICE_PROJECT__WEB_SERVICES:
+ case DomPackage.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DomPackage.Literals.IWEB_SERVICE_PROJECT__WEB_SERVICES,
+ DomFactory.eINSTANCE.createIWebService()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DomPackage.Literals.IWEB_SERVICE_PROJECT__SERVICE_ENDPOINT_INTERFACES,
+ DomFactory.eINSTANCE.createIServiceEndpointInterface()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebTypeItemProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebTypeItemProvider.java
new file mode 100755
index 0000000..bab35b8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/IWebTypeItemProvider.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebType} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IWebTypeItemProvider
+ extends IJavaWebServiceElementItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IWebTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns IWebType.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/IWebType")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((IWebType)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_IWebType_type") : //$NON-NLS-1$
+ getString("_UI_IWebType_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DomUi.INSTANCE;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/Images.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/Images.java
new file mode 100755
index 0000000..c75a909
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/Images.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui;
+
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.DomUi;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Images bundle. Use this class when you need to load some image.
+ *
+ * @author Georgi Vachkov
+ */
+public class Images
+{
+ public static final Images INSTANCE = new Images();
+
+ public static final String IMG_WEB_METHOD = "WebMethod"; //$NON-NLS-1$
+ public static final String IMG_WEB_PARAM_IN = "WebParamIn"; //$NON-NLS-1$
+ public static final String IMG_WEB_PARAM_OUT = "WebParamOut"; //$NON-NLS-1$
+ public static final String IMG_WEB_SERVICE = "WebService"; //$NON-NLS-1$
+ public static final String IMG_WEB_SERVICE_GROUP = "WebServiceGroup"; //$NON-NLS-1$
+ public static final String IMG_SEI = "SEI"; //$NON-NLS-1$
+ public static final String IMG_SEI_GROUP = "SEIGroup"; //$NON-NLS-1$
+ public static final String IMG_DOM_WS_PROVIDER = "DOMWSProvider"; //$NON-NLS-1$
+ public static final String IMG_ERROR_MARKER = "error_obj"; //$NON-NLS-1$
+ public static final String IMG_WARNING_MARKER = "warning_obj"; //$NON-NLS-1$
+
+ private static ResourceBundle iconsBundle;
+ private static ImageRegistry mImageRegistry;
+
+ /**
+ * Constructor
+ */
+ public Images()
+ {
+ try {
+ iconsBundle = ResourceBundle.getBundle("org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin.WSImageBundle"); //$NON-NLS-1$
+ }
+ catch (MissingResourceException x) {
+ (new Logger()).logError("Unable to load image bundle for this plugin!", x); //$NON-NLS-1$
+ iconsBundle = null;
+ }
+ }
+
+
+ protected void initializeImageRegistry()
+ {
+ try {
+ mImageRegistry = new ImageRegistry();
+
+ mImageRegistry.put(IMG_WEB_SERVICE, getImageResource(iconsBundle
+ .getString("IMG_WEB_SERVICE"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_WEB_SERVICE_GROUP, getImageResource(iconsBundle
+ .getString("IMG_WEB_SERVICE_GROUP"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_SEI, getImageResource(iconsBundle
+ .getString("IMG_SEI"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_SEI_GROUP, getImageResource(iconsBundle
+ .getString("IMG_SEI_GROUP"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_DOM_WS_PROVIDER, getImageResource(iconsBundle
+ .getString("IMG_DOM_WS_PROVIDER"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_WEB_METHOD, getImageResource(iconsBundle
+ .getString("IMG_WEB_METHOD"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_WEB_PARAM_IN, getImageResource(iconsBundle
+ .getString("IMG_WEB_PARAM_IN"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_WEB_PARAM_OUT, getImageResource(iconsBundle
+ .getString("IMG_WEB_PARAM_OUT"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_ERROR_MARKER, getImageResource(iconsBundle
+ .getString("IMG_ERROR_MARKER"))); //$NON-NLS-1$
+ mImageRegistry.put(IMG_WARNING_MARKER, getImageResource(iconsBundle
+ .getString("IMG_WARNING_MARKER"))); //$NON-NLS-1$
+
+ } catch (RuntimeException e) {
+ (new Logger()).logError("Unable to initialize image registry !", e); //$NON-NLS-1$
+ }
+ }
+
+ public ImageRegistry getImageRegistry()
+ {
+ if (mImageRegistry == null) {
+ initializeImageRegistry();
+ }
+
+ return mImageRegistry;
+ }
+
+ public Image getImage(String imageName)
+ {
+ return INSTANCE.getImageRegistry().get(imageName);
+ }
+
+ public static ImageDescriptor getImageResourceByKey(String resourceName) {
+ return getImageResource(iconsBundle.getString(resourceName));
+ }
+
+ public static ImageDescriptor getImageResource(String resourceName)
+ {
+ try {
+ URL url = DomUi.getDefault().getBundle().getResource(resourceName);
+ return ImageDescriptor.createFromURL(url);
+ }
+ catch (NullPointerException npe) {
+ (new Logger()).logError(MessageFormat.format("Unable to locate resource {0}!",resourceName), npe); //$NON-NLS-1$
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMItemPropertyProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMItemPropertyProvider.java
new file mode 100755
index 0000000..66b3210
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMItemPropertyProvider.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.internal.impl;
+
+import java.beans.PropertyDescriptor;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.PropertyDefaultsAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+
+/**
+ * Extends {@link PropertyDescriptor} to represent property descriptor for DOM objects.
+ * This class overrides createPropertyValueWrapper form {@link PropertyDescriptor} to provide
+ * custom property wrapper class.
+ *
+ * @author Georgi Vachkov
+ */
+public class DOMItemPropertyProvider extends ItemPropertyDescriptor
+{
+ public DOMItemPropertyProvider(AdapterFactory adapterFactory,
+ ResourceLocator resourceLocator,
+ String displayName,
+ String description,
+ EStructuralFeature feature,
+ boolean isSettable,
+ boolean multiLine,
+ boolean sortChoices,
+ Object staticImage,
+ String category,
+ String[] filterFlags)
+ {
+ super(adapterFactory, resourceLocator, displayName, description, feature,
+ isSettable, multiLine, sortChoices, staticImage, category, filterFlags);
+ }
+
+ @Override
+ protected Object createPropertyValueWrapper(Object object, Object propertyValue)
+ {
+ return new DOMPropertyValue(adapterFactory, object, propertyValue, null);
+ }
+
+ @Override
+ public boolean canSetProperty(Object object)
+ {
+ final IPropertyState state = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(object, IPropertyState.class);
+ if (state != null) {
+ super.isSettable = state.isChangeable(feature);
+ }
+
+ return super.canSetProperty(object);
+ }
+
+ @Override
+ public void resetPropertyValue(Object object)
+ {
+ final IPropertyDefaults defaults = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(object, IPropertyDefaults.class);
+ if (defaults != null) {
+ final Object defaultValue = defaults.getDefault(feature);
+ ((EObject)object).eSet(feature, defaultValue);
+ }
+ else {
+ super.resetPropertyValue(object);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMPropertyValue.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMPropertyValue.java
new file mode 100755
index 0000000..e4c521c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/impl/DOMPropertyValue.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.internal.impl;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.ws.jaxws.dom.ui.IDOMPropertyValue;
+
+/**
+ * Implementor of {@link IDOMPropertyValue}.
+ *
+ * @author Georgi Vachkov
+ */
+public class DOMPropertyValue extends ItemPropertyDescriptor.PropertyValueWrapper implements IDOMPropertyValue
+{
+ public DOMPropertyValue(AdapterFactory adapterFactory, Object object, Object propertyValue, Object nestedPropertySourc)
+ {
+ super(adapterFactory, object, propertyValue, nestedPropertySourc);
+ }
+
+ public Object getEditableValue() {
+ return getEditableValue(null);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/DomUi.java b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/DomUi.java
new file mode 100755
index 0000000..29a5752
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/DomUi.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.internal.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the Dom edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class DomUi extends EMFPlugin
+{
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final DomUi INSTANCE = new DomUi();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DomUi()
+ {
+ super
+ (new ResourceLocator []
+ {
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator()
+ {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin()
+ {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin
+ {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation()
+ {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Plugin getDefault()
+ {
+ return plugin;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/WSImageBundle.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/WSImageBundle.properties
new file mode 100755
index 0000000..b4aaf02
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.ui/src/org/eclipse/jst/ws/jaxws/dom/ui/internal/plugin/WSImageBundle.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+IMG_WEB_SERVICE=icons/Web_Service.gif
+IMG_WEB_SERVICE_GROUP=icons/Web_Service_Group.gif
+IMG_SEI=icons/SEI.gif
+IMG_SEI_GROUP=icons/SEI_Group.gif
+IMG_DOM_WS_PROVIDER=icons/Web_Service_Item_Provider.gif
+IMG_WEB_METHOD=icons/Web_Method.gif
+IMG_WEB_PARAM_IN=icons/Web_Param_In.gif
+IMG_WEB_PARAM_OUT=icons/Web_Param_Out.gif
+IMG_ERROR_MARKER=icons/error_obj.gif
+IMG_WARNING_MARKER=icons/warning_obj.gif
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/.classpath b/bundles/org.eclipse.jst.ws.jaxws.utils/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/.project b/bundles/org.eclipse.jst.ws.jaxws.utils/.project
new file mode 100755
index 0000000..ca99091
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.utils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.jaxws.utils/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.utils/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..d77c2e1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: UtilsPlugin (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.utils;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.core.resources,
+ org.eclipse.text,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.wst.common.project.facet.core,
+ org.apache.axis
+Export-Package: org.eclipse.jst.ws.jaxws.utils,
+ org.eclipse.jst.ws.jaxws.utils.annotations,
+ org.eclipse.jst.ws.jaxws.utils.clazz,
+ org.eclipse.jst.ws.jaxws.utils.dom.validation,
+ org.eclipse.jst.ws.jaxws.utils.exception,
+ org.eclipse.jst.ws.jaxws.utils.facets,
+ org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl,
+ org.eclipse.jst.ws.jaxws.utils.internal.text;x-friends:="org.eclipse.jst.ws.jaxws.dom.integration.tests",
+ org.eclipse.jst.ws.jaxws.utils.logging,
+ org.eclipse.jst.ws.jaxws.utils.resources
+Bundle-Activator: org.eclipse.jst.ws.jaxws.utils.internal.plugin.JaxwsUtilsPlugin
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/about.html b/bundles/org.eclipse.jst.ws.jaxws.utils/about.html
new file mode 100644
index 0000000..8410afb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 15, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/build.properties b/bundles/org.eclipse.jst.ws.jaxws.utils/build.properties
new file mode 100755
index 0000000..61726b0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/plugin.xml b/bundles/org.eclipse.jst.ws.jaxws.utils/plugin.xml
new file mode 100755
index 0000000..0029309
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ SAP AG - initial API and implementation
+ -->
+
+<plugin>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup></startup>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/ContractChecker.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/ContractChecker.java
new file mode 100755
index 0000000..7f13b8e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/ContractChecker.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils;
+
+import java.text.MessageFormat;
+
+/**
+ * Contains checks frequently applied on parameters.
+ *
+ * @author Joerg Dehmel
+ */
+public final class ContractChecker
+{
+ private ContractChecker()
+ {
+ // prevent instantiation from outside
+ }
+
+ /** Checks if the given parameter value is null and reports an <code>NullPointerException</code>
+ * in this case.
+ * @param paramValue the value to be checked
+ * @param paramName name of the parameter, used to report the problem to the user
+ * @throws NullPointerException thrown either the paramValue or paramName is null */
+ public static void nullCheckParam(final Object paramValue, final String paramName)
+ {
+ if (paramName == null)
+ {
+ throw new NullPointerException("paramName must not be null"); //$NON-NLS-1$
+ }
+ if (paramValue == null)
+ {
+ throw new NullPointerException(paramName + " must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /** Checks whether the given parameter value is null and reports an <code>NullPointerException</code>
+ * in this case.
+ * @param paramValue the value to be checked
+ * @throws NullPointerException thrown if the paramValue is null */
+ public static void nullCheckParam(final Object paramValue)
+ {
+ if (paramValue == null)
+ {
+ throw new NullPointerException("paramValue must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /** Checks if the given field value is null and reports an <code>IllegalStateException</code>
+ * in this case.
+ * @param fieldValue the value to be checked
+ * @param fieldName name of the field, used to report the problem to the user
+ * @throws NullPointerException thrown if the fieldName is null
+ * @throws IllegalStateException thrown if the fieldValue is null */
+ public static void nullCheckField(final Object fieldValue, final String fieldName)
+ {
+ if (fieldName == null)
+ {
+ throw new NullPointerException("fieldName must not be null"); //$NON-NLS-1$
+ }
+ if (fieldValue == null)
+ {
+ throw new IllegalStateException(fieldName + " must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /** Checks whether the given field value is null and reports an <code>IllegalStateException</code>
+ * in this case.
+ * @param fieldValue the value to be checked
+ * @throws IllegalStateException thrown if the fieldValue is null */
+ public static void nullCheckField(final Object fieldValue)
+ {
+ if (fieldValue == null)
+ {
+ throw new IllegalStateException("fieldValue must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /** Checks whether the given value of a local variable is null and reports an <code>IllegalStateException</code>
+ * in this case.
+ * @param varValue the value to be checked
+ * @param varName name of the local variable, used to report the problem to the user
+ * @throws NullPointerException thrown if the varName is null
+ * @throws IllegalStateException thrown if the varValue is null */
+ public static void nullCheckVariable(final Object varValue, final String varName)
+ {
+ if (varName == null)
+ {
+ throw new NullPointerException("varName must not be null"); //$NON-NLS-1$
+ }
+ if (varValue == null)
+ {
+ throw new IllegalStateException(varName + " must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /** Checks whether the given value of a local variable is null and reports an <code>IllegalStateException</code>
+ * in this case.
+ * @param varValue the value to be checked
+ * @throws IllegalStateException thrown if the varValue is null */
+ public static void nullCheckVariable(final Object varValue)
+ {
+ if (varValue == null)
+ {
+ throw new IllegalStateException("varValue must not be null"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * This method checks if <code>param</code> is <code>null</code> or empty string.
+ * @param param
+ * @param varName
+ * @throws NullPointerException in case <code>param</code> is <code>null</code>
+ * @throws IllegalArgumentException in case <code>param</code> is empty string or contains only
+ * white space characters
+ */
+ public static void emptyStringCheckParam(final String param, final String varName)
+ {
+ nullCheckParam(param, varName);
+
+ if (param.trim().length() == 0) {
+ throw new IllegalArgumentException(MessageFormat.format("Parameter {0} is empty string or contains only white spaces", varName)); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/JaxWsUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/JaxWsUtils.java
new file mode 100755
index 0000000..5edde7e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/JaxWsUtils.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils;
+
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Utility that contains JAX-WS releated functionality
+ *
+ * @author Danail Branekov
+ *
+ */
+public class JaxWsUtils
+{
+ private static final String BEAN_SUFFIX = "Bean"; //$NON-NLS-1$
+ private static final String PORT_SUFFIX = "Port"; //$NON-NLS-1$
+ private static final String SERVICE_SUFFIX = "Service"; //$NON-NLS-1$
+
+ private JaxWsUtils()
+ {
+ // hide default constructor
+ }
+
+ /**
+ * An utility method for composing a default target namespace for JaxWs customization
+ * out of a package name.
+ * Algorithm:
+ * <li>In case the package has 0 fragment (default package) the result would be http:///</li>
+ * <li>In case the package has 1 fragment the result would be http://fragment1/</li>
+ * <li>In case the package has 2 fragments the result would be http://fragment2.fragment1/</li>
+ * <li>In case the package has more than 2 fragments the result would be http://fragment2.fragment1/fragment3/fragment4/.../fragmentn/</li>
+ * @param packageName Name of the package
+ * @return the composed namespace
+ * @thorws NullPointerException when package name specified is null
+ */
+ public static String composeJaxWsTargetNamespaceByPackage(String packageName)
+ {
+ if(packageName == null)
+ {
+ throw new NullPointerException("Package name cannot be null"); //$NON-NLS-1$
+ }
+
+ String[] pkgFragments = packageName.split("\\."); //$NON-NLS-1$
+
+ if(pkgFragments.length > 1)
+ {
+ // reverse the first two fragments in case there are at least two fragments available
+ String frag0 = pkgFragments[0];
+ pkgFragments[0] = pkgFragments[1];
+ pkgFragments[1] = frag0;
+ }
+
+ StringBuilder result = new StringBuilder("http://"); //$NON-NLS-1$
+ for (int i = 0; i < pkgFragments.length; i++)
+ {
+ result.append(pkgFragments[i]);
+ result.append(i==0 && pkgFragments.length>1 ? "." : "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Same as composeJaxWsTargetNamespaceByPackage() but first extracts the package out of class
+ * fully qualified name
+ * @param fqName the class fully qualified name
+ * @return calculated target namespace
+ */
+ public static String composeJaxWsTargetNamespaceByFQName(String fqName)
+ {
+ ContractChecker.nullCheckParam(fqName, "fqName"); //$NON-NLS-1$
+ return composeJaxWsTargetNamespaceByPackage(extractPackage(fqName));
+ }
+
+ /**
+ * Returns the PortType name from the <code>endpointType</code> and <code>seiName</code>.
+ * @param endpoint class.
+ * @param seiName
+ * @return PortType name for the @WebService annotation, the name of the <code>endpointType</code> with the "Port" suffix.
+ * @throws NullPointerException when <code>endpointType</code> specified is null.
+ */
+ public static String getPorttypeName(IType endpointType, String seiName)
+ {
+ if(endpointType == null)
+ {
+ throw new NullPointerException("endpointType could not be null!"); //$NON-NLS-1$
+ }
+
+ if(seiName != null && seiName.length() > 0)
+ {
+ return seiName;
+ }
+
+ return removeBeanSuffixIfRequired(endpointType.getElementName());
+ }
+
+ /**
+ * Removes the "Bean" suffix from the <code>endpointType</code> in case it is present and generates Service name for the specified IType.
+ * @param endpoint class.
+ * @return Service name for the @WebService annotation, the name of the <code>endpointType</code> without the "Bean" suffix and <code>"Service"</code> at the end.
+ * In case the name of the <code>endpointType</code> equals "Bean" then the original name is returned with <code>"Service"</code> ate the end.
+ * @throws NullPointerException when <code>endpointType</code> specified is null
+ */
+ public static String getServiceName(final IType endpointType)
+ {
+ if(endpointType == null)
+ {
+ throw new NullPointerException("endpointType could not be null!"); //$NON-NLS-1$
+ }
+
+ return removeBeanSuffixIfRequired(endpointType.getElementName()) + SERVICE_SUFFIX;
+ }
+
+ /**
+ * Removes the "Bean" suffix from the endpoint name in case it is present.
+ * @param endpointName the name of the endpoint
+ * @return the name of the endpoint without the "Bean" suffix. In case the name of the endpoint equals "Bean" then the original name is returned
+ */
+ private static String removeBeanSuffixIfRequired(final String endpointName)
+ {
+ assert endpointName != null && endpointName.length() > 0;
+
+ if(endpointName.equals(BEAN_SUFFIX))
+ {
+ return endpointName;
+ }
+
+ if(endpointName.endsWith(BEAN_SUFFIX))
+ {
+ return endpointName.substring(0, endpointName.lastIndexOf(BEAN_SUFFIX));
+ }
+
+ return endpointName;
+ }
+
+ /**
+ * Returns the Port name from the <code>endpointType</code>.
+ * @param endpoint class.
+ * @return Port name for the @WebService annotation, the name of the <code>endpointType</code> with the "Port" suffix.
+ * @throws NullPointerException when <code>endpointType</code> specified is null.
+ */
+ public static String getPortName(final IType endpointType)
+ {
+ return getDefaultPortName(endpointType.getElementName());
+ }
+
+ /**
+ * Returns the default service name calculated as the specification states.
+ * @param fqName
+ * @return the default service name
+ * @throws NullPointerException in case <code>endpointType</code> is <code>null</code>
+ */
+ public static String getDefaultServiceName(final String fqName)
+ {
+ if(fqName == null)
+ {
+ throw new NullPointerException("endpointType could not be null!"); //$NON-NLS-1$
+ }
+
+ return extractShortName(fqName) + SERVICE_SUFFIX;
+ }
+
+ /**
+ * Returns the default wsdl:portType name defined as JAX-WS specification states.
+ * @param fqName
+ * @return
+ */
+ public static String getDefaultPorttypeName(final String fqName)
+ {
+ if(fqName == null)
+ {
+ throw new NullPointerException("fqName could not be null!"); //$NON-NLS-1$
+ }
+
+ return extractShortName(fqName);
+ }
+
+ /**
+ * Return the default name for a wsdl:port defined as JAX-WS specification states
+ * @param fqName
+ * @return the calculated name
+ */
+ public static String getDefaultPortName(final String fqName)
+ {
+ if(fqName == null)
+ {
+ throw new NullPointerException("fqName could not be null!"); //$NON-NLS-1$
+ }
+
+ return extractShortName(fqName) + PORT_SUFFIX;
+ }
+
+ private static String extractShortName(String fqName)
+ {
+ int pos = fqName.lastIndexOf('.');
+ if (pos ==-1 ) {
+ return fqName;
+ }
+
+ return fqName.substring(pos+1);
+ }
+
+ private static String extractPackage(final String fqName)
+ {
+ int pos = fqName.lastIndexOf('.');
+ if (pos ==-1 ) {
+ return fqName;
+ }
+
+ return fqName.substring(0, pos);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/StatusUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/StatusUtils.java
new file mode 100755
index 0000000..53779a6
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/StatusUtils.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+
+
+/**
+ * Convenience methods to manage status objects.
+ *
+ * @author Joerg Dehmel
+ */
+public final class StatusUtils
+{
+ private StatusUtils()
+ {
+ // no instantiation
+ }
+
+ /**
+ * Finds the most severe status from a array of stati.
+ * An error is more severe than a warning, and a warning is more severe
+ * than ok.
+ */
+ public static IStatus getMostSevere(IStatus[] status) {
+ IStatus max= null;
+ for (int i= 0; i < status.length; i++) {
+ IStatus curr= status[i];
+ if (curr.matches(IStatus.ERROR)) {
+ return curr;
+ }
+ if (max == null || curr.getSeverity() > max.getSeverity()) {
+ max= curr;
+ }
+ }
+ return max;
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.CANCEL.
+ *
+ * @param message
+ * status message
+ * @return the cancel status
+ */
+ public static IStatus statusCancel(final String message)
+ {
+ return createStatus(IStatus.CANCEL, message);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.ERROR.
+ *
+ * @param message
+ * status message
+ * @return the error status
+ */
+ public static IStatus statusError(final String message)
+ {
+ return createStatus(IStatus.ERROR, message);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.ERROR.
+ *
+ * @param message
+ * status message
+ * @param ex
+ * exception that corresponds to the status
+ * @return the error status
+ */
+ public static IStatus statusError(final String message, final Throwable ex)
+ {
+ return createStatus(IStatus.ERROR, message, ex);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.WARNING.
+ *
+ * @param message
+ * status message
+ * @return the warning status
+ */
+ public static IStatus statusWarning(final String message)
+ {
+ return createStatus(IStatus.WARNING, message);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.WARNING.
+ *
+ * @param message
+ * status message
+ * @param ex
+ * exception that corresponds to the status
+ * @return the warning status
+ */
+ public static IStatus statusWarning(final String message, final Throwable ex)
+ {
+ return createStatus(IStatus.WARNING, message, ex);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.INFO.
+ *
+ * @param message
+ * status message
+ * @return the info status
+ */
+ public static IStatus statusInfo(final String message)
+ {
+ return createStatus(IStatus.INFO, message);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.INFO.
+ *
+ * @param message
+ * status message
+ * @return the info status
+ */
+ public static IStatus statusInfo(final String message, final Throwable cause)
+ {
+ return createStatus(IStatus.INFO, message, cause);
+ }
+
+ /**
+ * Provides a new status object with severity IStatus.OK.
+ *
+ * @param message
+ * status message
+ * @return the ok status
+ */
+ public static IStatus statusOk(final String message)
+ {
+ return createStatus(IStatus.OK, message);
+ }
+
+ private static IStatus createStatus(final int severity, final String message)
+ {
+ return new Status(severity, "id", 0, message, null); //$NON-NLS-1$
+ }
+
+ private static IStatus createStatus(final int severity, final String message, final Throwable ex)
+ {
+ return new Status(severity, "id", 0, message, ex); //$NON-NLS-1$
+ }
+
+ /**
+ * Provides a new multistatus object
+ *
+ * @param message
+ * status message
+ * @return multistatus
+ */
+ public static MultiStatus createMultiStatus(String message)
+ {
+ return new MultiStatus("id", 0, message, null); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/WsdlNamesValidator.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/WsdlNamesValidator.java
new file mode 100755
index 0000000..97dd3fc
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/WsdlNamesValidator.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils;
+
+import java.text.MessageFormat;
+
+import org.apache.axis.types.NCName;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+
+
+/**
+ * Class that contains utility methods to validate names used in WSDL.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsdlNamesValidator
+{
+ /**
+ * Provides validation of NCName
+ * @param title the title for the error message
+ * @param name the checked name
+ * @return error status in case the name is invalid otherwise {@link Status#OK_STATUS}.
+ */
+ public static IStatus validateNCName(final String title, final String name)
+ {
+ if (name.trim().length() == 0) {
+ return StatusUtils.statusError(MessageFormat.format(JaxWsUtilMessages.WsdlNamesValidator_EmptyXmlName, title));
+ }
+
+ int errPos = checkNCName(name);
+ if (errPos > -1) {
+ return StatusUtils.statusError(MessageFormat.format(JaxWsUtilMessages.WsdlNamesValidator_InvalidNCName, name.charAt(errPos), title, name));
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Validates <code>name</code> for NCName
+ * @param name
+ * @return -1 if the name is valid or > -1 which is the position of the wrong character.
+ */
+ public static IStatus validateNCName2(final String title, final String name)
+ {
+ if (name==null || name.trim().length() == 0) {
+ return StatusUtils.statusError(MessageFormat.format(JaxWsUtilMessages.WsdlNamesValidator_EmptyXmlName2, title));
+ }
+
+ int errPos = checkNCName(name);
+ if (errPos > -1) {
+ return StatusUtils.statusError(MessageFormat.format(JaxWsUtilMessages.WsdlNamesValidator_InvalidNCName2, name.charAt(errPos), title));
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Checks whether the name specified is a valid NCName
+ * @param name the name to check
+ * @return index of the first symbol which violates the NCName rules or -1 in case the name is a valid NCName
+ * @see NCName#isValid(String)
+ */
+ private static int checkNCName(final String name)
+ {
+ final StringBuilder builder = new StringBuilder();
+ for(int i = 0; i < name.length(); i++)
+ {
+ builder.append(name.charAt(i));
+ if(!NCName.isValid(builder.toString()))
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationFactory.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationFactory.java
new file mode 100755
index 0000000..af2fd38
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationFactory.java
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import java.io.FileNotFoundException;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationInspectorImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ArrayValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.BooleanValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ClassValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.IntegerValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ParamValuePairImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.QualifiedNameValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.text.edits.MalformedTreeException;
+
+
+/**
+ * Factory class containing common factory and utility methods Annotation processing.
+ *
+ * @author Plamen Pavlov
+ */
+public class AnnotationFactory
+{
+ /**
+ * Creates complex Annotation, e.g. Annotation of kind \@WebService(param1="value1", param2="value2").
+ *
+ * @param annotationQName
+ * @param paramValuePairs
+ *
+ * @return Instantiated Annotation of type IComplexAnnotation.
+ *
+ * @throws NullPointerException in case <tt>annotationQName</tt> or <tt>paramValuePairs</tt> are null.
+ * @throws IllegalArgumentException in case <tt>annotationQName</tt> is empty String.
+ */
+ public static <T extends IJavaElement> IAnnotation<T> createAnnotation(String annotationQName, Set<IParamValuePair> paramValuePairs, final T appliedElement)
+ {
+ if (annotationQName == null)
+ {
+ throw new NullPointerException("annotationQName should not be null!"); //$NON-NLS-1$
+ }
+ if (annotationQName.trim().length() == 0)
+ {
+ throw new IllegalArgumentException("annotationQName should not be empty String!"); //$NON-NLS-1$
+ }
+
+ if (paramValuePairs == null)
+ {
+ throw new NullPointerException("paramValuePairs should not be null!"); //$NON-NLS-1$
+ }
+
+ final AnnotationImpl<T> impl = new AnnotationImpl<T>(annotationQName, paramValuePairs);
+ impl.setJavaElement(appliedElement);
+
+ return impl;
+ }
+
+
+ /**
+ * Creates {@link IAnnotation} instance that references <code>appliedElement</code> java element
+ * @param annotationQName the annotation name
+ * @param appliedElement the java element that this annotation is applied on
+ * @param paramValuePairs the annotation attributes
+ * @return {@link IAnnotation} instance
+ * @throws NullPointerException in case some of params is <code>null</code>
+ * @throws IllegalArgumentException in case <code>annotationQName</code> is empty string
+ */
+ public static IAnnotation<? extends IJavaElement> createAnnotation(String annotationQName, IJavaElement appliedElement, Set<IParamValuePair> paramValuePairs)
+ {
+ nullCheckParam(annotationQName, "annotationQName"); //$NON-NLS-1$
+ if (annotationQName.trim().length() == 0) {
+ throw new IllegalArgumentException("annotationQName should not be empty String!"); //$NON-NLS-1$
+ }
+
+ nullCheckParam(paramValuePairs, "paramValuePairs"); //$NON-NLS-1$
+ nullCheckParam(appliedElement, "appliedElement"); //$NON-NLS-1$
+
+ final AnnotationImpl<IJavaElement> annotation = new AnnotationImpl<IJavaElement>(annotationQName, paramValuePairs);
+ annotation.setAppliedElementWithoutSave(appliedElement);
+
+ return annotation;
+ }
+
+ /**
+ * Creates param-value pair needed in complex Annotations.
+ *
+ * @param param
+ * @param value
+ *
+ * @return instance of IParamValuePair
+ *
+ * @throws NullPointerException in case <code>param</code> or <code>value</code> is <code>null</code>.
+ * @throws IllegalArgumentException in case <code>param</code> parameter is empty String.
+ */
+ public static IParamValuePair createParamValuePairValue(String param, IValue value)
+ {
+ if (param == null)
+ {
+ throw new NullPointerException("param should not be null!"); //$NON-NLS-1$
+ }
+ if (param.trim().length() == 0)
+ {
+ throw new IllegalArgumentException("param should not be empty String!"); //$NON-NLS-1$
+ }
+
+ if (value == null)
+ {
+ throw new NullPointerException("value should not be null!"); //$NON-NLS-1$
+ }
+
+ return new ParamValuePairImpl(param, value);
+ }
+
+ /**
+ * Creates {@link IValue} instance using provided <code>values</code>.
+ *
+ * @param values
+ *
+ * @return instance of {@link IValue}
+ *
+ * @throws NullPointerException in case <code>values</code> is null.
+ * @throws IllegalArgumentException in case <code>values</code> is empty Set.
+ */
+ public static IValue createArrayValue(Set<IValue> values)
+ {
+ if (values == null)
+ {
+ throw new NullPointerException("values should not be null!"); //$NON-NLS-1$
+ }
+ if (values.size() < 1)
+ {
+ throw new IllegalArgumentException("values should not be empty Set!"); //$NON-NLS-1$
+ }
+
+ return new ArrayValueImpl(values);
+ }
+
+ /**
+ * Creates {@link IValue} instance out of <code>value</code>.
+ *
+ * @param value
+ *
+ * @return instance of {@link IValue}
+ */
+ public static IValue createBooleanValue(boolean value)
+ {
+ return new BooleanValueImpl(value);
+ }
+
+ /**
+ * Creates {@link IValue} instance out of <code>value</code>.
+ *
+ * @param value
+ *
+ * @return instance of {@link String}
+ */
+ public static IValue createClassValue(String value)
+ {
+ if (value == null)
+ {
+ throw new NullPointerException("value should not be null!"); //$NON-NLS-1$
+ }
+ if(value.equals("")) //$NON-NLS-1$
+ {
+ throw new IllegalArgumentException("value should not be empty String"); //$NON-NLS-1$
+ }
+
+ return new ClassValueImpl(value);
+ }
+
+ /**
+ * Creates {@link IValue} instance out of <code>value</code>.
+ *
+ * @param value
+ *
+ * @return instance of {@link IValue}
+ */
+ public static IValue createIntegerValue(String value)
+ {
+ return new IntegerValueImpl(value);
+ }
+
+ /**
+ * Creates {@link IValue} instance using provided <code>qualifiedName</code> fully qualified name.
+ *
+ * @param qualifiedName
+ *
+ * @return instance of {@link IValue}
+ *
+ * @throws NullPointerException in case <tt>qualifiedName</tt> is null.
+ * @throws IllegalArgumentException in case <code>qualifiedName</code> is not in correct form e.g. could not be empty String, shold be qualified.
+ */
+ public static IValue createQualifiedNameValue(String qualifiedName)
+ {
+ if (qualifiedName == null)
+ {
+ throw new NullPointerException("qualifiedName should not be null!"); //$NON-NLS-1$
+ }
+
+ if (qualifiedName.trim().length() == 0 || qualifiedName.indexOf('.') == -1)
+ {
+ throw new IllegalArgumentException("qualifiedName is not in correct form!"); //$NON-NLS-1$
+ }
+
+ return new QualifiedNameValueImpl(qualifiedName);
+ }
+
+ /**
+ * Creates {@link IValue} instance out of <code>value</code> content.
+ *
+ * @param value
+ *
+ * @return instance of {@link IValue}
+ * @throws NullPointerException in case <tt>value</tt> is null.
+ */
+ public static IValue createStringValue(String value)
+ {
+ if (value == null)
+ {
+ throw new NullPointerException("value should not be null!"); //$NON-NLS-1$
+ }
+
+ return new StringValueImpl(value);
+ }
+
+
+// /**
+// * Retrieves all Annotations from class.
+// *
+// * @param javaElement
+// *
+// * @return contained annotations in <code>javaElement</code>
+// *
+// * @throws JavaModelException if exception occurs
+// * @throws NullPointerException if <tt>javaElement</tt> is null.
+// * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: Itype, IMethod, IField, ITypeParameter
+// */
+// public static Set<IAnnotation> getAnnotationsFromJavaElement(IJavaElement javaElement) throws JavaModelException
+// {
+// if (javaElement == null)
+// {
+// throw new NullPointerException("javaElement should not be null!");
+// }
+// if(!(javaElement instanceof IType) || !(javaElement instanceof IMethod) || !(javaElement instanceof IField) || !(javaElement instanceof ITypeParameter))
+// {
+// throw new IllegalArgumentException("javaElement is not of correct type!");
+// }
+// pppppp
+// }
+
+ /**
+ * Removes all Annotations from <code>javaElement</code>.
+ *
+ * @param javaElement
+ *
+ * @throws NullPointerException if <tt>javaElement</tt> is null.
+ * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: Itype, IMethod, IField, ITypeParameter
+ * @throws AnnotationGeneratorException
+ */
+ public static void removeAnnotationsFromJavaElement(IJavaElement javaElement) throws AnnotationGeneratorException
+ {
+ if (javaElement == null)
+ {
+ throw new NullPointerException("javaElement should not be null!"); //$NON-NLS-1$
+ }
+ if(!(javaElement instanceof IType) && !(javaElement instanceof org.eclipse.jdt.core.IMethod) && !(javaElement instanceof IField) && !(javaElement instanceof ITypeParameter))
+ {
+ throw new IllegalArgumentException("javaElement is not of correct type!"); //$NON-NLS-1$
+ }
+ removeAnnotations(javaElement, null);
+ }
+
+ /**
+ * Removes Annotations with names contained in <code>annotations</code> from <code>javaElement</code> and its children, if such exist.
+ *
+ * @param javaElement
+ * @param annotations
+ *
+ * @throws NullPointerException if <tt>javaElement</tt> or <tt>annotations</tt> is null.
+ * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: Itype, IMethod, IField, ITypeParameter
+ * @throws AnnotationGeneratorException
+ */
+ public static void removeAnnotations(IJavaElement javaElement, Set<String> annotations) throws AnnotationGeneratorException
+ {
+ if (javaElement == null)
+ {
+ throw new NullPointerException("javaElement should not be null!"); //$NON-NLS-1$
+ }
+ if(!(javaElement instanceof IType) && !(javaElement instanceof org.eclipse.jdt.core.IMethod) && !(javaElement instanceof IField) && !(javaElement instanceof ITypeParameter))
+ {
+ throw new IllegalArgumentException("javaElement is not of correct type!"); //$NON-NLS-1$
+ }
+
+ try
+ {
+ AnnotationUtils.getInstance().removeAnnotations(javaElement, annotations, true);
+ }
+ catch (JavaModelException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), e.getStatus().getMessage(), e);
+ }
+ catch (MalformedTreeException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.InvalidTreeStateMsg, e);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CompUnitMissingMsg, e);
+ }
+ catch (CoreException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), e.getStatus().getMessage(), e);
+ }
+ catch (BadLocationException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CannotPerformEditMsg, e);
+ }
+ }
+
+ /**
+ * Create instance of IAnnotationInspector for a specific IType.
+ *
+ * @param type - IType, which will be inspected.
+ *
+ * @return IAnnotationInspector
+ */
+ public static IAnnotationInspector createAnnotationInspector(IType type)
+ {
+ return new AnnotationInspectorImpl(type);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationGeneratorException.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationGeneratorException.java
new file mode 100755
index 0000000..8558a94
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationGeneratorException.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import org.eclipse.jst.ws.jaxws.utils.exception.LocalizedException;
+
+/**
+ * Exception thrown by annotation generator in case when unexpected condition is met
+ *
+ * @author Plamen Pavlov
+ */
+
+public class AnnotationGeneratorException extends LocalizedException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor getting error message, localized message and {@link Throwable} to be wrapped
+ *
+ * @param message
+ * @param localizedMessage
+ * @param t
+ */
+ public AnnotationGeneratorException(final String message, final String localizedMessage, final Throwable t)
+ {
+ super(message, localizedMessage, t);
+ }
+
+ /**
+ * Constructor with error message and a localized message.
+ *
+ * @param message
+ * @param localizedMessage
+ */
+ public AnnotationGeneratorException(final String message, final String localizedMessage)
+ {
+ super(message, localizedMessage);
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationWriter.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationWriter.java
new file mode 100755
index 0000000..3f0732b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/AnnotationWriter.java
@@ -0,0 +1,600 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import java.io.FileNotFoundException;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.IExtendedModifier;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jst.ws.jaxws.utils.clazz.ASTUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.jst.ws.jaxws.utils.resources.EditResourcesManager;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+import org.eclipse.jst.ws.jaxws.utils.resources.IFileUtils;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Class, which is used to save the annotations.
+ *
+ * @author Plamen Pavlov
+ *
+ */
+public class AnnotationWriter
+{
+ private static AnnotationWriter writer = null;
+ private final IFileUtils fileUtils = FileUtils.getInstance();
+
+ /**
+ * The factory method.
+ *
+ * @return a AnnotationWriter instance.
+ */
+ public static<T extends IJavaElement> AnnotationWriter getInstance()
+ {
+ if (writer == null)
+ {
+ writer = new AnnotationWriter();
+ }
+ return writer;
+ }
+
+ /**
+ * Adds Annotation to specific IJavaElement.
+ *
+ * @param javaElement
+ *
+ * @throws NullPointerException if <tt>javaElement</tt> is null.
+ * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: IType, IMethod, IField, ITypeParameter.
+ * @throws AnnotationGeneratorException.
+ */
+ public <T extends IJavaElement> void setAppliedElement(final IAnnotation<T> annotation, final T javaElement) throws AnnotationGeneratorException
+ {
+ AnnotationImpl<T> annotationImpl = (AnnotationImpl<T>)annotation;
+ annotationImpl.setJavaElement(javaElement);
+
+ setAnnotatationStringVallue(annotationImpl, true, javaElement);
+ }
+
+ private <T extends IJavaElement> void setAnnotatationStringVallue(AnnotationImpl<T> annotationImpl, boolean needSave, final T javaElement) throws AnnotationGeneratorException
+ {
+ if (!needSave) {
+ return;
+ }
+
+ if(javaElement instanceof IType)
+ {
+ addToClass(annotationImpl, (IType)javaElement);
+ }
+ if(javaElement instanceof IField)
+ {
+ addToField(annotationImpl, (IField)javaElement);
+ }
+ if(javaElement instanceof IMethod)
+ {
+ addToMethod(annotationImpl, (IMethod)javaElement);
+ }
+ if(javaElement instanceof ITypeParameter)
+ {
+ addToParam(annotationImpl, (ITypeParameter)javaElement);
+ }
+ }
+
+ private <T extends IJavaElement> void addToClass(AnnotationImpl<T> annotationImpl, IType classType) throws AnnotationGeneratorException
+ {
+ String className = classType.getElementName();
+
+ addToMember(annotationImpl, classType.getCompilationUnit(), classType, className);
+ }
+
+ private <T extends IJavaElement> void addToField(AnnotationImpl<T> annotationImpl, IField fieldType) throws AnnotationGeneratorException
+ {
+ String className = fieldType.getParent().getElementName();
+
+ addToMember(annotationImpl, fieldType.getCompilationUnit(), fieldType, className);
+ }
+
+ private <T extends IJavaElement> void addToMethod(AnnotationImpl<T> annotationImpl, IMethod methodType) throws AnnotationGeneratorException
+ {
+ String className = methodType.getParent().getElementName();
+
+ addToMember(annotationImpl, methodType.getCompilationUnit(), methodType, className);
+ }
+
+ private <T extends IJavaElement> void addToParam(AnnotationImpl<T> annotationImpl, ITypeParameter typeParam) throws AnnotationGeneratorException
+ {
+ IMember member = typeParam.getDeclaringMember();
+ String className = null;
+ if (member.getElementType() == IJavaElement.METHOD)
+ {
+ className = member.getDeclaringType().getElementName();
+ } else
+ {
+ className = member.getElementName();
+ }
+
+ addToMember(annotationImpl, member.getCompilationUnit(), typeParam, className);
+ }
+
+ private <T extends IJavaElement> void addToMember(AnnotationImpl<T> annotationImpl, ICompilationUnit cUnit, IJavaElement type, String className) throws AnnotationGeneratorException
+ {
+ try
+ {
+ if (cUnit == null)
+ {
+ return;
+ }
+
+ CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(cUnit, null);
+ AST ast = unit.getAST();
+
+ TypeDeclaration typeDeclaration = (TypeDeclaration)ASTUtils.getInstance().getTypeDeclaration(className, unit);
+ if (typeDeclaration != null)
+ {
+ switch (type.getElementType())
+ {
+ case IJavaElement.TYPE:
+ addAnnotation(annotationImpl, cUnit, unit, ast, typeDeclaration);
+ break;
+ case IJavaElement.METHOD:
+ MethodDeclaration methodDeclaration = ASTUtils.getInstance().getMethodDeclaration((IMethod) type, typeDeclaration);
+ addAnnotation(annotationImpl, cUnit, unit, ast, methodDeclaration);
+ break;
+ case IJavaElement.FIELD:
+ FieldDeclaration fieldDeclaration = ASTUtils.getInstance().getFieldDeclaration((IField) type, typeDeclaration);
+ addAnnotation(annotationImpl, cUnit, unit, ast, fieldDeclaration);
+ break;
+ case IJavaElement.TYPE_PARAMETER:
+ ITypeParameter typeParameter = (ITypeParameter) type;
+ if (typeParameter.getDeclaringMember().getElementType() == IJavaElement.METHOD)
+ {
+ methodDeclaration = ASTUtils.getInstance().getMethodDeclaration((IMethod) typeParameter.getDeclaringMember(), typeDeclaration);
+ SingleVariableDeclaration paramDeclaration = getParamDeclaration(typeParameter, methodDeclaration);
+ addAnnotation(annotationImpl, cUnit, unit, ast, paramDeclaration);
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("unsupported type for annotation"); //$NON-NLS-1$
+ }
+ }
+ }
+ catch (MalformedTreeException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.InvalidTreeStateMsg, e);
+ }
+ catch (CoreException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), e.getStatus().getMessage(), e);
+ }
+ catch (BadLocationException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CannotPerformEditMsg, e);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CompUnitMissingMsg, e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> void addAnnotation(AnnotationImpl<T> annotationImpl, ICompilationUnit cUnit, CompilationUnit unit, AST ast, ASTNode declaration)
+ throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ editResManager().setFileEditable((IFile) cUnit.getResource());
+
+ unit.recordModifications();
+ Expression annot = annotationImpl.getExpression(unit, ast);
+
+ List modifiers = null;
+
+ switch (declaration.getNodeType())
+ {
+ case ASTNode.METHOD_DECLARATION:
+ case ASTNode.FIELD_DECLARATION:
+ case ASTNode.TYPE_DECLARATION:
+ modifiers = ((BodyDeclaration) declaration).modifiers();
+ break;
+ case ASTNode.SINGLE_VARIABLE_DECLARATION:
+ modifiers = ((SingleVariableDeclaration) declaration).modifiers();
+ break;
+ default:
+ throw new IllegalArgumentException("addAnnotation() illegal declataion type"); //$NON-NLS-1$
+ }
+
+ modifiers.add(0, annot);
+
+ IDocument doc = AnnotationUtils.getInstance().getDocument(cUnit);
+
+ TextEdit edit = unit.rewrite(doc, null);
+ edit.apply(doc);
+
+ IStatus status = editResManager().setFileEditable((IFile) cUnit.getResource());
+ if(status.getSeverity() == IStatus.OK)
+ {
+ fileUtils.setCompilationUnitContentAndSaveDirtyEditors(cUnit, doc.get(), true, null);
+ }
+ else
+ {
+ throw new AnnotationGeneratorException("Annotattion could not be stored, the file is not writable", //$NON-NLS-1$
+ JaxWsUtilMessages.AnnotationCannotBeStoredMsg);
+ }
+ }
+
+ private static SingleVariableDeclaration getParamDeclaration(ITypeParameter typeParameter, MethodDeclaration methodDeclaration)
+ {
+ //TODO check this method
+ final String paramName = typeParameter.getElementName();
+
+ for (Object decl : methodDeclaration.parameters())
+ {
+ if (!(decl instanceof SingleVariableDeclaration))
+ {
+ continue;
+ }
+
+ if (paramName.equals(((SingleVariableDeclaration) decl).getName().toString()))
+ {
+ return (SingleVariableDeclaration) decl;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Updates the Parameter-Value Pairs of specific Annotation.
+ *
+ * @param annotation - Annotation, which will be updated.
+ * @throws AnnotationGeneratorException
+ * @throws CoreException
+ */
+ public <T extends IJavaElement> void update(final IAnnotation<T> annotation) throws AnnotationGeneratorException, CoreException
+ {
+ AnnotationImpl<T> annotattionImpl = new AnnotationImpl<T>(annotation.getAnnotationName(), annotation.getParamValuePairs());
+ try
+ {
+ updateTheAnnotation(annotation.getAppliedElement(), annotattionImpl);
+ }
+ catch(MalformedTreeException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.InvalidTreeStateMsg, e);
+ }
+ catch (BadLocationException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CannotPerformEditMsg, e);
+ }
+ catch (FileNotFoundException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CompUnitMissingMsg, e);
+ }
+ }
+
+ /**
+ * Updates the Param-Value Pairs of specific Annotation.
+ *
+ * @param annotation - Annotation, which will be updated.
+ * @param paramValuePairs which will be updated. Old pairs will be replaced with the new once.
+ * @param replacePreviousPairs boolean value which specifies the way, how new IParamValuePairs will be updated. If the value is <tt>true</tt>,
+ * the Set with the old IParamValuePairs will be cleared and the new values will be applied. If the value is <tt>false</tt> the old pairs will be kept
+ * and will be updated with the values from the new Set, if there are params which do not exist in the old one, they will be added.
+ *
+ * @throws CoreException
+ * @throws AnnotationGeneratorException
+ *
+ * @deprecated - use public <T extends IJavaElement> void update(final IAnnotation<T> annotation) instead.
+ */
+ @Deprecated
+ public <T extends IJavaElement> void update(final IAnnotation<T> annotation, Set<IParamValuePair> paramValuePairs, boolean replacePreviousPairs) throws AnnotationGeneratorException, CoreException
+ {
+ updateAnnotation(annotation, annotation.getAppliedElement(), paramValuePairs, replacePreviousPairs);
+ }
+
+ /**
+ *
+ * @param <T>
+ * @param annotation
+ * @param javaElement
+ * @param paramValuePairs
+ * @param replacePreviousPairs
+ * @throws AnnotationGeneratorException
+ * @throws CoreException
+ *
+ */
+ private <T extends IJavaElement> void updateAnnotation(final IAnnotation<T> annotation, final T javaElement, Set<IParamValuePair> paramValuePairs, boolean replacePreviousPairs) throws AnnotationGeneratorException, CoreException
+ {
+ AnnotationImpl<T> annotationImpl = (AnnotationImpl<T>)annotation;
+ try
+ {
+ if(replacePreviousPairs)
+ {
+ annotationImpl.setParamValuePairs(paramValuePairs);
+ }
+ else
+ {
+ for (IParamValuePair pair : paramValuePairs)
+ {
+ boolean isUpdated = false;
+ Set<IParamValuePair> tmpParamValuePairs = annotationImpl.getParamValuePairs();
+ for (IParamValuePair thisPair : tmpParamValuePairs)
+ {
+ if(thisPair.getParam().equals(pair.getParam()))
+ {
+ tmpParamValuePairs.remove(thisPair);
+ tmpParamValuePairs.add(pair);
+ isUpdated = true;
+ break;
+ }
+ }
+ if(!isUpdated)
+ {
+ tmpParamValuePairs.add(pair);
+ }
+ annotationImpl.setParamValuePairs(tmpParamValuePairs);
+ }
+ }
+ updateTheAnnotation(javaElement, annotationImpl);
+
+ //remove(annotation);
+ //setAppliedElement(annotation, javaElement);
+ }
+ catch(MalformedTreeException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.InvalidTreeStateMsg, e);
+ }
+ catch (BadLocationException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CannotPerformEditMsg, e);
+ }
+ catch (FileNotFoundException e) {
+ throw new AnnotationGeneratorException(e.getMessage(), JaxWsUtilMessages.CompUnitMissingMsg, e);
+ }
+ }
+
+
+ /**
+ * Removes Annotation.
+ *
+ * @param annotation - Annotation, which will be removed.
+ *
+ * @throws BadLocationException
+ * @throws CoreException
+ * @throws AnnotationGeneratorException
+ * @throws FileNotFoundException
+ */
+ public <T extends IJavaElement> void remove(final IAnnotation<T> annotation) throws AnnotationGeneratorException, CoreException
+ {
+ removeAnnotation(annotation, annotation.getAppliedElement());
+ }
+
+ private <T extends IJavaElement> void removeAnnotation(final IAnnotation<T> annotation, final T javaElement) throws AnnotationGeneratorException, CoreException
+ {
+ AnnotationImpl<T> annotationImpl = (AnnotationImpl<T>)annotation;
+ try
+ {
+// if(annotationImpl.getAnnotationStringValue() == null || annotationImpl.getAnnotationStringValue().trim().equals(""))
+// {
+// annotationImpl.setAnnotationStringValue(createAnnotatationStringVallue(annotationImpl, javaElement));
+// AnnotationUtils.getInstance().removeAnnotation(javaElement, annotationImpl.getAnnotationStringValue());
+// }
+// else
+// {
+ AnnotationUtils.getInstance().removeAnnotation(javaElement, annotationImpl.getSimpleAnnotationName());
+// }
+ } catch (BadLocationException ble)
+ {
+ throw new AnnotationGeneratorException(ble.getMessage(), JaxWsUtilMessages.CannotPerformEditMsg, ble);
+ } catch (FileNotFoundException fnfe)
+ {
+ throw new AnnotationGeneratorException(fnfe.getMessage(), JaxWsUtilMessages.CompUnitMissingMsg, fnfe);
+ }
+ }
+
+ // i036509 added
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> void updateTheAnnotation(final T javaElement, final AnnotationImpl<T> annotationImpl) throws BadLocationException, CoreException, AnnotationGeneratorException, FileNotFoundException
+ {
+ final ICompilationUnit iCu = getCu(javaElement);
+ final CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(iCu, null);
+
+ BodyDeclaration bd = null;
+ Annotation found = null;
+ if(javaElement instanceof IType)
+ {
+ bd = ASTUtils.getInstance().getTypeDeclaration(javaElement.getElementName(), unit);
+ found = findAnnotation(bd, annotationImpl);
+
+ unit.recordModifications();
+ if (found!=null) {
+ bd.modifiers().remove(found);
+ }
+
+ final Expression annot = annotationImpl.getExpression(unit, unit.getAST());
+ bd.modifiers().add(0, annot);
+ }
+ if(javaElement instanceof IMethod)
+ {
+ TypeDeclaration td = (TypeDeclaration)ASTUtils.getInstance().getTypeDeclaration(((IMethod)javaElement).getDeclaringType().getElementName(), unit);
+ bd = ASTUtils.getInstance().getMethodDeclaration(((IMethod)javaElement), td);
+ found = findAnnotation(bd, annotationImpl);
+
+ unit.recordModifications();
+ if (found!=null) {
+ bd.modifiers().remove(found);
+ }
+
+ final Expression annot = annotationImpl.getExpression(unit, unit.getAST());
+ bd.modifiers().add(0, annot);
+ }
+ if(javaElement instanceof IField)
+ {
+ TypeDeclaration td = (TypeDeclaration)ASTUtils.getInstance().getTypeDeclaration(((IField)javaElement).getDeclaringType().getElementName(), unit);
+ bd = ASTUtils.getInstance().getFieldDeclaration(((IField)javaElement), td);
+ found = findAnnotation(bd, annotationImpl);
+
+ unit.recordModifications();
+ if (found!=null) {
+ bd.modifiers().remove(found);
+ }
+
+ final Expression annot = annotationImpl.getExpression(unit, unit.getAST());
+ bd.modifiers().add(0, annot);
+ }
+ if(javaElement instanceof ITypeParameter)
+ {
+ if(((ITypeParameter)javaElement).getDeclaringMember() instanceof IType)
+ {
+ bd = ASTUtils.getInstance().getTypeDeclaration(((ITypeParameter)javaElement).getDeclaringMember().getElementName(), unit);
+ SingleVariableDeclaration param = findParameter(bd, javaElement);
+ if(param != null)
+ {
+ found = findParamAnnotation(param, annotationImpl, javaElement);
+ }
+
+ unit.recordModifications();
+ if (found!=null) {
+ param.modifiers().remove(found);
+ }
+
+ final Expression annot = annotationImpl.getExpression(unit, unit.getAST());
+ param.modifiers().add(0, annot);
+ }
+ else
+ {
+ TypeDeclaration td = (TypeDeclaration)ASTUtils.getInstance().getTypeDeclaration(((IMethod)((ITypeParameter)javaElement).getParent()).getDeclaringType(). getElementName(), unit);
+ bd = ASTUtils.getInstance().getMethodDeclaration(((IMethod)((ITypeParameter)javaElement).getParent()), td);
+ SingleVariableDeclaration param = findParameter(bd, javaElement);
+ if(param != null)
+ {
+ found = findParamAnnotation(param, annotationImpl, javaElement);
+ }
+
+ unit.recordModifications();
+ if (found!=null) {
+ param.modifiers().remove(found);
+ }
+
+ final Expression annot = annotationImpl.getExpression(unit, unit.getAST());
+ param.modifiers().add(0, annot);
+ }
+ }
+
+ setAnnotatationStringVallue(annotationImpl, false, javaElement);
+ final IDocument doc = AnnotationUtils.getInstance().getDocument(iCu);
+ final TextEdit edit = unit.rewrite(doc, javaElement.getJavaProject().getOptions(true));
+ edit.apply(doc);
+
+ IStatus status = editResManager().setFileEditable((IFile) iCu.getResource());
+ if(status.getSeverity() == IStatus.OK)
+ {
+ fileUtils.setCompilationUnitContentAndSaveDirtyEditors(iCu, doc.get(), true, null);
+ }
+ else
+ {
+ throw new AnnotationGeneratorException("Annotattion could not be stored, the file is not writable", //$NON-NLS-1$
+ JaxWsUtilMessages.AnnotationCannotBeStoredMsg);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private Annotation findAnnotation(final BodyDeclaration td, final IAnnotation<? extends IJavaElement> annotation)
+ {
+ Annotation ann;
+ for (IExtendedModifier modifier : (List<IExtendedModifier>)td.modifiers())
+ {
+ if(!modifier.isAnnotation()) {
+ continue;
+ }
+
+ ann = (Annotation)modifier;
+ if (annotation.getAnnotationName().endsWith(ann.getTypeName().getFullyQualifiedName())) {
+ return ann;
+ }
+ }
+
+ return null;
+ }
+
+ private <T extends IJavaElement> SingleVariableDeclaration findParameter(final BodyDeclaration td, T javaElement)
+ {
+ if (td != null)
+ {
+ for (Object param : ((MethodDeclaration)td).parameters())
+ {
+ if (param instanceof SingleVariableDeclaration &&
+ ((ITypeParameter)javaElement).getElementName().toString().equals(((SingleVariableDeclaration)param).getName().toString()))
+ {
+ return (SingleVariableDeclaration)param;
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> Annotation findParamAnnotation(final SingleVariableDeclaration param, final IAnnotation<? extends IJavaElement> annotation, T javaElement)
+ {
+ Annotation ann;
+ for (IExtendedModifier modifier : (List<IExtendedModifier>)(param.modifiers()))
+ {
+ if(!modifier.isAnnotation()) {
+ continue;
+ }
+
+ ann = (Annotation)modifier;
+ if (annotation.getAnnotationName().endsWith(ann.getTypeName().getFullyQualifiedName())) {
+ return ann;
+ }
+ }
+ return null;
+ }
+
+ private ICompilationUnit getCu(final IJavaElement javaElement)
+ {
+ switch (javaElement.getElementType())
+ {
+ case IJavaElement.TYPE:
+ return ((IType) javaElement).getCompilationUnit();
+ case IJavaElement.FIELD:
+ return ((IField) javaElement).getCompilationUnit();
+ case IJavaElement.METHOD:
+ return ((IMethod) javaElement).getCompilationUnit();
+ case IJavaElement.TYPE_PARAMETER:
+ return ((ITypeParameter) javaElement).getDeclaringMember().getCompilationUnit();
+ }
+
+ return null;
+ }
+
+ private EditResourcesManager editResManager()
+ {
+ return new EditResourcesManager();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotation.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotation.java
new file mode 100755
index 0000000..0d8d839
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotation.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import java.util.Set;
+
+import org.eclipse.jdt.core.IJavaElement;
+
+/**
+ * Interface representing Complex Annotation consisting of param-value pairs.
+ *
+ * @author Plamen Pavlov
+ */
+public interface IAnnotation<T extends IJavaElement>
+{
+ /**
+ * Return the param-value pairs which this Annotation has.
+ *
+ * @return Set of param-values pairs.
+ */
+ public Set<IParamValuePair> getParamValuePairs();
+
+ /**
+ * Returns the value of the parameter with name param.
+ * @param param - the name of the parameter who's value is requested
+ * @return - the value represented as a string. Null if such parameter cannot be found or has a value of null.
+ * @throws - NullPointerException if param is null
+ */
+ public String getPropertyValue(String param);
+
+ /**
+ * Returns the T, to which this annotattion is associated.
+ */
+ public T getAppliedElement();
+
+
+//From IAnnotattionBase
+ /**
+ * @return - annotation name
+ */
+ public String getAnnotationName();
+
+ /**
+ * Gets the information about location in the source code.
+ *
+ * @return ILocator
+ */
+ public ILocator getLocator();
+
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationBase.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationBase.java
new file mode 100755
index 0000000..2f900d6
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationBase.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import java.io.FileNotFoundException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.text.edits.MalformedTreeException;
+
+/**
+ * Base interface representing Annotation and the functionality, required by it.
+ *
+ * @author Plamen Pavlov
+ */
+public interface IAnnotationBase<T extends IJavaElement>
+{
+ /** simple annotation type ID */
+ public final int SIMPLE_ANNOTATION = 1;
+
+ /** single element annotation type ID */
+ public final int SINGLE_ELEMENT_ANNOTATION = 2;
+
+ /** complex annotation type ID */
+ public final int COMPLEX_ANNOTATION = 4;
+
+ /**
+ * @return - annotation name
+ */
+ public String getAnnotationName();
+
+ /**
+ * Getting the TypeID of current Annotation
+ *
+ * @return Integer value, which represents the Annotation TypeID
+ */
+ public int getType();
+
+ /**
+ * Adds current Annotation to specific IJavaElement. It is not possible to have IMember as parameter because there is ITypeParameter as parameter when add to TypParameter is executed.
+ *
+ * @param javaElement
+ *
+ * @throws NullPointerException if <tt>javaElement</tt> is null.
+ * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: IType, IMethod, IField, ITypeParameter.
+ * @throws AnnotationGeneratorException.
+ */
+ public void setAppliedElement(T javaElement) throws AnnotationGeneratorException;
+
+ /**
+ * Remove the current Annotation from the associated JavaElement.
+ *
+ * @throws BadLocationException
+ * @throws CoreException
+ * @throws AnnotationGeneratorException
+ * @throws FileNotFoundException
+ * @throws MalformedTreeException
+ */
+ public void remove() throws MalformedTreeException, FileNotFoundException, AnnotationGeneratorException, CoreException, BadLocationException;
+
+ /**
+ * Gets the information about location in the source code.
+ *
+ * @return ILocator
+ */
+ public ILocator getLocator();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationInspector.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationInspector.java
new file mode 100755
index 0000000..c3f05f5
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationInspector.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import java.util.Collection;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+
+public interface IAnnotationInspector
+{
+ /**
+ * Retrieves all Type level Annotations from <code>type</code>, which is used to instantiate the IAnnotationInspector.
+ *
+ * @return contained Type level Annotations in <code>type</code> or empty Collection if not present.
+ *
+ * @throws JavaModelException
+ */
+ Collection<IAnnotation<IType>> inspectType() throws JavaModelException;
+
+ /**
+ * Retrieves a Type level Annotation with specific QName from <code>type</code>, which is used to instantiate the IAnnotationInspector.
+ *
+ * @param annotationQName - specified QName for the Annotation.
+ *
+ * @return Type level Annotation in <code>type</code> or <code>null</code>, if such Annotation do not present.
+ *
+ * @throws NullPointerException if <code>annotationQName</code> is <code>null</code>.
+ * @throws IllegalArgumentException if <code>annotationQName</code> is empty String.
+ * @throws JavaModelException
+ */
+ IAnnotation<IType> inspectType(final String annotationQName) throws JavaModelException;
+
+ /**
+ * Retrieves all Method level Annotations from <code>method</code>.
+ *
+ * @param method
+ *
+ * @return contained Method level Annotations in <code>method</code> or empty Collection if not present.
+ *
+ * @throws NullPointerException if <tt>method</tt> is null.
+ * @throws JavaModelException
+ */
+ Collection<IAnnotation<IMethod>> inspectMethod(IMethod method) throws JavaModelException;
+
+ /**
+ * Retrieves a Method level Annotation with specific QName from <code>method</code>.
+ *
+ * @param method
+ * @param annotationQName - specified QName for the Annotation.
+ *
+ * @return contained Method level Annotation in <code>method</code> or <code>null</code>.
+ *
+ * @throws NullPointerException if <tt>method</tt> or <code>annotationQName</code> are <code>null</code>.
+ * @throws IllegalArgumentException if <code>annotationQName</code> is empty String.
+ * @throws JavaModelException
+ */
+ IAnnotation<IMethod> inspectMethod(IMethod method, final String annotationQName) throws JavaModelException;
+
+ /**
+ * Retrieves all Field level Annotations from <code>field</code>.
+ *
+ * @param field
+ *
+ * @return contained Filed level Annotations in <code>field</code> or empty Collection if not present.
+ *
+ * @throws NullPointerException if <code>field</code> is <code>null</code>.
+ * @throws JavaModelException
+ */
+ Collection<IAnnotation<IField>> inspectField(IField field) throws JavaModelException;
+
+ /**
+ * Retrieves a Field level Annotation with specific QName from <code>field</code>.
+ *
+ * @param field
+ * @param annotationQName - specified QName for the Annotation.
+ *
+ * @return contained Filed level Annotations in <code>field</code> or <code>null</code>.
+ *
+ * @throws NullPointerException if <code>field</code> or <code>annotationQName</code> are <code>null</code>.
+ * @throws IllegalArgumentException if <code>annotationQName</code> is empty String.
+ * @throws JavaModelException
+ */
+ IAnnotation<IField> inspectField(IField field, final String annotationQName) throws JavaModelException;
+
+ /**
+ * Retrieves all TypeParameter level Annotations from <code>param</code>.
+ *
+ * @param param
+ *
+ * @return contained TypeParameter level Annotations in <code>param</code> or empty Collection if not present.
+ *
+ * @throws NullPointerException if <code>param</code> is <code>null</code>.
+ * @throws JavaModelException
+ */
+ Collection<IAnnotation<ITypeParameter>> inspectParam(ITypeParameter param) throws JavaModelException;
+
+ /**
+ * Retrieves a TypeParameter level Annotation with specific QName from <code>param</code>.
+ *
+ * @param param
+ * @param annotationQName - specified QName for the Annotation.
+ *
+ * @return contained TypeParameter level Annotations in <code>param</code> or <code>null</code>.
+ *
+ * @throws NullPointerException if <code>param</code> or <code>annotationQName</code> are <code>null</code>.
+ * @throws IllegalArgumentException if <code>annotationQName</code> is empty String.
+ * @throws JavaModelException
+ */
+ IAnnotation<ITypeParameter> inspectParam(ITypeParameter param, final String annotationQName) throws JavaModelException;
+
+
+
+
+// /**
+// * Retrieves all annotations from <code>javaElement</code>.
+// *
+// * @param javaElement
+// *
+// * @return contained annotations in <code>javaElement</code> or empty Colleaction if not present.
+// *
+// * @throws NullPointerException if <tt>javaElement</tt> is null.
+// * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: Itype, IMethod, IField.
+// * @throws JavaModelException
+// */
+// public Collection<IAnnotation> inspect(IJavaElement javaElement) throws JavaModelException;
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationProperty.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationProperty.java
new file mode 100755
index 0000000..db90bcb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationProperty.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AttributeTypeEnum;
+
+public interface IAnnotationProperty
+{
+ public String getAnnotationName();
+
+ public String getAttributeName();
+
+ public String getValue();
+
+ public AttributeTypeEnum getAttributeType();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationPropertyContainer.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationPropertyContainer.java
new file mode 100755
index 0000000..3cc7694
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IAnnotationPropertyContainer.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+import java.lang.annotation.ElementType;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationProperty;
+
+/**
+ * Interface for annotations container.
+ *
+ * @author Plamen Pavlov
+ *
+ */
+public interface IAnnotationPropertyContainer
+{
+ public void addAnnotationProperty(final AnnotationProperty annotationProperty, final ElementType target);
+
+ public Set<IAnnotation<ITypeParameter>> getParameterAnnotations(ITypeParameter tParam);
+
+ public Set<IAnnotation<IType>> getTypeAnnotations(IType type);
+
+ public Set<IAnnotation<IMethod>> getMethodAnnotations(IMethod method);
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/ILocator.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/ILocator.java
new file mode 100755
index 0000000..c47636f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/ILocator.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+/**
+ * Class that holds information to locate specific region in the source code
+ *
+ */
+public interface ILocator
+{
+ /**
+ * @return the line number in the source where the region pointed by this locator starts
+ */
+ public int getLineNumber();
+
+
+ /**
+ * @return the index of the first character of this region in source code
+ */
+ public int getStartPosition();
+
+ /**
+ * @return the length of the region
+ */
+ public int getLength();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IParamValuePair.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IParamValuePair.java
new file mode 100755
index 0000000..ffe6e5c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IParamValuePair.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+/**
+ * Interface representing param value pair in annotation. Param value pair has the following form: param=value
+ *
+ * @author Plamen Pavlov
+ */
+public interface IParamValuePair
+{
+ /**
+ * @return param name
+ */
+ public String getParam();
+
+ /**
+ * @return the value
+ */
+ public IValue getValue();
+
+ /**
+ * Gets the information about location in the source code.
+ *
+ * @return ILocator
+ */
+ public ILocator getLocator();
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IValue.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IValue.java
new file mode 100755
index 0000000..32c4a4c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/annotations/IValue.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.annotations;
+
+/**
+ * Interface representing artifact value in annotation.
+ *
+ * @author Plamen Pavlov
+ */
+public interface IValue
+{
+ /**
+ * Obtains the string representation of this value. The obtained string representation can later on be used to instantiate
+ * an instance of the type of the value that will be considedered equal to the returned value.
+ * <p>
+ * <c>@AnnotationExample(1)</c> //annoation with one attribute/parameter called "value" with value of "1".
+ * </p>
+ * The toString method will return the string "1", which can later on be used by Integer.parse(String) to create an instance of Integer
+ * equal to the value represented by the integer literal 1
+ * @return the string representation of this value
+ */
+ public String toString();
+
+ /**
+ * Gets the information about location in the source code.
+ *
+ * @return ILocator
+ */
+ public ILocator getLocator();
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/clazz/ASTUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/clazz/ASTUtils.java
new file mode 100755
index 0000000..28d5000
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/clazz/ASTUtils.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.clazz;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+
+/**
+ * Utility class that provides helper methods for {@link AST} processing.
+ *
+ * @author Georgi Vachkov
+ */
+public class ASTUtils
+{
+ private static ASTUtils instance;
+
+ private ASTUtils() {
+ // disable construction
+ }
+
+ /**
+ * @return create new instance for this utility
+ */
+ public static ASTUtils getInstance() {
+ if(instance==null) {
+ instance = new ASTUtils();
+ }
+ return instance;
+ }
+
+ /**
+ * Creates AST tree out of {@link File} instance.
+ * @param sourceFile java class file
+ * @param monitor progress monitor
+ * @return created {@link ASTNode}
+ * @throws IOException
+ */
+ public ASTNode createAST(final File sourceFile, final IProgressMonitor monitor) throws IOException
+ {
+ nullCheckParam(sourceFile, "sourceFile"); //$NON-NLS-1$
+
+ final ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(FileUtils.getInstance().getFileContent(sourceFile).toCharArray());
+ return parser.createAST(monitor);
+ }
+
+ /**
+ * Creates {@link AST} tree out of {@link IType} instance.
+ * @param sourceType java class
+ * @param monitor progress monitor
+ * @return created {@link ASTNode} instance
+ */
+ public CompilationUnit createCompilationUnit(final ICompilationUnit sourceCu, final IProgressMonitor monitor)
+ {
+ nullCheckParam(sourceCu, "sourceCu"); //$NON-NLS-1$
+ final ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(sourceCu);
+ parser.setBindingsRecovery(false);
+ return (CompilationUnit)parser.createAST(monitor);
+ }
+
+ /**
+ * Finds {@link FieldDeclaration} in {@link TypeDeclaration} with name <code>fieldType.getElementName()</code>.
+ *
+ * @param fieldType
+ * @param typeDeclaration
+ * @return found object or <code>null</code>
+ */
+ public FieldDeclaration getFieldDeclaration(final IField fieldType, final TypeDeclaration typeDeclaration)
+ {
+ for (FieldDeclaration fd : typeDeclaration.getFields())
+ {
+ for (Object fr : fd.fragments())
+ {
+ VariableDeclarationFragment vdf = (VariableDeclarationFragment) fr;
+ if (vdf.getName().getFullyQualifiedName().equals(fieldType.getElementName()))
+ {
+ return fd;
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean compareMethodParams(final IMethod methodType, final MethodDeclaration md)
+ {
+ List<SingleVariableDeclaration> list = md.parameters();
+ if (list.size() == methodType.getNumberOfParameters())
+ {
+ String[] parameterTypes = methodType.getParameterTypes();
+ for (int i = 0; i < list.size(); i++)
+ {
+ if (!isSameParam(parameterTypes[i], (SingleVariableDeclaration) list.get(i)))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isSameParam(final String type, final SingleVariableDeclaration svDecl)
+ {
+ return type.equals(getTypeSignature(svDecl));
+ }
+
+ /**
+ * Retrieves type signature from {@link SingleVariableDeclaration}. As {@link SingleVariableDeclaration} returns only the clean type in case
+ * declaration of type <tt>int paraArr[][]</tt> is in code the method adds array identifiers for type declaration int this case.
+ *
+ * @param svDecl
+ * @return the signatyre for the type
+ */
+ public String getTypeSignature(final SingleVariableDeclaration svDecl)
+ {
+ String typeName = Signature.createTypeSignature(svDecl.getType().toString(), false);
+
+ if (svDecl.getExtraDimensions() > 0 && typeName.indexOf('[') == -1)
+ {
+ for (int i = 0; i < svDecl.getExtraDimensions(); i++)
+ {
+ typeName = "[" + typeName;// $JL-STR_CONCAT$ //$NON-NLS-1$
+ }
+ }
+
+ return typeName;
+ }
+
+ /**
+ * Finds {@link MethodDeclaration} in {@link TypeDeclaration} having name <code>methodType.getElementName()</code>.
+ *
+ * @param methodType
+ * @param typeDeclaration
+ * @return found object or <code>null</code>
+ */
+ public MethodDeclaration getMethodDeclaration(final IMethod methodType, final TypeDeclaration typeDeclaration)
+ {
+ for (MethodDeclaration md : typeDeclaration.getMethods())
+ {
+ if (md.getName().getFullyQualifiedName().equals(methodType.getElementName()))
+ {
+ if (compareMethodParams(methodType, md))
+ {
+ return md;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Retrieves {@link TypeDeclaration} from {@link CompilationUnit} with name <tt>className</tt>
+ *
+ * @param className
+ * @param unit
+ * @return found {@link TypeDeclaration} or <code>null</code>
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractTypeDeclaration getTypeDeclaration(final String className, final CompilationUnit unit)
+ {
+ AbstractTypeDeclaration typeDeclaration = null;
+ // looking up the selected type
+ for (Object typeObject : unit.types())
+ {
+ AbstractTypeDeclaration tmpTypeDeclaration = (AbstractTypeDeclaration) typeObject;
+ if (tmpTypeDeclaration.getName().getFullyQualifiedName().equals(className))
+ {
+ typeDeclaration = tmpTypeDeclaration;
+ break;
+ }
+ }
+
+ if (typeDeclaration == null)
+ {
+ List<AbstractTypeDeclaration> list = unit.types();
+ typeDeclaration = getInnerClass(list.toArray(new AbstractTypeDeclaration[list.size()]), className);
+ }
+
+ return typeDeclaration;
+ }
+
+ private AbstractTypeDeclaration getInnerClass(final AbstractTypeDeclaration[] types, final String className)
+ {
+ AbstractTypeDeclaration result = null;
+ for (AbstractTypeDeclaration abstractType : types)
+ {
+ if (abstractType.getName().getFullyQualifiedName().equals(className)) {
+ return abstractType;
+ }
+
+ if (!(abstractType instanceof TypeDeclaration)) {
+ continue;
+ }
+
+ result = getInnerClass((AbstractTypeDeclaration[]) ((TypeDeclaration) abstractType).getTypes(), className);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/dom/validation/DomValidationConstants.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/dom/validation/DomValidationConstants.java
new file mode 100755
index 0000000..6ea7b68
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/dom/validation/DomValidationConstants.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.dom.validation;
+
+public class DomValidationConstants
+{
+ public static final String MARKER_ID = "org.eclipse.jst.ws.jaxws.dom.integration.WsValidatorMarker"; //$NON-NLS-1$
+
+ public static final String IMPLEMENTATION = "implementation"; //$NON-NLS-1$
+
+ public static final String WS_CONSTRAINT_ID = "webServiceConstraint"; //$NON-NLS-1$
+ public static final String WP_CONSTRAINT_ID = "webParamConstraint"; //$NON-NLS-1$
+ public static final String WM_CONSTRAINT_ID = "webMethodConstraint"; //$NON-NLS-1$
+ public static final String SEI_CONSTRAINT_ID = "seiConstraint"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/LocalizedException.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/LocalizedException.java
new file mode 100755
index 0000000..1ce0843
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/LocalizedException.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.exception;
+
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+
+
+
+/**
+ * This is base class for all CHECKED exceptions for the WS Tools
+ * toolset. This exception correctly overrides getLocalizedMessage()
+ * of Exception class and provide proper localized message.
+ * To achieve that there is a limitation - it will be impossible to return localized
+ * message if it haven't been passed to the constructor of exception, so there is no
+ * constructor without localized message.
+ *
+ * @author Mladen Tomov
+ **/
+
+public class LocalizedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String localizedMessage;
+
+ /**
+ * Constructs exception with ability to provide localized message
+ * @param message - the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method)
+ * @param localizedMessage - the localized message (which is saved for later retrieval
+ * by the {@link #getLocalizedMessage()} method)
+ *
+ * @throws NullPointerException - in case localized message is null
+ * */
+ public LocalizedException(String message, String localizedMessage) {
+ super(message);
+ ContractChecker.nullCheckParam(localizedMessage, "localizedMessage"); //$NON-NLS-1$
+ this.localizedMessage = localizedMessage;
+ }
+
+ /**
+ * Constructs exception with ability to provide localized message
+ * @param message - the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method)
+ * @param localizedMessage - the localized message (which is saved for later retrieval
+ * by the {@link #getLocalizedMessage()} method)
+ * @param cause - cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method).
+ *
+ * @throws NullPointerException - in case localized message is null
+ * */
+
+ public LocalizedException(String message, String localizedMessage, Throwable cause) {
+ super(message, cause);
+ ContractChecker.nullCheckParam(localizedMessage, "localizedMessage"); //$NON-NLS-1$
+ this.localizedMessage = localizedMessage;
+ }
+
+ /**
+ * Returns localized message with which the exception was constructed.*/
+ @Override
+ public String getLocalizedMessage() {
+ return localizedMessage;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/MissingResourceException.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/MissingResourceException.java
new file mode 100755
index 0000000..da21294
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/exception/MissingResourceException.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.exception;
+
+
+/**
+ * Indicates that a resource of any kind couldn't be found but this was expected.
+ *
+ * @author Joerg Dehmel
+ */
+public class MissingResourceException extends LocalizedException
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates an instance with a message and a localized message.
+ *
+ * @param message
+ * error message
+ * @param localizedMessage
+ * localized message
+ */
+ public MissingResourceException(final String message, final String localizedMessage)
+ {
+ super(message, localizedMessage);
+ }
+
+ /**
+ * Creates an instance with message, localized message and causing exception.
+ *
+ * @param message
+ * error message
+ * @param localizedMessage
+ * localized message
+ * @param cause
+ * causing exception
+ */
+ public MissingResourceException(final String message, final String localizedMessage, final Throwable cause)
+ {
+ super(message, localizedMessage, cause);
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/FacetUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/FacetUtils.java
new file mode 100755
index 0000000..e88da7f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/FacetUtils.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.facets;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+
+public class FacetUtils implements IFacetUtils
+{
+ /**
+ * @throws NullPointerException
+ * if <c>project</c> or <c>facetIds</c> is null
+ */
+ public boolean hasAnyFacet(IProject project, String... facetIds) throws CoreException
+ {
+ ContractChecker.nullCheckParam(project);
+ ContractChecker.nullCheckParam(facetIds);
+
+ if (!isFacetedProject(project))
+ {
+ return false;
+ }
+
+ final IFacetedProject facetedProject = getFacetedProject(project);
+ for (String facetId : facetIds)
+ {
+ final IProjectFacet facet = ProjectFacetsManager.getProjectFacet(facetId);
+ if (facetedProject.hasProjectFacet(facet))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean hasFacetWithVersion(IProject project, String facetVersion, String facetId) throws CoreException
+ {
+ return hasFacetWithVersion(project, facetVersion, facetId, true);
+ }
+
+ public boolean isFacetedProject(IProject project) throws CoreException
+ {
+ Set<IFacetedProject> facetedProjects = getAllWorkspaceFacetedProjects();
+ final Iterator<IFacetedProject> i = facetedProjects.iterator();
+ while (i.hasNext())
+ {
+ final IFacetedProject fp = (IFacetedProject) i.next();
+ if (project.equals(fp.getProject()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean hasFacetWithVersion(IProject project, String facetVersion, String facetId, boolean acceptHigherFacetVersion) throws CoreException
+ {
+ ContractChecker.nullCheckParam(project);
+ ContractChecker.nullCheckParam(facetVersion);
+ ContractChecker.nullCheckParam(facetId);
+
+ if (!isFacetedProject(project))
+ {
+ return false;
+ }
+
+ Set<IProjectFacetVersion> allFacetsVersions = getProjectFacets(project);
+ for (IProjectFacetVersion ver : allFacetsVersions)
+ {
+ if (ver.getProjectFacet().getId().equals(facetId))
+ {
+ return isFacetAcceptable(ver, facetVersion, acceptHigherFacetVersion);
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isFacetAcceptable(IProjectFacetVersion facetVersion, String facetVersionId, boolean acceptHigherFacetVersion)
+ throws CoreException
+ {
+ assert facetVersion != null;
+
+ // Check for exact version
+ if (!acceptHigherFacetVersion)
+ {
+ return facetVersion.getVersionString().equals(facetVersionId);
+ }
+
+ Comparator<String> comparator = facetVersion.getProjectFacet().getVersionComparator();
+ String currentFacetVersion = facetVersion.getVersionString();
+ return comparator.compare(currentFacetVersion, facetVersionId) >= 0;
+ }
+
+ private IFacetedProject getFacetedProject(IProject project) throws CoreException
+ {
+ return ProjectFacetsManager.create(project);
+ }
+
+ private Set<IProjectFacetVersion> getProjectFacets(IProject project) throws CoreException
+ {
+ assert isFacetedProject(project);
+
+ return getFacetedProject(project).getProjectFacets();
+ }
+
+ private Set<IFacetedProject> getAllWorkspaceFacetedProjects() throws CoreException
+ {
+ return ProjectFacetsManager.getFacetedProjects();
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/IFacetUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/IFacetUtils.java
new file mode 100755
index 0000000..8727750
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/facets/IFacetUtils.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.facets;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+public interface IFacetUtils
+{
+ /**
+ * Constant for EJB30 facet ID
+ */
+ public static final String EJB_30_FACET_ID = "jst.ejb"; //$NON-NLS-1$
+
+ /**
+ * Constant for EJB30 facet version 3.0
+ */
+ public static final String EJB_30_FACET_VERSION = "3.0"; //$NON-NLS-1$
+
+ /**
+ * Constant for Web 2.5 facet ID
+ */
+ public static final String WEB_25_FACET_ID = "jst.web"; //$NON-NLS-1$
+
+ /**
+ * Constant for Web facet version 2.5
+ */
+ public static final String WEB_25_FACET_VERSION = "2.5"; //$NON-NLS-1$
+
+ /**
+ * Constant for Application client facet ID
+ */
+ public static final String APPCLIENT_25_FACET_ID = "jst.appclient"; //$NON-NLS-1$
+
+ /**
+ * Constant for Application client facet version 2.5
+ */
+ public static final String APPCLIENT_25_FACET_VERSION = "5.0"; //$NON-NLS-1$
+
+ /**
+ * Checks whether <code>project</code> has a facet with id <code>facetId</code> with version <code>facetVersion</code>
+ * In case the project specified is not a faceted project, false is returned
+ * This is a convenience method that is equivalent to invoking hasFacetWithVersion(project, facetVersion, facetId, false)
+ * @param project the project
+ * @param facetVersion the facet version
+ * @param facetId the facet id
+ * @return true in case the project specified is a faceted project and has the facet with the version specified; false otherwise
+ * @throws CoreException
+ * @throws NullPointerException when any of the input parameters is null
+ * @see IFacetUtils#hasFacetWithVersion(IProject, String, String, boolean)
+ */
+ public boolean hasFacetWithVersion(IProject project, String facetVersion, String facetId) throws CoreException;
+
+ /**
+ * Checks whether <code>project</code> has a facet with id <code>facetId</code> with version <code>facetVersion</code>
+ * In case the project specified is not a faceted project, false is returned
+ * @param project the project
+ * @param facetVersion the facet version
+ * @param facetId the facet id
+ * @param acceptHigherFacetVersion a flag indicating whether higher facet versions are acceptable
+ * @return true in case the project specified is a faceted project and has the facet with the version specified; false otherwise
+ * @throws CoreException
+ * @throws NullPointerException when any of the input parameters is null
+ */
+ public boolean hasFacetWithVersion(IProject project, String facetVersion, String facetId, boolean acceptHigherFacetVersion) throws CoreException;
+
+ /**
+ * Checks whether the project specified is a faceted project
+ * @param project the project
+ * @return
+ * @throws CoreException
+ * @throws NullPointerException if <code>project</code> is null
+ */
+ public boolean isFacetedProject(IProject project) throws CoreException;
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationBaseImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationBaseImpl.java
new file mode 100755
index 0000000..32eda2b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationBaseImpl.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationBase;
+
+/**
+ * Base {@link IAnnotationBase} implementation
+ *
+ * @author Plamen Pavlov
+ */
+public abstract class AnnotationBaseImpl<T extends IJavaElement> extends ValueImpl
+{
+ private String annotationName;// Container for Annotation Name;
+ protected T javaElement; // Conatiner for the parent IJavaElement;
+ //private String annotationStringValue;//Conatiner to current String representation of this annotation
+
+ private static final String DOT = "."; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param annotationName
+ *
+ * @throws NullPointerException in case <code>annotationName</code> is null.
+ * @throws IllegalArgumentException in case <code>annotationName</code> is empty String.
+ */
+ public AnnotationBaseImpl(String annotationName)
+ {
+ this.annotationName = annotationName;
+ }
+
+ /**
+ * Extracts only the Annotation name in case it is in fully qualified form.
+ *
+ * @return the simple Annotation name.
+ */
+ public String getSimpleAnnotationName()
+ {
+ int lastDotIndex = annotationName.lastIndexOf(DOT);
+
+ if (lastDotIndex == -1)
+ {
+ return annotationName;
+ }
+
+ return annotationName.substring(lastDotIndex + 1);
+ }
+
+ public String getAnnotationName()
+ {
+ return annotationName;
+ }
+
+ /**
+ * Adds Annotation to specific IJavaElement.
+ *
+ * @param javaElement
+ *
+ * @throws NullPointerException if <tt>javaElement</tt> is null.
+ * @throws IllegalArgumentException in case <code>javaElement</code> is not of the correct type. Supported types are: IType, IMethod, IField, ITypeParameter.
+ */
+ public void setAppliedElementWithoutSave(T javaElement)
+ {
+ setJavaElement(javaElement);
+ }
+
+ public void setJavaElement(T javaElement)
+ {
+ if (javaElement == null)
+ {
+ throw new NullPointerException("javaElement should not be null!"); //$NON-NLS-1$
+ }
+ if(!(javaElement instanceof IType) && !(javaElement instanceof IMethod) && !(javaElement instanceof IField) && !(javaElement instanceof ITypeParameter))
+ {
+ throw new IllegalArgumentException("javaElement is not of correct type!"); //$NON-NLS-1$
+ }
+
+ this.javaElement = javaElement;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return annotationName.hashCode();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final AnnotationBaseImpl<T> other = (AnnotationBaseImpl<T>)obj;
+ return annotationName.equals(other.annotationName);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationImpl.java
new file mode 100755
index 0000000..5d3b5a3
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationImpl.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import java.util.Arrays;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * An implementation of {@link IAnnotation}
+ *
+ * @author Plamen Pavlov
+ */
+public class AnnotationImpl<T extends IJavaElement> extends AnnotationBaseImpl<T> implements IAnnotation<T>
+{
+
+ /**
+ * @see org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation#getPropertyValue(java.lang.String)
+ */
+ public String getPropertyValue(String param)
+ {
+ for (IParamValuePair pair : getParamValuePairs())
+ {
+ if (param.equals(pair.getParam()))
+ {
+ return pair.getValue()!=null ? pair.getValue().toString() : null;
+ }
+ }
+ return null;
+ }
+
+ private Set<IParamValuePair> paramValuePairs;
+
+ /**
+ * Constructor
+ *
+ * @param annotationName -
+ * the name of annotation
+ * @param paramValuePairs -
+ * the param=value paris
+ */
+ public AnnotationImpl(String annotationName, Set<IParamValuePair> paramValuePairs)
+ {
+ super(annotationName);
+ this.paramValuePairs = paramValuePairs;
+ }
+
+ public Set<IParamValuePair> getParamValuePairs()
+ {
+ return paramValuePairs;
+ }
+
+ public void setParamValuePairs(Set<IParamValuePair> paramValuePairs)
+ {
+ this.paramValuePairs = paramValuePairs;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ NormalAnnotation annot = ast.newNormalAnnotation();
+ boolean wasAdded = addImports(ast, unit, getAnnotationName());
+ if (wasAdded)
+ {
+ ((SimpleName) annot.getTypeName()).setIdentifier(getSimpleAnnotationName());
+ } else
+ {
+ Name name = ast.newName(getAnnotationName());
+ annot.setTypeName(name);
+ }
+ for (IParamValuePair paramValuePair : paramValuePairs)
+ {
+ MemberValuePair pair = ast.newMemberValuePair();
+ pair.getName().setIdentifier(paramValuePair.getParam());
+ pair.setValue(((ValueImpl) paramValuePair.getValue()).getExpression(unit, ast));
+ annot.values().add(pair);
+ }
+ return annot;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ if(paramValuePairs == null || paramValuePairs.size() < 1)
+ {
+ return 31 * super.hashCode();
+ }
+ return 31 * super.hashCode() + Arrays.hashCode(paramValuePairs.toArray(new IParamValuePair[paramValuePairs.size()]));
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ final AnnotationImpl<?> other = (AnnotationImpl<?>) obj;
+ return (Arrays.equals(paramValuePairs.toArray(new IParamValuePair[paramValuePairs.size()]), other.paramValuePairs.toArray(new IParamValuePair[paramValuePairs.size()])));
+ }
+
+ public T getAppliedElement()
+ {
+ return this.javaElement;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationInspectorImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationInspectorImpl.java
new file mode 100755
index 0000000..2c867e1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationInspectorImpl.java
@@ -0,0 +1,670 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import static org.eclipse.jst.ws.jaxws.utils.ContractChecker.nullCheckParam;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.BooleanLiteral;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.IExtendedModifier;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.NumberLiteral;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.clazz.ASTUtils;
+
+/**
+ * Class, which is made to load and return annotations from a given IJavaElemet.
+ *
+ * @author Plamen Pavlov
+ */
+public class AnnotationInspectorImpl implements IAnnotationInspector
+{
+ private IType iType;
+ private CompilationUnit cUnit;
+
+ public AnnotationInspectorImpl(final IType type)
+ {
+ ContractChecker.nullCheckParam(type, "type"); //$NON-NLS-1$
+
+ this.iType = type;
+ }
+
+ public IAnnotation<IMethod> inspectMethod(final IMethod method, final String annotationQName) throws JavaModelException
+ {
+ ContractChecker.nullCheckParam(method, "method"); //$NON-NLS-1$
+ ContractChecker.nullCheckParam(annotationQName, "annotationQName"); //$NON-NLS-1$
+ if(!(method instanceof IMethod))
+ {
+ throw new IllegalArgumentException("method argument is not of correct Type!"); //$NON-NLS-1$
+ }
+ if(annotationQName.trim().equals("")) //$NON-NLS-1$
+ {
+ throw new IllegalArgumentException("annotationQName argument is not with propper value!"); //$NON-NLS-1$
+ }
+
+ return getSpecificAnnotationFromMember(method, method.getParent().getElementName(), annotationQName);
+ }
+
+ public Collection<IAnnotation<IMethod>> inspectMethod(IMethod method) throws JavaModelException
+ {
+ ContractChecker.nullCheckParam(method, "method"); //$NON-NLS-1$
+
+ if(!(method instanceof IMethod))
+ {
+ throw new IllegalArgumentException("method argument is not of correct Type!"); //$NON-NLS-1$
+ }
+
+ return getFromMember(method, method.getParent().getElementName());
+ }
+
+ public IAnnotation<IField> inspectField(final IField field, final String annotationQName) throws JavaModelException
+ {
+ nullCheckParam(field, "field"); //$NON-NLS-1$
+ nullCheckParam(annotationQName, "annotationQName"); //$NON-NLS-1$
+
+ if(!(field instanceof IField))
+ {
+ throw new IllegalArgumentException("field argument is not of correct Type!"); //$NON-NLS-1$
+ }
+ if(annotationQName.trim().equals("")) //$NON-NLS-1$
+ {
+ throw new IllegalArgumentException("annotationQName argument is not with propper value!"); //$NON-NLS-1$
+ }
+
+ final String className = field.getParent().getElementName();
+ return getSpecificAnnotationFromMember(field, className, annotationQName);
+ }
+
+ public Collection<IAnnotation<IField>> inspectField(IField field) throws JavaModelException
+ {
+ if (field == null)
+ {
+ throw new NullPointerException("field should not be null!"); //$NON-NLS-1$
+ }
+ if(!(field instanceof IField))
+ {
+ throw new IllegalArgumentException("field argument is not of correct Type!"); //$NON-NLS-1$
+ }
+
+ final String className = field.getParent().getElementName();
+ return getFromMember(field, className);
+ }
+
+ public IAnnotation<ITypeParameter> inspectParam(final ITypeParameter param, final String annotationQName) throws JavaModelException
+ {
+ nullCheckParam(param, "param"); //$NON-NLS-1$
+ nullCheckParam(annotationQName, "annotationQName"); //$NON-NLS-1$
+
+ if(!(param instanceof ITypeParameter))
+ {
+ throw new IllegalArgumentException("param argument is not of correct Type!"); //$NON-NLS-1$
+ }
+ if(annotationQName.trim().equals("")) //$NON-NLS-1$
+ {
+ throw new IllegalArgumentException("annotationQName argument is not with propper value!"); //$NON-NLS-1$
+ }
+
+ final String className = getClassNameFromParam(param);
+ return getSpecificAnnotationFromMember(param, className, annotationQName);
+ }
+
+ public Collection<IAnnotation<ITypeParameter>> inspectParam(ITypeParameter param) throws JavaModelException
+ {
+ if (param == null)
+ {
+ throw new NullPointerException("param should not be null!"); //$NON-NLS-1$
+ }
+ if(!(param instanceof ITypeParameter))
+ {
+ throw new IllegalArgumentException("param argument is not of correct Type!"); //$NON-NLS-1$
+ }
+
+ return getFromMember(param, getClassNameFromParam(param));
+ }
+
+ public IAnnotation<IType> inspectType(final String annotationQName) throws JavaModelException
+ {
+ nullCheckParam(annotationQName, "annotationQName"); //$NON-NLS-1$
+
+ if (annotationQName.trim().equals("")) //$NON-NLS-1$
+ {
+ throw new IllegalArgumentException("annotationQName argument is not with propper value!"); //$NON-NLS-1$
+ }
+
+ return getSpecificAnnotationFromMember(iType, iType.getElementName(), annotationQName);
+ }
+
+ public Collection<IAnnotation<IType>> inspectType() throws JavaModelException
+ {
+ return getFromMember(iType, iType.getElementName());
+ }
+
+ // # implementation
+
+ private String getClassNameFromParam(final ITypeParameter param) throws JavaModelException
+ {
+ if(param.getDeclaringMember() instanceof IMethod)
+ {
+ return param.getDeclaringMember().getParent().getElementName();
+ }
+
+ return param.getDeclaringMember().getElementName();
+ }
+
+ protected <T extends IJavaElement> Set<IAnnotation<T>> getFromMember(T type, String className) throws JavaModelException
+ {
+ if (!isSupportedJavaElement(type)) {
+ throw new IllegalArgumentException("passed argument is not of correct type."); //$NON-NLS-1$
+ }
+
+ ICompilationUnit cUnit = null;
+ if(type instanceof IMember) {
+ cUnit = ((IMember)type).getCompilationUnit();
+ }
+ else {
+ cUnit = ((ITypeParameter)type).getDeclaringMember().getCompilationUnit();
+ }
+
+ if (cUnit == null) {
+ return new HashSet<IAnnotation<T>>();
+ }
+
+ final CompilationUnit unit = getCompilationUnit();
+ final AbstractTypeDeclaration typeDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, unit);
+
+ switch(type.getElementType())
+ {
+ case IJavaElement.TYPE:
+ return getAnnotations(type, typeDeclaration);
+
+ case IJavaElement.FIELD:
+ FieldDeclaration fieldDeclaration = ASTUtils.getInstance().getFieldDeclaration((IField) type, (TypeDeclaration)typeDeclaration);
+ return getAnnotations(type, fieldDeclaration);
+
+ case IJavaElement.METHOD:
+ MethodDeclaration methodDeclaration = ASTUtils.getInstance().getMethodDeclaration((IMethod) type, (TypeDeclaration)typeDeclaration);
+ return getAnnotations(type, methodDeclaration);
+
+ case IJavaElement.TYPE_PARAMETER:
+ methodDeclaration = ASTUtils.getInstance().getMethodDeclaration((IMethod)((ITypeParameter) type).getParent(), (TypeDeclaration)typeDeclaration);
+ return getParamAnnotations(type, methodDeclaration);
+ }
+
+ return new HashSet<IAnnotation<T>>();
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> Set<IAnnotation<T>> getAnnotations(T iMember, BodyDeclaration bodyDeclaration) throws JavaModelException
+ {
+ if (bodyDeclaration != null)
+ {
+ List list = bodyDeclaration.modifiers();
+ return extractAnnotations(iMember, list);
+ }
+ return new HashSet<IAnnotation<T>>();
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> Set<IAnnotation<T>> getParamAnnotations(T iMember, MethodDeclaration methodDeclaration) throws JavaModelException
+ {
+ if (methodDeclaration != null)
+ {
+ for (Object param : methodDeclaration.parameters())
+ {
+ if (param instanceof SingleVariableDeclaration &&
+ ((ITypeParameter)iMember).getElementName().toString().equals(((SingleVariableDeclaration)param).getName().toString()))
+ {
+ List list = ((SingleVariableDeclaration) param).modifiers();
+
+ return extractAnnotations(iMember, list);
+ }
+ }
+ }
+ return new HashSet<IAnnotation<T>>();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> Set<IAnnotation<T>> extractAnnotations(T iMember, List list) throws JavaModelException
+ {
+ Iterator iter = list.iterator();
+ Set<IValue> values = new HashSet<IValue>();
+ while (iter.hasNext())
+ {
+ IExtendedModifier element = (IExtendedModifier) iter.next();
+ if (element.isAnnotation())
+ {
+ values.add(convertExpression((Expression) element));
+ }
+ }
+
+ Set<IAnnotation<T>> expressions = new HashSet<IAnnotation<T>>();
+ for (IValue value : values)
+ {
+ AnnotationImpl<T> ann = (AnnotationImpl<T>)value;
+ ann.setAppliedElementWithoutSave(iMember);
+ expressions.add(ann);
+ }
+ return expressions;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends IJavaElement> IAnnotation<T> extractSpecificAnnotation(T iMember, List list, IType type, String annotationQName) throws JavaModelException
+ {
+ Iterator iter = list.iterator();
+ Set<IValue> values = new HashSet<IValue>();
+ while (iter.hasNext())
+ {
+ IExtendedModifier element = (IExtendedModifier) iter.next();
+ if (element.isAnnotation())
+ {
+ final Name typeName = ((Annotation)element).getTypeName();
+ if (annotationQName.endsWith(typeName.getFullyQualifiedName())) {
+ values.add(convertExpression((Expression) element));
+ }
+ }
+ }
+
+ for (IValue value : values)
+ {
+ AnnotationImpl<T> tmpAnnotation = (AnnotationImpl<T>)value;
+ if(checkSpecificAnnotattion(tmpAnnotation, type, annotationQName))
+ {
+ AnnotationImpl<T> result = new AnnotationImpl<T>(annotationQName, tmpAnnotation.getParamValuePairs());
+ result.setAppliedElementWithoutSave(iMember);
+ result.setLocator(tmpAnnotation.getLocator());
+ return result;
+ }
+ }
+ return null;
+ }
+
+ private <T extends IJavaElement> boolean checkSpecificAnnotattion(final AnnotationImpl<T> annotation, final IType type, final String annotationQName) throws JavaModelException
+ {
+ if(annotation.getAnnotationName().equals(annotationQName) ||
+ (type.getPackageFragment().getElementName() + "." + annotation.getAnnotationName()).equals(annotationQName)) //$NON-NLS-1$
+ {
+ return true;
+ }
+
+ ICompilationUnit cUnit = type.getCompilationUnit();
+ IImportDeclaration[] imports = cUnit.getImports();
+ for (IImportDeclaration importDeclaration : imports)
+ {
+ if(annotationQName.endsWith(annotation.getAnnotationName()) && importDeclaration.getElementName().equals(annotationQName))
+ {
+ return true;
+ }
+ }
+
+ for (IImportDeclaration importDeclaration : imports)
+ {
+ if(importDeclaration.getElementName().endsWith("*")) //$NON-NLS-1$
+ {
+ String importStr = importDeclaration.getElementName().substring(0, importDeclaration.getElementName().length() - 1);
+ if(annotationQName.endsWith(annotation.getAnnotationName()) && annotationQName.indexOf(importStr) == 0)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private IValue convertExpression(Expression element) throws JavaModelException
+ {
+ switch (element.getNodeType())
+ {
+ case ASTNode.MARKER_ANNOTATION:
+ {
+ MarkerAnnotation ma = (MarkerAnnotation) element;
+ AnnotationImpl annotation = new AnnotationImpl(getFullyQualifiedAnnotationName(ma), new HashSet<IParamValuePair>());
+ annotation.setLocator(createLocator(ma));
+ return annotation;
+ }
+ case ASTNode.SINGLE_MEMBER_ANNOTATION:
+ {
+ final SingleMemberAnnotation sma = (SingleMemberAnnotation) element;
+ final Set<IParamValuePair> values = new HashSet<IParamValuePair>();
+
+ final IValue value = convertExpression(sma.getValue());
+ if (value!=null) {
+ values.add(AnnotationFactory.createParamValuePairValue("value", value)); //$NON-NLS-1$
+ }
+
+ AnnotationImpl annotation = new AnnotationImpl(getFullyQualifiedAnnotationName(sma), values);
+ annotation.setLocator(createLocator(sma));
+ return annotation;
+ }
+ case ASTNode.NORMAL_ANNOTATION:
+ {
+ return getNormalAnnotationValue((NormalAnnotation) element);
+ }
+ case ASTNode.ARRAY_INITIALIZER:
+ {
+ ArrayInitializer arr = (ArrayInitializer) element;
+ List<Expression> list = arr.expressions();
+ Iterator<Expression> iter = list.iterator();
+ Set<IValue> result = new HashSet<IValue>();
+ while (iter.hasNext())
+ {
+ Expression expr = (Expression) iter.next();
+ result.add(convertExpression(expr));
+ }
+ return new ArrayValueImpl(result);
+ }
+ case ASTNode.NULL_LITERAL:
+ {
+ // return AnnotationFactory.createNullValue();
+ break;
+ }
+ case ASTNode.SIMPLE_NAME:
+ {
+ break;//return new StringValueImpl(((SimpleName)element).getIdentifier());
+ }
+ case ASTNode.TYPE_LITERAL:
+ {
+ return getTypeLiteralValue((TypeLiteral) element);
+ }
+ case ASTNode.QUALIFIED_NAME:
+ {
+ QualifiedName qn = (QualifiedName) element;
+ QualifiedNameValueImpl qnValue = new QualifiedNameValueImpl(qn.getFullyQualifiedName());
+ qnValue.setLocator(createLocator(qn));
+ return qnValue;
+ }
+ case ASTNode.BOOLEAN_LITERAL:
+ {
+ BooleanLiteral bl = (BooleanLiteral) element;
+ BooleanValueImpl bValue = new BooleanValueImpl(bl.booleanValue());
+ bValue.setLocator(createLocator(bl));
+ return bValue;
+ }
+ case ASTNode.CHARACTER_LITERAL:
+ {
+ // CharacterLiteral cl = (CharacterLiteral) element;
+ // TODO Finish with this return new CharacterValue(cl.charValue());
+ break;
+ }
+ case ASTNode.NUMBER_LITERAL:
+ {
+ NumberLiteral nl = (NumberLiteral) element;
+ IntegerValueImpl intValue = new IntegerValueImpl(nl.getToken());
+ intValue.setLocator(createLocator(nl));
+ return intValue;
+ }
+ case ASTNode.STRING_LITERAL:
+ {
+ StringLiteral sl = (StringLiteral) element;
+ StringValueImpl strValue = new StringValueImpl(sl.getLiteralValue());
+ strValue.setLocator(createLocator(sl));
+ return strValue;
+ }
+ }
+ return null;
+ }
+
+ private IValue getTypeLiteralValue(TypeLiteral tl) throws JavaModelException
+ {
+ Type type = tl.getType();
+ Name name = null;
+ if (type.isQualifiedType())
+ {
+ name = ((QualifiedType) type).getName();
+ } else
+ {
+ if (type.isSimpleType())
+ {
+ name = ((SimpleType) type).getName();
+ }
+ }
+ if (name != null)
+ {
+ CompilationUnit cu = getCompilationUnit(tl);
+ if (cu != null)
+ {
+ String fullyQualifiedName = name.getFullyQualifiedName();
+ if (type.isSimpleType())
+ {
+ fullyQualifiedName = resolveType((ICompilationUnit) cu.getJavaElement(), fullyQualifiedName);
+ }
+
+ ClassValueImpl cValue = new ClassValueImpl(fullyQualifiedName);
+ cValue.setLocator(createLocator(tl));
+ return cValue;
+ }
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private IValue getNormalAnnotationValue(NormalAnnotation na) throws JavaModelException
+ {
+ List<MemberValuePair> l = na.values();
+ Iterator<MemberValuePair> iter = l.iterator();
+ Set<IParamValuePair> result = new HashSet<IParamValuePair>();
+ while (iter.hasNext())
+ {
+ MemberValuePair mvp = (MemberValuePair) iter.next();
+ IValue mvpval = convertExpression(mvp.getValue());
+ ParamValuePairImpl pair = new ParamValuePairImpl(mvp.getName().getIdentifier(), mvpval);
+ pair.setLocator(createLocator(mvp));
+ result.add(pair);
+ }
+
+ AnnotationImpl annotation = new AnnotationImpl(getFullyQualifiedAnnotationName(na), result);
+ annotation.setLocator(createLocator(na));
+ return annotation;
+ }
+
+ private String getFullyQualifiedAnnotationName(Annotation anno) throws JavaModelException
+ {
+ Name typeName = anno.getTypeName();
+ String fullyQualifiedName = typeName.getFullyQualifiedName();
+ if (typeName.isSimpleName())
+ {
+ CompilationUnit cu = getCompilationUnit(anno);
+ fullyQualifiedName = resolveType((ICompilationUnit) cu.getJavaElement(), fullyQualifiedName);
+ }
+ return fullyQualifiedName;
+ }
+
+ private CompilationUnit getCompilationUnit(Expression element)
+ {
+ ASTNode cu = element;
+ while (cu != null && !(cu instanceof CompilationUnit))
+ {
+ cu = cu.getParent();
+ }
+ return (CompilationUnit) cu;
+ }
+
+ private String resolveType(ICompilationUnit icu, String fullyQualifiedName) throws JavaModelException
+ {
+ String localFullyQualifiedName = fullyQualifiedName;
+ IType[] allTypes = icu.getAllTypes();
+ if (allTypes == null)
+ {
+ return localFullyQualifiedName;
+ }
+
+ for (int i = 0; i < allTypes.length; i++)
+ {
+ String[][] resolvedType = allTypes[i].resolveType(localFullyQualifiedName);
+ if (resolvedType != null && resolvedType.length > 0)
+ {
+ StringBuffer buf = new StringBuffer();
+ for (int j = 0; j < resolvedType[0].length; j++)
+ {
+ buf = appendDot(j, buf);
+ buf.append(resolvedType[0][j]);
+ }
+ localFullyQualifiedName = buf.toString();
+ break;
+ }
+ }
+
+ return localFullyQualifiedName;
+ }
+
+ private StringBuffer appendDot(int index, StringBuffer buff)
+ {
+ StringBuffer result = buff;
+ if (index != 0)
+ {
+ result.append('.');
+ }
+ return result;
+ }
+
+ protected <T extends IJavaElement> IAnnotation<T> getSpecificAnnotationFromMember(final T type, final String className, final String annotationQName) throws JavaModelException
+ {
+ if (!isSupportedJavaElement(type))
+ {
+ throw new IllegalArgumentException("passed argument is not of correct type."); //$NON-NLS-1$
+ }
+
+ ICompilationUnit cUnit = null;
+ if (type instanceof IMember) {
+ cUnit = ((IMember)type).getCompilationUnit();
+ }
+ else {
+ cUnit = ((ITypeParameter)type).getDeclaringMember().getCompilationUnit();
+ }
+
+ if (cUnit == null) {
+ return null;
+ }
+
+ final CompilationUnit unit = getCompilationUnit();
+ final AbstractTypeDeclaration typeDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, unit);
+
+ switch(type.getElementType())
+ {
+ case IJavaElement.TYPE:
+ return getSpecificAnnotation(type, typeDeclaration, (IType)type, annotationQName);
+
+ case IJavaElement.FIELD:
+ IField field = (IField) type;
+ FieldDeclaration fieldDeclaration = ASTUtils.getInstance().getFieldDeclaration(field, (TypeDeclaration)typeDeclaration);
+ return getSpecificAnnotation(type, fieldDeclaration, field.getDeclaringType(), annotationQName);
+
+ case IJavaElement.METHOD:
+ IMethod method = (IMethod) type;
+ MethodDeclaration methodDeclaration = ASTUtils.getInstance().getMethodDeclaration(method, (TypeDeclaration)typeDeclaration);
+ return getSpecificAnnotation(type, methodDeclaration, method.getDeclaringType(), annotationQName);
+
+ case IJavaElement.TYPE_PARAMETER:
+ method = (IMethod)((ITypeParameter) type).getParent();
+ methodDeclaration = ASTUtils.getInstance().getMethodDeclaration(method, (TypeDeclaration)typeDeclaration);
+ return getSpecificParamAnnotation(type, methodDeclaration, method.getDeclaringType(), annotationQName);
+ }
+
+ return null;
+ }
+
+ private <T extends IJavaElement> IAnnotation<T> getSpecificAnnotation(final T iMember, final BodyDeclaration bodyDeclaration, final IType type, final String annotationQName) throws JavaModelException
+ {
+ if (bodyDeclaration != null)
+ {
+ @SuppressWarnings("unchecked")
+ final List list = bodyDeclaration.modifiers();
+ return extractSpecificAnnotation(iMember, list, type, annotationQName);
+ }
+ return null;
+ }
+
+ private <T extends IJavaElement> IAnnotation<T> getSpecificParamAnnotation(T iMember, MethodDeclaration methodDeclaration, final IType type, final String annotationQName) throws JavaModelException
+ {
+ if (methodDeclaration != null)
+ {
+ for (Object param : methodDeclaration.parameters())
+ {
+ if (param instanceof SingleVariableDeclaration &&
+ ((ITypeParameter)iMember).getElementName().toString().equals(((SingleVariableDeclaration)param).getName().toString()))
+ {
+ @SuppressWarnings("unchecked")
+ final List list = ((SingleVariableDeclaration) param).modifiers();
+
+ return extractSpecificAnnotation(iMember, list, type, annotationQName);
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean isSupportedJavaElement(final IJavaElement javaElement)
+ {
+ return javaElement.getElementType()==IJavaElement.METHOD ||
+ javaElement.getElementType()==IJavaElement.TYPE ||
+ javaElement.getElementType()==IJavaElement.FIELD ||
+ javaElement.getElementType()==IJavaElement.TYPE_PARAMETER;
+ }
+
+ private CompilationUnit getCompilationUnit()
+ {
+ if (cUnit==null) {
+ cUnit = ASTUtils.getInstance().createCompilationUnit(iType.getCompilationUnit(), null);
+ }
+
+ return cUnit;
+ }
+
+ private ILocator createLocator(final ASTNode node)
+ {
+ final int lineNumber = getCompilationUnit().getLineNumber(node.getStartPosition());
+ return new LocatorImpl(lineNumber, node.getStartPosition(), node.getLength());
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationProperty.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationProperty.java
new file mode 100755
index 0000000..3c17bfc
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationProperty.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationProperty;
+
+
+public class AnnotationProperty implements IAnnotationProperty
+{
+ private String annotationName;
+ private String attributeName;
+ private String value;
+ private AttributeTypeEnum attributeType;
+
+ /**
+ * Public constructor for AnnotationProperty objects
+ *
+ * @param annotationName - String representation of the Name for the Annotation.
+ * @param attributeName - String representation of the Name for the Attribute.
+ * @param value - String representation of the Value for the Attribute.
+ */
+ public AnnotationProperty(final String annotationName, final String attributeName, final String value, final AttributeTypeEnum attributeType)
+ {
+ this.annotationName = annotationName;
+ this.attributeName = attributeName;
+ this.value = value;
+ this.attributeType = attributeType;
+ }
+
+ public String getAnnotationName()
+ {
+ return this.annotationName;
+ }
+
+ public String getAttributeName()
+ {
+ return this.attributeName;
+ }
+
+ public String getValue()
+ {
+ return this.value;
+ }
+
+ public AttributeTypeEnum getAttributeType()
+ {
+ return this.attributeType;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationPropertyContainer.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationPropertyContainer.java
new file mode 100755
index 0000000..5b018cd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationPropertyContainer.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import java.lang.annotation.ElementType;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationPropertyContainer;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class AnnotationPropertyContainer implements IAnnotationPropertyContainer
+{
+ private Map<String, Set<IParamValuePair>> typeAnnotationName2ParamValuesMap =
+ new HashMap<String, Set<IParamValuePair>>();
+ private Map<String, Set<IParamValuePair>> methodAnnotationName2ParamValuesMap =
+ new HashMap<String, Set<IParamValuePair>>();
+ private Map<String, Set<IParamValuePair>> parameterAnnotationName2ParamValuesMap =
+ new HashMap<String, Set<IParamValuePair>>();
+
+ /**
+ * Add Annotation Property to the container.
+ *
+ * @throws NullPointerException if the <code>target</code> or <code>annotationProperty</code> is <code>null</code>.
+ */
+ public void addAnnotationProperty(final AnnotationProperty annotationProperty, final ElementType target)
+ {
+ if(annotationProperty == null)
+ {
+ throw new NullPointerException("annotationProperty could not be null!"); //$NON-NLS-1$
+ }
+ if(target == null)
+ {
+ throw new NullPointerException("target could not be null!"); //$NON-NLS-1$
+ }
+
+ if(!(target.equals(ElementType.TYPE)) && !(target.equals(ElementType.METHOD)) && !(target.equals(ElementType.PARAMETER)))
+ {
+ throw new IllegalArgumentException("target parameter is not of correct type"); //$NON-NLS-1$
+ }
+ Map<String, Set<IParamValuePair>> annotationName2ParamValuesMap = null;
+
+ if(target.equals(ElementType.TYPE))
+ {
+ annotationName2ParamValuesMap = typeAnnotationName2ParamValuesMap;
+ }
+ if(target.equals(ElementType.METHOD))
+ {
+ annotationName2ParamValuesMap = methodAnnotationName2ParamValuesMap;
+ }
+ if(target.equals(ElementType.PARAMETER))
+ {
+ annotationName2ParamValuesMap = parameterAnnotationName2ParamValuesMap;
+ }
+
+
+ Set<IParamValuePair> paramValuesSet = annotationName2ParamValuesMap.get(annotationProperty.getAnnotationName());
+ if(paramValuesSet == null)
+ {
+ paramValuesSet = new HashSet<IParamValuePair>();
+ annotationName2ParamValuesMap.put(annotationProperty.getAnnotationName(), paramValuesSet);
+ }
+
+ IValue value = null;
+ if(annotationProperty.getAttributeType() == null)
+ {
+ return;
+ }
+
+ if(annotationProperty.getAttributeType().equals(AttributeTypeEnum.BOOLEAN))
+ {
+ value = AnnotationFactory.createBooleanValue(new Boolean(annotationProperty.getValue()));
+ }
+ if(annotationProperty.getAttributeType().equals(AttributeTypeEnum.CLASS))
+ {
+ //TODO change this!!!!!!
+ //value = AnnotationFactory.createClassValue(annotationProperty.getValue());
+ }
+ if(annotationProperty.getAttributeType().equals(AttributeTypeEnum.INTEGER))
+ {
+ value = AnnotationFactory.createIntegerValue(annotationProperty.getValue());
+ }
+ if(annotationProperty.getAttributeType().equals(AttributeTypeEnum.QUALIFIED_NAME))
+ {
+ value = AnnotationFactory.createQualifiedNameValue(annotationProperty.getValue());
+ }
+ if(value == null)
+ {
+ value = AnnotationFactory.createStringValue(annotationProperty.getValue());
+ }
+
+ IParamValuePair paramValuePair = AnnotationFactory.createParamValuePairValue(annotationProperty.getAttributeName(), value);
+
+ paramValuesSet.add(paramValuePair);
+ }
+ /**
+ * @param ITypeParameter
+ * @return Set with all Annotation from the container, which are ITypeParameter relevant.
+ */
+ public Set<IAnnotation<ITypeParameter>> getParameterAnnotations(ITypeParameter tParam)
+ {
+ return getAnnotations(ElementType.PARAMETER, tParam);
+ }
+
+ /**
+ * @return Set with all Annotation from the container, which are IType relevant.
+ */
+ public Set<IAnnotation<IType>> getTypeAnnotations(IType type)
+ {
+ return getAnnotations(ElementType.TYPE, type);
+ }
+
+ /**
+ * @return Set with all Annotation from the container, which are IMethod relevant.
+ */
+ public Set<IAnnotation<IMethod>> getMethodAnnotations(IMethod method)
+ {
+ return getAnnotations(ElementType.METHOD , method);
+ }
+
+ private <T extends IJavaElement> Set<IAnnotation<T>> getAnnotations(final ElementType target, final T iTarget)
+ {
+ if(!(target.equals(ElementType.TYPE)) && !(target.equals(ElementType.METHOD)) && !(target.equals(ElementType.PARAMETER)))
+ {
+ throw new IllegalArgumentException("target parameter is not of correct type"); //$NON-NLS-1$
+ }
+
+ Map<String, Set<IParamValuePair>> annotationName2ParamValuesMap = null;
+ if(target.equals(ElementType.TYPE))
+ {
+ annotationName2ParamValuesMap = typeAnnotationName2ParamValuesMap;
+ }
+ if(target.equals(ElementType.METHOD))
+ {
+ annotationName2ParamValuesMap = methodAnnotationName2ParamValuesMap;
+ }
+ if(target.equals(ElementType.PARAMETER))
+ {
+ annotationName2ParamValuesMap = parameterAnnotationName2ParamValuesMap;
+ }
+ Set<IAnnotation<T>> result = new HashSet<IAnnotation<T>>();
+ Set<String> keys = annotationName2ParamValuesMap.keySet();
+ for (String key : keys)
+ {
+ Set<IParamValuePair> paramValuePairsSet = annotationName2ParamValuesMap.get(key);
+ IAnnotation<T> annotation = AnnotationFactory.createAnnotation(key, paramValuePairsSet, iTarget);
+ result.add(annotation);
+ }
+
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationUtils.java
new file mode 100755
index 0000000..c855a1b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AnnotationUtils.java
@@ -0,0 +1,528 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import java.io.FileNotFoundException;
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IExtendedModifier;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.clazz.ASTUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.jst.ws.jaxws.utils.resources.EditResourcesManager;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+import org.eclipse.jst.ws.jaxws.utils.resources.IFileUtils;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ * Contains utilities for getting AST objects needed in annotation processing
+ *
+ * @author Plamen Pavlov
+ */
+public class AnnotationUtils
+{
+ private static AnnotationUtils utils = null;
+ private final IFileUtils fileUtils = FileUtils.getInstance();
+
+ /**
+ * The factory method.
+ *
+ * @return a AnnotationUtils instance.
+ */
+ public static AnnotationUtils getInstance()
+ {
+ if (utils == null)
+ {
+ utils = new AnnotationUtils();
+ }
+ return utils;
+ }
+
+ /**
+ * Gets IDocument, which coresponds to one CompilationUnit.
+ *
+ * @param unit -
+ * Compilation Unit, which will be used as starting point to get the IDocument.
+ *
+ * @return IDocument which is found.
+ *
+ * @throws CoreException
+ */
+ public IDocument getDocument(ICompilationUnit unit) throws CoreException
+ {
+ String source = unit.getBuffer().getContents();
+ return new Document(source);
+ }
+
+ /**
+ * Removes Annotations of specified IJavaElement.
+ *
+ * @param javaElement - IJavaElement which will be used as starting poin for removing the annotations.
+ * @param annotations - Set which contains String values for the annotations which will be removed. If this Set is empty all Annotations will be removed.
+ * @param deepRemove - Boolean value, representing whether Annotations from javaElemet childs will be removed.
+ * @throws AnnotationGeneratorException
+ *
+ * @throws AnnotationGeneratorException
+ * thown if AST TypeDeclaration cannot be found for <code>type</code> and also is used as wrapper in case {@link CoreException} or
+ * {@link BadLocationException} is thrown while processing.
+ * @throws BadLocationException
+ * @throws CoreException
+ * @throws FileNotFoundException
+ * @throws MalformedTreeException
+ */
+ public void removeAnnotations(IJavaElement javaElement, Set<String> annotations, boolean deepRemove) throws AnnotationGeneratorException, MalformedTreeException, FileNotFoundException, CoreException, BadLocationException
+ {
+ if(javaElement instanceof IType)
+ {
+ IType type = (IType)javaElement;
+ ICompilationUnit cUnit = type.getCompilationUnit();
+ String className = type.getElementName();
+ CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(cUnit, null);
+
+ AbstractTypeDeclaration typeDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, unit);
+ if (typeDeclaration == null)
+ {
+ throw new AnnotationGeneratorException("typeDeclaration should not be null",//$NON-NLS-1$
+ MessageFormat.format(JaxWsUtilMessages.AnnotationUtils_ParamShouldNotBeNullMsg, "typeDeclaration")); //$NON-NLS-1$
+ }
+
+ removeTypeAnnotations(type, typeDeclaration, unit, cUnit, annotations);
+
+ if(!deepRemove)
+ {
+ return;
+ }
+
+ IField[] tmpFields = type.getFields();
+ if (tmpFields != null && tmpFields.length > 0)
+ {
+ for (IField tmpField : tmpFields)
+ {
+ removeFieldAnnotations(tmpField, type, cUnit, annotations);
+ }
+ }
+
+ IMethod[] tmpMethods = type.getMethods();
+ if (tmpMethods != null && tmpMethods.length > 0)
+ {
+ for (IMethod tmpMethod : tmpMethods)
+ {
+ removeMethodAnnotations(tmpMethod, type, cUnit, annotations);
+
+ //Remove params annotations
+ for (String paramName : tmpMethod.getParameterNames())
+ {
+ ITypeParameter typeParameter = tmpMethod.getTypeParameter(paramName);
+ removeParamAnnotations(typeParameter, type, cUnit, annotations, paramName);
+ }
+ }
+ }
+ }
+
+ if(javaElement instanceof IField)
+ {
+ IField field = (IField)javaElement;
+ IType declaringType = field.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+
+ removeFieldAnnotations(field, declaringType, declaringTypeCompUnit, annotations);
+ }
+
+ if(javaElement instanceof IMethod)
+ {
+ IMethod method = (IMethod)javaElement;
+ IType declaringType = method.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+
+ removeMethodAnnotations(method, declaringType, declaringTypeCompUnit, annotations);
+ if(!deepRemove)
+ {
+ return;
+ }
+
+ //Remove params annotations
+ for (String paramName: method.getParameterNames())
+ {
+ ITypeParameter param = method.getTypeParameter(paramName);
+ removeParamAnnotations(param, declaringType, declaringTypeCompUnit, annotations, paramName);
+ }
+ }
+
+ if(javaElement instanceof ITypeParameter)
+ {
+ ITypeParameter typeParameter = (ITypeParameter)javaElement;
+ IMethod tmpMethod = (IMethod) typeParameter.getDeclaringMember();
+ //TODO check this
+ //param.getParent();
+ IType declaringType = tmpMethod.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+ //TODO FIX THIS
+ removeParamAnnotations(typeParameter, declaringType, declaringTypeCompUnit, annotations, null);
+ }
+ }
+
+ private void removeTypeAnnotations(IType type, AbstractTypeDeclaration typeDeclaration, CompilationUnit unit, ICompilationUnit cUnit, Set<String> annotationsSet) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ unit.recordModifications();
+ if (removeAnnotations(typeDeclaration.modifiers(), annotationsSet))
+ {
+ IDocument doc = AnnotationUtils.getInstance().getDocument(cUnit);
+ TextEdit edit = unit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(cUnit, doc);
+ }
+ }
+
+ private void removeFieldAnnotations(IField field, IType declaringType, ICompilationUnit declaringTypeCompUnit, Set<String> annotationsSet) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ ICompilationUnit fcUnit = field.getCompilationUnit();
+ String className = declaringType.getElementName();
+ CompilationUnit fUnit = ASTUtils.getInstance().createCompilationUnit(fcUnit, null);
+
+ BodyDeclaration fBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, fUnit);
+ fBodyDeclaration = ASTUtils.getInstance().getFieldDeclaration(field, (TypeDeclaration) fBodyDeclaration);
+
+ fUnit.recordModifications();
+ if (removeAnnotations(fBodyDeclaration.modifiers(), annotationsSet))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = fUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+
+ private void removeMethodAnnotations(IMethod method, IType declaringType, ICompilationUnit declaringTypeCompUnit, Set<String> annotationsSet) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ ICompilationUnit mcUnit = method.getCompilationUnit();
+ String className = declaringType.getElementName();
+ CompilationUnit mUnit = ASTUtils.getInstance().createCompilationUnit(mcUnit, null);
+
+ BodyDeclaration mBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, mUnit);
+ mBodyDeclaration = ASTUtils.getInstance().getMethodDeclaration(method, (TypeDeclaration) mBodyDeclaration);
+ mUnit.recordModifications();
+ if (removeAnnotations(mBodyDeclaration.modifiers(), annotationsSet))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = mUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+
+ private void removeParamAnnotations(ITypeParameter param, IType declaringType, ICompilationUnit declaringTypeCompUnit, Set<String> annotationsSet, String paramName) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ IMethod tmpMethod = (IMethod)param.getDeclaringMember();
+ //TODO check this
+ //param.getParent();
+ String className = declaringType.getElementName();
+ ICompilationUnit mcUnit = tmpMethod.getCompilationUnit();
+ CompilationUnit mUnit = ASTUtils.getInstance().createCompilationUnit(mcUnit, null);
+
+ BodyDeclaration mBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, mUnit);
+ mBodyDeclaration = ASTUtils.getInstance().getMethodDeclaration(tmpMethod, (TypeDeclaration) mBodyDeclaration);
+ mUnit.recordModifications();
+
+ for (Object object : ((MethodDeclaration) mBodyDeclaration).parameters())
+ {
+ if (object instanceof SingleVariableDeclaration)
+ {
+ SingleVariableDeclaration svd = (SingleVariableDeclaration) object;
+ if ((paramName == null || svd.getName().toString().equals(paramName)) &&
+ removeAnnotations(svd.modifiers(), annotationsSet))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = mUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+ }
+ }
+
+ private void saveContent(ICompilationUnit cUnit, IDocument doc) throws FileNotFoundException, JavaModelException, AnnotationGeneratorException
+ {
+ IStatus status = (new EditResourcesManager()).setFileEditable((IFile) cUnit.getResource());
+ if(status.getSeverity() == IStatus.OK )
+ {
+ fileUtils.setCompilationUnitContentAndSaveDirtyEditors(cUnit, doc.get(), true, null);
+ }
+ else
+ {
+ throw new AnnotationGeneratorException("Annotattion could not be stored, the file is not writable", //$NON-NLS-1$
+ JaxWsUtilMessages.AnnotationCannotBeStoredMsg);
+ }
+ }
+
+ /**
+ * Removes specific Annotation of specified IJavaElement.
+ *
+ * @param javaElement - IJavaElement which will be used as starting poin for removing the Annotation.
+ * @param annotationName - String which is the representation Name of the Annotation, which will be removed.
+ *
+ * @throws AnnotationGeneratorException
+ * @throws AnnotationGeneratorException
+ * thown if AST TypeDeclaration cannot be found for <code>type</code> and also is used as wrapper in case {@link CoreException} or
+ * {@link BadLocationException} is thrown while processing.
+ * @throws BadLocationException
+ * @throws CoreException
+ * @throws FileNotFoundException
+ * @throws MalformedTreeException
+ */
+ public void removeAnnotation(IJavaElement javaElement, String annotationName) throws AnnotationGeneratorException, FileNotFoundException, CoreException, BadLocationException
+ {
+ if(javaElement instanceof IType)
+ {
+ IType type = (IType)javaElement;
+ ICompilationUnit cUnit = type.getCompilationUnit();
+ String className = type.getElementName();
+ CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(cUnit, null);
+
+ AbstractTypeDeclaration typeDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, unit);
+ if (typeDeclaration == null)
+ {
+ throw new AnnotationGeneratorException("typeDeclaration should not be null", //$NON-NLS-1$
+ MessageFormat.format(JaxWsUtilMessages.AnnotationUtils_ParamShouldNotBeNullMsg, "typeDeclaration")); //$NON-NLS-1$
+ }
+
+ removeTypeAnnotation(type, typeDeclaration, unit, cUnit, annotationName);
+
+ }
+
+ if(javaElement instanceof IField)
+ {
+ IField field = (IField)javaElement;
+ IType declaringType = field.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+
+ removeFieldAnnotation(field, declaringType, declaringTypeCompUnit, annotationName);
+ }
+
+ if(javaElement instanceof IMethod)
+ {
+ IMethod method = (IMethod)javaElement;
+ IType declaringType = method.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+
+ removeMethodAnnotation(method, declaringType, declaringTypeCompUnit, annotationName);
+ }
+
+ if(javaElement instanceof ITypeParameter)
+ {
+ ITypeParameter typeParameter = (ITypeParameter)javaElement;
+ IMethod tmpMethod = (IMethod) typeParameter.getDeclaringMember();
+ //TODO check this
+ //param.getParent();
+ IType declaringType = tmpMethod.getDeclaringType();
+ ICompilationUnit declaringTypeCompUnit = declaringType.getCompilationUnit();
+
+ removeParamAnnotation(typeParameter, declaringType, declaringTypeCompUnit, annotationName);
+ }
+ }
+
+ private void removeTypeAnnotation(IType type, AbstractTypeDeclaration typeDeclaration, CompilationUnit unit, ICompilationUnit cUnit, String annotationName) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ unit.recordModifications();
+ if (removeAnnotation(typeDeclaration.modifiers(), annotationName))
+ {
+ IDocument doc = AnnotationUtils.getInstance().getDocument(cUnit);
+ TextEdit edit = unit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(cUnit, doc);
+ }
+ }
+
+ private void removeFieldAnnotation(IField field, IType declaringType, ICompilationUnit declaringTypeCompUnit, String annotationName) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ ICompilationUnit fcUnit = field.getCompilationUnit();
+ String className = declaringType.getElementName();
+ CompilationUnit fUnit = ASTUtils.getInstance().createCompilationUnit(fcUnit, null);
+
+ BodyDeclaration fBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, fUnit);
+ fBodyDeclaration = ASTUtils.getInstance().getFieldDeclaration(field, (TypeDeclaration) fBodyDeclaration);
+
+ fUnit.recordModifications();
+ if (removeAnnotation(fBodyDeclaration.modifiers(), annotationName))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = fUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+
+ private void removeMethodAnnotation(IMethod method, IType declaringType, ICompilationUnit declaringTypeCompUnit, String annotationName) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ ICompilationUnit mcUnit = method.getCompilationUnit();
+ String className = declaringType.getElementName();
+ CompilationUnit mUnit = ASTUtils.getInstance().createCompilationUnit(mcUnit, null);
+
+ BodyDeclaration mBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, mUnit);
+ mBodyDeclaration = ASTUtils.getInstance().getMethodDeclaration(method, (TypeDeclaration) mBodyDeclaration);
+ mUnit.recordModifications();
+ if(removeAnnotation(mBodyDeclaration.modifiers(), annotationName))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = mUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+
+ private void removeParamAnnotation(ITypeParameter param, IType declaringType, ICompilationUnit declaringTypeCompUnit, String annotationName) throws CoreException, MalformedTreeException, BadLocationException, FileNotFoundException, AnnotationGeneratorException
+ {
+ IMethod tmpMethod = (IMethod)param.getDeclaringMember();
+ //TODO check this
+ //param.getParent();
+ String className = declaringType.getElementName();
+ ICompilationUnit mcUnit = tmpMethod.getCompilationUnit();
+ className = tmpMethod.getParent().getElementName();
+ CompilationUnit mUnit = ASTUtils.getInstance().createCompilationUnit(mcUnit, null);
+
+ BodyDeclaration mBodyDeclaration = ASTUtils.getInstance().getTypeDeclaration(className, mUnit);
+ mBodyDeclaration = ASTUtils.getInstance().getMethodDeclaration(tmpMethod, (TypeDeclaration) mBodyDeclaration);
+
+ mUnit.recordModifications();
+ for (Object object : ((MethodDeclaration) mBodyDeclaration).parameters())
+ {
+ if (object instanceof SingleVariableDeclaration)
+ {
+ if (removeAnnotation(((SingleVariableDeclaration) object).modifiers(), annotationName))
+ {
+ IDocument doc = getDocument(declaringTypeCompUnit);
+ TextEdit edit = mUnit.rewrite(doc, null);
+ edit.apply(doc);
+
+ saveContent(declaringTypeCompUnit, doc);
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes specific annotation from the list of modifiers.
+ *
+ * @param modifiers
+ * @param annotationName
+ *
+ * @return boolean value, which represents wheter the annotation is removed or not.
+ */
+ @SuppressWarnings("unchecked")
+ private boolean removeAnnotation(List modifiers, String annotationName)
+ {
+ Annotation[] mAnnotations = extractAnnotations(modifiers);
+ for (Annotation mAnnotation : mAnnotations)
+ {
+ if(validateAnnotatation(mAnnotation, annotationName))
+ {
+ modifiers.remove(mAnnotation);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean removeAnnotations(List modifiers, Set<String> annotationsSet)
+ {
+ boolean changed = false;
+ Annotation[] mAnnotations = extractAnnotations(modifiers);
+ for (int mai = 0; mai < mAnnotations.length; mai++)
+ {
+ if (annotationsSet != null)
+ {
+ if (annotationsSet.contains(mAnnotations[mai].getTypeName().getFullyQualifiedName()))
+ {
+ modifiers.remove(mAnnotations[mai]);
+ changed = true;
+ }
+ } else
+ {
+ modifiers.remove(mAnnotations[mai]);
+ changed = true;
+ }
+ }
+
+ return changed;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Annotation[] extractAnnotations(List modifiers)
+ {
+ Iterator iterator = modifiers.iterator();
+ Set<Annotation> annotationsSet = new HashSet<Annotation>();
+
+ while (iterator.hasNext())
+ {
+ IExtendedModifier modif = (IExtendedModifier) iterator.next();
+ if (modif.isAnnotation())
+ {
+ annotationsSet.add((Annotation) modif);
+ }
+ }
+
+ return annotationsSet.toArray(new Annotation[annotationsSet.size()]);
+ }
+
+ private boolean validateAnnotatation(Annotation mAnnotation, String annotationName)
+ {
+ String mAnnotationString = mAnnotation.toString();
+ int index = mAnnotationString.indexOf("("); //$NON-NLS-1$
+ if(index == -1)
+ {
+ mAnnotationString = mAnnotationString.trim();
+ }
+ else
+ {
+ mAnnotationString = mAnnotationString.substring(0, index).trim();
+ }
+
+ if(mAnnotationString.endsWith(annotationName))
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ArrayValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ArrayValueImpl.java
new file mode 100755
index 0000000..331862b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ArrayValueImpl.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+/**
+ * Implementation for {@link IArrayValue}
+ *
+ * @author Plamen Pavlov
+ */
+public class ArrayValueImpl extends ValueImpl
+{
+ private Set<IValue> values = new HashSet<IValue>();
+
+ /**
+ * Construction
+ *
+ * @param values
+ * @throws NullPointerException
+ * in case <code>values</code> is <code>null</code>.
+ */
+ public ArrayValueImpl(Set<IValue> values)
+ {
+ if (values == null)
+ {
+ throw new NullPointerException("values should not be null"); //$NON-NLS-1$
+ }
+
+ this.values = values;
+ }
+
+ @Override
+ public String toString()
+ {
+ String result = "["; //$NON-NLS-1$
+ boolean first = true;
+ for (IValue value : values)
+ {
+ if(first)
+ {
+ result = result + value.toString();
+ first = false;
+ }
+ else
+ {
+ result = result + ", " + value.toString(); //$NON-NLS-1$
+ }
+ }
+ result = result + "]"; //$NON-NLS-1$
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ //TODO check this method
+ ArrayInitializer arr = ast.newArrayInitializer();
+ for (IValue value : values)
+ {
+ arr.expressions().add(((ValueImpl) value).getExpression(unit, ast));
+ }
+
+ return arr;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Arrays.hashCode(values.toArray(new IValue[values.size()]));
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final ArrayValueImpl other = (ArrayValueImpl) obj;
+ return Arrays.equals(values.toArray(new IValue[values.size()]), other.values.toArray(new IValue[values.size()]));
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AttributeTypeEnum.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AttributeTypeEnum.java
new file mode 100755
index 0000000..a0ba607
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/AttributeTypeEnum.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+public enum AttributeTypeEnum
+{
+ BOOLEAN("Boolean"), //$NON-NLS-1$
+ CLASS("Class"), //$NON-NLS-1$
+ INTEGER("Integer"), //$NON-NLS-1$
+ QUALIFIED_NAME("Qualified Name"), //$NON-NLS-1$
+ STRING("String"); //$NON-NLS-1$
+
+ private final String value;
+
+ AttributeTypeEnum(final String value)
+ {
+ this.value = value;
+ }
+
+ final String getValue()
+ {
+ return this.value;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/BooleanValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/BooleanValueImpl.java
new file mode 100755
index 0000000..45fe1f9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/BooleanValueImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+
+/**
+ * Implementation for {@link IBooleanValue}
+ *
+ * @author Plamen Pavlov
+ */
+public class BooleanValueImpl extends ValueImpl
+{ //$JL-EQUALS$
+ private boolean value;
+
+ /**
+ * Constructor
+ *
+ * @param value
+ */
+ public BooleanValueImpl(boolean value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ return ast.newBooleanLiteral(value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return Boolean.toString(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final BooleanValueImpl other = (BooleanValueImpl) obj;
+ return value == other.value;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ClassValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ClassValueImpl.java
new file mode 100755
index 0000000..bdcea51
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ClassValueImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+
+public class ClassValueImpl extends ValueImpl
+{
+ private String classQName;
+
+ public ClassValueImpl(String classQName)
+ {
+ this.classQName = classQName;
+ }
+
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ String clsName = this.classQName;
+ if (addImports(ast, unit, clsName))
+ {
+ clsName = getSimpleName(clsName);
+ }
+ Name name = ast.newName(clsName);
+ SimpleType simpleType = ast.newSimpleType(name);
+ TypeLiteral literal = ast.newTypeLiteral();
+ literal.setType(simpleType);
+ return literal;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.classQName;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return this.classQName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final ClassValueImpl other = (ClassValueImpl) obj;
+ return this.classQName.equals(other.classQName);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/IntegerValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/IntegerValueImpl.java
new file mode 100755
index 0000000..faffe0f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/IntegerValueImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.NumberLiteral;
+
+/**
+ * Implementor for IIntegerValue
+ *
+ * @author Plamen Pavlov
+ */
+public class IntegerValueImpl extends ValueImpl
+{
+ private String value;
+
+ /**
+ * Constructor
+ *
+ * @param value
+ */
+ public IntegerValueImpl(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ NumberLiteral literal = ast.newNumberLiteral();
+ literal.setToken(new Integer(value).toString());
+ return literal;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return new Integer(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final IntegerValueImpl other = (IntegerValueImpl) obj;
+ return value == other.value;
+ }
+
+ @Override
+ public String toString()
+ {
+ return value;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/LocatorImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/LocatorImpl.java
new file mode 100755
index 0000000..89e859a
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/LocatorImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+/**
+ * Implementor of {@link ILocator} interface
+ */
+public class LocatorImpl implements ILocator
+{
+ private int lineNumber;
+ private int startPosition;
+ private int length;
+
+ public LocatorImpl(final int lineNumber, final int startPosition, final int length)
+ {
+ this.length = length;
+ this.startPosition = startPosition;
+ this.lineNumber = lineNumber;
+ }
+
+ public int getLength()
+ {
+ return this.length;
+ }
+
+ public int getStartPosition()
+ {
+ return this.startPosition;
+ }
+
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ParamValuePairImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ParamValuePairImpl.java
new file mode 100755
index 0000000..9ce31d7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ParamValuePairImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+/**
+ * @author Plamen Pavlov
+ */
+
+public class ParamValuePairImpl implements IParamValuePair
+{
+
+ private ILocator locator = null;
+
+
+ private String param;
+
+ private IValue value;
+
+ /**
+ * Constructor
+ *
+ * @param param
+ * @param value
+ */
+ public ParamValuePairImpl(String param, IValue value)
+ {
+ this.param = param;
+ this.value = value;
+ }
+
+ public String getParam()
+ {
+ return param;
+ }
+
+ public IValue getValue()
+ {
+ return value;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ if(value != null)
+ {
+ return 31 * param.hashCode() + value.hashCode();
+ }
+ else
+ {
+ return 31 * param.hashCode();
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final ParamValuePairImpl other = (ParamValuePairImpl) obj;
+ if (!param.equals(other.param))
+ {
+ return false;
+ }
+ return value.equals(other.value);
+ }
+
+ public ILocator getLocator()
+ {
+ return this.locator;
+ }
+
+ public void setLocator(final ILocator locator)
+ {
+ this.locator = locator;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/QualifiedNameValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/QualifiedNameValueImpl.java
new file mode 100755
index 0000000..5bb66cf
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/QualifiedNameValueImpl.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+
+/**
+ * Implementor for {@link IQualifiedNameValue}
+ *
+ * @author Plamen Pavlov
+ */
+public class QualifiedNameValueImpl extends ValueImpl
+{
+ private String value;
+
+ /**
+ * Constructor
+ *
+ * @param value
+ */
+ public QualifiedNameValueImpl(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ // "javax.ejb.TransactionAttributeType.REQUIRED"
+ int i = value.lastIndexOf('.');
+ if (i != -1)
+ {
+ String clsName = value.substring(0, i);
+ if (addImports(ast, unit, clsName))
+ {
+ return ast.newName(getSimpleName(clsName) + value.substring(i));
+ }
+ }
+ return ast.newName(value);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final QualifiedNameValueImpl other = (QualifiedNameValueImpl) obj;
+ return value.equals(other.value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return value;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/StringValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/StringValueImpl.java
new file mode 100755
index 0000000..58bd1b7
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/StringValueImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.StringLiteral;
+
+/**
+ * Implementor for IStringValue
+ *
+ * @author Plamen Pavlov
+ */
+public class StringValueImpl extends ValueImpl
+{
+ private String value;
+
+ /**
+ * Constructor
+ *
+ * @param value
+ */
+ public StringValueImpl(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ protected Expression getExpression(CompilationUnit unit, AST ast)
+ {
+ StringLiteral literal = ast.newStringLiteral();
+ literal.setLiteralValue(value);
+ return literal;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final StringValueImpl other = (StringValueImpl) obj;
+ return value.equals(other.value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return value;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ValueImpl.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ValueImpl.java
new file mode 100755
index 0000000..88c5715
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/annotations/impl/ValueImpl.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+/**
+ * @author Plamen Pavlov
+ */
+
+public abstract class ValueImpl implements IValue
+{
+ private ILocator locator = null;
+
+ protected abstract Expression getExpression(CompilationUnit unit, AST ast);
+
+
+ @SuppressWarnings("unchecked")
+ protected boolean addImports(AST ast, CompilationUnit unit, String annotationName)
+ {
+ String packageAnnotationName = getPackageName(annotationName);
+ if (packageAnnotationName == null)
+ {
+ return false;
+ }
+
+ if (packageAnnotationName.equals("java.lang")) //$NON-NLS-1$
+ {
+ return true;
+ }
+ if (unit != null)
+ {
+ ImportDeclaration imp = ast.newImportDeclaration();
+ imp.setName(ast.newName(annotationName));
+ List<ImportDeclaration> imports = unit.imports();
+ String imp1 = getImport(imports, getSimpleName(annotationName));
+ if (imp1 == null)
+ {
+ if (getOnDemandImport(imports, packageAnnotationName) == null)
+ {
+ imports.add(imp);
+ }
+ } else
+ {
+ if (!imp1.equals(annotationName))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ protected static String getImport(List<ImportDeclaration> imports, String imp)
+ {
+ Iterator<ImportDeclaration> iter = imports.iterator();
+ while (iter.hasNext())
+ {
+ ImportDeclaration next = iter.next();
+ Name fqName = next.getName();
+ SimpleName name;
+ if (fqName.isQualifiedName())
+ {
+ name = ((QualifiedName) fqName).getName();
+ } else
+ {
+ name = (SimpleName) fqName;
+ }
+ String simpleName = name.getIdentifier();
+ if (imp.equals(simpleName))
+ {
+ return fqName.getFullyQualifiedName();
+ }
+ }
+ return null;
+ }
+
+ protected static String getOnDemandImport(List<ImportDeclaration> imports, String imp)
+ {
+ Iterator<ImportDeclaration> iter = imports.iterator();
+ while (iter.hasNext())
+ {
+ ImportDeclaration next = iter.next();
+ if (!next.isOnDemand())
+ {
+ continue;
+ }
+ Name fqName = next.getName();
+ String name = fqName.getFullyQualifiedName();
+ if (imp.equals(name))
+ {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ protected static String getPackageName(String name)
+ {
+ int i = name.lastIndexOf('.');
+ if (i == -1)
+ return null;
+ return name.substring(0, i);
+ }
+
+ protected static String getSimpleName(String name)
+ {
+ int i = name.lastIndexOf('.');
+ if (i == -1)
+ return name;
+ return name.substring(i + 1);
+ }
+
+ public ILocator getLocator()
+ {
+ return this.locator;
+ }
+
+ public void setLocator(final ILocator locator)
+ {
+ this.locator = locator;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/plugin/JaxwsUtilsPlugin.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/plugin/JaxwsUtilsPlugin.java
new file mode 100755
index 0000000..44d3fa5
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/plugin/JaxwsUtilsPlugin.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.ui.IStartup;
+import org.osgi.framework.BundleContext;
+
+public class JaxwsUtilsPlugin extends Plugin implements IStartup
+{
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxws.utils";
+
+ // The shared instance
+ private static JaxwsUtilsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JaxwsUtilsPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static JaxwsUtilsPlugin getDefault() {
+ return plugin;
+ }
+
+ public void earlyStartup()
+ {
+ // Nothing to do. However, this pugin has to start as early as possible since its services will be used for common logging
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.java
new file mode 100755
index 0000000..e1376b9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.internal.text;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JaxWsUtilMessages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages"; //$NON-NLS-1$
+
+
+ public static String CannotPerformEditMsg;
+
+
+ public static String CompUnitMissingMsg;
+
+
+ public static String InvalidTreeStateMsg;
+
+
+ public static String AnnotationCannotBeStoredMsg;
+
+
+ public static String AnnotationUtils_ParamShouldNotBeNullMsg;
+
+//
+// public static String EngineDataProvider_UnableToDeterminePortOfDeployServerMsg;
+//
+// public static String EngineDataProvider_UnableToDetermineNameOfDeployServerMsg;
+//
+// public static String EngineDataProvider_UnableToDetermineSapSystemOfDeployServerMsg;
+//
+//
+ /** message constant */
+ public static String WsdlNamesValidator_EmptyXmlName;
+
+ /** message constant */
+ public static String WsdlNamesValidator_InvalidNCName;
+
+ /** message constant */
+ public static String WsdlNamesValidator_EmptyXmlName2;
+
+ /** message constant */
+ public static String WsdlNamesValidator_InvalidNCName2;
+
+ public static String EditResourcesManager_FILE_CONTENTS_CHANGE_FAILED_MSG;
+
+ public static String ProjectManagementUtils_ProjectHasNoMetaInfFolderMsg;
+
+ static
+ {
+ NLS.initializeMessages(BUNDLE_NAME, JaxWsUtilMessages.class);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.properties
new file mode 100755
index 0000000..8eca31d
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/internal/text/JaxWsUtilMessages.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+CannotPerformEditMsg = Edit cannot be performed
+CompUnitMissingMsg = Compilation unit file missing
+InvalidTreeStateMsg = Invalid project tree state
+AnnotationCannotBeStoredMsg = Annotation could not be stored, the file is not writable
+AnnotationUtils_ParamShouldNotBeNullMsg = {0} should not be null
+
+WsdlNamesValidator_EmptyXmlName = Empty {0} name is not allowed. Please enter name.
+WsdlNamesValidator_InvalidNCName = The symbol {0} specified for {1} with name {2} is not allowed for NCName. Please change {1} name.
+WsdlNamesValidator_EmptyXmlName2 = Specified {0} should not be empty
+WsdlNamesValidator_InvalidNCName2 = The symbol \"{0}\" used in {1} is not allowed in NCName
+
+EditResourcesManager_FILE_CONTENTS_CHANGE_FAILED_MSG = File contents could not be set
+ProjectManagementUtils_ProjectHasNoMetaInfFolderMsg = project {0} does not have a META-INF folder
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/ILogger.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/ILogger.java
new file mode 100755
index 0000000..e7f92fb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/ILogger.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.logging;
+
+public interface ILogger
+{
+ /**
+ * Logs a message with severity error.
+ *
+ * @param message
+ * message to be logged
+ */
+ public void logError(final String message);
+
+ /**
+ * Logs a message with severity error.
+ *
+ * @param message
+ * message to be logged
+ * @param cause
+ * causing exception
+ */
+ public void logError(final String message, final Throwable cause);
+
+ /**
+ * Logs a message with severity warning.
+ *
+ * @param message
+ * message to be logged
+ */
+ public void logWarn(final String message);
+
+ /**
+ * Logs a message with severity warning.
+ *
+ * @param message
+ * message to be logged
+ * @param cause
+ * causing exception
+ */
+ public void logWarn(final String message, final Throwable cause);
+
+ /**
+ * Logs a message with severity debug.
+ *
+ * @param message
+ * message to be logged
+ */
+ public void logDebug(final String message);
+
+ /**
+ * Logs a message with severity debug.
+ *
+ * @param message
+ * message to be logged
+ * @param cause
+ * causing exception
+ */
+ public void logDebug(final String message, final Throwable cause);
+
+
+ public boolean isDebug();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/Logger.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/Logger.java
new file mode 100755
index 0000000..efad315
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/logging/Logger.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.logging;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.jst.ws.jaxws.utils.StatusUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.plugin.JaxwsUtilsPlugin;
+
+public class Logger implements ILogger
+{
+ public void logDebug(String message)
+ {
+// log().log(StatusUtils.statusInfo(message));
+ }
+
+ public void logDebug(String message, Throwable cause)
+ {
+// log().log(StatusUtils.statusInfo(message, cause));
+ }
+
+ public void logError(String message)
+ {
+ log().log(StatusUtils.statusError(message));
+ }
+
+ public void logError(String message, Throwable cause)
+ {
+ log().log(StatusUtils.statusError(message, cause));
+ }
+
+ public void logWarn(String message)
+ {
+ log().log(StatusUtils.statusWarning(message));
+ }
+
+ public void logWarn(String message, Throwable cause)
+ {
+ log().log(StatusUtils.statusWarning(message, cause));
+ }
+
+ private ILog log()
+ {
+ return JaxwsUtilsPlugin.getDefault().getLog();
+ }
+
+ public boolean isDebug()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/EditResourcesManager.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/EditResourcesManager.java
new file mode 100755
index 0000000..26398a9
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/EditResourcesManager.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.ws.jaxws.utils.StatusUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+/**
+ * This is an utility class which is meant to provide common functionality to save and modify resources. It is a wrapper of the eclipse API and
+ * workarounds some DTR issues. Until DTR colleagues fix their coding, this manager must be used on each file modification occasion
+ *
+ * @author Danail Branekov
+ */
+public class EditResourcesManager
+{
+ private static final ILogger logger = new Logger();
+
+ /**
+ * Sets editability of a file. In case the file specified is already writable, <code>Status.OK_STATUS</code> is returned
+ *
+ * @param file
+ * The file to be set editable
+ * @param context
+ * either {@link IWorkspace#VALIDATE_PROMPT}, or the <code>org.eclipse.swt.widgets.Shell</code> that is to be used to parent any
+ * dialogs with the user, or <code>null</code> if there is no UI context (declared as an <code>Object</code> to avoid any direct
+ * references on the SWT component)
+ * @return the status of the operation
+ * @throws NullPointerException
+ * when the file specified is null
+ * @see IWorkspace#VALIDATE_PROMPT
+ */
+ public IStatus setFileEditable(IFile file, Object context)
+ {
+ if (file == null)
+ {
+ throw new NullPointerException("file"); //$NON-NLS-1$
+ }
+ if(!file.isReadOnly())
+ {
+ return Status.OK_STATUS;
+ }
+
+ IWorkspace workspace = file.getWorkspace();
+ return workspace.validateEdit(new IFile[] { file }, context);
+ }
+
+ /**
+ * Sets editablility of a file. This is a convenience method equivalent to invoking
+ * <code>setFileEditable(file, IWorkspace.VALIDATE_PROMPT)</code>
+ *
+ * @param file
+ * The file to be set editable
+ * @return the status of the operation
+ * @throws NullPointerException
+ * when the file specified is null
+ * @see EditResourcesManager#setFileEditable(IFile, Object)
+ * @see IWorkspace#VALIDATE_PROMPT
+ *
+ */
+ public IStatus setFileEditable(IFile file)
+ {
+ return setFileEditable(file, IWorkspace.VALIDATE_PROMPT);
+ }
+
+ /**
+ * Sets editablility of an array of files. In case all files specified are already writable, <code>Status.OK_STATUS</code> is returned
+ *
+ * @param files
+ * The array of files to be set editable
+ * @param context
+ * either {@link IWorkspace#VALIDATE_PROMPT}, or the <code>org.eclipse.swt.widgets.Shell</code> that is to be used to parent any
+ * dialogs with the user, or <code>null</code> if there is no UI context (declared as an <code>Object</code> to avoid any direct
+ * references on the SWT component)
+ * @return the status of the operation
+ * @throws IllegalArgumentException
+ * when the array is empty or null
+ */
+ public IStatus setFilesEditable(IFile[] files, Object context)
+ {
+ if (files == null || files.length == 0)
+ {
+ throw new IllegalArgumentException("Array must not be empty nor null"); //$NON-NLS-1$
+ }
+ List<IFile> roFiles = new ArrayList<IFile>();
+ for(IFile f : files)
+ {
+ if(f.isReadOnly())
+ {
+ roFiles.add(f);
+ }
+ }
+
+ if(roFiles.size() == 0)
+ {
+ return Status.OK_STATUS;
+ }
+
+ IWorkspace workspace = roFiles.get(0).getWorkspace();
+ return workspace.validateEdit(roFiles.toArray(new IFile[roFiles.size()]), context);
+ }
+
+ /**
+ * Sets editablility of an array of files. This is a convenience method equivalent to invoking
+ * <code>setFilesEditable(files, IWorkspace.VALIDATE_PROMPT)</code>
+ *
+ * @param files
+ * The array of files to be set editable
+ * @return the status of the operation
+ * @throws IllegalArgumentException
+ * when the array is empty or null
+ * @see EditResourcesManager#setFilesEditable(IFile[], Object)
+ */
+ public IStatus setFilesEditable(IFile[] files)
+ {
+ return setFilesEditable(files, IWorkspace.VALIDATE_PROMPT);
+ }
+
+ /**
+ * Sets the content of a file
+ *
+ * @param file
+ * the file to be set
+ * @param content
+ * the content to be set
+ * @param updateFlags
+ * update flags.
+ * @see IFile#setContents(java.io.InputStream, int, IProgressMonitor)
+ * @param progressMonitor
+ * a progress monitor, or <code>null</code> if progress reporting is not desired
+ * @return status of the operation
+ * @throws NullPointerException
+ * when <code>file</code> or <code>content</code> is null
+ */
+ public IStatus setFileContents(IFile file, String content, int updateFlags, IProgressMonitor progressMonitor)
+ {
+ if (file == null)
+ {
+ throw new NullPointerException("file"); //$NON-NLS-1$
+ }
+
+ if (content == null)
+ {
+ throw new NullPointerException("content"); //$NON-NLS-1$
+ }
+
+ IStatus editStatus = setFileEditable(file);
+ if (editStatus.getSeverity() != IStatus.OK)
+ {
+ // something went wrong with the validateEdit operation
+ return editStatus;
+ }
+
+ try
+ {
+ file.setContents(new StringInputStreamAdapter(content), updateFlags, progressMonitor);
+ return Status.OK_STATUS;
+ } catch (CoreException e)
+ {
+ logger.logError(e.getMessage(), e);
+ return StatusUtils.statusError(JaxWsUtilMessages.EditResourcesManager_FILE_CONTENTS_CHANGE_FAILED_MSG, e);
+ }
+ }
+
+ /**
+ * Sets the content of a file. This method is equivalent of invoking
+ * <code>setFileContens(IFile file, String content, (keepHistory ? IFile.KEEP_HISTORY : IResource.NONE) | (force ? IFile.FORCE : IResource.NONE), IProgressMonitor monitor)</code>
+ *
+ * @param file
+ * the file to be set
+ * @param content
+ * the content to be set
+ * @param force
+ * a flag controlling how to deal with resources that are not in sync with the local file system
+ * @param keepHistory
+ * a flag indicating whether or not store the current contents in the local history
+ * @param monitor
+ * a progress monitor, or <code>null</code> if progress reporting is not desired
+ * @return status of the operation
+ * @throws NullPointerException
+ * when <code>file</code> or <code>content</code> is null
+ * @see EditResourcesManager#setFileContents(IFile, String, int, IProgressMonitor)
+ */
+ public IStatus setFileContents(IFile file, String content, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ {
+ return setFileContents(file, content, ((keepHistory ? IFile.KEEP_HISTORY : IResource.NONE) | (force ? IFile.FORCE : IResource.NONE)), monitor);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/FileUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/FileUtils.java
new file mode 100755
index 0000000..dddb3a1
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/FileUtils.java
@@ -0,0 +1,438 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Implementation for file utilities interface
+ *
+ * @author Danail Branekov
+ *
+ */
+public class FileUtils implements IFileUtils {
+ private static IFileUtils utils = null;
+ private static int index = 0;
+
+ public FileUtils() {
+ }
+
+ /**
+ * The factory method
+ *
+ * @return a FileUtils instance
+ */
+ public static IFileUtils getInstance() {
+ if (utils == null) {
+ utils = new FileUtils();
+ }
+
+ return utils;
+ }
+
+ public final List<IEditorPart> getEditorsByFileLocation(
+ final String fileLocation) throws FileNotFoundException {
+ List<ICompilationUnit> units = getCompilationUnits(fileLocation);
+ Set<IEditorPart> editors = new HashSet<IEditorPart>();
+ for (ICompilationUnit cu : units) {
+ final IEditorDescriptor editorDescr = getEditorDescriptor(cu
+ .getElementName());
+ editors.addAll(getEditorsByCompilationUnit(editorDescr,
+ getActiveWorkbenchPage(), cu));
+
+ }
+
+ return Arrays.asList(editors.toArray(new IEditorPart[editors.size()]));
+ }
+
+ public final List<ICompilationUnit> getCompilationUnits(
+ final String fileLocation) throws FileNotFoundException {
+ if (fileLocation == null) {
+ throw new NullPointerException("fileLocation"); //$NON-NLS-1$
+ }
+
+ IFile[] filesFound = ResourcesPlugin.getWorkspace().getRoot()
+ .findFilesForLocationURI(new File(fileLocation).toURI());
+ if (filesFound == null || filesFound.length == 0) {
+ throw new FileNotFoundException("File: " + fileLocation + " does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ List<ICompilationUnit> units = new ArrayList<ICompilationUnit>();
+
+ for (IFile file : filesFound) {
+ IJavaElement javaElement = JavaCore.create(file);
+ if (!(javaElement instanceof ICompilationUnit)) {
+ throw new IllegalStateException("File: " + fileLocation + " is not a compilation unit"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ units.add((ICompilationUnit) javaElement);
+ }
+
+ return units;
+ }
+
+ public IProject getProjectUnit(String fileLocation)
+ throws FileNotFoundException {
+
+ if (fileLocation == null)
+ {
+ throw new NullPointerException("fileLocation"); //$NON-NLS-1$
+ }
+
+ IFile file = getFileForLocation(new Path(fileLocation));
+ if (file == null)
+ {
+ throw new FileNotFoundException("File: " + fileLocation + " does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return file.getProject();
+ }
+
+ public final boolean isFileDisplayedInDirtyEditor(final String fileLocation)
+ throws FileNotFoundException {
+ return isFileDisplayedInDirtyEditor(getEditorsByFileLocation(fileLocation));
+ }
+
+ public boolean isCompilationUnitDisplayedInDirtyEditor(
+ final ICompilationUnit unit) {
+ return isFileDisplayedInDirtyEditor(getEditorsByCompilationUnit(unit));
+ }
+
+ public final void saveEditor(String fileLocation)
+ throws FileNotFoundException {
+ saveEditor(fileLocation, new NullProgressMonitor());
+ }
+
+ public void saveEditor(final String fileLocation,
+ final IProgressMonitor monitor) throws FileNotFoundException {
+ List<IEditorPart> editors = getEditorsByFileLocation(fileLocation);
+ if (editors.size() == 0) {
+ throw new IllegalStateException("The file is not displayed by an editor"); //$NON-NLS-1$
+ }
+
+ saveEditors(editors, monitor);
+ }
+
+ public void saveEditor(final ICompilationUnit cu,
+ final IProgressMonitor monitor) {
+ List<IEditorPart> editors = getEditorsByCompilationUnit(cu);
+ if (editors.size() == 0) {
+ throw new IllegalStateException("The file is not displayed by an editor"); //$NON-NLS-1$
+ }
+
+ saveEditors(editors, monitor);
+ }
+
+ public void saveEditor(final ICompilationUnit cu) {
+ List<IEditorPart> editors = getEditorsByCompilationUnit(cu);
+ if (editors.size() == 0) {
+ throw new IllegalStateException("The file is not displayed by an editor"); //$NON-NLS-1$
+ }
+
+ saveEditors(editors, new NullProgressMonitor());
+ }
+
+ private void saveEditors(final List<IEditorPart> editors,
+ final IProgressMonitor monitor) {
+ for (IEditorPart e : editors) {
+ if (e.isDirty()) {
+ e.doSave(monitor);
+ }
+ }
+ }
+
+ public Collection<IEditorPart> getDirtyEditors() {
+ final Set<IEditorInput> inputs = new HashSet<IEditorInput>();
+ final Collection<IEditorPart> result = new ArrayList<IEditorPart>();
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ final IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+ for (int i = 0; i < windows.length; i++) {
+ final IWorkbenchPage[] pages = windows[i].getPages();
+ for (int x = 0; x < pages.length; x++) {
+ final IEditorPart[] editors = pages[x].getDirtyEditors();
+ for (int z = 0; z < editors.length; z++) {
+ final IEditorPart ep = editors[z];
+ final IEditorInput input = ep.getEditorInput();
+ if (!inputs.contains(input)) {
+ inputs.add(input);
+ result.add(ep);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ private IEditorDescriptor getEditorDescriptor(String fileName) {
+ IEditorRegistry editorRegistry = PlatformUI.getWorkbench()
+ .getEditorRegistry();
+ return editorRegistry.getDefaultEditor(fileName);
+ }
+
+ /**
+ * Converts a String to a URL, assuming 'file:' as a default scheme.
+ *
+ * @param base
+ * @param path
+ *
+ * @return
+ *
+ * @throws NullPointerException,
+ * if the String is neither a valid URL, nor a valid filename.
+ *
+ */
+ public final URL fileOrURLToURL(final URL base, final String path)
+ throws IOException {
+ if (path == null) {
+ throw new NullPointerException("path"); //$NON-NLS-1$
+ }
+
+ String localPath = path;
+ URL localBase = base;
+
+ if (localBase == null) {
+ localBase = new URL("file:");//$NON-NLS-1$
+ }
+
+ localPath = localPath.replace('\\', '/');
+ try {
+ String protocol = localBase.getProtocol();
+ if (!"http".equals(protocol) //$NON-NLS-1$
+ && !"https".equals(protocol) //$NON-NLS-1$
+ && (localPath.charAt(1) == ':'
+ || localPath.charAt(0) == '/' || localPath
+ .charAt(0) == '\\')) {
+ localPath = (new File(localPath)).toURI().toURL().toExternalForm();
+ }
+ } catch (IndexOutOfBoundsException e) {
+ // $JL-EXC$
+ }
+
+ if (localPath.startsWith("file:") && localPath.length() > 5 //$NON-NLS-1$
+ && localPath.charAt(5) != '/') {
+ localPath = "file:/".concat(localPath.substring(5)); //$NON-NLS-1$
+ } else {
+ if (localPath.startsWith("file://") //$NON-NLS-1$
+ && !localPath.startsWith("file:////") //$NON-NLS-1$
+ && !localPath.startsWith("file://localhost/")) { //$NON-NLS-1$
+ localPath = "file:////".concat(localPath.substring("file://" //$NON-NLS-1$ //$NON-NLS-2$
+ .length()));
+ }
+ }
+ URL url = new URL(localBase, localPath);
+ return url;
+ }
+
+ public File createTempDirectory() {
+ String tempDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
+ index++;
+ File temp1 = new File(tempDir, Integer.toString(this.hashCode()) + "_" //$NON-NLS-1$
+ + index);
+ temp1.mkdir();
+ return temp1;
+ }
+
+ public void deleteDirectory(final File directory) {
+ if (directory == null) {
+ return;
+ }
+ if (!directory.exists()) {
+ return;
+ }
+ for (File f : directory.listFiles()) {
+ f.delete();
+ }
+ directory.delete();
+ }
+
+ public IFile[] getFilesByExtension(IProject project, String extension)
+ throws CoreException {
+ ContractChecker.nullCheckParam(extension, "extension"); //$NON-NLS-1$
+ ArrayList<IFile> foundFiles = new ArrayList<IFile>();
+
+ getFilesByExtension(foundFiles, project.members(), extension);
+
+ return foundFiles.toArray(new IFile[foundFiles.size()]);
+ }
+
+ private void getFilesByExtension(ArrayList<IFile> foundFiles,
+ IResource[] currentResources, String extension)
+ throws CoreException {
+ for (int ii = 0; ii < currentResources.length; ii++) {
+ if (currentResources[ii].getType() == IResource.FOLDER) {
+ getFilesByExtension(foundFiles,
+ ((IFolder) currentResources[ii]).members(), extension);
+ } else if (currentResources[ii].getType() == IResource.FILE
+ && extension
+ .equals(currentResources[ii].getFileExtension())) {
+ foundFiles.add((IFile) currentResources[ii]);
+ }
+ }
+ }
+
+ public IFile getFileForLocation(IPath location) {
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
+ location);
+ }
+
+ private IWorkbenchPage getActiveWorkbenchPage() {
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
+ return null;
+ }
+
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage();
+ }
+
+ public List<IEditorPart> getEditorsByCompilationUnit(
+ final ICompilationUnit cu) {
+ ContractChecker.nullCheckParam(cu, "cu"); //$NON-NLS-1$
+ final IEditorDescriptor editorDescr = getEditorDescriptor(cu
+ .getElementName());
+ final IWorkbenchPage wbPage = getActiveWorkbenchPage();
+ if (wbPage == null) {
+ return new ArrayList<IEditorPart>(0);
+ }
+
+ return getEditorsByCompilationUnit(editorDescr, wbPage, cu);
+ }
+
+ private List<IEditorPart> getEditorsByCompilationUnit(
+ final IEditorDescriptor editorDescriptor,
+ final IWorkbenchPage page, final ICompilationUnit cu) {
+ List<IEditorPart> editorPartReturned = new ArrayList<IEditorPart>();
+
+ if (editorDescriptor != null && page != null) {
+ for (IEditorReference editorReferece : page.getEditorReferences()) {
+ IEditorPart editorPart = editorReferece.getEditor(true);
+ if (isEditorApplicableForCu(editorPart, cu)) {
+ editorPartReturned.add(editorPart);
+ }
+ }
+ }
+
+ return editorPartReturned;
+ }
+
+ private boolean isEditorApplicableForCu(final IEditorPart editor,
+ final ICompilationUnit cu) {
+ if (editor == null) {
+ return false;
+ }
+
+ if (!(editor.getEditorInput() instanceof IFileEditorInput)
+ || !(cu.getResource() instanceof IFile)) {
+ return false;
+ }
+
+ final IFile cuFile = (IFile) cu.getResource();
+ final IFileEditorInput editorInput = (IFileEditorInput) editor
+ .getEditorInput();
+
+ return cuFile.equals(editorInput.getFile());
+ }
+
+ public final boolean isFileDisplayedInDirtyEditor(
+ final List<IEditorPart> displayingEditors) {
+ ContractChecker.nullCheckParam(displayingEditors, "displayingEditors"); //$NON-NLS-1$
+ for (IEditorPart editor : displayingEditors) {
+ if (editor.isDirty()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Reads file content as text and returns {@link String}
+ *
+ * @param sourceFile
+ * @return the content of file
+ * @throws IOException
+ */
+ public String getFileContent(final File sourceFile) throws IOException {
+ final FileReader fr = new FileReader(sourceFile);
+ final StringBuilder builder = new StringBuilder();
+
+ try {
+ final char[] buff = new char[1024];
+ for (int cnt = 0; (cnt = fr.read(buff)) > -1;) {
+ builder.append(buff, 0, cnt);
+ }
+ } finally {
+ fr.close();
+ }
+
+ return builder.toString();
+ }
+
+ public void setCompilationUnitContent(final ICompilationUnit unit,
+ final String content, final boolean force,
+ final IProgressMonitor monitor) throws JavaModelException {
+ ContractChecker.nullCheckParam(unit, "unit"); //$NON-NLS-1$
+ ContractChecker.nullCheckParam(content, "content"); //$NON-NLS-1$
+
+ unit.becomeWorkingCopy(monitor);
+ try {
+ unit.getBuffer().setContents(content);
+ unit.commitWorkingCopy(force, monitor);
+ } finally {
+ unit.discardWorkingCopy();
+ }
+ }
+
+ public void setCompilationUnitContentAndSaveDirtyEditors(
+ final ICompilationUnit unit, final String content,
+ final boolean force, final IProgressMonitor monitor)
+ throws JavaModelException {
+ setCompilationUnitContent(unit, content, force, monitor);
+ if (isCompilationUnitDisplayedInDirtyEditor(unit)) {
+ saveEditor(unit);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/IFileUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/IFileUtils.java
new file mode 100755
index 0000000..0fdfa06
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/IFileUtils.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Interface that defines common utilies for file manipulation
+ *
+ * @author Danail Branekov
+ */
+public interface IFileUtils {
+
+ /**
+ * Retrieves the editors that are currently displaying the file specfied.
+ *
+ * @param fileLocation
+ * Absolute path to the file
+ * @see IResource#getLocation().toOSString()
+ * @return Current opened editors of the file specified or an empty list if such are not opened
+ * @throws FileNotFoundException
+ * when the file does not exist
+ */
+ public abstract List<IEditorPart> getEditorsByFileLocation(
+ final String fileLocation) throws FileNotFoundException;
+
+ /**
+ * Determines whether the file specified is displayed within an editor which
+ * has a dirty state.
+ *
+ * @param fileLocation
+ * Absolute path to the file
+ * @see IResource#getLocation().toOSString()
+ * @return whether the file is dirty
+ * @throws FileNotFoundException
+ * when the location specified does not exist
+ */
+ public abstract boolean isFileDisplayedInDirtyEditor(
+ final String fileLocation) throws FileNotFoundException;
+
+ /**
+ * Saves the dirty state editor
+ *
+ * @param fileLocation
+ * Absolute path to the file
+ * @see IResource#getLocation()#toOSString()
+ * @throws FileNotFoundException
+ * when the location specified does not exis
+ * @throws IllegalStateException
+ * when the file is not displayed by an editor
+ */
+ public abstract void saveEditor(String fileLocation)
+ throws FileNotFoundException;
+
+ /**
+ * Saves the dirty state editor
+ *
+ * @param fileLocation
+ * Absolute path to the file
+ * @see IResource#getLocation()#toOSString()
+ * @param monitor
+ * Progress monitor
+ * @throws FileNotFoundException
+ * when the location specified does not exis
+ * @throws IllegalStateException
+ * when the file is not displayed by an editor
+ */
+ public abstract void saveEditor(String fileLocation,
+ IProgressMonitor monitor) throws FileNotFoundException;
+
+ /**
+ * Retrieves a list of dirty editors
+ *
+ * @return collection containing dirty editors
+ */
+ public abstract Collection<IEditorPart> getDirtyEditors();
+
+ /**
+ * Retrieve compilation units for the location specified
+ *
+ * @param fileLocation
+ * The absolute path to the file, e.g.
+ * <code>C:\\dir1\\dir2\\file.name</code>
+ * @see IResource#getLocation()#toOSString()
+ *
+ * @throws FileNotFoundException
+ * when the file specified cannot be found in the workspace
+ * @throws IllegalStateException
+ * when the file specified is not a compilation unit
+ * @throws NullPointerException
+ * when fileLocation is null
+ * @return The compilation units; cannot be null
+ */
+ public abstract List<ICompilationUnit> getCompilationUnits(
+ final String fileLocation) throws FileNotFoundException;
+
+ /**
+ * Retrieve project unit for the location specified
+ *
+ * @param fileLocation
+ * The absolute path to the file, e.g.
+ * <code>C:\\dir1\\dir2\\file.name</code>
+ * @see IResource#getLocation()#toOSString()
+ *
+ * @throws FileNotFoundException
+ * when the file specified cannot be found in the workspace
+ * @throws NullPointerException
+ * when fileLocation is null
+ * @return The compilation units; cannot be null
+ */
+ public abstract IProject getProjectUnit(
+ final String fileLocation) throws FileNotFoundException;
+
+ /**
+ * Converts a String to a URL, assuming 'file:' as a default scheme.
+ *
+ * @param base
+ * @param path
+ *
+ * @return
+ *
+ * @throws NullPointerException,
+ * if the String is neither a valid URL, nor a valid filename.
+ *
+ */
+ public abstract URL fileOrURLToURL(final URL base, final String path)
+ throws IOException;
+
+ /**
+ * Creates a new directory in the OS temp folder
+ *
+ * @return the directory
+ */
+ public File createTempDirectory();
+
+ /**
+ * Deletes the specified directory and all its content
+ *
+ * param directory
+ */
+ public void deleteDirectory(final File directory);
+
+ /**
+ * Gets all the files with the provided extension within a project.
+ *
+ * @param project -
+ * to be searched
+ * @param extension -
+ * types of files of interest
+ */
+ public IFile[] getFilesByExtension(IProject project, String extension)
+ throws CoreException;
+
+ /**
+ * Retrieves a list of editors that are currently displaying the compilation
+ * unit specified.
+ *
+ * @param cu
+ * the compilation unit; must not be null
+ * @return Current editors list or an empty list in case there are not
+ * editors displaying the file specified
+ *
+ * @throws NullPointerException
+ * when the <code>cu</code> parameter is null
+ */
+ public abstract List<IEditorPart> getEditorsByCompilationUnit(
+ final ICompilationUnit cu);
+
+ /**
+ * Determines whether the compilation unit specified is displayed within an
+ * editor which has a dirty state.
+ *
+ * @param unit
+ * The compilation unit
+ *
+ * @return whether the compilation unit is dirty
+ */
+ public abstract boolean isCompilationUnitDisplayedInDirtyEditor(
+ final ICompilationUnit unit);
+
+ /**
+ * Saves all the dirty state editors that are currently displaying the
+ * compilation unit specified
+ *
+ * @param cu
+ * the compilation unit
+ * @param monitor
+ * Progress monitor
+ * @throws FileNotFoundException
+ * when the location specified does not exist
+ * @throws IllegalStateException
+ * when the file is not displayed by an editor
+ */
+ public abstract void saveEditor(ICompilationUnit cu,
+ IProgressMonitor monitor);
+
+ /**
+ * Saves all the dirty state editors that are currently displaying the
+ * compilation unit specified
+ *
+ * @param cu
+ * the compilation unit
+ * @throws FileNotFoundException
+ * when the location specified does not exist
+ * @throws IllegalStateException
+ * when the file is not displayed by an editor
+ */
+ public abstract void saveEditor(ICompilationUnit cu);
+
+ /**
+ * Retrieve a file instance for the location specified. This method is a
+ * convenience method equivalent to invoking
+ * <code>ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(location)</code>
+ *
+ * @param location
+ * the file location; must be absolute
+ * @return the corresponding file in the workspace, or null if none
+ * @see IWorkspaceRoot#getFileForLocation(IPath)
+ */
+ public IFile getFileForLocation(IPath location);
+
+ /**
+ * Reads file content as text and returns {@link String}
+ *
+ * @param sourceFile
+ * @return the content of file
+ * @throws IOException
+ */
+ public String getFileContent(final File sourceFile) throws IOException;
+
+ /**
+ * Sets the content of the compilation unit specified with the
+ * <code>content</code> provided. There is no validation of the content
+ *
+ * @param cUnit
+ * the compilation unit. Must not be null. If the compilation
+ * unit does not exist, it will be created
+ * @param content
+ * the content to be set. Must not be null
+ * @param force
+ * a flag to handle the cases when the contents of the original
+ * resource have changed since this working copy was created
+ * @param monitor
+ * the monitor to report progress to or null if no progress
+ * monitoring is required
+ *
+ * @throws JavaModelException
+ * when there is a problem with setting compilation unit content
+ * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor)
+ * @see ICompilationUnit#commitWorkingCopy(boolean, IProgressMonitor)
+ * @see ICompilationUnit#discardWorkingCopy()
+ */
+ public void setCompilationUnitContent(ICompilationUnit cUnit,
+ String content, boolean force, IProgressMonitor monitor)
+ throws JavaModelException;
+
+ /**
+ * Sets the content of the compilation unit specified with the
+ * <code>content</code> provided and saves the dirty editors if any which
+ * display the compilation unit. There is no validation of the content
+ *
+ * @param cUnit
+ * the compilation unit. Must not be null. If the compilation
+ * unit does not exist, it will be created
+ * @param content
+ * the content to be set. Must not be null
+ * @param force
+ * a flag to handle the cases when the contents of the original
+ * resource have changed since this working copy was created
+ * @param monitor
+ * the monitor to report progress to or null if no progress
+ * monitoring is required
+ *
+ * @throws JavaModelException
+ * when there is a problem with setting compilation unit content
+ * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor)
+ * @see ICompilationUnit#commitWorkingCopy(boolean, IProgressMonitor)
+ * @see ICompilationUnit#discardWorkingCopy()
+ * @see IFileUtils#setCompilationUnitContent(ICompilationUnit, String,
+ * boolean, IProgressMonitor)
+ * @see IFileUtils#isFileDisplayedInDirtyEditor(String)
+ * @see IFileUtils#saveEditor(ICompilationUnit, IProgressMonitor)
+ */
+ public void setCompilationUnitContentAndSaveDirtyEditors(
+ ICompilationUnit cUnit, String content, boolean force,
+ IProgressMonitor monitor) throws JavaModelException;
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/ProjectManagementUtils.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/ProjectManagementUtils.java
new file mode 100755
index 0000000..8f880a3
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/ProjectManagementUtils.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.utils.exception.MissingResourceException;
+import org.eclipse.jst.ws.jaxws.utils.facets.FacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.facets.IFacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+
+/**
+ * Utility that provides useful project management services
+ *
+ * @author Joerg Dehmel
+ * @author Danail Branekov
+ */
+public final class ProjectManagementUtils
+{
+ private static final ILogger logger = new Logger();
+
+ /**
+ * Provides the meta-inf folder of a EJB project.
+ *
+ * @param pProjectName
+ * project name
+ * @return the resource of the meta-inf folder
+ * @throws IllegalArgumentException
+ * when project name specified is <code>null</code>, empty string, the project does not exist or is not accessible, or the project
+ * is not an ejb project
+ * @throws MissingResourceException
+ * either the project doesn't exist in the workspace or it doesn't contain a meta-inf folder
+ * @throws RuntimeException
+ * when error occured while accessing java model
+ */
+ public static IFolder findMetaInfFolder(final String pProjectName) throws MissingResourceException
+ {
+ final String metaInfName = "META-INF"; //$NON-NLS-1$
+ final String ejbModuleName = "ejbModule"; //$NON-NLS-1$
+
+ if (!isEjb3Project(pProjectName))
+ {
+ throw new IllegalArgumentException("Project " + pProjectName + " is not an EJB project"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ IProject project = getProjectByName(pProjectName);
+ IJavaProject javaProject = getJavaProject(project);
+ IPackageFragment ejbModulePkgFragment = null;
+
+ try
+ {
+ for (IPackageFragmentRoot fragmentRoot : javaProject.getPackageFragmentRoots())
+ {
+ if (fragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE && fragmentRoot.getElementName().equals(ejbModuleName))
+ {
+ ejbModulePkgFragment = fragmentRoot.getPackageFragment(metaInfName);
+ }
+ }
+
+ verifyMetaInfFolder(ejbModulePkgFragment, pProjectName);
+ return (IFolder) ejbModulePkgFragment.getCorrespondingResource();
+ } catch (JavaModelException e)
+ {
+ logger.logError(e.getMessage(), e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ private static void verifyMetaInfFolder(IPackageFragment fragment, String projectName) throws MissingResourceException
+ {
+ if (fragment == null)
+ {
+ final String msg = MessageFormat.format("project {0} does not have a META-INF folder", new Object[] { projectName }); //$NON-NLS-1$
+ final String localizedMsg = MessageFormat.format(JaxWsUtilMessages.ProjectManagementUtils_ProjectHasNoMetaInfFolderMsg, new Object[] { projectName });
+ throw new MissingResourceException(msg, localizedMsg);
+ }
+
+ try
+ {
+ IResource resource = fragment.getCorrespondingResource();
+ // should not happen!
+ if (!(resource instanceof IFolder))
+ {
+ throw new RuntimeException("Resource " + resource.getName() + " is not a folder"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } catch (JavaModelException e)
+ {
+ logger.logError(e.getMessage(), e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Check whether a project is an ejb 3 project
+ *
+ * @param projectName
+ * the name of the project; cannot be <code>null</code> or empty string
+ * @return true in case the project specified is a ejb 3 project; false otherwise
+ * @throws IllegalArgumentException
+ * when the project name specified is <code>null</code>, empty string
+ * @throws IllegalStateException
+ * when the project does not exist or is not accessible
+ * @throws RuntimeException
+ * when an error occurred while accessing the project metadata
+ */
+ public static boolean isEjb3Project(final String projectName)
+ {
+ IProject project = getProjectByName(projectName);
+
+ try
+ {
+ return facetUtils().hasFacetWithVersion(project, IFacetUtils.EJB_30_FACET_VERSION, IFacetUtils.EJB_30_FACET_ID, true);
+ } catch (CoreException e)
+ {
+ logger.logError(e.getMessage(), e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Check whether a project is an web 2.5 project
+ *
+ * @param projectName
+ * the name of the project; cannot be <code>null</code> or empty string
+ * @return true in case the project specified is a web 2.5 project; false otherwise
+ * @throws IllegalArgumentException
+ * when the project name specified is <code>null</code>, empty string
+ * @throws IllegalStateException
+ * when the project does not exist or is not accessible
+ * @throws RuntimeException
+ * when an error occurred while accessing the project metadata
+ */
+ public static boolean isWeb25Project(final String projectName)
+ {
+ IProject project = getProjectByName(projectName);
+
+ try
+ {
+ return facetUtils().hasFacetWithVersion(project, IFacetUtils.WEB_25_FACET_VERSION, IFacetUtils.WEB_25_FACET_ID, true);
+ } catch (CoreException e)
+ {
+ logger.logError(e.getMessage(), e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Retrieve the project instance by project name
+ *
+ * @param projectName
+ * the project name
+ * @return the project instance
+ * @throws IllegalArgumentException
+ * when the project name specified is null or empty string
+ * @throws IllegalStateException
+ * when the project does not exist or is not accessible
+ *
+ */
+ public static IProject getProjectByName(String projectName)
+ {
+ if (projectName == null || projectName.length() == 0)
+ {
+ throw new IllegalArgumentException("Illegal project name: " + projectName); //$NON-NLS-1$
+ }
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project == null || !project.isAccessible())
+ {
+ throw new IllegalStateException("Project is not accessible"); //$NON-NLS-1$
+ }
+
+ return project;
+ }
+
+ /**
+ * Get the java project instance
+ *
+ * @param project
+ * the project as eclipse resource
+ * @return the java project instance
+ * @throws IllegalArgumentException
+ * when <code>project</code> null or the project is not accessible
+ */
+ public static IJavaProject getJavaProject(IProject project)
+ {
+ if (project == null || !project.isAccessible())
+ {
+ throw new IllegalArgumentException("Project is not accessible"); //$NON-NLS-1$
+ }
+ return JavaCore.create(project);
+ }
+
+ /**
+ * Refresh the resource specified. Refresh depth used is zero
+ * @param resource the resource to be refreshed
+ * @throws CoreException
+ * @see IResource#DEPTH_ZERO
+ */
+ public static void refreshResource(IResource resource) throws CoreException
+ {
+ if(resource == null)
+ {
+ throw new NullPointerException("resource"); //$NON-NLS-1$
+ }
+
+ resource.refreshLocal(IResource.DEPTH_ZERO, null);
+ }
+
+ /**
+ * Refreshes the project the resource specified belongs to. Refresh depth used is infinite.
+ * @param the resource which project is to be refreshed
+ * @throws CoreException
+ * @throws IllegalArgumentException when the resource specified is a workspace root
+ * @see IResource#DEPTH_INFINITE
+ */
+ public static void refreshProjectByResource(IResource resource) throws CoreException
+ {
+ if(resource == null)
+ {
+ throw new NullPointerException("resource"); //$NON-NLS-1$
+ }
+
+ if(resource instanceof IWorkspaceRoot)
+ {
+ throw new IllegalArgumentException("Operation is not defined for workspace roots"); //$NON-NLS-1$
+ }
+
+ resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+
+ private static IFacetUtils facetUtils()
+ {
+ return new FacetUtils();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapter.java b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapter.java
new file mode 100755
index 0000000..c0c9629
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.utils/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapter.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+/**
+ * Adapter class that uses a StringReader to organize an InputStream
+ *
+ * @author Danail Branekov
+ *
+ */
+public class StringInputStreamAdapter extends InputStream
+{
+ private StringReader reader;
+
+ /**
+ * Constructor
+ *
+ * @param string
+ * @throws NullPointerException
+ * when <code>string</code> is null
+ */
+ public StringInputStreamAdapter(String string)
+ {
+ if (string == null)
+ {
+ throw new NullPointerException("string"); //$NON-NLS-1$
+ }
+
+ reader = new StringReader(string);
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ return reader.read();
+ }
+
+}
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/.project b/features/org.eclipse.jst.ws.jaxws.dom.feature/.project
new file mode 100755
index 0000000..30fa25c
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/build.properties b/features/org.eclipse.jst.ws.jaxws.dom.feature/build.properties
new file mode 100755
index 0000000..399ea4b
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/build.properties
@@ -0,0 +1,5 @@
+bin.includes = feature.xml,\
+ eclipse_update_120.jpg,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/compile.org.eclipse.jst.ws.jaxws.sapnw.dom.xml b/features/org.eclipse.jst.ws.jaxws.dom.feature/compile.org.eclipse.jst.ws.jaxws.sapnw.dom.xml
new file mode 100755
index 0000000..17cec06
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/compile.org.eclipse.jst.ws.jaxws.sapnw.dom.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Compile org.eclipse.jst.ws.jaxws.dom" default="main">
+ <target name="main">
+ <ant antfile="build.xml" dir="../org.eclipse.jst.ws.jaxws.utils" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.eclipse.jst.ws.jaxws.dom.runtime" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.eclipse.jst.ws.jaxws.dom.ui" target="build.jars"/>
+ <ant antfile="build.xml" dir="../org.eclipse.jst.ws.jaxws.dom.integration" target="build.jars"/>
+ </target>
+</project>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/eclipse_update_120.jpg b/features/org.eclipse.jst.ws.jaxws.dom.feature/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/eclipse_update_120.jpg
Binary files differ
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/epl-v10.html b/features/org.eclipse.jst.ws.jaxws.dom.feature/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.properties b/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.properties
new file mode 100644
index 0000000..b42b308
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.properties
@@ -0,0 +1,144 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JAX-WS DOM Tools (Incubation)
+
+# "featureProvider" property - name of the company that provides the feature
+featureProvider=Eclipse Web Tools Platform
+
+# "description" property - description of the feature
+description=JAX-WS DOM Tools
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Web Tools (WTP) Update Site
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+ Copyright (c) 2009 SAP AG, Walldorf.\n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ SAP AG - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=epl-v10.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+March 17, 2005\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.xml b/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.xml
new file mode 100755
index 0000000..df75204
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/feature.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.jst.ws.jaxws.dom.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider"
+ image="eclipse_update_120.jpg">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.emf.edit.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jst.ws.consumption.ui"/>
+ <import plugin="org.eclipse.jst.ws.creation.ui"/>
+ <import plugin="org.eclipse.wst.command.env"/>
+ <import plugin="org.eclipse.wst.command.env.core"/>
+ <import plugin="org.eclipse.wst.command.env.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.navigator"/>
+ <import plugin="org.eclipse.wst.validation"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jst.j2ee.core" version="1.1.200" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jst.jee.ui" version="1.0.100" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jst.ws" version="1.0.304" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.wst.ws" version="1.1.1" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jem.util" version="2.0.100" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.emf" version="2.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.emf.common" version="2.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.emf.ecore" version="2.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jdt.core" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.resources" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.emf.validation" version="1.3.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jface.text" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.emf.edit"/>
+ <import plugin="org.eclipse.jface" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.runtime" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.text" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide" version="3.5.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.wst.common.project.facet.core" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.apache.axis" version="1.4.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.integration"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.runtime"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.utils"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom.feature/license.html b/features/org.eclipse.jst.ws.jaxws.dom.feature/license.html
new file mode 100644
index 0000000..c6af966
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom.feature/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/.project b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/.project
new file mode 100644
index 0000000..64d6e9f
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom_sdk.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/build.properties b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/build.properties
new file mode 100644
index 0000000..e7a2a6a
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/build.properties
@@ -0,0 +1,7 @@
+bin.includes = feature.xml,\
+ eclipse_update_120.jpg,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
+
+generate.feature@org.eclipse.jst.ws.jaxws.dom.feature.source=org.eclipse.jst.ws.jaxws.dom.feature
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/eclipse_update_120.jpg b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/eclipse_update_120.jpg
Binary files differ
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/epl-v10.html b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.properties b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.properties
new file mode 100644
index 0000000..33b615e
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.properties
@@ -0,0 +1,144 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JAX-WS DOM Tools SDK (Incubation)
+
+# "featureProvider" property - name of the company that provides the feature
+featureProvider=Eclipse Web Tools Platform
+
+# "description" property - description of the feature
+description=JAX-WS DOM Tools Source
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Web Tools (WTP) Update Site
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+ Copyright (c) 2009 SAP AG, Walldorf.\n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ SAP AG - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=epl-v10.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+March 17, 2005\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.xml b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.xml
new file mode 100644
index 0000000..00ea6fd
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/feature.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.jst.ws.jaxws.dom_sdk.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider"
+ image="eclipse_update_120.jpg">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
+ </url>
+
+ <includes
+ id="org.eclipse.jst.ws.jaxws.dom.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.jst.ws.jaxws.dom.feature.source"
+ version="0.0.0"/>
+
+</feature>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/license.html b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/license.html
new file mode 100644
index 0000000..c6af966
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_sdk.feature/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/.project b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/.project
new file mode 100644
index 0000000..03192a5
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom_tests.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/build.properties b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/build.properties
new file mode 100644
index 0000000..c6af93f
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/build.properties
@@ -0,0 +1,5 @@
+bin.includes = feature.xml,\
+ eclipse_update_120.jpg,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/eclipse_update_120.jpg b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/eclipse_update_120.jpg
Binary files differ
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/epl-v10.html b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.properties b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.properties
new file mode 100644
index 0000000..c751c73
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.properties
@@ -0,0 +1,144 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JAX-WS DOM Tools Tests (Incubation)
+
+# "featureProvider" property - name of the company that provides the feature
+featureProvider=Eclipse Web Tools Platform
+
+# "description" property - description of the feature
+description=JAX-WS DOM Tools Tests
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Web Tools (WTP) Update Site
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+ Copyright (c) 2009 SAP AG, Walldorf.\n\
+ All rights reserved. This program and the accompanying materials\n\
+ are made available under the terms of the Eclipse Public License v1.0\n\
+ which accompanies this distribution, and is available at\n\
+ http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ SAP AG - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=epl-v10.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+March 17, 2005\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml
new file mode 100644
index 0000000..85cc75d
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.jst.ws.jaxws.dom_tests.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider"
+ image="eclipse_update_120.jpg">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates"/>
+ </url>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.integration.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.runtime.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.dom.ui.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.utils.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.jmock"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.jst.ws.jaxws.testutils"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/license.html b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/license.html
new file mode 100644
index 0000000..c6af966
--- /dev/null
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.classpath b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.project b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.project
new file mode 100755
index 0000000..c53675b
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.integration.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..62fd259
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DOM Integration Tests (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.integration.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jst.ws.jaxws.dom.integration,
+ org.eclipse.jst.ws.jaxws.utils,
+ org.eclipse.jst.ws.jaxws.testutils,
+ org.jmock,
+ org.eclipse.jdt.core,
+ org.eclipse.ui.navigator,
+ org.eclipse.jst.ws.jaxws.dom.ui,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.jee.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jface.text,
+ org.junit,
+ org.eclipse.jdt.ui,
+ org.eclipse.wst.validation
+Export-Package: org.eclipse.jst.ws.jaxws.dom.integration.tests.dom
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/about.html b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/about.html
new file mode 100644
index 0000000..d2b7ace
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 20, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/build.properties b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/build.properties
new file mode 100755
index 0000000..2ff2ea1
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/AllTestsSuite.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/AllTestsSuite.java
new file mode 100755
index 0000000..74ca458
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/AllTestsSuite.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.dom;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.dom.validation.DomValidationHelperTest;
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.dom.validation.DomValidationManagerTest;
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator.DOMAdapterFactoryContentProviderTest;
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator.DOMAdapterFactoryLabelProviderTest;
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator.DOMPropertyViewAdapterFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator.WebServiceDecoratorTest;
+
+public class AllTestsSuite
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(DOMAdapterFactoryContentProviderTest.class);
+ suite.addTestSuite(DOMAdapterFactoryLabelProviderTest.class);
+ suite.addTestSuite(DOMPropertyViewAdapterFactoryTest.class);
+ suite.addTestSuite(DomValidationHelperTest.class);
+ suite.addTestSuite(DomValidationManagerTest.class);
+ suite.addTestSuite(WebServiceDecoratorTest.class);
+
+ return suite;
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationHelperTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationHelperTest.java
new file mode 100755
index 0000000..e99d5c5
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationHelperTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.dom.validation;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationHelper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+/**
+ * Test class for {@link DomValidationHelper}.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("restriction")
+public class DomValidationHelperTest extends MockObjectTestCase
+{
+ private DomValidationHelper helper;
+ @Override
+ public void setUp() {
+ helper = new DomValidationHelper();
+ }
+
+ public void testDomValidationHelper() {
+ assertTrue(helper.isRegistered("webServiceProject"));
+ }
+
+ public void testGetWebServiceProject() throws Exception
+ {
+ TestEjb3Project ejbProject = new TestEjb3Project("EjbProject");
+ TestProject testProject = new TestProject(ejbProject.getProject());
+ IPackageFragment pack = testProject.getSourceFolder().createPackageFragment("org.elcipse.test", true, null);
+ testProject.createType(pack, "Sei.java", "@javax.jws.WebService public interface Sei {}");
+
+ helper.setProject(testProject.getProject());
+ assertNotNull("DOM project not retrieved", helper.getWebServiceProject("org.eclipse.jst.ws.jaxws.dom.jee5"));
+
+ try {
+ testProject.dispose();
+ } catch (Exception _) {
+ }
+ }
+
+ public void testGetWebServiceProjectDOMLoadingCanceled() throws Exception
+ {
+ final Mock<IWsDOMRuntimeExtension> extMock = mock(IWsDOMRuntimeExtension.class);
+ extMock.expects(once()).method("getDOM").will(throwException(new WsDOMLoadCanceledException("", "")));
+ helper = new DomValidationHelper() {
+ @Override
+ protected IWsDOMRuntimeExtension getDomRuntime(final String domId) {
+ return extMock.proxy();
+ }
+ };
+ assertNull("The helper returned dom instance", helper.getWebServiceProject("some.dom"));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationManagerTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationManagerTest.java
new file mode 100755
index 0000000..f8d9f8e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/dom/validation/DomValidationManagerTest.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.dom.validation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationHelper;
+import org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.Assertions;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.ConditionCheckException;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.internal.text.JaxWsUtilMessages;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+
+@SuppressWarnings("nls")
+public class DomValidationManagerTest extends TestCase
+{
+ private static final String WST_VALIDATION_XP = "org.eclipse.wst.validation.validator";
+
+ public void testRegistered()
+ {
+ final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(WST_VALIDATION_XP);
+ IExtension extension = extensionPoint.getExtension("org.eclipse.jst.ws.jaxws.dom.integration.wsValidator");
+ assertNotNull(extension);
+
+ IConfigurationElement element = findElement(extension.getConfigurationElements(), "validator");
+ element = findElement(element.getChildren(), "run");
+ assertEquals(DomValidationManager.class.getName(), element.getAttribute("class"));
+ }
+
+ private IConfigurationElement findElement(IConfigurationElement [] configElements, String name)
+ {
+ for (IConfigurationElement configElement : configElements) {
+ if (configElement.getName().equals(name)) {
+ return configElement;
+ }
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("restriction")
+ public void testValidateCalled() throws Exception
+ {
+ TestEjb3Project ejbProject = new TestEjb3Project("EjbProject" + System.currentTimeMillis());
+ TestProject testProject = new TestProject(ejbProject.getProject());
+ IPackageFragment pack = testProject.getSourceFolder().createPackageFragment("org.eclipse.test", true, null);
+ testProject.createType(pack, "Sei.java", "@javax.jws.WebService public interface Sei {}");
+
+ DomValidationHelper helper = new DomValidationHelper();
+ helper.setProject(testProject.getProject());
+
+ MyDomValidationManager manager = new MyDomValidationManager("org.eclipse.jst.ws.jaxws.dom.jee5");
+ manager.validate(helper, null);
+ assertTrue(manager.validationCalled);
+
+ manager = new MyDomValidationManager("sample.not.existing");
+ manager.validate(helper, null);
+ assertFalse(manager.validationCalled);
+ }
+
+ @SuppressWarnings("restriction")
+ public void testValidateCleansUpErrorMarkers() throws Exception
+ {
+ final TestProject testProject = createProject();
+ IType seiType = testProject.getJavaProject().findType("org.eclipse.test.Sei");
+ seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ IMarker [] markers = seiType.getResource().findMarkers(DomValidationConstants.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+
+ DomValidationHelper helper = new DomValidationHelper();
+ helper.setProject(testProject.getProject());
+ MyDomValidationManager manager = new MyDomValidationManager("org.eclipse.jst.ws.jaxws.dom.jee5");
+ manager.validate(helper, null);
+
+ markers = seiType.getResource().findMarkers(DomValidationConstants.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+
+ public void testRefreshTree() throws Exception
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+
+ IWebMethod wm = DomFactory.eINSTANCE.createIWebMethod();
+ wm.getParameters().add(DomFactory.eINSTANCE.createIWebParam());
+
+ sei.getImplementingWebServices().add(ws);
+ sei.getWebMethods().add(wm);
+
+ IWebServiceProject wsProject = DomFactory.eINSTANCE.createIWebServiceProject();
+ wsProject.getWebServices().add(ws);
+ wsProject.getServiceEndpointInterfaces().add(sei);
+
+ final Set<Object> elements = new HashSet<Object>();
+ DOMAdapterFactoryLabelProvider labelProvider = new DOMAdapterFactoryLabelProvider()
+ {
+ @Override
+ public void fireLabelProviderChanged (Object element) {
+ elements.add(element.getClass().getInterfaces()[0]);
+ }
+ };
+
+ Runnable refresh = new MyDomValidationManager("").getRefreshRunnable(labelProvider, wsProject);
+ refresh.run();
+
+ assertTrue(elements.contains(IWebServiceProject.class));
+ assertTrue(elements.contains(IWebServiceChildList.class));
+ assertTrue(elements.contains(ISEIChildList.class));
+ assertTrue(elements.contains(IServiceEndpointInterface.class));
+ assertTrue(elements.contains(IWebService.class));
+ assertTrue(elements.contains(IWebMethod.class));
+ assertTrue(elements.contains(IWebParam.class));
+ }
+
+ public void testValidationFrameworkTriggersValidation() throws Exception
+ {
+ final TestEjb3Project ejbProject = new TestEjb3Project("EjbProject" + System.currentTimeMillis());
+ final TestProject testProject = new TestProject(ejbProject.getProject());
+ final IPackageFragment pack = testProject.getSourceFolder().createPackageFragment("org.eclipse.test", true, null);
+ final IType wsType = testProject.createType(pack, "Ws.java", "@javax.jws.WebService(name=\"Test\") public class Ws {}");
+ testProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+
+ boolean autoBuild = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding();
+ try {
+ setAutoBuild(false);
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"^^^\") public class Ws {}");
+ testProject.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ Assertions.waitAssert(new IWaitCondition() {
+ public boolean checkCondition() throws ConditionCheckException {
+ try {
+ IMarker[] markers= wsType.getResource().findMarkers(DomValidationConstants.MARKER_ID, false, IResource.DEPTH_ZERO);
+ for(IMarker m : markers)
+ {
+ if((m.getAttribute(IMarker.SEVERITY) == null) || (m.getAttribute(IMarker.MESSAGE) == null))
+ {
+ return false;
+ }
+ if((Integer)m.getAttribute(IMarker.SEVERITY) == IMarker.SEVERITY_ERROR || JaxWsUtilMessages.WsdlNamesValidator_InvalidNCName2.equals(m.getAttribute(IMarker.MESSAGE)))
+ {
+ return true;
+ }
+ }
+ return false;
+ } catch (CoreException e) {
+ throw new ConditionCheckException(e);
+ }
+ }
+ },
+ "Expected error marker was not found");
+ }
+ finally {
+ setAutoBuild(autoBuild);
+ }
+ }
+
+ public void setContents(ICompilationUnit cu, String contents) throws JavaModelException
+ {
+ final String contentToSet = "package "+cu.getParent().getElementName()+";\n"+contents;
+ FileUtils.getInstance().setCompilationUnitContent(cu, contentToSet, true, null);
+ }
+
+ private void setAutoBuild(boolean auto) throws CoreException
+ {
+ final IWorkspaceDescription desc = ResourcesPlugin.getWorkspace().getDescription();
+ desc.setAutoBuilding(auto);
+ ResourcesPlugin.getWorkspace().setDescription(desc);
+ }
+
+ private TestProject createProject() throws Exception
+ {
+ TestEjb3Project ejbProject = new TestEjb3Project("EjbProject" + System.currentTimeMillis());
+ TestProject testProject = new TestProject(ejbProject.getProject());
+ IPackageFragment pack = testProject.getSourceFolder().createPackageFragment("org.eclipse.test", true, null);
+ testProject.createType(pack, "Sei.java", "@javax.jws.WebService(endpointInterface=\"\") public interface Sei {}");
+
+ return testProject;
+ }
+
+ protected class MyDomValidationManager extends DomValidationManager
+ {
+ public boolean validationCalled;
+ private String domId;
+
+ public MyDomValidationManager(String domId)
+ {
+ this.domId = domId;
+ }
+
+ @Override
+ protected Collection<IDomValidator> getValidators()
+ {
+ IDomValidator validator = new IDomValidator()
+ {
+ public String getSupportedDomRuntime() {
+ return domId;
+ }
+
+ public IStatus validate(EObject object) {
+ validationCalled = true;
+ return null;
+ }};
+
+ List<IDomValidator> validators = new ArrayList<IDomValidator>();
+ validators.add(validator);
+
+ return validators;
+ }
+
+ public RefreshRunnable getRefreshRunnable(DOMAdapterFactoryLabelProvider labelProvider, IWebServiceProject wsProject)
+ {
+ return new RefreshRunnable(labelProvider, wsProject);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryContentProviderTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryContentProviderTest.java
new file mode 100755
index 0000000..8d9efb4
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryContentProviderTest.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingCanceled;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingDummy;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.ui.DomItemProviderAdapterFactory;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils;
+
+public class DOMAdapterFactoryContentProviderTest extends TestCase
+{
+ private static TestProject testPrj1;
+
+ private static IPackageFragment modelSync1;
+
+ private IWebServiceProject wsProject;
+
+ protected JaxWsWorkspaceResource targetResource;
+ protected DOMAdapterFactoryContentProvider adapterFactory;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ if(testPrj1==null)
+ {
+ IProject ejbProject = TestProjectsUtils.createEjb3Project("DOMCntProvTestProject1" + System.currentTimeMillis());
+ testPrj1 = new TestProject(ejbProject.getProject());
+ testPrj1.createSourceFolder("src");
+ modelSync1 = testPrj1.createPackage("org.eclipse.test.modelsync1");
+ testPrj1.createType(modelSync1, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1{\n" +
+ "@javax.jws.WebMethod(name=\"parentMethod\") public void voidMethodWithNoArgsInParent();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "Sei2.java", "@javax.jws.WebService(name=\"Sei2Name\") public interface Sei2 extends Sei1 {\n" +
+ "@javax.jws.WebMethod(name=\"voidMethodWithArgs\") public void voidMethodWithArgs(@javax.jws.WebParam(name=\"param1\") java.util.List<String> param1);\n" +
+ "}");
+ testPrj1.createType(modelSync1, "WS1.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei2\") public class WS1 {}");
+ testPrj1.createType(modelSync1, "WS2.java", "@javax.jws.WebService(serviceName=\"WS2Name\") public class WS2 {}");
+ }
+
+ targetResource = new JaxWsWorkspaceResource(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
+ targetResource.load(null);
+ Iterator<IWebServiceProject> wsProjects = targetResource.getDOM().getWebServiceProjects().iterator();
+
+ while(wsProjects.hasNext())
+ {
+ IWebServiceProject wsProj = wsProjects.next();
+
+ if(wsProj.getName().equals(testPrj1.getProject().getName()))
+ {
+ this.wsProject = wsProj;
+ }
+ }
+
+ assertNotNull(this.wsProject);
+
+ adapterFactory = new DOMAdapterFactoryContentProvider()
+ {
+ @Override
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project) {
+ return wsProject;
+ }
+ };
+
+ targetResource.startSynchronizing();
+ }
+
+ @Override
+ public void tearDown() throws CoreException
+ {
+ targetResource.stopSynchronizing();
+ }
+
+ public void testDOMAdapterFactoryContentProvider()
+ {
+ assertNotNull(adapterFactory.getAdapterFactory());
+ assertTrue(adapterFactory.getAdapterFactory() instanceof DomItemProviderAdapterFactory);
+ }
+
+ public void testDOMAdapterFactoryContentProviderAdapterFactory()
+ {
+ adapterFactory = new DOMAdapterFactoryContentProvider(new DomItemProviderAdapterFactory());
+
+ assertNotNull(adapterFactory.getAdapterFactory());
+ assertTrue(adapterFactory.getAdapterFactory() instanceof DomItemProviderAdapterFactory);
+ }
+
+ public void testGetChildrenListsObject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+
+ assertNotNull(children);
+ assertEquals(children.length, 1);
+ assertTrue(children[0] instanceof IWebServiceProject);
+
+ children = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(children);
+ assertEquals(children.length, 2);
+ assertTrue(children[0] instanceof ISEIChildList);
+ assertTrue(children[1] instanceof IWebServiceChildList);
+
+ Object[] sEIs = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(sEIs);
+ assertEquals(3, sEIs.length);
+ assertTrue(sEIs[0] instanceof IServiceEndpointInterface);
+ assertTrue(sEIs[1] instanceof IServiceEndpointInterface);
+ assertTrue(sEIs[2] instanceof IServiceEndpointInterface);
+
+ Object[] wSs = adapterFactory.getChildren(children[1]);
+
+ assertNotNull(wSs);
+ assertEquals(wSs.length, 2);
+ assertTrue(wSs[0] instanceof IWebService);
+ assertTrue(wSs[1] instanceof IWebService);
+ }
+
+ public void testHasChildrenObject()
+ {
+ // IWebServiceProject
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+
+ assertTrue(adapterFactory.hasChildren(children[0]));
+
+ // ISEIChildList & IWebServiceChildList
+ children = adapterFactory.getChildren(children[0]);
+
+ assertTrue(adapterFactory.hasChildren(children[0]));
+ assertTrue(adapterFactory.hasChildren(children[1]));
+
+ // null parameter
+ assertFalse(adapterFactory.hasChildren(null));
+ }
+
+ public void testChildrenIWebService()
+ {
+ IWebService ws = findWs("org.eclipse.test.modelsync1.WS1");
+ assertNotNull(ws);
+ assertTrue(adapterFactory.hasChildren(ws));
+ assertEquals(1, adapterFactory.getChildren(ws).length);
+ assertTrue(adapterFactory.getChildren(ws)[0] instanceof IServiceEndpointInterface);
+
+ // check if adapted only once
+ DOMAdapterFactoryContentProvider otherFactory = new DOMAdapterFactoryContentProvider();
+ otherFactory.getChildren(ws);
+ assertEquals(2, ws.eAdapters().size());
+ }
+
+ public void testChildrenIServiceEndpointInterface()
+ {
+ IServiceEndpointInterface sei = findSei("org.eclipse.test.modelsync1.Sei2");
+ assertNotNull(sei);
+ assertTrue(adapterFactory.hasChildren(sei));
+ assertEquals(2, adapterFactory.getChildren(sei).length);
+ assertTrue(adapterFactory.getChildren(sei)[0] instanceof IWebMethod);
+ DOMAdapterFactoryContentProvider otherFactory = new DOMAdapterFactoryContentProvider();
+ otherFactory.getChildren(sei);
+ assertEquals(2, sei.eAdapters().size());
+
+ IWebService ws = findWs("org.eclipse.test.modelsync1.WS2");
+ assertNotNull(ws);
+ assertFalse(adapterFactory.hasChildren(ws.getServiceEndpoint()));
+ assertEquals(0, adapterFactory.getChildren(ws.getServiceEndpoint()).length);
+ // check if adapted only once
+ otherFactory.getChildren(ws.getServiceEndpoint());
+ assertEquals(2, ws.getServiceEndpoint().eAdapters().size());
+ }
+
+ public void testChildrenWebMethod()
+ {
+ IServiceEndpointInterface sei = findSei("org.eclipse.test.modelsync1.Sei2");
+ assertNotNull(sei);
+
+ IWebMethod method = findMethod(sei, "voidMethodWithArgs");
+ assertNotNull(method);
+ assertTrue(adapterFactory.hasChildren(method));
+ assertEquals(1, adapterFactory.getChildren(method).length);
+ assertTrue(adapterFactory.getChildren(method)[0] instanceof IWebParam);
+
+ method = findMethod(sei, "voidMethodWithNoArgsInParent");
+ assertNotNull(method);
+ assertFalse(adapterFactory.hasChildren(method));
+ assertEquals(0, adapterFactory.getChildren(method).length);
+ }
+
+ public void testChildrenWebParam()
+ {
+ IServiceEndpointInterface sei = findSei("org.eclipse.test.modelsync1.Sei2");
+ assertNotNull(sei);
+
+ IWebMethod method = findMethod(sei, "voidMethodWithArgs");
+ assertNotNull(method);
+ assertFalse(adapterFactory.hasChildren(method.getParameters().get(0)));
+ assertEquals(0, adapterFactory.getChildren(method.getParameters().get(0)).length);
+ }
+
+
+ private IServiceEndpointInterface findSei(final String implName)
+ {
+ for(IServiceEndpointInterface sei : wsProject.getServiceEndpointInterfaces())
+ {
+ if(sei.getImplementation().equals(implName)) {
+ return sei;
+ }
+ }
+
+ return null;
+ }
+
+ private IWebService findWs(final String implName)
+ {
+ for(IWebService ws : wsProject.getWebServices())
+ {
+ if(ws.getImplementation().equals(implName)) {
+ return ws;
+ }
+ }
+
+ return null;
+ }
+
+ private IWebMethod findMethod(IServiceEndpointInterface sei, final String methodName)
+ {
+ for(IWebMethod method : sei.getWebMethods())
+ {
+ if(method.getName().equals(methodName)) {
+ return method;
+ }
+ }
+
+ return null;
+ }
+
+// public void testNotifyChanged()
+// {
+// Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+//
+// try
+// {
+// testPrj1.createType(modelSync1, "Sei3.java", "@javax.jws.WebService(name=\"Sei3Name\") public interface Sei3 {}");
+// testPrj1.createType(modelSync1, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei3\") public class WS3 {}");
+// }
+// catch(JavaModelException e)
+// {
+// fail(e.toString());
+// }
+//
+// children = adapterFactory.getChildren(children[0]);
+//
+// Object[] sEIs = adapterFactory.getChildren(children[0]);
+//
+// assertEquals(sEIs.length, 3);
+//
+// Object[] wSs = adapterFactory.getChildren(children[1]);
+//
+// assertEquals(wSs.length, 3);
+// }
+
+ public void testGetWSProject()
+ {
+ adapterFactory = new DOMAdapterFactoryContentProvider();
+
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ assertNotNull(children);
+ }
+
+ public void testGetWsProjectDomNotLoaded()
+ {
+ adapterFactory = new DOMAdapterFactoryContentProvider() {
+ @Override
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project) {
+ return null;
+ }
+ };
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ assertEquals(1, children.length);
+ assertTrue(children[0] instanceof ILoadingWsProject);
+ children = adapterFactory.getChildren(children[0]);
+ assertEquals(1, children.length);
+ assertTrue(children[0] instanceof ILoadingDummy);
+ }
+
+ public void testGetWsProjectChildsDomLoadNotCanceled()
+ {
+ ILoadingWsProject loadingProject = new ILoadingWsProject() {
+ public IProject getProject() { return null; }
+ public boolean isLoadCanceled() {return false;}
+ };
+
+ Object[] children = adapterFactory.getChildren(loadingProject);
+ assertEquals(1, children.length);
+ assertTrue(children[0] instanceof ILoadingDummy);
+ }
+
+ public void testGetWsProjectChildsDomLoadCanceled()
+ {
+ ILoadingWsProject loadingProject = new ILoadingWsProject() {
+ public IProject getProject() { return null; }
+ public boolean isLoadCanceled() {return true;}
+ };
+
+ Object[] children = adapterFactory.getChildren(loadingProject);
+ assertEquals(1, children.length);
+ assertTrue(children[0] instanceof ILoadingCanceled);
+ }
+
+ public void testGetSupportingRuntime()
+ {
+ DOMAdapterFactoryContentProviderMy provider = new DOMAdapterFactoryContentProviderMy();
+ IWsDOMRuntimeExtension runtime = provider.getSupportingRuntime(testPrj1.getProject());
+ assertNotNull(runtime);
+ }
+
+ protected class DOMAdapterFactoryContentProviderMy extends DOMAdapterFactoryContentProvider
+ {
+ @Override
+ public IWsDOMRuntimeExtension getSupportingRuntime(final IProject project) {
+ return super.getSupportingRuntime(project);
+ }
+ };
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryLabelProviderTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryLabelProviderTest.java
new file mode 100755
index 0000000..a548760
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMAdapterFactoryLabelProviderTest.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils;
+
+public class DOMAdapterFactoryLabelProviderTest extends TestCase
+{
+ private static TestProject testPrj1;
+
+ protected JaxWsWorkspaceResource targetResource;
+ protected DOMAdapterFactoryContentProvider adapterFactory;
+ protected DOMAdapterFactoryLabelProvider labelProvider;
+
+ private IWebServiceProject wsProject;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ if(testPrj1==null)
+ {
+ IProject ejbProject = TestProjectsUtils.createEjb3Project("DOMLblProvTestProject1" + System.currentTimeMillis());
+ testPrj1 = new TestProject(ejbProject.getProject());
+ testPrj1.createSourceFolder("src");
+ final IPackageFragment modelSync1 = testPrj1.createPackage("org.eclipse.test.modelsync1");
+ testPrj1.createType(modelSync1, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1{\n" +
+ "@javax.jws.WebMethod(name=\"parentMethod\") public void voidMethodWithNoArgsInParent();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "Sei2.java", "@javax.jws.WebService(name=\"Sei2Name\") public interface Sei2 extends Sei1 {\n" +
+ "@javax.jws.WebMethod(name=\"webMethod\") public void voidMethodWithNoArgsNotInParent();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "WS1.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei2\") public class WS1 {}");
+ testPrj1.createType(modelSync1, "WS2.java", "@javax.jws.WebService(serviceName=\"WS2Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei2\") public class WS2 {}");
+ }
+
+ targetResource = new JaxWsWorkspaceResource(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
+ targetResource.load(null);
+ Iterator<IWebServiceProject> wsProjects = targetResource.getDOM().getWebServiceProjects().iterator();
+
+ while(wsProjects.hasNext())
+ {
+ IWebServiceProject wsProj = wsProjects.next();
+
+ if(wsProj.getName().equals(testPrj1.getProject().getName()))
+ {
+ this.wsProject = wsProj;
+ }
+ }
+
+ assertNotNull(this.wsProject);
+
+ labelProvider = new DOMAdapterFactoryLabelProvider();
+ adapterFactory = new DOMAdapterFactoryContentProvider()
+ {
+ @Override
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project) {
+ return wsProject;
+ }
+ };
+ }
+
+ public void testGetImageObject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+
+ assertNotNull(labelProvider.getImage(children[0]));
+
+ children = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getImage(children[0]));
+ assertNotNull(labelProvider.getImage(children[1]));
+
+ Object[] sEIs = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getImage(sEIs[0]));
+
+ assertNotSame(labelProvider.getImage(null), labelProvider.getImage(sEIs[0]));
+ assertNotSame(labelProvider.getImage(testPrj1), labelProvider.getImage(sEIs[0]));
+
+ Object[] wSs = adapterFactory.getChildren(children[1]);
+
+ assertNotNull(labelProvider.getImage(wSs[0]));
+
+ assertNotSame(labelProvider.getImage(null), labelProvider.getImage(wSs[0]));
+ assertNotSame(labelProvider.getImage(testPrj1), labelProvider.getImage(wSs[0]));
+
+ Object[] webMethods = adapterFactory.getChildren(sEIs[0]);
+
+ assertNotNull(labelProvider.getImage(webMethods[0]));
+
+ assertNotSame(labelProvider.getImage(null), labelProvider.getImage(webMethods[0]));
+ assertNotSame(labelProvider.getImage(testPrj1), labelProvider.getImage(webMethods[0]));
+ }
+
+ public void testGetTextObject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+
+ assertNotNull(labelProvider.getText(children[0]));
+
+ children = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getText(children[0]));
+ assertNotNull(labelProvider.getText(children[1]));
+
+ Object[] sEIs = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getText(sEIs[0]));
+
+ assertNotSame(labelProvider.getText(null), labelProvider.getText(sEIs[0]));
+ assertNotSame(labelProvider.getText(testPrj1), labelProvider.getText(sEIs[0]));
+
+ Object[] wSs = adapterFactory.getChildren(children[1]);
+
+ assertNotNull(labelProvider.getText(wSs[0]));
+
+ assertNotSame(labelProvider.getText(null), labelProvider.getText(wSs[0]));
+ assertNotSame(labelProvider.getText(testPrj1), labelProvider.getText(wSs[0]));
+
+ Object[] webMethods = adapterFactory.getChildren(sEIs[0]);
+
+ assertNotNull(labelProvider.getText(webMethods[0]));
+
+ assertNotSame(labelProvider.getText(null), labelProvider.getText(webMethods[0]));
+ assertNotSame(labelProvider.getText(testPrj1), labelProvider.getText(webMethods[0]));
+ }
+
+ public void testGetDescription()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+
+ assertNotNull(labelProvider.getDescription(children[0]));
+
+ children = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getDescription(children[0]));
+ assertNotNull(labelProvider.getDescription(children[1]));
+
+ Object[] sEIs = adapterFactory.getChildren(children[0]);
+
+ assertNotNull(labelProvider.getDescription(sEIs[0]));
+
+ assertNotSame(labelProvider.getDescription(null), labelProvider.getDescription(sEIs[0]));
+ assertNotSame(labelProvider.getDescription(testPrj1), labelProvider.getDescription(sEIs[0]));
+
+ Object[] wSs = adapterFactory.getChildren(children[1]);
+
+ assertNotNull(labelProvider.getDescription(wSs[0]));
+
+ assertNotSame(labelProvider.getDescription(null), labelProvider.getDescription(wSs[0]));
+ assertNotSame(labelProvider.getDescription(testPrj1), labelProvider.getDescription(wSs[0]));
+
+ Object[] webMethods = adapterFactory.getChildren(sEIs[0]);
+
+ assertNotNull(labelProvider.getDescription(webMethods[0]));
+
+ assertNotSame(labelProvider.getDescription(null), labelProvider.getDescription(webMethods[0]));
+ assertNotSame(labelProvider.getDescription(testPrj1), labelProvider.getDescription(webMethods[0]));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMPropertyViewAdapterFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMPropertyViewAdapterFactoryTest.java
new file mode 100755
index 0000000..a7f9117
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/DOMPropertyViewAdapterFactoryTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+public class DOMPropertyViewAdapterFactoryTest extends TestCase
+{
+ public void testGetAdapter()
+ {
+ DOMPropertyViewAdapterFactory propertyAdapterFactory = new DOMPropertyViewAdapterFactory();
+
+ assertNotNull(propertyAdapterFactory.getAdapter(propertyAdapterFactory, IPropertySourceProvider.class));
+ assertNull(propertyAdapterFactory.getAdapter(propertyAdapterFactory, IWebService.class));
+ assertTrue(propertyAdapterFactory.getAdapter(propertyAdapterFactory, IPropertySourceProvider.class) instanceof DOMAdapterFactoryContentProvider);
+ assertTrue(propertyAdapterFactory.getAdapter(propertyAdapterFactory, DOMPropertyViewAdapterFactory.class) instanceof DOMPropertyViewAdapterFactory);
+ }
+
+ public void testGetAdapterList()
+ {
+ DOMPropertyViewAdapterFactory propertyAdapterFactory = new DOMPropertyViewAdapterFactory();
+
+ assertNotNull(propertyAdapterFactory.getAdapterList());
+ assertEquals(propertyAdapterFactory.getAdapterList().length, 1);
+ assertEquals(propertyAdapterFactory.getAdapterList()[0], DOMAdapterFactoryContentProvider.class);
+ }
+
+ public void testGetAdapterUsesSameFactory()
+ {
+ DOMPropertyViewAdapterFactory propertyAdapterFactory = new DOMPropertyViewAdapterFactory();
+ Object adapter1 = propertyAdapterFactory.getAdapter(propertyAdapterFactory, IPropertySourceProvider.class);
+ assertNotNull(adapter1);
+ Object adapter2 = propertyAdapterFactory.getAdapter(propertyAdapterFactory, IPropertySourceProvider.class);
+ assertTrue(adapter1==adapter2);
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/WebServiceDecoratorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/WebServiceDecoratorTest.java
new file mode 100755
index 0000000..efc95f4
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/WebServiceDecoratorTest.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.CustomDomItemProviderAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceProblemsDecorator;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceProblemsDecorator.Severity;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+/**
+ * Tests for {@link WebServiceDecorator} class
+ *
+ * @author Georgi Vachkov
+ */
+public class WebServiceDecoratorTest extends TestCase
+{
+ private TestWebServiceDecorator decorator = new TestWebServiceDecorator();;
+ private TestProject testProject;
+ private IType seiType;
+ private IType wsType;
+
+ private DomUtil domUtil = DomUtil.INSTANCE;
+ private IWebService ws;
+ private IServiceEndpointInterface sei;
+ private IWebServiceProject wsProject;
+
+ @Override
+ public void setUp() throws CoreException
+ {
+ testProject = new TestProject();
+ testProject.createSourceFolder("src");
+ IPackageFragment pack = testProject.createPackage("test");
+ seiType = testProject.createType(pack, "Sei.java", "public interface Sei {}");
+
+ sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ sei.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, seiType.getFullyQualifiedName());
+
+ wsType = testProject.createType(pack, "Ws.java", "public class Ws {}");
+ ws = DomFactory.eINSTANCE.createIWebService();
+ ws.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, wsType.getFullyQualifiedName());
+
+ wsProject = DomFactory.eINSTANCE.createIWebServiceProject();
+ wsProject.eSet(DomPackage.Literals.IWEB_SERVICE_PROJECT__NAME, testProject.getProject().getName());
+ wsProject.getServiceEndpointInterfaces().add(sei);
+ wsProject.getWebServices().add(ws);
+ }
+
+ public void testDefineSeverityForObject() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(new Integer(1)));
+ }
+
+ public void testDefineSeverityForProject() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(wsProject));
+
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ assertEquals(Severity.ERROR, decorator.defineSeverity(wsProject));
+
+ seiType.getResource().deleteMarkers(DomValidationConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
+ assertEquals(Severity.OK, decorator.defineSeverity(wsProject));
+
+ marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ assertEquals(Severity.ERROR, decorator.defineSeverity(wsProject));
+ }
+
+ public void testDefineSeverityForISEIChildList() throws CoreException
+ {
+ Adapter adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, ISEIChildList.class);
+ assertEquals(Severity.OK, decorator.defineSeverity(adapter));
+
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(adapter));
+
+ adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, IWebServiceChildList.class);
+ assertEquals(Severity.OK, decorator.defineSeverity(adapter));
+ }
+
+ public void testDefineSeverityForIWebServiceChildList() throws CoreException
+ {
+ Adapter adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, IWebServiceChildList.class);
+ assertEquals(Severity.OK, decorator.defineSeverity(adapter));
+
+ IMarker marker = wsType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(adapter));
+
+ adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, ISEIChildList.class);
+ assertEquals(Severity.OK, decorator.defineSeverity(adapter));
+ }
+
+ public void testDefineSeverityIWebService() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(ws));
+
+ IMarker marker = wsType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(ws));
+ }
+
+ public void testDefineSeverityIWebServiceWrongSei() throws CoreException
+ {
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+
+ assertEquals(Severity.OK, decorator.defineSeverity(ws));
+
+ sei.getImplementingWebServices().add(ws);
+ assertEquals(Severity.ERROR, decorator.defineSeverity(ws));
+ }
+
+ public void testDefineSeveritySei() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(sei));
+
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ assertEquals(Severity.ERROR, decorator.defineSeverity(sei));
+
+ }
+
+ public void testDefineSeveritySeiWrongMethod() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(sei));
+
+ IWebMethod webMethod = createMethod(true);
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, domUtil.calcUniqueImpl(webMethod));
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(sei));
+ }
+
+ public void testDefineSeveritySeiWrongParam() throws CoreException
+ {
+ assertEquals(Severity.OK, decorator.defineSeverity(sei));
+
+ IWebMethod webMethod = createMethod(true);
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, domUtil.calcUniqueImpl(webMethod.getParameters().get(0)));
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(sei));
+ }
+
+ public void testDefineSeverityEObjectIResource() throws CoreException
+ {
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
+ assertEquals(Severity.ERROR, decorator.defineSeverity(sei, seiType.getResource()));
+
+ assertEquals(Severity.ERROR, decorator.defineSeverity(wsProject, testProject.getProject()));
+
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
+ assertEquals(Severity.WARNING, decorator.defineSeverity(sei, seiType.getResource()));
+
+ marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
+ assertEquals(Severity.OK, decorator.defineSeverity(sei, seiType.getResource()));
+ }
+
+ public void testIsRelevantForMethod() throws CoreException
+ {
+ final IWebMethod webMethod = createMethod(false);
+
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, domUtil.calcUniqueImpl(webMethod));
+ assertTrue(decorator.isRelevantForMethod(webMethod, marker));
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, "other");
+ assertFalse(decorator.isRelevantForMethod(webMethod, marker));
+ }
+
+ public void testIsRelevant() throws CoreException
+ {
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ assertFalse(decorator.isRelevant("impl", marker));
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, "impl");
+ assertTrue(decorator.isRelevant("impl", marker));
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, "impl");
+ assertFalse(decorator.isRelevant("newImpl", marker));
+ }
+
+ public void testIsRelevantFor() throws CoreException
+ {
+ IMarker marker = seiType.getResource().createMarker(DomValidationConstants.MARKER_ID);
+ assertTrue(decorator.isRelevantFor(sei, marker));
+ IWebMethod webMethod = createMethod(false);
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, domUtil.calcUniqueImpl(webMethod));
+ assertTrue(decorator.isRelevantFor(webMethod, marker));
+ webMethod = createMethod(true);
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, domUtil.calcUniqueImpl(webMethod.getParameters().get(0)));
+ assertTrue(decorator.isRelevantFor(webMethod, marker));
+ assertTrue(decorator.isRelevantFor(webMethod.getParameters().get(0), marker));
+ marker.setAttribute(DomValidationConstants.IMPLEMENTATION, "impl");
+ assertFalse(decorator.isRelevantFor(webMethod, marker));
+ assertFalse(decorator.isRelevantFor(webMethod.getParameters().get(0), marker));
+ }
+
+ private IWebMethod createMethod(boolean withParam)
+ {
+ final IWebMethod webMethod = DomFactory.eINSTANCE.createIWebMethod();
+ webMethod.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "method(I)");
+
+ if (withParam)
+ {
+ final IWebParam webParam = DomFactory.eINSTANCE.createIWebParam();
+ webParam.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "a");
+ webMethod.getParameters().add(webParam);
+ }
+
+ return webMethod;
+ }
+
+ protected static class TestWebServiceDecorator extends WebServiceProblemsDecorator
+ {
+ @Override
+ protected boolean isRelevant(final String implementation, final IMarker marker) throws CoreException {
+ return super.isRelevant(implementation, marker);
+ }
+
+ @Override
+ protected boolean isRelevantFor(final EObject eObject, final IMarker marker) throws CoreException {
+ return super.isRelevantFor(eObject, marker);
+ }
+
+ @Override
+ protected boolean isRelevantForMethod(final IWebMethod webMethod, final IMarker marker) throws CoreException {
+ return super.isRelevantForMethod(webMethod, marker);
+ }
+
+ @Override
+ protected Severity defineSeverity(final EObject eObject, final IResource resource) throws CoreException {
+ return super.defineSeverity(eObject, resource);
+ }
+
+ @Override
+ protected Severity defineSeverity(final Object obj) {
+ return super.defineSeverity(obj);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/actions/WSActionAbstractTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/actions/WSActionAbstractTest.java
new file mode 100755
index 0000000..8572bc4
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.integration.tests/src/org/eclipse/jst/ws/jaxws/dom/integration/tests/navigator/actions/WSActionAbstractTest.java
@@ -0,0 +1,830 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.tests.navigator.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions.WSActionProvider;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.internal.navigator.NavigatorContentService;
+import org.eclipse.ui.internal.navigator.extensions.CommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.NavigatorContentServiceFactory;
+
+@SuppressWarnings("restriction")
+public class WSActionAbstractTest extends MockObjectTestCase
+{
+ protected static TestProject testPrj1;
+ protected static TestProject testPrj2;
+ protected static TestProject testPrj3;
+ protected static TestProject testPrj4;
+
+ private IWebServiceProject wsProject1;
+ private IWebServiceProject wsProject2;
+ private IWebServiceProject wsProject3;
+ private IWebServiceProject wsProject4;
+
+ protected IPackageFragment modelSync1;
+ protected IPackageFragment modelSync2;
+ protected IPackageFragment modelSync3;
+ protected IPackageFragment modelSync4;
+
+ protected JaxWsWorkspaceResource targetResource;
+ protected DOMAdapterFactoryContentProvider adapterFactory;
+
+ protected WSActionProvider wsActionProv = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ if(testPrj1==null)
+ {
+ IProject ejbProject = TestProjectsUtils.createEjb3Project("DOMWSActionTestProject1" + System.currentTimeMillis());
+ testPrj1 = new TestProject(ejbProject.getProject());
+ testPrj1.createSourceFolder("src");
+ modelSync1 = testPrj1.createPackage("org.eclipse.test.modelsync1");
+ testPrj1.createType(modelSync1, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1{\n" +
+ "@javax.jws.WebMethod(operationName=\"parentMethod\") public void voidMethodWithNoArgsInParent();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "Sei2.java", "@javax.jws.WebService(name=\"Sei2Name\") public interface Sei2 extends Sei1 {\n" +
+ "@javax.jws.WebMethod(operationName=\"webMethod\") public void voidMethodWithNoArgsNotInParent();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "WS1.java", "@javax.ejb.Stateless\n" + "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei2\") public class WS1 {}");
+
+ }
+
+ if(testPrj2==null)
+ {
+ IProject webProject = TestProjectsUtils.createWeb25Project("DOMWSActionTestProject2" + System.currentTimeMillis());
+ testPrj2 = new TestProject(webProject.getProject());
+ testPrj2.createSourceFolder("src");
+ modelSync2 = testPrj2.createPackage("org.eclipse.test.modelsync2");
+ testPrj2.createType(modelSync2, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1{\n" +
+ "@javax.jws.WebMethod(operationName=\"parentMethod\") public void voidMethodWithNoArgsInParent();\n" +
+ "}");
+ testPrj2.createType(modelSync2, "Sei2.java", "@javax.jws.WebService(name=\"Sei2Name\") public interface Sei2 extends Sei1 {\n" +
+ "@javax.jws.WebMethod(operationName=\"webMethod\") public void voidMethodWithNoArgsNotInParent();\n" +
+ "}");
+ testPrj2.createType(modelSync2, "WS1.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"org.eclipse.test.modelsync1.Sei2\") public class WS1 {}");
+ }
+
+ if(testPrj3==null)
+ {
+ IProject ejbProject = TestProjectsUtils.createEjb3Project("DOMWSActionTestProject3" + System.currentTimeMillis());
+ testPrj3 = new TestProject(ejbProject.getProject());
+ testPrj3.createSourceFolder("src");
+ modelSync3 = testPrj3.createPackage("org.eclipse.test.modelsync3");
+ testPrj3.createType(modelSync3,
+ "WS1.java",
+ "@javax.jws.WebService(name=\"ImplicitSei1Name\") public class WS1 {\n"
+ + "@javax.jws.WebMethod(operationName=\"superParentMethod\") public void superParentMethod() {}\n"
+ + "}");
+
+ testPrj3.createType(modelSync3,
+ "WS2.java",
+ "@javax.jws.WebService(name=\"ImplicitSei2Name\") public class WS2 extends WS1 {\n"
+ + "@javax.jws.WebMethod(operationName=\"parentMethod\") public void parentMethod() {}\n"
+ + "}");
+
+ testPrj3.createType(modelSync3,
+ "WS3.java",
+ "@javax.jws.WebService(name=\"ImplicitSei3Name\") public class WS3 extends WS2 {\n"
+ + "@javax.jws.WebMethod(operationName=\"webMethod\") public void webMethod(int param) {}\n"
+ + "}");
+ }
+
+ if(testPrj4==null)
+ {
+ IProject webProject = TestProjectsUtils.createWeb25Project("DOMWSActionTestProject4" + System.currentTimeMillis());
+ testPrj4 = new TestProject(webProject.getProject());
+ testPrj4.createSourceFolder("src");
+ modelSync4 = testPrj4.createPackage("org.eclipse.test.modelsync4");
+ testPrj4.createType(modelSync4,
+ "WS1.java",
+ "@javax.jws.WebService(name=\"ImplicitSei1Name\") public class WS1 {\n"
+ + "@javax.jws.WebMethod(operationName=\"superParentMethod\") public void superParentMethod() {}\n"
+ + "}");
+
+ testPrj4.createType(modelSync4,
+ "WS2.java",
+ "@javax.jws.WebService(name=\"ImplicitSei2Name\") public class WS2 extends WS1 {\n"
+ + "@javax.jws.WebMethod(operationName=\"parentMethod\") public void parentMethod() {}\n"
+ + "}");
+
+ testPrj4.createType(modelSync4,
+ "WS3.java",
+ "@javax.jws.WebService(name=\"ImplicitSei3Name\") public class WS3 extends WS2 {\n"
+ + "@javax.jws.WebMethod(operationName=\"webMethod\") public void webMethod() {}\n"
+ + "}");
+ }
+
+ targetResource = new JaxWsWorkspaceResource(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
+ targetResource.load(null);
+
+ Iterator<IWebServiceProject> wsProjects = targetResource.getDOM().getWebServiceProjects().iterator();
+
+ while(wsProjects.hasNext())
+ {
+ IWebServiceProject wsProject = wsProjects.next();
+
+ if(wsProject.getName().equals(testPrj1.getProject().getName()))
+ {
+ this.wsProject1 = wsProject;
+ }
+ else if(wsProject.getName().equals(testPrj2.getProject().getName()))
+ {
+ this.wsProject2 = wsProject;
+ }
+ else if(wsProject.getName().equals(testPrj3.getProject().getName()))
+ {
+ this.wsProject3 = wsProject;
+ }
+ else if(wsProject.getName().equals(testPrj4.getProject().getName()))
+ {
+ this.wsProject4 = wsProject;
+ }
+ }
+
+ assertNotNull(this.wsProject1);
+ assertNotNull(this.wsProject2);
+ assertNotNull(this.wsProject3);
+ assertNotNull(this.wsProject4);
+
+ adapterFactory = new DOMAdapterFactoryContentProvider()
+ {
+ @Override
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project) {
+ if(project.getName().equals(wsProject1.getName()))
+ {
+ return wsProject1;
+ }
+ else if(project.getName().equals(wsProject2.getName()))
+ {
+ return wsProject2;
+ }
+ else if(project.getName().equals(wsProject3.getName()))
+ {
+ return wsProject3;
+ }
+ else if(project.getName().equals(wsProject4.getName()))
+ {
+ return wsProject4;
+ }
+ throw new junit.framework.AssertionFailedError("project " + project + "not found in DOM");
+ }
+ };
+
+ }
+
+ protected IWebService getWSFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ return (IWebService)wSs[0];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebService getWSFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj2.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ return (IWebService)wSs[0];
+ }
+ }
+
+ return null;
+ }
+
+ protected IServiceEndpointInterface getSEIExpFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ Object[] sEIs = adapterFactory.getChildren(children[ii]);
+
+ return (IServiceEndpointInterface)sEIs[0];
+ }
+ }
+
+ return null;
+ }
+
+ protected IServiceEndpointInterface getSEIFromTestPrj1(String seiName)
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ Object[] sEIs = adapterFactory.getChildren(children[ii]);
+
+ for(int jj=0; jj<sEIs.length; jj++)
+ {
+ if(((IServiceEndpointInterface)sEIs[jj]).getName().equals(seiName))
+ {
+ return (IServiceEndpointInterface)sEIs[jj];
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebService getWSFromTestPrj(TestProject testPrj, String wsName)
+ {
+ Object[] children = adapterFactory.getChildren(testPrj.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ for(int jj=0; jj<wSs.length; jj++)
+ {
+ if(((IWebService)wSs[jj]).getImplementation().equals(wsName))
+ {
+ return (IWebService)wSs[jj];
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+// protected IWebService getWSFromTestPrj1(String wsName)
+// {
+// Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+// children = adapterFactory.getChildren(children[0]);
+//
+// for(int ii=0; ii<children.length; ii++)
+// {
+// if(children[ii] instanceof IWebServiceChildList)
+// {
+// Object[] wSs = adapterFactory.getChildren(children[ii]);
+//
+// for(int jj=0; jj<wSs.length; jj++)
+// {
+// if(((IWebService)wSs[jj]).getName().equals(wsName))
+// {
+// return (IWebService)wSs[jj];
+// }
+// }
+// }
+// }
+//
+// return null;
+// }
+
+ protected IServiceEndpointInterface getSEIFromTestPrj3(String seiName)
+ {
+ Object[] children = adapterFactory.getChildren(testPrj3.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ for(int jj=0; jj<wSs.length; jj++)
+ {
+ if(((IWebService)wSs[jj]).getServiceEndpoint().getName().equals(seiName))
+ {
+ return ((IWebService)wSs[jj]).getServiceEndpoint();
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected IServiceEndpointInterface getSEIExpFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj2.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ Object[] sEIs = adapterFactory.getChildren(children[ii]);
+
+ return (IServiceEndpointInterface)sEIs[0];
+ }
+ }
+
+ return null;
+ }
+
+ protected IServiceEndpointInterface getSEIImpFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj3.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ return ((IWebService)wSs[0]).getServiceEndpoint();
+ }
+ }
+
+ return null;
+ }
+
+ protected IServiceEndpointInterface getSEIImpFromWebProject()
+ {
+
+ Object[] children = adapterFactory.getChildren(testPrj4.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ Object[] wSs = adapterFactory.getChildren(children[ii]);
+
+ return ((IWebService)wSs[0]).getServiceEndpoint();
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getWSMethodInheritedFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj3.getProject());
+ children = adapterFactory.getChildren(children[0]);
+ Object[] wSs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ wSs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(wSs);
+
+ for(int ii=0; ii<wSs.length; ii++)
+ {
+ if(((IWebService)wSs[ii]).getImplementation().equals("org.eclipse.test.modelsync3.WS3"))
+ {
+ webMethods = adapterFactory.getChildren(((IWebService)wSs[ii]).getServiceEndpoint());
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("superParentMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getWSMethodInheritedFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj4.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] wSs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ wSs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(wSs);
+
+ for(int ii=0; ii<wSs.length; ii++)
+ {
+ if(((IWebService)wSs[ii]).getImplementation().equals("org.eclipse.test.modelsync4.WS3"))
+ {
+ webMethods = adapterFactory.getChildren(((IWebService)wSs[ii]).getServiceEndpoint());
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("superParentMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getWSMethodNotInheritedFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj3.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] wSs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ wSs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(wSs);
+
+ for(int ii=0; ii<wSs.length; ii++)
+ {
+ if(((IWebService)wSs[ii]).getImplementation().equals("org.eclipse.test.modelsync3.WS3"))
+ {
+ webMethods = adapterFactory.getChildren(((IWebService)wSs[ii]).getServiceEndpoint());
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("webMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getWSMethodNotInheritedFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj4.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] wSs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof IWebServiceChildList)
+ {
+ wSs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(wSs);
+
+ for(int ii=0; ii<wSs.length; ii++)
+ {
+ if(((IWebService)wSs[ii]).getImplementation().equals("org.eclipse.test.modelsync4.WS3"))
+ {
+ webMethods = adapterFactory.getChildren(((IWebService)wSs[ii]).getServiceEndpoint());
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("webMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getSEIMethodInheritedFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] sEIs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ sEIs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(sEIs);
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ if(((IServiceEndpointInterface)sEIs[ii]).getName().equals("Sei2Name"))
+ {
+ webMethods = adapterFactory.getChildren(((IServiceEndpointInterface)sEIs[ii]));
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("parentMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getSEIMethodInheritedFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj2.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] sEIs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ sEIs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(sEIs);
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ if(((IServiceEndpointInterface)sEIs[ii]).getName().equals("Sei2Name"))
+ {
+ webMethods = adapterFactory.getChildren(((IServiceEndpointInterface)sEIs[ii]));
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("parentMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getSEIMethodNotInheritedFromEjbProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj1.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] sEIs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ sEIs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(sEIs);
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ if(((IServiceEndpointInterface)sEIs[ii]).getName().equals("Sei2Name"))
+ {
+ webMethods = adapterFactory.getChildren(((IServiceEndpointInterface)sEIs[ii]));
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("webMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected IWebMethod getSEIMethodNotInheritedFromWebProject()
+ {
+ Object[] children = adapterFactory.getChildren(testPrj2.getProject());
+ children = adapterFactory.getChildren(children[0]);
+
+ Object[] sEIs = null;
+ Object[] webMethods = null;
+
+ for(int ii=0; ii<children.length; ii++)
+ {
+ if(children[ii] instanceof ISEIChildList)
+ {
+ sEIs = adapterFactory.getChildren(children[ii]);
+
+ break;
+ }
+ }
+
+ assertNotNull(sEIs);
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ if(((IServiceEndpointInterface)sEIs[ii]).getName().equals("Sei2Name"))
+ {
+ webMethods = adapterFactory.getChildren(((IServiceEndpointInterface)sEIs[ii]));
+
+ break;
+ }
+ }
+
+ assertNotNull(webMethods);
+
+ for(int ii=0; ii<webMethods.length; ii++)
+ {
+ if(((IWebMethod)webMethods[ii]).getName().equals("webMethod"))
+ {
+ return (IWebMethod)webMethods[ii];
+ }
+ }
+
+ return null;
+ }
+
+ protected void initWsActionProviderWithTreeSelection(Object[] selection)
+ {
+ wsActionProv = new WSActionProvider();
+
+ Mock<TreeViewer> treeViewer = mock(TreeViewer.class);
+ CommonActionExtensionSite cAExtSite = createCommonActionExtensionSiteMock(treeViewer.proxy());
+
+ wsActionProv.init(cAExtSite);
+
+ TreePath path = new TreePath(selection);
+ StructuredSelection sel = new TreeSelection(path);
+ ActionContext actCnt = new ActionContext(sel);
+
+ wsActionProv.setContext(actCnt);
+ }
+
+ protected void initWsActionProviderWithStructuredSelection(Object[] selection)
+ {
+ wsActionProv = new WSActionProvider();
+
+ Mock<TreeViewer> treeViewer = mock(TreeViewer.class);
+ CommonActionExtensionSite cAExtSite = createCommonActionExtensionSiteMock(treeViewer.proxy());
+
+ wsActionProv.init(cAExtSite);
+
+ StructuredSelection sel = new StructuredSelection(selection);
+ ActionContext actCnt = new ActionContext(sel);
+
+ wsActionProv.setContext(actCnt);
+ }
+
+ protected IWebServiceProject getWsProject(IProject project)
+ {
+ Iterator<IWebServiceProject> wsProjects = targetResource.getDOM().getWebServiceProjects().iterator();
+
+ while(wsProjects.hasNext())
+ {
+ IWebServiceProject wsProject = wsProjects.next();
+
+ if(wsProject.getName().equals(project.getName()))
+ {
+ return wsProject;
+ }
+ }
+ throw new junit.framework.AssertionFailedError("project " + project + "not found in DOM");
+ }
+
+ protected CommonActionExtensionSite createCommonActionExtensionSiteMock(final StructuredViewer viewer)
+ {
+ final NavigatorContentService contentService = (NavigatorContentService)NavigatorContentServiceFactory.INSTANCE.createContentService("myviewer");
+
+ return new CommonActionExtensionSite("myextensionid", (ICommonViewerSite)mock(ICommonViewerSite.class).proxy(), contentService, viewer);
+ }
+
+ protected IContributionItem createContributionItemMock(final String itemId)
+ {
+ Mock<IContributionItem> cntrbItem = mock(IContributionItem.class);
+ cntrbItem.stubs().method("getId").will(returnValue(itemId));
+ cntrbItem.stubs().method("setParent").will(returnValue(null));
+ cntrbItem.stubs().method("isDynamic").will(returnValue(false));
+ return cntrbItem.proxy();
+ }
+
+ protected void fillMenuWithContributionItems(final MenuManager menu, final String... itemIds)
+ {
+ for(String id : itemIds)
+ {
+ IContributionItem cntrbItem = createContributionItemMock(id);
+ menu.add(cntrbItem);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.classpath b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.project b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.project
new file mode 100755
index 0000000..1c241a6
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.runtime.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..56a52c8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DOM Runtime Tests (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.runtime.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.jst.ws.jaxws.testutils,
+ org.jmock,
+ org.eclipse.jst.ws.jaxws.dom.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.core.runtime,
+ org.eclipse.jst.ws.jaxws.utils,
+ org.eclipse.jface.text,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.emf.validation,
+ org.junit
+Export-Package: org.eclipse.jst.ws.jaxws.dom.runtime.tests
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/about.html b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/about.html
new file mode 100644
index 0000000..d2b7ace
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 20, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/build.properties b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/build.properties
new file mode 100755
index 0000000..61726b0
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/plugin.xml b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/plugin.xml
new file mode 100755
index 0000000..3693b7f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/plugin.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ SAP AG - initial API and implementation
+ -->
+
+<fragment>
+ <extension
+ id="supportedruntimetest"
+ name="Testing"
+ point="org.eclipse.jst.ws.jaxws.dom.runtime.domruntimes">
+ <implementation class="org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.TestWsDOMRuntimeExtension"/>
+ <project_facet
+ id="jst.web"
+ version="1.0.0.0"/>
+ <project_facet
+ id="test.facet"/>
+ </extension>
+ <extension
+ id="supportedruntimetest1"
+ name="Testing1"
+ point="org.eclipse.jst.ws.jaxws.dom.runtime.domruntimes">
+ <implementation class="org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.TestWsDOMRuntimeExtension"/>
+ <project_facet
+ id="jst.webb"
+ version="1.0.0.0"/>
+ <project_facet
+ id="test.facett"/>
+ </extension>
+ <extension
+ id="supportedruntimetest2"
+ name="Testing2"
+ point="org.eclipse.jst.ws.jaxws.dom.runtime.domruntimes">
+ <implementation class="org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.WsDOMRuntimeRegistryTest"/>
+ <project_facet
+ id="jst.webb"
+ version="1.0.0.0"/>
+ <project_facet
+ id="test.facett"/>
+ </extension>
+</fragment>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/AllTestsSuite.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/AllTestsSuite.java
new file mode 100755
index 0000000..707e3dd
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/AllTestsSuite.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.AnnotationFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.AnnotationsTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.ArrayValueImplTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.ComplexAnnotationImplTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.ParamValuePairImplTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations.QualifiedNameValueImplTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.LocatorExtractorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.WsDOMRuntimeManagerTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.WsDOMRuntimeRegistryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.JaxWsDefaultsCalculatorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.JaxWsWorkspaceResourceTests;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.Jee5WsDomRuntimeExtensionTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.ProjectAddingTests;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.WorkspaceCUFinderTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation.AnnotationAdapterFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation.impl.AnnotationAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults.MethodPropertyDefaultsAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults.ParameterPropertyDefaultsAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults.SeiPropertyDefaultsAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults.WsPropertyDefaultsAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.AbstractSerializerAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.MethodSerializerAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.ParameterSerializerAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.SeiSerializerAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.SerializerAdapterFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer.WsSerializerAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state.MethodPropertyStateAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state.ParameterPropertyStateAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state.PropertyStateAdapterFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state.SeiPropertyStateAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state.WsPropertyStateAdapterTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.AbstractModelSynchronizerTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.ImplicitSeiMethodSynchronizationTests;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.MethodParamsSynchronizationTests;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.ModelSynchronizationTests;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.OnEventModelSyncronizerTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.SeiMethodSyncronizationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.SeiSyncronizationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync.WsSynchronizationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.util.Dom2ResourceMapperTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.util.DomUtilTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.AbstractValidationConstraintTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.ConstraintStatusExtendedTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.DomValidationConstraintDescriptorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.DomValidatorFactoryTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.EndpointIsSessionBeanConstraintTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.JaxWsDomValidatorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.SeiValidationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.WmValidationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.WpValidationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation.WsValidationTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation.MethodValidatorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation.RuntimeTypeValidatorTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation.SeiValidatorTest;
+
+public class AllTestsSuite
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(RuntimeTypeValidatorTest.class);
+ suite.addTestSuite(MethodValidatorTest.class);
+ suite.addTestSuite(AnnotationFactoryTest.class);
+ suite.addTestSuite(AnnotationsTest.class);
+ suite.addTestSuite(ParamValuePairImplTest.class);
+ suite.addTestSuite(ComplexAnnotationImplTest.class);
+ suite.addTestSuite(QualifiedNameValueImplTest.class);
+ suite.addTestSuite(ArrayValueImplTest.class);
+ suite.addTestSuite(SeiValidatorTest.class);
+ suite.addTestSuite(WsDOMRuntimeRegistryTest.class);
+ suite.addTestSuite(WsDOMRuntimeManagerTest.class);
+ suite.addTestSuite(DomValidatorFactoryTest.class);
+ suite.addTestSuite(Dom2ResourceMapperTest.class);
+ suite.addTestSuite(DomUtilTest.class);
+
+ // DOM tests
+ suite.addTestSuite(Jee5WsDomRuntimeExtensionTest.class);
+ suite.addTestSuite(JaxWsWorkspaceResourceTests.class);
+ suite.addTestSuite(ProjectAddingTests.class);
+ suite.addTestSuite(WorkspaceCUFinderTest.class);
+ suite.addTestSuite(LocatorExtractorTest.class);
+ // DOM sync tests
+ suite.addTestSuite(AbstractModelSynchronizerTest.class);
+ suite.addTestSuite(OnEventModelSyncronizerTest.class);
+ suite.addTestSuite(ImplicitSeiMethodSynchronizationTests.class);
+ suite.addTestSuite(MethodParamsSynchronizationTests.class);
+ suite.addTestSuite(ModelSynchronizationTests.class);
+ suite.addTestSuite(SeiMethodSyncronizationTest.class);
+ suite.addTestSuite(SeiSyncronizationTest.class);
+ suite.addTestSuite(WsSynchronizationTest.class);
+ suite.addTestSuite(JaxWsDefaultsCalculatorTest.class);
+ // state adapters tests
+ suite.addTestSuite(MethodPropertyStateAdapterTest.class);
+ suite.addTestSuite(PropertyStateAdapterFactoryTest.class);
+ suite.addTestSuite(SeiPropertyStateAdapterTest.class);
+ suite.addTestSuite(WsPropertyStateAdapterTest.class);
+ suite.addTestSuite(ParameterPropertyStateAdapterTest.class);
+ // serialize adapter tests
+ suite.addTestSuite(AbstractSerializerAdapterTest.class);
+ suite.addTestSuite(MethodSerializerAdapterTest.class);
+ suite.addTestSuite(SeiSerializerAdapterTest.class);
+ suite.addTestSuite(SerializerAdapterFactoryTest.class);
+ suite.addTestSuite(WsSerializerAdapterTest.class);
+ suite.addTestSuite(ParameterSerializerAdapterTest.class);
+ // default values adapter tests
+ suite.addTestSuite(MethodPropertyDefaultsAdapterTest.class);
+ suite.addTestSuite(WsPropertyDefaultsAdapterTest.class);
+ suite.addTestSuite(SeiPropertyDefaultsAdapterTest.class);
+ suite.addTestSuite(ParameterPropertyDefaultsAdapterTest.class);
+ // other adapters tests
+ suite.addTestSuite(AnnotationAdapterTest.class);
+ suite.addTestSuite(AnnotationAdapterFactoryTest.class);
+ // validation tests
+ suite.addTestSuite(AbstractValidationConstraintTest.class);
+ suite.addTestSuite(DomValidationConstraintDescriptorTest.class);
+ suite.addTestSuite(JaxWsDomValidatorTest.class);
+ suite.addTestSuite(SeiValidationTest.class);
+ suite.addTestSuite(WsValidationTest.class);
+ suite.addTestSuite(WmValidationTest.class);
+ suite.addTestSuite(WpValidationTest.class);
+ suite.addTestSuite(EndpointIsSessionBeanConstraintTest.class);
+
+ //suite.addTestSuite(CAFWsdlTests.class);
+
+ suite.addTestSuite(ConstraintStatusExtendedTest.class);
+
+ return suite;
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationFactoryTest.java
new file mode 100755
index 0000000..39afe7c
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationFactoryTest.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+/**
+ * AnnotationFactory class test cases.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("nls")
+public class AnnotationFactoryTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+
+ public void testCreateStringValue()
+ {
+ try
+ {
+ AnnotationFactory.createStringValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ IValue strValue = AnnotationFactory.createStringValue("value");
+ assertNotNull(strValue);
+ assertTrue(strValue.toString().equals("value"));
+ }
+
+ public void testCreateParamValuePair()
+ {
+ IValue strValue = AnnotationFactory.createStringValue("value");
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue(null, strValue);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue("", null);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ IParamValuePair valuePair = AnnotationFactory.createParamValuePairValue("param", strValue);
+ assertNotNull(valuePair);
+ assertTrue(valuePair.getValue() instanceof IValue);
+ assertTrue(valuePair.getParam().equals("param"));
+ }
+
+ public void testCreateComplexAnnotation() throws Exception
+ {
+ IValue strValue1 = AnnotationFactory.createStringValue("value");
+ IParamValuePair valuePair1 = AnnotationFactory.createParamValuePairValue("param", strValue1);
+
+ IValue strValue2 = AnnotationFactory.createStringValue("value1");
+ IParamValuePair valuePair2 = AnnotationFactory.createParamValuePairValue("param1", strValue2);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(valuePair1);
+ paramValues.add(valuePair2);
+
+ try
+ {
+ AnnotationFactory.createAnnotation(null, paramValues,endpoint);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotation("", null, endpoint);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ prepareProject();
+ IAnnotation<IType> ca = AnnotationFactory.createAnnotation("name", paramValues,endpoint);
+ assertNotNull(ca);
+ assertEquals(ca.getParamValuePairs().size(), 2);
+ }
+
+ public void testCreateValuePair()
+ {
+ try
+ {
+ AnnotationFactory.createParamValuePairValue("", null);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue(null, null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+ }
+
+ public void testCreateArrayValue()
+ {
+ try
+ {
+ AnnotationFactory.createArrayValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ IValue strValue1 = AnnotationFactory.createStringValue("value1");
+ IValue strValue2 = AnnotationFactory.createStringValue("value2");
+ Set<IValue> values = new HashSet<IValue>();
+ values.add(strValue1);
+ values.add(strValue2);
+
+
+ IValue arrValue = AnnotationFactory.createArrayValue(values);
+ assertNotNull(arrValue);
+ assertTrue(arrValue.toString().equals("[value1, value2]"));
+ }
+
+ public void testCreateQualifiedNameValue()
+ {
+ try
+ {
+ AnnotationFactory.createQualifiedNameValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ IValue qName = AnnotationFactory.createQualifiedNameValue("org.eclipse.demo.Test");
+ assertNotNull(qName);
+ assertTrue(qName.toString().equals("org.eclipse.demo.Test"));
+ }
+
+ public void testCreateBooleanValue()
+ {
+ IValue boolValue = AnnotationFactory.createBooleanValue(true);
+ assertNotNull(boolValue);
+ assertEquals(boolValue.toString(), "true");
+ }
+
+ public void testGetAnnotationsFromClass() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 2);
+ }
+
+// public void testGetAnnotationsFromField() throws Exception // $JL-EXC$
+// {
+// prepareProject();
+//
+// IField field = endpoint.getField("field1");
+// assertNotNull(field);
+//
+// IAnnotation[] annotations = AnnotationFactory.createAnnotattionInspector(endpoint).inspectMethod(method) getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 1);
+// }
+
+ public void testGetAnnotationsFromMethod() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);;
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 1);
+ }
+
+ public void testRemoveAnnotationsIType() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint). inspectType();
+ assertTrue(annotations.size() == 0);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ @SuppressWarnings("unused")
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotations.size() == 0);
+ }
+
+ public void testRemoveAnnotationsITypeSetOfString() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ Set<String> toRemove = new HashSet<String>();
+ toRemove.add("WebService");
+ toRemove.add("WebMethod");
+
+ AnnotationFactory.removeAnnotations(endpoint, toRemove);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 1);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size() == 0);
+ }
+
+ public void testRemoveAnnotationsIField() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IField field = endpoint.getField("field1");
+ assertNotNull(field);
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(field);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 2);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size() == 1);
+
+// annotations = AnnotationFactory.getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 0);
+ }
+
+ public void testRemoveAnnotationsIMethod() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ @SuppressWarnings("unused")
+ IField field = endpoint.getField("field1");
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(method);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 2);
+
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size()== 0);
+
+// annotations = AnnotationFactory.getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 0);
+ }
+
+ private void prepareProject() throws Exception // $JL-EXC$
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationsTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationsTest.java
new file mode 100755
index 0000000..193e333
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/AnnotationsTest.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationInspectorImpl;
+
+public class AnnotationsTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testAddComplexAnnotationQNValue() throws JavaModelException, AnnotationGeneratorException
+ {
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ IParamValuePair pv = AnnotationFactory.createParamValuePairValue("param", qv);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pv);
+ IAnnotation<IType> annotation = AnnotationFactory.createAnnotation("javax.jws.WebService", paramValues, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, endpoint);
+
+ assertTrue(AnnotationFactory.createAnnotationInspector(endpoint).inspectType().size() > 0);
+ }
+
+// public void testAddSingleElementAnnotationArrayValues() throws JavaModelException, AnnotationGeneratorException
+// {
+// IAnnotation annotation = AnnotationFactory.createSingleElementAnnotation("javax.jws.WebService", new String[] { "val1", "val2" });
+// annotation.addToClass(endpoint);
+//
+// assertTrue(AnnotationFactory.getAnnotationsFromClass(endpoint).length > 0);
+// }
+//
+// public void testAddSimpleAnnotation() throws JavaModelException, AnnotationGeneratorException
+// {
+// IAnnotation annotation = AnnotationFactory.createSimpleAnnotation("javax.jws.WebService");
+// annotation.addToClass(endpoint);
+//
+// assertTrue(AnnotationFactory.getAnnotationsFromClass(endpoint).length > 0);
+// }
+
+ /**
+ * Creates complex annotation and adds it to class. The annotation has the form:
+ *
+ * <pre>
+ * @WebService(serviceName="serviceName",
+ * name="portTypeName",
+ * targetNamespace="http://demo.sap.com/",
+ * wsdlLocation="http://wsdl/url/",
+ * portName="portName",
+ * endpointInterface="org.eclipse.demo.ISei")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexClassAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ addStringProperty(paramValues, "serviceName", "serviceName");
+ addStringProperty(paramValues, "name", "portTypeName");
+ addStringProperty(paramValues, "targetNamespace", "http://demo.sap.com/");
+ addStringProperty(paramValues, "wsdlLocation", "http://wsdl/url/");
+ addStringProperty(paramValues, "portName", "portName");
+ addStringProperty(paramValues, "endpointInterface", "org.eclipse.demo.ISei");
+
+ IAnnotation<IType> annotation = AnnotationFactory.createAnnotation("javax.jws.WebService", paramValues, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, endpoint);
+
+ AnnotationInspectorImpl annotationInspector = new AnnotationInspectorImpl(endpoint);
+ Collection<IAnnotation<IType>> typeAnnotations = annotationInspector.inspectType();
+
+ boolean result = false;
+ for (IAnnotation<IType> typeAnnotation : typeAnnotations)
+ {
+ if(typeAnnotation.getAnnotationName().equals("WebService") || typeAnnotation.getAnnotationName().equals("javax.jws.WebService"))
+ {
+ if(typeAnnotation.getParamValuePairs().size() != 6)
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("serviceName").equals("serviceName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("name").equals("portTypeName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("targetNamespace").equals("http://demo.sap.com/"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("wsdlLocation").equals("http://wsdl/url/"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("portName").equals("portName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("endpointInterface").equals("org.eclipse.demo.ISei"))
+ {
+ break;
+ }
+
+ result = true;
+ }
+ }
+
+ assertTrue("Class is not annotated correctly", result);
+ }
+
+ /**
+ * Creates complex annotation and adds it to method declaration. Annotation has the form:
+ *
+ * <pre>
+ * \@WebMethod(exclude=false,operationName="annotatedMethod",action="go")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexMethodAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ IValue emValue = AnnotationFactory.createBooleanValue(false);
+ paramValues.add(AnnotationFactory.createParamValuePairValue("exclude", emValue));
+
+ addStringProperty(paramValues, "operationName", "annotatedMethod");
+ addStringProperty(paramValues, "action", "go");
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+
+ IAnnotation<IMethod> annotation = AnnotationFactory.createAnnotation("javax.jws.WebMethod", paramValues, method);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, method);
+
+ AnnotationInspectorImpl annotationInspector = new AnnotationInspectorImpl(endpoint);
+ Collection<IAnnotation<IMethod>> methodAnnotations = annotationInspector.inspectMethod(method);
+
+ boolean result = false;
+ for (IAnnotation<IMethod> methodAnnotation : methodAnnotations)
+ {
+ if(methodAnnotation.getAnnotationName().equals("javax.jws.WebMethod") || methodAnnotation.getAnnotationName().equals("WebMethod"))
+ {
+ if(methodAnnotation.getParamValuePairs().size() != 3)
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("exclude").equals("false"))
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("operationName").equals("annotatedMethod"))
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("action").equals("go"))
+ {
+ break;
+ }
+
+ result = true;
+ }
+ }
+
+ assertTrue("Method is not annotated correctly", result);
+ }
+
+ /**
+ * Creates complex annotation and adds it to a method parameter. The annotation has the form:
+ *
+ * <pre>
+ * \@WebParam(operationName="annotatedParam", targetNamespace="http://demo.sap.com/params/", partName="partName")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexParamAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ ITypeParameter typeParameter = method.getTypeParameter("annotatedParam");
+
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ addStringProperty(paramValues, "annotatedParam", "param");
+ addStringProperty(paramValues, "targetNamespace", "http://demo.sap.com/params/");
+ addStringProperty(paramValues, "partName", "partName");
+
+ IAnnotation<ITypeParameter> annotation = AnnotationFactory.createAnnotation("javax.jws.WebParam", paramValues, typeParameter);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, typeParameter);
+ }
+
+ private void addStringProperty(Set<IParamValuePair> paramValues, String property, String value)
+ {
+ IValue pValue = AnnotationFactory.createStringValue(value);
+ IParamValuePair pair = AnnotationFactory.createParamValuePairValue(property, pValue);
+ paramValues.add(pair);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ArrayValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ArrayValueImplTest.java
new file mode 100755
index 0000000..2e2e202
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ArrayValueImplTest.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ArrayValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+
+public class ArrayValueImplTest extends TestCase
+{
+
+ public void testHashCode()
+ {
+ Set<IValue> values1 = new HashSet<IValue>();
+ values1.clear();
+ values1.add(new StringValueImpl("val1"));
+ ArrayValueImpl av1 = new ArrayValueImpl(values1);
+
+ Set<IValue> values2 = new HashSet<IValue>();
+ values2.clear();
+ values2.add(new StringValueImpl("val2"));
+ ArrayValueImpl av2 = new ArrayValueImpl(values2);
+
+ assertTrue(av1.hashCode() != av2.hashCode());
+ }
+
+ public void testArrayValueImpl()
+ {
+ try
+ {
+ new ArrayValueImpl(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testEqualsObject()
+ {
+ Set<IValue> values1 = new HashSet<IValue>();
+ values1.clear();
+ values1.add(new StringValueImpl("val1"));
+ ArrayValueImpl av1 = new ArrayValueImpl(values1);
+
+ Set<IValue> values2 = new HashSet<IValue>();
+ values2.clear();
+ values2.add(new StringValueImpl("val2"));
+ ArrayValueImpl av2 = new ArrayValueImpl(values2);
+
+ Set<IValue> values3 = new HashSet<IValue>();
+ values3.clear();
+ values3.add(new StringValueImpl("val1"));
+ ArrayValueImpl av3 = new ArrayValueImpl(values3);
+
+ assertFalse(av1.equals(null));
+ assertFalse(av1.equals(123));
+ assertFalse(av1.equals(av2));
+
+ assertTrue(av1.equals(av3));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ComplexAnnotationImplTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ComplexAnnotationImplTest.java
new file mode 100755
index 0000000..c8665fe
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ComplexAnnotationImplTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class ComplexAnnotationImplTest extends MockObjectTestCase
+{
+ private Mock<IType> typeElement = mock(IType.class);
+
+ public void testHashCode()
+ {
+ IValue value = AnnotationFactory.createStringValue("value");
+ IParamValuePair pvp = AnnotationFactory.createParamValuePairValue("param", value);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pvp);
+ IAnnotation<IType> annotation1 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation2 = AnnotationFactory.createAnnotation("annotationName2", paramValues,typeElement.proxy());
+
+ assertTrue(annotation1.hashCode() != annotation2.hashCode());
+ }
+
+ public void testEqualsObject()
+ {
+ IValue value = AnnotationFactory.createStringValue("value");
+ IParamValuePair pvp = AnnotationFactory.createParamValuePairValue("param", value);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pvp);
+ IAnnotation<IType> annotation1 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation2 = AnnotationFactory.createAnnotation("annotationName2", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation3 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+
+ assertFalse(annotation1.equals(annotation2));
+ assertFalse(annotation1.equals(null));
+ assertFalse(annotation1.equals(123));
+ assertTrue(annotation1.equals(annotation3));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/Endpoint.src b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/Endpoint.src
new file mode 100755
index 0000000..89c7a40
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/Endpoint.src
@@ -0,0 +1,15 @@
+import java.util.List;
+import java.util.Map;
+
+@WebService(serviceName="WSImplBeanService", name="WSImplBean", targetNamespace="http://demo/sap/com/", portName="WSImplBeanPort")
+@Stateless
+public class Endpoint
+{
+ @MyAnnotation(name="field1")
+ public String field1;
+
+ @WebMethod(exclude=false,operationName="test")
+ public void annotatedMethod( @WebParam(name="annotatedParam") String annotatedParam)
+ {
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ParamValuePairImplTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ParamValuePairImplTest.java
new file mode 100755
index 0000000..1567ef2
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/ParamValuePairImplTest.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ParamValuePairImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+
+public class ParamValuePairImplTest extends TestCase
+{
+
+ public void testHashCode()
+ {
+ IValue value = new StringValueImpl("value");
+ ParamValuePairImpl pvp = new ParamValuePairImpl("param", value);
+
+ IValue value1 = new StringValueImpl("value1");
+ ParamValuePairImpl pvp1 = new ParamValuePairImpl("param1", value1);
+
+ assertFalse(pvp.hashCode() == pvp1.hashCode());
+ assertFalse(pvp.equals(null));
+ assertFalse(pvp.equals(123));
+ }
+
+ public void testEqualsObject()
+ {
+ IValue value = new StringValueImpl("value");
+ ParamValuePairImpl pvp = new ParamValuePairImpl("param", value);
+
+ IValue value1 = new StringValueImpl("value");
+ ParamValuePairImpl pvp1 = new ParamValuePairImpl("param", value1);
+
+ IValue value2 = new StringValueImpl("value2");
+ ParamValuePairImpl pvp2 = new ParamValuePairImpl("param2", value2);
+
+ assertTrue(pvp.equals(pvp1));
+ assertFalse(pvp.equals(pvp2));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/QualifiedNameValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/QualifiedNameValueImplTest.java
new file mode 100755
index 0000000..7767346
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/annotations/QualifiedNameValueImplTest.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.annotations;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class QualifiedNameValueImplTest extends TestCase
+{
+
+ public void testHashCode()
+ {
+ IValue qv1 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name1");
+ IValue qv2 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ assertFalse(qv1.hashCode() == qv2.hashCode());
+ }
+
+ public void testEqualsObject()
+ {
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+ IValue qv1 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name1");
+ IValue qv2 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ assertFalse(qv.equals(qv1));
+ assertTrue(qv.equals(qv2));
+ assertFalse(qv.equals(null));
+ assertFalse(qv.equals(123));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/LocatorExtractorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/LocatorExtractorTest.java
new file mode 100755
index 0000000..44362fd
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/LocatorExtractorTest.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.LocatorExtractor;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+/**
+ * Tests for {@link LocatorExtractor}
+ *
+ * @author Georgi Vachkov
+ */
+public class LocatorExtractorTest extends TestCase
+{
+ private TestProject testProject;
+ private IType wsType;
+ private IWebService ws;
+
+ public void setUp() throws Exception
+ {
+ testProject = new TestProject();
+
+ IPackageFragment pack = testProject.createPackage("test.locator.extractor");
+ wsType = testProject.createType(pack, "Ws.java", "public class Ws {\n" +
+ " public void test() {}\n " +
+ "}");
+
+ IWebServiceProject wsProject = DomFactory.eINSTANCE.createIWebServiceProject();
+ wsProject.eSet(DomPackage.Literals.IWEB_SERVICE_PROJECT__NAME, testProject.getProject().getName());
+
+ ws = DomFactory.eINSTANCE.createIWebService();
+ ws.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, wsType.getFullyQualifiedName());
+
+ wsProject.getWebServices().add(ws);
+ }
+
+ public void testFindForWs() throws JavaModelException, BadLocationException
+ {
+ ILocator locator = LocatorExtractor.getInstance().find(ws);
+
+ assertEquals(3, locator.getLineNumber());
+ assertEquals(46, locator.getStartPosition());
+ assertEquals(2, locator.getLength());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/TestWsDOMRuntimeExtension.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/TestWsDOMRuntimeExtension.java
new file mode 100755
index 0000000..67751ff
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/TestWsDOMRuntimeExtension.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.jmock.Mock;
+
+public class TestWsDOMRuntimeExtension extends MockObjectTestCase implements IWsDOMRuntimeExtension
+{
+ public IProgressMonitor monitor;
+
+ public void createDOM(IProgressMonitor monitor)
+ {
+ this.monitor = monitor;
+ }
+
+ public IDOM getDOM()
+ {
+ Mock iter = new Mock(Iterator.class);
+ iter.expects(atLeastOnce()).method("hasNext").will(returnValue(false));
+ ((Iterator<?>)iter.proxy()).hasNext();
+ Mock eList = new Mock(EList.class);
+ eList.expects(atLeastOnce()).method("iterator").will(returnValue(iter.proxy()));
+ ((EList<?>)eList.proxy()).iterator();
+ Mock dom = new Mock(IDOM.class);
+ dom.expects(atLeastOnce()).method("getWebServiceProjects").will(returnValue(eList.proxy()));
+ ((IDOM)dom.proxy()).getWebServiceProjects();
+ return (IDOM)dom.proxy();
+ }
+
+ public void addLoadListener(IWsDomLoadListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+ public void removeLoadListener(IWsDomLoadListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean isLoadCanceled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeManagerTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeManagerTest.java
new file mode 100755
index 0000000..e14c0d6
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeManagerTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom;
+
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.IWsDOMRuntimeInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.WsDOMRuntimeRegistry;
+
+public class WsDOMRuntimeManagerTest extends TestCase
+{
+ private WsDOMRuntimeManager target;
+
+ @Override
+ public void setUp()
+ {
+ target = (WsDOMRuntimeManager)WsDOMRuntimeManager.instance();
+ }
+
+ public void testGetDOMRuntimeForRuntimeInfo()
+ {
+ Collection<IWsDOMRuntimeInfo> registeredRuntimes = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+
+ assertNotNull(target.getDOMRuntime(registeredRuntimes.iterator().next()));
+
+ IWsDOMRuntimeExtension runtime = target.getDOMRuntime(registeredRuntimes.iterator().next());
+
+ assertEquals(runtime, target.getDOMRuntime(registeredRuntimes.iterator().next()));
+
+ registeredRuntimes = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+
+ assertEquals(runtime, target.getDOMRuntime(registeredRuntimes.iterator().next()));
+ }
+
+ public void testGetDOMRuntimeForRuntimeId()
+ {
+ assertNotNull(target.getDOMRuntime("supportedruntimetest"));
+ assertNull(target.getDOMRuntime("test.id"));
+ assertEquals(target.getDOMRuntime("supportedruntimetest"), target.getDOMRuntime("supportedruntimetest"));
+ }
+
+ public void testCreateDOMRuntimes()
+ {
+ target.createDOMRuntimes(null);
+
+ assertNotNull(target.getDOMRuntime("supportedruntimetest"));
+ assertNotNull(target.getDOMRuntime("supportedruntimetest1"));
+ }
+
+ public void testEarlyStartup()
+ {
+ IConfigurationElement[] confElements = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.startup").getConfigurationElements();
+
+ for(int ii=0; ii<confElements.length; ii++)
+ {
+ if("org.eclipse.jst.ws.jaxws.dom.runtime.WsDomStartupParticipant".equals(confElements[ii].getAttribute("class")))
+ {
+ return;
+ }
+ }
+
+ fail("The early startup for DOM Model is not defined !");
+ }
+
+ public void testReloadDOMRuntimes()
+ {
+ target.reloadDOMRuntimes(null);
+
+ IWsDOMRuntimeExtension domRuntime = target.getDOMRuntime("supportedruntimetest");
+ IWsDOMRuntimeExtension domRuntime1 = target.getDOMRuntime("supportedruntimetest1");
+
+ target.reloadDOMRuntimes(null);
+
+ assertNotSame(domRuntime,target.getDOMRuntime(WsDOMRuntimeRegistry.getRuntimeInfo("supportedruntimetest").getId()));
+ assertNotSame(domRuntime1,target.getDOMRuntime(WsDOMRuntimeRegistry.getRuntimeInfo("supportedruntimetest1").getId()));
+ }
+
+ public void testGetDOMRuntimes()
+ {
+ IWsDOMRuntimeExtension domRuntime = target.getDOMRuntime("supportedruntimetest");
+ assertNotNull(domRuntime);
+ assertTrue(domRuntime instanceof TestWsDOMRuntimeExtension);
+
+ IWsDOMRuntimeExtension domRuntime1 = target.getDOMRuntime("supportedruntimetest1");
+ assertNotNull(domRuntime1);
+ assertTrue(domRuntime1 instanceof TestWsDOMRuntimeExtension);
+
+ IWsDOMRuntimeExtension domRuntime2 = target.getDOMRuntime("supportedruntimetest2");
+ assertNull(domRuntime2);
+ }
+
+ public void testCreateDOMPassesProgressMonitor()
+ {
+ MyWsDomRuntimeManager manager = new MyWsDomRuntimeManager();
+ IWsDOMRuntimeInfo info = WsDOMRuntimeRegistry.getRuntimeInfo("supportedruntimetest1");
+ NullProgressMonitor npm = new NullProgressMonitor();
+ IWsDOMRuntimeExtension rtEx = manager.createDOMRuntime(info, npm);
+ assertTrue(rtEx instanceof TestWsDOMRuntimeExtension);
+ assertEquals(npm, ((TestWsDOMRuntimeExtension)rtEx).monitor);
+ }
+
+ private class MyWsDomRuntimeManager extends WsDOMRuntimeManager
+ {
+ protected IWsDOMRuntimeExtension createDOMRuntime(final IWsDOMRuntimeInfo runtimeInfo, final IProgressMonitor monitor) {
+ return super.createDOMRuntime(runtimeInfo, monitor);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeRegistryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeRegistryTest.java
new file mode 100755
index 0000000..26fc228
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/WsDOMRuntimeRegistryTest.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.util.NamedExtensionInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.IWsDOMRuntimeInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.WsDOMRuntimeRegistry;
+
+public class WsDOMRuntimeRegistryTest extends TestCase
+{
+ private static final class RuntimeInfo extends NamedExtensionInfo implements IWsDOMRuntimeInfo
+ {
+ private HashMap<String, String> projectFacets;
+
+ RuntimeInfo(final String pId, final String pLabel, final HashMap<String, String> projectFacets)
+ {
+ super(pId, pLabel);
+
+ this.projectFacets = projectFacets;
+ }
+
+ public HashMap<String,String> getProjectFacets()
+ {
+ return this.projectFacets;
+ }
+ }
+
+
+ public void testInstantiateRuntime()
+ {
+ Collection<IWsDOMRuntimeInfo> runtimeInfos = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+ Iterator<IWsDOMRuntimeInfo> runtimeInfoIter = runtimeInfos.iterator();
+
+ while(runtimeInfoIter.hasNext())
+ {
+ IWsDOMRuntimeInfo runtimeInfo = runtimeInfoIter.next();
+
+ if(runtimeInfo.getId().equals("supportedruntimetest")
+ || runtimeInfo.getId().equals("supportedruntimetest1"))
+ {
+ assertNotNull(WsDOMRuntimeRegistry.instantiateRuntime(runtimeInfo));
+ assertTrue(WsDOMRuntimeRegistry.instantiateRuntime(runtimeInfo) instanceof TestWsDOMRuntimeExtension);
+ }
+ else if(runtimeInfo.getId().equals("supportedruntimetest2"))
+ {
+ assertNull(WsDOMRuntimeRegistry.instantiateRuntime(runtimeInfo));
+ }
+ }
+
+ assertNull(WsDOMRuntimeRegistry.instantiateRuntime(null));
+
+ RuntimeInfo info = new RuntimeInfo("Tst", "ddgg", new HashMap<String,String>());
+
+ assertNull(WsDOMRuntimeRegistry.instantiateRuntime(info));
+ }
+
+ public void testFindExtension()
+ {
+ assertNotNull(WsDOMRuntimeRegistry.findExtension(WsDOMRuntimeRegistry.getRegisteredRuntimesInfo().iterator().next()));
+ assertNull(WsDOMRuntimeRegistry.findExtension(null));
+
+ RuntimeInfo runtimeInfo = new RuntimeInfo("Tst", "ddgg", new HashMap<String,String>());
+ assertNull(WsDOMRuntimeRegistry.findExtension(runtimeInfo));
+ }
+
+ public void testGetRegisteredRuntimeInfo()
+ {
+ Collection<IWsDOMRuntimeInfo> runtimeInfos = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+
+ assertNotNull(runtimeInfos);
+ assertTrue(runtimeInfos.size() >= 3);
+
+ Iterator<IWsDOMRuntimeInfo> runtimeInfoIter = runtimeInfos.iterator();
+
+ while(runtimeInfoIter.hasNext())
+ {
+ IWsDOMRuntimeInfo runtimeInfo = runtimeInfoIter.next();
+
+ assertNotNull(runtimeInfo.getId());
+
+ if(runtimeInfo.getId().equals("supportedruntimetest"))
+ {
+ assertNotNull(runtimeInfo.getName());
+ assertEquals(runtimeInfo.getName(), "Testing");
+
+ assertNotNull(runtimeInfo.getProjectFacets());
+ assertEquals(runtimeInfo.getProjectFacets().size(), 2);
+
+ assertTrue(runtimeInfo.getProjectFacets().containsKey("jst.web"));
+ assertTrue(runtimeInfo.getProjectFacets().containsKey("test.facet"));
+
+ assertFalse(runtimeInfo.getProjectFacets().containsKey("jst.webb"));
+ assertFalse(runtimeInfo.getProjectFacets().containsKey("test.facett"));
+
+ assertNotNull(runtimeInfo.getProjectFacets().get("jst.web"));
+ assertEquals(runtimeInfo.getProjectFacets().get("jst.web"), "1.0.0.0");
+ assertNull(runtimeInfo.getProjectFacets().get("test.facet"));
+
+ assertNull(runtimeInfo.getProjectFacets().get("dummy.facet"));
+ }
+ else if(runtimeInfo.getId().equals("supportedruntimetest1"))
+ {
+ assertNotNull(runtimeInfo.getName());
+ assertEquals(runtimeInfo.getName(), "Testing1");
+
+ assertNotNull(runtimeInfo.getProjectFacets());
+ assertEquals(runtimeInfo.getProjectFacets().size(), 2);
+
+ assertTrue(runtimeInfo.getProjectFacets().containsKey("jst.webb"));
+ assertTrue(runtimeInfo.getProjectFacets().containsKey("test.facett"));
+
+ assertFalse(runtimeInfo.getProjectFacets().containsKey("jst.web"));
+ assertFalse(runtimeInfo.getProjectFacets().containsKey("test.facet"));
+
+ assertNotNull(runtimeInfo.getProjectFacets().get("jst.webb"));
+ assertEquals(runtimeInfo.getProjectFacets().get("jst.webb"), "1.0.0.0");
+ assertNull(runtimeInfo.getProjectFacets().get("test.facett"));
+
+ assertNull(runtimeInfo.getProjectFacets().get("dummy.facet"));
+ }
+ }
+ }
+
+
+ public void testGetRuntimeInfo()
+ {
+ assertNull(WsDOMRuntimeRegistry.getRuntimeInfo("test.id"));
+ assertNotNull(WsDOMRuntimeRegistry.getRuntimeInfo("supportedruntimetest"));
+ assertNotNull(WsDOMRuntimeRegistry.getRuntimeInfo("supportedruntimetest1"));
+ assertNull(WsDOMRuntimeRegistry.getRuntimeInfo(null));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/CompilationUnitFinderContractTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/CompilationUnitFinderContractTest.java
new file mode 100755
index 0000000..adb4d1f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/CompilationUnitFinderContractTest.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitFinder;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.jmock.core.Constraint;
+import org.jmock.core.Invocation;
+import org.jmock.core.Stub;
+
+/**
+ * The tests in this class might be executed in a dirty workspace. Thus this class should assume that other projects are already existing and ignore them
+ * @author Hristo Sabev
+ *
+ */
+public abstract class CompilationUnitFinderContractTest extends MockObjectTestCase
+{
+// private ICompilationUnitFinder target;
+ private List<IProjectSelector> projectSelectors;
+
+ private IJavaModel javaModel;
+
+ private List<String> existingProjectsNames;
+
+ protected IJavaModel javaModel() {
+ return javaModel;
+ }
+
+ protected List<IProjectSelector> projectSelectors() {
+ return projectSelectors;
+ }
+
+ protected abstract ICompilationUnitFinder createTarget();
+
+ @Override
+ public void setUp() {
+
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ projectSelectors = new ArrayList<IProjectSelector>();
+ existingProjectsNames = new ArrayList<String>();
+ for (IProject prj : (IProject[])javaModel.getWorkspace().getRoot().getProjects())
+ {
+ existingProjectsNames.add(prj.getName());
+ }
+ }
+
+ public void test_find() throws CoreException, WsDOMLoadCanceledException {
+
+
+ final TestProject project1 = new TestProject();
+ project1.createSourceFolder("sourceFolder");
+ final IPackageFragment pf1 = project1.createPackage("com.sap.test1");
+ project1.createType(pf1, "CompilationUnit1.java", "class Ignorred{}");
+ project1.createType(pf1, "CompilationUnit2.java", "class Ignorred{}");
+ project1.createType(pf1, "CompilationUnit3.java", "class Ignorred{}");
+
+ final TestProject project2 = new TestProject();
+ project2.createSourceFolder("sourceFolder");
+ final IPackageFragment pf2 = project2.createPackage("com.sap.test1");
+ project2.createType(pf2, "CompilationUnit1.java", "class Ignorred{}");
+ project2.createType(pf2, "CompilationUnit2.java", "class Ignorred{}");
+
+ final TestProject project3 = new TestProject();
+ project3.createSourceFolder("sourceFolder");
+ final IPackageFragment pf3 = project3.createPackage("com.sap.test3");
+ project3.createType(pf3, "CompilationUnit1.java", "class Ignorred{}");
+ project3.createType(pf3, "CompilationUnit2.java", "class Ignorred{}");
+
+ final IProjectSelector exludeProject2 = new IProjectSelector() {
+
+ public boolean approve(IJavaProject prj)
+ {
+ return prj.getElementName().equals(project2.getJavaProject().getElementName()) || existingProjectsNames.contains(prj.getElementName())? false : true;
+ }
+
+ };
+
+ final IProjectSelector addmitAll_exceptProject2 = new IProjectSelector() {
+ public boolean approve(IJavaProject prj)
+ {
+ return prj.getElementName().equals(project2.getJavaProject().getElementName()) || existingProjectsNames.contains(prj.getElementName()) ? false : true;
+ }
+ };
+
+ projectSelectors().add(exludeProject2);
+ projectSelectors().add(addmitAll_exceptProject2);
+
+ final ICompilationUnitFinder target = createTarget();
+
+
+ final Mock<ICompilationUnitHandler> mockCUHandler = mock(ICompilationUnitHandler.class);
+
+ final Stub configureExpectations = new Stub()
+ {
+
+ public Object invoke(Invocation arg0) throws Throwable
+ {
+ mockCUHandler.expects(once()).method("handle").with(projectNamed(project1.getJavaProject().getElementName())).id("cuCall1");
+ mockCUHandler.expects(once()).method("handle").with(cuNamed(pf1.getCompilationUnit("CompilationUnit1.java").getPath().toOSString())).after("cuCall1").id("cuCall2");
+ mockCUHandler.expects(once()).method("handle").with(cuNamed(pf1.getCompilationUnit("CompilationUnit2.java").getPath().toOSString())).after("cuCall1").id("cuCall3");
+ mockCUHandler.expects(once()).method("handle").with(cuNamed(pf1.getCompilationUnit("CompilationUnit3.java").getPath().toOSString())).after("cuCall1").id("cuCall4");
+
+ mockCUHandler.expects(once()).method("handle").with(projectNamed(project3.getJavaProject().getElementName())).id("cuCall5");
+ mockCUHandler.expects(once()).method("handle").with(cuNamed(pf3.getCompilationUnit("CompilationUnit1.java").getPath().toOSString())).after("cuCall5").id("cuCall6");
+ mockCUHandler.expects(once()).method("handle").with(cuNamed(pf3.getCompilationUnit("CompilationUnit2.java").getPath().toOSString())).after("cuCall5").id("cuCall7");
+ mockCUHandler.expects(once()).method("finished").withNoArguments().after("cuCall1").after("cuCall2").after("cuCall3").after("cuCall4").after("cuCall5").after("cuCall6").after("cuCall7");
+ return null;
+ }
+
+ public StringBuffer describeTo(StringBuffer arg0)
+ {
+ return arg0.append("Configure expectations after start is invoked");
+ }
+
+ };
+ mockCUHandler.expects(once()).method("started").withNoArguments().will(configureExpectations);
+ target.find(null, mockCUHandler.proxy());
+ }
+
+ private Constraint projectNamed(final String prjName) {
+ return new Constraint() {
+ public StringBuffer describeTo(StringBuffer arg0)
+ {
+ return arg0.append(prjName);
+ }
+
+ public boolean eval(Object arg0)
+ {
+ if (!(arg0 instanceof IJavaProject))
+ {
+ return false;
+ }
+ final IJavaProject cast = (IJavaProject)arg0;
+ return prjName.equals(cast.getElementName());
+ }
+ };
+ }
+
+ private Constraint cuNamed(final String cuName) {
+ return new Constraint() {
+ public StringBuffer describeTo(StringBuffer arg0)
+ {
+ return arg0.append(cuName);
+ }
+
+ public boolean eval(Object arg0)
+ {
+ if (!(arg0 instanceof ICompilationUnit))
+ {
+ return false;
+ }
+ final ICompilationUnit cast = (ICompilationUnit)arg0;
+ return cuName.equals(cast.getPath().toOSString());
+ }
+ };
+
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/DomTestUtils.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/DomTestUtils.java
new file mode 100755
index 0000000..aebb6a9
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/DomTestUtils.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import junit.framework.Assert;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+
+public class DomTestUtils
+{
+ public IMethod getExistingMethod(IType type, String methodName, String... args)
+ {
+ final IMethod m = type.getMethod(methodName, args);
+ Assert.assertTrue(m.exists());
+ return m;
+ }
+
+ public void setContents(ICompilationUnit cu, String contents) throws JavaModelException
+ {
+ final String contentToSet = "package "+cu.getParent().getElementName()+";\n"+contents;
+ FileUtils.getInstance().setCompilationUnitContent(cu, contentToSet, true, null);
+ }
+
+ public IWebParam findParam(final IWebMethod method, final String implName)
+ {
+ for (IWebParam param : method.getParameters()) {
+ if (param.getImplementation().equals(implName)) {
+ return param;
+ }
+ }
+
+ return null;
+ }
+
+
+ public IWebMethod findWebMethodByName(final IServiceEndpointInterface sei, final String name)
+ {
+ for (IWebMethod webMethod : sei.getWebMethods()) {
+ if(webMethod.getName().equals(name)) {
+ return webMethod;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsDefaultsCalculatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsDefaultsCalculatorTest.java
new file mode 100755
index 0000000..13ee7ba
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsDefaultsCalculatorTest.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsDefaultsCalculator;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+public class JaxWsDefaultsCalculatorTest extends MockObjectTestCase
+{
+ private static final String METHOD_NAME = "method";
+
+ private Mock<IWebMethod> webMethod;
+ private JaxWsDefaultsCalculator defCalc = new JaxWsDefaultsCalculator();
+
+ @Override
+ public void setUp()
+ {
+ webMethod = mock(IWebMethod.class);
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.DOCUMENT));
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.BARE));
+ webMethod.stubs().method("getName").will(returnValue(METHOD_NAME));
+ }
+
+ public void testDefineSBStyleDefaultValue()
+ {
+ assertEquals(SOAPBindingStyle.DOCUMENT, defCalc.defineSBStyle(null));
+
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue(null));
+ assertEquals(SOAPBindingStyle.DOCUMENT, defCalc.defineSBStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("Style.DOCUMENT"));
+ assertEquals(SOAPBindingStyle.DOCUMENT, defCalc.defineSBStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.Style.DOCUMENT"));
+ assertEquals(SOAPBindingStyle.DOCUMENT, defCalc.defineSBStyle(ann.proxy()));
+ }
+
+ public void testDefineSBStyle()
+ {
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue("Style.RPC"));
+ assertEquals(SOAPBindingStyle.RPC, defCalc.defineSBStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.Style.RPC"));
+ assertEquals(SOAPBindingStyle.RPC, defCalc.defineSBStyle(ann.proxy()));
+ }
+
+ public void testDefineSBUseDefaultValue()
+ {
+ assertEquals(SOAPBindingUse.LITERAL, defCalc.defineSBUse(null));
+
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue(null));
+ assertEquals(SOAPBindingUse.LITERAL, defCalc.defineSBUse(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("Style.LITERAL"));
+ assertEquals(SOAPBindingUse.LITERAL, defCalc.defineSBUse(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.Style.LITERAL"));
+ assertEquals(SOAPBindingUse.LITERAL, defCalc.defineSBUse(ann.proxy()));
+ }
+
+ public void testDefineSBUse()
+ {
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue("Use.ENCODED"));
+ assertEquals(SOAPBindingUse.ENCODED, defCalc.defineSBUse(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.Use.ENCODED"));
+ assertEquals(SOAPBindingUse.ENCODED, defCalc.defineSBUse(ann.proxy()));
+ }
+
+ public void testDefineSBParameterStyleDefaultValue()
+ {
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, defCalc.defineSBParameterStyle(null));
+
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue(null));
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, defCalc.defineSBParameterStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("ParameterStyle.WRAPPED"));
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, defCalc.defineSBParameterStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.ParameterStyle.WRAPPED"));
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, defCalc.defineSBParameterStyle(ann.proxy()));
+ }
+
+ public void testDefineSBParameterStyle()
+ {
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getPropertyValue").will(returnValue("ParameterStyle.BARE"));
+ assertEquals(SOAPBindingParameterStyle.BARE, defCalc.defineSBParameterStyle(ann.proxy()));
+
+ ann.stubs().method("getPropertyValue").will(returnValue("SOAPBinding.ParameterStyle.BARE"));
+ assertEquals(SOAPBindingParameterStyle.BARE, defCalc.defineSBParameterStyle(ann.proxy()));
+ }
+
+ public void testCalcWebParamDefaultName()
+ {
+ assertEquals(METHOD_NAME, defCalc.calcWebParamDefaultName(webMethod.proxy(), 0));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.RPC));
+ assertEquals("arg0", defCalc.calcWebParamDefaultName(webMethod.proxy(), 0));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.DOCUMENT));
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.WRAPPED));
+ assertEquals("arg1", defCalc.calcWebParamDefaultName(webMethod.proxy(), 1));
+ }
+
+ public void testCalcWebParamDefaultTargetNS()
+ {
+ Mock<IWebParam> webParam = mock(IWebParam.class);
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.WRAPPED));
+ webParam.stubs().method("isHeader").will(returnValue(false));
+
+ Mock<IServiceEndpointInterface> sei = mock(IServiceEndpointInterface.class);
+ sei.stubs().method("getTargetNamespace").will(returnValue("http://com.sap.test"));
+ webMethod.stubs().method("eContainer").will(returnValue(sei.proxy()));
+
+ assertEquals("", defCalc.calcWebParamDefaultTargetNS(webMethod.proxy(), webParam.proxy()));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.RPC));
+ assertEquals("http://com.sap.test", defCalc.calcWebParamDefaultTargetNS(webMethod.proxy(), webParam.proxy()));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.DOCUMENT));
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.BARE));
+ assertEquals("http://com.sap.test", defCalc.calcWebParamDefaultTargetNS(webMethod.proxy(), webParam.proxy()));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.DOCUMENT));
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.WRAPPED));
+ webParam.stubs().method("isHeader").will(returnValue(true));
+
+ assertEquals("http://com.sap.test", defCalc.calcWebParamDefaultTargetNS(webMethod.proxy(), webParam.proxy()));
+ }
+
+ public void testCalcWebResultDefaultName()
+ {
+ assertEquals(METHOD_NAME + "Response", defCalc.calcWebResultDefaultName(webMethod.proxy()));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.RPC));
+ assertEquals("return", defCalc.calcWebResultDefaultName(webMethod.proxy()));
+
+ webMethod.stubs().method("getSoapBindingStyle").will(returnValue(SOAPBindingStyle.DOCUMENT));
+ webMethod.stubs().method("getSoapBindingParameterStyle").will(returnValue(SOAPBindingParameterStyle.WRAPPED));
+ assertEquals("return", defCalc.calcWebResultDefaultName(webMethod.proxy()));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsWorkspaceResourceTests.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsWorkspaceResourceTests.java
new file mode 100755
index 0000000..16fdb20
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/JaxWsWorkspaceResourceTests.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import java.io.IOException;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+/**
+ * This test might be executed in non-clean workspace. Thus it should try to ignore any existing projects and work with the test proejcts it creates.
+ * @author Hristo Sabev
+ *
+ */
+public class JaxWsWorkspaceResourceTests extends TestCase
+{
+ private TestProject testProject;
+ private IPackageFragment pf;
+ private IJavaModel javaModel;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ testProject = new TestProject();
+ testProject.createSourceFolder("src");
+ pf = testProject.createPackage("com.sap.test.smoke");
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ /**
+ * Verifies that a simple project with one web service class and one sei can be parsed
+ *
+ */
+ public void test_Smoke_OneWsAndOneSei() throws JavaModelException, IOException
+ {
+ testProject.createType(pf, "Sei1.java", "@javax.jws.WebService public interface Sei1 {}");
+ testProject.createType(pf, "WebService1.java", "@javax.jws.WebService(endpointInterface=\"com.sap.test.smoke.Sei1\") public class WebService1{}");
+ final JaxWsWorkspaceResource target = createJaxWsWorkspaceResource(testProject);
+ target.load(null);
+
+ //find the test project and work only with it. ignore any other projects in the workspace
+ final List<IWebServiceProject> projects = target.getDOM().getWebServiceProjects();
+ IWebServiceProject testWsProject = null;
+ for (IWebServiceProject aProject : projects)
+ {
+ if (aProject.getName().equals(testProject.getJavaProject().getElementName()))
+ {
+ testWsProject = aProject;
+ break;
+ }
+ }
+ if (testWsProject == null)
+ {
+ fail("WebServiceProject wit name " + testProject.getJavaProject().getElementName() + "is not found in the model");
+ }
+
+ final List<IServiceEndpointInterface> seis = testWsProject.getServiceEndpointInterfaces();
+ assertTrue("More than 1 sei found in the model, while only one test sei was used", seis.size() == 1);
+ assertEquals("The sei in the model is with different name", "Sei1", seis.get(0).getName());
+ assertEquals("The sei in the model is with different implementation", "com.sap.test.smoke.Sei1", seis.get(0).getImplementation());
+ final List<IWebService> webServices = testWsProject.getWebServices();
+ assertTrue("More than 1 web service found in the model, while only one test web service was used", webServices.size() == 1);
+ assertEquals("The web service in the model is with different name", "WebService1Service", webServices.get(0).getName());
+ assertEquals("The web service in the model is with different implementation", "com.sap.test.smoke.WebService1", webServices.get(0).getImplementation());
+ assertSame("The service endpoint found in the model is not the same instance as the sei of the web service", webServices.get(0).getServiceEndpoint(), seis.get(0));
+ }
+
+ public void test_DomLoadedForNoProcessedProjects() throws IOException
+ {
+ final JaxWsWorkspaceResource target = new JaxWsWorkspaceResource(javaModel)
+ {
+
+ @Override
+ public IProjectSelector[] getProjectSelectors()
+ {
+ return new IProjectSelector[] { new IProjectSelector()
+ {
+
+ public boolean approve(IJavaProject prj)
+ {
+ return false;
+ }
+ }};
+ }
+
+ };
+ target.load(null);
+ assertNotNull(target.getDOM());
+ assertEquals(0, target.getDOM().getWebServiceProjects().size());
+ }
+
+ private JaxWsWorkspaceResource createJaxWsWorkspaceResource(final TestProject testProject)
+ {
+ return new JaxWsWorkspaceResource(javaModel)
+ {
+ @Override
+ public IProjectSelector[] getProjectSelectors()
+ {
+ return new IProjectSelector[] {new IProjectSelector()
+ {
+ public boolean approve(IJavaProject prj) {
+ return prj.getElementName().equals(testProject.getJavaProject().getElementName());
+ }
+ }};
+ }
+ };
+ }
+
+ protected class LoadListener implements IWsDomLoadListener
+ {
+ boolean startCalled;
+ boolean finishedCalled;
+
+ public void finished() {
+ finishedCalled = true;
+ }
+
+ public void started() {
+ startCalled = true;
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/Jee5WsDomRuntimeExtensionTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/Jee5WsDomRuntimeExtensionTest.java
new file mode 100755
index 0000000..d20baf0
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/Jee5WsDomRuntimeExtensionTest.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.Assertions;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+/**
+ * Tests for Jee5WsDomRuntimeExtension
+ *
+ * @author Georgi Vachkov
+ */
+public class Jee5WsDomRuntimeExtensionTest extends MockObjectTestCase
+{
+ private Jee5WsDomRuntimeExtension extension;
+
+ public void setUp() throws Exception
+ {
+ extension = new Jee5WsDomRuntimeExtension();
+ }
+
+ public void testGetDOMCreateNotCalled() throws WsDOMLoadCanceledException
+ {
+ assertNull(extension.getDOM());
+ }
+
+ public void testLoadListenerStartFinishCalled() throws Exception
+ {
+ final Mock<IWsDomLoadListener> loadListenerMock = mock(IWsDomLoadListener.class);
+ loadListenerMock.expects(once()).method("started");
+ loadListenerMock.expects(once()).method("finished");
+
+ extension.addLoadListener(loadListenerMock.proxy());
+ extension.createDOM(null);
+ }
+
+ public void testRemoveLoadListener() throws Exception
+ {
+ final IWsDomLoadListener loadListener = (IWsDomLoadListener) mock(IWsDomLoadListener.class).proxy();
+ extension.addLoadListener(loadListener);
+ extension.removeLoadListener(loadListener);
+ extension.createDOM(null);
+ }
+
+ public void testLoadCanceled() throws Exception
+ {
+ final IProgressMonitor monitor = new NullProgressMonitor();
+ monitor.setCanceled(true);
+
+ final Mock<IWsDomLoadListener> loadListenerMock = mock(IWsDomLoadListener.class);
+ loadListenerMock.expects(once()).method("started");
+ loadListenerMock.expects(once()).method("finished");
+ extension = new Jee5WsDomRuntimeExtension() {
+ @Override
+ protected JaxWsWorkspaceResource createResource() {
+ return new JaxWsWorkspaceResource(javaModel()) {
+ @Override
+ public boolean isLoadCnaceled() {
+ return true;
+ }
+ @Override
+ public void startSynchronizing() {
+ fail("startSynchronizing should not be called in this case");
+ }
+ };
+ }
+ };
+ extension.addLoadListener(loadListenerMock.proxy());
+ try {
+ extension.createDOM(monitor);
+ fail("WsDOMLoadCanceledException not thrown az expected");
+ } catch (WsDOMLoadCanceledException _) {
+ // nothing to do here
+ }
+ }
+
+ public void testStartSynchronizingCalledIfLoadNotCanceled() throws Exception {
+ final boolean[] startSyncCalled = { false };
+ extension = new Jee5WsDomRuntimeExtension() {
+ @Override
+ protected JaxWsWorkspaceResource createResource() {
+ return new JaxWsWorkspaceResource(javaModel()) {
+ @Override
+ public void startSynchronizing() {
+ startSyncCalled[0] = true;
+ }
+ };
+ }
+ };
+ extension.createDOM(new NullProgressMonitor());
+ assertTrue("Start syncronization was not started even the load wasa not canceled", startSyncCalled[0]);
+ }
+
+ public void testCreateDOMBlocksWhenCalled() throws Exception
+ {
+ final boolean[] doLoadStarted = { false };
+ final boolean[] doLoadFinished = { false };
+ extension = new Jee5WsDomRuntimeExtension() {
+ @Override
+ protected JaxWsWorkspaceResource createResource() {
+ return new JaxWsWorkspaceResource(javaModel()) {
+ @Override
+ protected void doLoad(final Map<?, ?> options) throws IOException {
+ doLoadStarted[0] = true;
+ try {
+ Thread.sleep(400);
+ } catch (InterruptedException e) {
+ throw new IOException(e.getLocalizedMessage());
+ }
+ super.doLoad(options);
+ doLoadFinished[0] = true;
+ }
+ };
+ }
+ };
+ new Thread(){
+ @Override
+ public void run() {
+ try {
+ extension.createDOM(new NullProgressMonitor());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ } catch (WsDOMLoadCanceledException e) {
+ fail(e.getMessage());
+ }
+ }
+ }.start();
+ Assertions.waitAssert(new IWaitCondition() {public boolean checkCondition() {
+ return doLoadStarted[0];
+ }}, "Loading from another thread not started");
+
+ extension.createDOM(new NullProgressMonitor());
+ assertTrue("Start syncronization was not started even the load was not canceled", doLoadFinished[0]);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/ProjectAddingTests.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/ProjectAddingTests.java
new file mode 100755
index 0000000..0e980e2
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/ProjectAddingTests.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class ProjectAddingTests extends TestCase {
+
+ private JaxWsWorkspaceResource target;
+ private IJavaModel javaModel;
+ private DomUtil util;
+ private TestProject testPrj3;;
+
+ @Override
+ public void setUp() throws IOException
+ {
+ util = new DomUtil();
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = new JaxWsWorkspaceResource(javaModel);
+ target.load(null);
+ target.startSynchronizing();
+
+ }
+
+ @Override
+ public void tearDown() throws CoreException
+ {
+ target.stopSynchronizing();
+ }
+
+ public void test_newWsProjectSynched() throws Exception
+ {
+ testPrj3 = new TestProject(new TestEjb3Project("TestEJBProject3").getProject());
+ final IWebServiceProject wsPrj3 = util.findProjectByName(target.getDOM(), testPrj3.getProject().getName());
+ assertNotNull("Newly added project not in dom",wsPrj3);
+ }
+
+ public void test_newNonWsProjectNotAdded() throws Exception
+ {
+ testPrj3 = new TestProject("TestProject3");
+ final IWebServiceProject wsPrj3 = util.findProjectByName(target.getDOM(), testPrj3.getProject().getName());
+ assertNull("Newly added project in dom",wsPrj3);
+ }
+
+ public void test_NonWsProjectIgnorredWhenClosedOrRemoved() throws CoreException
+ {
+ testPrj3 = new TestProject("TestProject3");
+ testPrj3.createSourceFolder("src");
+ final IPackageFragment pf = testPrj3.createPackage("com.sap.test.nonwsproject");
+ final IType type = testPrj3.createType(pf, "SomeClass.java", "public class SomeClass {}");
+ final IFile file = testPrj3.getJavaProject().getJavaModel().getWorkspace().getRoot().getFile(type.getPath());
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
+ testPrj3.getProject().close(null);
+ }
+
+ public void test_openedNonWsProjectNotAdded() throws Exception
+ {
+ testPrj3 = new TestProject("TestEJBProject3");
+ testPrj3.getProject().close(null);
+ testPrj3.getProject().open(null);
+ final IWebServiceProject wsPrj3 = util.findProjectByName(target.getDOM(), testPrj3.getProject().getName());
+ assertNull("Newly added project not in dom",wsPrj3);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/WorkspaceCUFinderTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/WorkspaceCUFinderTest.java
new file mode 100755
index 0000000..41a824e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/WorkspaceCUFinderTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitFinder;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.ICompilationUnitHandler;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WorkspaceCUFinder;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+
+public class WorkspaceCUFinderTest extends CompilationUnitFinderContractTest
+{
+
+ @Override
+ protected ICompilationUnitFinder createTarget()
+ {
+ final IProjectSelector[] ps = new IProjectSelector[projectSelectors().size()];
+ projectSelectors().toArray(ps);
+ return new WorkspaceCUFinder(javaModel(), ps);
+ }
+
+ public void testProgressMonitorUpdated() throws CoreException, WsDOMLoadCanceledException
+ {
+ Mock<IProgressMonitor> monitor = mock(IProgressMonitor.class);
+ monitor.stubs().method("isCanceled").will(returnValue(false));
+ monitor.expects(once()).method("beginTask");
+ monitor.expects(once()).method("done");
+ monitor.expects(exactly(2)).method("worked");
+
+ ICompilationUnitFinder cuFinder = setUpForProgressMonitorTests();
+ Mock<ICompilationUnitHandler> cuHandler = mock(ICompilationUnitHandler.class);
+ cuHandler.stubs().method("handle");
+ cuHandler.stubs().method("started");
+ cuHandler.stubs().method("finished");
+
+ cuFinder.find(monitor.proxy(), cuHandler.proxy());
+ }
+
+ public void testCnacelationRequestsProcessed() throws CoreException
+ {
+ Mock<IProgressMonitor> monitor = mock(IProgressMonitor.class);
+ monitor.expects(once()).method("beginTask");
+ monitor.expects(once()).method("done");
+ monitor.expects(once()).method("isCanceled").will(returnValue(true));
+
+ ICompilationUnitFinder cuFinder = setUpForProgressMonitorTests();
+ Mock<ICompilationUnitHandler> cuHandler = mock(ICompilationUnitHandler.class);
+ cuHandler.stubs().method("handle");
+ cuHandler.stubs().method("started");
+
+ try {
+ cuFinder.find(monitor.proxy(), cuHandler.proxy());
+ fail("SynchronizationCanceledException not thrown");
+ } catch (WsDOMLoadCanceledException e) {
+ // expected
+ }
+ }
+
+ private ICompilationUnitFinder setUpForProgressMonitorTests() throws CoreException
+ {
+ final TestProject project1 = new TestProject();
+ project1.createSourceFolder("src");
+ final IPackageFragment pf1 = project1.createPackage("com.sap.test");
+ project1.createType(pf1, "Cu1.java", "class Cu1 {}");
+ project1.createType(pf1, "Cu2.java", "class Cu2 {}");
+
+ IProjectSelector [] slectors = new IProjectSelector[] {
+ new IProjectSelector() {
+ public boolean approve(IJavaProject prj) {
+ return project1.getProject().getName().equals(prj.getProject().getName());
+ }
+ }
+ };
+
+ return new WorkspaceCUFinder(javaModel(), slectors);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/AnnotationAdapterFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/AnnotationAdapterFactoryTest.java
new file mode 100755
index 0000000..63e5697
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/AnnotationAdapterFactoryTest.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+
+public class AnnotationAdapterFactoryTest extends TestCase
+{
+ public void testIsFactoryForTypeObject()
+ {
+ assertTrue(AnnotationAdapterFactory.INSTANCE.isFactoryForType(IAnnotationAdapter.class));
+ }
+
+ public void testCreateAdapter()
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ AnnotationAdapterFactory.INSTANCE.adapt(ws, IAnnotationAdapter.class);
+ Adapter adapter = ws.eAdapters().get(0);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof IAnnotationAdapter);
+
+ AnnotationAdapterFactory.INSTANCE.adapt(ws, IAnnotationAdapter.class);
+ assertEquals(1, ws.eAdapters().size());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AbstractLocatorsTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AbstractLocatorsTest.java
new file mode 100755
index 0000000..05e196a
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AbstractLocatorsTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation.impl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class AbstractLocatorsTest extends MockObjectTestCase
+{
+ protected static final int VALUE_OFFSET = 10;
+
+ protected Mock<IAnnotation<IType>> annotation;
+ protected IParamValuePair param1;
+ protected IParamValuePair param2;
+
+ @Override
+ public void setUp()
+ {
+ annotation = mock(IAnnotation.class);
+ annotation.stubs().method("getLocator").will(returnValue(createLocator(1, 11)));
+
+ param1 = createParamValue("param1", 21, 31);
+ param2 = createParamValue("param2", 22, 32);
+
+ Set<IParamValuePair> pairs = new HashSet<IParamValuePair>();
+ pairs.add(param1);
+ pairs.add(param2);
+ annotation.stubs().method("getParamValuePairs").will(returnValue(pairs));
+ }
+
+ protected IParamValuePair createParamValue(String name, int startPos, int lenght)
+ {
+ Mock<IParamValuePair> param = mock(IParamValuePair.class);
+ param.stubs().method("getParam").will(returnValue(name));
+ param.stubs().method("getLocator").will(returnValue(createLocator(startPos, lenght)));
+ Mock<IValue> value = mock(IValue.class);
+ value.stubs().method("getLocator").will(returnValue(createLocator(startPos + VALUE_OFFSET, lenght + VALUE_OFFSET)));
+ param.stubs().method("getValue").will(returnValue(value.proxy()));
+
+ return param.proxy();
+ }
+
+ protected ILocator createLocator(int startPos, int length)
+ {
+ Mock<ILocator> locator = mock(ILocator.class);
+ locator.stubs().method("getLength").will(returnValue(length));
+ locator.stubs().method("getStartPosition").will(returnValue(startPos));
+
+ return locator.proxy();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AnnotationAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AnnotationAdapterTest.java
new file mode 100755
index 0000000..be51973
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/annotation/impl/AnnotationAdapterTest.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation.impl;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.impl.AnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.SBAnnotationFeatures.SB_ANNOTATION;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WS_ANNOTATION;
+
+
+public class AnnotationAdapterTest extends AbstractLocatorsTest
+{
+
+ private AnnotationAdapter adapter;
+
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+ adapter = new AnnotationAdapter();
+ }
+
+ public void testAddGetAnnotationLocations()
+ {
+ adapter.addAnnotation(WS_ANNOTATION, annotation.proxy());
+ annotation.stubs().method("getLocator").will(returnValue(createLocator(100, 110)));
+ adapter.addAnnotation(SB_ANNOTATION, annotation.proxy());
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation(WS_ANNOTATION);
+ assertNotNull("Annotation adapter not added", annotation);
+ assertEquals(100, annotation.getLocator().getStartPosition());
+
+ annotation = adapter.getAnnotation(SB_ANNOTATION);
+ assertNotNull("Annotation adapter not added", annotation);
+ assertEquals(100, annotation.getLocator().getStartPosition());
+
+ adapter.addAnnotation(WS_ANNOTATION, null);
+ annotation= adapter.getAnnotation(WS_ANNOTATION);
+ assertNull("Annotation adapter not cleared", annotation);
+ }
+
+ public void testIsAdapterForType()
+ {
+ assertTrue("Adapter reports that it is not for ILocatorAdapter", adapter.isAdapterForType(IAnnotationAdapter.class));
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/MethodPropertyDefaultsAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/MethodPropertyDefaultsAdapterTest.java
new file mode 100755
index 0000000..c8f71e8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/MethodPropertyDefaultsAdapterTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.MethodPropertyDefaultsAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.PropertyDefaultsAdapterFactory;
+
+/**
+ * Tests for method default values adapter
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodPropertyDefaultsAdapterTest extends TestCase
+{
+ private IWebMethod webMethod;
+ private IPropertyDefaults defaults;
+
+ public void setUp()
+ {
+ webMethod = DomFactory.eINSTANCE.createIWebMethod();
+ webMethod.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "myMethod()");
+ defaults = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webMethod, IPropertyDefaults.class);
+ }
+
+ public void testMethodName()
+ {
+ assertEquals("myMethod", defaults.getDefault(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testAdaptedOnce()
+ {
+ IPropertyDefaults adapter = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webMethod, IPropertyDefaults.class);
+ assertTrue(adapter instanceof MethodPropertyDefaultsAdapter);
+ assertEquals(1, webMethod.eAdapters().size());
+ assertEquals(defaults, adapter);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/ParameterPropertyDefaultsAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/ParameterPropertyDefaultsAdapterTest.java
new file mode 100755
index 0000000..aa267f9
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/ParameterPropertyDefaultsAdapterTest.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.ParameterPropertyDefaultsAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.PropertyDefaultsAdapterFactory;
+
+/**
+ * Tests for {@link IWebParam} properties default values
+ *
+ * @author Georgi Vachkov
+ */
+public class ParameterPropertyDefaultsAdapterTest extends TestCase
+{
+ private IWebMethod webMethod;
+ private IWebParam webParam;
+ private IPropertyDefaults defaults;
+
+ public void setUp()
+ {
+ webMethod = DomFactory.eINSTANCE.createIWebMethod();
+ webMethod.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ webMethod.setSoapBindingUse(SOAPBindingUse.LITERAL);
+ webMethod.setSoapBindingParameterStyle(SOAPBindingParameterStyle.WRAPPED);
+
+ webParam = DomFactory.eINSTANCE.createIWebParam();
+ webParam.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "myParam");
+
+ IWebParam dummy = DomFactory.eINSTANCE.createIWebParam();
+ dummy.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "dummy");
+
+ webMethod.getParameters().add(dummy);
+ webMethod.getParameters().add(webParam);
+
+ defaults = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webParam, IPropertyDefaults.class);
+ }
+
+ public void testNameDefaultValue()
+ {
+ webParam.setName("test");
+ assertEquals("arg1", defaults.getDefault(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testPartNameDefaultValue()
+ {
+ webParam.setPartName("test");
+ assertEquals("arg1", defaults.getDefault(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ }
+
+ public void testPartNameMethodParamStyleBare()
+ {
+ webMethod.setSoapBindingParameterStyle(SOAPBindingParameterStyle.BARE);
+ webMethod.setName("test");
+ assertEquals("test", defaults.getDefault(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testTargetNSDefaultValue()
+ {
+ webParam.setTargetNamespace("test");
+ assertEquals("", defaults.getDefault(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testTargetNSParamInHeaderDefaultValue()
+ {
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ sei.setTargetNamespace("http://test");
+
+ sei.getWebMethods().add(webMethod);
+
+ webParam.setHeader(true);
+ assertEquals("http://test", defaults.getDefault(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testHeaderDefaultValue()
+ {
+ assertEquals(false, defaults.getDefault(DomPackage.Literals.IWEB_PARAM__HEADER));
+ }
+
+ public void testKindDefaultValue()
+ {
+ assertEquals(WebParamKind.IN, defaults.getDefault(DomPackage.Literals.IWEB_PARAM__KIND));
+ }
+
+ public void testAdaptedOnce()
+ {
+ IPropertyDefaults adapter = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webParam, IPropertyDefaults.class);
+ assertTrue(adapter instanceof ParameterPropertyDefaultsAdapter);
+
+ assertEquals(1, webParam.eAdapters().size());
+ assertEquals(defaults, adapter);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/SeiPropertyDefaultsAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/SeiPropertyDefaultsAdapterTest.java
new file mode 100755
index 0000000..2649a99
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/SeiPropertyDefaultsAdapterTest.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.PropertyDefaultsAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.SeiPropertyDefaultsAdapter;
+
+/**
+ * Tests for {@link IServiceEndpointInterface} default properties values
+ * @author Georgi Vachkov
+ */
+public class SeiPropertyDefaultsAdapterTest extends TestCase
+{
+ private IServiceEndpointInterface sei;
+ private IPropertyDefaults defaults;
+
+ public void setUp()
+ {
+ sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ sei.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "com.sap.test.Sei");
+ defaults = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(sei, IPropertyDefaults.class);
+ }
+
+ public void testNameDefaultValue()
+ {
+ sei.setName("Test");
+ assertEquals("Sei", defaults.getDefault(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testTargetNamespaceDefaultValue()
+ {
+ sei.setTargetNamespace("test");
+ assertEquals("http://sap.com/test/", defaults.getDefault(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE));
+ }
+
+ public void testAdaptedOnce()
+ {
+ IPropertyDefaults adapter = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(sei, IPropertyDefaults.class);
+ assertTrue(adapter instanceof SeiPropertyDefaultsAdapter);
+ assertEquals(1, sei.eAdapters().size());
+ assertEquals(defaults, adapter);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/WsPropertyDefaultsAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/WsPropertyDefaultsAdapterTest.java
new file mode 100755
index 0000000..c482f42
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/defaults/WsPropertyDefaultsAdapterTest.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.defaults;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyDefaults;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.PropertyDefaultsAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.defaults.WsPropertyDefaultsAdapter;
+
+/**
+ * Tests for {@link IWebService} default values calculation
+ * @author Georgi Vachkov
+ */
+public class WsPropertyDefaultsAdapterTest extends TestCase
+{
+ private IWebService webService;
+ private IPropertyDefaults defaults;
+
+ public void setUp() {
+ webService = DomFactory.eINSTANCE.createIWebService();
+ webService.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "com.sap.test.MyWs");
+ defaults = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webService, IPropertyDefaults.class);
+ }
+
+ public void testNameDefaultValue()
+ {
+ webService.setName("Test");
+ assertEquals("MyWsService", defaults.getDefault(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testPortNameDefaultValue()
+ {
+ webService.setPortName("TestPortName");
+ assertEquals("MyWsPort", defaults.getDefault(DomPackage.Literals.IWEB_SERVICE__PORT_NAME));
+ }
+
+ public void testTargetNamespaceDefaultValue()
+ {
+ webService.setTargetNamespace("test");
+ assertEquals("http://sap.com/test/", defaults.getDefault(DomPackage.Literals.IWEB_SERVICE__TARGET_NAMESPACE));
+ }
+
+ public void testAdaptedOnce()
+ {
+ IPropertyDefaults adapter = (IPropertyDefaults)PropertyDefaultsAdapterFactory.INSTANCE.adapt(webService, IPropertyDefaults.class);
+ assertTrue(adapter instanceof WsPropertyDefaultsAdapter);
+ assertEquals(1, webService.eAdapters().size());
+ assertEquals(defaults, adapter);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/AbstractSerializerAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/AbstractSerializerAdapterTest.java
new file mode 100755
index 0000000..b7a30bd
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/AbstractSerializerAdapterTest.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.AbstractSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.WsSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * Tests for {@link WsSerializerAdapter} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class AbstractSerializerAdapterTest extends MockObjectTestCase
+{
+ private TestWsSerializerAdapter adapter;
+ private JaxWsWorkspaceResource resource;
+
+ @Override
+ public void setUp()
+ {
+ Mock<IJavaModel> javaModelMock = mock(IJavaModel.class);
+ resource = new JaxWsWorkspaceResource(javaModelMock.proxy());
+ adapter = new TestWsSerializerAdapter(null, false);
+ }
+
+ public void testWsSerializerAdapter()
+ {
+ try {
+ new WsSerializerAdapter(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _) {
+ }
+ }
+
+ public void testNotifyChangedNotificationEditEnabledOnSet()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.expects(once()).method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.SET));
+
+ adapter.notifyChanged(notificationMock.proxy());
+ assertTrue(adapter.saveCalled);
+ }
+
+ public void testNotifyChangedNotificationEditEnabledOnUnset()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.expects(once()).method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.UNSET));
+
+ adapter.notifyChanged(notificationMock.proxy());
+ assertTrue(adapter.saveCalled);
+ }
+
+ public void testNotifyChangedNotificationEditEnabledOnAdd()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.expects(once()).method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.ADD));
+
+ adapter.notifyChanged(notificationMock.proxy());
+ assertFalse(adapter.saveCalled);
+ }
+
+ public void testNotifyChangedNotificationObjectTouched()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.expects(once()).method("isTouch").will(returnValue(true));
+ adapter.notifyChanged(notificationMock.proxy());
+ assertFalse(adapter.saveCalled);
+ }
+
+ public void testNotifyChangedNotificationEditDisabled()
+ {
+ resource.disableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ adapter.notifyChanged(notificationMock.proxy());
+ assertFalse(adapter.saveCalled);
+ }
+
+ public void testCheckStringValue()
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ TestWsSerializerAdapter adapter = new TestWsSerializerAdapter(ws, true);
+
+ Mock<Notification> msg = mock(Notification.class);
+ msg.stubs().method("getFeature").will(returnValue(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ msg.stubs().method("getOldStringValue").will(returnValue("oldValue"));
+ msg.stubs().method("getNewStringValue").will(returnValue("newValue"));
+
+ assertTrue(adapter.checkValue(msg.proxy()));
+ assertEquals("newValue", ws.getName());
+ }
+
+ public void testCheckStringValueInvalidValues()
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ TestWsSerializerAdapter adapter = new TestWsSerializerAdapter(ws, true);
+
+ Mock<Notification> msg = mock(Notification.class);
+ msg.stubs().method("getFeature").will(returnValue(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ msg.stubs().method("getOldValue").will(returnValue("oldValue"));
+
+ msg.stubs().method("getNewStringValue").will(returnValue(null));
+ assertFalse(adapter.checkValue(msg.proxy()));
+ assertEquals("oldValue", ws.getName());
+ msg.stubs().method("getNewStringValue").will(returnValue(""));
+ assertFalse(adapter.checkValue(msg.proxy()));
+ assertEquals("oldValue", ws.getName());
+ msg.stubs().method("getNewStringValue").will(returnValue(" "));
+ assertFalse(adapter.checkValue(msg.proxy()));
+ assertEquals("oldValue", ws.getName());
+ msg.stubs().method("getNewStringValue").will(returnValue(" oldValue "));
+ assertTrue(adapter.checkValue(msg.proxy()));
+ assertEquals("oldValue", ws.getName());
+ }
+
+ public void testIsAdapterForTypeObject()
+ {
+ assertTrue(adapter.isAdapterForType(IAnnotationSerializer.class));
+ assertFalse(adapter.isAdapterForType(Notification.class));
+ }
+
+ public void testUpdateCalledForRequiredAnnotation()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.stubs().method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.UNSET));
+ notificationMock.stubs().method("getNewStringValue").will(returnValue("test"));
+ notificationMock.stubs().method("getOldValue").will(returnValue("oldValue"));
+ notificationMock.stubs().method("getFeature").will(returnValue(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getParamValuePairs").will(returnValue(new HashSet<IParamValuePair>()));
+
+ TestSavingWsSerializerAdapter saveAdapter = new TestSavingWsSerializerAdapter(resource, true, ann.proxy());
+ saveAdapter.setTarget(DomFactory.eINSTANCE.createIWebService());
+ saveAdapter.notifyChanged(notificationMock.proxy());
+ assertTrue(saveAdapter.annWriter.updateCalled);
+ assertFalse(saveAdapter.annWriter.removeCalled);
+ }
+
+ public void testUpdateCalledForNonEmptyAnnotation()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.stubs().method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.UNSET));
+ notificationMock.stubs().method("getNewStringValue").will(returnValue("test"));
+ notificationMock.stubs().method("getOldValue").will(returnValue("oldValue"));
+ notificationMock.stubs().method("getFeature").will(returnValue(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ Set<IParamValuePair> params = new HashSet<IParamValuePair>();
+ Mock<IParamValuePair> param = mock(IParamValuePair.class);
+ params.add(param.proxy());
+ ann.stubs().method("getParamValuePairs").will(returnValue(params));
+
+ TestSavingWsSerializerAdapter saveAdapter = new TestSavingWsSerializerAdapter(resource, false, ann.proxy());
+ saveAdapter.setTarget(DomFactory.eINSTANCE.createIWebService());
+ saveAdapter.notifyChanged(notificationMock.proxy());
+ assertTrue(saveAdapter.annWriter.updateCalled);
+ assertFalse(saveAdapter.annWriter.removeCalled);
+ }
+
+ public void testRemoveCalledForNotRequiredAnnotation()
+ {
+ resource.enableSaving();
+ Mock<Notification> notificationMock = mock(Notification.class);
+ notificationMock.stubs().method("isTouch").will(returnValue(false));
+ notificationMock.stubs().method("getEventType").will(returnValue(Notification.UNSET));
+ notificationMock.stubs().method("getNewStringValue").will(returnValue("test"));
+ notificationMock.stubs().method("getOldValue").will(returnValue("oldValue"));
+ notificationMock.stubs().method("getFeature").will(returnValue(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ Mock<IAnnotation<IType>> ann = mock(IAnnotation.class);
+ ann.stubs().method("getParamValuePairs").will(returnValue(new HashSet<IParamValuePair>()));
+
+ TestSavingWsSerializerAdapter saveAdapter = new TestSavingWsSerializerAdapter(resource, false, ann.proxy());
+ saveAdapter.setTarget(DomFactory.eINSTANCE.createIWebService());
+ saveAdapter.notifyChanged(notificationMock.proxy());
+ assertFalse(saveAdapter.annWriter.updateCalled);
+ assertTrue(saveAdapter.annWriter.removeCalled);
+ }
+
+
+ protected class TestWsSerializerAdapter extends AbstractSerializerAdapter
+ {
+ public boolean saveCalled;
+
+ private boolean doCheck;
+
+ private IWebService ws;
+
+ public TestWsSerializerAdapter(final IWebService ws, boolean doCheck) {
+ super(resource);
+ this.ws = ws;
+ this.doCheck = doCheck;
+ }
+
+ @Override
+ public void save(Notification msg) {
+ saveCalled = true;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException {
+ return null;
+ }
+
+ @Override
+ public boolean checkValue(Notification msg)
+ {
+ if(!doCheck) {
+ return true;
+ }
+
+ return super.checkValue(msg);
+ }
+
+ @Override
+ public EObject getTarget() {
+ return ws;
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return true;
+ }
+ }
+
+ protected class TestSavingWsSerializerAdapter extends AbstractSerializerAdapter
+ {
+ boolean annRequired;
+ MyAnnotationWriter annWriter = new MyAnnotationWriter();
+ IAnnotation<? extends IJavaElement> ann;
+
+ public TestSavingWsSerializerAdapter(JaxWsWorkspaceResource resource, boolean annRequired, IAnnotation<? extends IJavaElement> ann) {
+ super(resource);
+ this.annRequired = annRequired;
+ this.ann = ann;
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException {
+ return ann;
+ }
+
+ @Override
+ protected boolean isAnnotationRequired() {
+ return annRequired;
+ }
+
+ @Override
+ protected AnnotationWriter getAnnotationWriter() {
+ return annWriter;
+ }
+ }
+
+ protected class MyAnnotationWriter extends AnnotationWriter
+ {
+ boolean removeCalled;
+ boolean updateCalled;
+
+ public void clear()
+ {
+ removeCalled = false;
+ updateCalled = false;
+ }
+
+ @Override
+ public <T extends IJavaElement> void update(final IAnnotation<T> annotation) {
+ updateCalled = true;
+ }
+
+ @Override
+ public <T extends IJavaElement> void remove(final IAnnotation<T> annotation) {
+ removeCalled = true;
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/MethodSerializerAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/MethodSerializerAdapterTest.java
new file mode 100755
index 0000000..0d3c49a
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/MethodSerializerAdapterTest.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.MethodSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WMAnnotationFeatures.WM_ANNOTATION;
+
+public class MethodSerializerAdapterTest extends SerializerAdapterTestFixture
+{
+ private IWebMethod webMethod1;
+ private IMethod method1;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ resource.startSynchronizing();
+ method1 = seiType.createMethod("public void test1();", null, true, null);
+ webMethod1 = sei.getWebMethods().get(0);
+ }
+
+ public void testGetAnnotationDefaultValues() throws Exception
+ {
+ MyMethodSerializerAdapter adapter = new MyMethodSerializerAdapter(resource, webMethod1);
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertNotNull(annotation);
+ assertEquals(0, annotation.getParamValuePairs().size());
+ assertNull(annotation.getPropertyValue(WMAnnotationFeatures.WM_NAME_ATTRIBUTE));
+ assertNull(annotation.getPropertyValue(WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE));
+ }
+
+ public void testGetAnnotationNonDefaultValues() throws Exception
+ {
+ resource.disableSaving();
+ webMethod1.setName("changed");
+ webMethod1.setExcluded(true);
+ MyMethodSerializerAdapter adapter = new MyMethodSerializerAdapter(resource, webMethod1);
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertNotNull(annotation);
+ assertEquals(2, annotation.getParamValuePairs().size());
+ assertEquals("changed", annotation.getPropertyValue(WMAnnotationFeatures.WM_NAME_ATTRIBUTE));
+ assertEquals("true", annotation.getPropertyValue(WMAnnotationFeatures.WM_EXCLUDED_ATTRIBUTE));
+ }
+
+ public void testSaveAnnotation() throws Exception
+ {
+ webMethod1.setName("changedOperation");
+ final IAnnotationInspector inspector = AnnotationFactory.createAnnotationInspector(seiType);
+ final IAnnotation<IMethod> annotation = inspector.inspectMethod(method1, WM_ANNOTATION);
+ assertNotNull(annotation);
+ assertEquals("changedOperation", annotation.getPropertyValue(WMAnnotationFeatures.WM_NAME_ATTRIBUTE));
+ }
+
+ public void testSaveAnnotationEmptyName() throws Exception
+ {
+ webMethod1.setName("method1");
+ webMethod1.setName(null);
+ final IAnnotationInspector inspector = AnnotationFactory.createAnnotationInspector(seiType);
+ final IAnnotation<IMethod> annotation = inspector.inspectMethod(method1, WM_ANNOTATION);
+ assertNotNull(annotation);
+ assertEquals("method1", annotation.getPropertyValue(WMAnnotationFeatures.WM_NAME_ATTRIBUTE));
+ }
+
+ protected class MyMethodSerializerAdapter extends MethodSerializerAdapter
+ {
+ public MyMethodSerializerAdapter(JaxWsWorkspaceResource resource, IWebMethod webMethod) {
+ super(resource);
+ setTarget(webMethod);
+ }
+
+ public IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException
+ {
+ return super.getAnnotation();
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/ParameterSerializerAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/ParameterSerializerAdapterTest.java
new file mode 100755
index 0000000..4599e9d
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/ParameterSerializerAdapterTest.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures.WP_ANNOTATION;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WPAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.ParameterSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+public class ParameterSerializerAdapterTest extends SerializerAdapterTestFixture
+{
+ private MyParameterSerializerAdapter adapter;
+ private IMethod method;
+ private IWebMethod wsMethod;
+ private IWebParam webParam;
+ private IAnnotationInspector inspector;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ resource.startSynchronizing();
+ adapter = new MyParameterSerializerAdapter(resource);
+ method = seiType.createMethod("public void method(int param1);", null, false, null);
+ wsMethod = domUtil.findWebMethodByImpl(sei, domUtil.calcImplementation(method));
+ webParam = wsMethod.getParameters().get(0);
+ adapter.setTarget(webParam);
+ resource.disableSaving();
+ inspector = AnnotationFactory.createAnnotationInspector(seiType);
+ }
+
+ public void testGetAnnotationKind() throws Exception
+ {
+ // IN case
+ webParam.setKind(WebParamKind.IN);
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(0, annotation.getParamValuePairs().size());
+
+ // INOUT case
+ webParam.setKind(WebParamKind.INOUT);
+ annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ IParamValuePair paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("mode", paramValue.getParam());
+ assertTrue(WPAnnotationFeatures.WEB_PARAM_MODE_INOUT.endsWith(paramValue.getValue().toString()));
+
+ // OUT case
+ webParam.setKind(WebParamKind.OUT);
+ annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("mode", paramValue.getParam());
+ assertTrue(WPAnnotationFeatures.WEB_PARAM_MODE_OUT.endsWith(paramValue.getValue().toString()));
+ }
+
+ public void testGetAnnotationHeader() throws Exception
+ {
+ // not in header case
+ webParam.setHeader(false);
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(0, annotation.getParamValuePairs().size());
+
+ // in header case
+ webParam.setHeader(true);
+ annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ IParamValuePair paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("header", paramValue.getParam());
+ assertEquals("true", paramValue.getValue().toString());
+ }
+
+ public void testGetAnnotationName() throws Exception
+ {
+ webParam.setName("arg0");
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(0, annotation.getParamValuePairs().size());
+
+ // in header case
+ webParam.setName("changed");
+ annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ IParamValuePair paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("name", paramValue.getParam());
+ assertEquals("changed", paramValue.getValue().toString());
+ }
+
+ public void testGetAnnotationPartName() throws Exception
+ {
+ wsMethod.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ webParam.setPartName("arg0");
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertEquals(WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(0, annotation.getParamValuePairs().size());
+
+ // in header case
+ webParam.setPartName("changed");
+ annotation = adapter.getAnnotation();
+ assertEquals(WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ IParamValuePair paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("partName", paramValue.getParam());
+ assertEquals("changed", paramValue.getValue().toString());
+ }
+
+ public void testChangeNameChangesPartName() throws Exception
+ {
+ resource.enableSaving();
+ webParam.setName("changed");
+
+ IAnnotation<ITypeParameter> annotation = inspector.inspectParam(method.getTypeParameter(webParam.getImplementation()), WP_ANNOTATION);
+ assertNotNull(annotation);
+ assertEquals("changed", annotation.getPropertyValue("name"));
+ assertEquals(null, annotation.getPropertyValue("partName"));
+ }
+
+ public void testChangeNameDoesNotChangePartNameIfPartNameInAnnotation() throws Exception
+ {
+ method = seiType.createMethod("public void method1(@javax.jws.WebParam(name=\"param1\", partName=\"param1Part\") int param1);", null, false, null);
+ wsMethod = testUtil.findWebMethodByName(sei, "method1");
+ webParam = testUtil.findParam(wsMethod, "param1");
+ wsMethod.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ resource.enableSaving();
+ webParam.setName("test");
+ IAnnotation<ITypeParameter> annotation = inspector.inspectParam(method.getTypeParameter(webParam.getImplementation()), WP_ANNOTATION);
+ assertNotNull(annotation);
+ assertEquals("param1Part", annotation.getPropertyValue("partName"));
+ }
+
+ public void testGetAnnotationTargetNS() throws Exception
+ {
+ wsMethod.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ webParam.setTargetNamespace("http://com.sap/test");
+ IAnnotation<? extends IJavaElement> annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(0, annotation.getParamValuePairs().size());
+
+ // changed target namespace case
+ webParam.setTargetNamespace("http://changed");
+ annotation = adapter.getAnnotation();
+ assertEquals(WPAnnotationFeatures.WP_ANNOTATION, annotation.getAnnotationName());
+ assertEquals(1, annotation.getParamValuePairs().size());
+ IParamValuePair paramValue = annotation.getParamValuePairs().iterator().next();
+ assertEquals("targetNamespace", paramValue.getParam());
+ assertEquals("http://changed", paramValue.getValue().toString());
+ }
+
+ public void testSaveAnnotation() throws Exception
+ {
+ wsMethod.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ webParam.setName("changed");
+ webParam.setKind(WebParamKind.INOUT);
+ webParam.setPartName("different");
+ webParam.setHeader(true);
+ resource.enableSaving();
+ webParam.setTargetNamespace("http://changed/terget/ns");
+
+ IAnnotation<ITypeParameter> annotation = inspector.inspectParam(method.getTypeParameter(webParam.getImplementation()), WP_ANNOTATION);
+ assertNotNull(annotation);
+ assertEquals(4, annotation.getParamValuePairs().size());
+ assertEquals("changed", annotation.getPropertyValue("name"));
+ assertTrue(WPAnnotationFeatures.WEB_PARAM_MODE_INOUT.endsWith(annotation.getPropertyValue("mode")));
+ assertEquals("http://changed/terget/ns", annotation.getPropertyValue("targetNamespace"));
+
+ wsMethod.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ webParam.setPartName("different");
+ // create new inspector cause source has been changed
+ inspector = AnnotationFactory.createAnnotationInspector(seiType);
+ annotation = inspector.inspectParam(method.getTypeParameter(webParam.getImplementation()), WP_ANNOTATION);
+ assertEquals(5, annotation.getParamValuePairs().size());
+ assertEquals("different", annotation.getPropertyValue("partName"));
+ }
+
+ public void testEmptyAnnotationRemoved() throws JavaModelException
+ {
+ method = seiType.createMethod("public void method1(@javax.jws.WebParam(name=\"param1\") int param1);", null, false, null);
+ wsMethod = testUtil.findWebMethodByName(sei, "method1");
+ webParam = testUtil.findParam(wsMethod, "param1");
+ resource.enableSaving();
+ webParam.setName("arg0");
+ IAnnotation<ITypeParameter>annotation = inspector.inspectParam(method.getTypeParameter(webParam.getImplementation()), WP_ANNOTATION);
+ assertNull("Empty annotation has not been removed", annotation);
+ }
+
+ protected class MyParameterSerializerAdapter extends ParameterSerializerAdapter
+ {
+ public MyParameterSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ public IAnnotation<? extends IJavaElement> getAnnotation() throws JavaModelException {
+ return super.getAnnotation();
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SeiSerializerAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SeiSerializerAdapterTest.java
new file mode 100755
index 0000000..d3841d9
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SeiSerializerAdapterTest.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.SeiSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+
+/**
+ * Tests for {@link SeiSerializerAdapter} class;
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiSerializerAdapterTest extends SerializerAdapterTestFixture
+{
+ public void testCreateIAnnotationIServiceEndpointInterface() throws JavaModelException
+ {
+ try {
+ new MySeiSerializerAdapter(resource).createIAnnotation((IServiceEndpointInterface)null, project.getJavaProject().getJavaModel());
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _) {}
+
+ try {
+ new MySeiSerializerAdapter(resource).createIAnnotation(sei, null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _) {}
+ }
+
+ public void testCreateIAnnotationExplicitSei() throws JavaModelException
+ {
+ final IAnnotation<? extends IJavaElement> annotation = new MySeiSerializerAdapter(resource).createIAnnotation(sei, project.getJavaProject().getJavaModel());
+ assertEquals(2, annotation.getParamValuePairs().size());
+ assertEquals(TARGET_NAMESPACE, annotation.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE));
+ assertEquals(PORT_TYPE_NAME, annotation.getPropertyValue(NAME_ATTRIBUTE));
+ assertEquals(seiType.getFullyQualifiedName(), ((IType)annotation.getAppliedElement()).getFullyQualifiedName());
+ }
+
+ public void testCreateIAnnotationImplicitSei() throws JavaModelException
+ {
+ final IAnnotation<? extends IJavaElement> annotation = new MySeiSerializerAdapter(resource).createIAnnotation(wsImplicit.getServiceEndpoint(), project.getJavaProject().getJavaModel());
+ assertEquals(5, annotation.getParamValuePairs().size());
+ WsSerializerAdapterTest.checkIWebServiceIAnnotation(annotation);
+ assertEquals("ImplicitName", annotation.getPropertyValue(WSAnnotationFeatures.NAME_ATTRIBUTE));
+ assertEquals(implBeanImplicit.getFullyQualifiedName(), ((IType)annotation.getAppliedElement()).getFullyQualifiedName());
+ }
+
+ public void testCreateIAnnotationDefaultValues() throws JavaModelException
+ {
+ sei.setName("SEI");
+ sei.setTargetNamespace("http://test/");
+ final IAnnotation<? extends IJavaElement> annotation = new MySeiSerializerAdapter(resource).createIAnnotation(sei, project.getJavaProject().getJavaModel());
+ assertEquals(0, annotation.getParamValuePairs().size());
+ }
+
+ public void testSaveAnnotation() throws JavaModelException
+ {
+ resource.getSerializerFactory().adapt(sei, IAnnotationSerializer.class);
+ sei.setName("ChangedSeiName");
+
+ IAnnotationInspector inspector = AnnotationFactory.createAnnotationInspector(seiType);
+ IAnnotation<IType> found = inspector.inspectType(WS_ANNOTATION);
+ assertNotNull(found);
+ assertEquals("ChangedSeiName", found.getPropertyValue(NAME_ATTRIBUTE));
+ assertEquals(TARGET_NAMESPACE, found.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE));
+ }
+
+ protected class MySeiSerializerAdapter extends SeiSerializerAdapter
+ {
+ public MySeiSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ @Override
+ protected IAnnotation<? extends IJavaElement> createIAnnotation(final IServiceEndpointInterface sei, final IJavaModel javaModel) throws JavaModelException
+ {
+ return super.createIAnnotation(sei, javaModel);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterFactoryTest.java
new file mode 100755
index 0000000..b653394
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterFactoryTest.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.SerializerAdapterFactory;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+/**
+ * Tests for {@link WsSerializerAdapterFactory} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class SerializerAdapterFactoryTest extends MockObjectTestCase
+{
+ private JaxWsWorkspaceResource resource;
+ private SerializerAdapterFactory factory;
+
+ @Override
+ public void setUp()
+ {
+ Mock<IJavaModel> javaModelMock = mock(IJavaModel.class);
+ resource = new JaxWsWorkspaceResource(javaModelMock.proxy());
+ factory = resource.getSerializerFactory();
+ }
+
+ public void testIsFactoryForType()
+ {
+ assertTrue(factory.isFactoryForType(IAnnotationSerializer.class));
+ assertFalse(factory.isFactoryForType(Notification.class));
+ }
+
+ public void testAdaptWebService()
+ {
+ IWebService webService = DomFactory.eINSTANCE.createIWebService();
+ Adapter adapter1 = factory.adapt(webService, IAnnotationSerializer.class);
+ assertEquals(1, webService.eAdapters().size());
+
+ Adapter adapter2 = factory.adapt(webService, IAnnotationSerializer.class);
+ assertEquals(1, webService.eAdapters().size());
+
+ assertTrue(adapter1==adapter2);
+ }
+
+ public void testAdaptSei()
+ {
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ Adapter adapter1 = factory.adapt(sei, IAnnotationSerializer.class);
+ assertEquals(1, sei.eAdapters().size());
+
+ Adapter adapter2 = factory.adapt(sei, IAnnotationSerializer.class);
+ assertEquals(1, sei.eAdapters().size());
+
+ assertTrue(adapter1==adapter2);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterTestFixture.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterTestFixture.java
new file mode 100755
index 0000000..d0fcff0
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/SerializerAdapterTestFixture.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.DomTestUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+public abstract class SerializerAdapterTestFixture extends TestCase
+{
+ protected static final String WS_ANNOTATION = "javax.jws.WebService";
+ protected static final String SERVICE_NAME = "MyService";
+ protected static final String PORT_TYPE_NAME = "MyPortType";
+ protected static final String PORT_NAME = "MyPort";
+ protected static final String TARGET_NAMESPACE = "http://com.sap/test";
+ protected static final String WSDL_LOCATION = "C:/test/wsdl/location";
+
+ protected IWebService ws;
+ protected IWebService wsImplicit;
+
+ protected IServiceEndpointInterface sei;
+ protected TestProject project;
+ protected IType implBeanType;
+ protected IType implBeanImplicit;
+ protected IType seiType;
+ protected IWebServiceProject wsProject;
+ protected JaxWsWorkspaceResource resource;
+ protected DomTestUtils testUtil = new DomTestUtils();
+ protected DomUtil domUtil = new DomUtil();
+
+ @Override
+ public void setUp() throws Exception
+ {
+ project = new TestProject();
+ final IPackageFragment pack = project.createSourceFolder("src").createPackageFragment("test", true, null);
+ seiType = project.createType(pack, "SEI.java", "@javax.jws.WebService(name=\"MyPortType\", targetNamespace=\"http://com.sap/test\")\n" +
+ "public interface SEI {}");
+ implBeanType = project.createType(pack, "ImplBean.java", "@javax.jws.WebService(endpointInterface=\"test.SEI\", " +
+ "serviceName=\"MyService\", portName=\"MyPort\", wsdlLocation=\"C:/test/wsdl/location\", targetNamespace=\"http://com.sap/test\")" +
+ "public class ImplBean {}");
+
+ implBeanImplicit = project.createType(pack, "ImplicitImplBean.java", "@javax.jws.WebService(name=\"ImplicitName\", " +
+ "serviceName=\"MyService\", portName=\"MyPort\", wsdlLocation=\"C:/test/wsdl/location\", targetNamespace=\"http://com.sap/test\")" +
+ "public class ImplicitImplBean {}");
+
+ assertNotNull(seiType);
+ assertNotNull(implBeanType);
+ resource = createTarget();
+ resource.load(null);
+
+ wsProject = resource.getDOM().getWebServiceProjects().get(0);
+ sei = domUtil.findSeiByImplName(wsProject, "test.SEI");
+ ws = domUtil.findWsByImplName(wsProject, "test.ImplBean");
+ wsImplicit = domUtil.findWsByImplName(wsProject, "test.ImplicitImplBean");
+ }
+
+ @Override
+ public void tearDown()
+ {
+ try {
+ project.dispose();
+ } catch (Exception _) {
+ }
+ }
+
+ private JaxWsWorkspaceResource createTarget()
+ {
+ return new JaxWsWorkspaceResource(project.getJavaProject().getJavaModel())
+ {
+ @Override
+ public boolean approveProject(IJavaProject prj)
+ {
+ if (prj.getElementName().equals(project.getJavaProject().getElementName()))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ };
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/WsSerializerAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/WsSerializerAdapterTest.java
new file mode 100755
index 0000000..b3ea0ef
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/serializer/WsSerializerAdapterTest.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.serializer;
+
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.PORT_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE;
+import static org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IAnnotationSerializer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.serializer.WsSerializerAdapter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotationInspector;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+
+/**
+ * Tests for {@link WsSerializerAdapter} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsSerializerAdapterTest extends SerializerAdapterTestFixture
+{
+ public void testCreateIAnnotationIWebServiceNpe() throws JavaModelException
+ {
+ try {
+ new MyWsSerializerAdapter(resource).createIAnnotation((IWebService)null, project.getJavaProject().getJavaModel());
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _) {}
+
+ try {
+ new MyWsSerializerAdapter(resource).createIAnnotation(ws, null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _) {}
+ }
+
+ public void testCreateIAnnotationIWebServiceExplicit() throws JavaModelException
+ {
+ final IAnnotation<? extends IJavaElement> annotation = new MyWsSerializerAdapter(resource).createIAnnotation(ws, project.getJavaProject().getJavaModel());
+ assertEquals(5, annotation.getParamValuePairs().size());
+ checkIWebServiceIAnnotation(annotation);
+ assertNotNull(annotation.getPropertyValue(WSAnnotationFeatures.ENDPOINT_INTERFACE_ATTRIBUTE));
+ assertEquals(implBeanType.getFullyQualifiedName(), ((IType)annotation.getAppliedElement()).getFullyQualifiedName());
+ }
+
+ public void testCreateIAnnotationIWebServiceImplicit() throws JavaModelException
+ {
+ final IAnnotation<? extends IJavaElement> annotation = new MyWsSerializerAdapter(resource).createIAnnotation(wsImplicit, project.getJavaProject().getJavaModel());
+ assertEquals(5, annotation.getParamValuePairs().size());
+ checkIWebServiceIAnnotation(annotation);
+
+ assertEquals("ImplicitName", annotation.getPropertyValue(WSAnnotationFeatures.NAME_ATTRIBUTE));
+ assertEquals(implBeanImplicit.getFullyQualifiedName(), ((IType)annotation.getAppliedElement()).getFullyQualifiedName());
+ }
+
+ public void testCreateIAnnotationIWebServiceDefault() throws JavaModelException
+ {
+ resource.disableSaving();
+ wsImplicit.getServiceEndpoint().setName("ImplicitImplBean");
+ wsImplicit.setName("ImplicitImplBeanService");
+ wsImplicit.setPortName("ImplicitImplBeanPort");
+ wsImplicit.setTargetNamespace("http://test/");
+ wsImplicit.setWsdlLocation(null);
+ final IAnnotation<? extends IJavaElement> annotation =new MyWsSerializerAdapter(resource).createIAnnotation(wsImplicit, project.getJavaProject().getJavaModel());
+ assertEquals(0, annotation.getParamValuePairs().size());
+ }
+
+ public void testSaveAnnotation() throws JavaModelException
+ {
+ resource.getSerializerFactory().adapt(ws, IAnnotationSerializer.class);
+ ws.setName("ChangedService");
+
+ IAnnotationInspector inspector = AnnotationFactory.createAnnotationInspector(implBeanType);
+ IAnnotation<IType> found = inspector.inspectType(WS_ANNOTATION);
+ assertNotNull(found);
+ assertEquals("ChangedService", found.getPropertyValue(SERVICE_NAME_ATTRIBUTE));
+ assertEquals(PORT_NAME, found.getPropertyValue(PORT_NAME_ATTRIBUTE));
+ assertEquals(TARGET_NAMESPACE, found.getPropertyValue(TARGET_NAMESPACE_ATTRIBUTE));
+ assertEquals(WSDL_LOCATION, found.getPropertyValue(WSDL_LOCATION_ATTRIBUTE));
+ }
+
+ public static void checkIWebServiceIAnnotation(IAnnotation<? extends IJavaElement> annotation)
+ {
+ boolean [] found = {false, false, false, false};
+ String [] params = {"serviceName", "portName", "targetNamespace", "wsdlLocation" };
+ for (IParamValuePair paramValuePair : annotation.getParamValuePairs())
+ {
+ String param = paramValuePair.getParam();
+ if (param.equals(WSAnnotationFeatures.SERVICE_NAME_ATTRIBUTE)) {
+ assertEquals(SERVICE_NAME, paramValuePair.getValue().toString());
+ found[0] = true;
+ }
+ if (param.equals(WSAnnotationFeatures.PORT_NAME_ATTRIBUTE)) {
+ assertEquals(PORT_NAME, paramValuePair.getValue().toString());
+ found[1] = true;
+ }
+ if (param.equals(WSAnnotationFeatures.TARGET_NAMESPACE_ATTRIBUTE)) {
+ assertEquals(TARGET_NAMESPACE, paramValuePair.getValue().toString());
+ found[2] = true;
+ }
+ if (param.equals(WSAnnotationFeatures.WSDL_LOCATION_ATTRIBUTE)) {
+ assertEquals(WSDL_LOCATION, paramValuePair.getValue().toString());
+ found[3] = true;
+ }
+ }
+
+ for (int i=0; i < found.length; i++)
+ {
+ assertTrue("Annotation param " + params[i] + " not found", found[i]);
+ }
+ }
+
+ protected class MyWsSerializerAdapter extends WsSerializerAdapter
+ {
+ public MyWsSerializerAdapter(JaxWsWorkspaceResource resource) {
+ super(resource);
+ }
+
+ @Override
+ public IAnnotation<? extends IJavaElement> createIAnnotation(final IWebService ws, final IJavaModel javaModel) throws JavaModelException
+ {
+ return super.createIAnnotation(ws, javaModel);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/MethodPropertyStateAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/MethodPropertyStateAdapterTest.java
new file mode 100755
index 0000000..9e85adb
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/MethodPropertyStateAdapterTest.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.MethodPropertyStateAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+
+/**
+ * Class containing tests for {@link MethodPropertyStateAdapter}
+ *
+ * @author Georgi Vachkov
+ */
+public class MethodPropertyStateAdapterTest extends TestCase
+{
+ private IWebMethod wm;
+ private IWebService ws;
+ private IPropertyState adapter;
+
+ public void setUp()
+ {
+ wm = DomFactory.eINSTANCE.createIWebMethod();
+ ws = DomFactory.eINSTANCE.createIWebService();
+
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ sei.getWebMethods().add(wm);
+ sei.getImplementingWebServices().add(ws);
+ adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(wm, IPropertyState.class);
+ assertNotNull(adapter);
+ }
+
+ public void testIsChangebleOutsideInWs()
+ {
+ ws.setWsdlLocation("C:/test/wsdl/location");
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__EXCLUDED));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_STYLE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_USE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE));
+ }
+
+ public void testIsChangable()
+ {
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__EXCLUDED));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_STYLE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_USE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_METHOD__SOAP_BINDING_PARAMETER_STYLE));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/ParameterPropertyStateAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/ParameterPropertyStateAdapterTest.java
new file mode 100755
index 0000000..2842209
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/ParameterPropertyStateAdapterTest.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.ParameterPropertyStateAdapter;
+
+public class ParameterPropertyStateAdapterTest extends TestCase
+{
+ private ParameterPropertyStateAdapter adapter;;
+ private IWebParam param;
+ private IWebMethod method;
+ private IServiceEndpointInterface sei;
+
+ @Override
+ public void setUp()
+ {
+ sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ method = DomFactory.eINSTANCE.createIWebMethod();
+ method.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ method.setSoapBindingUse(SOAPBindingUse.LITERAL);
+ method.setSoapBindingParameterStyle(SOAPBindingParameterStyle.WRAPPED);
+ sei.getWebMethods().add(method);
+
+ param = DomFactory.eINSTANCE.createIWebParam();
+ param.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "testParam");
+ param.setName("testParam");
+ method.getParameters().add(param);
+
+ adapter = new ParameterPropertyStateAdapter();
+ adapter.setTarget(param);
+ }
+
+ public void testIsChagebleNameCorrectSoapBinding()
+ {
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testIsChagebleNameIncorrectSoapBinding()
+ {
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+
+ method.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ method.setSoapBindingUse(SOAPBindingUse.ENCODED);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+
+ method.setSoapBindingUse(SOAPBindingUse.LITERAL);
+ method.setSoapBindingParameterStyle(SOAPBindingParameterStyle.BARE);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testIsChagebleNameParamInHeader()
+ {
+ param.setHeader(true);
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ method.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+
+ public void testIsChagebleTargetNSCorrectSoapBinding()
+ {
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testIsChagebleTargetNSIncorrectSoapBinding()
+ {
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+
+ method.setSoapBindingStyle(SOAPBindingStyle.DOCUMENT);
+ method.setSoapBindingUse(SOAPBindingUse.ENCODED);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+
+ method.setSoapBindingUse(SOAPBindingUse.LITERAL);
+ method.setSoapBindingParameterStyle(SOAPBindingParameterStyle.BARE);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testIsChagebleTargetNSParamInHeader()
+ {
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ param.setHeader(true);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testIsChageblePartNameCorrectSoapBinding()
+ {
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ }
+
+ public void testIsChageblePartNameIncorrectSoapBinding()
+ {
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ method.setSoapBindingUse(SOAPBindingUse.ENCODED);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+
+ method.setSoapBindingUse(SOAPBindingUse.LITERAL);
+ method.setSoapBindingParameterStyle(SOAPBindingParameterStyle.BARE);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ }
+
+ public void testIsChagebleTargetNSHeader()
+ {
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__HEADER));
+
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__HEADER));
+ }
+
+ public void testReturnParamNotEditable()
+ {
+ param.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "return");
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+
+ public void testOutsideInWebService()
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ ws.setWsdlLocation("C:/test/wsdl/location");
+ sei.getImplementingWebServices().add(ws);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+
+ method.setSoapBindingStyle(SOAPBindingStyle.RPC);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__PART_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_PARAM__TARGET_NAMESPACE));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/PropertyStateAdapterFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/PropertyStateAdapterFactoryTest.java
new file mode 100755
index 0000000..1bcbfc3
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/PropertyStateAdapterFactoryTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.SeiPropertyStateAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.WsPropertyStateAdapter;
+
+/**
+ * Tests for {@link PropertyStateAdapterFactory} class
+ *
+ * @author Georgi Vachkov
+ */
+public class PropertyStateAdapterFactoryTest extends TestCase
+{
+ @Override
+ public void setUp()
+ {
+ }
+
+ public void testIsFactoryForType()
+ {
+ assertTrue(PropertyStateAdapterFactory.INSTANCE.isFactoryForType(IPropertyState.class));
+ assertFalse(PropertyStateAdapterFactory.INSTANCE.isFactoryForType(Notification.class));
+ }
+
+ public void testAdaptWebService()
+ {
+ IWebService webService = DomFactory.eINSTANCE.createIWebService();
+ Adapter adapter1 = PropertyStateAdapterFactory.INSTANCE.adapt(webService, IPropertyState.class);
+ assertEquals(1, webService.eAdapters().size());
+ assertTrue(adapter1 instanceof WsPropertyStateAdapter);
+
+ Adapter adapter2 = PropertyStateAdapterFactory.INSTANCE.adapt(webService, IPropertyState.class);
+ assertEquals(1, webService.eAdapters().size());
+
+ assertTrue(adapter1==adapter2);
+ }
+
+ public void testAdaptSei()
+ {
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ Adapter adapter1 = PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertEquals(1, sei.eAdapters().size());
+ assertTrue(adapter1 instanceof SeiPropertyStateAdapter);
+
+ Adapter adapter2 = PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertEquals(1, sei.eAdapters().size());
+
+ assertTrue(adapter1==adapter2);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/SeiPropertyStateAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/SeiPropertyStateAdapterTest.java
new file mode 100755
index 0000000..f795654
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/SeiPropertyStateAdapterTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+
+/**
+ * Test for {@ SeiPropertyStateAdapter} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiPropertyStateAdapterTest extends TestCase
+{
+ private IServiceEndpointInterface sei;
+ private IWebService ws;
+
+ public void setUp()
+ {
+ sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ ws = DomFactory.eINSTANCE.createIWebService();
+ sei.getImplementingWebServices().add(ws);
+ }
+
+ public void testIsAdapted()
+ {
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertNotNull(adapter);
+ }
+
+ public void testIsChangeableOutsideIn()
+ {
+ ws.setWsdlLocation("C:/test");
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE));
+ }
+
+ public void testIsChangealbeInOutImplicitInterface()
+ {
+ sei.eSet(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT, Boolean.TRUE);
+
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE));
+ }
+
+ public void testIsChangeableInOutExplicitInterface()
+ {
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(sei, IPropertyState.class);
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__IMPLICIT));
+ assertTrue(adapter.isChangeable(DomPackage.Literals.ISERVICE_ENDPOINT_INTERFACE__TARGET_NAMESPACE));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/WsPropertyStateAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/WsPropertyStateAdapterTest.java
new file mode 100755
index 0000000..f119689
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/state/WsPropertyStateAdapterTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.state;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.PropertyStateAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.state.WsPropertyStateAdapter;
+
+/**
+ * Tests for {@link WsPropertyStateAdapter} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class WsPropertyStateAdapterTest extends TestCase
+{
+ private IWebService ws;
+
+ public void setUp() {
+ ws = DomFactory.eINSTANCE.createIWebService();
+ }
+
+ public void testIsAdapted()
+ {
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(ws, IPropertyState.class);
+ assertNotNull(adapter);
+ }
+
+ public void testIsChangebleOutsideInWs()
+ {
+ ws.setWsdlLocation("C:/test");
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(ws, IPropertyState.class);
+
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__PORT_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__SERVICE_ENDPOINT));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__TARGET_NAMESPACE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__WSDL_LOCATION));
+ }
+
+ public void testIsChangableInOut()
+ {
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(ws, IPropertyState.class);
+
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__PORT_NAME));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__SERVICE_ENDPOINT));
+ assertTrue(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__TARGET_NAMESPACE));
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IWEB_SERVICE__WSDL_LOCATION));
+ }
+
+ public void testIsChangebleNonWsInstance()
+ {
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ IPropertyState adapter = (IPropertyState)PropertyStateAdapterFactory.INSTANCE.adapt(ws, IPropertyState.class);
+ ((Adapter)adapter).setTarget(sei);
+
+ assertFalse(adapter.isChangeable(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/AbstractModelSynchronizerTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/AbstractModelSynchronizerTest.java
new file mode 100755
index 0000000..ff8ffba
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/AbstractModelSynchronizerTest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync.AbstractModelSynchronizer;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+/**
+ * Tests for {@link AbstractModelSynchronizer} class, methods not covered in this test
+ * are covered implicitly by {@link ModelSynchronizationTests}.
+ *
+ * @author Georgi Vachkov
+ */
+public class AbstractModelSynchronizerTest extends MockObjectTestCase
+{
+ private AbstractModelSynchronizerTester modelSync;
+ private JaxWsWorkspaceResource resource;
+
+ @Override
+ public void setUp()
+ {
+ Mock<IJavaModel> javaModelMock = mock(IJavaModel.class);
+ resource = new JaxWsWorkspaceResource(javaModelMock.proxy());
+
+ modelSync = new AbstractModelSynchronizerTester(resource, resource.new ServiceModelData()){};
+ }
+
+ public void testProcessCompilationUnitEditEnabledDespiteNPE() throws JavaModelException
+ {
+ assertTrue(resource.isSaveEnabled());
+ try {
+ modelSync.processCompilationUnit(null, null);
+ } catch (NullPointerException _) {
+ }
+ assertTrue(resource.isSaveEnabled());
+ }
+
+ public void testProcessCompilationUnitEditEnabledNormalExecution() throws JavaModelException
+ {
+ assertTrue(resource.isSaveEnabled());
+ Mock<ICompilationUnit> cuMock = mock(ICompilationUnit.class);
+ cuMock.expects(once()).method("findPrimaryType").will(returnValue(null));
+ modelSync.processCompilationUnit(null, cuMock.proxy());
+ assertTrue(resource.isSaveEnabled());
+ }
+
+ public class AbstractModelSynchronizerTester extends AbstractModelSynchronizer
+ {
+ public AbstractModelSynchronizerTester(JaxWsWorkspaceResource resource, ServiceModelData serviceData) {
+ super(resource, serviceData);
+ }
+
+ protected void processCompilationUnit(final IWebServiceProject wsProject, final ICompilationUnit cu) throws JavaModelException
+ {
+ super.processCompilationUnit(wsProject, cu);
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ImplicitSeiMethodSynchronizationTests.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ImplicitSeiMethodSynchronizationTests.java
new file mode 100755
index 0000000..1e97335
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ImplicitSeiMethodSynchronizationTests.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.DomTestUtils;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+public class ImplicitSeiMethodSynchronizationTests extends TestCase
+{
+
+ private TestProject testPrj1;
+
+ private JaxWsWorkspaceResource target;
+
+ private IJavaModel javaModel;
+
+ private IType baseClassWithWsAnnot;
+
+ private IType baseClassWithoutWsAnnot;
+
+ private IType wsClass;
+
+ private IWebServiceProject wsPrj1;
+
+ private IWebService ws1;
+
+ private DomTestUtils util = new DomTestUtils();
+ private DomUtil domUtil = new DomUtil();
+
+ private static final String ws1ImplName = "com.sap.test.modelsync1.WS1";
+
+ public void setUp() throws Exception
+ {
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = new JaxWsWorkspaceResource(javaModel)
+ {
+
+ @Override
+ public IProjectSelector[] getProjectSelectors()
+ {
+ return new IProjectSelector[] { new IProjectSelector()
+ {
+
+ public boolean approve(IJavaProject prj)
+ {
+ return prj.getElementName().equals(testPrj1.getJavaProject().getElementName());
+ }
+ } };
+ }
+
+ };
+ testPrj1 = new TestProject("TestProject1");
+ testPrj1.createSourceFolder("src");
+ final IPackageFragment modelSync1 = testPrj1.createPackage("com.sap.test.modelsync1");
+
+ baseClassWithoutWsAnnot = testPrj1.createType(modelSync1, "BaseClassWithoutWsAnnot.java", "public class BaseClassWithoutWsAnnot {\n"
+ + "@javax.jws.WebMethod public void annotationInBaseNoWSClass(){}\n"
+ + "public void noAnnotationInBaseNoWSClass(){}\n" + "void nonPublicInBaseNoWSClass() {}\n"
+ + "@javax.jws.WebMethod public void toOverride() {}\n"
+ + "@javax.jws.WebMethod(exclude=true) public void excludedPublicInBaseNoWSClass() {}\n" + "}");
+
+ baseClassWithWsAnnot = testPrj1
+ .createType(
+ modelSync1,
+ "BaseClassWithWsAnnot.java",
+ "@javax.jws.WebService public class BaseClassWithWsAnnot extends BaseClassWithoutWsAnnot {\n"
+ + "public void noWMAnnoationInBaseWSClass() {}\n"
+ + "void nonPublicInBaseWSClass() {}\n"
+ + "@javax.jws.WebMethod(operationName=\"nameInBaseClassWithAnnot\") public void toOverride() {}\n"
+ + "@javax.jws.WebMethod(exclude=true) public void excludedPublicInBaseWSClass() {}\n"
+ + "}");
+
+ wsClass = testPrj1
+ .createType(
+ modelSync1,
+ "WS1.java",
+ "@javax.jws.WebService(name=\"ImplicitSei1Name\") public class WS1 extends BaseClassWithWsAnnot {\n"
+ + "public void noWMAnnotationInWSClass();\n"
+ + "void nonPublicInWSClass() {}\n"
+ + "@javax.jws.WebMethod(operationName=\"nameInWsClass\") public void toOverride() {}\n"
+ + "@javax.jws.WebMethod(exclude=true) public void excludedPublicInWSClass() {}\n"
+ + "@javax.jws.WebMethod(operationName=\"webName\", exclude=true) public void voidMethodWithNoArgsWithAnnotation(){}\n"
+ + "}");
+
+ JobUtils.waitForJobs();
+
+ target.load(null);
+ assertEquals("One projects were defined but a different number were found in the DOM", 1, target.getDOM().getWebServiceProjects().size());
+ assertEquals(2, target.getDOM().getWebServiceProjects().get(0).getWebServices().size());
+ wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ assertNotNull(wsPrj1);
+ ws1 = domUtil.findWsByImplName(wsPrj1, ws1ImplName);
+ assertNotNull(ws1);
+ }
+
+ public void test_methodNoAnnotationSynched() throws JavaModelException
+ {
+ final IMethod methodElem = util.getExistingMethod(wsClass, "noWMAnnotationInWSClass");
+ final IWebMethod wm = findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals(methodElem.getElementName(), wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(calcImplementation(methodElem), wm.getImplementation());
+ assertFalse(wm.isExcluded());
+ }
+
+ public void test_methodNoAnnotationInParentWithWSAnnotationSynched() throws JavaModelException
+ {
+ final IMethod methodElem = util.getExistingMethod(baseClassWithWsAnnot, "noWMAnnoationInBaseWSClass");
+ final IWebMethod wm = findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals(methodElem.getElementName(), wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(calcImplementation(methodElem), wm.getImplementation());
+ assertFalse(wm.isExcluded());
+ }
+
+ public void test_methodNoAnnotationInParentWithoutWsAnnotationNotSynched() throws JavaModelException
+ {
+ final IMethod methodElem = util.getExistingMethod(baseClassWithoutWsAnnot, "noAnnotationInBaseNoWSClass");
+ final IWebMethod wm = findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElem));
+ assertNull(wm);
+ }
+
+ public void test_methodWithAnnotationInParentWithoutWsAnnotationSynched() throws JavaModelException
+ {
+ final IMethod methodElemBaseNoWsClass = util.getExistingMethod(baseClassWithoutWsAnnot, "annotationInBaseNoWSClass");
+ assertNotNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseNoWsClass)));
+
+ }
+
+ public void test_nonPublicMethodTroughHierarchyNotSynched() throws JavaModelException
+ {
+ final IMethod methodElemBaseNoWsClass = util.getExistingMethod(baseClassWithoutWsAnnot, "nonPublicInBaseNoWSClass");
+ assertFalse(Modifier.isPublic(methodElemBaseNoWsClass.getFlags()));
+ final IMethod methodElemBaseWsClass = util.getExistingMethod(baseClassWithWsAnnot, "nonPublicInBaseWSClass");
+ assertFalse(Modifier.isPublic(methodElemBaseWsClass.getFlags()));
+ final IMethod methodElemWsClass = util.getExistingMethod(wsClass, "nonPublicInWSClass");
+ assertFalse(Modifier.isPublic(methodElemWsClass.getFlags()));
+
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseNoWsClass)));
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseWsClass)));
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemWsClass)));
+ }
+
+ public void test_excludedMethodTroughHierarchyNotSynched() throws JavaModelException
+ {
+ final IMethod methodElemBaseNoWsClass = util.getExistingMethod(baseClassWithoutWsAnnot, "excludedPublicInBaseNoWSClass");
+ assertTrue(Modifier.isPublic(methodElemBaseNoWsClass.getFlags()));
+ final IMethod methodElemBaseWsClass = util.getExistingMethod(baseClassWithWsAnnot, "excludedPublicInBaseWSClass");
+ assertTrue(Modifier.isPublic(methodElemBaseWsClass.getFlags()));
+ final IMethod methodElemWsClass = util.getExistingMethod(wsClass, "excludedPublicInWSClass");
+ assertTrue(Modifier.isPublic(methodElemWsClass.getFlags()));
+
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseNoWsClass)));
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseWsClass)));
+ assertNull(findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemWsClass)));
+ }
+
+ public void test_overrideMethodsLoadedProperly() throws JavaModelException
+ {
+ final IMethod methodElemBaseNoWsClass = util.getExistingMethod(baseClassWithoutWsAnnot, "toOverride");
+ final IWebMethod wm = findWebMethodByImpl(ws1.getServiceEndpoint(), calcImplementation(methodElemBaseNoWsClass));
+ assertNotNull(wm);
+ assertEquals("nameInWsClass", wm.getName());
+ }
+
+ private IWebMethod findWebMethodByImpl(IServiceEndpointInterface sei, String impl)
+ {
+ for (IWebMethod wm : sei.getWebMethods())
+ {
+ if (wm.getImplementation().equals(impl))
+ {
+ return wm;
+ }
+ }
+ return null;
+ }
+
+ private String calcImplementation(IMethod m) throws JavaModelException
+ {
+ return m.getElementName() + m.getSignature();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/MethodParamsSynchronizationTests.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/MethodParamsSynchronizationTests.java
new file mode 100755
index 0000000..8c3b317
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/MethodParamsSynchronizationTests.java
@@ -0,0 +1,373 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IModelElementSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.IProjectSelector;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync.ParameterSynchronizer;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.DomTestUtils;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.Assertions;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+
+@SuppressWarnings("nls")
+public class MethodParamsSynchronizationTests extends TestCase
+{
+ private TestEjb3Project testEjbPrj1;
+ private IJavaProject testPrj1;
+ private JaxWsWorkspaceResource target;
+ private IJavaModel javaModel;
+ private IType sei1Type;
+
+ private IWebServiceProject wsPrj1;
+ private IServiceEndpointInterface sei1;
+
+ private DomUtil domUtil = new DomUtil();
+ private DomTestUtils testUtil = new DomTestUtils();
+
+ private static final String sei1ImplName = "com.sap.test.modelsync1.Sei1";
+
+ public void setUp() throws Exception
+ {
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = new JaxWsWorkspaceResource(javaModel)
+ {
+ @Override
+ public IProjectSelector[] getProjectSelectors()
+ {
+ return new IProjectSelector[] { new IProjectSelector()
+ {
+ public boolean approve(IJavaProject prj) {
+ return prj.getElementName().equals(testPrj1.getElementName());
+ }
+ }};
+ }
+
+ };
+ testEjbPrj1 = new TestEjb3Project("TestProject1");
+ testPrj1 = JavaCore.create(testEjbPrj1.getProject());
+ final IPackageFragment modelSync1 = testPrj1.findPackageFragmentRoot(testEjbPrj1.getProject().getFullPath().append("ejbModule")).createPackageFragment("com.sap.test.modelsync1", false, null);
+ JobUtils.waitForJobs();
+ assertTrue(modelSync1.exists());
+
+ final String contents = "import javax.jws.soap.SOAPBinding;\nimport javax.xml.ws.Holder;\n@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 {}";
+ sei1Type = createType(modelSync1, "Sei1.java", contents);
+ createType(modelSync1, "Class1.java", "public class Class1 {}");
+ JobUtils.waitForJobs();
+
+ target.load(null);
+ assertEquals("One projects were defined but a different number were found in the DOM", 1, target.getDOM().getWebServiceProjects().size());
+ assertEquals(1, target.getDOM().getWebServiceProjects().get(0).getServiceEndpointInterfaces().size());
+ wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ assertNotNull(wsPrj1);
+ sei1 = domUtil.findSeiByImplName(wsPrj1, sei1ImplName);
+ assertNotNull(sei1);
+ }
+
+ private IType createType(IPackageFragment pack, String compUnit, String contents) throws JavaModelException
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("package " + pack.getElementName() + ";\n");
+ buf.append("\n");
+ buf.append(contents);
+ ICompilationUnit cu = pack.createCompilationUnit(compUnit, buf.toString(), false, null);
+ return cu.getTypes()[0];
+ }
+
+ @Override
+ public void tearDown() throws CoreException
+ {
+ target.stopSynchronizing();
+ }
+
+ public void test_voidMethodWithNoArgsSynched() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod voidNoArgs = sei1Type.createMethod("public void voidMethodWithNoArgsNoAnnotation();\n", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(voidNoArgs));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(voidNoArgs));
+ assertEquals(0, wsMethod.getParameters().size());
+ }
+
+ public void test_nonVoidMethodWithNoArgs() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod nonVoidNoArgs = sei1Type.createMethod("public Class1 nonVoidMethodWithNoArgs();\n", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(nonVoidNoArgs));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(nonVoidNoArgs));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals("return", wsMethod.getParameters().get(0).getName());
+ assertEquals(WebParamKind.OUT, wsMethod.getParameters().get(0).getKind());
+ assertEquals("QClass1;", wsMethod.getParameters().get(0).getTypeName());
+ }
+
+ public void test_voidMethodWithPrimitiveArg() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodWithPrimitiveArg(int param1);\n", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals("arg0", wsMethod.getParameters().get(0).getName());
+ assertEquals(WebParamKind.IN, wsMethod.getParameters().get(0).getKind());
+ assertEquals("I", wsMethod.getParameters().get(0).getTypeName());
+ }
+
+ public void test_voidMethodWithNonParameterizedHolderParam() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodWithParameterizedHolderParam(Holder param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals("arg0", wsMethod.getParameters().get(0).getName());
+ //FIXME commenting out for build integration. Throwing an assertion error: expected INOUT but was IN
+ //assertEquals(WebParamKind.INOUT, wsMethod.getParameters().get(0).getKind());
+ assertEquals("QHolder;", wsMethod.getParameters().get(0).getTypeName());
+ }
+
+ public void test_voidMethodWithParameterizedHolderParam() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodWithParameterizedHolderParam(javax.xml.ws.Holder<Class1> param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals("arg0", wsMethod.getParameters().get(0).getName());
+ //FIXME commenting out for build integration. Throwing an assertion error: expected INOUT but was IN
+ //assertEquals(WebParamKind.INOUT, wsMethod.getParameters().get(0).getKind());
+ assertEquals("Qjavax.xml.ws.Holder<QClass1;>;", wsMethod.getParameters().get(0).getTypeName());
+ }
+
+ public void test_paramNameDefaultSunchronized() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void method1(int param);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals("arg0", testUtil.findParam(wsMethod, "param").getName());
+ }
+
+ public void test_paramNameSunchronized() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public int method2(@javax.jws.WebParam(name=\"param\", header=true) int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals("param", testUtil.findParam(wsMethod, "param1").getName());
+ assertEquals("return", testUtil.findParam(wsMethod, "return").getName());
+
+ // operation is Document/Bare - the parameters use method name
+ final IMethod method2 = sei1Type.createMethod("@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, parameterStyle=SOAPBinding.ParameterStyle.BARE)\n" +
+ "public int method3(int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method2));
+
+ final IWebMethod wsMethod2 = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method2));
+ assertEquals("method3Response", testUtil.findParam(wsMethod2, "return").getName());
+ assertEquals("method3", testUtil.findParam(wsMethod2, "param1").getName());
+ }
+
+ public void test_paramHeaderDefaultSyncromized() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method1 = sei1Type.createMethod("public void method2(@javax.jws.WebParam(name=\"param1\") int param1);", null, false, null);
+ JobUtils.waitForJobs();
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method1));
+
+ final IWebMethod wsMethod1 = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method1));
+ assertEquals(1, wsMethod1.getParameters().size());
+ assertEquals("param1", wsMethod1.getParameters().get(0).getName());
+ assertFalse(wsMethod1.getParameters().get(0).isHeader());
+ }
+
+ public void test_paramHeaderFalseSyncromized() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method2 = sei1Type.createMethod("public void method2(@javax.jws.WebParam(name=\"param1\", header=false) int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method2));
+
+ final IWebMethod wsMethod2 = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method2));
+ assertEquals(1, wsMethod2.getParameters().size());
+ assertEquals("param1", wsMethod2.getParameters().get(0).getName());
+ assertFalse(wsMethod2.getParameters().get(0).isHeader());
+ }
+
+ public void test_paramHeaderTrueSyncromized() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method2 = sei1Type.createMethod("public void method2(@javax.jws.WebParam(name=\"param1\", header=true) int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method2));
+
+ final IWebMethod wsMethod2 = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method2));
+ assertEquals(1, wsMethod2.getParameters().size());
+ assertEquals("param1", wsMethod2.getParameters().get(0).getName());
+ assertTrue(wsMethod2.getParameters().get(0).isHeader());
+ }
+
+ public void test_paramPartNameDefault() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodExcluded(@javax.jws.WebParam(name=\"paramA\") int a);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals(WebParamKind.IN, wsMethod.getParameters().get(0).getKind());
+ assertEquals("I", wsMethod.getParameters().get(0).getTypeName());
+
+ assertEquals("paramA", wsMethod.getParameters().get(0).getName());
+ assertEquals("paramA", wsMethod.getParameters().get(0).getPartName());
+ }
+
+ public void test_paramPartName() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodExcluded(@javax.jws.WebParam(name=\"paramA\", partName=\"partNameA\") int a);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals(WebParamKind.IN, wsMethod.getParameters().get(0).getKind());
+ assertEquals("I", wsMethod.getParameters().get(0).getTypeName());
+
+ assertEquals("paramA", wsMethod.getParameters().get(0).getName());
+ assertEquals("partNameA", wsMethod.getParameters().get(0).getPartName());
+ }
+
+ public void test_paramTargetNamespaceDefault() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodExcluded(@javax.jws.WebParam(name=\"paramA\") int a);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals(WebParamKind.IN, wsMethod.getParameters().get(0).getKind());
+ assertEquals("I", wsMethod.getParameters().get(0).getTypeName());
+
+ assertEquals("paramA", wsMethod.getParameters().get(0).getName());
+ assertEquals("", wsMethod.getParameters().get(0).getTargetNamespace());
+ }
+
+ public void test_paramTargetNamespaceEmptyNs() throws Exception
+ {
+ target.startSynchronizing();
+ // parameter is not in the header
+ final IMethod method = sei1Type.createMethod("@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED) " +
+ "public void method3(@javax.jws.WebParam(name=\"param\", header=false) int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals("", wsMethod.getParameters().get(0).getTargetNamespace());
+
+ // parameter is in header
+ final IMethod method2 = sei1Type.createMethod("@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)\n" +
+ "public void method4(@javax.jws.WebParam(name=\"param\", header=true) int param1);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method2));
+
+ final IWebMethod wsMethod2 = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method2));
+ assertEquals("http://sap.com/test/modelsync1/", wsMethod2.getParameters().get(0).getTargetNamespace());
+ }
+
+ public void test_paramTargetNamespace() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod method = sei1Type.createMethod("public void voidMethodExcluded(@javax.jws.WebParam(name=\"paramA\", targetNamespace=\"http://targetNs/\") int a);", null, false, null);
+ waitMethodLoadedInDom(sei1, domUtil.calcImplementation(method));
+
+ final IWebMethod wsMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(method));
+ assertEquals(1, wsMethod.getParameters().size());
+ assertEquals(WebParamKind.IN, wsMethod.getParameters().get(0).getKind());
+ assertEquals("I", wsMethod.getParameters().get(0).getTypeName());
+
+ assertEquals("paramA", wsMethod.getParameters().get(0).getName());
+ assertEquals("http://targetNs/", wsMethod.getParameters().get(0).getTargetNamespace());
+ }
+
+ private void waitMethodLoadedInDom(final IServiceEndpointInterface sei, final String implementation)
+ {
+ final IWaitCondition condition = new IWaitCondition(){
+ public boolean checkCondition()
+ {
+ return domUtil.findWebMethodByImpl(sei, implementation) != null;
+ }};
+ Assertions.waitAssert(condition, "Method " + implementation + " not found");
+ }
+
+ public void test_paramTypeResolvedForNonQualifiedHolderType() throws Exception
+ {
+ final ParameterSynchronizerForParamTypesTests syncronizer = new ParameterSynchronizerForParamTypesTests(null);
+ syncronizer.calcKind(null, null, "QHolder;");
+ assertTrue("resolveFullyQualifiedName should be called for non qualified Holder type", syncronizer.called);
+ }
+
+ public void test_paramTypeResolvedForQualifiedHolderType() throws Exception
+ {
+ final ParameterSynchronizerForParamTypesTests syncronizer = new ParameterSynchronizerForParamTypesTests(null);
+ syncronizer.calcKind(null, null, "Qjavax.xml.ws.Holder<QClass1;>;");
+ assertTrue("resolveFullyQualifiedName should be called for qualified Holder type", syncronizer.called);
+ }
+
+ public void test_paramTypeNotResolvedForNonHolderType() throws Exception
+ {
+ final ParameterSynchronizerForParamTypesTests syncronizer = new ParameterSynchronizerForParamTypesTests(null);
+ syncronizer.calcKind(null, null, "QString;");
+ assertFalse("resolveFullyQualifiedName should not be called for non Holder type", syncronizer.called);
+ }
+
+ private class ParameterSynchronizerForParamTypesTests extends ParameterSynchronizer
+ {
+ public ParameterSynchronizerForParamTypesTests(IModelElementSynchronizer parent) {
+ super(parent);
+ }
+
+ public boolean called = false;
+
+ @Override
+ protected WebParamKind calcKind(final IAnnotation<ITypeParameter> parmAnnotation, final IMethod method, final String typeSignature) throws JavaModelException, IllegalArgumentException {
+ return super.calcKind(parmAnnotation, method, typeSignature);
+ }
+
+ @Override
+ protected String resolveFullyQualifiedName(final IMethod method, final String typeSignature) {
+ called = true;
+ return "";
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ModelSynchronizationTests.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ModelSynchronizationTests.java
new file mode 100755
index 0000000..7e515da
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/ModelSynchronizationTests.java
@@ -0,0 +1,590 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+public class ModelSynchronizationTests extends SynchronizationTestFixture
+{
+ private void assertBeforeAfterAreTheSame()
+ { final IWebServiceProject newRefWsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ assertEquals(wsPrj1, newRefWsPrj1);
+ assertEquals(ws1, domUtil.findWsByImplName(newRefWsPrj1, ws1ImplName));
+ assertEquals(sei1, domUtil.findSeiByImplName(newRefWsPrj1, sei1ImplName));
+
+ final IWebServiceProject newRefWsPrj2 = domUtil.findProjectByName(target.getDOM(), testPrj2.getJavaProject().getElementName());
+ assertEquals(wsPrj2, newRefWsPrj2);
+ assertEquals(ws2, domUtil.findWsByImplName(newRefWsPrj2, ws2ImplName));
+ assertEquals(sei2, domUtil.findSeiByImplName(newRefWsPrj2, sei2ImplName));
+ }
+
+ public void test_openedWsProjectSynched() throws Exception
+ {
+ final TestProject testPrj3 = new TestProject(new TestEjb3Project("TestEJBProject3").getProject());
+ try {
+ allowedProjects.add(testPrj3.getJavaProject().getElementName());
+ final IPackageFragment modelSync3 = testPrj3.createPackage("com.sap.test.modelsync3");
+ testPrj3.createType(modelSync3, "Sei3.java", "@javax.jws.WebService(name=\"Sei3Name\") public interface Sei3 {}");
+ testPrj3.createType(modelSync3, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", endpointInterface=\"com.sap.test.modelsync1.Sei3Name\") public class WS3 {}");
+ testPrj3.getProject().close(null);
+ JobUtils.waitForJobs();
+
+ target.startSynchronizing();
+ testPrj3.getProject().open(null);
+ JobUtils.waitForJobs();
+
+ assertBeforeAfterAreTheSame();
+ final IWebServiceProject wsPrj3 = domUtil.findProjectByName(target.getDOM(), testPrj3.getJavaProject().getElementName());
+ assertNotNull("Web Service Project not synchronized after opened",wsPrj3);
+ final IWebService ws3 = domUtil.findWsByImplName(wsPrj3, "com.sap.test.modelsync3.WS3");
+ assertNotNull("Web Service not synchronized after containing project was oppened", ws3);
+ final IServiceEndpointInterface sei3 = domUtil.findSeiByImplName(wsPrj3, "com.sap.test.modelsync3.Sei3");
+ assertNotNull("Service Endpoint interface not synchronized after containing project was oppened", sei3);
+ } finally
+ {
+ testPrj3.dispose();
+ }
+ }
+
+ public void test_openedProjectWithEnumsInitialySynched() throws CoreException, Exception
+ {
+ final TestProject testPrj3 = new TestProject(new TestEjb3Project("TestEJBProject3").getProject());
+ try {
+ allowedProjects.add(testPrj3.getJavaProject().getElementName());
+ final IPackageFragment modelSync3 = testPrj3.createPackage("com.sap.test.modelsync3");
+ testPrj3.createType(modelSync3, "TestEnum.java", "public enum TestEnum {A, B, C}");
+ target = createTarget();
+ JobUtils.waitForJobs();
+
+ target.load(null);
+ final IWebServiceProject wsPrj3 = domUtil.findProjectByName(target.getDOM(), testPrj3.getJavaProject().getElementName());
+ assertNotNull("Web Service Project not synchronized after created",wsPrj3);
+ } finally
+ {
+ testPrj3.dispose();
+ }
+ }
+
+ public void test_newSeiCompilationUnitsSynched() throws JavaModelException, CoreException, InterruptedException
+ {
+ verifySetUpModelEntitesNotChanged();
+ final IPackageFragment pf = testPrj1.createPackage("com.sap.test.newsei");
+ JobUtils.waitForJobs();
+
+ target.startSynchronizing();
+ testPrj1.createType(pf, "Sei3.java", "@javax.jws.WebService(name=\"Sei3Name\", targetNamespace=\"http://com.sap.test/\") public interface Sei3 {}");
+ JobUtils.waitForJobs();
+
+ assertBeforeAfterAreTheSame();
+ final IWebServiceProject wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ final IServiceEndpointInterface sei3 = domUtil.findSeiByImplName(wsPrj1, "com.sap.test.newsei.Sei3");
+ assertNotNull("Newly added SEI not synched into the model",sei3);
+ assertEquals("Java Intf for newly added SEI does not match the expected", "com.sap.test.newsei.Sei3", sei3.getImplementation());
+ assertEquals("Target NS for newly added SEI does not match the expected", "http://com.sap.test/", sei3.getTargetNamespace());
+ assertEquals("The name of the newly added sei doesn't match", "Sei3Name", sei3.getName());
+ }
+
+ public void test_unreSolvedSeiRefGetsResolvedAfterSeiAdded() throws JavaModelException, CoreException, InterruptedException
+ {
+ verifySetUpModelEntitesNotChanged();
+ final IPackageFragment pf = testPrj1.createPackage("com.sap.test.newws");
+ JobUtils.waitForJobs();
+ //Make the WS be created with a reference to "com.sap.test.newsei.Sei3" which doesn't exist yet.
+ target.startSynchronizing();
+ testPrj1.createType(pf, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", endpointInterface=\"com.sap.test.newsei.Sei3\") public class WS3 {}");
+ JobUtils.waitForJobs();
+
+ assertBeforeAfterAreTheSame();
+
+ final IWebServiceProject wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ final IWebService ws3 = domUtil.findWsByImplName(wsPrj1, "com.sap.test.newws.WS3");
+ assertNotNull("Web Service not synchronized after new compilation unit with ws was added", ws3);
+ //add a new sei and test that it has been synched.
+ test_newSeiCompilationUnitsSynched();
+ //now check taht the Sei ref in ws3 has been properly resolved
+ final IServiceEndpointInterface newlyAddedSei = domUtil.findSeiByImplName(wsPrj1, "com.sap.test.newsei.Sei3");
+ assertNotNull("Newly added sei not found in the model. Probably the test_newSeiCompilationUnitsSynched() test method has changed the name of the interface it works with", newlyAddedSei);
+ assertSame("Web Service Reference not resolved properly", newlyAddedSei, ws3.getServiceEndpoint());
+ }
+
+ public void test_newSourceFolderWithJavaContentSynchedWhenAdded() throws JavaModelException, CoreException, InterruptedException
+ {
+ // verifySetUpModelEntitesNotChanged();
+ //create new folder, which will later on be made a soure folder
+ IFolder folder = testPrj1.getProject().getFolder("src1");
+ folder.create(true, true, null);
+ //make the folder a source folder now in order to create the type in there.
+ final IClasspathEntry[] oldEntries = testPrj1.getJavaProject().getRawClasspath();
+ final IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ //create a new package fragment folder. Note htat it cannot be used to create type, as the folder is not source folder yet
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ final IPackageFragmentRoot newSourceFolder = testPrj1.getJavaProject().getPackageFragmentRoot(folder);
+ newEntries[oldEntries.length] = JavaCore.newSourceEntry(newSourceFolder.getPath());
+ testPrj1.getJavaProject().setRawClasspath(newEntries, null);
+ final IPackageFragment pf = newSourceFolder.createPackageFragment("com.sap.test.newws", true, null);
+ //now create the types
+ testPrj1.createType(pf, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", endpointInterface=\"com.sap.test.newsei.Sei3\") public class WS3 {}");
+ testPrj1.createType(pf, "Sei3.java", "@javax.jws.WebService(name=\"Sei3Name\") public interface Sei3 {}");
+ //after the type is created make the source folder an ordinary source again.
+ testPrj1.getJavaProject().setRawClasspath(oldEntries, null);
+ JobUtils.waitForJobs();
+ //then start synchronizing
+ target.startSynchronizing();
+ //finally the resource is sychnronizing and in the same time we have a folder with source content. So just make it a source folder again.
+ testPrj1.getJavaProject().setRawClasspath(newEntries, null);
+ JobUtils.waitForJobs();
+
+ final IWebServiceProject wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ final IWebService ws3 = domUtil.findWsByImplName(wsPrj1, "com.sap.test.newws.WS3");
+ assertNotNull("Web Service not synchronized after a source folder in which it was contained was added", ws3);
+ final IServiceEndpointInterface sei3 = domUtil.findSeiByImplName(wsPrj1, "com.sap.test.newws.Sei3");
+ assertNotNull("Sei not synched after a source folder in which it was contained was added", sei3);
+
+ }
+
+ public void test_removedSourceFolderSyched() throws CoreException, InterruptedException
+ {
+ test_newSourceFolderWithJavaContentSynchedWhenAdded();
+ final IClasspathEntry[] oldEntries = testPrj1.getJavaProject().getRawClasspath();
+ final IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length - 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, newEntries.length);
+ testPrj1.getJavaProject().setRawClasspath(newEntries, null);
+ JobUtils.waitForJobs();
+
+ assertNull(domUtil.findWsByImplName(wsPrj1, "com.sap.test.newws.WS3"));
+ assertNull(domUtil.findSeiByImplName(wsPrj1, "com.sap.test.newws.Sei3"));
+ }
+
+ public void test_removedOrClosedProjectSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync1 = testPrj1.createPackage("com.sap.test.modelsync1_1");
+ testPrj1.createType(modelSync1, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", endpointInterface=\"com.sap.test.modelsync2_1.Sei3\") public class WS3 {}");
+
+ final IPackageFragment modelSync2 = testPrj2.createPackage("com.sap.test.modelsync2_1");
+ testPrj2.createType(modelSync2, "Sei3.java", "@javax.jws.WebService(name=\"Sei3Name\") public interface Sei3 {}");
+ JobUtils.waitForJobs();
+
+
+ final IWebService ws3 = domUtil.findWsByImplName(wsPrj1, "com.sap.test.modelsync1_1.WS3");
+ assertNotNull(ws3);
+
+ final IServiceEndpointInterface sei3 = domUtil.findSeiByImplName(wsPrj2, "com.sap.test.modelsync2_1.Sei3");
+ assertNotNull(sei3);
+ assertEquals(sei3, ws3.getServiceEndpoint());
+ final String testPrj2Name = testPrj2.getJavaProject().getElementName();
+ testPrj2.getProject().close(null);
+ JobUtils.waitForJobs();
+ assertNull(domUtil.findProjectByName(target.getDOM(), testPrj2Name));
+ assertNull("The web service returns a sei instance which is contained in a closed project", ws3.getServiceEndpoint());
+ }
+
+ public void test_deletedCUWithSeiSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit sei1CU = testPrj1.getJavaProject().findType(sei1ImplName).getCompilationUnit();
+ sei1CU.delete(true, null);
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getServiceEndpointInterfaces().contains(sei1));
+ assertNull(ws1.getServiceEndpoint());
+ }
+
+ public void test_deletedCUWithWSSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1ImplName).getCompilationUnit();
+ ws1CU.delete(true, null);
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getWebServices().contains(ws1));
+ assertFalse(sei1.getImplementingWebServices().contains(ws1));
+ }
+
+ public void test_deletedCuContentWithSeiSynched() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit sei1Cu = testPrj1.getJavaProject().findType(sei1ImplName).getCompilationUnit();
+ testUtil.setContents(sei1Cu, "");
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getWebServices().contains(sei1));
+ assertNull(ws1.getServiceEndpoint());
+ }
+
+ public void test_deletedCuContentWithWsSynched() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1ImplName).getCompilationUnit();
+ testUtil.setContents(ws1CU, "");
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getWebServices().contains(ws1));
+ assertFalse(sei1.getImplementingWebServices().contains(ws1));
+ }
+
+ public void test_movedCUWithWSInOtherProjectWithSameJavaNameSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1ImplName).getCompilationUnit();
+ final IPackageFragment moveIn = testPrj2.getSourceFolder().createPackageFragment(ws1CU.getParent().getElementName(), true, null);
+ ws1CU.move(moveIn, null, null, false, null);
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getWebServices().contains(ws1));
+ assertTrue(wsPrj2.getWebServices().contains(ws1));
+ assertTrue(sei1.getImplementingWebServices().contains(ws1));
+ }
+
+ public void test_movedCUWithSeiInOtherProjectWithSameJavaNameSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit se1CU = testPrj1.getJavaProject().findType(sei1ImplName).getCompilationUnit();
+ final IPackageFragment moveIn = testPrj2.getSourceFolder().createPackageFragment(se1CU.getParent().getElementName(), true, null);
+ se1CU.move(moveIn, null, null, false, null);
+ JobUtils.waitForJobs();
+
+ assertFalse(wsPrj1.getServiceEndpointInterfaces().contains(sei1));
+ assertTrue(wsPrj2.getServiceEndpointInterfaces().contains(sei1));
+ assertSame(ws1.getServiceEndpoint(), sei1);
+ }
+
+ public void test_renamedCUWithSeiSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit se1CU = testPrj1.getJavaProject().findType(sei1ImplName).getCompilationUnit();
+ se1CU.findPrimaryType().rename("Sei1NewName", false, null);
+ JobUtils.waitForJobs();
+ final ICompilationUnit se1CURenamed = testPrj1.getJavaProject().findType("com.sap.test.modelsync1.Sei1NewName").getCompilationUnit();
+
+ assertEquals("Sei1NewName.java", se1CURenamed.getElementName());
+ IServiceEndpointInterface renamedSei1 = domUtil.findSeiByImplName(wsPrj1, se1CURenamed.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(renamedSei1);
+ assertNull(ws1.getServiceEndpoint());
+ }
+
+ public void test_renamedCUWithWSSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1ImplName).getCompilationUnit();
+ ws1CU.findPrimaryType().rename("WS1NewName", false, null);
+ JobUtils.waitForJobs();
+ final ICompilationUnit ws1CURenamed = testPrj1.getJavaProject().findType("com.sap.test.modelsync1.WS1NewName").getCompilationUnit();
+
+ assertEquals("WS1NewName.java", ws1CURenamed.getElementName());
+ IWebService renamedWS1 = domUtil.findWsByImplName(wsPrj1, ws1CURenamed.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(renamedWS1);
+ assertFalse(sei1.getImplementingWebServices().contains(ws1));
+ assertTrue(sei1.getImplementingWebServices().contains(renamedWS1));
+ assertSame(sei1, renamedWS1.getServiceEndpoint());
+ }
+
+ public void test_removedWSAnnotationFromSeiSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit se1CU = testPrj1.getJavaProject().findType(sei1ImplName).getCompilationUnit();
+ testUtil.setContents(se1CU, "public interface Sei1 {}");
+ JobUtils.waitForJobs();
+ assertNull(domUtil.findSeiByImplName(wsPrj1, sei1ImplName));
+ assertNull(ws1.getServiceEndpoint());
+ }
+
+ public void test_removedWSAnnotationFromWSSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit se1CU = testPrj1.getJavaProject().findType(ws1ImplName).getCompilationUnit();
+ testUtil.setContents(se1CU, "public class WS1 {}");
+ JobUtils.waitForJobs();
+ assertNull(domUtil.findSeiByImplName(wsPrj1, ws1ImplName));
+ assertTrue(sei1.getImplementingWebServices().size() == 0);
+ }
+
+ public void test_addedWSAnnotaionToClassSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync4 = testPrj1.createPackage("com.sap.test.modelsync4");
+ final ICompilationUnit ws4CU = testPrj1.createType(modelSync4, "WS4.java", "public class WS4 {}").getCompilationUnit();
+ testUtil.setContents(ws4CU, "@javax.jws.WebService(serviceName=\"WS4Name\", endpointInterface=\"com.sap.test.modelsync1.Sei1\", portName=\"TestPortName\", targetNamespace=\"http://com.sap/test\", wsdlLocation=\"C:/test/wsdl/location\") public class WS4 {}");
+ JobUtils.waitForJobs();
+
+ final IWebService addedWS4 = domUtil.findWsByImplName(wsPrj1, ws4CU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(addedWS4);
+ assertTrue(addedWS4.getServiceEndpoint() == sei1);
+ assertEquals("portName not same", "TestPortName", addedWS4.getPortName());
+ assertEquals("targetNamespace not same", "http://com.sap/test", addedWS4.getTargetNamespace());
+ assertEquals("wsdlLocation not same", "C:/test/wsdl/location", addedWS4.getWsdlLocation());
+ }
+
+ public void test_addedWSAnnotationToSeiSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync4 = testPrj1.createPackage("com.sap.test.modelsync4");
+
+ final IType ws4Type = testPrj1.createType(modelSync4, "WS4.java", "@javax.jws.WebService(serviceName=\"WS4Name\", endpointInterface=\"com.sap.test.modelsync4.Sei4\") public class WS4 {}");
+ JobUtils.waitForJobs();
+
+ final IWebService ws4 = domUtil.findWsByImplName(wsPrj1, ws4Type.getFullyQualifiedName());
+ assertNotNull(ws4);
+ assertNull(ws4.getServiceEndpoint());
+
+ final ICompilationUnit sei4CU = testPrj1.createType(modelSync4, "Sei4.java", "public interface Sei4 {}").getCompilationUnit();
+ testUtil.setContents(sei4CU, "@javax.jws.WebService(name=\"Sei4Name\") public interface Sei4 {}");
+ JobUtils.waitForJobs();
+
+ final IServiceEndpointInterface addedWS4 = domUtil.findSeiByImplName(wsPrj1, sei4CU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(addedWS4);
+ assertSame(ws4.getServiceEndpoint(), addedWS4);
+ }
+
+ public void test_changedSeiRefSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(ws1CU, "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync2.Sei2\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertSame(sei2, ws1.getServiceEndpoint());
+ assertSame(ws1, domUtil.findWsByImplName(wsPrj1, ws1.getImplementation()));
+ }
+
+ public void test_changedSeiRefWithUnxesistingSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(ws1CU, "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync2.SeiUnexisting\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertNull(ws1.getServiceEndpoint());
+ assertSame(ws1, domUtil.findWsByImplName(wsPrj1, ws1.getImplementation()));
+ }
+
+ public void test_changedFromExplicitToImplicit() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(ws1CU, "@javax.jws.WebService(serviceName=\"WS1Name\", name=\"ImplicitInterfaceName\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertNotSame(sei2, ws1.getServiceEndpoint());
+ assertTrue(ws1.getServiceEndpoint().isImplicit());
+ assertEquals("ImplicitInterfaceName", ws1.getServiceEndpoint().getName());
+ }
+
+ public void test_deletedPackageSynched() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync3 = testPrj1.createPackage("com.sap.test.modelsync3");
+ testPrj1.createType(modelSync3, "WS4.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS4 {}");
+ JobUtils.waitForJobs();
+
+ final IWebService ws4 = domUtil.findWsByImplName(wsPrj1, "com.sap.test.modelsync3.WS4");
+ assertNotNull(ws4);
+ assertSame(sei1, ws4.getServiceEndpoint());
+ final IPackageFragment pf = testPrj1.getSourceFolder().getPackageFragment("com.sap.test.modelsync1");
+ pf.delete(true, null);
+ JobUtils.waitForJobs();
+
+ assertNull(domUtil.findSeiByImplName(wsPrj1, sei1ImplName));
+ assertNull(domUtil.findWsByImplName(wsPrj1, ws1ImplName));
+ assertNull(ws4.getServiceEndpoint());
+ }
+
+ public void test_addedPackageWithCompilationUnitsSynched() throws CoreException, IOException
+ {
+ target.startSynchronizing();
+ final File ioPackage = new File(testPrj1.getSourceFolder().getResource().getRawLocation().toOSString(), "com/sap/test/modelsync4");
+ ioPackage.mkdirs();
+ final FileWriter writer = new FileWriter(new File(ioPackage, "WS4.java"));
+ try {
+ writer.write("package com.sap.test.modelsync4;\n @javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS4 {}");
+ writer.flush();
+ } finally
+ {
+ writer.close();
+ }
+ testPrj1.getSourceFolder().getResource().refreshLocal(IResource.DEPTH_INFINITE,null);
+ JobUtils.waitForJobs();
+
+ assertNotNull(domUtil.findWsByImplName(wsPrj1, "com.sap.test.modelsync4.WS4"));
+ }
+
+ public void test_changedClassToInterface() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync = testPrj1.createPackage("com.sap.test.modelsync4");
+ final ICompilationUnit wsCU = testPrj1.createType(modelSync, "WS4.java", "@javax.jws.WebService() public class WS4 {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+ IWebService ws4 = domUtil.findWsByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(ws4);
+ testUtil.setContents(wsCU, "@javax.jws.WebService() public interface WS4 {}");
+ JobUtils.waitForJobs();
+ ws4 = domUtil.findWsByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNull(ws4);
+ IServiceEndpointInterface sei = domUtil.findSeiByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(sei);
+ assertFalse(sei.isImplicit());
+ }
+
+ public void test_changedInterfaceToClass() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync = testPrj1.createPackage("com.sap.test.modelsync4");
+ final ICompilationUnit wsCU = testPrj1.createType(modelSync, "WS4.java", "@javax.jws.WebService() public interface WS4 {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+
+ IServiceEndpointInterface sei = domUtil.findSeiByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(sei);
+ assertFalse(sei.isImplicit());
+ testUtil.setContents(wsCU, "@javax.jws.WebService() public class WS4 {}");
+ JobUtils.waitForJobs();
+
+ sei = domUtil.findSeiByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(sei);
+ assertTrue(sei.isImplicit());
+ IWebService ws4 = domUtil.findWsByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(ws4);
+ }
+
+ public void test_changedInterfaceAndClassWithSimilarNamesNotRemovedFromDom() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync = testPrj1.createPackage("com.sap.test.modelsync5");
+ final ICompilationUnit wsCU = testPrj1.createType(modelSync, "Test.java", "@javax.jws.WebService() public class Test {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+
+ assertNotNull(domUtil.findWsByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName()));
+ final ICompilationUnit seiCU = testPrj1.createType(modelSync, "TestSei.java", "@javax.jws.WebService() public interface TestSei {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+ assertNotNull(domUtil.findSeiByImplName(wsPrj1, seiCU.findPrimaryType().getFullyQualifiedName()));
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService(serviceName=\"TestService\") public class Test {}");
+ JobUtils.waitForJobs();
+ assertNotNull(domUtil.findSeiByImplName(wsPrj1, seiCU.findPrimaryType().getFullyQualifiedName()));
+ assertNotNull(domUtil.findWsByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName()));
+ }
+
+ public void test_WsChangedToUseExplicitSEI() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync = testPrj1.createPackage("com.sap.test.modelsync4");
+ final ICompilationUnit wsCU = testPrj1.createType(modelSync, "WS4.java", "@javax.jws.WebService() public class WS4 {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+ IServiceEndpointInterface sei = domUtil.findSeiByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNotNull(sei);
+ assertTrue(sei.isImplicit());
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService(endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS4 {}");
+ JobUtils.waitForJobs();
+ sei = domUtil.findSeiByImplName(wsPrj1, wsCU.findPrimaryType().getFullyQualifiedName());
+ assertNull(sei);
+ }
+
+ public void test_WsOpenedInWorkingCopyContentChangedReconcileCalled() throws CoreException
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync = testPrj1.createPackage("com.sap.test.modelsync4");
+ final ICompilationUnit wsCu = testPrj1.createType(modelSync, "WS3.java", "@javax.jws.WebService() public class WS3 {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+ IWebService ws3 = domUtil.findWsByImplName(wsPrj1, wsCu.findPrimaryType().getFullyQualifiedName());
+
+ assertEquals(0, ws3.getServiceEndpoint().getWebMethods().size());
+ // update compilation unit without updating the underlying resource
+ wsCu.becomeWorkingCopy(null);
+ wsCu.getBuffer().setContents("@javax.jws.WebService public class WS3 {" +
+ "public void test() {}" +
+ "}");
+ wsCu.reconcile(ICompilationUnit.NO_AST, false, null, null);
+ JobUtils.waitForJobs();
+
+ assertEquals(1, ws3.getServiceEndpoint().getWebMethods().size());
+ }
+
+ public void test_WsOpenedInWorkingCopyContentChangedReconcileCalledOnNonJavaCU() throws CoreException
+ {
+ target.startSynchronizing();
+
+ IPackageFragmentRoot root = testPrj1.getJavaProject().getPackageFragmentRoot(testPrj1.getProject());
+ IPackageFragment pf = root.getPackageFragment("");
+ ICompilationUnit cu = pf.createCompilationUnit("NotWS.java", "@javax.jws.WebService public class NotWS {}", true, null);
+ cu.becomeWorkingCopy(null);
+ cu.getBuffer().setContents("@javax.jws.WebService(serviceName=\"NewNotWs\") public class NotWS {}");
+ cu.reconcile(ICompilationUnit.NO_AST, false, null, null);
+ JobUtils.waitForJobs();
+
+ for (IWebService ws : wsPrj1.getWebServices()) {
+ if (ws.getName().equals("NewNotWs")) {
+ fail("reconcile on java file which is not on project's build path processed incorrectly");
+ }
+ }
+ }
+
+ private JaxWsWorkspaceResource createTarget()
+ {
+ return new JaxWsWorkspaceResource(javaModel)
+ {
+
+ @Override
+ public boolean approveProject(IJavaProject prj) {
+ for (String allowedPrj : allowedProjects)
+ {
+ if (prj.getElementName().equals(allowedPrj))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ private void verifySetUpModelEntitesNotChanged()
+ {
+ final Adapter adapter = new AdapterImpl()
+ {
+
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ fail("should not be called, because the objects created in the setup should not have been changed during this test");
+ super.notifyChanged(msg);
+ }
+
+ };
+ this.ws1.eAdapters().add(adapter);
+ this.sei1.eAdapters().add(adapter);
+ this.ws2.eAdapters().add(adapter);
+ this.sei2.eAdapters().add(adapter);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/OnEventModelSyncronizerTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/OnEventModelSyncronizerTest.java
new file mode 100755
index 0000000..bd476cc
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/OnEventModelSyncronizerTest.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource.ServiceModelData;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.sync.OnEventModelSynchronizer;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+public class OnEventModelSyncronizerTest extends MockObjectTestCase
+{
+ public void testElementChangedResourceLoadChanged()
+ {
+ JaxWsWorkspaceResource resource = new JaxWsWorkspaceResource(null) {
+ @Override
+ public boolean isLoadCnaceled() {
+ return true;
+ }
+ } ;
+
+ OnEventModelSynchronizer sync = new OnEventModelSynchronizer(resource, null);
+ // in case resource load cancel is not processed call to element delta will fail with NPE
+ sync.elementChanged(null);
+ }
+
+ public void testGuessPrimaryTypeNameCuInDefaultPackage()
+ {
+ final Mock<IJavaModel> javaModel = mock(IJavaModel.class);
+ final JaxWsWorkspaceResource resource = new JaxWsWorkspaceResource(javaModel.proxy());
+
+ final Mock<IJavaElement> parent = mock(IJavaElement.class);
+ parent.expects(once()).method("getElementName").will(returnValue(""));
+
+ final String className = "MyTest";
+ final Mock<ICompilationUnit> cu = mock(ICompilationUnit.class);
+ cu.expects(once()).method("getParent").will(returnValue(parent.proxy()));
+ cu.expects(once()).method("getElementName").will(returnValue(className + ".java"));
+
+ final MyOnEventModelSynchronizer sync = new MyOnEventModelSynchronizer(resource, null);
+ assertEquals("Incorrect name guessed", className, sync.guessPrimaryTypeName(cu.proxy()));
+ }
+
+ public void testGuessPrimaryTypeNameCuInSomePackage()
+ {
+ final Mock<IJavaModel> javaModel = mock(IJavaModel.class);
+ final JaxWsWorkspaceResource resource = new JaxWsWorkspaceResource(javaModel.proxy());
+
+ final String pack = "com.sap.demo";
+ final Mock<IJavaElement> parent = mock(IJavaElement.class);
+ parent.expects(once()).method("getElementName").will(returnValue(pack));
+
+ final String className = "MyTest";
+ final Mock<ICompilationUnit> cu = mock(ICompilationUnit.class);
+ cu.expects(once()).method("getParent").will(returnValue(parent.proxy()));
+ cu.expects(once()).method("getElementName").will(returnValue(className + ".java"));
+
+ final MyOnEventModelSynchronizer sync = new MyOnEventModelSynchronizer(resource, null);
+ assertEquals("Incorrect name guessed", pack + "." + className, sync.guessPrimaryTypeName(cu.proxy()));
+ }
+
+ public void testRecursevilyHandleAddedPackagesDoesNotProcessNonWsProjects() throws JavaModelException
+ {
+ final Mock<IJavaModel> javaModel = mock(IJavaModel.class);
+ final JaxWsWorkspaceResource resource = new JaxWsWorkspaceResource(javaModel.proxy());
+ final MyOnEventModelSynchronizer sync = new MyOnEventModelSynchronizer(resource, null);
+ final Mock<IJavaElementDelta> delta = mock(IJavaElementDelta.class);
+ // it is expected that IJavaElementDelta#getAffectedChildren() method will not be called
+ sync.recursevilyHandleAddedPackages(delta.proxy());
+ }
+
+ public class MyOnEventModelSynchronizer extends OnEventModelSynchronizer
+ {
+ public IWebServiceProject wsProject;
+
+ public MyOnEventModelSynchronizer(JaxWsWorkspaceResource resource, ServiceModelData serviceData) {
+ super(resource, serviceData);
+ }
+
+ @Override
+ protected String guessPrimaryTypeName(ICompilationUnit cu) {
+ return super.guessPrimaryTypeName(cu);
+ }
+
+ @Override
+ protected void recursevilyHandleAddedPackages(IJavaElementDelta rootDelta) throws JavaModelException {
+ super.recursevilyHandleAddedPackages(rootDelta);
+ }
+
+ @Override
+ protected IWebServiceProject findProjectByDelta(IJavaElementDelta rootDelta) {
+ return wsProject;
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiMethodSyncronizationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiMethodSyncronizationTest.java
new file mode 100755
index 0000000..a64f14d
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiMethodSyncronizationTest.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.DomTestUtils;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+
+public class SeiMethodSyncronizationTest extends TestCase {
+
+ private TestProject testPrj1;
+ private JaxWsWorkspaceResource target;
+ private IJavaModel javaModel;
+ private ICompilationUnit sei1CU;
+ private ICompilationUnit someIntfCU;
+
+ private IWebServiceProject wsPrj1;
+ private IWebService ws1;
+ private IServiceEndpointInterface sei1;
+
+ private DomTestUtils testUtil = new DomTestUtils();
+ private DomUtil domUtil = new DomUtil();
+
+ private static final String ws1ImplName = "com.sap.test.modelsync1.WS1";
+// private static final String someIntfImplName = "com.sap.test.modelsync1.SomeIntf";
+ private static final String sei1ImplName = "com.sap.test.modelsync1.Sei1";
+
+
+ public void setUp() throws Exception
+ {
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = new JaxWsWorkspaceResource(javaModel)
+ {
+
+ @Override
+ public boolean approveProject(IJavaProject prj) {
+ return prj.getElementName().equals(testPrj1.getJavaProject().getElementName());
+ }
+ };
+ testPrj1 = new TestProject("TestProject1");
+ testPrj1.createSourceFolder("src");
+ final IPackageFragment modelSync1 = testPrj1.createPackage("com.sap.test.modelsync1");
+
+ someIntfCU = testPrj1.createType(modelSync1, "SomeIntf.java", "public interface SomeIntf{\n" +
+ "public void voidMethodWithNoArgsNoAnnotationInParent();\n" +
+ "}").getCompilationUnit();
+
+ testPrj1.createType(modelSync1, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 extends SomeIntf {\n" +
+ "public void voidMethodWithNoArgsNoAnnotation();\n" +
+ "@javax.jws.WebMethod(operationName=\"webName\", exclude=true) public void voidMethodWithNoArgsWithAnnotation();\n" +
+ "}");
+ testPrj1.createType(modelSync1, "WS1.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ target.load(null);
+ assertEquals("One projects were defined but a different number were found in the DOM", 1, target.getDOM().getWebServiceProjects().size());
+ assertEquals(1, target.getDOM().getWebServiceProjects().get(0).getServiceEndpointInterfaces().size());
+ assertEquals(1, target.getDOM().getWebServiceProjects().get(0).getWebServices().size());
+ wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ assertNotNull(wsPrj1);
+ ws1 = domUtil.findWsByImplName(wsPrj1, ws1ImplName);
+ assertNotNull(ws1);
+ sei1 = domUtil.findSeiByImplName(wsPrj1, sei1ImplName);
+ assertNotNull(sei1);
+ sei1CU = testPrj1.getJavaProject().findType(sei1.getImplementation()).getCompilationUnit();
+ }
+
+ public void test_voidMethodWithNoArgsNoAnnotationSynched() throws JavaModelException
+ {
+ final IMethod methodElem = testPrj1.getJavaProject().findType(sei1.getImplementation()).getMethod("voidMethodWithNoArgsNoAnnotation", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals(methodElem.getElementName(), wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertFalse(wm.isExcluded());
+ }
+
+ public void test_voidMethodWithNoArgsWithAnnotationSynched() throws JavaModelException
+ {
+ final IMethod methodElem = testPrj1.getJavaProject().findType(sei1.getImplementation()).getMethod("voidMethodWithNoArgsWithAnnotation", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals("webName", wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertTrue(wm.isExcluded());
+ }
+
+ public void test_webNameChangedSynched() throws JavaModelException
+ {
+ final IMethod methodElem = testPrj1.getJavaProject().findType(sei1.getImplementation()).getMethod("voidMethodWithNoArgsWithAnnotation", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals("webName", wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertTrue(wm.isExcluded());
+ target.startSynchronizing();
+ FileUtils.getInstance().setCompilationUnitContent(sei1CU, "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 {\n" +
+ "@javax.jws.WebMethod(operationName=\"webNameNew\", exclude=true) public void voidMethodWithNoArgsWithAnnotation();\n" +
+ "}", false, null);
+ JobUtils.waitForJobs();
+
+ assertEquals("webNameNew", wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertTrue(wm.isExcluded());
+ }
+
+ public void test_excludedChangedSynched() throws JavaModelException
+ {
+ final IMethod methodElem = testPrj1.getJavaProject().findType(sei1.getImplementation()).getMethod("voidMethodWithNoArgsWithAnnotation", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(methodElem));
+ assertNotNull(wm);
+ assertEquals("webName", wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertTrue(wm.isExcluded());
+ target.startSynchronizing();
+ FileUtils.getInstance().setCompilationUnitContent(sei1CU, "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 {\n" +
+ "@javax.jws.WebMethod(operationName=\"webName\", exclude=false) public void voidMethodWithNoArgsWithAnnotation();\n" +
+ "}", false, null);
+ JobUtils.waitForJobs();
+
+ assertEquals("webName", wm.getName());
+ assertTrue(wm.getParameters().isEmpty());
+ assertEquals(domUtil.calcImplementation(methodElem), wm.getImplementation());
+ assertFalse(wm.isExcluded());
+ }
+
+ public void test_deletedMethodSynced() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod methodToDelete = testPrj1.getJavaProject().findType(sei1.getImplementation()).getMethod("voidMethodWithNoArgsNoAnnotation", new String[0]);
+ final String methodToDeleteImpl= domUtil.calcImplementation(methodToDelete);
+
+ FileUtils.getInstance().setCompilationUnitContent(sei1CU, "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 {\n" +
+ "@javax.jws.WebMethod(operationName=\"webName\", exclude=true) public void voidMethodWithNoArgsWithAnnotation();\n" +
+ "}", false, null);
+ JobUtils.waitForJobs();
+
+ assertNull(domUtil.findWebMethodByImpl(sei1, methodToDeleteImpl));
+ }
+
+ public void test_overloadedMethodLoadedProperly() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final IMethod newMethod = sei1CU.findPrimaryType().createMethod("@javax.jws.WebMethod(operationName=\"webName\", exclude=true) public void voidMethodWithNoArgsWithAnnotation(int i);", null, false, null);
+ JobUtils.waitForJobs();
+
+ final IWebMethod newWebMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(newMethod));
+ assertNotNull(newWebMethod);
+ final IMethod oldMethod = sei1CU.findPrimaryType().getMethod("voidMethodWithNoArgsWithAnnotation", new String[0]);
+ assertNotSame(newWebMethod, domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(oldMethod)));
+ }
+
+ public void test_MethodsFromSuperTypeLoaded() throws JavaModelException
+ {
+ final IMethod parentMethod = someIntfCU.findPrimaryType().getMethod("voidMethodWithNoArgsNoAnnotationInParent", new String[0]);
+ assertNotNull(domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(parentMethod)));
+ }
+
+ public void test_OverrideMethodsLoadedProperly() throws JavaModelException
+ {
+ target.startSynchronizing();
+ sei1CU.findPrimaryType().createMethod("@javax.jws.WebMethod(operationName=\"webName\", exclude=true) public void voidMethodWithNoArgsNoAnnotationInParent();", null, false, null);
+ JobUtils.waitForJobs();
+
+ final IMethod overridenMethod = sei1CU.findPrimaryType().getMethod("voidMethodWithNoArgsNoAnnotationInParent", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(overridenMethod));
+ assertNotNull(wm);
+ assertEquals("webName", wm.getName());
+ assertTrue(wm.isExcluded());
+ }
+
+ public void test_ChangedMethodInParentInterfaceSynched() throws JavaModelException
+ {
+ target.startSynchronizing();
+ someIntfCU.getBuffer().save(null, false);
+ JobUtils.waitForJobs();
+
+ final IMethod parentMethod = someIntfCU.findPrimaryType().getMethod("voidMethodWithNoArgsNoAnnotationInParent", new String[0]);
+ final IWebMethod wm = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(parentMethod));
+ assertEquals("voidMethodWithNoArgsNoAnnotationInParent", wm.getName());
+ assertFalse(wm.isExcluded());
+ FileUtils.getInstance().setCompilationUnitContent(someIntfCU, "public interface SomeIntf{\n" +
+ "@javax.jws.WebMethod(operationName=\"MethodInParentClassWithNewName\", exclude=true) public void voidMethodWithNoArgsNoAnnotationInParent();\n" +
+ "}", false, null);
+ JobUtils.waitForJobs();
+
+ assertNotNull(wm);
+ assertEquals("MethodInParentClassWithNewName", wm.getName());
+ assertTrue(wm.isExcluded());
+ }
+
+ public void test_ChangedSoapBindingSynched() throws Exception
+ {
+ target.startSynchronizing();
+ testUtil.setContents(sei1CU, "@javax.jws.WebService() public interface Sei1 { public void soapBindingMethod(); }");
+ JobUtils.waitForJobs();
+
+ final IMethod newMethod = sei1CU.findPrimaryType().getMethod("soapBindingMethod", new String[0]);
+ final IWebMethod newWebMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(newMethod));
+ assertNotNull(newWebMethod);
+ assertEquals(SOAPBindingStyle.DOCUMENT, newWebMethod.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.LITERAL, newWebMethod.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, newWebMethod.getSoapBindingParameterStyle());
+
+ testUtil.setContents(sei1CU, "@javax.jws.WebService() public interface Sei1 { \n" +
+ "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)\n" +
+ "public void soapBindingMethod(); }");
+ JobUtils.waitForJobs();
+
+ assertEquals(SOAPBindingStyle.RPC, newWebMethod.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.ENCODED, newWebMethod.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.BARE, newWebMethod.getSoapBindingParameterStyle());
+ }
+
+ public void test_SoapBindingOnSeiSynched() throws Exception
+ {
+ target.startSynchronizing();
+ testUtil.setContents(sei1CU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)\n" +
+ "@javax.jws.WebService() public interface Sei1 { public void soapBindingMethod(); }");
+ JobUtils.waitForJobs();
+
+ final IMethod newMethod = sei1CU.findPrimaryType().getMethod("soapBindingMethod", new String[0]);
+ final IWebMethod newWebMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(newMethod));
+ assertEquals(SOAPBindingStyle.RPC, newWebMethod.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.ENCODED, newWebMethod.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.BARE, newWebMethod.getSoapBindingParameterStyle());
+ }
+
+ public void test_SoapBindingOnSeiOverlappingAnnotationOnMethodSynched() throws Exception
+ {
+ target.startSynchronizing();
+ testUtil.setContents(sei1CU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)\n" +
+ "@javax.jws.WebService() public interface Sei1 { " +
+ "@javax.jws.soap.SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED)" +
+ "public void soapBindingMethod();" +
+ "}");
+ JobUtils.waitForJobs();
+
+ final IMethod newMethod = sei1CU.findPrimaryType().getMethod("soapBindingMethod", new String[0]);
+ final IWebMethod newWebMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(newMethod));
+ assertEquals(SOAPBindingStyle.DOCUMENT, newWebMethod.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.LITERAL, newWebMethod.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, newWebMethod.getSoapBindingParameterStyle());
+ }
+
+ public void test_SoapBindingOnSeiWrongOverlappingAnnotationOnMethodSynched() throws Exception
+ {
+ target.startSynchronizing();
+ testUtil.setContents(sei1CU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)\n" +
+ "@javax.jws.WebService() public interface Sei1 { " +
+ "@javax.jws.soap.SOAPBinding(style=Style.DOCUMENT1, use=Use.LITERAL1, parameterStyle=ParameterStyle.WRAPPED1)" +
+ "public void soapBindingMethod();" +
+ "}");
+ JobUtils.waitForJobs();
+
+ final IMethod newMethod = sei1CU.findPrimaryType().getMethod("soapBindingMethod", new String[0]);
+ final IWebMethod newWebMethod = domUtil.findWebMethodByImpl(sei1, domUtil.calcImplementation(newMethod));
+ assertEquals(SOAPBindingStyle.RPC, newWebMethod.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.ENCODED, newWebMethod.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.BARE, newWebMethod.getSoapBindingParameterStyle());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiSyncronizationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiSyncronizationTest.java
new file mode 100755
index 0000000..98eae1a
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SeiSyncronizationTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+
+
+public class SeiSyncronizationTest extends SynchronizationTestFixture
+{
+
+ public void test_changedSeiNameSynched() throws Exception
+ {
+ target.startSynchronizing();
+ final ICompilationUnit sei1CU = testPrj1.getJavaProject().findType(sei1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(sei1CU, "@javax.jws.WebService() public interface Sei1 {}");
+ JobUtils.waitForJobs();
+ assertEquals("Sei1", sei1.getName()); // check default value
+
+ testUtil.setContents(sei1CU, "@javax.jws.WebService(name=\"Sei1NewName\") public interface Sei1 {}");
+ JobUtils.waitForJobs();
+ assertEquals("Sei1NewName", sei1.getName());
+ assertTrue(sei1.getImplementingWebServices().contains(ws1));
+ assertSame(sei1, domUtil.findSeiByImplName(wsPrj1, sei1.getImplementation()));
+
+ }
+
+ public void test_changedSeiTargetNamespaceSynched() throws Exception
+ {
+ target.startSynchronizing();
+ assertEquals(JaxWsUtils.composeJaxWsTargetNamespaceByPackage(prj1PckName), sei1.getTargetNamespace()); // check default value
+
+ final ICompilationUnit sei1CU = testPrj1.getJavaProject().findType(sei1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(sei1CU, "@javax.jws.WebService(name=\"Sei1NewName\", targetNamespace=\"http://com.sap/test\") public interface Sei1 {}");
+ JobUtils.waitForJobs();
+ assertEquals("Sei1NewName", sei1.getName());
+ assertTrue(sei1.getImplementingWebServices().contains(ws1));
+ assertSame(sei1, domUtil.findSeiByImplName(wsPrj1, sei1.getImplementation()));
+ assertEquals("SEI targetNamespace not synched", "http://com.sap/test", sei1.getTargetNamespace());
+ }
+
+ public void test_SoapBindingStyleChanged() throws Exception
+ {
+ target.startSynchronizing();
+ assertEquals(SOAPBindingStyle.DOCUMENT, sei1.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.LITERAL, sei1.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, sei1.getSoapBindingParameterStyle());
+
+ final ICompilationUnit sei1CU = testPrj1.getJavaProject().findType(sei1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(sei1CU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)" +
+ "@javax.jws.WebService() public interface Sei1 {}");
+ JobUtils.waitForJobs();
+ assertEquals(SOAPBindingStyle.RPC, sei1.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.ENCODED, sei1.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.BARE, sei1.getSoapBindingParameterStyle());
+ }
+//
+// public void test_LocationInterfaceAdapted() throws Exception
+// {
+// final ICompilationUnit sei1CU = testPrj1.getJavaProject().findType(sei1.getImplementation()).getCompilationUnit();
+// testUtil.setContents(sei1CU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)" +
+// "@javax.jws.WebService() public interface Sei1 {}");
+//
+// ILocatorAdapter adapter = (ILocatorAdapter)findAdapter(sei1, ILocatorAdapter.class);
+// assertNotNull(adapter);
+// IAnnotationLocator locator = adapter.getAnnotationLocator(WSAnnotationFeatures.WS_ANNOTATION);
+// printLocator("WS", locator.getLocation());
+// locator = adapter.getAnnotationLocator(SBAnnotationFeatures.SB_ANNOTATION);
+// printLocator("SB", locator.getLocation());
+// printLocator("use", locator.getAttributeNameLocation("use"));
+// printLocator("useVal", locator.getAttributeValueLocation("use"));
+// }
+//
+// private void printLocator(String name, ILocator locator)
+// {
+// System.out.println(name + "------");
+// System.out.println(locator.getStartPosition());
+// System.out.println(locator.getLength());
+// }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SynchronizationTestFixture.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SynchronizationTestFixture.java
new file mode 100755
index 0000000..1490d71
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/SynchronizationTestFixture.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.DomTestUtils;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+public class SynchronizationTestFixture extends MockObjectTestCase
+{
+ protected TestProject testPrj1;
+ protected TestProject testPrj2;
+ protected JaxWsWorkspaceResource target;
+ protected IJavaModel javaModel;
+
+ protected static final String prj1PckName = "com.sap.test.modelsync1";
+ protected static final String prj2PckName = "com.sap.test.modelsync2";
+
+ protected static final String ws1ImplName = prj1PckName + ".WS1";
+ protected static final String sei1ImplName = prj1PckName + ".Sei1";
+ protected static final String ws2ImplName = prj2PckName + ".WS2";
+ protected static final String sei2ImplName = prj2PckName + ".Sei2";
+
+ protected IWebServiceProject wsPrj1;
+ protected IWebService ws1;
+ protected IServiceEndpointInterface sei1;
+
+ protected IWebServiceProject wsPrj2;
+ protected IWebService ws2;
+ protected IServiceEndpointInterface sei2;
+ protected Collection<String> allowedProjects;
+
+ protected DomUtil domUtil = new DomUtil();
+ protected DomTestUtils testUtil = new DomTestUtils();
+
+ public void setUp() throws Exception
+ {
+ allowedProjects = new ArrayList<String>(3);
+ javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = createTarget();
+ testPrj1 = new TestProject(new TestEjb3Project("TestProject1").getProject());
+ testPrj1.createSourceFolder("src");
+ final IPackageFragment modelSync1 = testPrj1.createPackage("com.sap.test.modelsync1");
+ final String javaModelErrorMessage = "Java Model Error. Just created type not found in the java model";
+ assertNotNull(javaModelErrorMessage, testPrj1.createType(modelSync1, "Sei1.java", "@javax.jws.WebService(name=\"Sei1Name\") public interface Sei1 {}"));
+ assertNotNull(javaModelErrorMessage, testPrj1.createType(modelSync1, "WS1.java", "@javax.jws.WebService(serviceName=\"WS1Name\", endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS1 {}"));
+
+ testPrj2 = new TestProject(new TestEjb3Project("TestProject2").getProject());
+ testPrj2.createSourceFolder("src");
+ final IPackageFragment modelSync2 = testPrj2.createPackage("com.sap.test.modelsync2");
+ assertNotNull(javaModelErrorMessage, testPrj2.createType(modelSync2, "Sei2.java", "@javax.jws.WebService(name=\"Sei2Name\") public interface Sei2 {}"));
+ assertNotNull(javaModelErrorMessage, testPrj2.createType(modelSync2, "WS2.java", "@javax.jws.WebService(serviceName=\"WS2Name\", endpointInterface=\"com.sap.test.modelsync1.Sei2\") public class WS2 {}"));
+
+ allowedProjects.add(testPrj1.getJavaProject().getElementName());
+ allowedProjects.add(testPrj2.getJavaProject().getElementName());
+ JobUtils.waitForJobs();
+
+ target.load(null);
+ wsPrj1 = domUtil.findProjectByName(target.getDOM(), testPrj1.getJavaProject().getElementName());
+ assertNotNull(wsPrj1);
+
+ assertEquals(1, wsPrj1.getServiceEndpointInterfaces().size());
+ assertEquals(1, wsPrj1.getWebServices().size());
+
+ ws1 = domUtil.findWsByImplName(wsPrj1, ws1ImplName);
+ assertNotNull(ws1);
+ sei1 = domUtil.findSeiByImplName(wsPrj1, sei1ImplName);
+ assertNotNull(sei1);
+ wsPrj2 = domUtil.findProjectByName(target.getDOM(), testPrj2.getJavaProject().getElementName());
+ assertNotNull(wsPrj2);
+ assertEquals(1, wsPrj2.getServiceEndpointInterfaces().size());
+ assertEquals(1, wsPrj2.getWebServices().size());
+
+ ws2 = domUtil.findWsByImplName(wsPrj2, ws2ImplName);
+ assertNotNull(ws2);
+ sei2 = domUtil.findSeiByImplName(wsPrj2, sei2ImplName);
+ assertNotNull(sei2);
+ }
+
+ @Override
+ public void beforeTestCase() throws CoreException
+ {
+ enableAutoBuild(ResourcesPlugin.getWorkspace(), false);
+ }
+
+ @Override
+ public void afterTestCase() throws CoreException
+ {
+ enableAutoBuild(ResourcesPlugin.getWorkspace(), true);
+ }
+
+ private void enableAutoBuild(IWorkspace ws, boolean enable) throws CoreException
+ {
+ final IWorkspaceDescription desc = ws.getDescription();
+ desc.setAutoBuilding(enable);
+ ws.setDescription(desc);
+ }
+
+ protected Adapter findAdapter(EObject object, Class<?> clazz) {
+ for (Adapter adapter: object.eAdapters()) {
+ if (adapter.isAdapterForType(clazz)) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public void tearDown() throws CoreException
+ {
+ target.stopSynchronizing();
+ testPrj1.dispose();
+ testPrj2.dispose();
+ }
+
+ private JaxWsWorkspaceResource createTarget()
+ {
+ return new JaxWsWorkspaceResource(javaModel)
+ {
+
+ @Override
+ public boolean approveProject(IJavaProject prj) {
+ for (String allowedPrj : allowedProjects)
+ {
+ if (prj.getElementName().equals(allowedPrj))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/WsSynchronizationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/WsSynchronizationTest.java
new file mode 100755
index 0000000..3859e9e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/persistence/sync/WsSynchronizationTest.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.sync;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingParameterStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingStyle;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.SOAPBindingUse;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+
+public class WsSynchronizationTest extends SynchronizationTestFixture
+{
+ public void test_changedWSnameSynched() throws JavaModelException, CoreException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit ws1CU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(ws1CU, "@javax.jws.WebService(serviceName=\"WS1NewName\", endpointInterface=\"com.sap.test.modelsync1.Sei1\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertEquals("WS1NewName", ws1.getName());
+ assertSame(sei1, ws1.getServiceEndpoint());
+ assertSame(ws1, domUtil.findWsByImplName(wsPrj1, ws1.getImplementation()));
+ }
+
+ public void test_changedNameOfImplicitInterface() throws Exception
+ {
+ target.startSynchronizing();
+ final IPackageFragment modelSync3 = testPrj1.createPackage("com.sap.test.modelsync3");
+ final ICompilationUnit ws3CU = testPrj1.createType(modelSync3, "WS3.java", "@javax.jws.WebService(serviceName=\"WS3Name\", name=\"ImplicitInterfaceName\") public class WS3 {}").getCompilationUnit();
+ JobUtils.waitForJobs();
+
+ final IWebService ws3 = domUtil.findWsByImplName(wsPrj1, ws3CU.findPrimaryType().getFullyQualifiedName());
+ final IServiceEndpointInterface implSei = ws3.getServiceEndpoint();
+ assertTrue(implSei.isImplicit());
+ testUtil.setContents(ws3CU, "@javax.jws.WebService(serviceName=\"WS3Name\", name=\"ImplicitInterfaceNewName\") public class WS3 {}");
+ JobUtils.waitForJobs();
+
+ assertSame(implSei, ws3.getServiceEndpoint());
+ assertTrue(implSei.isImplicit());
+ assertEquals("ImplicitInterfaceNewName", implSei.getName());
+ }
+
+ public void test_changedTargetNamespaceSynched() throws Exception
+ {
+ target.startSynchronizing();
+ assertEquals(JaxWsUtils.composeJaxWsTargetNamespaceByPackage(prj1PckName), ws1.getTargetNamespace());
+
+ final ICompilationUnit wsCU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ testUtil.setContents(wsCU, "@javax.jws.WebService(serviceName=\"WS1Name\", targetNamespace=\"http://com.sap./test\") public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertEquals("targetNamespace not synchronized", "http://com.sap./test", ws1.getTargetNamespace());
+ }
+
+ public void test_changedPortNameSynched() throws Exception
+ {
+ target.startSynchronizing();
+ final ICompilationUnit wsCU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ assertEquals("WS1Port", ws1.getPortName());
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService(portName=\"ChangedPortName\") public class WS1 {}");;
+ JobUtils.waitForJobs();
+
+ assertEquals("portName not synchronized", "ChangedPortName", ws1.getPortName());
+ }
+
+ public void test_changedWsdlLocationSynched() throws Exception
+ {
+ target.startSynchronizing();
+ final ICompilationUnit wsCU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+ assertEquals(null, ws1.getWsdlLocation());
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService(wsdlLocation=\"C:/changed/wsdl/location\") public class WS1 {}");;
+ JobUtils.waitForJobs();
+
+ assertEquals("wsdlLocation not synchronized", "C:/changed/wsdl/location", ws1.getWsdlLocation());
+ }
+
+ public void test_changedImplicitSeiSoapBinding() throws Exception
+ {
+ target.startSynchronizing();
+ final ICompilationUnit wsCU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService() public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ final IServiceEndpointInterface sei = ws1.getServiceEndpoint();
+ assertEquals(SOAPBindingStyle.DOCUMENT, sei.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.LITERAL, sei.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.WRAPPED, sei.getSoapBindingParameterStyle());
+
+ testUtil.setContents(wsCU, "@javax.jws.soap.SOAPBinding(style=Style.RPC, use=Use.ENCODED, parameterStyle=ParameterStyle.BARE)\n" +
+ "@javax.jws.WebService() public class WS1 {}");
+ JobUtils.waitForJobs();
+
+ assertEquals(SOAPBindingStyle.RPC, sei.getSoapBindingStyle());
+ assertEquals(SOAPBindingUse.ENCODED, sei.getSoapBindingUse());
+ assertEquals(SOAPBindingParameterStyle.BARE, sei.getSoapBindingParameterStyle());
+ }
+
+ public void test_ContructorIsNotIncludedInWebMethods() throws JavaModelException
+ {
+ target.startSynchronizing();
+ final ICompilationUnit wsCU = testPrj1.getJavaProject().findType(ws1.getImplementation()).getCompilationUnit();
+
+ testUtil.setContents(wsCU, "@javax.jws.WebService()public class WS1{public WS1(){};public WS1(String s){}public void myMethod(){}}");
+ JobUtils.waitForJobs();
+
+ final IServiceEndpointInterface sei = ws1.getServiceEndpoint();
+ final EList<IWebMethod> methods = sei.getWebMethods();
+ assertEquals("One method expected in the SEI", 1, methods.size());
+ assertEquals("Unpexpected method name in SEI", "myMethod", methods.iterator().next().getName());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/Dom2ResourceMapperTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/Dom2ResourceMapperTest.java
new file mode 100755
index 0000000..9e6cf06
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/Dom2ResourceMapperTest.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.util;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestEjb3Project;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+
+/**
+ * Tests for {@link Dom2ResourceMapper} class
+ *
+ * @author Georgi Vachkov
+ */
+public class Dom2ResourceMapperTest extends TestCase
+{
+ private Dom2ResourceMapper mapper = Dom2ResourceMapper.INSTANCE;
+ private TestProject testProject;
+ private TestProject testProject1;
+
+ private IType seiType;
+ private IType wsType;
+ private IDOM dom;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ testProject = prepareProject();
+ IPackageFragment pck = testProject.createPackage("test");
+ seiType = testProject.createType(pck, "Sei.java", "@javax.jws.WebService public interface Sei { \n" +
+ "@javax.jws.WebMethod public void test(int a); \n" +
+ "}");
+
+ testProject1 = prepareProject();
+ pck = testProject1.createPackage("test");
+ wsType = testProject1.createType(pck, "Ws.java", "@javax.jws.WebService public class Ws {}");
+
+
+ final IWsDOMRuntimeExtension domRuntime = WsDOMRuntimeManager.instance().getDOMRuntime("org.eclipse.jst.ws.jaxws.dom.jee5");
+ domRuntime.createDOM(null);
+ dom = domRuntime.getDOM();
+ }
+
+ private TestProject prepareProject() throws Exception
+ {
+ TestEjb3Project tp = new TestEjb3Project("Ejb");
+ return new TestProject(tp.getProject());
+ }
+
+ @Override
+ public void tearDown()
+ {
+ try {
+ testProject.dispose();
+ } catch (Exception _) {}
+ try {
+ testProject1.dispose();
+ } catch (Exception _) {}
+ }
+
+ public void testFindProject()
+ {
+ IWebServiceProject wsProject = DomUtil.INSTANCE.findProjectByName(dom, testProject.getProject().getName());
+ IProject project = mapper.findProject(wsProject);
+ assertEquals(testProject.getProject(), project);
+ }
+
+ public void testFindResourceSei() throws JavaModelException
+ {
+ IWebServiceProject wsProject = DomUtil.INSTANCE.findProjectByName(dom, testProject.getProject().getName());
+ IServiceEndpointInterface sei = DomUtil.INSTANCE.findSeiByImplName(wsProject, "test.Sei");
+ assertNotNull(sei);
+
+ // find using SEI
+ IType type = mapper.findType(sei);
+ assertNotNull(type);
+ assertEquals(seiType, type);
+ }
+
+ public void testFindResourceWs() throws JavaModelException
+ {
+ IWebServiceProject wsProject = DomUtil.INSTANCE.findProjectByName(dom, testProject1.getProject().getName());
+ IWebService ws = DomUtil.INSTANCE.findWsByImplName(wsProject, "test.Ws");
+ assertNotNull(ws);
+
+ IType type = mapper.findType(ws);
+ assertNotNull(type);
+ assertEquals(wsType, type);
+ }
+
+ public void testFindResourceWebMethod() throws JavaModelException
+ {
+ IWebServiceProject wsProject = DomUtil.INSTANCE.findProjectByName(dom, testProject.getProject().getName());
+ IServiceEndpointInterface sei = DomUtil.INSTANCE.findSeiByImplName(wsProject, "test.Sei");
+ assertNotNull(sei);
+
+ IType type = mapper.findType(sei.getWebMethods().get(0));
+ assertNotNull(type);
+ assertEquals(seiType, type);
+
+ final IWebMethod webMethod = DomFactory.eINSTANCE.createIWebMethod();
+ type = mapper.findType(webMethod);
+ assertNull(type);
+ }
+
+ public void testFindResourceWebParam() throws JavaModelException
+ {
+ IWebServiceProject wsProject = DomUtil.INSTANCE.findProjectByName(dom, testProject.getProject().getName());
+ IServiceEndpointInterface sei = DomUtil.INSTANCE.findSeiByImplName(wsProject, "test.Sei");
+ assertNotNull(sei);
+
+ IType type = mapper.findType(sei.getWebMethods().get(0).getParameters().get(0));
+ assertNotNull(type);
+ assertEquals(seiType, type);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/DomUtilTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/DomUtilTest.java
new file mode 100755
index 0000000..1cfdd20
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/util/DomUtilTest.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.util;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+public class DomUtilTest extends MockObjectTestCase
+{
+ private DomUtil util;
+
+ public void setUp()
+ {
+ util = new DomUtil();
+ }
+
+ public void testIsOutideInWebService()
+ {
+ Mock<IWebService> ws = mock(IWebService.class);
+ ws.stubs().method("getWsdlLocation").will(returnValue("C:/test/wsdl/location"));
+ Mock<IServiceEndpointInterface> sei = mock(IServiceEndpointInterface.class);
+ EList<IWebService> implemetingWs = new BasicEList<IWebService>();
+ implemetingWs.add(ws.proxy());
+
+ sei.stubs().method("getImplementingWebServices").will(returnValue(implemetingWs));
+ assertTrue(util.isOutsideInWebService(sei.proxy()));
+
+ ws.stubs().method("getWsdlLocation").will(returnValue(null));
+ assertFalse(util.isOutsideInWebService(sei.proxy()));
+ }
+
+ public void testFindWsProject()
+ {
+ IWebServiceProject wsProject = DomFactory.eINSTANCE.createIWebServiceProject();
+ IServiceEndpointInterface sei = DomFactory.eINSTANCE.createIServiceEndpointInterface();
+ IWebMethod method = DomFactory.eINSTANCE.createIWebMethod();
+ sei.getWebMethods().add(method);
+ wsProject.getServiceEndpointInterfaces().add(sei);
+
+ assertEquals(wsProject, util.findWsProject(method));
+ }
+
+ public void testCalcUniqueImpl()
+ {
+ IWebMethod method = DomFactory.eINSTANCE.createIWebMethod();
+ method.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "method(I)");
+ IWebParam param = DomFactory.eINSTANCE.createIWebParam();
+ param.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "a");
+ method.getParameters().add(param);
+
+ assertEquals("method(I)", util.calcUniqueImpl(method));
+ assertEquals("method(I)[a]", util.calcUniqueImpl(param));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/AbstractValidationConstraintTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/AbstractValidationConstraintTest.java
new file mode 100755
index 0000000..90d779f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/AbstractValidationConstraintTest.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.emf.validation.service.IConstraintDescriptor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.AnnotationAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.annotation.IAnnotationAdapter;
+import org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.persistence.annotation.impl.AbstractLocatorsTest;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.AbstractValidationConstraint;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IConstraintStatusExtended;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IProblemLocation;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+
+public class AbstractValidationConstraintTest extends AbstractLocatorsTest
+{
+ private MyAbstractValidationConstraint constraint;
+ private Mock<IResource> resource;
+
+ @Override
+ public void setUp()
+ {
+ super.setUp();
+ resource = mock(IResource.class);
+ Mock<IConstraintDescriptor> descriptor = mock(IConstraintDescriptor.class);
+ descriptor.stubs().method("getPluginId").will(returnValue("plugin.id"));
+ descriptor.stubs().method("getSeverity").will(returnValue(ConstraintSeverity.ERROR));
+ descriptor.stubs().method("getStatusCode").will(returnValue(-1));
+
+ constraint = new MyAbstractValidationConstraint(descriptor.proxy());
+ }
+
+ public void testCreateOkStatus() throws JavaModelException
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ IConstraintStatusExtended cs = constraint.createOkStatus(ws);
+ assertNotNull("Constraint status is null", cs);
+ assertTrue(cs.isOK());
+ assertEquals(0, cs.getResultLocus().size());
+ assertEquals(0, cs.getProblemLocations().size());
+ }
+
+ public void testCreateErrorStatus() throws JavaModelException
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ IConstraintStatusExtended cs = constraint.createStatus(ws, "error message", null, null);
+ assertNotNull(cs);
+ assertFalse(cs.isOK());
+ IProblemLocation pl = cs.getProblemLocations().iterator().next();
+ assertEquals(resource.proxy(), pl.getResource());
+ assertNotNull(pl.getLocator());
+ assertEquals(0, pl.getLocator().getStartPosition());
+ assertEquals(0, pl.getLocator().getLength());
+ }
+
+ public void testGetLocatorNoAnnotations() throws JavaModelException
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ IProblemLocation pl = constraint.getLocator(ws, null, null);
+ assertEquals(resource.proxy(), pl.getResource());
+ }
+
+ public void testGetLocatorForAnnotation() throws JavaModelException
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ Mock<IJavaElement> javaElement = mock(IJavaElement.class);
+ javaElement.stubs().method("getResource").will(returnValue(resource.proxy()));
+ annotation.stubs().method("getAppliedElement").will(returnValue(javaElement.proxy()));
+
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(ws, IAnnotationAdapter.class);
+ adapter.addAnnotation(WSAnnotationFeatures.WS_ANNOTATION, annotation.proxy());
+ IProblemLocation pl = constraint.getLocator(ws, WSAnnotationFeatures.WS_ANNOTATION, null);
+ assertEquals(resource.proxy(), pl.getResource());
+ assertEquals(annotation.proxy().getLocator(), pl.getLocator());
+ }
+
+ public void testGetLocatorForAttribute() throws JavaModelException
+ {
+ IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ Mock<IJavaElement> javaElement = mock(IJavaElement.class);
+ javaElement.stubs().method("getResource").will(returnValue(resource.proxy()));
+ annotation.stubs().method("getAppliedElement").will(returnValue(javaElement.proxy()));
+
+ final IAnnotationAdapter adapter = (IAnnotationAdapter)AnnotationAdapterFactory.INSTANCE.adapt(ws, IAnnotationAdapter.class);
+ adapter.addAnnotation(WSAnnotationFeatures.WS_ANNOTATION, annotation.proxy());
+ IProblemLocation pl = constraint.getLocator(ws, WSAnnotationFeatures.WS_ANNOTATION, "param1");
+ assertEquals(resource.proxy(), pl.getResource());
+ assertEquals(param1.getValue().getLocator(), pl.getLocator());
+ }
+
+ protected class MyAbstractValidationConstraint extends AbstractValidationConstraint
+ {
+ public MyAbstractValidationConstraint(IConstraintDescriptor descriptor) {
+ super(descriptor);
+ }
+
+ public IStatus validate(IValidationContext ctx) {
+ return null;
+ }
+
+ @Override
+ public IConstraintStatusExtended createOkStatus(EObject object) throws JavaModelException {
+ return super.createOkStatus(object);
+ }
+
+ @Override
+ protected IConstraintStatusExtended createStatus(EObject object, String errorMessage, String annFQName, String attributeName) throws JavaModelException {
+ return super.createStatus(object, errorMessage, annFQName, attributeName);
+ }
+
+ @Override
+ protected IResource findResource(EObject eObject) throws JavaModelException {
+ return resource.proxy();
+ }
+
+ public IProblemLocation getLocator(EObject eObject, String annFQName, String attributeName) throws JavaModelException {
+ return super.getLocator(eObject, annFQName, attributeName);
+ }
+
+ @Override
+ protected ILocator getLocatorForImplementation(final EObject eObject) throws JavaModelException
+ {
+ return new ILocator() {
+ public int getLength() { return 0; }
+ public int getStartPosition() { return 0; }
+ public int getLineNumber() { return 0; }
+ };
+ }
+
+ @Override
+ protected IStatus doValidate(IValidationContext ctx) throws JavaModelException {
+ return null;
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ConstraintStatusExtendedTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ConstraintStatusExtendedTest.java
new file mode 100755
index 0000000..31c7709
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ConstraintStatusExtendedTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.emf.validation.model.IModelConstraint;
+import org.eclipse.emf.validation.service.IConstraintDescriptor;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IProblemLocation;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.impl.ConstraintStatusExtended;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+
+public class ConstraintStatusExtendedTest extends MockObjectTestCase
+{
+ private Mock<IProblemLocation> locationMock;
+ private Mock<IModelConstraint> modelConstraint;
+ private Mock<EObject> targetObject;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ locationMock = mock(IProblemLocation.class);
+ modelConstraint = mock(IModelConstraint.class);
+ targetObject = mock(EObject.class);
+
+ final Mock<IConstraintDescriptor> constraintDescr = mock(IConstraintDescriptor.class);
+ constraintDescr.stubs().method("getSeverity").will(returnValue(ConstraintSeverity.ERROR));
+ constraintDescr.stubs().method("getStatusCode").will(returnValue(0));
+ constraintDescr.stubs().method("getPluginId").will(returnValue("mytestpluginid"));
+ modelConstraint.stubs().method("getDescriptor").will(returnValue(constraintDescr.proxy()));
+ }
+
+ public void testCreateWithNullLocation()
+ {
+ try
+ {
+ new ConstraintStatusExtended(modelConstraint.proxy(), targetObject.proxy(), IStatus.OK, 0, "TEST", null);
+ fail("NPE expected");
+ } catch (NullPointerException e)
+ {
+ //expected
+ }
+ }
+
+ public void testProblemLocationInitialized()
+ {
+ final Set<IProblemLocation> locations = new HashSet<IProblemLocation>();
+ locations.add(locationMock.proxy());
+
+ final ConstraintStatusExtended status = new ConstraintStatusExtended(modelConstraint.proxy(), targetObject.proxy(), IStatus.ERROR, 0, "TEST", locations);
+ assertTrue("Problem location not initialized properly", status.getProblemLocations().size() == 1);
+ assertTrue("Problem location not initialized properly", status.getProblemLocations().iterator().next() == locationMock.proxy());
+ }
+
+ public void testProblemLocationInitialized2()
+ {
+ final Set<IProblemLocation> locations = new HashSet<IProblemLocation>();
+ locations.add(locationMock.proxy());
+
+ final ConstraintStatusExtended status = new ConstraintStatusExtended(modelConstraint.proxy(), targetObject.proxy(), "TEST", locations);
+ assertTrue("Problem location not initialized properly", status.getProblemLocations().size() == 1);
+ assertTrue("Problem location not initialized properly", status.getProblemLocations().iterator().next() == locationMock.proxy());
+ }
+
+ public void testProblemLocationIsNotModifiable()
+ {
+ final Set<IProblemLocation> locations = new HashSet<IProblemLocation>();
+ final ConstraintStatusExtended status = new ConstraintStatusExtended(modelConstraint.proxy(), targetObject.proxy(), IStatus.ERROR, 0, "TEST", locations);
+ try
+ {
+ status.getProblemLocations().add(locationMock.proxy());
+ fail("UnsupportedOperationException expected");
+ }
+ catch(UnsupportedOperationException e)
+ {
+ //expected
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidationConstraintDescriptorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidationConstraintDescriptorTest.java
new file mode 100755
index 0000000..85d77a1
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidationConstraintDescriptorTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import junit.framework.TestCase;
+
+import org.eclipse.emf.validation.model.ConstraintSeverity;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidationConstraintDescriptor;
+
+public class DomValidationConstraintDescriptorTest extends TestCase
+{
+ private DomValidationConstraintDescriptor desc;
+
+ @Override
+ public void setUp()
+ {
+ desc = new DomValidationConstraintDescriptor(){
+ public String getId() {return null;}
+ public String getPluginId() {return null;}
+ public ConstraintSeverity getSeverity() {return null;}
+ public int getStatusCode() {return 0;}};
+ }
+
+ public void testDescriptor()
+ {
+ assertNull(desc.getBody());
+ assertNotNull(desc.getDescription());
+ assertEquals(EvaluationMode.BATCH, desc.getEvaluationMode());
+ assertNull(desc.getMessagePattern());
+ assertNotNull(desc.getName());
+ assertTrue(desc.targetsEvent(null));
+ assertTrue(desc.targetsTypeOf(null));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidatorFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidatorFactoryTest.java
new file mode 100755
index 0000000..1f4c89e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/DomValidatorFactoryTest.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidatorFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator;
+
+/**
+ * Tests for {@link DomValidatorFactory} class.
+ * @author Georgi Vachkov
+ */
+public class DomValidatorFactoryTest extends TestCase
+{
+ public void testGetRegisteredValidators()
+ {
+ Collection<IDomValidator> validators = DomValidatorFactory.INSTANCE.getRegisteredValidators();
+ assertTrue("No validators found", validators.size() > 0);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanConstraintTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanConstraintTest.java
new file mode 100755
index 0000000..2eae2be
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanConstraintTest.java
@@ -0,0 +1,146 @@
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.WSAnnotationFeatures;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.messages.ValidationMessages;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.Assertions;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.ConditionCheckException;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+
+public class EndpointIsSessionBeanConstraintTest extends TestCase
+{
+ private TestProject ejbProject;
+ private TestProject webProject;
+ private static final String CU_NAME = "MyTestClass";
+ private static final String CU_PACKAGE = "test";
+ private static final String CU_CONTENT = MessageFormat.format("public class {0} '{'public void test()'{'}}", CU_NAME);
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ TestProjectsUtils.deleteWorkspaceProjects();
+
+ ejbProject = new TestProject(TestProjectsUtils.createEjb3Project("EJB3" + System.currentTimeMillis()).getProject());
+ createCompilationUnit(ejbProject);
+ webProject = new TestProject(TestProjectsUtils.createWeb25Project("Web25" + System.currentTimeMillis()).getProject());
+ createCompilationUnit(webProject);
+ }
+
+ private void createCompilationUnit(final TestProject project) throws CoreException
+ {
+ final IPackageFragment pkg = project.createPackage(CU_PACKAGE);
+ final IType cu = project.createType(pkg, CU_NAME + ".java", CU_CONTENT);
+ refreshAndBuildProject(project);
+ assertEquals("No errors expected", 0, cu.getResource().findMarkers(DomValidationConstants.MARKER_ID, false, IResource.DEPTH_ONE).length);
+ }
+
+ private void refreshAndBuildProject(final TestProject project) throws CoreException
+ {
+ project.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForJobs();
+ }
+
+ private IType findTestEndpoint(final TestProject project) throws JavaModelException
+ {
+ final IJavaProject javaP = project.getJavaProject();
+ final IType result = javaP.findType(CU_PACKAGE + "." + CU_NAME);
+ assertNotNull(result);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWsAnnotationInEjbStateful() throws AnnotationGeneratorException, CoreException
+ {
+ final IType endpointType = findTestEndpoint(ejbProject);
+
+ final IAnnotation<IType> wsann = (IAnnotation<IType>) AnnotationFactory.createAnnotation(WSAnnotationFeatures.WS_ANNOTATION, endpointType, new HashSet<IParamValuePair>());
+ AnnotationWriter.getInstance().setAppliedElement(wsann, endpointType);
+ refreshAndBuildProject(ejbProject);
+ checkMarkers(endpointType.getResource(), IMarker.SEVERITY_ERROR, 1, ValidationMessages.WsValidation_WsAnnotationOnNonSessionBean_Error);
+
+ final IAnnotation<IType> beanAnnotation = (IAnnotation<IType>) AnnotationFactory.createAnnotation("com.sun.xml.internal.ws.developer.Stateful", endpointType, new HashSet<IParamValuePair>());
+ AnnotationWriter.getInstance().setAppliedElement(beanAnnotation, endpointType);
+ refreshAndBuildProject(ejbProject);
+ checkMarkers(endpointType.getResource(), IMarker.SEVERITY_ERROR, 0, ValidationMessages.WsValidation_WsAnnotationOnNonSessionBean_Error);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWsAnnotationInWeb() throws AnnotationGeneratorException, CoreException
+ {
+ final IType endpointType = findTestEndpoint(webProject);
+
+ final IAnnotation<IType> wsann = (IAnnotation<IType>) AnnotationFactory.createAnnotation(WSAnnotationFeatures.WS_ANNOTATION, endpointType, new HashSet<IParamValuePair>());
+ AnnotationWriter.getInstance().setAppliedElement(wsann, endpointType);
+ refreshAndBuildProject(webProject);
+ checkMarkers(endpointType.getResource(), IMarker.SEVERITY_ERROR, 0, ValidationMessages.WsValidation_WsAnnotationOnNonSessionBean_Error);
+
+ }
+
+ private void checkMarkers(final IResource resource, final int severity, final int expectedMarkers, final String expectedMarkerMessage)
+ {
+ Assertions.waitAssert(new IWaitCondition()
+ {
+ public boolean checkCondition() throws ConditionCheckException
+ {
+ try
+ {
+ final IMarker[] markers = resource.findMarkers(DomValidationConstants.MARKER_ID, false, IResource.DEPTH_ONE);
+ final List<IMarker> matchedMarkers = new ArrayList<IMarker>();
+ for (IMarker m : markers)
+ {
+ if (m.getAttribute(IMarker.SEVERITY) == null || m.getAttribute(IMarker.MESSAGE) == null)
+ {
+ continue;
+ }
+
+ if (((Integer) m.getAttribute(IMarker.SEVERITY) == severity) && (expectedMarkerMessage.equals((String) m.getAttribute(IMarker.MESSAGE))))
+ {
+ matchedMarkers.add(m);
+ }
+ }
+
+ return matchedMarkers.size() == expectedMarkers;
+ } catch (CoreException e)
+ {
+ throw new ConditionCheckException(e);
+ }
+ }
+ }, "expected markers not found");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ ejbProject.dispose();
+ webProject.dispose();
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/JaxWsDomValidatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/JaxWsDomValidatorTest.java
new file mode 100755
index 0000000..66a92e8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/JaxWsDomValidatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import java.util.Collection;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidatorFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.JaxWsDomValidator;
+
+/**
+ * Tests for {@link JaxWsDomValidator}
+ *
+ * @author Georgi Vachkov
+ */
+public class JaxWsDomValidatorTest extends TestCase
+{
+ private JaxWsDomValidator validator;
+
+ @Override
+ public void setUp() {
+ validator = new JaxWsDomValidator();
+ }
+
+ public void testRegistered()
+ {
+ Collection<IDomValidator> validators = DomValidatorFactory.INSTANCE.getRegisteredValidators();
+ IDomValidator validator=null;
+ for (IDomValidator domValidator : validators) {
+ if(domValidator instanceof JaxWsDomValidator) {
+ validator = domValidator;
+ break;
+ }
+ }
+
+ assertNotNull("Jax-ws validator not found", validator);
+ }
+
+ public void testGetSupportedDomRuntime() {
+ assertEquals(Jee5WsDomRuntimeExtension.ID, validator.getSupportedDomRuntime());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/SeiValidationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/SeiValidationTest.java
new file mode 100755
index 0000000..b22a46f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/SeiValidationTest.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsProblemsReporter;
+
+/**
+ * Tests for SEI validation constraints
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiValidationTest extends ValidationTestsSetUp
+{
+ protected IType seiType;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ seiType = testProject.createType(testPack, "Sei.java", "@javax.jws.WebService(name=\"SeiName\") public interface Sei {}");
+ }
+
+ public void testServiceNameIsNCName() throws CoreException
+ {
+ final IServiceEndpointInterface sei = findSei("test.Sei");
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"---\") public interface Sei {}");
+ validator.validate(sei);
+ markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(40, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(45, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(2, markers[0].getAttribute(IMarker.LINE_NUMBER));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testTargetNsIsValidUri() throws CoreException
+ {
+ final IServiceEndpointInterface sei = findSei("test.Sei");
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(targetNamespace=\"^^^\") public interface Sei {}");
+ validator.validate(sei);
+ markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(51, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(56, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testRedundandAttributesOnExplicitSei() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"Name\", portName=\"PortName\") public interface Sei {}");
+ IServiceEndpointInterface sei = findSei("test.Sei");
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(13, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(68, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testRedundandAttributesOnImplicitSei() throws CoreException
+ {
+ testProject.createType(testPack, "Ws.java", "@javax.jws.WebService(name=\"Name\", portName=\"PortName\") public class Ws {}");
+ IServiceEndpointInterface sei = findSei("test.Ws");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+
+ public void testSeiClassCorrectExplicitSei() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService interface Sei {}");
+ IServiceEndpointInterface sei = findSei("test.Sei");
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(13, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(34, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testSeiClassCorrectImplicitSei() throws CoreException
+ {
+ testProject.createType(testPack, "Ws.java", "@javax.jws.WebService public class Ws {}");
+ IServiceEndpointInterface sei = findSei("test.Ws");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+}
+
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ValidationTestsSetUp.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ValidationTestsSetUp.java
new file mode 100755
index 0000000..2bb6dcb
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/ValidationTestsSetUp.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.JaxWsWorkspaceResource;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.JaxWsDomValidator;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.Assertions;
+import org.eclipse.jst.ws.jaxws.testutils.assertions.ConditionCheckException;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+
+public class ValidationTestsSetUp extends TestCase
+{
+ protected TestProject testProject;
+ protected JaxWsWorkspaceResource target;
+ protected IPackageFragment testPack;
+ protected JaxWsDomValidator validator;
+ protected DomUtil util = DomUtil.INSTANCE;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ testProject = new TestProject();
+ testProject.createSourceFolder("src");
+ testPack = testProject.createPackage("test");
+ validator = new JaxWsDomValidator();
+
+ IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ target = new JaxWsWorkspaceResource(javaModel)
+ {
+ @Override
+ public boolean approveProject(IJavaProject prj) {
+ return prj.getElementName().equals(testProject.getJavaProject().getElementName());
+ }
+ };
+ target.load(null);
+ target.startSynchronizing();
+ }
+
+ @Override
+ public void tearDown()
+ {
+ try {
+ testProject.dispose();
+ } catch (Exception _) {}
+ }
+
+ protected IWebService findWs(String wsFQName)
+ {
+ final IWebServiceProject wsProject = util.findProjectByName(target.getDOM(), testProject.getProject().getName());
+ return util.findWsByImplName(wsProject, wsFQName);
+ }
+
+ protected IServiceEndpointInterface findSei(String seiFQName)
+ {
+ final IWebServiceProject wsProject = util.findProjectByName(target.getDOM(), testProject.getProject().getName());
+ return util.findSeiByImplName(wsProject, seiFQName);
+ }
+
+ protected void setContents(final ICompilationUnit cu, final String contents) throws JavaModelException
+ {
+ String newContent = "import " + testPack.getElementName() + ";\n" + contents;
+ FileUtils.getInstance().setCompilationUnitContent(cu, newContent, false, null);
+ }
+
+ protected void waitUntilMarkersAppear(final IResource resource, final String markerId, final boolean includeSubtypes, final int depth)
+ {
+ final IWaitCondition condition = new IWaitCondition(){
+ public boolean checkCondition() throws ConditionCheckException
+ {
+ try
+ {
+ return resource.findMarkers(markerId, includeSubtypes, depth).length > 0;
+ } catch (CoreException e)
+ {
+ throw new ConditionCheckException(e);
+ }
+ }};
+ Assertions.waitAssert(condition, "Error markers did not disappear");
+ }
+
+ protected void waitUntilMarkersDisappear(final IResource resource, final String markerId, final boolean includeSubtypes, final int depth)
+ {
+ final IWaitCondition condition = new IWaitCondition(){
+ public boolean checkCondition() throws ConditionCheckException
+ {
+ try
+ {
+ return resource.findMarkers(markerId, includeSubtypes, depth).length == 0;
+ } catch (CoreException e)
+ {
+ throw new ConditionCheckException(e);
+ }
+ }};
+ Assertions.waitAssert(condition, "Error markers did not appear");
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WmValidationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WmValidationTest.java
new file mode 100755
index 0000000..a90da65
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WmValidationTest.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsProblemsReporter;
+
+public class WmValidationTest extends ValidationTestsSetUp
+{
+ private IType seiType;
+ private IServiceEndpointInterface sei;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ seiType = testProject.createType(testPack, "Sei.java", "@javax.jws.WebService(name=\"SeiName\") public interface Sei {\n" +
+ "@javax.jws.WebMethod(operationName=\"test\") public void test();" +
+ "}");
+ }
+
+ public void testNameIsNCName() throws CoreException
+ {
+// validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {\n" +
+ "@javax.jws.WebMethod(operationName=\"---\") public void test(); \n" + "}");
+
+ sei = findSei("test.Sei");
+ validator.validate(sei);
+ waitUntilMarkersAppear(seiType.getResource(), WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(109, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(114, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(3, markers[0].getAttribute(IMarker.LINE_NUMBER));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameIsUnique() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {\n" +
+ "@javax.jws.WebMethod(operationName=\"OpName\") public void first(); \n" +
+ "@javax.jws.WebMethod(operationName=\"OpName\") public void second(); \n" +
+ "}");
+
+ sei = findSei("test.Sei");
+ validator.validate(sei);
+ waitUntilMarkersAppear(seiType.getResource(), WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(2, markers.length);
+
+ assertTrue(((Integer)markers[0].getAttribute(IMarker.CHAR_START)) > 0);
+ assertTrue(((Integer)markers[0].getAttribute(IMarker.CHAR_END)) > 0);
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ assertTrue(((Integer)markers[1].getAttribute(IMarker.CHAR_START)) > 0);
+ assertTrue(((Integer)markers[1].getAttribute(IMarker.CHAR_END)) > 0);
+ assertEquals(IMarker.SEVERITY_ERROR, markers[1].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameIsUniqueExcludedMethod() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {\n" +
+ "@javax.jws.WebMethod(exclude=true) public void first(); \n" +
+ "@javax.jws.WebMethod(operationName=\"first\") public void second(); \n" +
+ "}");
+
+ sei = findSei("test.Sei");
+ validator.validate(sei);
+ waitUntilMarkersAppear(seiType.getResource(), WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ // only the marker for incorrect 'excluded=true' should be available
+ assertEquals(1, markers.length);
+ assertEquals(103, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(107, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ /**
+ * this test currently does nothing because excluded methods are not contained in
+ * the model.
+ *
+ * @throws CoreException
+ */
+ public void testRedundantAttributesForExcludedMethod() throws CoreException
+ {
+// setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public class Sei {\n" +
+// "@javax.jws.WebMethod(exclude=true, operationName=\"OpName\") public void first(); \n" +
+// "}");
+//
+// sei = findSei("test.Sei");
+// IWebService ws = findWs("test.Sei");
+//
+// validator.validate(sei);
+// IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ }
+
+ public void testMethodCannotBeExcludedInSEI() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {\n" +
+ "@javax.jws.WebMethod(exclude=true) public void first(); \n" +
+ "}");
+
+ sei = findSei("test.Sei");
+ validator.validate(sei);
+ waitUntilMarkersAppear(seiType.getResource(), WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(103, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(107, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WpValidationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WpValidationTest.java
new file mode 100755
index 0000000..531fc7a
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WpValidationTest.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsProblemsReporter;
+
+public class WpValidationTest extends ValidationTestsSetUp
+{
+ protected IType seiType;
+ protected IServiceEndpointInterface sei;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ seiType = testProject.createType(testPack, "Sei.java", "@javax.jws.WebService(name=\"SeiName\") public interface Sei {}");
+ sei = findSei(seiType.getFullyQualifiedName());
+ }
+
+ public void testNameIsNCName() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {" +
+ "public void test(@javax.jws.WebParam(name=\"---\")int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(115, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(120, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(2, markers[0].getAttribute(IMarker.LINE_NUMBER));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testPartNameIsNCName() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "import javax.jws.soap.SOAPBinding;\n" +
+ "@SOAPBinding(style=SOAPBinding.Style.RPC)" +
+ "@javax.jws.WebService public interface Sei {" +
+ "public void test(@javax.jws.WebParam(partName=\"---\")int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(179, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(184, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameIsUniqe() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {" +
+ "public void test(@javax.jws.WebParam(name=\"param1\")int a, @javax.jws.WebParam(name=\"param1\")int b); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(2, markers.length);
+
+ IMarker first;
+ IMarker second;
+
+ if (markers[0].getAttribute(IMarker.CHAR_START).equals(new Integer(115)) ) {
+ first = markers[0];
+ second = markers[1];
+ } else {
+ first = markers[1];
+ second = markers[0];
+ }
+
+ assertEquals(115, first.getAttribute(IMarker.CHAR_START));
+ assertEquals(123, first.getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, first.getAttribute(IMarker.SEVERITY));
+ assertEquals(156, second.getAttribute(IMarker.CHAR_START));
+ assertEquals(164, second.getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, second.getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameNotRedundant() throws CoreException
+ {
+ // in RPC style if partName is not present the name is not redundant
+ setContents(seiType.getCompilationUnit(), "import javax.jws.soap.SOAPBinding;\n" +
+ "@SOAPBinding(style=SOAPBinding.Style.RPC)" +
+ "@javax.jws.WebService public interface Sei {" +
+ "public void test(@javax.jws.WebParam(name=\"myName\")int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+
+ public void testNameRedundant() throws CoreException
+ {
+ // in RPC style if partName is present the name is redundant
+ setContents(seiType.getCompilationUnit(), "import javax.jws.soap.SOAPBinding;\n" +
+ "@SOAPBinding(style=SOAPBinding.Style.RPC)" +
+ "@javax.jws.WebService public interface Sei {" +
+ "public void test(@javax.jws.WebParam(name=\"myName\", partName=\"myPart\")int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(175, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(183, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameIsRequired() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "import javax.jws.soap.SOAPBinding;\n" +
+ "@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)" +
+ "@javax.jws.WebService public interface Sei {" +
+ "public int test(@javax.jws.WebParam(mode=WebParam.Mode.INOUT) int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(168, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(213, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testTargetNsValidUri() throws CoreException
+ {
+ setContents(seiType.getCompilationUnit(), "@javax.jws.WebService(name=\"SeiName\") public interface Sei {" +
+ "public void test(@javax.jws.WebParam(targetNamespace=\"^^^\")int a); \n" +
+ "}");
+
+ validator.validate(sei);
+ IMarker [] markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(126, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(131, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WsValidationTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WsValidationTest.java
new file mode 100755
index 0000000..499fed4
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/WsValidationTest.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.WsProblemsReporter;
+import org.eclipse.jst.ws.jaxws.utils.resources.StringInputStreamAdapter;
+
+public class WsValidationTest extends ValidationTestsSetUp
+{
+ private IType wsType;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ wsType = testProject.createType(testPack, "Ws.java", "@javax.jws.WebService(serviceName=\"WsName\") public class Ws {}");
+ }
+
+ public void testServiceNameIsNCName() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(serviceName=\"---\") public class Ws {}");
+ validator.validate(ws);
+
+ markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(47, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(52, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(2, markers[0].getAttribute(IMarker.LINE_NUMBER));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testPortNameIsNCName() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(portName=\"---\") public class Ws {}");
+ validator.validate(ws);
+
+ markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(44, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(49, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testTargetNsIsUri() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(targetNamespace=\"^^^\") public class Ws {}");
+ validator.validate(ws);
+
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(51, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(56, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testSEIExists() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(endpointInterface=\"com.sap.demo.Test\") public class Ws {}");
+ validator.validate(ws);
+
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(53, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(72, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testNameMissingIfSeiReferenced() throws CoreException
+ {
+ final IType sei = testProject.createType(testPack, "Sei.java", "@javax.jws.WebService(name=\"SeiName\") public interface Sei {}");
+ assertNotNull(sei);
+ final IWebService ws = findWs("test.Ws");
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(endpointInterface=\"test.Sei\") public class Ws {}");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"Test\", endpointInterface=\"test.Sei\") public class Ws {}");
+ validator.validate(ws);
+ markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(40, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(46, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testWsdlLocationInProject() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ IFile file = testProject.getProject().getFile("Test.wsdl");
+ file.create(new StringInputStreamAdapter(""), true, null);
+
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"Test\", wsdlLocation=\"Test.wsdl\") public class Ws {}");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ // wrong location
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"Test\", wsdlLocation=\"Test1.wsdl\") public class Ws {}");
+ validator.validate(ws);
+ markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(61, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(73, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testWsdlLocationInMetaInfCorrect() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ final IFolder metaInf = ((IFolder)testProject.getSourceFolder().getResource()).getFolder("META-INF");
+ metaInf.create(true, true, null);
+ IFile file = metaInf.getFile("Test.wsdl");
+ file.create(new StringInputStreamAdapter(""), true, null);
+
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"Test\", wsdlLocation=\"META-INF/Test.wsdl\") public class Ws {}");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+
+ public void testWsdlLocationIncorrect() throws CoreException
+ {
+ final IWebService ws = findWs("test.Ws");
+ // empty location
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(name=\"Test\", wsdlLocation=\"\") public class Ws {}");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(61, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(63, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testEndpointCorrect() throws CoreException
+ {
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService class Ws {}");
+ IWebService ws = findWs("test.Ws");
+ validator.validate(ws);
+ IMarker [] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(13, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(34, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ }
+
+ public void testEndpointImplementsSei() throws CoreException
+ {
+ IType seiType = testProject.createType(testPack, "Sei.java", "@javax.jws.WebService public interface Sei {" +
+ "public void test();" +
+ "public int second(int a, int b, String c);" +
+ "}");
+ setContents(wsType.getCompilationUnit(), "@javax.jws.WebService(endpointInterface=\"test.Sei\") public class Ws {" +
+ "public void test() {}" +
+ "}");
+
+ IWebService ws = findWs("test.Ws");
+
+ validator.validate(ws);
+ IMarker[] markers = wsType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(1, markers.length);
+ assertEquals(IMarker.SEVERITY_ERROR, markers[0].getAttribute(IMarker.SEVERITY));
+ assertEquals(53, markers[0].getAttribute(IMarker.CHAR_START));
+ assertEquals(63, markers[0].getAttribute(IMarker.CHAR_END));
+ assertEquals(2, markers[0].getAttribute(IMarker.LINE_NUMBER));
+
+ markers = seiType.getResource().findMarkers(WsProblemsReporter.MARKER_ID, false, IResource.DEPTH_ZERO);
+ assertEquals(0, markers.length);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/MethodValidatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/MethodValidatorTest.java
new file mode 100755
index 0000000..1314f08
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/MethodValidatorTest.java
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.MethodValidator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.AbstractClassNotImplementedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.ConstructorNotExposableException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.HasInadmisableInnerTypesException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InheritanceAndImplementationExecption;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InterfacesNotSupportedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.MethodNotPublicException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.NoDefaultConstructorException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.RemoteObjectException;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+
+@SuppressWarnings("nls")
+public class MethodValidatorTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "runtime.type.validation.test";
+
+ private MethodValidator validator;
+
+ private IType endpoint;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ createJavaProject(SRC, PCK);
+
+ createClasses("mock/RuntimeClasses.src");
+ endpoint = createClass("mock/Endpoint.src", "Endpoint");
+
+ validator = new MethodValidator();
+ }
+
+ public void testCheckGeneralCases() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // check constructor
+ IMethod method = endpoint.getMethod("Endpoint", emptyParams);
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertTrue(status.getException() instanceof ConstructorNotExposableException);
+
+ // check private method
+ method = endpoint.getMethod("privateMethod", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof MethodNotPublicException);
+
+ // check protected
+ method = endpoint.getMethod("protectedMethod", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof MethodNotPublicException);
+
+ // check use unsupported javax.* class for return type
+ method = endpoint.getMethod("useUnsupportedJavaType", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof NoDefaultConstructorException);
+
+ // check use unsupported javax.* class for return type
+ method = endpoint.getMethod("useSupportedJavaType", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // check use void return type
+ method = endpoint.getMethod("useVoid", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // check use array as return type
+ method = endpoint.getMethod("useArrayAsReturnValue", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // check use array as paramether
+ method = endpoint.getMethod("useArrayAsParam", new String[] { "[I" });
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // check use multy dimention array as paramether
+ method = endpoint.getMethod("useMDArrayAsParam", new String[] { "[[[I" });
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // check use nested generics
+ method = endpoint.getMethod("useNestedGenerics", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+
+ method = endpoint.getMethod("useExtendsInGenerics", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+
+ method = endpoint.getMethod("useSuperInGenerics", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+
+ method = endpoint.getMethod("useSuperInGenericsAsParam", new String[] { "QList<-QString;>;" });
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+
+ // check method returning enum
+ method = endpoint.getMethod("useEnum", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+
+ // check method returning custom map
+ method = endpoint.getMethod("useMyMap", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertNotNull(status.getMessage());
+ assertNull(status.getException());
+ }
+
+ public void testCeckTypesIncompatible() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // use type which doesn't have default constructor
+ IMethod method = endpoint.getMethod("useImplementsRemote", emptyParams);
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof RemoteObjectException);
+
+ // use type which doesn't have default constructor
+ method = endpoint.getMethod("useNoDefaultConstructor", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof NoDefaultConstructorException);
+
+ // use type which has non public non static inner class
+ method = endpoint.getMethod("useHasInadmisableInnerClass", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof HasInadmisableInnerTypesException);
+
+ // use type as paramether which contains unsupported java type as public field
+ String[] params = new String[] { "QUsesUnsupportedAsField;" };
+ method = endpoint.getMethod("useUsesUnsupportedAsField", params);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof NoDefaultConstructorException);
+ }
+
+ public void testCeckTypesIncompatibleImplementation() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // use not implemented abstract class
+ IMethod method = endpoint.getMethod("useNotImplementedAbstractClass", emptyParams);
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof AbstractClassNotImplementedException);
+
+ // use implemented abstract class
+ method = endpoint.getMethod("useImplementedAbstractClass", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+ }
+
+ public void testCheckInterfacesUsed() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // use not implemented interface
+ IMethod method = endpoint.getMethod("useInterface", emptyParams);
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof InterfacesNotSupportedException);
+ }
+
+ public void testCeckTypesIncompatibleInheritance() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // use class that extends custom class and custom interface
+ IMethod method = endpoint.getMethod("useMultyInheritanceUseClass", new String[] { "QMultyInheritanceUseClass;" });
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.ERROR);
+ assertNotNull(status.getMessage());
+ assertTrue(status.getException() instanceof InheritanceAndImplementationExecption);
+
+ // use class that extends class and implements 3 supported interfaces
+ method = endpoint.getMethod("useSupportedMultyInheritanceWithBaseClass", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ // SupportedMultyInheritanceWithInterface
+ method = endpoint.getMethod("useSupportedMultyInheritanceWithInterface", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ method = endpoint.getMethod("useImplementedBaseInGenerics", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+ }
+
+ public void testCeckMethodsWithExceptions() throws Exception
+ {
+ String[] emptyParams = new String[] {};
+
+ // use class that extends java.lang.Exception and custom interface
+ IMethod method = endpoint.getMethod("useCustomException", emptyParams);
+ assertNotNull(method);
+ IStatus status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+
+ method = endpoint.getMethod("useException", emptyParams);
+ assertNotNull(method);
+ status = validator.check(method);
+ assertTrue(status.getSeverity() == IStatus.OK);
+ assertTrue(status.getMessage().equals(""));
+ assertNull(status.getException());
+ }
+
+ public void testCheckMethodWithDefaultAccessInInterface() throws JavaModelException
+ {
+ final String seiCode = "public interface SEIWithDefaultAccessMethod { \n" +
+ " String test(); \n" +
+ "}";
+ final IType seiType = getTestProject().createType(defaultPackage, "SEIWithDefaultAccessMethod.java", seiCode);
+ final IMethod method = seiType.getMethod("test", new String []{});
+ IStatus status = validator.check(method);
+ assertEquals("Default method in SEI reported as incorrect", IStatus.OK, status.getSeverity());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/RuntimeTypeValidatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/RuntimeTypeValidatorTest.java
new file mode 100755
index 0000000..1ec1a3e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/RuntimeTypeValidatorTest.java
@@ -0,0 +1,365 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation;
+
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.dom.runtime.internal.validation.provider.TypeFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.RuntimeTypeValidator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.AbstractClassNotImplementedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.HasInadmisableInnerTypesException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InheritanceAndImplementationExecption;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.InterfacesNotSupportedException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.MultipleImplementationException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.NoDefaultConstructorException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.exceptions.RemoteObjectException;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+
+/**
+ * Test for runtime types validation.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("nls")
+public class RuntimeTypeValidatorTest extends ClassLoadingTest
+{
+ private static String SRC = "src";
+
+ private static String PCK = "runtime.type.validation.test";
+
+ private RuntimeTypeValidator validator;
+
+ @Override
+ protected void setUp() throws Exception // $JL-EXC$
+ {
+ createJavaProject(SRC, PCK);
+
+ createClasses("mock/RuntimeClasses.src");
+ validator = new RuntimeTypeValidator();
+ }
+
+ public void testValidateGeneralCases() throws Exception // $JL-EXC$
+ {
+ // check unsupported javax.* class
+ IType type = TypeFactory.create(getProjectName(), "java.sql.Date");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("NotSupportedJavaType");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+
+ // check supported java type
+ type = TypeFactory.create(getProjectName(), "java.net.URI");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // check unsupported javax.* class used in getter
+ type = TypeFactory.create(getProjectName(), PCK + ".UsesUnsupportedAsProperty");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("UsesUnsupportedAsProperty");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+
+ // uses unsupported in not a getter method
+ type = TypeFactory.create(getProjectName(), PCK + ".UsesUnsupportedInMethod");
+ assertNotNull(type);
+ validator.validate(type);
+
+ }
+
+ public void testJavaSqlTymestampNotSupported() throws Exception
+ {
+ IType type = TypeFactory.create(getProjectName(), "java.sql.Timestamp");
+ try {
+ validator.validate(type);
+ fail("java.sql.Timestamp not detected as unsupported");
+ } catch (NoDefaultConstructorException _) {
+ }
+ }
+
+ public void testValidateNoDefaultConstructor() throws Exception // $JL-EXC$
+ {
+ // use type which doesn't have default constructor
+ IType type = TypeFactory.create(getProjectName(), PCK + ".NoDefaultConstructor");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("NoDefaultConstructor");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+
+ type = TypeFactory.create(getProjectName(), PCK + ".NoDefaultConstructorPrivateConstructors");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("NoDefaultConstructorPrivateConstructors");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testUsesUnsupportedInTransientMethod() throws Exception
+ {
+ // uses unsupported in xml transient method
+ IType type = TypeFactory.create(getProjectName(), PCK + ".UsesUnsupportedInTransientMethod");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testXmlTypeAnnotated() throws Exception
+ {
+ IType type = TypeFactory.create(getProjectName(), PCK + ".XmlTypeClass");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ } catch (NoDefaultConstructorException e)
+ {
+ fail("XML Type annotated class not recognized");
+ }
+ }
+
+ public void testWebFaultAnnotated() throws Exception
+ {
+ IType type = TypeFactory.create(getProjectName(), PCK + ".WebFaultClass");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ } catch (NoDefaultConstructorException e)
+ {
+ fail("Web Fault annotated class not recognized");
+ }
+ }
+
+ public void testValidateCustomCollection() throws Exception // $JL-EXC$
+ {
+ IType type = TypeFactory.create(getProjectName(), PCK + ".MySet");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testValidateCustomMap() throws Exception // $JL-EXC$
+ {
+ IType type = TypeFactory.create(getProjectName(), PCK + ".MyMap");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testValidateTypesIncompatible() throws Exception // $JL-EXC$
+ {
+ // use type which doesn't have default constructor
+ IType type = TypeFactory.create(getProjectName(), PCK + ".ImplementsRemote");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("ImplementsRemote");
+ } catch (RemoteObjectException e)
+ {
+ assertTrue(true);
+ }
+
+ // use type which has non public non static inner class
+ type = TypeFactory.create(getProjectName(), PCK + ".HasInadmisableInnerClass");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("ImplementsRemote");
+ } catch (HasInadmisableInnerTypesException e)
+ {
+ assertTrue(true);
+ }
+
+ // use type as paramether which contains unsupported java type as public field
+ type = TypeFactory.create(getProjectName(), PCK + ".UsesUnsupportedAsField");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("ImplementsRemote");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testValidateTypesIncompatibleImplementation() throws Exception
+ {
+ // use not implemented abstract class
+ IType type = TypeFactory.create(getProjectName(), PCK + ".BaseNotImplemented");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("ImplementsRemote");
+ } catch (AbstractClassNotImplementedException e)
+ {
+ assertTrue(true);
+ }
+
+ // use implemented abstract class
+ type = TypeFactory.create(getProjectName(), PCK + ".BaseImplemented");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // use interface
+ type = TypeFactory.create(getProjectName(), PCK + ".InterfaceImplemented");
+ assertNotNull(type);
+ try
+ {
+ // use implemented interface
+ validator.validate(type);
+ } catch (InterfacesNotSupportedException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testValidateTypesIncompatibleInheritance() throws Exception
+ {
+ // use class that extends custom class and custom interface
+ IType type = TypeFactory.create(getProjectName(), PCK + ".MultyInheritanceUseClass");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("MultyInheritanceUseClass");
+ } catch (InheritanceAndImplementationExecption e)
+ {
+ assertTrue(true);
+ }
+
+ // use multy inheritance with 2 implemented interfaces
+ type = TypeFactory.create(getProjectName(), PCK + ".MultyInheritanceUseInterfaces");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("MultyInheritanceUseInterfaces");
+ } catch (MultipleImplementationException e)
+ {
+ assertTrue(true);
+ }
+
+ // use class that extends class and implements 3 supported interfaces
+ type = TypeFactory.create(getProjectName(), PCK + ".SupportedMultyInheritanceWithBaseClass");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // SupportedMultyInheritanceWithInterface
+ type = TypeFactory.create(getProjectName(), PCK + ".SupportedMultyInheritanceWithInterface");
+ assertNotNull(type);
+ validator.validate(type);
+
+ type = TypeFactory.create(getProjectName(), PCK + ".BaseImplementedNotCorrectly");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("MultyInheritanceUseClass");
+ } catch (AbstractClassNotImplementedException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testValidateTypesUsingGenerics() throws Exception
+ {
+ // check supported type in list using generics
+ IType type = TypeFactory.create(getProjectName(), PCK + ".ContainsList");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // check not supported type in list using generics
+ type = TypeFactory.create(getProjectName(), PCK + ".ContainsNotSupportedInList");
+ assertNotNull(type);
+ try
+ {
+ validator.validate(type);
+ fail("ContainsNotSupportedInList");
+ } catch (NoDefaultConstructorException e)
+ {
+ assertTrue(true);
+ }
+
+ // check supported type in list using quote
+ type = TypeFactory.create(getProjectName(), PCK + ".ContainsQuoteInList");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // check supported type in list using quote
+ type = TypeFactory.create(getProjectName(), PCK + ".ContainsExtendsInList");
+ assertNotNull(type);
+ validator.validate(type);
+
+ type = TypeFactory.create(getProjectName(), PCK + ".ContainsSuperInList");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testValidateTypesCircularReference() throws Exception
+ {
+ // check circular reference via member varibles
+ IType type = TypeFactory.create(getProjectName(), PCK + ".CircularAsParamA");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // check circular reference via return values
+ type = TypeFactory.create(getProjectName(), PCK + ".CircularAsReturnValueB");
+ assertNotNull(type);
+ validator.validate(type);
+
+ // check circular reference via member and return value
+ type = TypeFactory.create(getProjectName(), PCK + ".CircularAsMixedParamReturnValueA");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testValidateEnumType() throws Exception
+ {
+ IType type = TypeFactory.create(getProjectName(), PCK + ".EnumType");
+ assertNotNull(type);
+ validator.validate(type);
+ }
+
+ public void testValidateInterfaceInObjectFactory() throws Exception
+ {
+ final String PCK1 = "org.eclipse.test.implemented";
+ final IPackageFragment pack = getTestProject().createPackage(PCK1);
+
+ final IType type = getTestProject().createType(pack, "ImplementedInterface.java", "public interface ImplementedInterface {}");
+ getTestProject().createType(pack, "ObjectFactory.java",
+ "public class ObjectFactory {" +
+ " public ImplementedInterface createImplementedInterface() {" +
+ " return null;" +
+ " }" +
+ "}");
+
+ assertNotNull(type);
+ validator.validate(type);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SEIImplementationValidatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SEIImplementationValidatorTest.java
new file mode 100755
index 0000000..a340c25
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SEIImplementationValidatorTest.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.SeiImplementationValidator;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+
+public class SEIImplementationValidatorTest extends ClassLoadingTest
+{
+ private static final String PCK = "org.eclipse.tests";
+
+ @Override
+ public void setUp() throws Exception
+ {
+ createJavaProject("src", PCK);
+ createClasses("mock/SEITests.src");
+ }
+
+ public void testUseClassForSEI() throws Exception
+ {
+ try
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".SEIIsClass");
+ new SeiImplementationValidator(seiType);
+ assertTrue("IllegalArgumentException not thrown", false);
+ } catch (IllegalArgumentException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ /**
+ * Test wrong implementation via not same params and return type.
+ *
+ * @throws JavaModelException
+ */
+ public void testBeanDoesNotImplemetsSeiDifferentMethodParams() throws JavaModelException
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".INotImplemented");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".NotImplementedMethodParamsBean");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.ERROR, status.getSeverity());
+ }
+
+ /**
+ * Test wrong implementation different method exceptioins.
+ *
+ * @throws JavaModelException
+ */
+ public void testBeanDoesNotImplemetsSeiDifferentExceptions() throws JavaModelException
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".INotImplemented");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".NotImplementedMethodExceptionsBean");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.ERROR, status.getSeverity());
+ }
+
+ /**
+ * Tests the case when the bean implements the Sei by declaring the implementation.
+ *
+ * @throws Exception
+ */
+ public void testBeanImplementsSei() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IImplemented");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".BeanImplementsSei");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Staus not correct", IStatus.OK, status.getSeverity());
+ }
+
+ /**
+ * Tests the case when the bean implements methods from Sei withot directly implementing it via java declaration.
+ *
+ * @throws Exception
+ */
+ public void testSEIImplemented() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IImplemented");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".ImplementedBean");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Staus not correct", IStatus.OK, status.getSeverity());
+ }
+
+ public void testSEIImplementedExtended() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IImplementedExtended");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".ImplementedExtendedBean");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.OK, status.getSeverity());
+ }
+
+ public void testSEIImplementedNonPublicMethods() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IImplemented");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".ImplementedBean1");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.ERROR, status.getSeverity());
+ }
+
+ public void testSEIImplementedWrongExceptions() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IExceptionsUsed");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".ExceptionsUsedBean");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.ERROR, status.getSeverity());
+ }
+
+ public void testSEIImplementedRightExceptions() throws Exception
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IExceptionsUsed");
+ IType beanType = getTestProject().getJavaProject().findType(PCK + ".ExceptionsUsedBean1");
+
+ SeiImplementationValidator validator = new SeiImplementationValidator(seiType);
+ IStatus status = validator.validate(beanType);
+ assertEquals("Status not correct", IStatus.OK, status.getSeverity());
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SeiValidatorTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SeiValidatorTest.java
new file mode 100755
index 0000000..8aee6d3
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/SeiValidatorTest.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.runtime.tests.validation;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.provider.SeiValidator;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+
+/**
+ * Class testing {@link SeiValidator}
+ *
+ * @author Georgi Vachkov
+ */
+public class SeiValidatorTest extends ClassLoadingTest
+{
+ private static final String PCK = "org.eclipse.tests";
+
+ private SeiValidator validator = new SeiValidator();
+
+ @Override
+ public void setUp() throws Exception
+ {
+ createJavaProject("src", PCK);
+ createClasses("mock/SEITests.src");
+ }
+
+ /**
+ * Tests incorrect interface declarations
+ *
+ * @throws Exception
+ */
+ public void testUseIncorrectSEI() throws JavaModelException
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".SEIIsClass");
+ IStatus status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+
+ // testUseBinaryInterfaceForSEI
+ seiType = getTestProject().getJavaProject().findType("java.util.List");
+ status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+
+ seiType = getTestProject().getJavaProject().findType(PCK + ".SEIIsClass.InternalSei");
+ status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+
+ seiType = getTestProject().getJavaProject().findType(PCK + ".SEINotPublic");
+ status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+ }
+
+ /**
+ * Tests incorrect interface methds
+ *
+ * @throws Exception
+ */
+ public void testUseIncorrectSeiMethods() throws JavaModelException
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".SEIIncorrectMethods");
+ IStatus status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+
+ seiType = getTestProject().getJavaProject().findType(PCK + ".SEIExtendsSeiWithIncorrectMethods");
+ status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.ERROR);
+ assertTrue("Message is missing", status.getMessage().trim().length() > 0);
+ }
+
+ public void testUseCorrectSei() throws JavaModelException
+ {
+ IType seiType = getTestProject().getJavaProject().findType(PCK + ".IImplemented");
+ IStatus status = validator.validate(seiType);
+
+ assertEquals("Severity not correct", status.getSeverity(), IStatus.OK);
+ assertTrue("Message is not empty", status.getMessage().trim().length() == 0);
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/Endpoint.src b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/Endpoint.src
new file mode 100755
index 0000000..9e75050
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/Endpoint.src
@@ -0,0 +1,120 @@
+import java.util.List;
+import java.util.Map;
+
+public class Endpoint
+{
+ public Endpoint() {
+ }
+
+ public void useVoid() {
+ }
+
+ private void privateMethod() {
+ }
+
+ protected void protectedMethod() {
+ }
+
+ public int[] useArrayAsReturnValue() {
+ return new int[0];
+ }
+
+ public int useArrayAsParam(int [] arr) {
+ return 0;
+ }
+
+ public java.util.List<String> useGenericsAs() {
+ return null;
+ }
+
+ public MyMap<String, String> useMyMap() {
+ return null;
+ }
+
+ public java.util.List<?> useGenericsAs() {
+ return null;
+ }
+
+ public int useMDArrayAsParam(int [][][] arr) {
+ return 0;
+ }
+
+ public List<List<Map<String, String>>> useNestedGenerics() {
+ return null;
+ }
+
+ public List<? extends String> useExtendsInGenerics() {
+ return null;
+ }
+
+ public List<? super String> useSuperInGenerics() {
+ return null;
+ }
+
+ public List<List<String>> useSuperInGenericsAsParam(List<? super String> param) {
+ return null;
+ }
+
+ public List<BaseImplemented> useImplementedBaseInGenerics() {
+ return null;
+ }
+
+ public javax.crypto.Cipher useUnsupportedJavaType() {
+ return null;
+ }
+
+ public java.net.URI useSupportedJavaType() {
+ }
+
+ public ImplementsRemote useImplementsRemote() {
+ }
+
+ public NoDefaultConstructor useNoDefaultConstructor() {
+ return null;
+ }
+
+ public HasInadmisableInnerClass useHasInadmisableInnerClass() {
+ return null;
+ }
+
+ public void useUsesUnsupportedAsField(UsesUnsupportedAsField param) {
+ return null;
+ }
+
+ // Implementation cases
+ public BaseNotImplemented useNotImplementedAbstractClass() {
+ return null;
+ }
+
+ public BaseImplemented useImplementedAbstractClass() {
+ return null;
+ }
+
+ public InterfaceImplemented useInterface() {
+ return null;
+ }
+
+ public EnumType useEnum() {
+ return null;
+ }
+
+ // Inheritance cases
+ public void useMultyInheritanceUseClass(MultyInheritanceUseClass param) {
+ return null;
+ }
+
+ public SupportedMultyInheritanceWithBaseClass useSupportedMultyInheritanceWithBaseClass() {
+ return null;
+ }
+
+ public SupportedMultyInheritanceWithInterface useSupportedMultyInheritanceWithInterface() {
+ return null;
+ }
+
+ // Using exceptions methods
+ public void useException() throws java.lang.Exception {
+ }
+
+ public void useCustomException() throws CustomException {
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/RuntimeClasses.src b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/RuntimeClasses.src
new file mode 100755
index 0000000..347657b
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/RuntimeClasses.src
@@ -0,0 +1,281 @@
+
+#ImplementsRemote
+public class ImplementsRemote implements java.rmi.Remote
+{
+}
+
+#NoDefaultConstructor
+public class NoDefaultConstructor implements java.io.Serializable
+{
+ public NoDefaultConstructor(String param) {
+ }
+}
+
+#NoDefaultConstructorPrivateConstructors
+public class NoDefaultConstructorPrivateConstructors implements java.io.Serializable
+{
+ private NoDefaultConstructorPrivateConstructors(String param) {
+ }
+}
+
+#HasInadmisableInnerClass
+public class HasInadmisableInnerClass implements java.io.Serializable
+{
+ public class InnerClass {
+ }
+}
+
+#UsesUnsupportedAsField
+public class UsesUnsupportedAsField implements java.io.Serializable
+{
+ public java.util.logging.LogRecord field;
+}
+
+#UsesUnsupportedAsProperty
+public class UsesUnsupportedAsProperty implements java.io.Serializable
+{
+ public UsesUnsupportedAsProperty() {
+ }
+
+ public NoDefaultConstructor[] getRecord() {
+ return null;
+ }
+}
+
+#UsesUnsupportedInMethod
+public class UsesUnsupportedInMethod
+{
+ public java.util.logging.LogRecord [][] otherMethod() {
+ return null;
+ }
+
+ public java.util.logging.LogRecord [][] validate() {
+ return null;
+ }
+}
+
+#UsesUnsupportedInTransientMethod
+import javax.xml.bind.annotation.XmlTransient;
+public class UsesUnsupportedInTransientMethod
+{
+ @XmlTransient
+ public java.util.logging.LogRecord getLogRecord() {
+ return null;
+ }
+}
+
+#WebFaultClass
+import javax.xml.ws.WebFault;
+@WebFault
+public class WebFaultClass
+{
+ public WebFaultClass(String a) {
+ }
+}
+
+#XmlTypeClass
+import javax.xml.bind.annotation.XmlType;
+@XmlType
+public class XmlTypeClass
+{
+ public XmlTypeClass(String a) {
+ }
+}
+
+#BaseNotImplemented
+public abstract class BaseNotImplemented
+{
+}
+
+#BaseImplementedNotCorrectly
+public abstract class BaseImplementedNotCorrectly
+{
+}
+
+#BaseImplementedNotCorrectlyExtendor
+public abstract class BaseImplementedNotCorrectlyExtendor
+{
+}
+
+#BaseImplementedNotCorrectlyImplementor
+public class BaseImplementedNotCorrectlyImplementor extends BaseImplementedNotCorrectlyExtendor
+{
+}
+
+#BaseImplemented
+public abstract class BaseImplemented
+{
+}
+
+#BaseImplementedImplementor
+public class BaseImplementedImplementor extends BaseImplemented implements java.io.Serializable
+{
+}
+
+#InterfaceNotImplemented
+public interface InterfaceNotImplemented
+{
+}
+
+#InterfaceImplemented
+public interface InterfaceImplemented
+{
+}
+
+#InterfaceImplementedImplementor
+public class InterfaceImplementedImplementor implements InterfaceImplemented, java.io.Serializable
+{
+}
+
+#EnumType
+public enum EnumType {
+ StringType,
+ IntType,
+ FloatType
+}
+
+#MultyInheritanceUseClass
+public class MultyInheritanceUseClass extends BaseImplemented implements InterfaceImplemented, java.io.Serializable
+{
+}
+
+#MultyInheritanceUseInterfaces
+public class MultyInheritanceUseInterfaces implements InterfaceImplemented, InterfaceNotImplemented
+{
+}
+
+#SupportedMultyInheritanceWithBaseClass
+public class SupportedMultyInheritanceWithBaseClass extends BaseImplemented implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable {
+ public int compareTo(Object arg0) {
+ return 0;
+ }
+}
+
+#SupportedMultyInheritanceWithInterface
+public class SupportedMultyInheritanceWithInterface implements InterfaceImplemented, java.io.Serializable, Cloneable, Comparable {
+ public int compareTo(Object arg0) {
+ return 0;
+ }
+}
+
+#ContainsList
+public class ContainsList implements java.io.Serializable {
+ public java.util.Map<String, java.util.List<String>> param;
+}
+
+#ContainsNotSupportedInList
+public class ContainsNotSupportedInList implements java.io.Serializable {
+ public java.util.List<java.util.logging.LogRecord> param;
+}
+
+#ContainsQuoteInList
+public class ContainsQuoteInList implements java.io.Serializable {
+ public java.util.List<?> param;
+}
+
+#ContainsExtendsInList
+public class ContainsExtendsInList implements java.io.Serializable {
+ public java.util.List<? extends String> param;
+}
+
+#ContainsSuperInList
+public class ContainsSuperInList implements java.io.Serializable {
+ public java.util.List<? super String> param;
+}
+
+#CircularAsParamA
+public class CircularAsParamA implements java.io.Serializable
+{
+ public CircularAsParamB cB;
+}
+
+#CircularAsParamB
+public class CircularAsParamB implements java.io.Serializable
+{
+ public CircularAsParamA cA;
+}
+
+#CircularAsReturnValueA
+public class CircularAsReturnValueA implements java.io.Serializable
+{
+ public CircularAsReturnValueB returnCB() {
+ return null;
+ }
+}
+
+#CircularAsReturnValueB
+public class CircularAsReturnValueB implements java.io.Serializable
+{
+ public CircularAsReturnValueA returnCA() {
+ return null;
+ }
+}
+
+#CircularAsMixedParamReturnValueA
+public class CircularAsMixedParamReturnValueA implements java.io.Serializable
+{
+ public CircularAsMixedParamReturnValueB cB;
+}
+
+#CircularAsMixedParamReturnValueB
+public class CircularAsMixedParamReturnValueB implements java.io.Serializable
+{
+ public CircularAsMixedParamReturnValueA returnCA() {
+ return null;
+ }
+
+ public void useCa(CircularAsMixedParamReturnValueA cA) {
+ }
+}
+
+#CustomException
+public class CustomException extends java.lang.Exception implements InterfaceImplemented
+{
+ public CustomException()
+ {
+ super();
+ }
+}
+
+#MySet
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+public class MySet<T> implements Set<T>
+{
+ public boolean add(T o) { return false; }
+ public boolean addAll(Collection<? extends T> c) { return false; }
+ public void clear() {}
+ public boolean contains(Object o) { return false; }
+ public boolean containsAll(Collection<?> c) { return false; }
+ public boolean isEmpty() { return false; }
+ public Iterator<T> iterator() { return null; }
+ public boolean remove(Object o) { return false;}
+ public boolean removeAll(Collection<?> c) { return false; }
+ public boolean retainAll(Collection<?> c) { return false; }
+ public int size() { return 0; }
+ public Object[] toArray() { return null; }
+ public <T> T[] toArray(T[] a) { return null;}
+}
+
+#MyMap
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+public class MyMap<K, V> implements Map<K, V>
+{
+ public void clear() {}
+ public boolean containsKey(Object key) { return false; }
+ public boolean containsValue(Object value) { return false; }
+ public Set<java.util.Map.Entry<K, V>> entrySet() { return null; }
+ public V get(Object key) { return null; }
+ public boolean isEmpty() { return false; }
+ public Set<K> keySet() { return null; }
+ public V put(K key, V value) { return null; }
+ public void putAll(Map<? extends K, ? extends V> t) {}
+ public V remove(Object key) { return null; }
+ public int size() { return 0; }
+ public Collection<V> values() { return null; }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/SEITests.src b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/SEITests.src
new file mode 100755
index 0000000..80fb196
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/validation/mock/SEITests.src
@@ -0,0 +1,146 @@
+#SEIIsClass
+public class SEIIsClass
+{
+ public SEIIsClass(String a) {
+ }
+
+ public interface InternalSei {
+ }
+}
+
+#SEINotPublic
+interface SEINotPublic
+{
+}
+
+#SEIIncorrectMethods
+public interface SEIIncorrectMethods
+{
+ public SEIIsClass method1();
+}
+
+#SEIExtendsSeiWithIncorrectMethods
+public interface SEIExtendsSeiWithIncorrectMethods extends SEIIncorrectMethods
+{
+ public String method2();
+}
+
+
+#INotImplemented
+import java.util.List;
+import java.util.Map;
+public interface INotImplemented
+{
+ public List<String> method(String param) throws Exception;
+}
+
+#NotImplementedMethodParamsBean
+import java.util.List;
+import java.util.Map;
+public class NotImplementedMethodParamsBean
+{
+ public String method(String a) {}
+
+ public List<String> method(int a) {}
+
+ public List<String> method(String param, int a) {}
+
+ public void method1(Map<String, List> p) {}
+}
+
+#NotImplementedMethodExceptionsBean
+import java.util.List;
+import java.util.Map;
+public class NotImplementedMethodExceptionsBean
+{
+ public List<String> method(String param) throws java.io.IOException {
+ return null;
+ }
+}
+
+#IImplemented
+import java.util.List;
+import java.util.Map;
+public interface IImplemented
+{
+ public List<String> method(String param);
+
+ public void method1(Map<String, List> p);
+}
+
+#ImplementedBeanBase
+import java.util.List;
+public class ImplementedBeanBase {
+ public List<String> method(String param) { return null; }
+}
+
+#BeanImplementsSei
+import java.util.List;
+import java.util.Map;
+public class BeanImplementsSei extends ImplementedBeanBase implements IImplemented {
+ public void method1(Map<String, List> p) {}
+}
+
+#ImplementedBean
+import java.util.List;
+import java.util.Map;
+public class ImplementedBean extends ImplementedBeanBase {
+ public void method1(Map<String, List> p) {}
+}
+
+
+#IImplementedExtended
+import java.util.List;
+import java.util.Map;
+public interface IImplementedExtended extends IImplemented
+{
+ public int [] method2(String p1, float p2);
+
+ public String [][] method3(double p1);
+}
+
+#ImplementedExtendedBean
+import java.util.List;
+import java.util.Map;
+public class ImplementedExtendedBean
+{
+ public List<String> method(String param) { return null; }
+
+ public void method1(Map<String, List> p) {}
+
+ public int [] method2(String p1, float p2) { return null; }
+
+ public String [][] method3(double p1) { return null; }
+}
+
+#ImplementedBean1
+import java.util.List;
+import java.util.Map;
+// should implement IImplemented
+public class ImplementedBean1 {
+ public List<String> method(String param) { return null; }
+
+ protected void method1(Map<String, List> p) {}
+}
+
+#MyException
+public class MyException extends Exception {
+}
+
+#IExceptionsUsed
+public interface IExceptionsUsed {
+ public void method() throws MyException;
+ public void method1() throws java.lang.Exception;
+}
+
+#ExceptionsUsedBean
+public class ExceptionsUsedBean {
+ public void method() {}
+ public void method1() throws Exception {}
+}
+
+#ExceptionsUsedBean1
+public class ExceptionsUsedBean1 {
+ public void method() throws org.eclipse.tests.MyException {}
+ public void method1() throws Exception {}
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.classpath b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.project b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.project
new file mode 100755
index 0000000..e347d1e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..d99b551
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DOM UI Tests (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.ui.tests
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.jst.ws.jaxws.dom.ui
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.jmock,
+ org.eclipse.jst.ws.jaxws.testutils,
+ org.junit
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/about.html b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/about.html
new file mode 100644
index 0000000..d2b7ace
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 20, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/build.properties b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/build.properties
new file mode 100755
index 0000000..2ff2ea1
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/AllTestsSuite.java b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/AllTestsSuite.java
new file mode 100755
index 0000000..92b4d86
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/AllTestsSuite.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jst.ws.jaxws.dom.ui.tests.internal.AllDomItemProviderTest;
+import org.eclipse.jst.ws.jaxws.dom.ui.tests.internal.DOMItemPropertyProviderTest;
+
+public class AllTestsSuite
+{
+ public static Test suite()
+ {
+ final TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(AllDomItemProviderTest.class);
+ suite.addTestSuite(DOMItemPropertyProviderTest.class);
+
+ return suite;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/AllDomItemProviderTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/AllDomItemProviderTest.java
new file mode 100755
index 0000000..e638ceb
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/AllDomItemProviderTest.java
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.tests.internal;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor.PropertyValueWrapper;
+import org.eclipse.jst.ws.jaxws.dom.runtime.IPropertyState;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WebParamKind;
+import org.eclipse.jst.ws.jaxws.dom.ui.DomItemProviderAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.ui.IJavaWebServiceElementItemProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.IServiceEndpointInterfaceItemProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.IWebMethodItemProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.IWebParamItemProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.IWebServiceItemProvider;
+import org.eclipse.jst.ws.jaxws.dom.ui.IWebServiceProjectItemProvider;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.jmock.Mock;
+
+public class AllDomItemProviderTest extends MockObjectTestCase
+{
+ private DomItemProviderAdapterFactory itemProvider;
+
+ @Override
+ public void setUp()
+ {
+ itemProvider = new DomItemProviderAdapterFactory();
+ }
+
+ @Override
+ public void tearDown()
+ {
+ itemProvider.dispose();
+ }
+
+ public void testDOMItemProvider()
+ {
+ assertNotNull(itemProvider.getRootAdapterFactory());
+ itemProvider.setParentAdapterFactory(null);
+ assertNotNull(itemProvider.getRootAdapterFactory());
+ itemProvider.removeListener(null);
+ assertNotNull(itemProvider.getRootAdapterFactory());
+ }
+
+ public void testIJavaWebServiceElementItemProvider()
+ {
+ IJavaWebServiceElementItemProvider javaItemProvider = (IJavaWebServiceElementItemProvider) itemProvider.createIJavaWebServiceElementAdapter();
+
+ assertNotNull(javaItemProvider);
+
+ List<IItemPropertyDescriptor> propDescs = javaItemProvider.getPropertyDescriptors(null);
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ Mock javaWSElem = mock(IJavaWebServiceElement.class);
+ javaWSElem.expects(once()).method("getName").will(returnValue("TestName"));
+ assertNotNull(javaItemProvider.getImage(new Object()));
+ assertNotNull(javaItemProvider.getText(javaWSElem.proxy()));
+ assertNull(javaItemProvider.getNameCategory());
+ }
+
+ public void testIServiceEndpointItemProvider()
+ {
+ IServiceEndpointInterfaceItemProvider seiItemProvider = (IServiceEndpointInterfaceItemProvider) itemProvider.createIServiceEndpointInterfaceAdapter();
+
+ assertNotNull(seiItemProvider);
+
+ List<IItemPropertyDescriptor> propDescs = seiItemProvider.getPropertyDescriptors(null);
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ Mock sEIElem = mock(IServiceEndpointInterface.class);
+ sEIElem.expects(once()).method("getName").will(returnValue("TestName"));
+ assertNotNull(seiItemProvider.getImage(new Object()));
+ assertNotNull(seiItemProvider.getText(sEIElem.proxy()));
+ assertNotNull(seiItemProvider.getChildrenFeatures(null));
+ assertNotNull(seiItemProvider.getNameCategory());
+ }
+
+ public void testIWebMethodItemProvider()
+ {
+ IWebMethodItemProvider methodItemProvider = (IWebMethodItemProvider) itemProvider.createIWebMethodAdapter();
+
+ assertNotNull(methodItemProvider);
+
+ List<IItemPropertyDescriptor> propDescs = methodItemProvider.getPropertyDescriptors(null);
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ Mock wMElem = mock(IWebMethod.class);
+ wMElem.expects(once()).method("getName").will(returnValue("TestName"));
+ assertNotNull(methodItemProvider.getImage(new Object()));
+ assertNotNull(methodItemProvider.getText(wMElem.proxy()));
+ assertNotNull(methodItemProvider.getChildrenFeatures(null));
+ assertNotNull(methodItemProvider.getNameCategory());
+ }
+
+ public void testIWebServiceItemProvider()
+ {
+ IWebServiceItemProvider wsItemProvider = (IWebServiceItemProvider) itemProvider.createIWebServiceAdapter();
+
+ assertNotNull(wsItemProvider);
+
+ List<IItemPropertyDescriptor> propDescs = wsItemProvider.getPropertyDescriptors(null);
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ Mock wsElem = mock(IWebService.class);
+ wsElem.expects(once()).method("getName").will(returnValue("TestName"));
+ assertNotNull(wsItemProvider.getImage(new Object()));
+ assertNotNull(wsItemProvider.getText(wsElem.proxy()));
+ assertNotNull(wsItemProvider.getNameCategory());
+ }
+
+ public void testIWebServiceProjectItemProvider()
+ {
+ IWebServiceProjectItemProvider wsProjItemProvider = (IWebServiceProjectItemProvider) itemProvider.createIWebServiceProjectAdapter();
+
+ assertNotNull(wsProjItemProvider);
+
+ List<IItemPropertyDescriptor> propDescs = wsProjItemProvider.getPropertyDescriptors(null);
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ Mock wsProjElem = mock(IWebServiceProject.class);
+ wsProjElem.expects(once()).method("getName").will(returnValue("TestName"));
+ assertNotNull(wsProjItemProvider.getImage(new Object()));
+ assertNotNull(wsProjItemProvider.getText(wsProjElem.proxy()));
+ assertNotNull(wsProjItemProvider.getChildrenFeatures(null));
+ }
+
+ public void testIWebMethodItemProviderGetImplementation()
+ {
+ IWebMethodItemProvider methodItemProvider = (IWebMethodItemProvider) itemProvider.createIWebMethodAdapter();
+ assertNotNull(methodItemProvider);
+
+ Mock webParam1 = mock(IWebParam.class);
+ webParam1.expects(atLeastOnce()).method("getName").will(returnValue("Param1"));
+ webParam1.expects(atLeastOnce()).method("getTypeName").will(returnValue("boolean"));
+ Mock webParam2 = mock(IWebParam.class);
+ webParam2.expects(atLeastOnce()).method("getName").will(returnValue("return"));
+ webParam2.expects(atLeastOnce()).method("getTypeName").will(returnValue("java.lang.String"));
+ org.eclipse.emf.common.util.EList<IWebParam> webParams = new org.eclipse.emf.common.util.BasicEList<IWebParam>();
+ webParams.add((IWebParam)webParam1.proxy());
+ webParams.add((IWebParam)webParam2.proxy());
+ Mock webMethod = mock(IWebMethod.class);
+ webMethod.expects(atLeastOnce()).method("getParameters").will(returnValue(webParams));
+ webMethod.expects(atLeastOnce()).method("getImplementation").will(returnValue("testMethod(B)QString"));
+
+ BasicEList<StateAdapter> adapters = new org.eclipse.emf.common.util.BasicEList<StateAdapter>();
+ Mock adapter = mock(StateAdapter.class);
+ adapter.stubs().method("isAdapterForType").will(returnValue(true));
+ adapter.stubs().method("isChangeable").will(returnValue(false));
+ adapters.add((StateAdapter)adapter.proxy());
+
+ webMethod.expects(atLeastOnce()).method("eAdapters").will(returnValue(adapters));
+ ((IWebMethod)webMethod.proxy()).eAdapters();
+ methodItemProvider.setTarget((Notifier)webMethod.proxy());
+ List<IItemPropertyDescriptor> propDescs = methodItemProvider.getPropertyDescriptors(webMethod.proxy());
+
+ assertNotNull(propDescs);
+ assertTrue(propDescs.size() > 0);
+
+ for(IItemPropertyDescriptor propDesc : propDescs)
+ {
+ if(propDesc.getFeature(null).equals(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION))
+ {
+ assertEquals(((PropertyValueWrapper)propDesc.getPropertyValue(webMethod.proxy())).getText(null), "String testMethod(boolean)");
+ }
+ }
+ }
+
+ public void testIWebParamItemProvider()
+ {
+ IWebParamItemProvider itemProvider = (IWebParamItemProvider) new DomItemProviderAdapterFactory().createIWebParamAdapter();
+ Mock paramMock = mock(IWebParam.class);
+ assertNotNull(itemProvider.getImage(new Object()));
+
+ paramMock.stubs().method("getName").will(returnValue("myParam"));
+ paramMock.stubs().method("getTypeName").will(returnValue("java.util.List"));
+ paramMock.stubs().method("getImplementation").will(returnValue("test"));
+ paramMock.stubs().method("eContainer").will(returnValue(null));
+ paramMock.stubs().method("eResource").will(returnValue(null));
+
+ assertEquals("myParam", itemProvider.getText(paramMock.proxy()));
+ assertNotNull(itemProvider.getImage(paramMock.proxy()));
+ assertNotNull(itemProvider.getNameCategory());
+ paramMock.stubs().method("getImplementation").will(returnValue("return"));
+ assertNotNull(itemProvider.getImage(paramMock.proxy()));
+ }
+
+ public void testIWebParamItemProviderForTypeName()
+ {
+ // IWebParamItemProvider itemProvider = (IWebParamItemProvider) new DomItemProviderAdapterFactory().createIWebParamAdapter();
+ final IItemPropertyDescriptor typeNamePropertyDescriptor = findWebParamItemPropertyDescriptor(DomPackage.Literals.IWEB_PARAM__TYPE_NAME);
+
+ final IWebParam webParam = DomFactory.eINSTANCE.createIWebParam();
+ webParam.setHeader(true);
+ webParam.setKind(WebParamKind.INOUT);
+ webParam.setName("anyName"); //$NON-NLS-1$
+ webParam.setPartName("anyPartName"); //$NON-NLS-1$
+ webParam.setTargetNamespace("anyTargetNamespace"); //$NON-NLS-1$
+ ((EObject) webParam).eSet(DomPackage.Literals.IWEB_PARAM__TYPE_NAME, null);
+
+ assertNull("Unexpected value.", typeNamePropertyDescriptor.getPropertyValue(webParam)); //$NON-NLS-1$
+
+ Object propertyValueWrapper = null;
+
+ ((EObject) webParam).eSet(DomPackage.Literals.IWEB_PARAM__TYPE_NAME, "I"); //$NON-NLS-1$
+ propertyValueWrapper = typeNamePropertyDescriptor.getPropertyValue(webParam);
+ assertEquals("Unresolved value.", "int", ((IItemPropertySource) propertyValueWrapper).getEditableValue(null)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ((EObject) webParam).eSet(DomPackage.Literals.IWEB_PARAM__TYPE_NAME, "[QString;"); //$NON-NLS-1$
+ propertyValueWrapper = typeNamePropertyDescriptor.getPropertyValue(webParam);
+ assertEquals("Unresolved value.", "String[]", ((IItemPropertySource) propertyValueWrapper).getEditableValue(null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private IItemPropertyDescriptor findWebParamItemPropertyDescriptor(final EAttribute attribute)
+ {
+ final IWebParamItemProvider itemProvider = (IWebParamItemProvider) new DomItemProviderAdapterFactory().createIWebParamAdapter();
+ List<IItemPropertyDescriptor> descriptors = itemProvider.getPropertyDescriptors(null);
+
+ for (IItemPropertyDescriptor descriptor : descriptors)
+ {
+ if (descriptor.getFeature(null).equals(attribute))
+ {
+ return descriptor;
+ }
+ }
+
+ return null;
+ }
+
+ public interface StateAdapter extends IPropertyState, Adapter
+ {
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/DOMItemPropertyProviderTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/DOMItemPropertyProviderTest.java
new file mode 100755
index 0000000..8fbfcdd
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.ui.tests/src/org/eclipse/jst/ws/jaxws/dom/ui/tests/internal/DOMItemPropertyProviderTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.ui.tests.internal;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.ui.internal.impl.DOMItemPropertyProvider;
+
+/**
+ * Tests for {@link DOMItemPropertyProvider} class
+ * @author Georgi Vachkov
+ */
+public class DOMItemPropertyProviderTest extends TestCase
+{
+ private DOMItemPropertyProvider provider;
+
+ public void setUp()
+ {
+ provider = new DOMItemPropertyProvider(
+ null,
+ null,
+ "display name",
+ "description",
+ DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__NAME,
+ true,
+ false,
+ false,
+ null,
+ "category",
+ new String[0]);
+ }
+
+ public void testResetPropertyValue()
+ {
+ final IWebService ws = DomFactory.eINSTANCE.createIWebService();
+ ws.eSet(DomPackage.Literals.IJAVA_WEB_SERVICE_ELEMENT__IMPLEMENTATION, "org.eclipse.test.Sei");
+ ws.setName("Test");
+ provider.resetPropertyValue(ws);
+ assertEquals("SeiService", ws.getName());
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/.classpath b/tests/org.eclipse.jst.ws.jaxws.testutils/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/.project b/tests/org.eclipse.jst.ws.jaxws.testutils/.project
new file mode 100755
index 0000000..f7a3803
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.testutils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.jaxws.testutils/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.testutils/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..51fe550
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Utilities for JUnit tests (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.testutils
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.jmock,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.ui,
+ org.eclipse.jdt.launching,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.jst.ws.jaxws.utils,
+ org.junit
+Export-Package: org.eclipse.jst.ws.jaxws.testutils,
+ org.eclipse.jst.ws.jaxws.testutils.assertions,
+ org.eclipse.jst.ws.jaxws.testutils.files,
+ org.eclipse.jst.ws.jaxws.testutils.jmock,
+ org.eclipse.jst.ws.jaxws.testutils.jmock.testcases,
+ org.eclipse.jst.ws.jaxws.testutils.jobs,
+ org.eclipse.jst.ws.jaxws.testutils.project,
+ org.eclipse.jst.ws.jaxws.testutils.threading
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/about.html b/tests/org.eclipse.jst.ws.jaxws.testutils/about.html
new file mode 100644
index 0000000..d2b7ace
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 20, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/build.properties b/tests/org.eclipse.jst.ws.jaxws.testutils/build.properties
new file mode 100755
index 0000000..2ff2ea1
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/IWaitCondition.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/IWaitCondition.java
new file mode 100755
index 0000000..da08e8f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/IWaitCondition.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils;
+
+import org.eclipse.jst.ws.jaxws.testutils.assertions.ConditionCheckException;
+
+/**
+ * Interface which defines a condition upon which the execution can continue
+ * @author Danail Branekov
+ */
+public interface IWaitCondition
+{
+ /**
+ * Method which checks whether a given condition is met
+ * @return <code>true</code> in case the condition is met, <code>false</code> otherwise
+ * @throws ConditionCheckException when implementors decide that they cannot deal with a given exceptional situation
+ */
+ public boolean checkCondition() throws ConditionCheckException;
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/Assertions.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/Assertions.java
new file mode 100755
index 0000000..cfb9ff5
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/Assertions.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.assertions;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+import org.eclipse.jst.ws.jaxws.testutils.threading.TestContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Utility class which provides methods which assert that a given condition is met. If necessary, methods will block the execution of the caller until
+ * the condition is met for a reasonable time. If the conditions is not met, <code>Assert.fail()</code> is invoked
+ *
+ * @author Danail Branekov
+ *
+ */
+public class Assertions
+{
+ private final static int MAX_CONDITION_CHECKS = 5000;
+
+ private final static int SLEEP_TIMEOUT = 42;
+
+ /**
+ * Asserts that waits some time until the condition specified is met. If the condition is not met after some reasonable time, the method calls Assert.fail()
+ * @param condition the condition to check
+ * @param failMessage the message which will be passed to <code>Assert.fail()</code> thus indicating a test failure
+ */
+ public static void waitAssert(final IWaitCondition condition, final String failMessage)
+ {
+ try
+ {
+ if (!waitForConditionLoop(condition))
+ {
+ Assert.fail(failMessage);
+ }
+ } catch (ConditionCheckException e)
+ {
+ failUponThrowable(e);
+ }
+ }
+
+ /**
+ * Blocks the execution of the caller until the <code>condition</code> is met or MAX_CONDITION_CHECKS attempts have been reached.<br>
+ * The method behaviour slightly depends on whether the method is invoked from the UI thread or not
+ * <li>If the caller is the UI thread, a new modal context thread is started which sleeps for {@link #SLEEP_TIMEOUT}
+ * <li>If the caller is not the UI thread, then the current thread sleeps for {@link #SLEEP_TIMEOUT} <br>
+ *
+ * @param condition
+ * condition on which the method will return if met
+ * @throws ConditionCheckException
+ */
+ private static boolean waitForConditionLoop(final IWaitCondition condition) throws ConditionCheckException
+ {
+ int attempts = 0;
+ while (attempts < MAX_CONDITION_CHECKS)
+ {
+ if (condition.checkCondition())
+ {
+ return true;
+ }
+
+ attempts++;
+ final IRunnableWithProgress sleepRunnable = getSleepRunnable();
+
+ try
+ {
+ TestContext.run(sleepRunnable, Display.getCurrent() != null, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+ } catch (InvocationTargetException e)
+ {
+ throw new ConditionCheckException(e);
+ } catch (InterruptedException e)
+ {
+ throw new ConditionCheckException(e);
+ }
+ }
+
+ return false;
+ }
+
+ private static IRunnableWithProgress getSleepRunnable()
+ {
+ return new IRunnableWithProgress()
+ {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ Thread.sleep(SLEEP_TIMEOUT);
+ }
+ };
+ }
+
+ private static void failUponThrowable(final Throwable t)
+ {
+ final StringBuilder msgBuilder = new StringBuilder(t.getMessage());
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ t.printStackTrace(printWriter);
+ msgBuilder.append(stringWriter.toString());
+ msgBuilder.append("------------------------------------\n\n");
+
+ Assert.fail(msgBuilder.toString());
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/ConditionCheckException.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/ConditionCheckException.java
new file mode 100755
index 0000000..9e691db
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/assertions/ConditionCheckException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.assertions;
+
+import org.eclipse.jst.ws.jaxws.testutils.IWaitCondition;
+
+
+/**
+ * Exception which can be thrown by {@link IWaitCondition#checkCondition()} method. This is a wrapper exception which encloses the exception cause
+ *
+ * @author Danail Branekov
+ */
+public class ConditionCheckException extends Exception
+{
+ private static final long serialVersionUID = -4929080285506788984L;
+
+ public ConditionCheckException(final Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ConditionCheckException(final String message)
+ {
+ super(message);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/TestFileUtils.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/TestFileUtils.java
new file mode 100755
index 0000000..3532cbd
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/TestFileUtils.java
@@ -0,0 +1,517 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.files;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.nio.channels.FileChannel;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+
+public class TestFileUtils
+{
+ // Hide default constructor
+ private TestFileUtils()
+ {
+ };
+
+ /** Get new instance of the FileUtilities object */
+ public static TestFileUtils getInstance()
+ {
+ return new TestFileUtils();
+ }
+
+ /**
+ * Utility method. Copies the contents of the source folder to the destination folder.
+ */
+ public boolean copyFiles(final File dest, final File src) throws IOException
+ {
+
+ if (src.isDirectory())
+ {
+ dest.mkdirs();
+ final String list[] = src.list();
+
+ for (int i = 0; i < list.length; i++)
+ {
+ final String dest1 = dest.getAbsolutePath() + "\\" + list[i];
+ final String src1 = src.getAbsolutePath() + "\\" + list[i];
+ copyFiles(new File(dest1), new File(src1));
+ }
+ } else
+ {
+ return copy(dest, src);
+ }
+
+ return false;
+ }
+
+ /**
+ * Utility method for copying a file! - not a directory
+ *
+ * @param target
+ * @param source
+ * @throws IOException
+ */
+ public boolean copy(final File target, final File source) throws IOException
+ {
+ if (!source.isFile())
+ return false;
+
+ final FileChannel sourceChannel = new FileInputStream(source).getChannel();
+ final FileChannel targetChannel = new FileInputStream(target).getChannel();
+ sourceChannel.transferTo(0, sourceChannel.size(), targetChannel);
+ sourceChannel.close();
+ targetChannel.close();
+
+ return true;
+ }
+
+ /**
+ *
+ * @param destDir
+ * @param srcRelativePath -
+ * the relative path of the resource or <code>null</code> if it is in the same package
+ * @param resourceName
+ * @param resourceClass
+ * @return
+ * @throws IOException
+ */
+ public File copyResourceToDir(File destDir, InputStream srcStream, String resourceName) throws IOException
+ {
+ File destFile = new File(destDir.getAbsolutePath(), resourceName);
+ copyFile(srcStream, new FileOutputStream(destFile));
+ return destFile;
+ }
+ /**
+ *
+ * @param destDir
+ * @param srcRelativePath -
+ * the relative path of the resource or <code>null</code> if it is in the same package
+ * @param srcFileName
+ * @param resourceClass
+ * @return
+ * @throws IOException
+ */
+ public File copyResourceToDir(File destDir, String srcRelativePath, String srcFileName, Class<?> resourceClass) throws IOException
+ {
+ File destFile = new File(destDir.getAbsolutePath(), srcFileName);
+ copyFile(createInputStreamForResource(srcRelativePath, srcFileName, resourceClass), new FileOutputStream(destFile));
+ return destFile;
+ }
+
+ private InputStream createInputStreamForResource(String srcRelativePath, String srcFileName, Class<?> resourceClass)
+ {
+ return resourceClass.getResourceAsStream(createResourcePath(srcRelativePath) + srcFileName);
+ }
+
+ private String createResourcePath(String srcRelativePath)
+ {
+ return (srcRelativePath == null) ? "" : srcRelativePath + "/";
+ }
+
+ /** Closes the streams after completion */
+ public void copyFile(InputStream in, OutputStream out) throws IOException
+ {
+ if (in == null || out == null)
+ throw new IllegalArgumentException("Stream not initialized");
+ try
+ {
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0)
+ {
+ out.write(buf, 0, len);
+ }
+ } finally
+ {
+ in.close();
+ out.close();
+ }
+ }
+
+ /**
+ * Utility method for deleting the contents of a given folder path
+ *
+ * @param folderPath
+ * @return <code>true</code> if the process was completed successfully.
+ * @throws IOException
+ */
+ public boolean deleteFolderAndContents(final String folderPath) throws IOException
+ {
+ final File path = new File(folderPath);
+ return deleteFolderAndContents(path);
+ }
+
+ /**
+ * Deletes the specified directory and all its contents including all sub directories.
+ *
+ * @param tempDir
+ * the directory that is being deleted.
+ */
+ public boolean deleteFolderAndContents(File tempDir)
+ {
+ boolean status = true;
+ if (tempDir != null)
+ {
+ File[] files = tempDir.listFiles();
+
+ if (files != null)
+ {
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ status = deleteFolderAndContents(files[i]) && status;
+ } else
+ {
+ status = files[i].delete() && status;
+ }
+ }
+ }
+ status = tempDir.delete() && status;
+ } else
+ {
+ status = false;
+ }
+ return status;
+ }
+
+ /**
+ * Extracts the contents of the given input stream file to the given directory.
+ *
+ * @param istr
+ * The input stream of the jar file
+ * @param srcFileName
+ * The name of the archive - where the contents of the input stream will be copied
+ * @param destDir
+ * The destination directory object
+ * @return <code>true</code> if the process was completed successfully
+ * @throws IOException
+ */
+ public boolean unzipArchiveToDir(final InputStream istr, final String srcFileName, final File destDir) throws IOException
+ {
+
+ if (!destDir.exists())
+ throw new IOException("Directory does not exist");
+ if (!destDir.canWrite())
+ throw new IOException("Could not write to directory");
+
+ final File sourceFile = new File(destDir, srcFileName);
+
+ final FileOutputStream fos = new FileOutputStream(sourceFile);
+ final BufferedOutputStream bufOutStream = new BufferedOutputStream(fos);
+
+ try
+ {
+ Unzipper.INSTANCE.copyInputStream(istr, bufOutStream);
+ } finally
+ {
+ bufOutStream.close();
+ fos.close();
+ }
+
+ // check if the archive was copied successfully
+ if (!sourceFile.exists())
+ {
+ throw new FileNotFoundException("Archive could not be found");
+ }
+
+ Unzipper.INSTANCE.unzip(sourceFile, destDir, false);
+
+ return true;
+ }
+
+ /** Utility method for getting the contents of a file through URL */
+ public String readURLResource(URL url) throws IOException
+ {
+ String readInf = null;
+ final InputStream in = url.openStream();
+
+ try
+ {
+ int inRead = in.read();
+
+ readInf = "";
+ while (inRead != -1)
+ {
+ readInf += String.valueOf((char) inRead);
+ inRead = in.read();
+ }
+ } finally
+ {
+ in.close();
+ }
+
+ return readInf;
+ }
+
+ /**
+ * Method for replacing the text occurrence in a file with the provided replacement.
+ *
+ * @param file
+ * @param find
+ * @param replacement
+ * @return
+ * @throws IOException
+ */
+ public boolean replaceContentsInFile(File file, String find, String replacement) throws IOException
+ {
+ if (!file.exists())
+ return false;
+
+ String fileContents = readFileContents(file);
+
+ fileContents = fileContents.replaceAll(find, replacement);
+
+ file.delete();
+ file.createNewFile();
+
+ writeContentsToFile(file, fileContents);
+
+ return true;
+ }
+
+ /**
+ * Writes the string to the given file.
+ *
+ * @param file -
+ * the file to write to
+ * @param fileContents -
+ * the contents to be written to the file
+ * @throws IOException
+ * @throws FileNotFoundException
+ */
+ public void writeContentsToFile(File file, String fileContents) throws IOException, FileNotFoundException
+ {
+
+ PrintWriter pout = new PrintWriter(file);
+
+ try
+ {
+ pout.println(fileContents);
+ pout.flush();
+ } finally
+ {
+ pout.close();
+ }
+ }
+
+ /**
+ * Reads the contents of a file and returns it as String.
+ *
+ * @param file -
+ * the file to read from
+ * @return the contents of the file
+ * @throws IOException
+ */
+ public String readFileContents(File file) throws IOException
+ {
+ String readInf = null;
+ final InputStream in = new FileInputStream(file);
+
+ try
+ {
+ int inRead = in.read();
+
+ readInf = "";
+ while (inRead != -1)
+ {
+ readInf += String.valueOf((char) inRead);
+ inRead = in.read();
+ }
+ } catch (IOException e)
+ {
+ throw e;
+ } finally
+ {
+ in.close();
+ }
+
+ return readInf;
+ }
+
+ /** @return the resource input stream of the projects archive */
+ @SuppressWarnings("unchecked")
+ public InputStream getResourceInputStream(final String archiveName, final String projectSourceFolder, Class relativeResourceBaseClass)
+ {
+ return relativeResourceBaseClass.getResourceAsStream(projectSourceFolder + "/" + archiveName);
+ }
+
+ /** Method for handling the unzipping of the test projects */
+ public void unzipTestProjects(final InputStream archiveStream, final String archiveName, final File destDir) throws IOException
+ {
+
+ if (archiveStream == null)
+ throw new IOException("The archive resource stream is not initialized! archive: " + archiveName + " - dir: " + destDir);
+
+ try
+ {
+ unzipArchiveToDir(archiveStream, archiveName, destDir);
+ } finally
+ {
+ archiveStream.close();
+ }
+ }
+
+ /**
+ * Unzips the content of <tt>zipFileLocation</tt> into <tt>outFolder</tt>.
+ *
+ * @param zipFileLocation
+ * @param outFolder
+ * @throws IOException
+ */
+ public static void addZippedContent(File zipFileLocation, File outFolder) throws IOException
+ {
+ FileInputStream fis = new FileInputStream(zipFileLocation);
+ addZippedContent(fis, outFolder);
+ }
+
+ /**
+ * Unzips the content of <tt>is</tt> into <tt>outFolder</tt>.
+ *
+ * @param zipFileLocation
+ * @param outFolder
+ * @throws IOException
+ */
+ public static void addZippedContent(InputStream is, File outFolder) throws IOException
+ {
+ ZipInputStream zis = new ZipInputStream(is);
+ ZipEntry entry = null;
+ while ((entry = zis.getNextEntry()) != null)
+ {
+ File outFile = new File(outFolder, entry.getName());
+
+ if (entry.isDirectory())
+ {
+ outFile.mkdirs();
+ } else
+ {
+ OutputStream out = new FileOutputStream(outFile);
+ byte[] buff = new byte[2048];
+ int read;
+ while ((read = zis.read(buff)) > 0)
+ {
+ out.write(buff, 0, read);
+ }
+ out.close();
+ }
+
+ zis.closeEntry();
+ }
+
+ zis.close();
+ }
+
+ /**
+ * Deletes directory with its content
+ *
+ * @param dir
+ */
+ public static void deleteDirectory(File dir)
+ {
+ if (!dir.isDirectory())
+ {
+ throw new IllegalArgumentException("Not a directory" + dir.getName());
+ }
+
+ for (String s : dir.list())
+ {
+ File f = new File(dir.getAbsolutePath() + File.separator + s);
+ if (f.isDirectory())
+ {
+ deleteDirectory(f);
+ } else
+ {
+ f.delete();
+ }
+ }
+
+ dir.delete();
+ }
+
+ /**
+ * Create a directory named via the pattern System.getProperty("java.io.tmpdir") + File.separator + dirName
+ *
+ * @param dirName
+ * @return
+ */
+ public static File createTempDirectory(String dirName)
+ {
+ File tempDir = new File(System.getProperty("java.io.tmpdir"), dirName);
+ if (tempDir.exists())
+ {
+ deleteDirectory(tempDir);
+ }
+
+ if (!tempDir.mkdir())
+ {
+ throw new IllegalStateException("Temp direcory " + tempDir.getAbsolutePath() + " could not be created");
+ }
+ // tempDir.deleteOnExit();
+
+ return tempDir;
+ }
+
+ /**
+ * Copy the content of <code>filePath</code> and copies it to temporary file in system temp directory.
+ *
+ * @param classContext
+ * @param filePath
+ * @return created temporary file
+ * @throws IOException
+ */
+ public static File copyToTempLocation(Class<?> classContext, String filePath) throws IOException
+ {
+ final InputStream is = classContext.getResourceAsStream(filePath);
+ final File dir = new File(System.getProperty("java.io.tmpdir"));
+ final File tempFile = new File(dir, System.currentTimeMillis() + ".java");
+ tempFile.deleteOnExit();
+
+ final FileOutputStream fos = new FileOutputStream(tempFile);
+ try
+ {
+ byte[] buff = new byte[1024];
+ for (int cnt = 0; (cnt = is.read(buff)) > -1;)
+ {
+ fos.write(buff, 0, cnt);
+ }
+ } finally
+ {
+ is.close();
+ fos.close();
+ }
+
+ return tempFile;
+ }
+
+ public static void setFileContent(File file, String content) throws IOException
+ {
+ final FileWriter fw = new FileWriter(file);
+ try
+ {
+ fw.write(content);
+ } finally
+ {
+ fw.close();
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/Unzipper.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/Unzipper.java
new file mode 100755
index 0000000..d9bfdfb
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/files/Unzipper.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.files;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * A simple utility for unzipping ZIP archives
+ *
+ * @author Danail Branekov
+ */
+public class Unzipper {
+ public static final Unzipper INSTANCE = new Unzipper();
+
+ // Hide default constructor
+ private Unzipper() {
+
+ }
+
+ /**
+ * Copy the content from the <code>sourceStream</code> to the
+ * <code>destinationStream</code>
+ *
+ * @param sourceStream
+ * @param destStream
+ * @throws IOException
+ */
+ public void copyInputStream(final InputStream sourceStream,
+ final OutputStream destStream) throws IOException {
+ byte[] buffer = new byte[1024];
+ int len;
+
+ while ((len = sourceStream.read(buffer)) >= 0) {
+ destStream.write(buffer, 0, len);
+ }
+
+ destStream.flush();
+ }
+
+ /**
+ * Unzip the zip file specified to the destination directory
+ *
+ * @param sourceFile
+ * the source zip file
+ * @param destinationDir
+ * the destination directory
+ * @param toLowerCase
+ * if true, all the unzipped entries would be lowercased (for *IX
+ * compatibility) The background behind this parameter is the
+ * case inconsistency between ABAP xml test data directory names
+ * and the real directory names in the ABAP ZIP
+ * @throws IOException
+ * @throws NullPointerException
+ * when any of the input parameters is null
+ * @throws IllegalArgumentException
+ * when <code>sourceFile</code> does not exist or points to a
+ * directory
+ * @throws IllegalArgumentException
+ * when <code>destinationDir</code> does not exist or is not a
+ * directory
+ */
+ public void unzip(final File sourceFile, final File destinationDir,
+ final boolean toLowerCase) throws IOException {
+ checkInputParams(sourceFile, destinationDir);
+ ZipFile zipFile = null;
+
+ try {
+ zipFile = new ZipFile(sourceFile);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+ // Create dir structure
+ while (entries.hasMoreElements()) {
+ final ZipEntry entry = entries.nextElement();
+
+ if (entry.isDirectory()) {
+ // This is not robust, just for demonstration purposes.
+ (new File(destinationDir, toLowerCase ? entry.getName()
+ .toLowerCase() : entry.getName())).mkdirs();
+ }
+ }
+
+ // Create files
+ entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ final ZipEntry entry = entries.nextElement();
+
+ if (entry.isDirectory()) {
+ continue;
+ }
+
+ FileOutputStream fos = null;
+ BufferedOutputStream bufOutStream = null;
+
+ try {
+ fos = new FileOutputStream(new File(destinationDir,
+ toLowerCase ? entry.getName().toLowerCase() : entry
+ .getName()));
+ bufOutStream = new BufferedOutputStream(fos);
+ copyInputStream(zipFile.getInputStream(entry), bufOutStream);
+ fos.flush();
+ bufOutStream.flush();
+ } finally {
+ if (fos != null) {
+ fos.close();
+ }
+ if (bufOutStream != null) {
+ bufOutStream.close();
+ }
+ }
+ }
+ } finally {
+ if (zipFile != null) {
+ zipFile.close();
+ }
+ }
+ }
+
+ private void checkInputParams(final File zipFile, final File destination) {
+ // ContractChecker.nullCheckParam(zipFile, "zipFile");
+ // ContractChecker.nullCheckParam(destination, "destination");
+ if (!zipFile.exists() || zipFile.isDirectory()) {
+ throw new IllegalArgumentException(
+ "ZIP file does not exist or is a directory");
+ }
+ if (!destination.exists() || !destination.isDirectory()) {
+ throw new IllegalArgumentException(
+ "Destination does not exist or is not a directory");
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractDynamicMock.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractDynamicMock.java
new file mode 100755
index 0000000..15314b2
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractDynamicMock.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock;
+
+import org.jmock.core.InvocationDispatcher;
+
+/**
+ * This class is equivalent to <c>org.jmock.core.AbstractDynamicMock</c>. The difference is that this class is parameterized. It extends from
+ * <c>org.jmock.core.AbstractDynamicMock</c> and is thus backward compatible.
+ *
+ * @author Hristo Sabev
+ *
+ * @param <T>
+ */
+public abstract class AbstractDynamicMock<T> extends org.jmock.core.AbstractDynamicMock
+{
+
+ public AbstractDynamicMock(Class<T> mockedType, String name, InvocationDispatcher invocationDispatcher)
+ {
+ super(mockedType, name, invocationDispatcher);
+ }
+
+ public AbstractDynamicMock(Class<T> mockedType, String name)
+ {
+ super(mockedType, name);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Class<T> getMockedType()
+ {
+ return super.getMockedType();
+ }
+
+ @Override
+ public abstract T proxy();
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractMockObjectTestCase.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractMockObjectTestCase.java
new file mode 100755
index 0000000..25c1367
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/AbstractMockObjectTestCase.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock;
+
+import java.util.Collection;
+
+import org.jmock.core.Constraint;
+import org.jmock.core.DynamicMock;
+import org.jmock.core.Formatting;
+import org.jmock.core.InvocationMatcher;
+import org.jmock.core.MockObjectSupportTestCase;
+import org.jmock.core.Stub;
+import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
+import org.jmock.core.matcher.InvokeAtMostOnceMatcher;
+import org.jmock.core.matcher.InvokeCountMatcher;
+import org.jmock.core.matcher.InvokeOnceMatcher;
+import org.jmock.core.matcher.TestFailureMatcher;
+import org.jmock.core.stub.ReturnIteratorStub;
+import org.jmock.core.stub.ReturnStub;
+import org.jmock.core.stub.ThrowStub;
+
+/**
+ * An abstract class from which sub-classing test cases can inherit. This class is equivalent to org.jmock.MockObjectTestCase with the difference that
+ * id does not provide an implementation to <c>newCoreMock</c> method and thus is not able to create any proxies. The other major difference is that
+ * this class is parameterized. It should be used as a base class for sub-classes that provide strongly typed mocks. This class also take advantage of
+ * some of the java 5 sugars. For example "varargs".
+ *
+ * @author Hristo Sabev
+ *
+ */
+public abstract class AbstractMockObjectTestCase extends MockObjectSupportTestCase
+{
+
+ public AbstractMockObjectTestCase()
+ {
+ }
+
+ public AbstractMockObjectTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Creates a mock object that mocks the given type. The mock object is named after the type; the exact name is calculated by
+ * {@link #defaultMockNameForType}.
+ *
+ * @param mockedType
+ * The type to be mocked.
+ * @return A {@link Mock} object that mocks <var>mockedType</var>.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Mock<T> mock(Class mockedType)
+ {
+ return mock(mockedType, defaultMockNameForType(mockedType));
+ }
+
+ /**
+ * Creates a mock object that mocks the given type and is explicitly given a name. The mock object is named after the type; the exact name is
+ * calculated by {@link #defaultMockNameForType}.
+ *
+ * @param mockedType
+ * The type to be mocked.
+ * @param roleName
+ * The name of the mock object
+ * @return A {@link Mock} object that mocks <var>mockedType</var>.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Mock<T> mock(Class mockedType, String roleName)
+ {
+ final Mock<T> newMock = new Mock<T>(newCoreMock(mockedType, roleName));
+ registerToVerify(newMock);
+ return newMock;
+ }
+
+ protected abstract <T> DynamicMock newCoreMock(Class<T> mockedType, String roleName);
+
+ /**
+ * Calculates
+ *
+ * @param mockedType
+ * @return
+ */
+ public String defaultMockNameForType(Class<?> mockedType)
+ {
+ return "mock" + Formatting.classShortName(mockedType);
+ }
+
+ public Stub returnValue(Object o)
+ {
+ return new ReturnStub(o);
+ }
+
+ public Stub returnValue(boolean result)
+ {
+ return returnValue(new Boolean(result));
+ }
+
+ public Stub returnValue(byte result)
+ {
+ return returnValue(new Byte(result));
+ }
+
+ public Stub returnValue(char result)
+ {
+ return returnValue(new Character(result));
+ }
+
+ public Stub returnValue(short result)
+ {
+ return returnValue(new Short(result));
+ }
+
+ public Stub returnValue(int result)
+ {
+ return returnValue(new Integer(result));
+ }
+
+ public Stub returnValue(long result)
+ {
+ return returnValue(new Long(result));
+ }
+
+ public Stub returnValue(float result)
+ {
+ return returnValue(new Float(result));
+ }
+
+ public Stub returnValue(double result)
+ {
+ return returnValue(new Double(result));
+ }
+
+ public Stub returnIterator(Collection<?> collection)
+ {
+ return new ReturnIteratorStub(collection);
+ }
+
+ public Stub returnIterator(Object[] array)
+ {
+ return new ReturnIteratorStub(array);
+ }
+
+ public Stub throwException(Throwable throwable)
+ {
+ return new ThrowStub(throwable);
+ }
+
+ public InvocationMatcher once()
+ {
+ return new InvokeOnceMatcher();
+ }
+
+ public InvocationMatcher atLeastOnce()
+ {
+ return new InvokeAtLeastOnceMatcher();
+ }
+
+ public InvocationMatcher atMostOnce()
+ {
+ return new InvokeAtMostOnceMatcher();
+ }
+
+ public InvocationMatcher exactly(int expectedCount)
+ {
+ return new InvokeCountMatcher(expectedCount);
+ }
+
+ public InvocationMatcher never()
+ {
+ return new TestFailureMatcher("not expected");
+ }
+
+ public InvocationMatcher never(String errorMessage)
+ {
+ return new TestFailureMatcher("not expected (" + errorMessage + ")");
+ }
+
+ /**
+ * @since 1.0.1
+ */
+ public Stub onConsecutiveCalls(Stub... stubs)
+ {
+ return onConsecutiveCalls(stubs);
+ }
+
+ /**
+ * @since 1.1.0
+ */
+ public Stub doAll(Stub... stubs)
+ {
+ return doAll(stubs);
+ }
+
+ public Constraint collectionWithElements(final int expectedCollectionSize, final Object... objects)
+ {
+ return new Constraint(){
+
+ public boolean eval(Object arg0)
+ {
+ final Collection<?> col = (Collection<?>)arg0;
+ for(Object o : objects)
+ {
+ if(!col.contains(o))
+ {
+ return false;
+ }
+ }
+
+ return objects.length == expectedCollectionSize;
+ }
+
+ public StringBuffer describeTo(StringBuffer arg0)
+ {
+ return arg0;
+ }};
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/Mock.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/Mock.java
new file mode 100755
index 0000000..7c3b9a8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/Mock.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock;
+
+import org.jmock.core.DynamicMock;
+
+/**
+ * This class is equivalent to <c>org.jmock.Mock</c> class from JMock. The only difference is that this a parameterized (generic) version. This makes
+ * it a lot easier for use as no manual casts to the mocked type are required by the programmer. This class extends from <c>org.jmock.Mock</c> so its
+ * fully backward compatible.
+ *
+ * @see org.jmock.Mock
+ */
+public class Mock<T> extends org.jmock.Mock
+{
+
+ /**
+ * Constructs a new mock for the specified type. The new mock has the specified name. This name will be shown by all reports concerning this mock
+ * instance. Such reports are unmached invocations and so on.
+ *
+ * @param mockedType -
+ * the type to be mocked. This could be either class or interface.
+ * @param name -
+ * name of this mock
+ */
+ public Mock(Class<T> mockedType, String name)
+ {
+ super(mockedType, name);
+ }
+
+ /**
+ * Constructs a new mock for the specified type.
+ *
+ * @param mockedType -
+ * the type to be mocked. This class needs to be either class or interface.
+ */
+ public Mock(Class<T> mockedType)
+ {
+ super(mockedType);
+ }
+
+ /**
+ * Constructs new Mock that wraps the supplied <c>DynamicMock</c> instance.
+ *
+ * @param arg0 -
+ * the dynamic mock instance
+ */
+ public Mock(DynamicMock arg0)
+ {
+ super(arg0);
+ }
+
+ /**
+ * Obtains the proxy instance for this mock.
+ *
+ * @return the proxy instance for this mock.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public T proxy()
+ {
+ return (T) super.proxy();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/MockObjectTestCase.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/MockObjectTestCase.java
new file mode 100755
index 0000000..d126061
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/MockObjectTestCase.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.jst.ws.jaxws.testutils.jmock.testcases.BeforeAfterEnabler;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.testcases.IBeforeAfterEnabled;
+import org.jmock.core.CoreMock;
+import org.jmock.core.DynamicMock;
+import org.jmock.core.Verifiable;
+
+
+/**
+ * An test case base class for mock objects test case. This one is roughly equivalent to org.jmock.cglib.MockObjectTestCase. There are several
+ * important differences though. This test case class assumes that the loader of the test case class is able to load both the class being mocked and
+ * the jmock classes. Thus test case class loader is used to create the mock type. This mock test case also provides two new <c>mock</c> methods.
+ * These methods can instantiate a mock for a given class by executing the class's constructor. The methods <c></c> and <c></c> inherited from
+ * <c>AbstractMockObjectTestCase</c> create mocks without executing the constructor of the mocked class. They use the SUN's reflection mechanism and
+ * are able to create classes without a visible default constructor or without constructor at all. This functionallity however is platform specific.
+ * It can be compiled and executed only on SUN VMs. Should the code be executed on another VM most likely a <c>NoClassDefFoundError</c> will ocurr.
+ *
+ * @author Hristo Sabev
+ *
+ */
+public abstract class MockObjectTestCase extends AbstractMockObjectTestCase implements IBeforeAfterEnabled
+{
+ private final BeforeAfterEnabler bae = new BeforeAfterEnabler(this);
+ public void afterTestCase() throws Exception
+ {
+ }
+
+ public void beforeTestCase() throws Exception
+ {
+ }
+
+ public void runBareInternal() throws Throwable
+ {
+ super.runBare();
+ }
+
+ @Override
+ public void runBare() throws Throwable
+ {
+ bae.runBare();
+ }
+
+ private List<Mock<?>> mocksToVerify = new Vector<Mock<?>>();
+
+ /**
+ * Constructs a new <c>MockObjectTestCase</c> instance with no name
+ *
+ */
+ public MockObjectTestCase()
+ {
+ }
+
+ public List<Mock<?>> getMocksToVerify()
+ {
+ final List<Mock<?>> copy = new ArrayList<Mock<?>>();
+ copy.addAll(mocksToVerify);
+ return copy;
+ }
+
+ @Override
+ public void unregisterToVerify(Verifiable arg0)
+ {
+ mocksToVerify.remove(arg0);
+ super.unregisterToVerify(arg0);
+ }
+
+ @Override
+ public void verify()
+ {
+ mocksToVerify.clear();
+ super.verify();
+ }
+
+ /**
+ * Constructs a new <c>MockObjectTestCase</c> instance with the specified name
+ *
+ * @param name -
+ * the name of this test case.
+ * @see junit.framework.TestCase
+ */
+ public MockObjectTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected <T> DynamicMock newCoreMock(Class<T> mockedType, String roleName)
+ {
+ return new CoreMock(mockedType, roleName);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/StubUtils.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/StubUtils.java
new file mode 100755
index 0000000..95ac877
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/StubUtils.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jmock.core.Stub;
+import org.jmock.core.stub.ReturnStub;
+import org.jmock.core.stub.StubSequence;
+
+/**
+ * Utils for creating more complex jmock stubs
+ *
+ * @author Hristo Sabev
+ *
+ */
+public class StubUtils
+{
+
+ /**
+ * Creates a stub that will return the proxy for the next mock in the supplied array on a consequtive call. I.e. the first call returns the proxy
+ * at <c>returnValues[0]</c>, the second call will return the proxy for the mock at <c>returnValues[1]</c>, and so forth
+ *
+ * @param returnValues -
+ * the mocks which will be returned on consequtive calls
+ * @return - a stub that will return the proxies for the specified mocks on each consequtive call
+ */
+ public static Stub onConsequtiveCallsWillReturnMocks(Mock<?>[] returnValues)
+ {
+ final Stub[] returnStubs = new Stub[returnValues.length];
+ for (int i = 0; i < returnValues.length; i++)
+ {
+ returnStubs[i] = new ReturnStub(returnValues[i].proxy());
+ }
+ return new StubSequence(returnStubs);
+ }
+
+ /**
+ * Converts an array of mocks to an array of proxies for these mocks. All mocks should be mocks for one and the
+ * same type.
+ * @param <T> - the type of the mocked class
+ * @param mocks - the array of mocks to be converted to proxies
+ * @param proxies - an array of the type of the proxy. It will be used to store the proxies for the mocks
+ * @throws IndexOutOfBoundsException - thrown if the arrays are with different sizes.
+ */
+ public static <T> void mocksToProxies(Mock<T>[] mocks, T[] proxies) {
+ for (int i = 0; i < mocks.length; i++)
+ {
+ proxies[i] = mocks[i].proxy();
+ }
+ }
+
+ /**
+ * Creates a return stub that will return an array of mock proxies for the supplied array of mocks.
+ * @param returnValues - an array of mocks, whose proxies has to be returned
+ * @return - a stub wich will return an array of proxies in the same order as the passed mocks.
+ * @throws IndexOutOfBoundsException - if the two arrays are with different lengths
+ */
+ public static <T>Stub returnArrayOfMocks(Mock<T>[] returnValues, T[] proxies)
+ {
+ mocksToProxies(returnValues, proxies);
+ return new ReturnStub(proxies);
+ }
+
+ /**
+ * Creates a stub that on consequtive calls will return the next boolean in the supplied array I.e. the first call returns the boolean at
+ * <c>returnValues[0]</c>, the second call will return the boolean at <c>returnValues[1]</c>, and so forth
+ *
+ * @param returnValues -
+ * the booleans which will be returned on consequtive calls
+ * @return - a stub that will return the booleans for each consequtive call
+ */
+ public static Stub onConsecutiveCallsWillReturnBoolean(boolean[] returnValues)
+ {
+ final Stub[] returnStubs = new Stub[returnValues.length];
+ for (int i = 0; i < returnValues.length; i++)
+ {
+ returnStubs[i] = new ReturnStub(returnValues[i]);
+ }
+ return new StubSequence(returnStubs);
+ }
+
+ public static <T> Stub returnCollectionContaining(T[] contained) {
+ final Collection<T> coll = new ArrayList<T>();
+ for(T o : contained) {
+ coll.add(o);
+ }
+ return new ReturnStub(coll);
+ }
+
+ public static <T> Stub returnCollectionContaining(T contained) {
+ final Collection<T> coll = new ArrayList<T>(1);
+ coll.add(contained);
+ return new ReturnStub(coll);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterEnabler.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterEnabler.java
new file mode 100755
index 0000000..49d1650
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterEnabler.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * This class is based on work by Shay Banon (http://www.kimchy.org/before_after_testcase_with_junit/)
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock.testcases;
+
+import java.lang.reflect.Method;
+import java.util.Vector;
+
+import junit.framework.Test;
+
+public class BeforeAfterEnabler {
+
+ private final IBeforeAfterEnabled tc;
+
+ private int testCount = 0;
+
+ private final int totalTestCount;
+
+ private boolean disableAfterTestCase = false;
+
+ public BeforeAfterEnabler(IBeforeAfterEnabled tc) {
+ this.tc = tc;
+ totalTestCount = countTotalTests();
+ }
+
+ public void runBare() throws Throwable {
+ Throwable exception = null;
+ if (testCount == 0) {
+ beforeTestCase();
+ }
+ testCount++;
+ try {
+ tc.runBareInternal();
+ } catch (Throwable running) {
+ exception = running;
+ }
+ if (testCount == totalTestCount) {
+ if (!disableAfterTestCase) {
+ try {
+ afterTestCase();
+ } catch (Exception afterTestCase) {
+ if (exception == null) exception = afterTestCase;
+ }
+ } else {
+ disableAfterTestCase = false;
+ }
+ }
+ if (exception != null) throw exception;
+ }
+
+ public void disableAfterTestCase() {
+ disableAfterTestCase = true;
+ }
+
+ /**
+ * Called before any tests within this test case.
+ *
+ * @throws Exception
+ */
+ protected void beforeTestCase() throws Exception {
+ tc.beforeTestCase();
+ }
+
+ /**
+ * Called after all the tests within the test case
+ * have executed.
+ *
+ * @throws Exception
+ */
+ protected void afterTestCase() throws Exception {
+ tc.afterTestCase();
+ }
+
+ private int countTotalTests() {
+ int count = 0;
+ Class<?> superClass = tc.getClass();
+ Vector<String> names = new Vector<String>();
+ while (Test.class.isAssignableFrom(superClass)) {
+ Method[] methods = superClass.getDeclaredMethods();
+ for (Method method : methods) {
+ String name = method.getName();
+ if (names.contains(name))
+ continue;
+ names.addElement(name);
+ if (isTestMethod(method)) {
+ count++;
+ }
+ }
+ superClass = superClass.getSuperclass();
+ }
+ return count;
+ }
+
+ private boolean isTestMethod(Method m) {
+ String name = m.getName();
+ Class<?>[] parameters = m.getParameterTypes();
+ Class<?> returnType = m.getReturnType();
+ return parameters.length == 0 && name.startsWith("test") && returnType.equals(Void.TYPE);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterTestCase.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterTestCase.java
new file mode 100755
index 0000000..9eaba7f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/BeforeAfterTestCase.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock.testcases;
+
+import junit.framework.TestCase;
+
+public abstract class BeforeAfterTestCase extends TestCase implements IBeforeAfterEnabled {
+
+ private final BeforeAfterEnabler bfe = new BeforeAfterEnabler(this);
+
+ public void runBareInternal() throws Throwable {
+ super.runBare();
+ }
+
+ @Override
+ public void runBare() throws Throwable {
+ bfe.runBare();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/EqualsTestCase.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/EqualsTestCase.java
new file mode 100755
index 0000000..5ed0e24
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/EqualsTestCase.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock.testcases;
+
+import java.lang.reflect.Modifier;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+/**
+ * An abstract test case for the <c>Object.equals(Object)</c> and <c>Object.hashCode()</c> methods. This test case performs the tests for <c>equals</c>
+ * and <c>hashCode</c> simultaniesly as they are tightly connected. The tescase test the following properties of equals/hasCode:
+ * <p>
+ * 1. equals reflexivity 2. equals symetricity 3. equals transitivyte 4. hashCode statbility 5. hashCode immutability 6. equals is suitable for
+ * subclasses
+ * </p>
+ *
+ * The test cases is abstract and need to be sublcassed by concrete test case. Several abstract methods need to be implemented by concrete test cases.
+ *
+ * @author Hristo Sabev
+ *
+ * @param <T>
+ */
+public abstract class EqualsTestCase<T> extends TestCase
+{
+
+ private final Class<T> testClass;
+
+ /**
+ * Creates a new <c>EqualsTestCase</c> instance to test the equals method of the supplied class
+ *
+ * @param testClass -
+ * the class whose equals method will be tested
+ */
+ public EqualsTestCase(Class<T> testClass)
+ {
+ this(null, testClass);
+ }
+
+ /**
+ * Creates a new <c>EqualsTestCase</c> instance to test the equals method of the supplied class. This test case also takes a name paramter, which
+ * i passed to <c>TestCase</c> super constructor. I.e. this is the name of the test case
+ *
+ * @param name -
+ * name of the test case
+ * @param testClass -
+ * the class whose equals method will be tested
+ */
+ public EqualsTestCase(String name, Class<T> testClass)
+ {
+ assertNotNull("test class passed in constructor was null", testClass);
+ this.testClass = testClass;
+ }
+
+ /**
+ * Obtains a new iterator of instances for the tested class.
+ *
+ * @param iterations -
+ * number of iterations i.e the number of times one can invoke <c>Iterator.next()</c> withouth getting <c>NoSuchElementException</c>
+ * exception
+ * @return a new iterator of instanced for the tested class;
+ */
+ abstract public Iterator<T> newObjectIterator(int iterations);
+
+ /**
+ * Obtains a new instance of the tested class. Each call to this method should return a new instance, which is considered equal to the instance
+ * returned by the prefvious call but is not identical. For example if the tested class was <c>String</c> the most obvious implementation of this
+ * method would be <c>
+ * <p>
+ * return new String("test string")
+ * </p>
+ * </c>
+ *
+ * @return a new instance of the test class assumed to be equal to the previously returned instances
+ */
+ abstract public T newEqualInstance();
+
+ /**
+ * Obtains a new instance of a single class, which is a subclass of the tested class. The subclass must not override the <c>equals</c> method of
+ * the tested class. All instances should be equal. The returned instances should have the same values of all the inherited fields as the
+ * instances retured by <c>newEqualInstance</c>
+ *
+ * @return returns a new instance of single sublcass of the tested class. Each call should return an instance equal to the previously returned but
+ * not identical. Null if the tested class is final
+ */
+ abstract public T newAncestorEqualInstance();
+
+ /**
+ * Obtains a new instance of the the tested class. The single restriction on the returned instances is that they should not be equal to the
+ * instances returned by <c>newEqualInstance</c>
+ *
+ * @return a new instance of the test class. The newly returned instance is not equal to the instances returned by <c>newEqualInstance</c>
+ */
+ abstract public T newNonEqualInstance();
+
+ /**
+ * Modifies a given instance of the tested class. The instance should be modified in such a way that it's not equal to the instances retured by
+ * <c>newEqualInstance</c> ans <c>newNoneEqualInstance()</c>. If the tested class is immutable then the implementation of this method should be
+ * empty
+ *
+ * @param instance -
+ * the instance to be modified.
+ */
+ abstract public void modifyObjectInstance(T instance);
+
+ /**
+ * Obtains the number of comparisons that will be made for the reflexivity test. This method can be overriden by subclasses to specify a different
+ * value. By default this number is 100.
+ *
+ * @return - the number of comparisons that will be made for the reflexivity test.
+ */
+ public int getIterationsForReflixivityTest()
+ {
+ return 100;
+ }
+
+ /**
+ * Obatains the number of comparisons that will be made for the symitricity test. This method can be override by subclasses to specify a different
+ * value. By default this number is 1000
+ *
+ * @return - the number of comparisons that will be made for the reflixivity test.
+ */
+ public int getIterationsForSymetricityTest()
+ {
+ return 1000;
+ }
+
+ /**
+ * Obatains the number of comparisons that will be made for the transitivity test. This method can be override by subclasses to specify a
+ * different value. By default this number is 2000
+ *
+ * @return - the number of comparisons that will be made for the transitivity test.
+ */
+ public int getIterationsForTransitivityTest()
+ {
+ return 2000;
+ }
+
+ /**
+ * Tests that equals is reflexive. It enforces the rule a.equals(a) == true. This test also tests that hashCode function is stable(). I.e.
+ * hashCode doesn't change it's value between several invocations, as well as that hashCode is immutable over object change. The test strategy is
+ * to create an new object iterator and then for each returned instance:
+ *
+ * <ol>
+ * <li>Compare it with itself</li>
+ * <li>check that its hash code stays the same</li>
+ * <li>modify the returned instance by calling <c>modifyInstance</c> and then check the hashCode again</li>
+ * </ol>
+ *
+ */
+ public void testEqulsReflexive()
+ {
+ final int iterationsForThisTest = getIterationsForReflixivityTest();
+ final Iterator<T> objectTiterator = newObjectIterator(iterationsForThisTest);
+ while (objectTiterator.hasNext())
+ {
+ final T objectT = objectTiterator.next();
+ assertTrue("equals is not reflexive", objectT.equals(objectT));
+ final int initialHashCode = objectT.hashCode();
+ for (int i = 0; i < iterationsForThisTest; i++)
+ {
+ assertEquals("hashCode is not stable upon multiple calls", initialHashCode, objectT.hashCode());
+ }
+ modifyObjectInstance(objectT);
+ assertEquals("hashCode is not stable upon modification of the object", initialHashCode, objectT.hashCode());
+ }
+ }
+
+ /**
+ * Tests that equals is symetric i.e. a.equals(b) <==> b.equals(a). This method also tests that hashCode behaves correctly in sense a.quals(b) =>
+ * a.hashCode() == b.hashCode(). This test uses two object iterators. One for a and one for b, where a and b are from the above rule. Each of
+ * these iterators are instantiated with the same number of elements. This method also checks that whenever two instances returned by the two
+ * iterators are equal then their hascode is equal.
+ *
+ */
+ public void testEqualsSymetric()
+ {
+ final int iterationsForThisTest = getIterationsForSymetricityTest();
+ final Iterator<T> objectTIterator1 = newObjectIterator(iterationsForThisTest);
+ final Iterator<T> objectTIterator2 = newObjectIterator(iterationsForThisTest);
+ while (objectTIterator1.hasNext())
+ {
+ assertTrue("The two object iterators don't have equal number of objects", objectTIterator2.hasNext());
+ final T objectT1 = objectTIterator1.next();
+ final T objectT2 = objectTIterator2.next();
+ if (objectT1.equals(objectT2))
+ {
+ assertTrue("Equals is not symetric", objectT2.equals(objectT1));
+ assertTrue("Hashcode is not the same for equal instances", objectT1.hashCode() == objectT2.hashCode());
+ } else if (objectT2.equals(objectT1))
+ {
+ fail("Equals is not symetric");
+ }
+ }
+ }
+
+ /**
+ * Tests that equals is transitive i.e. a.equals(b) & b.equals(c) => a.equals(c). This test uses three object iterators. One for a, one for b, and
+ * one for c, where a,b,c are from the above rule. Each of these iterators are instantiated with the same number of elements.
+ */
+ public void testEqualsTransitive()
+ {
+ final int iterationsForThisTest = getIterationsForTransitivityTest();
+ final Iterator<T> objectTIterator1 = newObjectIterator(iterationsForThisTest);
+ final Iterator<T> objectTIterator2 = newObjectIterator(iterationsForThisTest);
+ final Iterator<T> objectTIterator3 = newObjectIterator(iterationsForThisTest);
+
+ while (objectTIterator1.hasNext())
+ {
+ assertTrue("The three object iterators don't have equal number of objects", objectTIterator2.hasNext());
+ assertTrue("The three object iterators don't have equal number of objects", objectTIterator3.hasNext());
+ final T objectT1 = objectTIterator1.next();
+ final T objectT2 = objectTIterator2.next();
+ final T objectT3 = objectTIterator3.next();
+
+ if (objectT1.equals(objectT2) && objectT1.equals(objectT3))
+ {
+ assertTrue("equals is not transitive", objectT2.equals(objectT3));
+ }
+ }
+ }
+
+ /**
+ * Tests that <c>equal</c> returns false if <c>null</c> is passed as argument
+ *
+ */
+ public void testEqualsReturnsFalseIfNullPassed()
+ {
+ final T objectT = this.newEqualInstanceCheckCorrect();
+ assertFalse("equals returned true when null passed for other object", objectT.equals(null));
+ }
+
+ /**
+ * Tests that <c>equal</c> returns false if a non-equal object is passed as an argument. The two non equal instances are created by calling
+ * <c>newEqualInstance</c> and <c> newNonEqualInstance</c>
+ *
+ */
+ public void testEqualsReturnsFalseOnNonEquals()
+ {
+ final T objectT1 = this.newEqualInstanceCheckCorrect();
+ final T objectT2 = this.newNonEqualInstanceCheckCorrect();
+ assertTrue("Equals reported true for instances assumed non equal.", !objectT1.equals(objectT2) && !objectT2.equals(objectT1));
+ }
+
+ /**
+ * Tests that <c>equal</cL returns true if an equal object is passed as an argument. The instances that are compared are obtained by two
+ * consecutive calls to <c>newEqualInstance</c>
+ *
+ */
+ public void testEqualsReturnsTrueOnEquals()
+ {
+ final T objectT1 = this.newEqualInstanceCheckCorrect();
+ final T objectT2 = this.newEqualInstanceCheckCorrect();
+ assertTrue("Equals reported false for instances assumed equal.", objectT1.equals(objectT2) && objectT2.equals(objectT1));
+ }
+
+ /**
+ * Tests that equals returns false if an object of another class is passed. In case that the tested class is not final this test passes a subclass
+ * of the test class as an argument to <c>equals</c>. The passed ancestor object has the same value for all its field. This is intended to cahtch
+ * wrong implementations using "instanceof" rather than <c>getClass() == other.getClass()</c>
+ *
+ */
+ public void testEqualsReturnsFalseIfOtherClassPassed()
+ {
+ final T objectT = newEqualInstanceCheckCorrect();
+ Object object = newAncestorEqualInstanceCheckCorrect();
+ if (object == null)
+ {
+ // class is final. No ancestor could be created. Use some other class.
+ object = new Object();
+ }
+ assertFalse("equals returned true when object of another type passed", objectT.equals(object));
+ }
+
+ /**
+ * Tests that <c>equals</c> is properly implemented for use in subclasses. It takes two equal ancestor instances and compares them for equality.
+ * Since the ancestor class does not override the equals method. The tests asserts that equals should return true.
+ *
+ */
+ public void testEqualsSuitableForAncestors()
+ {
+ final T ancestorT1 = newAncestorEqualInstanceCheckCorrect();
+ final T ancestorT2 = newAncestorEqualInstanceCheckCorrect();
+ if (ancestorT1 == null)
+ {
+ assertNull(
+ "The newAncestorInstance() method returned null on the second invocation, while it return a value differet than null from the first",
+ ancestorT2);
+ return;
+ }
+ assertTrue(ancestorT1.equals(ancestorT2) && ancestorT2.equals(ancestorT1));
+
+ }
+
+ private T newAncestorEqualInstanceCheckCorrect()
+ {
+ final T ancestorT = newAncestorEqualInstance();
+ if (ancestorT == null)
+ {
+ assertTrue("newAncestorEqualInstance returned null, although the test class ", Modifier.isFinal(testClass.getModifiers()));
+ } else
+ {
+ assertTrue("newAncestorEqualInstance returned object of class " + ancestorT.getClass() + ", which is not subtype of "
+ + testClass.getName(), testClass.isAssignableFrom(ancestorT.getClass()));
+ }
+ return ancestorT;
+ }
+
+ private T newEqualInstanceCheckCorrect()
+ {
+ final T objectT = newEqualInstance();
+ assertTrue("newEqualInstance returned object of class " + objectT.getClass().getName() + "Expected was class " + testClass.getName(),
+ testClass == objectT.getClass());
+ return objectT;
+ }
+
+ private T newNonEqualInstanceCheckCorrect()
+ {
+ final T objectT = newNonEqualInstance();
+ assertTrue("newNonEqualInstance returned object of class " + objectT.getClass().getName() + "Expected was class " + testClass.getName(),
+ testClass == objectT.getClass());
+ return objectT;
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/IBeforeAfterEnabled.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/IBeforeAfterEnabled.java
new file mode 100755
index 0000000..9115eed
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jmock/testcases/IBeforeAfterEnabled.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jmock.testcases;
+
+public interface IBeforeAfterEnabled {
+
+ public void beforeTestCase() throws Exception;
+
+ public void afterTestCase() throws Exception;
+
+ public void runBareInternal() throws Throwable;
+
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jobs/JobUtils.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jobs/JobUtils.java
new file mode 100755
index 0000000..d5e208a
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/jobs/JobUtils.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.jobs;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.TypeNameRequestor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.ws.jaxws.testutils.threading.TestContext;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+public class JobUtils
+{
+ @SuppressWarnings("deprecation")
+ public static void waitForJobsInterruptable() throws InterruptedException
+ {
+ while (Platform.getJobManager().currentJob() != null)
+ {
+ delay(5);
+ }
+ }
+
+ public static void waitForJobs() throws JavaModelException
+ {
+ waitForDummyJob(Job.INTERACTIVE);
+
+ while (true)
+ {
+ try
+ {
+ waitForJobsInterruptable();
+ break;
+ } catch (InterruptedException ie)
+ {
+
+ }
+ }
+
+ // i036509 added couse waiting for jobs is not enought
+ waitForIndexer();
+
+ // Force notifications
+ waitForNotifications();
+ }
+
+ public static void delay(final long millis) throws InterruptedException
+ {
+ Display display = Display.getCurrent();
+ // if this is the UI thread, then process the input
+ if (display != null)
+ {
+ final long entTimeMillis = System.currentTimeMillis() + millis;
+ while (System.currentTimeMillis() < entTimeMillis)
+ {
+ if (!display.readAndDispatch())
+ {
+ display.sleep();
+ }
+ }
+ display.update();
+ } else
+ {
+ Thread.sleep(1000);
+ }
+ }
+
+ public static void waitForIndexer() throws JavaModelException
+ {
+ new SearchEngine().searchAllTypeNames(null,SearchPattern.R_EXACT_MATCH, null,
+ SearchPattern.R_CASE_SENSITIVE, IJavaSearchConstants.CLASS, SearchEngine
+ .createJavaSearchScope(new IJavaElement[0]), new TypeNameRequestor()
+ {
+ @SuppressWarnings("unused")
+ public void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames,
+ String path)
+ {
+ }
+ @SuppressWarnings("unused")
+ public void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames,
+ String path)
+ {
+ }
+ }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
+ }
+
+ /**
+ * Schedule a dummy job with the priority specified and wait for it is done
+ */
+ private static void waitForDummyJob(final int priority)
+ {
+ try
+ {
+ waitForDummyJobWithPrio(priority);
+ }
+ catch(InterruptedException e)
+ {
+
+ }
+ }
+
+ private static void waitForDummyJobWithPrio(final int prio) throws InterruptedException
+ {
+ Job myDummyJob = new Job("DUMMY"){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ return Status.OK_STATUS;
+ }};
+
+ myDummyJob.setPriority(prio);
+ myDummyJob.setUser(false);
+ myDummyJob.schedule();
+
+ myDummyJob.join();
+ }
+
+
+ /**
+ * Forces delivering of notification events. The implementation of the method is "inspired" by NotificationManager's notification job
+ * @throws InterruptedException
+ */
+ private static void waitForNotifications()
+ {
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IWorkspaceRunnable dummyRunnable = new IWorkspaceRunnable(){
+ public void run(IProgressMonitor monitor) throws CoreException
+ {
+ }
+ };
+
+ final Job notifForcingJob = new Job("Delivering notifications..."){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
+ {
+ workspace.run(dummyRunnable, null, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e)
+ {
+ logger().logDebug( e.getMessage(), e );
+ }
+ return Status.OK_STATUS;
+ }};
+
+ syncExecJob(notifForcingJob, PlatformUI.getWorkbench().getDisplay());
+ }
+
+ public static void waitForJobsSlow() throws JavaModelException
+ {
+ waitForJobs();
+ waitForDummyJob(Job.DECORATE);
+
+ waitForEventLoop();
+ }
+
+ private static void waitForEventLoop()
+ {
+ final Display display = PlatformUI.getWorkbench().getDisplay();
+
+ final Runnable runnable = new Runnable(){
+
+ public void run()
+ {
+ // Let the display process the events in its queue
+ while(display.readAndDispatch()){};
+ }};
+
+ if(Display.getCurrent() != null)
+ {
+ runnable.run();
+ }
+ else
+ {
+ display.syncExec(runnable);
+ }
+
+ }
+
+ /**
+ * Executes synchronously (schedules and joins) the job specified.<br>
+ * If the method is called from the UI thread, the job is scheduled and joined in a modal context thread thus letting the event loop process asynchronous events<br>
+ * If the method is called from a worker thread, the job is scheduled and joined in the caller thread.
+ *
+ * @param job
+ * @param display
+ */
+ private static void syncExecJob(final Job job, final Display display)
+ {
+ final IRunnableWithProgress runnable = new IRunnableWithProgress()
+ {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ job.schedule();
+ try
+ {
+ job.join();
+ } catch (InterruptedException e)
+ {
+ logger().logDebug(e.getMessage(), e);
+ }
+ }
+ };
+ try
+ {
+ TestContext.run(runnable, Display.getCurrent() != null, new NullProgressMonitor(), display);
+ } catch (InvocationTargetException e)
+ {
+ logger().logDebug(e.getMessage(), e);
+ } catch (InterruptedException e)
+ {
+ logger().logDebug(e.getMessage(), e);
+ }
+ }
+
+ private static ILogger logger()
+ {
+ return new Logger();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ClassLoadingTest.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ClassLoadingTest.java
new file mode 100755
index 0000000..d3cac49
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ClassLoadingTest.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.project;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+
+/**
+ * Extends {@link ProjectBasedTest} by adding finctionalities to create classes in some package eider by reading it from text file or passed as
+ * strings.
+ *
+ * </pre>
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("nls")
+public abstract class ClassLoadingTest extends ProjectBasedTest
+{
+ private final static String JAVA_EXT = ".java";
+
+ private final static char SEPARATOR = '#';
+
+ protected IPackageFragment defaultPackage;
+
+ public void createJavaProject(String srcFolder, String defaultPackageName) throws CoreException
+ {
+ createJavaProject(srcFolder);
+
+ if (defaultPackageName != null)
+ {
+ defaultPackage = getSourceFolder().createPackageFragment(defaultPackageName, true, null);
+ }
+ }
+
+ /**
+ * Creates class in test project. <code>sourceFilePath</code> must contain the class source without package declaration. The class is created in
+ * default package.
+ *
+ * Project must be created before this method is called.
+ *
+ * @param sourceFilePath
+ * @param className
+ * @return IType object for the created class
+ * @throws IOException
+ * @throws JavaModelException
+ */
+ protected IType createClass(String sourceFilePath, String className) throws IOException, JavaModelException
+ {
+ if (sourceFilePath == null)
+ {
+ throw new NullPointerException("sourceFilePath should not be null.");
+ }
+
+ String source = TestProjectsUtils.readSource(this.getClass(), sourceFilePath);
+
+ return createClass(defaultPackage, className, source);
+ }
+
+ /**
+ * Creates class in <code>pck</code> package with name and source <code>className, source</code>. Source must not incluse package
+ * declaration. Project must be created before this method is called.
+ *
+ * @param pck
+ * @param className
+ * @param source
+ * @return
+ * @throws NullPointerException
+ * in case some of the params is null.
+ * @throws JavaModelException
+ */
+ protected IType createClass(IPackageFragment pck, String className, String source) throws JavaModelException
+ {
+ if (className == null)
+ {
+ throw new NullPointerException("param 'className' should not be null.");
+ }
+
+ if (source == null)
+ {
+ throw new NullPointerException("param 'source' should not be null.");
+ }
+
+ if (getTestProject() == null)
+ {
+ throw new NullPointerException("project must be created before classes can be added to it");
+ }
+
+ return getTestProject().createType(pck, className + JAVA_EXT, source);
+ }
+
+ /**
+ * Reads the content of <code>sourcesFilePath</code> and creates classes in test project. The content of <code>sourcesFilePath</code> sould be -
+ * '#' char (separator for classes) followed by Class name, new line and after that class source without package declaration.<br>
+ * Example:
+ *
+ * <pre>
+ * #ImplementsRemote
+ * public class ImplementsRemote implements java.rmi.Remote
+ * {
+ * }
+ *
+ * #NoDefaultConstructor
+ * public class NoDefaultConstructor implements java.io.Serializable
+ * {
+ * public NoDefaultConstructor(String param) {
+ * }
+ * }
+ * </pre>
+ *
+ * This method is useful if lots of small classes should be created from a source file. Project must be created before this method is called.
+ *
+ * @param sourcesFilePath
+ * @return map of className->IType. that have been created
+ * @throws Exception
+ */
+ protected Map<String, IType> createClasses(String sourcesFilePath) throws Exception
+ {
+ Map<String, IType> types = new HashMap<String, IType>();
+ String source = TestProjectsUtils.readSource(this.getClass(), sourcesFilePath);
+
+ int startPos = 0;
+ while ((startPos = source.indexOf(SEPARATOR)) > -1)
+ {
+ int endPos = source.indexOf(SEPARATOR, startPos + 1);
+ if (endPos == -1)
+ endPos = source.length();
+
+ String src = source.substring(startPos + 1, endPos);
+ source = source.substring(endPos);
+
+ String className = src.substring(0, src.indexOf('\n')).replaceAll("\r", "");
+ src = src.substring(src.indexOf('\n') + 1);
+
+ types.put(className, createClass(defaultPackage, className, src));
+ }
+
+ return types;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ProjectBasedTest.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ProjectBasedTest.java
new file mode 100755
index 0000000..44e0898
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/ProjectBasedTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.project;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+
+/**
+ * General class for tests that should be started as JUnit Plugin tests. Provides basic functionalities for functional testing: 1. Create Java project
+ * in junit-runtime-workbench. 2. Create default source folder. 3. Create default package.
+ *
+ * @author Georgi Vachkov
+ */
+public abstract class ProjectBasedTest extends TestCase
+{
+ private TestProject project;
+
+ /**
+ * <code>srcFolderName</code> the source folder where classes will be created, <code>packageName</code> is the package where classes will be
+ * created.
+ *
+ * @param srcFolderName
+ * @throws CoreException
+ * @throws NullPointerException -
+ * in case srcFolderName is null
+ */
+ protected void createJavaProject(String srcFolderName) throws CoreException
+ {
+ if (srcFolderName == null)
+ {
+ throw new NullPointerException("srcFolderName should not be null.");
+ }
+
+ project = new TestProject();
+ project.createSourceFolder(srcFolderName);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (project != null)
+ {
+ project.dispose();
+ }
+ }
+
+ protected final TestProject getTestProject()
+ {
+ return project;
+ }
+
+ protected IPackageFragmentRoot getSourceFolder()
+ {
+ return project.getSourceFolder();
+ }
+
+ protected String getProjectName()
+ {
+ return project.getProject().getName();
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestEjb3Project.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestEjb3Project.java
new file mode 100755
index 0000000..a0a79b5
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestEjb3Project.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.project;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.exception.MissingResourceException;
+
+public class TestEjb3Project
+{
+ private IProject ejbProject;
+
+ public TestEjb3Project(final String name) throws Exception
+ {
+ ejbProject = createEjbModule(name + "_" + Long.toString(System.currentTimeMillis()));
+ }
+
+ public TestEjb3Project(final String name, final boolean appendUid, final boolean reuseExisting) throws Exception
+ {
+ final StringBuilder projectName = new StringBuilder(name);
+ if (appendUid)
+ {
+ projectName.append("_");
+ projectName.append(Long.toString(System.currentTimeMillis()));
+ }
+ IProject existingProject = null;
+ if (reuseExisting)
+ {
+ existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName.toString());
+ }
+ if (existingProject == null)
+ {
+ this.ejbProject = createEjbModule(projectName.toString());
+ } else
+ {
+ this.ejbProject = existingProject;
+ }
+ }
+
+ private IProject createEjbModule(final String name) throws Exception {
+ return TestProjectsUtils.createEjb3Project(name);
+ }
+
+ public IProject getProject()
+ {
+ return ejbProject.getProject();
+ }
+
+ public IFolder getMetaInfFolder() throws MissingResourceException
+ {
+ return ejbProject.getProject().getFolder("ejbModule").getFolder("META-INF");
+ }
+
+ public IPackageFragment createPackage(String sourceFolder, String packageName) throws JavaModelException
+ {
+ final IJavaProject javaProject = JavaCore.create(getProject());
+ final IFolder folder = getProject().getFolder(sourceFolder);
+ final IPackageFragmentRoot srcFolder = javaProject.getPackageFragmentRoot(folder);
+ return srcFolder.createPackageFragment(packageName, false, new NullProgressMonitor());
+ }
+
+ public IFile createFile(final IFolder folder, final String fileName, final URL inputUrl) throws IOException, CoreException
+ {
+ ContractChecker.nullCheckParam(folder, "folder");
+ ContractChecker.nullCheckParam(fileName, "fileName");
+ ContractChecker.nullCheckParam(inputUrl, "inputUrl");
+
+ final IFile file = folder.getFile(fileName);
+ final InputStream inputStream = inputUrl.openStream();
+ try
+ {
+ file.create(inputStream, false, new NullProgressMonitor());
+ return file;
+ }
+ finally
+ {
+ inputStream.close();
+ }
+ }
+
+ /** To get a handle to a file located in this project specified by the relative file path.
+ * @param filePath file path relative inside of the project, i.e. the project name must NOT
+ * be part of the path
+ * @return the file handle */
+ public final IFile getFile(final String filePath)
+ {
+ ContractChecker.nullCheckParam(filePath, "filePath");
+ return this.ejbProject.getProject().getFile(filePath);
+ }
+
+ public final void deleteFile(final IFolder folder, final String fileName) throws CoreException, IOException
+ {
+ ContractChecker.nullCheckParam(folder, "folder");
+ ContractChecker.nullCheckParam(fileName, "fileName");
+
+ final IFile file = folder.getFile(fileName);
+ if (file.exists())
+ {
+ file.delete(true, new NullProgressMonitor());
+ }
+ }
+
+ /** To create a project folder specified by the relative folder path. All folder segments
+ * have already to exist apart from the last one, i.e. parent folders are not created automatically.
+ * @param folderPath folder path relative inside of the project, i.e. the project name must NOT
+ * be part of the path
+ * @return the created folder
+ * @throws CoreException */
+ public final IFolder createFolder(final String folderPath) throws CoreException
+ {
+ ContractChecker.nullCheckParam(folderPath, "folderPath");
+
+ final IFolder folder = this.ejbProject.getProject().getFolder(folderPath);
+ folder.create(true, true, null);
+ return folder;
+ }
+
+ /** To get a handle to a project folder specified by the relative folder path.
+ * @param folderPath folder path relative inside of the project, i.e. the project name must NOT
+ * be part of the path
+ * @return the folder handle */
+ public final IFolder getFolder(final String folderPath)
+ {
+ ContractChecker.nullCheckParam(folderPath, "folderPath");
+ return this.ejbProject.getProject().getFolder(folderPath);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProject.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProject.java
new file mode 100755
index 0000000..020758b
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProject.java
@@ -0,0 +1,390 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.project;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.internal.resources.ResourceException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.osgi.framework.Bundle;
+
+@SuppressWarnings("restriction")
+public class TestProject
+{
+ public final static char CLASS_SEPARATOR = '#';
+
+ private int idInMillis = 0;
+
+ private IProject project;
+
+ private IJavaProject javaProject;
+
+ private IPackageFragmentRoot sourceFolder;
+
+ public TestProject() throws CoreException
+ {
+ this("");
+ }
+
+ public TestProject(String name) throws CoreException
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ /*
+ * Calculate the name of the test project. The formula: JavaProj_ + <current_time_in_millis? + <idInMillis> is ussed. In this formula
+ * JavaProj_ is a string litteral, current_time_in_millis is obvious. idInMillis is an integer incremented each time a project name is
+ * calculated. This is necessary because the system timer has precision about 10 ms. Thus it's possible that two consecutive project creations
+ * give the same project name. For example the project is creted then the test executes very fast and a new project is created again. In the
+ * same time simply the id is not enough as a different test run might produce the same project name. Thus the combination tim_millis +
+ * idInMillis gives a unique project name
+ */
+ final String testProjectName = "JavaProj_" + Long.toString(System.currentTimeMillis()) + "_" + idInMillis++ + name;
+ project = root.getProject(testProjectName);
+ project.create(null);
+ project.open(null);
+
+ configureJavaProject();
+ }
+
+ private void configureJavaProject() throws CoreException
+ {
+ javaProject = JavaCore.create(project);
+
+ IFolder binFolder = createBinFolder();
+
+ setJavaNature();
+ javaProject.setRawClasspath(new IClasspathEntry[0], null);
+
+ createOutputFolder(binFolder);
+ addSystemLibraries();
+ }
+
+ public TestProject(final IProject project) throws CoreException
+ {
+ if (project == null)
+ {
+ throw new NullPointerException("project should not be null");
+ }
+
+ this.project = project;
+ this.javaProject = JavaCore.create(project);
+ this.sourceFolder = findSourceFolder();
+ }
+
+ private IPackageFragmentRoot findSourceFolder() throws JavaModelException
+ {
+ for (IPackageFragmentRoot pfr : javaProject.getAllPackageFragmentRoots())
+ {
+ if (pfr.getKind() == IPackageFragmentRoot.K_SOURCE)
+ {
+ return pfr;
+ }
+ }
+
+ return null;
+ }
+
+ public IProject getProject()
+ {
+ return project;
+ }
+
+ public IJavaProject getJavaProject()
+ {
+ return javaProject;
+ }
+
+ public void addJar(String plugin, String jar) throws MalformedURLException, IOException, JavaModelException
+ {
+ Path result = findFileInPlugin(plugin, jar);
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ newEntries[oldEntries.length] = JavaCore.newLibraryEntry(result, null, null);
+ javaProject.setRawClasspath(newEntries, null);
+
+ String log = "\n"+javaProject.getProject().getName()+"\n"+String.valueOf(javaProject.getRawClasspath().length)+"\n";
+
+ for(int ii=0; ii < javaProject.getRawClasspath().length; ii++)
+ {
+ log = log + javaProject.getRawClasspath()[ii].getPath().toString()+"\n";
+ }
+
+ if(javaProject.getRawClasspath().length==0)
+ {
+ log = log + "Classpath not initialized !\n";
+ }
+
+ ResourcesPlugin.getPlugin().getLog().log(new Status(0,"testOutput",log));
+ }
+
+ public IPackageFragment createPackage(String name) throws CoreException
+ {
+ if (sourceFolder == null)
+ sourceFolder = createSourceFolder("src");
+ return sourceFolder.createPackageFragment(name, false, null);
+ }
+
+ public IType createType(IPackageFragment pack, String cuName, String source) throws JavaModelException
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("package " + pack.getElementName() + ";\n");
+ buf.append("\n");
+ buf.append(source);
+ ICompilationUnit cu = pack.createCompilationUnit(cuName, buf.toString(), false, null);
+ return cu.getTypes()[0];
+ }
+
+
+ /**
+ * Creates multiple classes in project. The content of <code>source</code> should be in form -
+ * '#' char (separator for classes) followed by Class name, new line and after that class source without package declaration.<br>
+ * Example:
+ *
+ * <pre>
+ * #ImplementsRemote
+ * public class ImplementsRemote implements java.rmi.Remote
+ * {
+ * }
+ *
+ * #NoDefaultConstructor
+ * public class NoDefaultConstructor implements java.io.Serializable
+ * {
+ * public NoDefaultConstructor(String param) {
+ * }
+ * }
+ * </pre>
+ *
+ * This method is useful if lots of small classes should be created from a source file.
+ *
+ * @param sourcesFilePath
+ * @return map of className->IType. that have been created
+ * @throws Exception
+ */
+ public Map<String, IType> createTypes(IPackageFragment pack, String source) throws Exception
+ {
+ Map<String, IType> types = new HashMap<String, IType>();
+ int startPos = 0;
+ while ((startPos = source.indexOf(CLASS_SEPARATOR)) > -1)
+ {
+ int endPos = source.indexOf(CLASS_SEPARATOR, startPos + 1);
+ if (endPos == -1) {
+ endPos = source.length();
+ }
+
+ String src = source.substring(startPos + 1, endPos);
+ source = source.substring(endPos);
+
+ String className = src.substring(0, src.indexOf('\n')).replaceAll("\r", "").trim();
+ src = src.substring(src.indexOf('\n') + 1);
+
+ types.put(className, createType(pack, className + ".java", src));
+ }
+
+ return types;
+ }
+
+ public void dispose() throws CoreException
+ {
+ JobUtils.waitForJobs();
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ project.delete(true, true, null);
+ } catch (ResourceException re) {
+ /*
+ * silently swallow the resource exception. For some reason this exception gets thrown
+ * from time to time and reports the test failing. The project deletion itself happens
+ * after the test has completed and a failure will not report a problem in the test.
+ * Only ResourceException is caught in order not to hide unexpected errors.
+ */
+ return;
+ }
+ }
+ public void close() throws CoreException
+ {
+ JobUtils.waitForJobs();
+
+ project.close(new NullProgressMonitor());
+ }
+
+ private IFolder createBinFolder() throws CoreException
+ {
+ IFolder binFolder = project.getFolder("bin");
+ binFolder.create(false, true, null);
+ return binFolder;
+ }
+
+ private void setJavaNature() throws CoreException
+ {
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] { JavaCore.NATURE_ID });
+ project.setDescription(description, null);
+ }
+
+ private void createOutputFolder(IFolder binFolder) throws JavaModelException
+ {
+ IPath outputLocation = binFolder.getFullPath();
+ javaProject.setOutputLocation(outputLocation, null);
+ }
+
+ public IPackageFragmentRoot createSourceFolder(String name) throws CoreException
+ {
+ IFolder folder = project.getFolder(name);
+ folder.create(false, true, null);
+ IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
+
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ newEntries[oldEntries.length] = JavaCore.newSourceEntry(root.getPath());
+ javaProject.setRawClasspath(newEntries, null);
+ this.sourceFolder = root;
+
+ String log = "\n"+javaProject.getProject().getName()+"\n"+String.valueOf(javaProject.getRawClasspath().length)+"\n";
+
+ for(int ii=0; ii < javaProject.getRawClasspath().length; ii++)
+ {
+ log = log + javaProject.getRawClasspath()[ii].getPath().toString()+"\n";
+ }
+
+ if(javaProject.getRawClasspath().length==0)
+ {
+ log = log + "Classpath not initialized !\n";
+ }
+
+ ResourcesPlugin.getPlugin().getLog().log(new Status(0,"testOutput",log));
+
+ return root;
+ }
+
+ private void addSystemLibraries() throws JavaModelException
+ {
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ newEntries[oldEntries.length] = JavaRuntime.getDefaultJREContainerEntry();
+ javaProject.setRawClasspath(newEntries, null);
+
+ String log = "\n"+javaProject.getProject().getName()+"\n"+String.valueOf(javaProject.getRawClasspath().length)+"\n";
+
+ for(int ii=0; ii < javaProject.getRawClasspath().length; ii++)
+ {
+ log = log + javaProject.getRawClasspath()[ii].getPath().toString()+"\n";
+ }
+
+ if(javaProject.getRawClasspath().length==0)
+ {
+ log = log + "Classpath not initialized !\n";
+ }
+
+ ResourcesPlugin.getPlugin().getLog().log(new Status(0,"testOutput",log));
+ }
+
+ private Path findFileInPlugin(String plugin, String file) throws MalformedURLException, IOException
+ {
+ Bundle pluginBundle = Platform.getBundle(plugin);
+ URL jarURL = new URL(pluginBundle.getEntry("/"), file);
+ URL localJarURL = FileLocator.toFileURL(jarURL);
+ return new Path(localJarURL.getPath());
+ }
+
+ public IPackageFragmentRoot getSourceFolder()
+ {
+ return sourceFolder;
+ }
+
+ /**
+ *
+ * @return the container corresponding to the package fragment root, i.e. the source folder.<br>
+ * If this project is a jar/zip (if this is possible at all), the method will return null.
+ */
+ public IContainer getSourceFolderContainer()
+ {
+ try{
+ IResource res = getSourceFolder().getCorrespondingResource();
+ if(res==null) {
+ return null;
+ }else {
+ IContainer retVal = (IContainer) res;
+ return retVal;
+ }
+ }catch(JavaModelException ex) {
+ return null;
+ }catch(ClassCastException ex) {
+ return null;
+ }
+ }
+
+ public IFolder createFolder(final String folderName) throws CoreException
+ {
+ ContractChecker.nullCheckParam(folderName, "folderName");
+ final IFolder folder = this.project.getFolder(folderName);
+ folder.create(false, true, null);
+ return folder;
+ }
+
+ /**
+ * Set the project root as source folder
+ * @throws JavaModelException
+ */
+ public void assignProjectRootAsSourceFolder() throws JavaModelException
+ {
+ IClasspathEntry defaultSrcFolderEntry = JavaCore.newSourceEntry(project.getFullPath());
+ IClasspathEntry[] oldCp = javaProject.getRawClasspath();
+ IClasspathEntry[] newCp = new IClasspathEntry[oldCp.length + 1];
+ System.arraycopy(oldCp, 0, newCp, 0, oldCp.length);
+ newCp[newCp.length - 1] = defaultSrcFolderEntry;
+
+ javaProject.setRawClasspath(newCp, null);
+ this.sourceFolder = TestProjectsUtils.getSourceFolder(project, "");
+
+ String log = "\n"+javaProject.getProject().getName()+"\n"+String.valueOf(javaProject.getRawClasspath().length)+"\n";
+
+ for(int ii=0; ii < javaProject.getRawClasspath().length; ii++)
+ {
+ log = log + javaProject.getRawClasspath()[ii].getPath().toString()+"\n";
+ }
+
+ if(javaProject.getRawClasspath().length==0)
+ {
+ log = log + "Classpath not initialized !\n";
+ }
+
+ ResourcesPlugin.getPlugin().getLog().log(new Status(0,"testOutput",log));
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java
new file mode 100755
index 0000000..ebb3382
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.project;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.TypeNameRequestor;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.ws.jaxws.testutils.jobs.JobUtils;
+import org.eclipse.jst.ws.jaxws.testutils.threading.TestContext;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class TestProjectsUtils
+{
+ /**
+ * Reads content of text file and returns it as String.
+ *
+ * @param class context
+ * @param name
+ * @return
+ * @throws IOException
+ */
+ public static String readSource(Class<?> classContext, String filePath) throws IOException
+ {
+ InputStreamReader isr = new InputStreamReader(classContext.getResourceAsStream(filePath));
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ char[] buff = new char[512];
+
+ int len = 0;
+ while ((len = isr.read(buff)) > 0)
+ {
+ sb.append(String.valueOf(buff, 0, len));
+ }
+
+ return sb.toString();
+
+ } finally
+ {
+ isr.close();
+ }
+ }
+
+ /**
+ * Starts an indexer job. This method is useful to make sure that all workbench refresh/build processes are over
+ * @throws JavaModelException
+ */
+ public static void waitForIndexer() throws JavaModelException
+ {
+ new SearchEngine().searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH,
+ null, SearchPattern.R_CASE_SENSITIVE,
+ IJavaSearchConstants.CLASS,
+ SearchEngine.createJavaSearchScope(new IJavaElement[0]), new TypeNameRequestor()
+ {
+ @SuppressWarnings("unused")
+ public void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames,
+ String path)
+ {
+ }
+ @SuppressWarnings("unused")
+ public void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames,
+ String path)
+ {
+ }
+ },
+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
+ }
+
+
+ public static IProject createJavaProject(String projectName) throws CoreException
+ {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ project.create(null);
+ project.open(null);
+ JobUtils.waitForIndexer();
+
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] { JavaCore.NATURE_ID });
+ project.setDescription(description, null);
+ IJavaProject javaP = JavaCore.create(project);
+ addToClasspath(javaP, JavaRuntime.getDefaultJREContainerEntry());
+
+ return project;
+ }
+
+ private static void addToClasspath(final IJavaProject javaProject, final IClasspathEntry cpEntry) throws JavaModelException
+ {
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ newEntries[oldEntries.length] = cpEntry;
+ javaProject.setRawClasspath(newEntries, null);
+ }
+
+ public static IPackageFragmentRoot getSourceFolder(IProject project, String folderName) throws JavaModelException
+ {
+ IJavaProject javaProject = JavaCore.create(project);
+ for(IPackageFragmentRoot root : javaProject.getPackageFragmentRoots())
+ {
+ if(root.getElementName().equals(folderName))
+ {
+ return root;
+ }
+ }
+
+ return null;
+ }
+
+ public static IPackageFragmentRoot createSourceFolder(IProject project, String folderName) throws CoreException
+ {
+ if(getSourceFolder(project, folderName) != null)
+ {
+ throw new IllegalStateException("Source folder already exists: " + folderName);
+ }
+
+ IFolder srcFolder = project.getFolder(folderName);
+ srcFolder.create(true, true, null);
+
+ IJavaProject javaProject = JavaCore.create(project);
+ IClasspathEntry srcCpEntry = JavaCore.newSourceEntry(srcFolder.getFullPath().makeAbsolute());
+ IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+ IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+ System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+ newEntries[newEntries.length - 1] = srcCpEntry;
+ javaProject.setRawClasspath(newEntries, null);
+
+ return getSourceFolder(project, folderName);
+ }
+
+ /**
+ * Imports a file into a project
+ * @param classContext the class which classloader is used to get the source resource
+ * @param relativeSrcFileLocation source file location relative to the <code>classContext</code> parameter
+ * @param targetResource the target resource;
+ * @param targetFileName the name of the file to be created
+ * @throws IOException
+ * @returns the file imported
+ */
+ public static File importFileIntoProject(Class<?> classContext, String relativeSrcFileLocation, IContainer targetResource, String targetFileName) throws IOException
+ {
+ String src = TestProjectsUtils.readSource(classContext, relativeSrcFileLocation);
+ File f = new File(targetResource.getLocation().toOSString() + "\\" + targetFileName);
+
+ if(f.exists())
+ {
+ throw new IllegalStateException("File already exists: " + f.getAbsolutePath());
+ }
+
+ if(f.isDirectory())
+ {
+ throw new IllegalStateException(f.getAbsolutePath() + " is a directory");
+ }
+ if( f.createNewFile() )
+ {
+ BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f)));
+ out.write(src);
+ out.flush();
+ out.close();
+ }
+
+ return f;
+ }
+
+ public static void deleteWorkspaceProjects() throws JavaModelException
+ {
+ final IProgressMonitor monitor = new NullProgressMonitor();
+ JobUtils.waitForJobs();
+ for(IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects())
+ {
+ try
+ {
+ project.delete(false, monitor);
+ } catch (CoreException e)
+ {
+ (new Logger()).logError(e.getMessage());
+ }
+ JobUtils.waitForJobs();
+ }
+ }
+
+ public static IProject createEjb3Project(final String projectName) throws CoreException
+ {
+ final IProject ejbProject = createProjectWithFacet(projectName, new String[]{"jst.java", "jst.ejb"}, new String[]{"5.0", "3.0"});
+ final IJavaProject javaP = JavaCore.create(ejbProject);
+
+ removeAllSourceFolders(javaP);
+
+ // Set ejbModule folder (created during jst.ejb facet installation) as source folder
+ final IFolder srcFolder = ejbProject.getFolder("ejbModule");
+ final IClasspathEntry ejbModuleCpEntry = JavaCore.newSourceEntry(srcFolder.getFullPath().makeAbsolute());
+ addToClasspath(JavaCore.create(ejbProject), ejbModuleCpEntry);
+
+ return ejbProject;
+ }
+
+ private static void removeAllSourceFolders(final IJavaProject javaP) throws JavaModelException
+ {
+ final List<IClasspathEntry> newClasspath = new ArrayList<IClasspathEntry>();
+ for(IClasspathEntry cpEntry : javaP.getRawClasspath())
+ {
+ if(cpEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE)
+ {
+ continue;
+ }
+ newClasspath.add(cpEntry);
+ }
+ javaP.setRawClasspath(newClasspath.toArray(new IClasspathEntry[newClasspath.size()]), new NullProgressMonitor());
+ }
+
+ private static IProject createProjectWithFacet(final String projectName, final String[] facetId, final String[] facetVersion) throws CoreException
+ {
+ assert facetId.length == facetVersion.length;
+ final IProject[] result = new IProject[1];
+ try
+ {
+ TestContext.run(new IRunnableWithProgress(){
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ try
+ {
+ result[0] = createJavaProject(projectName);
+ final IFacetedProject facetedProject = ProjectFacetsManager.create(result[0], true, new NullProgressMonitor());
+
+ for(int i = 0; i < facetId.length; i++)
+ {
+ final IProjectFacet facet = ProjectFacetsManager.getProjectFacet(facetId[i]);
+ facetedProject.installProjectFacet(facet.getVersion(facetVersion[i]), null, monitor);
+ }
+
+ } catch (CoreException e)
+ {
+ throw new InvocationTargetException(e);
+ }
+ }}, true, new NullProgressMonitor(), PlatformUI.getWorkbench().getDisplay());
+ } catch (InvocationTargetException e)
+ {
+ if(e.getCause() instanceof CoreException)
+ {
+ throw (CoreException)e.getCause();
+ }
+ throw new RuntimeException(e);
+ } catch (InterruptedException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ return result[0];
+ }
+
+ /**
+ * Creates a dynamic web module project with "jst.web" facet ver. 2.5 installed
+ * @param projectName
+ * @throws CoreException
+ */
+ public static IProject createWeb25Project(final String projectName) throws CoreException
+ {
+ final IProject webProject = createProjectWithFacet(projectName, new String[]{"jst.java", "jst.web"}, new String[]{"5.0", "2.5"});
+ final IJavaProject javaP = JavaCore.create(webProject);
+
+ removeAllSourceFolders(javaP);
+
+ return webProject;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContext.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContext.java
new file mode 100755
index 0000000..7f76886
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContext.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.threading;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.operation.ModalContext;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility to execute runnable instances in a separate thread. Implementation is pretty similar to {@link ModalContext} but it uses {@link TestContextThread} to perform forking
+ *
+ * @author Danail Branekov
+ *
+ */
+public class TestContext
+{
+ /**
+ * Executes the operation specified in the caller or in a {@link TestContextThread} thread depending on the <code>fork</code> value. In case the caller of this method is a {@link TestContextThread} instance, the execution of the <code>operation</code> is performed in the current thread no matter
+ * of the <code>fork</code> value
+ *
+ * @param operation
+ * the operation; must not be null
+ * @param fork
+ * true to perform the <code>operation</code> in a {@link TestContextThread}; false to perform the <code>operation</code> in the current thread
+ * @param monitor
+ * progress monitor
+ * @param display TODO
+ * @throws InvocationTargetException
+ * @throws InterruptedException
+ */
+ public static void run(final IRunnableWithProgress operation, final boolean fork, final IProgressMonitor monitor, final Display display) throws InvocationTargetException, InterruptedException
+ {
+ ContractChecker.nullCheckParam(operation, "operation");
+
+ final boolean willFork = !isInTestContextThread() && fork;
+ if (willFork)
+ {
+ runInTestContextThread(operation, monitor, display);
+ } else
+ {
+ runInCurrentThread(operation, monitor);
+ }
+ }
+
+ /**
+ * Runs the operation in the current thread
+ *
+ * @param operation
+ * the operation
+ * @throws InvocationTargetException
+ * if a {@link Throwable} has been thrown during operation execution. The exception wraps that {@link Throwable}
+ */
+ private static void runInCurrentThread(final IRunnableWithProgress operation, final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ operation.run(monitor);
+ }
+
+ /**
+ * Runs the operation in a {@link TestContextThread}.
+ *
+ * @param runnable
+ * operation
+ * @throws InvocationTargetException
+ * if the {@link TestContextThread} finished with error
+ * @see TestContextThread#getError()
+ */
+ private static void runInTestContextThread(final IRunnableWithProgress runnable, final IProgressMonitor monitor, final Display display) throws InvocationTargetException
+ {
+ final TestContextThread contextThread = new TestContextThread(runnable, monitor, display);
+ contextThread.start();
+ contextThread.block();
+
+ if (contextThread.getError() != null)
+ {
+ if(contextThread.getError() instanceof InvocationTargetException) {
+ throw (InvocationTargetException)contextThread.getError();
+ }
+ else {
+ throw new InvocationTargetException(contextThread.getError());
+ }
+ }
+ }
+
+ /**
+ * Checks whether the current thread is instance of {@link TestContextThread}
+ */
+ private static boolean isInTestContextThread()
+ {
+ final Thread t = Thread.currentThread();
+ return t instanceof TestContextThread;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContextThread.java b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContextThread.java
new file mode 100755
index 0000000..ad1bb91
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/threading/TestContextThread.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.testutils.threading;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * {@link Thread} extender which is capable of providing event loop processing while the runnable is executed<br>
+ * A typical usage of this class should be:
+ *
+ * <pre>
+ * TestContextThread t = new TestContextThread(someRunnable());
+ * t.start();
+ * t.block();
+ * </pre>
+ *
+ * The implementation of this thread resembles to the ModalContextThread with the difference that it does not call {@link Display#sleep()} and is simplified in order to meet test requirements. The reason not to call {@link Display#sleep()} is that under certain conditions putting the display to
+ * sleep causes junit tests to wait forever
+ *
+ * @author Danail Branekov
+ */
+class TestContextThread extends Thread
+{
+ private boolean isRunning;
+ private Throwable errorThrowable;
+ private final IProgressMonitor monitor;
+ private final IRunnableWithProgress runnable;
+ private final Display display;
+
+ TestContextThread(final IRunnableWithProgress runnable, final IProgressMonitor monitor, final Display display)
+ {
+ super();
+ ContractChecker.nullCheckParam(runnable, "runnable");
+ ContractChecker.nullCheckParam(monitor, "monitor");
+
+ isRunning = true;
+ this.monitor = monitor;
+ this.runnable = runnable;
+ this.setName("TestContext");
+ this.setDaemon(true);
+ this.display = display;
+ }
+
+ /**
+ * Retrieves the error throwable which happened during execution
+ *
+ * @return the error throwable or null if none
+ */
+ public Throwable getError()
+ {
+ return errorThrowable;
+ }
+
+ @Override
+ public void run()
+ {
+ isRunning = true;
+ try
+ {
+ runnable.run(monitor);
+ } catch (Throwable t)
+ {
+ errorThrowable = t;
+ } finally
+ {
+ // Make sure that asynchronous events are processed by the event loop via sync execution of an "empty" runnable
+ display().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ }
+ });
+ isRunning = false;
+
+ // Force the display to wake up
+ display().asyncExec(null);
+ }
+ }
+
+ /**
+ * Blocks the caller while the {@link Runnable} specified in the constructor is being executed.<br>
+ * If the caller is the UI thread, {@link Display#readAndDispatch()} is invoked in order to ensure that the event loop is processed<br>
+ * If the caller is not a UI thread, this method simply joins. <br>
+ *
+ * @throws IllegalStateException
+ * in case the method is invoked within its own thread
+ */
+ public void block()
+ {
+ if (Thread.currentThread() == this)
+ {
+ throw new IllegalStateException("The method should not be called from inside the same thread");
+ }
+
+ if (Display.getCurrent() == null)
+ {
+ try
+ {
+ join();
+ } catch (Throwable e)
+ {
+ errorThrowable = e;
+ }
+ } else
+ {
+ while (isRunning)
+ {
+ if(!display().readAndDispatch())
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException e)
+ {
+ // ignore
+ (new Logger()).logDebug(e.getMessage(), e);
+ }
+ }
+ }
+ }
+ }
+
+ private Display display()
+ {
+ return display;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/.classpath b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/.project b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.project
new file mode 100755
index 0000000..4fb0308
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.utils.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.utils.tests/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..fc42c80
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Utils Tests (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.utils.tests
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.jst.ws.jaxws.utils
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.jst.ws.jaxws.testutils,
+ org.jmock,
+ org.junit
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/about.html b/tests/org.eclipse.jst.ws.jaxws.utils.tests/about.html
new file mode 100644
index 0000000..d2b7ace
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 20, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/build.properties b/tests/org.eclipse.jst.ws.jaxws.utils.tests/build.properties
new file mode 100755
index 0000000..2ff2ea1
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapterTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapterTest.java
new file mode 100755
index 0000000..f2bfd9c
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/resources/StringInputStreamAdapterTest.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.resources;
+
+import java.io.IOException;
+
+import org.eclipse.jst.ws.jaxws.utils.resources.StringInputStreamAdapter;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for StringInputStreamAdapter class
+ *
+ * @author Danail Branekov
+ *
+ */
+public class StringInputStreamAdapterTest extends TestCase
+{
+ public void testCreation()
+ {
+ try
+ {
+ new StringInputStreamAdapter(null);
+ fail("NPE expected");
+ } catch (NullPointerException e)
+ {
+ // expected
+ assertTrue(true);
+ }
+
+ StringInputStreamAdapter adapter = new StringInputStreamAdapter("ABC");
+ assertNotNull(adapter);
+ }
+
+ public void testRead()
+ {
+ try
+ {
+ StringInputStreamAdapter adapter = new StringInputStreamAdapter("ABC");
+ assertTrue(adapter.read() > 0);
+
+ adapter = new StringInputStreamAdapter("");
+ assertTrue(adapter.read() == -1);
+ } catch (IOException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/AllTestsSuite.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/AllTestsSuite.java
new file mode 100755
index 0000000..f8c1bfe
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/AllTestsSuite.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jst.ws.jaxws.utils.resources.StringInputStreamAdapterTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.FileUtilsUnitTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.JaxWsUtilsTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.AnnotationFactoryTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.AnnotationInspectorImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.AnnotationPropertyContainerTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.AnnotationUtilsTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.AnnotationsBaseImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.ArrayValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.BooleanValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.ClassValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.IntegerValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.ParamValuePairImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.QualifiedNameValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations.StringValueImplTest;
+import org.eclipse.jst.ws.jaxws.utils.tests.internal.clazz.ASTUtilsTest;
+
+
+public class AllTestsSuite
+{
+ /**
+ * Returns a test suite containing the tests to be run by Java Developer Test Dispatcher
+ *
+ * @return - a suite of junit pde test
+ */
+ public static Test suite()
+ {
+ final TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(AnnotationFactoryTest.class);
+ suite.addTestSuite(ArrayValueImplTest.class);
+ suite.addTestSuite(AnnotationsBaseImplTest.class);
+ suite.addTestSuite(AnnotationInspectorImplTest.class);
+ suite.addTestSuite(AnnotationUtilsTest.class);
+ suite.addTestSuite(BooleanValueImplTest.class);
+ suite.addTestSuite(IntegerValueImplTest.class);
+ suite.addTestSuite(ParamValuePairImplTest.class);
+ suite.addTestSuite(QualifiedNameValueImplTest.class);
+ suite.addTestSuite(StringValueImplTest.class);
+ suite.addTestSuite(ClassValueImplTest.class);
+ suite.addTestSuite(AnnotationPropertyContainerTest.class);
+ suite.addTestSuite(ASTUtilsTest.class);
+ suite.addTestSuite(FileUtilsUnitTest.class);
+ suite.addTestSuite(JaxWsUtilsTest.class);
+ suite.addTestSuite(StringInputStreamAdapterTest.class);
+
+ return suite;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/FileUtilsUnitTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/FileUtilsUnitTest.java
new file mode 100755
index 0000000..5d4a914
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/FileUtilsUnitTest.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.StatusUtils;
+import org.eclipse.jst.ws.jaxws.utils.resources.FileUtils;
+import org.eclipse.jst.ws.jaxws.utils.resources.IFileUtils;
+import org.jmock.core.constraint.IsEqual;
+import org.jmock.core.constraint.IsSame;
+
+public class FileUtilsUnitTest extends MockObjectTestCase
+{
+ private final IFileUtils fileUtils = FileUtils.getInstance();
+ private Mock<ICompilationUnit> cuMock;
+ private final IProgressMonitor monitor = new NullProgressMonitor();
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ cuMock = mock(ICompilationUnit.class);
+ }
+
+ public void testSetCompilationUnitContentDealsCorrectlyWithWorkingCopy() throws JavaModelException
+ {
+ final String testContent = "MyTestContent";
+ final Mock<IBuffer> bufferMock = mock(IBuffer.class);
+ bufferMock.expects(once()).method("setContents").with(new IsSame(testContent));
+
+ cuMock.expects(once()).method("becomeWorkingCopy");
+ cuMock.expects(once()).method("getBuffer").will(returnValue(bufferMock.proxy()));
+ cuMock.expects(once()).method("commitWorkingCopy").with(new IsEqual(true), new IsSame(monitor));
+ cuMock.expects(once()).method("discardWorkingCopy");
+
+ fileUtils.setCompilationUnitContent(cuMock.proxy(), testContent, true, monitor);
+ }
+
+ public void testSetCompilationUnitContentDoesNotDiscardWorkingCopyOnJME()
+ {
+ final JavaModelException testException = new JavaModelException(new CoreException(StatusUtils.statusError("TEST")));
+ cuMock.expects(once()).method("becomeWorkingCopy").will(throwException(testException));
+ cuMock.expects(never()).method("discardWorkingCopy");
+ cuMock.expects(never()).method("commitWorkingCopy");
+
+ try
+ {
+ fileUtils.setCompilationUnitContent(cuMock.proxy(), "123", true, monitor);
+ }
+ catch(JavaModelException e)
+ {
+ assertTrue("Test exception was not caught", e == testException);
+ }
+ }
+
+ public void testSetCuContentSavesDirtyEditors() throws JavaModelException
+ {
+ final boolean[] saveEditorInvoked = new boolean[]{false};
+ final boolean[] setContentsInvoked = new boolean[]{false};
+
+ final IFileUtils myFileUtils = new FileUtils(){
+ public boolean isCompilationUnitDisplayedInDirtyEditor(final ICompilationUnit cu)
+ {
+ assertTrue("Unexpected compilation unit", cu == cuMock.proxy());
+ return true;
+ }
+
+ @Override
+ public void saveEditor(final ICompilationUnit cu)
+ {
+ assertTrue("Save editors invoked before set CU content", setContentsInvoked[0]);
+ assertTrue("Unexpected compilation unit", cu == cuMock.proxy());
+ saveEditorInvoked[0] = true;
+ }
+
+ @Override
+ public void setCompilationUnitContent(ICompilationUnit unit, String content, boolean force, IProgressMonitor monitor)
+ throws JavaModelException
+ {
+ assertFalse("Set CU content invoked after editor saved", saveEditorInvoked[0]);
+ assertEquals("Unexpected CU content", "MyContent", content);
+ setContentsInvoked[0] = true;
+ }
+ };
+
+ myFileUtils.setCompilationUnitContentAndSaveDirtyEditors(cuMock.proxy(), "MyContent", true, null);
+ assertTrue("Set contents not invoked", setContentsInvoked[0]);
+ assertTrue("Save editors not invoked", saveEditorInvoked[0]);
+ }
+
+ public void testSetCuContentDoesNotSavesCleanEditors() throws JavaModelException
+ {
+ final boolean[] isDisplayedInvoked = new boolean[]{false};
+ final boolean[] setContentsInvoked = new boolean[]{false};
+
+ final IFileUtils myFileUtils = new FileUtils(){
+ public boolean isCompilationUnitDisplayedInDirtyEditor(final ICompilationUnit cu)
+ {
+ assertTrue("Unexpected compilation unit", cu == cuMock.proxy());
+ isDisplayedInvoked[0] = true;
+ return false;
+ }
+
+ @Override
+ public void saveEditor(final ICompilationUnit cu)
+ {
+ fail("Unexpected invocation");
+ }
+
+ @Override
+ public void setCompilationUnitContent(ICompilationUnit unit, String content, boolean force, IProgressMonitor monitor)
+ throws JavaModelException
+ {
+ assertFalse("Set CU content invoked after editor saved", isDisplayedInvoked[0]);
+ assertEquals("Unexpected CU content", "MyContent", content);
+ setContentsInvoked[0] = true;
+ }
+ };
+
+ myFileUtils.setCompilationUnitContentAndSaveDirtyEditors(cuMock.proxy(), "MyContent", true, null);
+ assertTrue("Set contents not invoked", setContentsInvoked[0]);
+ assertTrue("Is displayed in dirty editor not invoked", isDisplayedInvoked[0]);
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/JaxWsUtilsTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/JaxWsUtilsTest.java
new file mode 100755
index 0000000..010f4b5
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/JaxWsUtilsTest.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal;
+
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.JaxWsUtils;
+
+public class JaxWsUtilsTest extends MockObjectTestCase
+{
+ private static final String CLASS_NAME = "TestBean";
+ private static final String CLASS_FQ_NAME = "org.eclipse.test." + CLASS_NAME;
+
+
+ public void testComposeJaxWsTargetNamespaceByPackage_WithNull()
+ {
+ try
+ {
+ JaxWsUtils.composeJaxWsTargetNamespaceByPackage(null);
+ fail("NPE expected");
+ } catch (Exception e)
+ {
+ // expected
+ assertTrue(true);
+ }
+ }
+
+ public void testComposeJaxWsTargetNamespaceByPackage()
+ {
+ String ns = JaxWsUtils.composeJaxWsTargetNamespaceByPackage("");
+ assertTrue(ns.equals("http:///"));
+ ns = JaxWsUtils.composeJaxWsTargetNamespaceByPackage("a");
+ assertTrue(ns.equals("http://a/"));
+ ns = JaxWsUtils.composeJaxWsTargetNamespaceByPackage("a.b.c");
+ assertTrue(ns.equals("http://b.a/c/"));
+ ns = JaxWsUtils.composeJaxWsTargetNamespaceByPackage("a.b.c.d");
+ assertTrue(ns.equals("http://b.a/c/d/"));
+ ns = JaxWsUtils.composeJaxWsTargetNamespaceByPackage("a.b.c.d.e");
+ assertTrue(ns.equals("http://b.a/c/d/e/"));
+ }
+
+ public void testGetDefaultServiceName()
+ {
+ try {
+ JaxWsUtils.getDefaultServiceName(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _){}
+
+ assertEquals(CLASS_NAME + "Service", JaxWsUtils.getDefaultServiceName(CLASS_FQ_NAME));
+ }
+
+ public void testGetDefaultPorttypeName()
+ {
+ try {
+ JaxWsUtils.getDefaultPorttypeName(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _){}
+
+ assertEquals(CLASS_NAME, JaxWsUtils.getDefaultPorttypeName(CLASS_FQ_NAME));
+ }
+
+ public void testGetDefaultPortName()
+ {
+ try {
+ JaxWsUtils.getDefaultPortName(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException _){}
+
+ assertEquals(CLASS_NAME + "Port", JaxWsUtils.getDefaultPortName(CLASS_FQ_NAME));
+ }
+
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationFactoryTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationFactoryTest.java
new file mode 100755
index 0000000..dd0cb95
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationFactoryTest.java
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+/**
+ * AnnotationFactory class test cases.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("nls")
+public class AnnotationFactoryTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+
+ public void testCreateStringValue()
+ {
+ try
+ {
+ AnnotationFactory.createStringValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ IValue strValue = AnnotationFactory.createStringValue("value");
+ assertNotNull(strValue);
+ assertTrue(strValue.toString().equals("value"));
+ }
+
+ public void testCreateParamValuePair()
+ {
+ IValue strValue = AnnotationFactory.createStringValue("value");
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue(null, strValue);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue("", null);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue("param", null);
+ fail("NullPointerException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+ IParamValuePair valuePair = AnnotationFactory.createParamValuePairValue("param", strValue);
+ assertNotNull(valuePair);
+ assertTrue(valuePair.getValue() instanceof IValue);
+ assertTrue(valuePair.getParam().equals("param"));
+ }
+
+ public void testCreateComplexAnnotation() throws Exception
+ {
+ IValue strValue1 = AnnotationFactory.createStringValue("value");
+ IParamValuePair valuePair1 = AnnotationFactory.createParamValuePairValue("param", strValue1);
+
+ IValue strValue2 = AnnotationFactory.createStringValue("value1");
+ IParamValuePair valuePair2 = AnnotationFactory.createParamValuePairValue("param1", strValue2);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(valuePair1);
+ paramValues.add(valuePair2);
+
+ try
+ {
+ AnnotationFactory.createAnnotation(null, paramValues, endpoint);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotation("", null, endpoint);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotation("MyName", null, endpoint);
+ fail("NullPointerException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+// try
+// {
+// AnnotationFactory.createAnnotation("MyName", new HashSet<IParamValuePair>());
+// fail("IllegalArgumentException not thrown");
+// }
+// catch (IllegalArgumentException e)
+// {
+// }
+
+
+ prepareProject();
+ IAnnotation<IType> ca = AnnotationFactory.createAnnotation("name", paramValues, endpoint);
+ assertNotNull(ca);
+ assertEquals(ca.getParamValuePairs().size(), 2);
+ }
+
+ public void testCreateValuePair()
+ {
+ try
+ {
+ AnnotationFactory.createParamValuePairValue("", null);
+ fail("NullPointerException not thrown");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createParamValuePairValue(null, null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+ }
+
+ public void testCreateArrayValue()
+ {
+ try
+ {
+ AnnotationFactory.createArrayValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createArrayValue(new HashSet<IValue>());
+ fail("IllegalArgumentException not thrown");
+ } catch (IllegalArgumentException e)
+ {
+ }
+
+ IValue strValue1 = AnnotationFactory.createStringValue("value1");
+ IValue strValue2 = AnnotationFactory.createStringValue("value2");
+ Set<IValue> values = new HashSet<IValue>();
+ values.add(strValue1);
+ values.add(strValue2);
+
+
+ IValue arrValue = AnnotationFactory.createArrayValue(values);
+ assertNotNull(arrValue);
+ assertTrue(arrValue.toString().equals("[value1, value2]"));
+ }
+
+ public void testCreateQualifiedNameValue()
+ {
+
+ try
+ {
+ AnnotationFactory.createQualifiedNameValue("QName");
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.createQualifiedNameValue(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ }
+
+ IValue qName = AnnotationFactory.createQualifiedNameValue("org.eclipse.demo.Test");
+ assertNotNull(qName);
+ assertTrue(qName.toString().equals("org.eclipse.demo.Test"));
+ }
+
+ public void testCreateBooleanValue()
+ {
+ IValue boolValue = AnnotationFactory.createBooleanValue(true);
+ assertNotNull(boolValue);
+ assertEquals(boolValue.toString(), "true");
+ }
+
+ public void testGetAnnotationsFromClass() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 2);
+ }
+
+// public void testGetAnnotationsFromField() throws Exception // $JL-EXC$
+// {
+// prepareProject();
+//
+// IField field = endpoint.getField("field1");
+// assertNotNull(field);
+//
+// IAnnotation[] annotations = AnnotationFactory.createAnnotattionInspector(endpoint).inspectMethod(method) getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 1);
+// }
+
+ public void testGetAnnotationsFromMethod() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);;
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 1);
+ }
+
+ public void testRemoveAnnotationsIType() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ try
+ {
+ AnnotationFactory.removeAnnotationsFromJavaElement(null);
+ fail("NullPointerException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint.getPackageFragment());
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint). inspectType();
+ assertTrue(annotations.size() == 0);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ @SuppressWarnings("unused")
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotations.size() == 0);
+ }
+
+ public void testRemoveAnnotationsITypeSetOfString() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ Set<String> toRemove = new HashSet<String>();
+ toRemove.add("WebService");
+ toRemove.add("WebMethod");
+
+ try
+ {
+ AnnotationFactory.removeAnnotations(null, toRemove);
+ fail("NullPointerException not thrown");
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+ try
+ {
+ AnnotationFactory.removeAnnotations(endpoint.getPackageFragment(), toRemove);
+ fail("IllegalArgumentException not thrown");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+
+
+ AnnotationFactory.removeAnnotations(endpoint, toRemove);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 1);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size() == 0);
+ }
+
+ public void testRemoveAnnotationsIField() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IField field = endpoint.getField("field1");
+ assertNotNull(field);
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(field);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 2);
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size() == 1);
+
+// annotations = AnnotationFactory.getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 0);
+ }
+
+ public void testRemoveAnnotationsIMethod() throws Exception // $JL-EXC$
+ {
+ prepareProject();
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ endpoint.getField("field1");
+
+ AnnotationFactory.removeAnnotationsFromJavaElement(method);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 2);
+
+ Collection<IAnnotation<IMethod>> annotationsMethod = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsMethod.size()== 0);
+
+// annotations = AnnotationFactory.getAnnotationsFromField(field);
+// assertNotNull(annotations);
+// assertTrue(annotations.length == 0);
+ }
+
+ private void prepareProject() throws Exception // $JL-EXC$
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationInspectorImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationInspectorImplTest.java
new file mode 100755
index 0000000..10845b8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationInspectorImplTest.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class AnnotationInspectorImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void setUpSpecific() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("EndpointAnnInspector.src", "EndpointAnnInspector");
+ }
+
+ public void testInspector() throws Exception
+ {
+ setUp();
+
+ try
+ {
+ AnnotationFactory.createAnnotationInspector(null).inspectType();
+ fail("NullPointerException should be thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(null);
+ fail("NullPointerException should be thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotationInspector(endpoint).inspectField(null);
+ fail("NullPointerException should be thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ try
+ {
+ AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(null);
+ fail("NullPointerException should be thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ IValue sv = AnnotationFactory.createStringValue("My Value");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", sv));
+
+ IAnnotation<IField> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint.getField("field1"));
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint.getField("field1"));
+
+ Collection<IAnnotation<IField>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(endpoint.getField("field1"));
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 1);
+ IAnnotation<IField> annP = annotations.iterator().next();
+ AnnotationWriter.getInstance().remove(annP);
+
+ annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(endpoint.getField("field1"));
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 0);
+
+
+ IMethod[] methods = endpoint.getMethods();
+ for (IMethod method : methods)
+ {
+ if(method.getRawParameterNames() != null && method.getRawParameterNames().length > 0)
+ {
+ for(int i = 0; i < method.getRawParameterNames().length; i++)
+ {
+ ITypeParameter param = method.getTypeParameter(method.getRawParameterNames()[i]);
+
+ IValue svParam = AnnotationFactory.createStringValue("String Valu Param");
+ Set<IParamValuePair> pvParam = new HashSet<IParamValuePair>();
+ pvParam.add(AnnotationFactory.createParamValuePairValue("ParamAtribute", svParam));
+ IAnnotation<ITypeParameter> annPam = AnnotationFactory.createAnnotation("ParamAnnotation", pvParam, param);
+ AnnotationWriter.getInstance().setAppliedElement(annPam, param);
+ Collection<IAnnotation<ITypeParameter>> paramAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(param);
+ assertNotNull(paramAnnotations);
+ assertTrue(paramAnnotations.size() == 1);
+ IAnnotation<ITypeParameter> tmpAnn = paramAnnotations.iterator().next();
+
+ AnnotationWriter.getInstance().remove(tmpAnn);
+ paramAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(param);
+ assertNotNull(paramAnnotations);
+ assertTrue(paramAnnotations.size() == 0);
+
+ annPam = AnnotationFactory.createAnnotation("ParamAnnotation2", pvParam, param);
+ AnnotationWriter.getInstance().setAppliedElement(annPam, param);
+ paramAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(param);
+ assertNotNull(paramAnnotations);
+ assertTrue(paramAnnotations.size() == 1);
+ AnnotationFactory.removeAnnotationsFromJavaElement(param);
+ paramAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(param);
+ assertNotNull(paramAnnotations);
+ assertTrue(paramAnnotations.size() == 0);
+ }
+ }
+ }
+ }
+
+ public void testInspectorSpecificAnnotation() throws Exception
+ {
+ setUpSpecific();
+
+ IAnnotation<IType> inspectedTypeAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectType("org.eclipse.demo.MyAnnotation");
+ assertNotNull(inspectedTypeAnnotation);
+ assertEquals(inspectedTypeAnnotation.getPropertyValue("myValue"), "MyString");
+
+ inspectedTypeAnnotation = null;
+
+ inspectedTypeAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectType("javax.jws.WebService");
+ assertNotNull(inspectedTypeAnnotation);
+ assertTrue("javax.jws.WebService".endsWith(inspectedTypeAnnotation.getAnnotationName()));
+ assertEquals(inspectedTypeAnnotation.getPropertyValue("serviceName"), "WSImplBeanService");
+ assertEquals(inspectedTypeAnnotation.getPropertyValue("name"), "WSImplBean");
+ assertEquals(inspectedTypeAnnotation.getPropertyValue("targetNamespace"), "http://demo/eclipse/org/");
+ assertEquals(inspectedTypeAnnotation.getPropertyValue("portName"), "WSImplBeanPort");
+
+ IField field = endpoint.getField("field1");
+ IAnnotation<IField> inspectedFieldAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(field, "org.eclipse.demo.MyFieldAnnotation");
+ assertNotNull(inspectedFieldAnnotation);
+ assertTrue("org.eclipse.demo.MyFieldAnnotation".endsWith(inspectedFieldAnnotation.getAnnotationName()));
+ assertEquals(inspectedFieldAnnotation.getPropertyValue("name"), "field1");
+
+ inspectedFieldAnnotation = null;
+
+ inspectedFieldAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(field, "javax.jws.WebField");
+ assertNotNull(inspectedFieldAnnotation);
+ assertTrue("javax.jws.WebField".endsWith(inspectedFieldAnnotation.getAnnotationName()));
+ assertEquals(inspectedFieldAnnotation.getPropertyValue("name"), "MyField");
+
+ IMethod method = endpoint.getMethods()[0];
+ IAnnotation<IMethod> inspectedMethodAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method, "org.eclipse.demo.MyMethodAnnotation");
+ assertNotNull(inspectedMethodAnnotation);
+ assertTrue("org.eclipse.demo.MyMethodAnnotation".endsWith(inspectedMethodAnnotation.getAnnotationName()));
+ assertEquals(inspectedMethodAnnotation.getPropertyValue("name"), "annotatedMethod");
+
+ inspectedMethodAnnotation = null;
+
+ inspectedMethodAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method, "javax.jws.WebMethod");
+ assertNotNull(inspectedMethodAnnotation);
+ assertTrue("javax.jws.WebMethod".endsWith(inspectedMethodAnnotation.getAnnotationName()));
+ assertEquals(inspectedMethodAnnotation.getPropertyValue("exclude"), "false");
+ assertEquals(inspectedMethodAnnotation.getPropertyValue("operationName"), "test");
+
+ ITypeParameter typeParameter = method.getTypeParameter("annotatedParam");
+ IAnnotation<ITypeParameter> inspectedParamAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter, "org.eclipse.demo.MyParamAnnotation");
+ assertNotNull(inspectedParamAnnotation);
+ assertTrue("org.eclipse.demo.MyParamAnnotation".endsWith(inspectedParamAnnotation.getAnnotationName()));
+ assertEquals(inspectedParamAnnotation.getPropertyValue("name"), "annotatedMyParam");
+
+ inspectedParamAnnotation = null;
+
+ inspectedParamAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter, "javax.jws.WebParam");
+ assertNotNull(inspectedParamAnnotation);
+ assertTrue("javax.jws.WebParam".endsWith(inspectedParamAnnotation.getAnnotationName()));
+ assertEquals(inspectedParamAnnotation.getPropertyValue("name"), "annotatedParam");
+ }
+
+ public void testInspectorLocatorRetrieved() throws Exception
+ {
+ setUpSpecific();
+ IAnnotation<IType> annotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectType("javax.jws.WebService");
+ assertNotNull(annotation);
+
+ assertEquals(11, annotation.getLocator().getLineNumber());
+ assertEquals(226, annotation.getLocator().getStartPosition());
+ assertEquals(134, annotation.getLocator().getLength());
+
+ assertEquals(11, getParam("portName", annotation).getLocator().getLineNumber());
+ assertEquals(334, getParam("portName", annotation).getLocator().getStartPosition());
+ assertEquals(25, getParam("portName", annotation).getLocator().getLength());
+ }
+
+ private IParamValuePair getParam(final String name, final IAnnotation<? extends IJavaElement> annotation)
+ {
+ for (IParamValuePair param : annotation.getParamValuePairs()) {
+ if(param.getParam().equals(name)) {
+ return param;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationPropertyContainerTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationPropertyContainerTest.java
new file mode 100755
index 0000000..f0dbe7f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationPropertyContainerTest.java
@@ -0,0 +1,365 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationProperty;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationPropertyContainer;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AttributeTypeEnum;
+
+public class AnnotationPropertyContainerTest extends MockObjectTestCase
+{
+ private Mock<IType> type = mock(IType.class);
+ private Mock<IMethod> method = mock(IMethod.class);
+ private Mock<ITypeParameter> typeParameter = mock(ITypeParameter.class);
+
+ public void testBase() throws Exception
+ {
+ AnnotationPropertyContainer container = new AnnotationPropertyContainer();
+ try
+ {
+ container.addAnnotationProperty(null, null);
+ fail("NullPointerException was not thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ try
+ {
+ AnnotationProperty annotationProperty = new AnnotationProperty("annotationName", "attributeName", "value", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, null);
+ fail("NullPointerException was not thrown!");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+
+ try
+ {
+ AnnotationProperty annotationProperty = new AnnotationProperty("annotationName", "attributeName", "value", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.PACKAGE);
+ fail("IllegalArgumentException was not thrown!");
+ }
+ catch (IllegalArgumentException e)
+ {
+ assertTrue(true);
+ }
+
+ }
+
+ public void testTypeLevel() throws Exception
+ {
+ AnnotationPropertyContainer container = new AnnotationPropertyContainer();
+ AnnotationProperty annotationProperty = new AnnotationProperty("annotationName", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 1);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 0);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 0);
+ Set<IAnnotation<IType>> typeAnnotations = container.getTypeAnnotations(type.proxy());
+
+ for (IAnnotation<IType> annotation : typeAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("annotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+
+ container = new AnnotationPropertyContainer();
+ annotationProperty = new AnnotationProperty("annotationName1", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName2", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName3", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("annotationName4", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 4);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 0);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 0);
+ typeAnnotations = container.getTypeAnnotations(type.proxy());
+
+ Set<String> names = new HashSet<String>();
+ names.clear();
+ names.add("annotationName1");
+ names.add("annotationName2");
+ names.add("annotationName3");
+ names.add("annotationName4");
+
+ for (IAnnotation<IType> annotation : typeAnnotations)
+ {
+ assertTrue(names.contains(annotation.getAnnotationName()));
+ names.remove(annotation.getAnnotationName());
+ if(annotation.getAnnotationName().equals("annotationName1"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName2"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName3"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName4"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+ }
+ }
+
+ public void testMethodLevel() throws Exception
+ {
+ AnnotationPropertyContainer container = new AnnotationPropertyContainer();
+ AnnotationProperty annotationProperty = new AnnotationProperty("annotationName", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 0);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 0);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 1);
+ Set<IAnnotation<IMethod>> methodAnnotations = container.getMethodAnnotations(method.proxy());
+
+ for (IAnnotation<IMethod> annotation : methodAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("annotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+
+ container = new AnnotationPropertyContainer();
+ annotationProperty = new AnnotationProperty("annotationName1", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName2", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName3", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("annotationName4", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 0);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 0);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 4);
+ methodAnnotations = container.getMethodAnnotations(method.proxy());
+
+ Set<String> names = new HashSet<String>();
+ names.clear();
+ names.add("annotationName1");
+ names.add("annotationName2");
+ names.add("annotationName3");
+ names.add("annotationName4");
+
+ for (IAnnotation<IMethod> annotation : methodAnnotations)
+ {
+ assertTrue(names.contains(annotation.getAnnotationName()));
+ names.remove(annotation.getAnnotationName());
+ if(annotation.getAnnotationName().equals("annotationName1"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName2"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName3"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName4"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+ }
+ }
+
+ public void testParameterLevel() throws Exception
+ {
+ AnnotationPropertyContainer container = new AnnotationPropertyContainer();
+ AnnotationProperty annotationProperty = new AnnotationProperty("annotationName", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 0);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 1);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 0);
+ Set<IAnnotation<ITypeParameter>> parameterAnnotations = container.getParameterAnnotations(typeParameter.proxy());
+
+ for (IAnnotation<ITypeParameter> annotation : parameterAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("annotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+
+ container = new AnnotationPropertyContainer();
+ annotationProperty = new AnnotationProperty("annotationName1", "attributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName2", "attributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName3", "attributeNameQualified", "org.eclipse.testEnumeration.VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("annotationName4", "attributeNameString", "valueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 0);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 4);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 0);
+ parameterAnnotations = container.getParameterAnnotations(typeParameter.proxy());
+
+ Set<String> names = new HashSet<String>();
+ names.clear();
+ names.add("annotationName1");
+ names.add("annotationName2");
+ names.add("annotationName3");
+ names.add("annotationName4");
+
+ for (IAnnotation<ITypeParameter> annotation : parameterAnnotations)
+ {
+ assertTrue(names.contains(annotation.getAnnotationName()));
+ names.remove(annotation.getAnnotationName());
+ if(annotation.getAnnotationName().equals("annotationName1"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameBoolean").equals("true"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName2"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameInteger").equals("100"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName3"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameQualified").equals("org.eclipse.testEnumeration.VALUE"));
+ }
+ if(annotation.getAnnotationName().equals("annotationName4"))
+ {
+ assertTrue(annotation.getParamValuePairs().size() == 1);
+ assertTrue(annotation.getPropertyValue("attributeNameString").equals("valueString"));
+ }
+ }
+ }
+
+ public void testCombined() throws Exception
+ {
+ AnnotationPropertyContainer container = new AnnotationPropertyContainer();
+ AnnotationProperty annotationProperty = new AnnotationProperty("paramAnnotationName", "paramAttributeNameBoolean", "true", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("paramAnnotationName", "paramAttributeNameInteger", "100", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("paramAnnotationName", "paramAttributeNameQualified", "org.eclipse.testEnumeration.PARAM_VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+ annotationProperty = new AnnotationProperty("paramAnnotationName", "paramAttributeNameString", "paramValueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.PARAMETER);
+
+ annotationProperty = new AnnotationProperty("methodAnnotationName", "methodAttributeNameBoolean", "false", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("methodAnnotationName", "methodAttributeNameInteger", "101", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("methodAnnotationName", "methodAttributeNameQualified", "org.eclipse.testEnumeration.METHOD_VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+ annotationProperty = new AnnotationProperty("methodAnnotationName", "methodAttributeNameString", "methodValueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.METHOD);
+
+ annotationProperty = new AnnotationProperty("typeAnnotationName", "typeAttributeNameBoolean", "false", AttributeTypeEnum.BOOLEAN);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("typeAnnotationName", "typeAttributeNameInteger", "1", AttributeTypeEnum.INTEGER);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("typeAnnotationName", "typeAttributeNameQualified", "org.eclipse.testEnumeration.TYPE_VALUE", AttributeTypeEnum.QUALIFIED_NAME);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+ annotationProperty = new AnnotationProperty("typeAnnotationName", "typeAttributeNameString", "typeValueString", AttributeTypeEnum.STRING);
+ container.addAnnotationProperty(annotationProperty, ElementType.TYPE);
+
+ assertTrue(container.getTypeAnnotations(type.proxy()).size() == 1);
+ assertTrue(container.getParameterAnnotations(typeParameter.proxy()).size() == 1);
+ assertTrue(container.getMethodAnnotations(method.proxy()).size() == 1);
+
+ Set<IAnnotation<ITypeParameter>> parameterAnnotations = container.getParameterAnnotations(typeParameter.proxy());
+ for (IAnnotation<ITypeParameter> annotation : parameterAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("paramAnnotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("paramAttributeNameBoolean").equals("true"));
+ assertTrue(annotation.getPropertyValue("paramAttributeNameInteger").equals("100"));
+ assertTrue(annotation.getPropertyValue("paramAttributeNameQualified").equals("org.eclipse.testEnumeration.PARAM_VALUE"));
+ assertTrue(annotation.getPropertyValue("paramAttributeNameString").equals("paramValueString"));
+ }
+
+ Set<IAnnotation<IMethod>> methodAnnotations = container.getMethodAnnotations(method.proxy());
+ for (IAnnotation<IMethod> annotation : methodAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("methodAnnotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("methodAttributeNameBoolean").equals("false"));
+ assertTrue(annotation.getPropertyValue("methodAttributeNameInteger").equals("101"));
+ assertTrue(annotation.getPropertyValue("methodAttributeNameQualified").equals("org.eclipse.testEnumeration.METHOD_VALUE"));
+ assertTrue(annotation.getPropertyValue("methodAttributeNameString").equals("methodValueString"));
+ }
+
+ Set<IAnnotation<IType>> typeAnnotations = container.getTypeAnnotations(type.proxy());
+ for (IAnnotation<IType> annotation : typeAnnotations)
+ {
+ assertTrue(annotation.getAnnotationName().equals("typeAnnotationName"));
+ assertTrue(annotation.getParamValuePairs().size() == 4);
+ assertTrue(annotation.getPropertyValue("typeAttributeNameBoolean").equals("false"));
+ assertTrue(annotation.getPropertyValue("typeAttributeNameInteger").equals("1"));
+ assertTrue(annotation.getPropertyValue("typeAttributeNameQualified").equals("org.eclipse.testEnumeration.TYPE_VALUE"));
+ assertTrue(annotation.getPropertyValue("typeAttributeNameString").equals("typeValueString"));
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationUtilsTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationUtilsTest.java
new file mode 100755
index 0000000..ed2452f
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationUtilsTest.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class AnnotationUtilsTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testRemove() throws Exception
+ {
+ setUp();
+
+ IValue sv = AnnotationFactory.createStringValue("My String Value");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("Param", sv));
+
+ IAnnotation<IField> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint.getField("field1"));
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint.getField("field1"));
+ assertEquals(ann.getAppliedElement(), endpoint.getField("field1"));
+
+ AnnotationWriter.getInstance().remove(ann);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsBaseImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsBaseImplTest.java
new file mode 100755
index 0000000..815d146
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsBaseImplTest.java
@@ -0,0 +1,570 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.ILocator;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationImpl;
+
+public class AnnotationsBaseImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ setUpWitoutRemove();
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void setUpWitoutRemove() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ }
+
+ public void setUpWitoutRemove2() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("EndpointAnnInspector.src", "EndpointAnnInspector");
+ }
+
+ public void testBaseAnnotattionFunctionality()
+ {
+ AnnotationImpl<IType> ann = new AnnotationImpl<IType>("com.spa.test.MyAnnotation", new HashSet<IParamValuePair>());
+ assertEquals(ann.getAnnotationName(), "com.spa.test.MyAnnotation");
+ assertEquals(ann.getSimpleAnnotationName(), "MyAnnotation");
+ //assertEquals(ann.getValueType(), IValue.ANNOTATION_VALUE);
+
+ ann = new AnnotationImpl<IType>("MyNewAnnotation", new HashSet<IParamValuePair>());
+ assertEquals(ann.getAnnotationName(), "MyNewAnnotation");
+ assertEquals(ann.getSimpleAnnotationName(), "MyNewAnnotation");
+ //assertEquals(ann.getValueType(), IValue.ANNOTATION_VALUE);
+ }
+
+ public void testAddAnnotation() throws Exception
+ {
+ setUp();
+
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", qv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 1);
+ IAnnotation<IType> tmpAnn = annotations.iterator().next();
+
+ AnnotationWriter.getInstance().remove(tmpAnn);
+
+ annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 0);
+
+ IMethod[] methods = endpoint.getMethods();
+ for (IMethod method : methods)
+ {
+ if(method.getRawParameterNames() != null && method.getRawParameterNames().length > 0)
+ {
+ IAnnotation<IMethod> annM = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotationMethod", pv, method);
+ AnnotationWriter.getInstance().setAppliedElement(annM, method);
+ assertEquals("full.qualified.Name", annM.getPropertyValue("param"));
+ assertNull(annM.getPropertyValue("paramNotExists"));
+ Collection<IAnnotation<IMethod>> annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ IAnnotation<IMethod> annotatM = annotationsM.iterator().next();
+ assertEquals("qualified.Name", annotatM.getPropertyValue("param"));
+
+ IValue sv = AnnotationFactory.createStringValue("New String Value");
+ annM.getParamValuePairs().add(AnnotationFactory.createParamValuePairValue("NewParam", sv));
+ AnnotationWriter.getInstance().update(annM);
+ annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsM.size() == 1);
+ annotatM = annotationsM.iterator().next();
+ assertEquals("New String Value", annotatM.getPropertyValue("NewParam"));
+ assertEquals("qualified.Name", annotatM.getPropertyValue("param"));
+ AnnotationWriter.getInstance().remove(annotatM);
+ annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsM.size() == 0);
+
+ IValue sv3 = AnnotationFactory.createStringValue("New String Value3");
+ annM.getParamValuePairs().clear();
+ annM.getParamValuePairs().add(AnnotationFactory.createParamValuePairValue("NewParam", sv3));
+ AnnotationWriter.getInstance().update(annM);
+ annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsM.size() == 1);
+ annotatM = annotationsM.iterator().next();
+ assertEquals("New String Value3", annotatM.getPropertyValue("NewParam"));
+
+ // clear annotation
+ AnnotationWriter.getInstance().remove(annM);
+
+ annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertTrue(annotationsM.size() == 0);
+
+ for(int i = 0; i < method.getRawParameterNames().length; i++)
+ {
+ ITypeParameter param = method.getTypeParameter(method.getRawParameterNames()[i]);
+
+ IValue svParam = AnnotationFactory.createStringValue("String Valu Param");
+ Set<IParamValuePair> pvParam = new HashSet<IParamValuePair>();
+ pvParam.add(AnnotationFactory.createParamValuePairValue("ParamAtribute", svParam));
+ IAnnotation<ITypeParameter> annP = AnnotationFactory.createAnnotation("ParamAnnotation", pvParam, param);
+ AnnotationWriter.getInstance().setAppliedElement(annP, param);
+
+ AnnotationWriter.getInstance().remove(annP);
+ }
+ }
+ }
+ }
+
+ public void testAnnotattionUpdate() throws Exception
+ {
+ setUp();
+
+ IValue sv = AnnotationFactory.createStringValue("StringValue");
+ Set<IParamValuePair> spv = new HashSet<IParamValuePair>();
+ spv.add(AnnotationFactory.createParamValuePairValue("stringParam", sv));
+ IAnnotation<IType> typeAnnotation = AnnotationFactory.createAnnotation("org.eclipse.test.MyTypeAnnotation", spv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(typeAnnotation, endpoint);
+
+ Collection<IAnnotation<IType>> typeAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(typeAnnotations);
+ assertTrue(typeAnnotations.size() == 1);
+ IAnnotation<IType> tempTypeAnnotation = typeAnnotations.iterator().next();
+ assertEquals(tempTypeAnnotation.getPropertyValue("stringParam"), "StringValue");
+
+ IValue newSV = AnnotationFactory.createStringValue("NewStringValue");
+ Set<IParamValuePair> newSPV = new HashSet<IParamValuePair>();
+ newSPV.add(AnnotationFactory.createParamValuePairValue("stringParam", newSV));
+ AnnotationImpl<IType> newTypeAnnotation = new AnnotationImpl<IType>("org.eclipse.test.MyTypeAnnotation", newSPV);
+ newTypeAnnotation.setAppliedElementWithoutSave(endpoint);
+
+ AnnotationWriter.getInstance().update(newTypeAnnotation);
+
+ typeAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(typeAnnotations);
+ assertTrue(typeAnnotations.size() == 1);
+ tempTypeAnnotation = typeAnnotations.iterator().next();
+ assertEquals(tempTypeAnnotation.getPropertyValue("stringParam"), "NewStringValue");
+
+ newSV = AnnotationFactory.createStringValue("NewestStringValue");
+ newSPV = new HashSet<IParamValuePair>();
+ newSPV.add(AnnotationFactory.createParamValuePairValue("newestStringParam", newSV));
+ newTypeAnnotation = new AnnotationImpl<IType>("org.eclipse.test.MyTypeAnnotation", newSPV);
+ newTypeAnnotation.setAppliedElementWithoutSave(endpoint);
+
+ AnnotationWriter.getInstance().update(newTypeAnnotation);
+
+ typeAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(typeAnnotations);
+ assertTrue(typeAnnotations.size() == 1);
+ tempTypeAnnotation = typeAnnotations.iterator().next();
+ assertNull(tempTypeAnnotation.getPropertyValue("stringParam"));
+ assertEquals(tempTypeAnnotation.getPropertyValue("newestStringParam"), "NewestStringValue");
+
+ IMethod firstMethod = endpoint.getMethods()[0];
+
+ IValue iv = AnnotationFactory.createIntegerValue("10");
+ Set<IParamValuePair> ipv = new HashSet<IParamValuePair>();
+ ipv.add(AnnotationFactory.createParamValuePairValue("integerParam", iv));
+ IAnnotation<IMethod> methodAnnotation = AnnotationFactory.createAnnotation("org.eclipse.test.MyMethodAnnotation", ipv, firstMethod);
+ AnnotationWriter.getInstance().setAppliedElement(methodAnnotation, firstMethod);
+
+ Collection<IAnnotation<IMethod>> methodAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(firstMethod);
+ assertNotNull(methodAnnotations);
+ assertTrue(methodAnnotations.size() == 1);
+ IAnnotation<IMethod> tempMethodAnnotation = methodAnnotations.iterator().next();
+ assertEquals(tempMethodAnnotation.getPropertyValue("integerParam"), "10");
+
+ IValue newIV = AnnotationFactory.createIntegerValue("11");
+ Set<IParamValuePair> newIPV = new HashSet<IParamValuePair>();
+ newIPV.add(AnnotationFactory.createParamValuePairValue("integerParam", newIV));
+ AnnotationImpl<IMethod> newMethodAnnotation = new AnnotationImpl<IMethod>("org.eclipse.test.MyMethodAnnotation", newIPV);
+ newMethodAnnotation.setAppliedElementWithoutSave(firstMethod);
+
+ AnnotationWriter.getInstance().update(newMethodAnnotation);
+
+ methodAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(firstMethod);
+ assertNotNull(methodAnnotations);
+ assertTrue(methodAnnotations.size() == 1);
+ tempMethodAnnotation = methodAnnotations.iterator().next();
+ assertEquals(tempMethodAnnotation.getPropertyValue("integerParam"), "11");
+
+ newIV = AnnotationFactory.createIntegerValue("100");
+ newIPV = new HashSet<IParamValuePair>();
+ newIPV.add(AnnotationFactory.createParamValuePairValue("newestIntegerParam", newIV));
+ newMethodAnnotation = new AnnotationImpl<IMethod>("org.eclipse.test.MyMethodAnnotation", newIPV);
+ newMethodAnnotation.setAppliedElementWithoutSave(firstMethod);
+
+ AnnotationWriter.getInstance().update(newMethodAnnotation);
+
+ methodAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(firstMethod);
+ assertNotNull(methodAnnotations);
+ assertTrue(methodAnnotations.size() == 1);
+ tempMethodAnnotation = methodAnnotations.iterator().next();
+ assertNull(tempMethodAnnotation.getPropertyValue("integerParam"));
+ assertEquals(tempMethodAnnotation.getPropertyValue("newestIntegerParam"), "100");
+
+ ITypeParameter typeParameter = firstMethod.getTypeParameter("annotatedParam");
+
+ IValue bv = AnnotationFactory.createBooleanValue(true);
+ Set<IParamValuePair> bpv = new HashSet<IParamValuePair>();
+ bpv.add(AnnotationFactory.createParamValuePairValue("booleanParam", bv));
+ IAnnotation<ITypeParameter> parameterAnnotation = AnnotationFactory.createAnnotation("org.eclipse.test.MyParameterAnnotation", bpv, typeParameter);
+ AnnotationWriter.getInstance().setAppliedElement(parameterAnnotation, typeParameter);
+
+ Collection<IAnnotation<ITypeParameter>> parameterAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter);
+ assertNotNull(parameterAnnotations);
+ assertTrue(parameterAnnotations.size() == 1);
+ IAnnotation<ITypeParameter> tempParameterAnnotation = parameterAnnotations.iterator().next();
+ assertEquals(tempParameterAnnotation.getPropertyValue("booleanParam"), "true");
+
+ IValue newBV = AnnotationFactory.createBooleanValue(false);
+ Set<IParamValuePair> newBPV = new HashSet<IParamValuePair>();
+ newBPV.add(AnnotationFactory.createParamValuePairValue("booleanParam", newBV));
+ AnnotationImpl<ITypeParameter> newParameterAnnotation = new AnnotationImpl<ITypeParameter>("org.eclipse.test.MyParameterAnnotation", newBPV);
+ newParameterAnnotation.setAppliedElementWithoutSave(typeParameter);
+
+ AnnotationWriter.getInstance().update(newParameterAnnotation);
+
+ parameterAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter);
+ assertNotNull(parameterAnnotations);
+ assertTrue(parameterAnnotations.size() == 1);
+ tempParameterAnnotation = parameterAnnotations.iterator().next();
+ assertEquals(tempParameterAnnotation.getPropertyValue("booleanParam"), "false");
+
+ newBV = AnnotationFactory.createBooleanValue(true);
+ newBPV = new HashSet<IParamValuePair>();
+ newBPV.add(AnnotationFactory.createParamValuePairValue("newestBooleanParam", newBV));
+ newParameterAnnotation = new AnnotationImpl<ITypeParameter>("org.eclipse.test.MyParameterAnnotation", newBPV);
+ newParameterAnnotation.setAppliedElementWithoutSave(typeParameter);
+
+ AnnotationWriter.getInstance().update(newParameterAnnotation);
+
+ parameterAnnotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter);
+ assertNotNull(parameterAnnotations);
+ assertTrue(parameterAnnotations.size() == 1);
+ tempParameterAnnotation = parameterAnnotations.iterator().next();
+ assertNull(tempParameterAnnotation.getPropertyValue("booleanParam"));
+ assertEquals(tempParameterAnnotation.getPropertyValue("newestBooleanParam"), "true");
+
+
+ }
+
+ public void testSetAppliedElementWithoutSave() throws Exception
+ {
+ setUp();
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", qv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ try
+ {
+ AnnotationWriter.getInstance().setAppliedElement(ann, null);
+ fail("NullPointerException was not thrown.");
+ }
+ catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testMultyAddAnnotation() throws Exception
+ {
+ setUpWitoutRemove();
+
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable()
+ {
+ public void run(IProgressMonitor monitor) throws CoreException
+ {
+ try
+ {
+ Set<String> annoSet = new HashSet<String>();
+ annoSet.add("Stateless");
+
+ AnnotationFactory.removeAnnotations(endpoint, annoSet);
+
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", qv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+
+ IValue sv = AnnotationFactory.createStringValue("StringValue");
+
+ Set<IParamValuePair> spv = new HashSet<IParamValuePair>();
+ spv.add(AnnotationFactory.createParamValuePairValue("stringParam", sv));
+
+ IAnnotation<IType> sAnn = AnnotationFactory.createAnnotation("org.eclipse.test.MyStringAnnotation", spv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(sAnn, endpoint);
+
+
+ Collection<IAnnotation<IType>> annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 3);
+ IAnnotation<IType> tmpAnn = annotations.iterator().next();
+
+ AnnotationWriter.getInstance().remove(tmpAnn);
+
+ annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertTrue(annotations.size() == 2);
+
+ IMethod[] methods = endpoint.getMethods();
+ for (IMethod method : methods)
+ {
+ IValue smv = AnnotationFactory.createStringValue("StringValue");
+ Set<IParamValuePair> smpv = new HashSet<IParamValuePair>();
+ smpv.add(AnnotationFactory.createParamValuePairValue("stringParam", smv));
+
+ IAnnotation<IMethod> smAnn = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotationMethod", smpv, method);
+ AnnotationWriter.getInstance().setAppliedElement(smAnn, method);
+ Collection<IAnnotation<IMethod>> annotationsM = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method);
+ assertNotNull(annotationsM);
+ assertTrue(annotationsM.size() == 2);
+
+ annotations = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+ assertNotNull(annotations);
+ assertTrue(annotations.size() == 2);
+
+ }
+
+ } catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+ }
+ };
+
+ getTestProject().getSourceFolder().getResource().getWorkspace().run(runnable, null);
+
+
+
+
+ }
+
+ public void testEquals()
+ {
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", qv));
+
+ IAnnotation<IType> ann1 = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation1", pv, endpoint);
+ IAnnotation<IType> ann2 = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation2", pv, endpoint);
+ IAnnotation<IType> ann3 = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation1", pv, endpoint);
+
+ assertTrue(ann1.equals(ann1));
+ assertFalse(ann1.equals(null));
+ assertFalse(ann1.equals(qv));
+ assertFalse(ann1.equals(ann2));
+ assertTrue(ann1.equals(ann3));
+ }
+
+ public void testField() throws Exception
+ {
+ setUp();
+
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", qv));
+
+ IAnnotation<IField> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint.getField("field1"));
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint.getField("field1"));
+ assertEquals(ann.getAppliedElement(), endpoint.getField("field1"));
+ }
+
+ public void testLocator() throws Exception
+ {
+ setUpWitoutRemove2();
+
+ IAnnotation<IType> inspectedTypeAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectType("org.eclipse.demo.MyAnnotation");
+ assertNotNull(inspectedTypeAnnotation);
+ ILocator locator = inspectedTypeAnnotation.getLocator();
+ assertEquals("Unexpected annotation start position", 191, locator.getStartPosition());
+ assertEquals("Unexpected length", 33, locator.getLength());
+ Set<IParamValuePair> parmValues = inspectedTypeAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("myValue"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected annotation parameter start position", 205, locator.getStartPosition());
+ assertEquals("Unexpected annotation parameter length", 18, locator.getLength());
+ }
+ }
+
+ inspectedTypeAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectType("javax.jws.WebService");
+ assertNotNull(inspectedTypeAnnotation);
+ locator = inspectedTypeAnnotation.getLocator();
+ assertEquals("Unexpected @WebService annotation start position", 226, locator.getStartPosition());
+ assertEquals("Unexpected @WebService annotation length", 134, locator.getLength());
+ parmValues = inspectedTypeAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("serviceName"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected serviceName annotation parameter start position", 238, locator.getStartPosition());
+ assertEquals("Unexpected serviceName annotation parameter length", 31, locator.getLength());
+ }
+
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected serviceName annotation parameter start position", 271, locator.getStartPosition());
+ assertEquals("Unexpected serviceName annotation parameter length", 17, locator.getLength());
+ }
+
+ if(paramValuePair.getParam().equals("targetNamespace"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected targetNamespace annotation parameter start position", 290, locator.getStartPosition());
+ assertEquals("Unexpected targetNamespace annotation parameter length", 42, locator.getLength());
+ }
+
+ if(paramValuePair.getParam().equals("portName"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected portName annotation parameter start position", 334, locator.getStartPosition());
+ assertEquals("Unexpected portName annotation parameter length", 25, locator.getLength());
+ }
+ }
+
+ IField field = endpoint.getField("field1");
+ IAnnotation<IField> inspectedFieldAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(field, "org.eclipse.demo.MyFieldAnnotation");
+ locator = inspectedFieldAnnotation.getLocator();
+ assertEquals("Unexpected MyFieldAnnotation annotation parameter start position", 401, locator.getStartPosition());
+ assertEquals("Unexpected MyFieldAnnotation annotation parameter length", 33, locator.getLength());
+ parmValues = inspectedFieldAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected name annotation parameter start position", 420, locator.getStartPosition());
+ assertEquals("Unexpected name annotation parameter length", 13, locator.getLength());
+ }
+ }
+
+ inspectedFieldAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectField(field, "javax.jws.WebField");
+ locator = inspectedFieldAnnotation.getLocator();
+ assertEquals("Unexpected WebField annotation parameter start position", 437, locator.getStartPosition());
+ assertEquals("Unexpected WebField annotation parameter length", 25, locator.getLength());
+ parmValues = inspectedFieldAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected name annotation parameter start position", 447, locator.getStartPosition());
+ assertEquals("Unexpected name annotation parameter length", 14, locator.getLength());
+ }
+ }
+
+ IMethod method = endpoint.getMethods()[0];
+ IAnnotation<IMethod> inspectedMethodAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method, "org.eclipse.demo.MyMethodAnnotation");
+ locator = inspectedMethodAnnotation.getLocator();
+ assertEquals("Unexpected MyMethodAnnotation annotation parameter start position", 492, locator.getStartPosition());
+ assertEquals("Unexpected MyMethodAnnotation annotation parameter length", 43, locator.getLength());
+ parmValues = inspectedMethodAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected name annotation parameter start position", 512, locator.getStartPosition());
+ assertEquals("Unexpected name annotation parameter length", 22, locator.getLength());
+ }
+ }
+
+ inspectedMethodAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectMethod(method, "javax.jws.WebMethod");
+ locator = inspectedMethodAnnotation.getLocator();
+ assertEquals("Unexpected WebMethod annotation parameter start position", 538, locator.getStartPosition());
+ assertEquals("Unexpected WebMethod annotation parameter length", 46, locator.getLength());
+ parmValues = inspectedMethodAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("exclude"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected exclude annotation parameter start position", 549, locator.getStartPosition());
+ assertEquals("Unexpected exclude annotation parameter length", 13, locator.getLength());
+ }
+
+ if(paramValuePair.getParam().equals("operationName"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected operationName annotation parameter start position", 563, locator.getStartPosition());
+ assertEquals("Unexpected operationName annotation parameter length", 20, locator.getLength());
+ }
+ }
+
+ ITypeParameter typeParameter = method.getTypeParameter("annotatedParam");
+ IAnnotation<ITypeParameter> inspectedParamAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter, "org.eclipse.demo.MyParamAnnotation");
+ locator = inspectedParamAnnotation.getLocator();
+ assertEquals("Unexpected MyParamAnnotation annotation parameter start position", 649, locator.getStartPosition());
+ assertEquals("Unexpected MyParamAnnotation annotation parameter length", 43, locator.getLength());
+ parmValues = inspectedParamAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected name annotation parameter start position", 668, locator.getStartPosition());
+ assertEquals("Unexpected name annotation parameter length", 23, locator.getLength());
+ }
+ }
+
+ inspectedParamAnnotation = AnnotationFactory.createAnnotationInspector(endpoint).inspectParam(typeParameter, "javax.jws.WebParam");
+ locator = inspectedParamAnnotation.getLocator();
+ assertEquals("Unexpected WebParam annotation parameter start position", 616, locator.getStartPosition());
+ assertEquals("Unexpected WebParam annotation parameter length", 32, locator.getLength());
+ parmValues = inspectedParamAnnotation.getParamValuePairs();
+ for (IParamValuePair paramValuePair : parmValues)
+ {
+ if(paramValuePair.getParam().equals("name"))
+ {
+ locator = paramValuePair.getLocator();
+ assertEquals("Unexpected name annotation parameter start position", 626, locator.getStartPosition());
+ assertEquals("Unexpected name annotation parameter length", 21, locator.getLength());
+ }
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsTest.java
new file mode 100755
index 0000000..31433a7
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/AnnotationsTest.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.AnnotationInspectorImpl;
+
+public class AnnotationsTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testAddComplexAnnotationQNValue() throws JavaModelException, AnnotationGeneratorException
+ {
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ IParamValuePair pv = AnnotationFactory.createParamValuePairValue("param", qv);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pv);
+ IAnnotation<IType> annotation = AnnotationFactory.createAnnotation("javax.jws.WebService", paramValues, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, endpoint);
+
+ assertTrue(AnnotationFactory.createAnnotationInspector(endpoint).inspectType().size() > 0);
+ }
+
+// public void testAddSingleElementAnnotationArrayValues() throws JavaModelException, AnnotationGeneratorException
+// {
+// IAnnotation annotation = AnnotationFactory.createSingleElementAnnotation("javax.jws.WebService", new String[] { "val1", "val2" });
+// annotation.addToClass(endpoint);
+//
+// assertTrue(AnnotationFactory.getAnnotationsFromClass(endpoint).length > 0);
+// }
+//
+// public void testAddSimpleAnnotation() throws JavaModelException, AnnotationGeneratorException
+// {
+// IAnnotation annotation = AnnotationFactory.createSimpleAnnotation("javax.jws.WebService");
+// annotation.addToClass(endpoint);
+//
+// assertTrue(AnnotationFactory.getAnnotationsFromClass(endpoint).length > 0);
+// }
+
+ /**
+ * Creates complex annotation and adds it to class. The annotation has the form:
+ *
+ * <pre>
+ * @WebService(serviceName="serviceName",
+ * name="portTypeName",
+ * targetNamespace="http://demo.sap.com/",
+ * wsdlLocation="http://wsdl/url/",
+ * portName="portName",
+ * endpointInterface="org.eclipse.demo.ISei")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexClassAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ addStringProperty(paramValues, "serviceName", "serviceName");
+ addStringProperty(paramValues, "name", "portTypeName");
+ addStringProperty(paramValues, "targetNamespace", "http://demo.sap.com/");
+ addStringProperty(paramValues, "wsdlLocation", "http://wsdl/url/");
+ addStringProperty(paramValues, "portName", "portName");
+ addStringProperty(paramValues, "endpointInterface", "org.eclipse.demo.ISei");
+
+ IAnnotation<IType> annotation = AnnotationFactory.createAnnotation("javax.jws.WebService", paramValues, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, endpoint);
+
+ AnnotationInspectorImpl annotationInspector = new AnnotationInspectorImpl(endpoint);
+ Collection<IAnnotation<IType>> typeAnnotations = annotationInspector.inspectType();
+
+ boolean result = false;
+ for (IAnnotation<IType> typeAnnotation : typeAnnotations)
+ {
+ if(typeAnnotation.getAnnotationName().equals("javax.jws.WebService") || typeAnnotation.getAnnotationName().equals("WebService"))
+ {
+ if(typeAnnotation.getParamValuePairs().size() != 6)
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("serviceName").equals("serviceName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("name").equals("portTypeName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("targetNamespace").equals("http://demo.sap.com/"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("wsdlLocation").equals("http://wsdl/url/"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("portName").equals("portName"))
+ {
+ break;
+ }
+ if(!typeAnnotation.getPropertyValue("endpointInterface").equals("org.eclipse.demo.ISei"))
+ {
+ break;
+ }
+
+ result = true;
+ }
+ }
+
+ assertTrue("Class is not annotated correctly", result);
+ }
+
+ /**
+ * Creates complex annotation and adds it to method declaration. Annotation has the form:
+ *
+ * <pre>
+ * \@WebMethod(exclude=false,operationName="annotatedMethod",action="go")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexMethodAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ IValue emValue = AnnotationFactory.createBooleanValue(false);
+ paramValues.add(AnnotationFactory.createParamValuePairValue("exclude", emValue));
+
+ addStringProperty(paramValues, "operationName", "annotatedMethod");
+ addStringProperty(paramValues, "action", "go");
+
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+
+ IAnnotation<IMethod> annotation = AnnotationFactory.createAnnotation("javax.jws.WebMethod", paramValues, method);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, method);
+
+ AnnotationInspectorImpl annotationInspector = new AnnotationInspectorImpl(endpoint);
+ Collection<IAnnotation<IMethod>> methodAnnotations = annotationInspector.inspectMethod(method);
+
+ boolean result = false;
+ for (IAnnotation<IMethod> methodAnnotation : methodAnnotations)
+ {
+ if(methodAnnotation.getAnnotationName().equals("javax.jws.WebMethod") || methodAnnotation.getAnnotationName().equals("WebMethod"))
+ {
+ if(methodAnnotation.getParamValuePairs().size() != 3)
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("exclude").equals("false"))
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("operationName").equals("annotatedMethod"))
+ {
+ break;
+ }
+ if(!methodAnnotation.getPropertyValue("action").equals("go"))
+ {
+ break;
+ }
+
+ result = true;
+ }
+ }
+
+ assertTrue("Method is not annotated correctly", result);
+ }
+
+ /**
+ * Creates complex annotation and adds it to a method parameter. The annotation has the form:
+ *
+ * <pre>
+ * \@WebParam(operationName="annotatedParam", targetNamespace="http://demo.sap.com/params/", partName="partName")
+ * </pre>
+ *
+ * @throws JavaModelException
+ * @throws AnnotationGeneratorException
+ */
+ public void testAddComplexParamAnnotation() throws JavaModelException, AnnotationGeneratorException
+ {
+ IMethod method = endpoint.getMethod("annotatedMethod", new String[] { "QString;" });
+ ITypeParameter typeParameter = method.getTypeParameter("annotatedParam");
+
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+
+ addStringProperty(paramValues, "annotatedParam", "param");
+ addStringProperty(paramValues, "targetNamespace", "http://demo.sap.com/params/");
+ addStringProperty(paramValues, "partName", "partName");
+
+ IAnnotation<ITypeParameter> annotation = AnnotationFactory.createAnnotation("javax.jws.WebParam", paramValues, typeParameter);
+ AnnotationWriter.getInstance().setAppliedElement(annotation, typeParameter);
+ }
+
+ private void addStringProperty(Set<IParamValuePair> paramValues, String property, String value)
+ {
+ IValue pValue = AnnotationFactory.createStringValue(value);
+ IParamValuePair pair = AnnotationFactory.createParamValuePairValue(property, pValue);
+ paramValues.add(pair);
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ArrayValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ArrayValueImplTest.java
new file mode 100755
index 0000000..bf5e4df
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ArrayValueImplTest.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ArrayValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+
+public class ArrayValueImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testHashCode()
+ {
+ Set<IValue> values1 = new HashSet<IValue>();
+ values1.clear();
+ values1.add(new StringValueImpl("val1"));
+ ArrayValueImpl av1 = new ArrayValueImpl(values1);
+
+ Set<IValue> values2 = new HashSet<IValue>();
+ values2.clear();
+ values2.add(new StringValueImpl("val2"));
+ ArrayValueImpl av2 = new ArrayValueImpl(values2);
+
+ assertTrue(av1.hashCode() != av2.hashCode());
+ }
+
+ public void testArrayValueImpl()
+ {
+ try
+ {
+ new ArrayValueImpl(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testEqualsObject()
+ {
+ Set<IValue> values1 = new HashSet<IValue>();
+ values1.clear();
+ values1.add(new StringValueImpl("val1"));
+ ArrayValueImpl av1 = new ArrayValueImpl(values1);
+
+ Set<IValue> values2 = new HashSet<IValue>();
+ values2.clear();
+ values2.add(new StringValueImpl("val2"));
+ ArrayValueImpl av2 = new ArrayValueImpl(values2);
+
+ Set<IValue> values3 = new HashSet<IValue>();
+ values3.clear();
+ values3.add(new StringValueImpl("val1"));
+ ArrayValueImpl av3 = new ArrayValueImpl(values3);
+
+ assertFalse(av1.equals(null));
+ assertFalse(av1.equals(123));
+ assertFalse(av1.equals(av2));
+
+ assertTrue(av1.equals(av3));
+ assertTrue(av1.equals(av1));
+ }
+
+ public void testArrays() throws Exception
+ {
+ setUp();
+
+ Set<IValue> values = new HashSet<IValue>();
+ values.clear();
+ values.add(new StringValueImpl("val1"));
+ values.add(new StringValueImpl("val2"));
+ ArrayValueImpl av = new ArrayValueImpl(values);
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", av));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+ Collection<IAnnotation<IType>> annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 1);
+ IAnnotation<IType> readAnnotation = annotattions.iterator().next();
+ readAnnotation.equals(ann);
+ AnnotationWriter.getInstance().remove(ann);
+ annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 0);
+
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/BooleanValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/BooleanValueImplTest.java
new file mode 100755
index 0000000..6dad8ea8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/BooleanValueImplTest.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ArrayValueImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.BooleanValueImpl;
+
+public class BooleanValueImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+
+ public void testBooleanValueImpl()
+ {
+ try
+ {
+ new ArrayValueImpl(null);
+ fail("NullPointerException not thrown");
+ } catch (NullPointerException e)
+ {
+ assertTrue(true);
+ }
+ }
+
+ public void testBooleans() throws Exception
+ {
+ setUp();
+
+ BooleanValueImpl bv = new BooleanValueImpl(true);
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", bv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+ Collection<IAnnotation<IType>> annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 1);
+ IAnnotation<IType> readAnnotation = annotattions.iterator().next();
+ readAnnotation.equals(ann);
+ AnnotationWriter.getInstance().remove(ann);
+ annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 0);
+ }
+
+ public void testEqualsObject()
+ {
+ BooleanValueImpl bv1 = new BooleanValueImpl(true);
+ BooleanValueImpl bv2 = new BooleanValueImpl(false);
+ BooleanValueImpl bv3 = new BooleanValueImpl(true);
+
+ assertFalse(bv1.equals(null));
+ assertFalse(bv1.equals(123));
+ assertFalse(bv1.equals(bv2));
+
+ assertTrue(bv1.equals(bv3));
+ assertTrue(bv1.equals(bv1));
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ClassValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ClassValueImplTest.java
new file mode 100755
index 0000000..2400a28
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ClassValueImplTest.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ClassValueImpl;
+
+public class ClassValueImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testIntegers() throws Exception
+ {
+ setUp();
+
+ ClassValueImpl cv = new ClassValueImpl(endpoint.getFullyQualifiedName());
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", cv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+ Collection<IAnnotation<IType>> annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 1);
+ IAnnotation<IType> readAnnotation = annotattions.iterator().next();
+ readAnnotation.equals(ann);
+ assertEquals(ann.getPropertyValue("param").toString(), endpoint.getFullyQualifiedName());
+ AnnotationWriter.getInstance().remove(ann);
+ annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 0);
+ }
+
+ public void testEqualsObject()
+ {
+ ClassValueImpl cv1 = new ClassValueImpl(endpoint.getFullyQualifiedName());
+ ClassValueImpl cv2 = new ClassValueImpl(null);
+ ClassValueImpl cv3 = new ClassValueImpl(endpoint.getFullyQualifiedName());
+
+ assertFalse(cv1.equals(null));
+ assertFalse(cv1.equals(true));
+ assertFalse(cv1.equals(cv2));
+
+ assertTrue(cv1.equals(cv3));
+ assertTrue(cv1.equals(cv1));
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ComplexAnnotationImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ComplexAnnotationImplTest.java
new file mode 100755
index 0000000..6f56d2d
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ComplexAnnotationImplTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.Mock;
+import org.eclipse.jst.ws.jaxws.testutils.jmock.MockObjectTestCase;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class ComplexAnnotationImplTest extends MockObjectTestCase
+{
+ private Mock<IType> typeElement = mock(IType.class);
+
+ public void testHashCode()
+ {
+ IValue value = AnnotationFactory.createStringValue("value");
+ IParamValuePair pvp = AnnotationFactory.createParamValuePairValue("param", value);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pvp);
+ IAnnotation<IType> annotation1 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation2 = AnnotationFactory.createAnnotation("annotationName2", paramValues, typeElement.proxy());
+
+ assertTrue(annotation1.hashCode() != annotation2.hashCode());
+ }
+
+ public void testEqualsObject()
+ {
+ IValue value = AnnotationFactory.createStringValue("value");
+ IParamValuePair pvp = AnnotationFactory.createParamValuePairValue("param", value);
+ Set<IParamValuePair> paramValues = new HashSet<IParamValuePair>();
+ paramValues.add(pvp);
+ IAnnotation<IType> annotation1 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation2 = AnnotationFactory.createAnnotation("annotationName2", paramValues, typeElement.proxy());
+ IAnnotation<IType> annotation3 = AnnotationFactory.createAnnotation("annotationName", paramValues, typeElement.proxy());
+
+ assertFalse(annotation1.equals(annotation2));
+ assertFalse(annotation1.equals(null));
+ assertFalse(annotation1.equals(123));
+ assertTrue(annotation1.equals(annotation3));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/Endpoint.src b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/Endpoint.src
new file mode 100755
index 0000000..db699b7
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/Endpoint.src
@@ -0,0 +1,15 @@
+import java.util.List;
+import java.util.Map;
+
+@WebService(serviceName="WSImplBeanService", name="WSImplBean", targetNamespace="http://demo/eclipse/org/", portName="WSImplBeanPort")
+@Stateless
+public class Endpoint
+{
+ @MyAnnotation(name="field1")
+ public String field1;
+
+ @WebMethod(exclude=false,operationName="test")
+ public void annotatedMethod( @WebParam(name="annotatedParam") String annotatedParam)
+ {
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/EndpointAnnInspector.src b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/EndpointAnnInspector.src
new file mode 100755
index 0000000..d250d57
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/EndpointAnnInspector.src
@@ -0,0 +1,22 @@
+import java.util.List;
+import java.util.Map;
+import javax.jws.WebService;
+import javax.jws.WebField;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+
+@MyAnnotation(myValue="MyString")
+@WebService(serviceName="WSImplBeanService", name="WSImplBean", targetNamespace="http://demo/eclipse/org/", portName="WSImplBeanPort")
+@Stateless
+public class Endpoint
+{
+ @MyFieldAnnotation(name="field1")
+ @WebField(name="MyField")
+ public String field1;
+
+ @MyMethodAnnotation(name="annotatedMethod")
+ @WebMethod(exclude=false,operationName="test")
+ public void annotatedMethod( @WebParam(name="annotatedParam") @MyParamAnnotation(name="annotatedMyParam") String annotatedParam)
+ {
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/IntegerValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/IntegerValueImplTest.java
new file mode 100755
index 0000000..48d8cc6
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/IntegerValueImplTest.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.IntegerValueImpl;
+
+public class IntegerValueImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testIntegers() throws Exception
+ {
+ setUp();
+
+ IntegerValueImpl iv = new IntegerValueImpl("10");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", iv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+ Collection<IAnnotation<IType>> annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 1);
+ IAnnotation<IType> readAnnotation = annotattions.iterator().next();
+ readAnnotation.equals(ann);
+ assertEquals(ann.getPropertyValue("param").toString(), "10");
+ AnnotationWriter.getInstance().remove(ann);
+ annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 0);
+ }
+
+ public void testEqualsObject()
+ {
+ IntegerValueImpl iv1 = new IntegerValueImpl("10");
+ IntegerValueImpl iv2 = new IntegerValueImpl("11");
+ IntegerValueImpl iv3 = new IntegerValueImpl("10");
+
+ assertFalse(iv1.equals(null));
+ assertFalse(iv1.equals(true));
+ assertFalse(iv1.equals(iv2));
+
+ assertTrue(iv1.equals(iv3));
+ assertTrue(iv1.equals(iv1));
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ParamValuePairImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ParamValuePairImplTest.java
new file mode 100755
index 0000000..32eb628
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/ParamValuePairImplTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.ParamValuePairImpl;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+
+public class ParamValuePairImplTest extends TestCase
+{
+
+ public void testHashCode()
+ {
+ IValue value = new StringValueImpl("value");
+ ParamValuePairImpl pvp = new ParamValuePairImpl("param", value);
+
+ IValue value1 = new StringValueImpl("value1");
+ ParamValuePairImpl pvp1 = new ParamValuePairImpl("param1", value1);
+
+ assertFalse(pvp.hashCode() == pvp1.hashCode());
+ assertFalse(pvp.equals(null));
+ assertFalse(pvp.equals(123));
+ }
+
+ public void testEqualsObject()
+ {
+ IValue value = new StringValueImpl("value");
+ ParamValuePairImpl pvp = new ParamValuePairImpl("param", value);
+
+ IValue value1 = new StringValueImpl("value");
+ ParamValuePairImpl pvp1 = new ParamValuePairImpl("param", value1);
+
+ IValue value2 = new StringValueImpl("value2");
+ ParamValuePairImpl pvp2 = new ParamValuePairImpl("param2", value2);
+
+ assertTrue(pvp.equals(pvp1));
+ assertFalse(pvp.equals(pvp2));
+ assertTrue(pvp.equals(pvp));
+
+ assertFalse(pvp.equals(null));
+ assertFalse(pvp.equals(123));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/QualifiedNameValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/QualifiedNameValueImplTest.java
new file mode 100755
index 0000000..476119d
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/QualifiedNameValueImplTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IValue;
+
+public class QualifiedNameValueImplTest extends TestCase
+{
+
+ public void testHashCode()
+ {
+ IValue qv1 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name1");
+ IValue qv2 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ assertFalse(qv1.hashCode() == qv2.hashCode());
+ }
+
+ public void testEqualsObject()
+ {
+ IValue qv = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+ IValue qv1 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name1");
+ IValue qv2 = AnnotationFactory.createQualifiedNameValue("full.qualified.Name");
+
+ assertFalse(qv.equals(qv1));
+ assertTrue(qv.equals(qv2));
+ assertTrue(qv.equals(qv));
+ assertFalse(qv.equals(null));
+ assertFalse(qv.equals(123));
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/StringValueImplTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/StringValueImplTest.java
new file mode 100755
index 0000000..ad19b03
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/annotations/StringValueImplTest.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.annotations;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jst.ws.jaxws.testutils.project.ClassLoadingTest;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationFactory;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationGeneratorException;
+import org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IAnnotation;
+import org.eclipse.jst.ws.jaxws.utils.annotations.IParamValuePair;
+import org.eclipse.jst.ws.jaxws.utils.internal.annotations.impl.StringValueImpl;
+
+public class StringValueImplTest extends ClassLoadingTest
+{
+ private static final String SRC = "src";
+
+ private static final String PCK = "org.eclipse.demo";
+
+ private IType endpoint;
+
+ public void setUp() throws CoreException, IOException, AnnotationGeneratorException
+ {
+ createJavaProject(SRC, PCK);
+ endpoint = createClass("Endpoint.src", "Endpoint");
+ AnnotationFactory.removeAnnotationsFromJavaElement(endpoint);
+ }
+
+ public void testIntegers() throws Exception
+ {
+ setUp();
+
+ StringValueImpl sv = new StringValueImpl("10");
+
+ Set<IParamValuePair> pv = new HashSet<IParamValuePair>();
+ pv.add(AnnotationFactory.createParamValuePairValue("param", sv));
+
+ IAnnotation<IType> ann = AnnotationFactory.createAnnotation("org.eclipse.test.MyAnnotation", pv, endpoint);
+ AnnotationWriter.getInstance().setAppliedElement(ann, endpoint);
+ Collection<IAnnotation<IType>> annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 1);
+ IAnnotation<IType> readAnnotation = annotattions.iterator().next();
+ readAnnotation.equals(ann);
+ assertEquals(ann.getPropertyValue("param").toString(), "10");
+ AnnotationWriter.getInstance().remove(ann);
+ annotattions = AnnotationFactory.createAnnotationInspector(endpoint).inspectType();
+
+ assertNotNull(annotattions);
+ assertTrue(annotattions.size() == 0);
+ }
+
+ public void testEqualsObject()
+ {
+ StringValueImpl sv1 = new StringValueImpl("10");
+ StringValueImpl sv2 = new StringValueImpl("11");
+ StringValueImpl sv3 = new StringValueImpl("10");
+
+ assertFalse(sv1.equals(null));
+ assertFalse(sv1.equals(true));
+ assertFalse(sv1.equals(sv2));
+
+ assertTrue(sv1.equals(sv3));
+ assertTrue(sv1.equals(sv1));
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/clazz/ASTUtilsTest.java b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/clazz/ASTUtilsTest.java
new file mode 100755
index 0000000..7b438ee
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/clazz/ASTUtilsTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.utils.tests.internal.clazz;
+
+import java.io.File;
+import java.io.FileWriter;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jst.ws.jaxws.testutils.files.TestFileUtils;
+import org.eclipse.jst.ws.jaxws.testutils.project.TestProject;
+import org.eclipse.jst.ws.jaxws.utils.clazz.ASTUtils;
+
+/**
+ * Tests for {@link ASTUtils} class.
+ *
+ * @author Georgi Vachkov
+ */
+public class ASTUtilsTest extends TestCase
+{
+ private static final String PCK = "org.eclipse.test";
+ private static final String SRC =
+ "import javax.xml.namespace.QName;" + "\n" +
+ "public class Test {" + "\n" +
+ " private final static String name = \"are\";" + "\n" +
+ " public Test() {}" + "\n" +
+ " public int createInt() {return 0;}" + "\n" +
+ "}";
+
+ private TestProject project;
+
+ public void manualSetUp() throws Exception
+ {
+ project = new TestProject("JavaProj_" + System.currentTimeMillis());
+ project.createSourceFolder("src");
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ if (project != null) {
+ project.dispose();
+ }
+ }
+
+ public void testCreateASTFileNpe() throws Exception
+ {
+ try {
+ ASTUtils.getInstance().createAST((File)null, null);
+ } catch(NullPointerException _) {}
+ }
+
+ public void testCreateASTFile() throws Exception
+ {
+ final File tempJavaFile = createTempJavaFile();
+ ASTNode node = ASTUtils.getInstance().createAST(tempJavaFile, null);
+ assertNotNull(node);
+ assertTrue(node instanceof CompilationUnit);
+ }
+
+ public void testCreateASTITypeNpe() throws Exception
+ {
+ try {
+ ASTUtils.getInstance().createCompilationUnit((ICompilationUnit)null, null);
+ } catch(NullPointerException _) {}
+ }
+
+ public void testCreateASTIType() throws Exception
+ {
+ manualSetUp();
+ final IType sourceType = project.createType(project.createPackage(PCK), "Test.java", SRC);
+ ASTNode node = ASTUtils.getInstance().createCompilationUnit(sourceType.getCompilationUnit(), null);
+ assertNotNull(node);
+ assertTrue(node instanceof CompilationUnit);
+ }
+
+ public void testGetTypeDeclaration() throws Exception
+ {
+ manualSetUp();
+ final IType sourceType = project.createType(project.createPackage(PCK), "Test.java", SRC);
+ CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(sourceType.getCompilationUnit(), null);
+
+ AbstractTypeDeclaration abstractType = ASTUtils.getInstance().getTypeDeclaration("Test", unit);
+ assertNotNull(abstractType);
+ }
+
+ public void testGetTypeDeclarationForInnerType() throws Exception
+ {
+ manualSetUp();
+ String source = "public class Test {" +
+ "public static class Parameters {}" +
+ "}";
+
+ final IType sourceType = project.createType(project.createPackage(PCK), "Test.java", source);
+ CompilationUnit unit = ASTUtils.getInstance().createCompilationUnit(sourceType.getCompilationUnit(), null);
+
+ AbstractTypeDeclaration abstractType = ASTUtils.getInstance().getTypeDeclaration("Parameters", unit);
+ assertNotNull(abstractType);
+ }
+
+ private File createTempJavaFile() throws Exception
+ {
+ File dir = TestFileUtils.createTempDirectory("" + System.currentTimeMillis());
+ File tempClassFile = new File(dir, "Test.java");
+ FileWriter fw = new FileWriter(tempClassFile);
+ fw.write("package " + PCK + ";\n" + SRC);
+ fw.close();
+
+ return tempClassFile;
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/mock/EndpointFormat.src b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/mock/EndpointFormat.src
new file mode 100755
index 0000000..7bf6fb8
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.utils.tests/src/org/eclipse/jst/ws/jaxws/utils/tests/internal/mock/EndpointFormat.src
@@ -0,0 +1 @@
+public class Endpoint{public Endpoint(){}public void useVoid(){}public String echoString(String s){return s}}
\ No newline at end of file