diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.jaxrs.core/src')
72 files changed, 0 insertions, 11646 deletions
diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/IJAXRSCoreConstants.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/IJAXRSCoreConstants.java deleted file mode 100644 index 137db212e..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/IJAXRSCoreConstants.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100302 304405 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet : support JAX-RS 1.1 (JSR 311) - * 20100428 310905 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet fails to install due to NPE or runtime exception due to duplicate cp entries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal; - -/** - * JAXRS Core framework constants - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * - */ -public final class IJAXRSCoreConstants { - /** - * The global id for the JAXRS facet - */ - public static final String JAXRS_FACET_ID = "jst.jaxrs"; //$NON-NLS-1$ - /** - * The facet version for a JAX-RS 1.0 project - */ - public final static String FACET_VERSION_1_0 = "1.0"; //$NON-NLS-1$ - /** - * The constant id for a JAXRS 1.0 project - */ - public final static String JAXRS_VERSION_1_0 = FACET_VERSION_1_0; - /** - * The facet version for a JAX-RS 1.1 project - */ - public final static String FACET_VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * The constant id for a JAXRS 1.1 project - */ - public final static String JAXRS_VERSION_1_1 = FACET_VERSION_1_1; - public static final String NO_OP_LIBRARY_ID = "jaxrs-no-op-library-provider"; //$NON-NLS-1$ - - private IJAXRSCoreConstants() { - // no instantiation - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSCorePlugin.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSCorePlugin.java deleted file mode 100644 index 0808c4449..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSCorePlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/package org.eclipse.jst.ws.jaxrs.core.internal; - -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.ILog; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.ui.preferences.ScopedPreferenceStore; -import org.osgi.framework.BundleContext; - -/** - * JAX-RS Core plugin. - */ -public class JAXRSCorePlugin extends Plugin { - /** - * The plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxrs.core"; - // //$NON-NLS-1$ - - // The shared instance. - private static JAXRSCorePlugin plugin; - - private IPreferenceStore preferenceStore; - - private static IDialogSettings jaxrsUIsettings = null; - - /** - * The constructor. - */ - public JAXRSCorePlugin() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - * - * @param context - * @throws Exception - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - * - * @param context - * @throws Exception - */ - @Override - public void stop(final BundleContext context) throws Exception { - super.stop(context); - - plugin = null; - } - - /** - * Returns the shared instance. - * - * @return the shared instance - */ - public static JAXRSCorePlugin getDefault() { - return plugin; - } - - /** - * @param e - * @param msg - */ - public static void log(final Exception e, final String msg) { - final ILog log = getDefault().getLog(); - - log.log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - * @param ex - * Throwable instance (can be null) - */ - public static void log(final int severity, final String message, - final Throwable ex) { - getDefault().getLog().log( - new Status(severity, PLUGIN_ID, IStatus.OK, message, ex)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - */ - public static void log(final int severity, final String message) { - log(severity, message, null); - } - - /** - * Logs a message for this plugin - * - * @param message - * @param t - */ - public static void log(final String message, final Throwable t) { - final ILog log = plugin.getLog(); - log.log(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), - 0, message, t)); - } - - public String getPluginID() { - return PLUGIN_ID; - } - - /** - * @return the preference store for this bundle - */ - public IPreferenceStore getPreferenceStore() { - // Create the preference store lazily. - if (this.preferenceStore == null) { - this.preferenceStore = new ScopedPreferenceStore( - new InstanceScope(), getBundle().getSymbolicName()); - - } - return this.preferenceStore; - } - - /** - * @param name - * @return the extension point called name for this bundle - */ - public IExtensionPoint getExtension(final String name) { - return Platform.getExtensionRegistry().getExtensionPoint( - plugin.getBundle().getSymbolicName(), name); - } - - public IDialogSettings getJaxrsUISettings() { - return jaxrsUIsettings; - } - - public void setJAXRSUIDialogSettings(IDialogSettings jaxrsUISettings) { - if (JAXRSCorePlugin.jaxrsUIsettings == null) - JAXRSCorePlugin.jaxrsUIsettings = jaxrsUISettings; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibrariesContainerInitializer.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibrariesContainerInitializer.java deleted file mode 100644 index 052f981ff..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibrariesContainerInitializer.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - - *******************************************************************************/package org.eclipse.jst.ws.jaxrs.core.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.ClasspathContainerInitializer; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryRegistryUtil; -import org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal.JAXRSLibraryConfigurationHelper; - -/** - * Initialize JAXRS Libraries as classpath containers - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibrariesContainerInitializer extends - ClasspathContainerInitializer { - - private static final String MISSING_LIBRARY = Messages.JAXRSLibrariesContainerInitializer_missing_library; - - /** - * Constructor - */ - public JAXRSLibrariesContainerInitializer() { - super(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse - * .core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public void initialize(IPath containerPath, IJavaProject project) - throws CoreException { - if (isJAXRSLibraryContainer(containerPath)) { - String libId = containerPath.lastSegment(); - - JAXRSLibrary ref = JAXRSLibraryRegistryUtil.getInstance() - .getJAXRSLibraryRegistry().getJAXRSLibraryByID(libId); - if (ref != null) { - JAXRSLibraryClasspathContainer container = new JAXRSLibraryClasspathContainer( - ref); - JavaCore.setClasspathContainer(containerPath, - new IJavaProject[] { project }, - new IClasspathContainer[] { container }, null); - } - } - } - - private boolean isJAXRSLibraryContainer(IPath path) { - return path != null - && path.segmentCount() == 2 - && JAXRSLibraryConfigurationHelper.JAXRS_LIBRARY_CP_CONTAINER_ID - .equals(path.segment(0)); - } - - /* - * (non-Javadoc) - * - * @seeorg.eclipse.jdt.core.ClasspathContainerInitializer# - * canUpdateClasspathContainer(org.eclipse.core.runtime.IPath, - * org.eclipse.jdt.core.IJavaProject) - */ - public boolean canUpdateClasspathContainer(IPath containerPath, - IJavaProject project) { - return isJAXRSLibraryContainer(containerPath); - } - - /** - * @see org.eclipse.jdt.core.ClasspathContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, - * org.eclipse.jdt.core.IJavaProject) - */ - public String getDescription(IPath containerPath, IJavaProject project) { - if (isJAXRSLibraryContainer(containerPath)) { - String id = containerPath.lastSegment(); - JAXRSLibrary libref = JAXRSLibraryRegistryUtil.getInstance() - .getJAXRSLibraryRegistry().getJAXRSLibraryByID(id); - String displayText = id; - - if (libref == null) { - displayText = displayText + " " + MISSING_LIBRARY; //$NON-NLS-1$ - } - - return displayText; - } - return super.getDescription(containerPath, project); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jdt.core.ClasspathContainerInitializer#getComparisonID(org - * .eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject) - */ - public Object getComparisonID(IPath containerPath, IJavaProject project) { - return containerPath; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibraryClasspathContainer.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibraryClasspathContainer.java deleted file mode 100644 index 6e94f4909..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/JAXRSLibraryClasspathContainer.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/package org.eclipse.jst.ws.jaxrs.core.internal; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryRegistryUtil; -import org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal.JAXRSLibraryConfigurationHelper; - -/** - * JAXRS Library classpath container - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryClasspathContainer implements IClasspathContainer { - private static final String IMPL_DESC = Messages.JAXRSLibraryClasspathContainer_IMPL_LIBRARY; - - private JAXRSLibrary lib; - - /** - * @param lib - */ - public JAXRSLibraryClasspathContainer(JAXRSLibrary lib) { - this.lib = lib; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries() - */ - public IClasspathEntry[] getClasspathEntries() { - return JAXRSLibraryRegistryUtil.getInstance().getClasspathEntries(lib); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jdt.core.IClasspathContainer#getDescription() - */ - public String getDescription() { - StringBuffer buf = new StringBuffer(lib.getLabel()); - buf.append(" "); //$NON-NLS-1$ - buf.append(IMPL_DESC); - - return buf.toString(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jdt.core.IClasspathContainer#getKind() - */ - public int getKind() { - return IClasspathContainer.K_APPLICATION; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jdt.core.IClasspathContainer#getPath() - */ - public IPath getPath() { - return new Path( - JAXRSLibraryConfigurationHelper.JAXRS_LIBRARY_CP_CONTAINER_ID) - .append(this.lib.getID()); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/Messages.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/Messages.java deleted file mode 100644 index 836f38bd6..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/Messages.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100519 313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal; -import org.eclipse.osgi.util.NLS; - -/** - * String resource handler. - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxrs.core.internal.messages"; //$NON-NLS-1$ - - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDataModelProvider_ClientImplValidationMsg; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDataModelProvider_DupeJarValidation; - - /** - * see messages.properties - */ - public static String JAXRSLibrariesContainerInitializer_missing_library; - - /** - * see messages.properties - */ - public static String JAXRSLibraryClasspathContainer_IMPL_LIBRARY; - - /** - * see messages.properties - */ - public static String JAXRSLibraryConfigModel_Null_Data_Source; - - /** - * see messages.properties - */ - public static String JAXRSLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND; - - /** - * see messages.properties - */ - public static String JAXRSLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND; - - /** - * see messages.properties - */ - public static String JAXRSLibraryRegistry_ErrorCreatingURL; - /** - * see messages.properties - */ - public static String JAXRSLibraryRegistry_ErrorSaving; - /** - * see messages.properties - */ - public static String JAXRSLibraryRegistry_DEFAULT_IMPL_LABEL; - /** - * see messages.properties - */ - public static String JAXRSLibraryRegistry_ErrorLoadingFromExtPt; - - /** - * see messages.properties - */ - public static String JAXRSSharedLibraryConfigurator_ErrorLoadingFromExtPt; - /** - * see messages.properties - */ - public static String JAXRSLibraryProvider_ErrorLoadingFromExtPt; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDataModelProvider_ValidateServletName; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDataModelProvider_ValidateServletClassName; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDataModelProvider_ValidateJAXRSImpl; - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotCopyFile; - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotCloseFile; - /** - * see messages.properties - */ - public static String ArchiveFileImpl_CannotLocatePluginRelativeFile; - - /** - * see messages.properties - */ - public static String PluginProvidedJAXRSLibraryCreationHelper_ErrorCreating; - - /** - * see messages.properties - */ - public static String PluginProvidedSharedLibraryConfiguratorCreationHelper_ErrorCreating; - - /** - * see messages.properties - */ - public static String JAXRSLibraryProviderCreationHelper_ErrorCreating; - - /** - * see messages.properties - */ - public static String PluginProvidedJAXRSLibraryCreationHelper_ErrorMultipleDefinition; - - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDelegate_InternalErr; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDelegate_ConfigErr; - /** - * see messages.properties - */ - public static String JAXRSFacetInstallDelegate_NonUpdateableWebXML; - /** - * see messages.properties - */ - public static String JAXRSFacetUninstallDelegate_ConfigErr; - /** - * see messages.properties - */ - public static String JAXRSFacetUninstallDelegate_NonUpdateableWebXML; - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/ArchiveFile.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/ArchiveFile.java deleted file mode 100644 index 99d964f68..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/ArchiveFile.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Archive File</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#isRelativeToWorkspace - * <em>Relative To Workspace</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getSourceLocation - * <em>Source Location</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getRelativeDestLocation - * <em>Relative Dest Location</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary - * <em>JAXRS Library</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getArchiveFile() - * @model - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface ArchiveFile extends EObject { - /** - * Returns the value of the '<em><b>Source Location</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Location</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Source Location</em>' attribute. - * @see #setSourceLocation(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getArchiveFile_SourceLocation() - * @model required="true" - * @generated - */ - String getSourceLocation(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getSourceLocation - * <em>Source Location</em>}' attribute. <!-- begin-user-doc --> If the - * value passed is found to be relative to the workspace, a - * workspace-relative location is stored; to prevent this behaviour, call - * isRelativeToWorkspace(false) before calling this method. <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Source Location</em>' attribute. - * @see #getSourceLocation() - * @generated - */ - void setSourceLocation(String value); - - /** - * Returns the value of the '<em><b>Relative To Workspace</b></em>' - * attribute. The default value is <code>"true"</code>. <!-- begin-user-doc - * --> - * <p> - * If the meaning of the '<em>Relative To Workspace</em>' attribute isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Relative To Workspace</em>' attribute. - * @see #setRelativeToWorkspace(boolean) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getArchiveFile_RelativeToWorkspace() - * @model default="true" required="true" - * @generated - */ - boolean isRelativeToWorkspace(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#isRelativeToWorkspace - * <em>Relative To Workspace</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Relative To Workspace</em>' - * attribute. - * @see #isRelativeToWorkspace() - * @generated - */ - void setRelativeToWorkspace(boolean value); - - /** - * Returns the value of the '<em><b>Relative Dest Location</b></em>' - * attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Relative Dest Location</em>' attribute isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Relative Dest Location</em>' attribute. - * @see #setRelativeDestLocation(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getArchiveFile_RelativeDestLocation() - * @model required="true" - * @generated - */ - String getRelativeDestLocation(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getRelativeDestLocation - * <em>Relative Dest Location</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Relative Dest Location</em>' - * attribute. - * @see #getRelativeDestLocation() - * @generated - */ - void setRelativeDestLocation(String value); - - /** - * Returns the value of the '<em><b>JAXRS Library</b></em>' container - * reference. It is bidirectional and its opposite is ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getArchiveFiles - * <em>Archive Files</em>}'. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>JAXRS Library</em>' container reference isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>JAXRS Library</em>' container reference. - * @see #setJAXRSLibrary(JAXRSLibrary) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getArchiveFile_JAXRSLibrary() - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getArchiveFiles - * @model opposite="ArchiveFiles" required="true" - * @generated - */ - JAXRSLibrary getJAXRSLibrary(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary - * <em>JAXRS Library</em>}' container reference. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>JAXRS Library</em>' container - * reference. - * @see #getJAXRSLibrary() - * @generated - */ - void setJAXRSLibrary(JAXRSLibrary value); - - /** - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Path</em>' attribute isn't clear, there really - * should be more of a description here... - * </p> - * - * @return the path <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getPath(); - - /** - * <!-- begin-user-doc --> - * - * @return the name <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getName(); - - /** - * <!-- begin-user-doc --> - * - * @return true if exists <!-- end-user-doc --> - * @model required="true" - * @generated - */ - boolean exists(); - - /** - * <!-- begin-user-doc --> - * - * @param object - * @return true if equal <!-- end-user-doc --> - * @model required="true" objectRequired="true" - * @generated - */ - boolean equals(Object object); - - /** - * <!-- begin-user-doc --> - * - * @return the hashCode <!-- end-user-doc --> - * @model required="true" - * @generated - */ - int hashCode(); - - /** - * <!-- begin-user-doc --> - * - * @param baseDestLocation - * @return true if copied succeeds <!-- end-user-doc --> - * @model required="true" baseDestLocationRequired="true" - * @generated - */ - boolean copyTo(String baseDestLocation); - - /** - * <!-- begin-user-doc --> - * - * @return the resolved source location <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getResolvedSourceLocation(); - -} // ArchiveFile diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibrary.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibrary.java deleted file mode 100644 index 18f228738..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibrary.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>JAXRS Library</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.JAXRSLibrary#getID - * <em>ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.JAXRSLibrary#getName - * <em>Name</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.JAXRSLibrary#isDeployed - * <em>Deployed</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.JAXRSLibrary#getArchiveFiles - * <em>Archive Files</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryRegistryPackage#getJAXRSLibrary() - * @model - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface JAXRSLibrary extends EObject { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * Returns the value of the '<em><b>ID</b></em>' attribute. The default - * value is <code>""</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>ID</em>' attribute isn't clear, there really - * should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>ID</em>' attribute. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibrary_ID() - * @model default="" transient="true" changeable="false" derived="true" - * @generated - */ - String getID(); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>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>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibrary_Name() - * @model required="true" - * @generated - */ - String getName(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#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); - - /** - * Returns the value of the '<em><b>Deployed</b></em>' attribute. The - * default value is <code>"true"</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Deployed</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Deployed</em>' attribute. - * @see #setDeployed(boolean) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibrary_Deployed() - * @model default="true" required="true" - * @generated - */ - boolean isDeployed(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#isDeployed - * <em>Deployed</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @param value - * the new value of the '<em>Deployed</em>' attribute. - * @see #isDeployed() - * @generated - */ - void setDeployed(boolean value); - - /** - * Returns the value of the '<em><b>Archive Files</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile} - * . It is bidirectional and its opposite is ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary - * <em>JAXRS Library</em>}'. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Archive Files</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>Archive Files</em>' containment reference - * list. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibrary_ArchiveFiles() - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary - * @model type= - * "org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryregistry.ArchiveFile" - * opposite="JAXRSLibrary" containment="true" - * @generated - */ - @SuppressWarnings("unchecked") - EList getArchiveFiles(); - - /** - * <!-- begin-user-doc --> - * - * @param fullPath - * @return true if fullPath contains archive file <!-- end-user-doc --> - * @model required="true" fullPathRequired="true" - * @generated - */ - boolean containsArchiveFile(String fullPath); - - /** - * <!-- begin-user-doc --> - * - * @return the working copy <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - JAXRSLibrary getWorkingCopy(); - - /** - * <!-- begin-user-doc --> - * - * @param otherLibrary - * <!-- end-user-doc --> - * @model otherLibraryRequired="true" - * @generated - */ - void updateValues(JAXRSLibrary otherLibrary); - - /** - * <!-- begin-user-doc --> - * - * @param baseDestLocation - * @return true if copy succeeds <!-- end-user-doc --> - * @model required="true" baseDestLocationRequired="true" - * @generated - */ - boolean copyTo(String baseDestLocation); - - /** - * <!-- begin-user-doc --> - * - * @return label <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - String getLabel(); - -} // JAXRSLibrary diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistry.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistry.java deleted file mode 100644 index 63b17936d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistry.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>JAXRS Library Registry</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getDefaultImplementationID - * <em>Default Implementation ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getJAXRSLibraries - * <em>JAXRS Libraries</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getPluginProvidedJAXRSLibraries - * <em>Plugin Provided JAXRS Libraries</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibraryRegistry() - * @model - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - public interface JAXRSLibraryRegistry extends EObject { - /** - * Returns the value of the '<em><b>Default Implementation ID</b></em>' - * attribute. The default value is <code>""</code>. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Default Implementation ID</em>' attribute - * isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Default Implementation ID</em>' attribute. - * @see #setDefaultImplementationID(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibraryRegistry_DefaultImplementationID() - * @model default="" - * @generated - */ - String getDefaultImplementationID(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getDefaultImplementationID - * <em>Default Implementation ID</em>}' attribute. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Default Implementation ID</em>' - * attribute. - * @see #getDefaultImplementationID() - * @generated - */ - void setDefaultImplementationID(String value); - - /** - *The default implementation message string - */ - public static final String DEFAULT_IMPL_LABEL = Messages.JAXRSLibraryRegistry_DEFAULT_IMPL_LABEL; - - /** - * Returns the value of the '<em><b>JAXRS Libraries</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary} - * . <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>JAXRS Libraries</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>JAXRS Libraries</em>' containment reference - * list. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibraryRegistry_JAXRSLibraries() - * @model type= - * "org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryregistry.JAXRSLibrary" - * containment="true" - * @generated - */ - @SuppressWarnings("unchecked") - EList getJAXRSLibraries(); - - /** - * Returns the value of the '<em><b>Plugin Provided JAXRS Libraries</b></em> - * ' containment reference list. The list contents are of type - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary} - * . <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Plugin Provided JAXRS Libraries</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>Plugin Provided JAXRS Libraries</em>' - * containment reference list. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getJAXRSLibraryRegistry_PluginProvidedJAXRSLibraries() - * @model type="org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryregistry.PluginProvidedJAXRSLibrary" - * containment="true" transient="true" - * @generated - */ - @SuppressWarnings("unchecked") - EList getPluginProvidedJAXRSLibraries(); - - /** - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Default Implementation</em>' reference isn't - * clear, there really should be more of a description here... - * </p> - * - * @return the default implementation <!-- end-user-doc --> - * @model kind="operation" required="true" - * @generated - */ - JAXRSLibrary getDefaultImplementation(); - - /** - * <!-- begin-user-doc --> - * - * @param implementation - * <!-- end-user-doc --> - * @model implementationRequired="true" - * @generated - */ - void setDefaultImplementation(JAXRSLibrary implementation); - - /** - * <!-- begin-user-doc --> - * - * @param ID - * @return the JAXRS Library <!-- end-user-doc --> - * @model required="true" IDRequired="true" - * @generated - */ - JAXRSLibrary getJAXRSLibraryByID(String ID); - - /** - * <!-- begin-user-doc --> - * - * @param name - * @return the jaxrs libraries matching name <!-- end-user-doc --> - * @model required="true" many="false" nameRequired="true" - * @generated - */ - @SuppressWarnings("unchecked") - EList getJAXRSLibrariesByName(String name); - - /** - * <!-- begin-user-doc --> - * - * @return the implementation JAXRS libraries <!-- end-user-doc --> - * @model kind="operation" required="true" many="false" - * @generated - */ - @SuppressWarnings("unchecked") - EList getImplJAXRSLibraries(); - - /** - * <!-- begin-user-doc --> - * - * @return all the JAXRS libraries <!-- end-user-doc --> - * @model kind="operation" required="true" many="false" - * @generated - */ - @SuppressWarnings("unchecked") - EList getAllJAXRSLibraries(); - - /** - * <!-- begin-user-doc --> - * - * @param library - * @return true if add succeeds <!-- end-user-doc --> - * @model required="true" libraryRequired="true" - * @generated - */ - boolean addJAXRSLibrary(JAXRSLibrary library); - - /** - * <!-- begin-user-doc --> - * - * @param library - * @return true if remove succeeds <!-- end-user-doc --> - * @model required="true" libraryRequired="true" - * @generated - */ - boolean removeJAXRSLibrary(JAXRSLibrary library); - -} // JAXRSLibraryRegistry diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryFactory.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryFactory.java deleted file mode 100644 index 6aee7b967..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryFactory.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface JAXRSLibraryRegistryFactory extends EFactory { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The singleton instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - JAXRSLibraryRegistryFactory eINSTANCE = org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryFactoryImpl - .init(); - - /** - * Returns a new object of class '<em>JAXRS Library Registry</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>JAXRS Library Registry</em>'. - * @generated - */ - JAXRSLibraryRegistry createJAXRSLibraryRegistry(); - - /** - * Returns a new object of class '<em>JAXRS Library</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>JAXRS Library</em>'. - * @generated - */ - JAXRSLibrary createJAXRSLibrary(); - - /** - * Returns a new object of class '<em>Archive File</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Archive File</em>'. - * @generated - */ - ArchiveFile createArchiveFile(); - - /** - * Returns a new object of class '<em>Plugin Provided JAXRS Library</em>'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Plugin Provided JAXRS Library</em>'. - * @generated - */ - PluginProvidedJAXRSLibrary createPluginProvidedJAXRSLibrary(); - - /** - * Returns the package supported by this factory. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @return the package supported by this factory. - * @generated - */ - JAXRSLibraryRegistryPackage getJAXRSLibraryRegistryPackage(); - -} // JAXRSLibraryRegistryFactory diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryPackage.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryPackage.java deleted file mode 100644 index 3820a71c4..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/JAXRSLibraryRegistryPackage.java +++ /dev/null @@ -1,745 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory - * @model kind="package" - * @generated - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - public interface JAXRSLibraryRegistryPackage extends EPackage { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - /** - * The package name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNAME = "jaxrslibraryregistry"; - - /** - * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_URI = "http://www.eclipse.org/webtools/jaxrs/schema/jaxrslibraryregistry.xsd"; - - /** - * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_PREFIX = "jaxrslibreg"; - - /** - * The singleton instance of the package. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - JAXRSLibraryRegistryPackage eINSTANCE = org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl - .init(); - - /** - * The meta object id for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl - * <em>JAXRS Library Registry</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getJAXRSLibraryRegistry() - * @generated - */ - int JAXRS_LIBRARY_REGISTRY = 0; - - /** - * The feature id for the '<em><b>Default Implementation ID</b></em>' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID = 0; - - /** - * The feature id for the '<em><b>JAXRS Libraries</b></em>' containment - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES = 1; - - /** - * The feature id for the '<em><b>Plugin Provided JAXRS Libraries</b></em>' - * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES = 2; - - /** - * The number of structural features of the '<em>JAXRS Library Registry</em> - * ' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY_REGISTRY_FEATURE_COUNT = 3; - - /** - * The meta object id for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl - * <em>JAXRS Library</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getJAXRSLibrary() - * @generated - */ - int JAXRS_LIBRARY = 1; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY__ID = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY__NAME = 1; - - /** - * The feature id for the '<em><b>Deployed</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY__DEPLOYED = 2; - - /** - * The feature id for the '<em><b>Archive Files</b></em>' containment - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY__ARCHIVE_FILES = 3; - - /** - * The number of structural features of the '<em>JAXRS Library</em>' class. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int JAXRS_LIBRARY_FEATURE_COUNT = 6; - - /** - * The meta object id for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl - * <em>Archive File</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getArchiveFile() - * @generated - */ - int ARCHIVE_FILE = 3; - - /** - * The meta object id for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl - * <em>Plugin Provided JAXRS Library</em>}' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getPluginProvidedJAXRSLibrary() - * @generated - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY = 2; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__ID = JAXRS_LIBRARY__ID; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__NAME = JAXRS_LIBRARY__NAME; - - /** - * The feature id for the '<em><b>Deployed</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__DEPLOYED = JAXRS_LIBRARY__DEPLOYED; - - /** - * The feature id for the '<em><b>Archive Files</b></em>' containment - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__ARCHIVE_FILES = JAXRS_LIBRARY__ARCHIVE_FILES; - - /** - * The feature id for the '<em><b>Plugin ID</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID = JAXRS_LIBRARY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Label</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL = JAXRS_LIBRARY_FEATURE_COUNT + 1; - - /** - * The number of structural features of the ' - * <em>Plugin Provided JAXRS Library</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int PLUGIN_PROVIDED_JAXRS_LIBRARY_FEATURE_COUNT = JAXRS_LIBRARY_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Relative To Workspace</b></em>' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ARCHIVE_FILE__RELATIVE_TO_WORKSPACE = 0; - - /** - * The feature id for the '<em><b>Source Location</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ARCHIVE_FILE__SOURCE_LOCATION = 1; - - /** - * The feature id for the '<em><b>Relative Dest Location</b></em>' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ARCHIVE_FILE__RELATIVE_DEST_LOCATION = 2; - - /** - * The feature id for the '<em><b>JAXRS Library</b></em>' container - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ARCHIVE_FILE__JAXRS_LIBRARY = 3; - - /** - * The number of structural features of the '<em>Archive File</em>' class. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ARCHIVE_FILE_FEATURE_COUNT = 4; - - /** - * Returns the meta object for class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry - * <em>JAXRS Library Registry</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for class '<em>JAXRS Library Registry</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry - * @generated - */ - EClass getJAXRSLibraryRegistry(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getDefaultImplementationID - * <em>Default Implementation ID</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute ' - * <em>Default Implementation ID</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getDefaultImplementationID() - * @see #getJAXRSLibraryRegistry() - * @generated - */ - EAttribute getJAXRSLibraryRegistry_DefaultImplementationID(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getJAXRSLibraries - * <em>JAXRS Libraries</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list ' - * <em>JAXRS Libraries</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getJAXRSLibraries() - * @see #getJAXRSLibraryRegistry() - * @generated - */ - EReference getJAXRSLibraryRegistry_JAXRSLibraries(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getPluginProvidedJAXRSLibraries - * <em>Plugin Provided JAXRS Libraries</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the containment reference list ' - * <em>Plugin Provided JAXRS Libraries</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry#getPluginProvidedJAXRSLibraries() - * @see #getJAXRSLibraryRegistry() - * @generated - */ - EReference getJAXRSLibraryRegistry_PluginProvidedJAXRSLibraries(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary - * <em>JAXRS Library</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>JAXRS Library</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary - * @generated - */ - EClass getJAXRSLibrary(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getID - * <em>ID</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>ID</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getID() - * @see #getJAXRSLibrary() - * @generated - */ - EAttribute getJAXRSLibrary_ID(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getName() - * @see #getJAXRSLibrary() - * @generated - */ - EAttribute getJAXRSLibrary_Name(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#isDeployed - * <em>Deployed</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Deployed</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#isDeployed() - * @see #getJAXRSLibrary() - * @generated - */ - EAttribute getJAXRSLibrary_Deployed(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getArchiveFiles - * <em>Archive Files</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list ' - * <em>Archive Files</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary#getArchiveFiles() - * @see #getJAXRSLibrary() - * @generated - */ - EReference getJAXRSLibrary_ArchiveFiles(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile - * <em>Archive File</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Archive File</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile - * @generated - */ - EClass getArchiveFile(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getSourceLocation - * <em>Source Location</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Source Location</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getSourceLocation() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_SourceLocation(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#isRelativeToWorkspace - * <em>Relative To Workspace</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute '<em>Relative To Workspace</em> - * '. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#isRelativeToWorkspace() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_RelativeToWorkspace(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getRelativeDestLocation - * <em>Relative Dest Location</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute ' - * <em>Relative Dest Location</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getRelativeDestLocation() - * @see #getArchiveFile() - * @generated - */ - EAttribute getArchiveFile_RelativeDestLocation(); - - /** - * Returns the meta object for the container reference ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary - * <em>JAXRS Library</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the container reference ' - * <em>JAXRS Library</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile#getJAXRSLibrary() - * @see #getArchiveFile() - * @generated - */ - EReference getArchiveFile_JAXRSLibrary(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary - * <em>Plugin Provided JAXRS Library</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for class '<em>Plugin Provided JAXRS Library</em> - * '. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary - * @generated - */ - EClass getPluginProvidedJAXRSLibrary(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getPluginID - * <em>Plugin ID</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Plugin ID</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getPluginID() - * @see #getPluginProvidedJAXRSLibrary() - * @generated - */ - EAttribute getPluginProvidedJAXRSLibrary_PluginID(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getLabel - * <em>Label</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Label</em>'. - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getLabel() - * @see #getPluginProvidedJAXRSLibrary() - * @generated - */ - EAttribute getPluginProvidedJAXRSLibrary_Label(); - - /** - * 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 - */ - JAXRSLibraryRegistryFactory getJAXRSLibraryRegistryFactory(); - - /** - * <!-- 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.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl - * <em>JAXRS Library Registry</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getJAXRSLibraryRegistry() - * @generated - */ - // @SuppressWarnings("hiding") - EClass JAXRS_LIBRARY_REGISTRY = eINSTANCE.getJAXRSLibraryRegistry(); - - /** - * The meta object literal for the ' - * <em><b>Default Implementation ID</b></em>' attribute feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID = eINSTANCE - .getJAXRSLibraryRegistry_DefaultImplementationID(); - - /** - * The meta object literal for the '<em><b>JAXRS Libraries</b></em>' - * containment reference list feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EReference JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES = eINSTANCE - .getJAXRSLibraryRegistry_JAXRSLibraries(); - - /** - * The meta object literal for the ' - * <em><b>Plugin Provided JAXRS Libraries</b></em>' containment - * reference list feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EReference JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES = eINSTANCE - .getJAXRSLibraryRegistry_PluginProvidedJAXRSLibraries(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl - * <em>JAXRS Library</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getJAXRSLibrary() - * @generated - */ - // @SuppressWarnings("hiding") - EClass JAXRS_LIBRARY = eINSTANCE.getJAXRSLibrary(); - - /** - * The meta object literal for the '<em><b>ID</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute JAXRS_LIBRARY__ID = eINSTANCE.getJAXRSLibrary_ID(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute JAXRS_LIBRARY__NAME = eINSTANCE.getJAXRSLibrary_Name(); - - /** - * The meta object literal for the '<em><b>Deployed</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute JAXRS_LIBRARY__DEPLOYED = eINSTANCE - .getJAXRSLibrary_Deployed(); - - /** - * The meta object literal for the '<em><b>Archive Files</b></em>' - * containment reference list feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EReference JAXRS_LIBRARY__ARCHIVE_FILES = eINSTANCE - .getJAXRSLibrary_ArchiveFiles(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl - * <em>Archive File</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getArchiveFile() - * @generated - */ - // @SuppressWarnings("hiding") - EClass ARCHIVE_FILE = eINSTANCE.getArchiveFile(); - - /** - * The meta object literal for the ' - * <em><b>Relative To Workspace</b></em>' attribute feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__RELATIVE_TO_WORKSPACE = eINSTANCE - .getArchiveFile_RelativeToWorkspace(); - - /** - * The meta object literal for the '<em><b>Source Location</b></em>' - * attribute feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__SOURCE_LOCATION = eINSTANCE - .getArchiveFile_SourceLocation(); - - /** - * The meta object literal for the ' - * <em><b>Relative Dest Location</b></em>' attribute feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute ARCHIVE_FILE__RELATIVE_DEST_LOCATION = eINSTANCE - .getArchiveFile_RelativeDestLocation(); - - /** - * The meta object literal for the '<em><b>JAXRS Library</b></em>' - * container reference feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EReference ARCHIVE_FILE__JAXRS_LIBRARY = eINSTANCE - .getArchiveFile_JAXRSLibrary(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl - * <em>Plugin Provided JAXRS Library</em>}' class. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl#getPluginProvidedJAXRSLibrary() - * @generated - */ - // @SuppressWarnings("hiding") - EClass PLUGIN_PROVIDED_JAXRS_LIBRARY = eINSTANCE - .getPluginProvidedJAXRSLibrary(); - - /** - * The meta object literal for the '<em><b>Plugin ID</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID = eINSTANCE - .getPluginProvidedJAXRSLibrary_PluginID(); - - /** - * The meta object literal for the '<em><b>Label</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - // @SuppressWarnings("hiding") - EAttribute PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL = eINSTANCE - .getPluginProvidedJAXRSLibrary_Label(); - - } - -} // JAXRSLibraryRegistryPackage diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/PluginProvidedJAXRSLibrary.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/PluginProvidedJAXRSLibrary.java deleted file mode 100644 index 79a43407a..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrsibraryregistry/PluginProvidedJAXRSLibrary.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Plugin Provided JAXRS Library</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getPluginID - * <em>Plugin ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getLabel - * <em>Label</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getPluginProvidedJAXRSLibrary() - * @model - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface PluginProvidedJAXRSLibrary extends JAXRSLibrary { - /** - * Separator between plugin id and JAXRS Library name - */ - public static final String ID_SEPARATOR = "$$"; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - /** - * Returns the value of the '<em><b>Plugin ID</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Plugin ID</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Plugin ID</em>' attribute. - * @see #setPluginID(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getPluginProvidedJAXRSLibrary_PluginID() - * @model required="true" - * @generated - */ - String getPluginID(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getPluginID - * <em>Plugin ID</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @param value - * the new value of the '<em>Plugin ID</em>' attribute. - * @see #getPluginID() - * @generated - */ - void setPluginID(String value); - - /** - * Returns the value of the '<em><b>Label</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Label</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Label</em>' attribute. - * @see #setLabel(String) - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#getPluginProvidedJAXRSLibrary_Label() - * @model required="true" - * @generated - */ - String getLabel(); - - /** - * Sets the value of the ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary#getLabel - * <em>Label</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Label</em>' attribute. - * @see #getLabel() - * @generated - */ - void setLabel(String value); - -} // PluginProvidedJAXRSLibrary diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigDialogSettingData.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigDialogSettingData.java deleted file mode 100644 index 06136f1b6..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigDialogSettingData.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -/** - * To construct implementation library from sticky values in DialogSettings as - * saved libraries. - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - -public class JAXRSLibraryConfigDialogSettingData implements - JAXRSLibraryConfiglModelSource { - /** - * Delimintor for parsing a persistent property string. - */ - final protected static String SEPARATOR = ":"; //$NON-NLS-1$ - - final private JAXRSLibraryRegistryUtil jaxrsLibReg; - final private boolean dftImplLibDeployFlag; - final private boolean dftImplLibSharedLibFlag; - final private boolean sharedLibSupported; - private JAXRSLibraryInternalReference selJAXRSLibImpl; // lazy initialized - - public JAXRSLibraryConfigDialogSettingData(boolean implLibDeployFlag, boolean implLibSharedLibFlag, boolean sharedLibSupported) { - this.jaxrsLibReg = JAXRSLibraryRegistryUtil.getInstance(); - this.dftImplLibDeployFlag = implLibDeployFlag; - this.dftImplLibSharedLibFlag = implLibSharedLibFlag; - this.sharedLibSupported = sharedLibSupported; - } - - /** - * There is no saved JAXRSImplLibrary per se if initializing from - * DialogSettings since default implementation library is always selected - * - * A null is returned when there is no default implementation library in - * registry. - * - * @return selJAXRSLibImpl JAXRSLibraryInternalReference return default - * implementation library with updated deployment flag - */ - public JAXRSLibraryInternalReference getJAXRSImplementationLibrary() { - if (selJAXRSLibImpl == null) { - // To instansiate a JAXRSLibraryReferenceUserSpecified object from - // default impl lib as the saved library. - JAXRSLibraryInternalReference dftImplLib = jaxrsLibReg - .getDefaultJAXRSImplementationLibrary(); - if (dftImplLib != null) { - selJAXRSLibImpl = new JAXRSLibraryInternalReference(dftImplLib - .getLibrary(), true, // selected - dftImplLibDeployFlag, dftImplLibSharedLibFlag); - selJAXRSLibImpl.setSharedLibSupported(sharedLibSupported); - } - - } - return selJAXRSLibImpl; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigModel.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigModel.java deleted file mode 100644 index 675b4ff59..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigModel.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; - -/** - * Model for the custom control <b>JAXRSLibraryConfigControl</b>. A - * JAXRSLibraryConfigModel object is initialized from a source and updated with - * selected implementation when selections are changed. - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - -public class JAXRSLibraryConfigModel { - final private JAXRSLibraryConfiglModelSource data; - final private JAXRSLibraryRegistryUtil jaxrsLibReg; - @SuppressWarnings("unchecked") - private List colJAXRSImplLib; - - /** - * Private constructor. - * - * @param data - */ - private JAXRSLibraryConfigModel(JAXRSLibraryConfiglModelSource data) { - this.data = data; - this.jaxrsLibReg = JAXRSLibraryRegistryUtil.getInstance(); - } - - /** - * Return JAXRS implementation libraries. - * - * This list is initialized from JAXRS Library registry and updated with - * persistent configuration data. - * - * @return List - * - * @see org.eclipse.jst.ws.jaxrs.ui.properties.IJAXRSLibraryDecoratorProvider#getProjectJAXRSImplementationLibraries() - */ - @SuppressWarnings("unchecked") - public List getJAXRSImplementationLibraries() { - if (colJAXRSImplLib == null) { - /* - * To initialze an implementation library list from registry and - * then update the list with saved implementation library. - */ - colJAXRSImplLib = jaxrsLibReg.getJAXRSImplementationLibraries(); - JAXRSLibraryInternalReference targetLib = data - .getJAXRSImplementationLibrary(); - if (targetLib == null) { - // no saved implementation, get default implementation library - targetLib = jaxrsLibReg.getDefaultJAXRSImplementationLibrary(); - } - if (targetLib != null) { - JAXRSLibraryInternalReference srcLib = jaxrsLibReg - .getJAXRSLibraryReferencebyID(targetLib.getID()); - if (srcLib != null) { - srcLib.setSelected(true); - srcLib.setToBeDeployed(targetLib.isCheckedToBeDeployed()); - srcLib.setToBeSharedLibrary(targetLib.isSharedLibSupported() && targetLib.isCheckedToBeSharedLibrary()); - srcLib.setSharedLibSupported(targetLib.isSharedLibSupported()); - } - } - } - return colJAXRSImplLib; - } - - /** - * Return the selected JAXRS implementation library currently. A null is - * returned if none is selected. - * - * @return JAXRSLibraryInternalReference - */ - @SuppressWarnings("unchecked") - public JAXRSLibraryInternalReference getCurrentJAXRSImplementationLibrarySelection() { - Iterator it = getJAXRSImplementationLibraries().iterator(); - JAXRSLibraryInternalReference crtItem = null; - while (it.hasNext()) { - crtItem = (JAXRSLibraryInternalReference) it.next(); - if (crtItem.isSelected()) { - return crtItem; - } - } - return null; - } - - /** - * Returned a saved implementation library which was persisted as - * DialogSettings or as project properties. - * - * @return JAXRSLibraryInternalReference - */ - public JAXRSLibraryInternalReference getSavedJAXRSImplementationLibrary() { - return data.getJAXRSImplementationLibrary(); - } - - /** - * Update the selected JAXRS implementation library. - * - * Note: The library parameter won't be not added into the collection if it - * does not exist already. - * - * @param library - * JAXRSLibraryInternalReference - */ - @SuppressWarnings("unchecked") - public void setCurrentJAXRSImplementationLibrarySelection( - final JAXRSLibraryInternalReference library) { - if (library != null) { - Iterator it = getJAXRSImplementationLibraries().iterator(); - JAXRSLibraryInternalReference crtjaxrslib = null; - while (it.hasNext()) { - crtjaxrslib = (JAXRSLibraryInternalReference) it.next(); - if (crtjaxrslib.getID().equals(library.getID())) { - crtjaxrslib.setSelected(true); - crtjaxrslib - .setToBeDeployed(library.isCheckedToBeDeployed()); - crtjaxrslib.setToBeSharedLibrary(library.isSharedLibSupported() && library.isCheckedToBeSharedLibrary()); - crtjaxrslib.setSharedLibSupported(library.isSharedLibSupported()); - } else { - crtjaxrslib.setSelected(false); - } - } - } - } - - /** - * To save current configuration of implementation libraries as project - * properties. - * - * @param project - * IProject - */ - public void saveData(final IProject project) { - // Instantiate one to make sure it is for a project. - JAXRSLibraryConfigProjectData data_ = new JAXRSLibraryConfigProjectData( - project); - List<JAXRSLibraryInternalReference> implLibs = new ArrayList<JAXRSLibraryInternalReference>(); - implLibs.add(getCurrentJAXRSImplementationLibrarySelection()); - data_.saveData(implLibs); - } - - /** - * Factory class to create new JAXRSLibraryConfigModel instances - */ - public static final class JAXRSLibraryConfigModelFactory { - /** - * To create a new instance of JAXRSLibraryConfigModel object. A - * NullPointerException is raised if source is null. - * - * @param source - * JAXRSLibraryConfiglModelSource - * @return JAXRSLibraryConfigModel - */ - public static JAXRSLibraryConfigModel createInstance( - final JAXRSLibraryConfiglModelSource source) { - if (source == null) { - throw new NullPointerException( - Messages.JAXRSLibraryConfigModel_Null_Data_Source); - } - return new JAXRSLibraryConfigModel(source); - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigProjectData.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigProjectData.java deleted file mode 100644 index 92f578083..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfigProjectData.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -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.QualifiedName; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUtils; -import org.eclipse.osgi.util.NLS; - -/** - * To construct implementation library from persistent project properties as - * saved libraries. - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - -public class JAXRSLibraryConfigProjectData implements - JAXRSLibraryConfiglModelSource { - final static String QUALIFIEDNAME = "org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryConfigProjectData"; - /** - * Parsing delimiter for elements in a tuple. - */ - final protected static String SPTR_TUPLE = ":"; //$NON-NLS-1$ - /** - * Parsing delimiter for tuples in a persistent property string. - */ - final protected static String EO_TUPLE = ";"; //$NON-NLS-1$ - - final private IProject project; - final private JAXRSLibraryRegistryUtil jaxrsLibReg; - private JAXRSLibraryInternalReference selJAXRSLibImpl; - - /** - * Constructor - * - * @param project - */ - public JAXRSLibraryConfigProjectData(IProject project) { - this.project = project; - this.jaxrsLibReg = JAXRSLibraryRegistryUtil.getInstance(); - - /* - * logging message when object is instantiated instead of at method call - * to reduce log entries. - */ - if (!isProjectFirstCreated()) { - verifySavedLibAvailability(); - } - } - - /** - * Return the previously selected JAXRS implementation library from project - * persistent properties. Return null if none exists. - * - * @return selJAXRSLibImpl JAXRSLibraryDecorator - */ - public JAXRSLibraryInternalReference getJAXRSImplementationLibrary() { - try { - if (!isProjectFirstCreated() && selJAXRSLibImpl == null) { - String strImplLibs = ((IResource) project) - .getPersistentProperty(new QualifiedName(QUALIFIEDNAME, - JAXRSUtils.PP_JAXRS_IMPLEMENTATION_LIBRARIES)); - selJAXRSLibImpl = getJAXRSImplLibfromPersistentProperties(getTuples(strImplLibs)); - } - } catch (CoreException e) { - JAXRSCorePlugin - .log( - e, - "Exception occured while returning reference to the JAXRS implementation library"); - } - return selJAXRSLibImpl; - } - - /** - * To save configuration data as a project persistent properties. - * - * @param implementation - * @param component - */ - @SuppressWarnings("unchecked") - void saveData(final List implementation) { - try { - ((IResource) project).setPersistentProperty( - new QualifiedName(QUALIFIEDNAME, - JAXRSUtils.PP_JAXRS_IMPLEMENTATION_LIBRARIES), - generatePersistString(implementation)); - - /* - * Flush the selection so that they can be reconstructed from - * persistent properties when getSavedJAXRSImplLib and - * getSavedJAXRSCompLibs called next time. - */ - selJAXRSLibImpl = null; - - } catch (CoreException e) { - JAXRSCorePlugin - .log(e, - "Exception occured while persisting the JAXRS Library preferences"); - } - } - - /** - * Check if a project is just created by inspecting persistent properties if - * there is any. ? - */ - private boolean isProjectFirstCreated() { - boolean isNew = false; - try { - ((IResource) project) - .getPersistentProperty(new QualifiedName(QUALIFIEDNAME, - JAXRSUtils.PP_JAXRS_IMPLEMENTATION_LIBRARIES)); - } catch (CoreException e) { - isNew = true; - } - return isNew; - } - - private void verifySavedLibAvailability() { - try { - String strImplLibs = ((IResource) project) - .getPersistentProperty(new QualifiedName(QUALIFIEDNAME, - JAXRSUtils.PP_JAXRS_IMPLEMENTATION_LIBRARIES)); - - logMissingLib(getTuples(strImplLibs), true); - - } catch (CoreException e) { - JAXRSCorePlugin - .log(e, - "Exception occured while verifying saved JAXRS Library preferences"); - } - } - - private void logMissingLib(final List<Tuple> jaxrsLibTuples, - final boolean isVerifyImpl) { - if (jaxrsLibReg != null) { - Iterator<Tuple> itTuple = jaxrsLibTuples.iterator(); - while (itTuple.hasNext()) { - Tuple tuple = itTuple.next(); - JAXRSLibraryInternalReference jaxrsLib = jaxrsLibReg - .getJAXRSLibraryReferencebyID(tuple.getID()); - /* - * Information logged when saved JAXRS lib is removed from - * registry. One log entry is created for each missing library. - */ - if (jaxrsLib == null) { - String prjName = project.getName(); - String msg = (isVerifyImpl) ? Messages.JAXRSLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND - : Messages.JAXRSLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND; - JAXRSCorePlugin.log(IStatus.INFO, NLS.bind(msg, prjName)); - } - } - } - } - - private JAXRSLibraryInternalReference getJAXRSImplLibfromPersistentProperties( - final List<Tuple> jaxrsLibTuples) { - if (jaxrsLibReg != null) { - Tuple tuple = null; - JAXRSLibraryInternalReference lib = null; - Iterator<Tuple> itTuple = jaxrsLibTuples.iterator(); - while (itTuple.hasNext()) { - tuple = itTuple.next(); - lib = jaxrsLibReg.getJAXRSLibraryReferencebyID(tuple.id); - if (lib != null) { - return new JAXRSLibraryInternalReference(lib.getLibrary(), - tuple.selected, tuple.deploy, tuple.sharedLib); - } /* - * else { // already logged a message for a missing library } - */ - } - } - return null; - } - - @SuppressWarnings("unchecked") - private String generatePersistString(List list) { - JAXRSLibraryInternalReference jaxrsLibItem; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < list.size(); i++) { - jaxrsLibItem = (JAXRSLibraryInternalReference) list.get(i); - sb = sb.append(jaxrsLibItem.generatePersistString()); - sb.append(JAXRSLibraryConfigProjectData.EO_TUPLE); - } - return sb.toString(); - } - - private List<Tuple> getTuples(String strJAXRSLibs) { - List<Tuple> list = new ArrayList<Tuple>(); - - if (strJAXRSLibs != null) { - String patternStr = JAXRSLibraryConfigProjectData.EO_TUPLE; - String[] fields = strJAXRSLibs.split(patternStr); - if (strJAXRSLibs.length() > 0) { - Tuple tuple; - for (int i = 0; i < fields.length; i++) { - tuple = new Tuple(fields[i]); - list.add(tuple); - } - } - } - return list; - } - - /** - * Inner class for parsing project persistent properties. - * - * To Do: Take out selected attribute since it is not needed. Add the - * library name as an attribute. Provide code path to migrate earlier - * project. - * - * NOTE: this class should no longer be used except to support legacy - * library registries - */ - static class Tuple { - final private String id; - final private boolean selected; - final private boolean deploy; - final private boolean sharedLib; - - Tuple(String id, boolean selected, boolean deploy, boolean sharedLib) { - this.id = id; - this.selected = selected; - this.deploy = deploy; - this.sharedLib = sharedLib; - } - - // parse tuple = ID:selected:deploy - Tuple(String tuple) { - String[] fields = tuple - .split(JAXRSLibraryConfigProjectData.SPTR_TUPLE); - - if (fields.length >= 4) { - this.id = fields[0]; - this.selected = Boolean.valueOf(fields[1]).booleanValue(); - this.deploy = Boolean.valueOf(fields[2]).booleanValue(); - this.sharedLib = Boolean.valueOf(fields[3]).booleanValue(); - } else { - throw new IllegalStateException("Library registry is corrupt"); - } - } - - String getID() { - return id; - } - - boolean isSelected() { - return selected; - } - - boolean needDeploy() { - return deploy; - } - boolean needSharedLib() { - return sharedLib; - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfiglModelSource.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfiglModelSource.java deleted file mode 100644 index a87d3d4d0..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryConfiglModelSource.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -/** - * Interface for data source to instanciate a <b>JAXRSLibraryConfigModel</b> - * object. - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - -public interface JAXRSLibraryConfiglModelSource { - /** - * Return a saved JAXRS implementation library. Depends on the model source, - * it could be sticky values from DialogSettings or project property values. - * - * A null could be returned when creating first web project in a new - * workspace. - * - * @return JAXRSLibraryInternalReference - */ - public JAXRSLibraryInternalReference getJAXRSImplementationLibrary(); - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryInternalReference.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryInternalReference.java deleted file mode 100644 index cad96f5a5..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryInternalReference.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; - -/** - * Attach additional attributes such as selection and deployment to a JAXRS - * Library when it is referenced by a project. - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryInternalReference { - final private JAXRSLibrary jaxrsLib; - private boolean check4Deploy; // Initialized from default in workspace - private boolean check4SharedLib; // Initialized from default in workspace - private boolean selected; // selected for project - private boolean sharedLibSupported = false; - - public boolean isSharedLibSupported() { - return sharedLibSupported; - } - - public void setSharedLibSupported(boolean sharedLibSupported) { - this.sharedLibSupported = sharedLibSupported; - } - - /** - * Constructor - * - * @param jaxrsLib - * JAXRSLibrary instance embedded inside. - * @param selected - * boolean true if selected, otherwise, not selected. - * @param deploy - * boolean true if needs to be deployed, otherwise, won't be - * deployed. - */ - public JAXRSLibraryInternalReference(JAXRSLibrary jaxrsLib, - boolean selected, boolean deploy, boolean sharedLib) { - this.jaxrsLib = jaxrsLib; - this.selected = selected; - this.check4Deploy = deploy; - this.check4SharedLib = sharedLib; - } - - /** - * Return the embedded JAXRSLibrary instance. - * - * @return jaxrsLib JAXRSLibrary - */ - public JAXRSLibrary getLibrary() { - return jaxrsLib; - } - - /** - * Set the to be deployed flag. - * - * @param deploy - * boolean - */ - public void setToBeDeployed(final boolean deploy) { - check4Deploy = deploy; - } - - /** - * Set the to be shared library flag. - * - * @param deploy - * boolean - */ - public void setToBeSharedLibrary(final boolean sharedLib) { - check4SharedLib = sharedLib; - } - - /** - * Return true if the JAXRS Library needs to be deployed. Otherwise, return - * false. - * - * @return boolean - */ - public boolean isCheckedToBeDeployed() { - return check4Deploy; - } - /** - * Return true if the JAXRS Library needs to be added to the project as a shared library. - * Otherwise, return false. - * - * @return boolean - */ - public boolean isCheckedToBeSharedLibrary() { - return check4SharedLib; - } - - /** - * Set the selected attribute to a JAXRSLibraryLibraryReference object. - * - * @param selected - * boolean - */ - public void setSelected(final boolean selected) { - this.selected = selected; - } - - /** - * Return true if the JAXRS Library is referenced by a project. Otherwise, - * return false. - * - * @return selected boolean - */ - public boolean isSelected() { - return selected; - } - - /** - * To generate a string that represents the JAXRSLibraryLibraryReference - * object for persistence. - * - * @return String - */ - protected String generatePersistString() { - return (getID() + JAXRSLibraryConfigProjectData.SPTR_TUPLE - + String.valueOf(isSelected()) - + JAXRSLibraryConfigProjectData.SPTR_TUPLE + String - .valueOf(isCheckedToBeDeployed())); - } - - /** - * Helper method to return the library ID from the embedded JAXRSLibrary - * instance. - * - * @return id String - */ - public String getID() { - return jaxrsLib.getID(); - } - - /** - * Helper method to return the library name from the embedded JAXRSLibrary - * instance. - * - * @return name String - */ - public String getName() { - return jaxrsLib.getName(); - } - - /** - * Helper method to return the label for the library from the embedded - * JAXRSLibrary instance. - * - * @return name String - */ - public String getLabel() { - return jaxrsLib.getLabel(); - } - - /** - * Help method to return a list of Archive files from the embedded - * JAXRSLibrary instance. - * - * @return boolean - */ - @SuppressWarnings("unchecked") - public EList getArchiveFiles() { - return jaxrsLib.getArchiveFiles(); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryRegistryUtil.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryRegistryUtil.java deleted file mode 100644 index dae0a9ede..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryconfig/JAXRSLibraryRegistryUtil.java +++ /dev/null @@ -1,544 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100304 304732 ericdp@ca.ibm.com - Eric D. Peters, NPE loading library extensions - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryClasspathContainer; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.adapter.MaintainDefaultImplementationAdapter; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryPackageImpl; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util.JAXRSLibraryRegistryResourceFactoryImpl; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util.JAXRSLibraryRegistryResourceImpl; -import org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal.JAXRSLibraryConfigurationHelper; -import org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal.PluginProvidedJAXRSLibraryCreationHelper2; - -/** - * A singleton maintains lists of implementation libraries in registry. - * - * Each item in the lists contains a workingcopy of a JAX-RS library and - * decorates with usage information such selection and deployment. - * - * The lists are updated when there are changes in JAX-RS library registry. - * - */ -public class JAXRSLibraryRegistryUtil { - private static JAXRSLibraryRegistryUtil instance = null; - - private List<JAXRSLibraryInternalReference> implLibs = null; - - // The NS URI of the JAX-RS Library Registry's Ecore package. (Must match - // setting on package in Ecore model.) - private static final String JAXRS_LIBRARY_REGISTRY_NSURI = "http://www.eclipse.org/webtools/jaxrs/schema/jaxrslibraryregistry.xsd"; //$NON-NLS-1$ - - private static final String LIB_EXT_PT = "pluginProvidedJaxrsLibraries"; //$NON-NLS-1$ - - // The JAX-RS Library Registry EMF resource instance. - private static JAXRSLibraryRegistryResourceImpl JAXRSLibraryRegistryResource = null; - - // JAXRSLibraryRegistry singleton - private JAXRSLibraryRegistry JAXRSLibraryRegistry; - - /** - * Private constructor - */ - private JAXRSLibraryRegistryUtil() { - // nothing to do - } - - /** - * Return the singleton instance of JAXRSLibraryRegistryUtil. - * - * @return JAXRSLibraryRegistryUtil - */ - public synchronized static JAXRSLibraryRegistryUtil getInstance() { - if (instance == null) { - instance = new JAXRSLibraryRegistryUtil(); - instance.loadJAXRSLibraryRegistry(); - } - return instance; - } - - /** - * Convenience method to return the JAXRSLibraryRegistry instance. - * - * @return jaxrsLibReg JAXRSLibraryRegistry - */ - public JAXRSLibraryRegistry getJAXRSLibraryRegistry() { - return JAXRSLibraryRegistry; - } - - /** - * Get the default JAXRS implementation library instance. A null is returned - * when there is no libraries in the registry. - * - * @return JAXRSLibraryInternalReference - */ - public JAXRSLibraryInternalReference getDefaultJAXRSImplementationLibrary() { - JAXRSLibrary dftImplLib = getJAXRSLibraryRegistry() - .getDefaultImplementation(); - - return ((dftImplLib != null) ? getJAXRSLibraryReferencebyID(dftImplLib - .getID()) : null); - } - - /** - * Get the working copy of JAXRS implementation libraries. The list is - * updated when there are changes in registry. - * - * @return List - */ - List<JAXRSLibraryInternalReference> getJAXRSImplementationLibraries() { - if (implLibs == null) { - implLibs = wrapJAXRSLibraries(getJAXRSLibraryRegistry() - .getImplJAXRSLibraries()); - } else { - if (implLibs.size() != getJAXRSLibraryRegistry() - .getImplJAXRSLibraries().size() - || isAnyLibraryChanged(implLibs)) { - implLibs.clear(); - implLibs = wrapJAXRSLibraries(getJAXRSLibraryRegistry() - .getImplJAXRSLibraries()); - } - } - return implLibs; - } - - /** - * Get the JAXRSLibraryDecorator object from the provided ID. A null is - * returned no library matches the ID. - * - * @param id - * String - * @return JAXRSLibraryDecorator - */ - public JAXRSLibraryInternalReference getJAXRSLibraryReferencebyID( - final String id) { - Iterator<JAXRSLibraryInternalReference> it = getJAXRSImplementationLibraries() - .iterator(); - JAXRSLibraryInternalReference crtItem = null; - - // search implementation libraries - while (it.hasNext()) { - crtItem = it.next(); - if (id.equals(crtItem.getID())) { - return crtItem; - } - } - return null; - } - - /** - * Add a JAXRS Library into collection for either JAXRS implementation - * libraries. The decision is based on if a JAXRS Library is an - * implementation. - * - * @param library - * JAXRSLibraryLibraryReference - */ - public void addJAXRSLibrary(final JAXRSLibraryInternalReference library) { - // Library is added only if it does not exist in registry - if (library != null - && getJAXRSLibraryRegistry().getJAXRSLibraryByID( - library.getID()) == null) { - // Add the library working copy into workspace registry. - JAXRSLibrary jaxrsLib = library.getLibrary(); - getJAXRSLibraryRegistry() - .addJAXRSLibrary(jaxrsLib.getWorkingCopy()); - - // Add library into the collection depends on its type. - List<JAXRSLibraryInternalReference> list = getJAXRSImplementationLibraries(); - list.add(library); - } - } - - @SuppressWarnings("unchecked") - private List<JAXRSLibraryInternalReference> wrapJAXRSLibraries( - final EList libs) { - List<JAXRSLibraryInternalReference> list = new ArrayList<JAXRSLibraryInternalReference>(); - if (libs != null) { - JAXRSLibrary jaxrsLib; - JAXRSLibraryInternalReference jaxrsLibDctr; - - Iterator it = libs.iterator(); - while (it.hasNext()) { - jaxrsLib = (JAXRSLibrary) it.next(); - // Set selected , deployed , unshared initially - jaxrsLibDctr = new JAXRSLibraryInternalReference(jaxrsLib, - true, true, false); - list.add(jaxrsLibDctr); - } - } - return list; - } - - private boolean isAnyLibraryChanged( - final List<JAXRSLibraryInternalReference> list) { - Iterator<JAXRSLibraryInternalReference> it = list.iterator(); - JAXRSLibraryInternalReference wclib = null; // working copy library - JAXRSLibrary lib = null; - - while (it.hasNext()) { - wclib = it.next(); - lib = getJAXRSLibraryRegistry().getJAXRSLibraryByID(wclib.getID()); - if (lib == null) { // removed. Hence, changed. - return true; - } - if (wclib.getArchiveFiles().size() != lib.getArchiveFiles().size()) { // Archives - // changed.. - return true; - } - if (isAnyArchiveFileChanged(wclib.getArchiveFiles(), lib - .getArchiveFiles())) { // Check archive file changes. I.e., - // name and location - return true; - } - } - return false; - } - - @SuppressWarnings("unchecked") - private boolean isAnyArchiveFileChanged(final EList source, EList target) { - ArchiveFile arSrc = null; - Iterator it = source.iterator(); - while (it.hasNext()) { - arSrc = (ArchiveFile) it.next(); - if (!findMatchedArchive(arSrc, target)) { - return true; - } - } - return false; - } - - @SuppressWarnings("unchecked") - private boolean findMatchedArchive(ArchiveFile source, EList list) { - ArchiveFile target = null; - Iterator it = list.iterator(); - while (it.hasNext()) { - target = (ArchiveFile) it.next(); - if (target.equals(source)) { - return true; - } - } - return false; - } - - /** - * Get the classpath entries for a JAXRS Library - * - * @param lib - * @return IClasspathEntry[] - */ - @SuppressWarnings("unchecked") - public IClasspathEntry[] getClasspathEntries(JAXRSLibrary lib) { - // TODO: cache to optimize. probably belongs inside JAXRSLibrary model. - ArrayList<IClasspathEntry> res = new ArrayList<IClasspathEntry>(lib - .getArchiveFiles().size()); - for (Iterator it = lib.getArchiveFiles().iterator(); it.hasNext();) { - ArchiveFile jar = (ArchiveFile) it.next(); - if (jar != null && jar.exists()) { - IClasspathEntry entry = getClasspathEntry(jar); - if (entry != null) - res.add(entry); - } - } - IClasspathEntry[] entries = res - .toArray(new IClasspathEntry[res.size()]); - return entries; - } - - /** - * Create IClasspathEntry for ArchiveFile - * - * @param jar - * @return IClasspathEntry - */ - public IClasspathEntry getClasspathEntry(ArchiveFile jar) { - IClasspathEntry entry = null; - if (jar != null && jar.exists()) { - entry = JavaCore.newLibraryEntry(new Path(jar - .getResolvedSourceLocation()), null, null);// , nu, - // sourceAttachRoot, - // accessRules, - // extraAttributes, - // false/*not - // exported*/); - } - return entry; - } - - /** - * Binds JAXRS Libraries to classpath containers when the library changes. - * - * This method will deal with library/cp container renames by removing the - * old classpath container and then adding. - * - * @param oldId - * @param newId - * @param monitor - * @throws JavaModelException - */ - public static void rebindClasspathContainerEntries(String oldId, - String newId, IProgressMonitor monitor) throws JavaModelException { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IJavaProject[] projects = JavaCore.create(root).getJavaProjects(); - IPath containerPath = new Path( - JAXRSLibraryConfigurationHelper.JAXRS_LIBRARY_CP_CONTAINER_ID) - .append(newId); - IPath oldContainerPath = new Path( - JAXRSLibraryConfigurationHelper.JAXRS_LIBRARY_CP_CONTAINER_ID) - .append(oldId); - - JAXRSLibrary lib = JAXRSLibraryRegistryUtil.getInstance() - .getJAXRSLibraryRegistry().getJAXRSLibraryByID(newId); - List<IJavaProject> affectedProjects = new ArrayList<IJavaProject>(); - boolean removeAndAddBecauseOfRename = (!oldId.equals(newId)); - // find all projects using the old container name... - for (int i = 0; i < projects.length; i++) { - IJavaProject project = projects[i]; - IClasspathEntry[] entries = project.getRawClasspath(); - for (int k = 0; k < entries.length; k++) { - IClasspathEntry curr = entries[k]; - if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { - if (oldContainerPath.equals(curr.getPath())) { - affectedProjects.add(project); - break; - } - } - } - } - - if (!affectedProjects.isEmpty()) { - IJavaProject[] affected = affectedProjects - .toArray(new IJavaProject[affectedProjects.size()]); - IClasspathContainer[] containers = new IClasspathContainer[affected.length]; - removeAndAddBecauseOfRename = (!oldId.equals(newId)); - if (removeAndAddBecauseOfRename) {// not very pretty... remove and - // add new container - IClasspathEntry newEntry = JavaCore - .newContainerEntry(containerPath); - for (int i = 0; i < affected.length; i++) { - IJavaProject project = affected[i]; - IClasspathEntry[] entries = project.getRawClasspath(); - List<IClasspathEntry> keptEntries = new ArrayList<IClasspathEntry>(); - // keep all entries except the old one - for (int k = 0; k < entries.length; k++) { - IClasspathEntry curr = entries[k]; - if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { - if (!oldContainerPath.equals(curr.getPath())) - keptEntries.add(curr); - } else { - keptEntries.add(curr); - } - } - // add new container entry - keptEntries.add(newEntry); - setRawClasspath(project, keptEntries, monitor); - } - - } else {// rebind - - JAXRSLibraryClasspathContainer container = new JAXRSLibraryClasspathContainer( - lib); - containers[0] = container; - - JavaCore.setClasspathContainer(containerPath, affected, - containers, monitor); - } - } else { - if (monitor != null) { - monitor.done(); - } - } - } - - /** - * Sets the raw classpath on a project and logs an error if it when a - * JavaModelException occurs - * - * @param project - * @param cpEntries - * @param monitor - */ - public static void setRawClasspath(IJavaProject project, - List<IClasspathEntry> cpEntries, IProgressMonitor monitor) { - IClasspathEntry[] entries = cpEntries.toArray(new IClasspathEntry[0]); - try { - project.setRawClasspath(entries, monitor); - } catch (JavaModelException e) { - JAXRSCorePlugin.log(e, "Unable to set classpath for: " - + project.getProject().getName()); - } - } - - /** - * Return the URI for the specified JAXRS Library Registry - * - * @param registryVersion - * @return URI - * @throws MalformedURLException - */ - public static URI getRegistryURI(String registryVersion) - throws MalformedURLException { - URL jaxrsLibRegURL = new URL(Platform.getInstanceLocation().getURL(), - registryVersion); - return URI.createURI(jaxrsLibRegURL.toString()); - } - - /** - * Loads the JAXRSLibraryRegistry EMF object from plugin-specfic workspace - * settings location. - */ - private void loadJAXRSLibraryRegistry() { - try { - - EPackage.Registry.INSTANCE.put(JAXRS_LIBRARY_REGISTRY_NSURI, - JAXRSLibraryRegistryPackageImpl.init()); - URI jaxrsLibRegURI = getRegistryURI(".metadata/.plugins/org.eclipse.jst.ws.jaxrs.core/JAXRSLibraryRegistry.xml"); - - JAXRSLibraryRegistryResourceFactoryImpl resourceFactory = new JAXRSLibraryRegistryResourceFactoryImpl(); - JAXRSLibraryRegistryResource = (JAXRSLibraryRegistryResourceImpl) resourceFactory - .createResource(jaxrsLibRegURI); - try { - Map<String, Boolean> options = new HashMap<String, Boolean>(); - // disable notifications during load to avoid changing stored - // default implementation - options.put(XMLResource.OPTION_DISABLE_NOTIFY, Boolean.TRUE); - JAXRSLibraryRegistryResource.load(options); - JAXRSLibraryRegistry = (JAXRSLibraryRegistry) JAXRSLibraryRegistryResource - .getContents().get(0); - - loadJAXRSLibraryExtensions(); - - } catch (IOException ioe) { - // Create a new Registry instance - JAXRSLibraryRegistry = JAXRSLibraryRegistryFactory.eINSTANCE - .createJAXRSLibraryRegistry(); - JAXRSLibraryRegistryResource = (JAXRSLibraryRegistryResourceImpl) resourceFactory - .createResource(jaxrsLibRegURI); - JAXRSLibraryRegistryResource.getContents().add( - JAXRSLibraryRegistry); - loadJAXRSLibraryExtensions(); - saveJAXRSLibraryRegistry(); - } - // add adapter to maintain default implementation - if (JAXRSLibraryRegistry != null) { - // check that a default impl is set. if not pick first one if - // available. - JAXRSLibrary defLib = JAXRSLibraryRegistry - .getDefaultImplementation(); - if (defLib == null - && JAXRSLibraryRegistry.getImplJAXRSLibraries().size() > 0) { - JAXRSLibraryRegistry - .setDefaultImplementation((JAXRSLibrary) JAXRSLibraryRegistry - .getImplJAXRSLibraries().get(0)); - saveJAXRSLibraryRegistry(); - } - JAXRSLibraryRegistry.eAdapters().add( - MaintainDefaultImplementationAdapter.getInstance()); - - } - } catch (MalformedURLException mue) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSLibraryRegistry_ErrorCreatingURL, mue); - } - } - - // /////////////////////////////// Load and Save JAXRS Library Registry - // //////////////////////////////////////////////// - - /** - * Creates library registry items from extension points. - */ - private void loadJAXRSLibraryExtensions() { - try { - IExtensionPoint point = Platform.getExtensionRegistry() - .getExtensionPoint(JAXRSCorePlugin.PLUGIN_ID, LIB_EXT_PT); - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IExtension ext = extensions[i]; - for (int j = 0; j < ext.getConfigurationElements().length; j++) { - PluginProvidedJAXRSLibraryCreationHelper2 newLibCreator = new PluginProvidedJAXRSLibraryCreationHelper2( - ext.getConfigurationElements()[j]); - JAXRSLibrary newLib = newLibCreator.create(); - - if (newLib != null) - JAXRSLibraryRegistry.addJAXRSLibrary(newLib); - } - } - } catch (InvalidRegistryObjectException e) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSLibraryRegistry_ErrorLoadingFromExtPt, e); - } - } - - /** - * Saves the JAXRSLibraryRegistry EMF object from plugin-specfic workspace - * settings location. (Called from stop(BundleContext).) - * - * @return true if save is successful - */ - public boolean saveJAXRSLibraryRegistry() { - boolean saved = false; - if (JAXRSLibraryRegistryResource != null) { - try { - JAXRSLibraryRegistryResource.save(Collections.EMPTY_MAP); - saved = true; - } catch (IOException ioe) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSLibraryRegistry_ErrorSaving, ioe); - } - } else { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSLibraryRegistry_ErrorSaving); - } - return saved; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProvider.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProvider.java deleted file mode 100644 index 8d52f023d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig; - - -public interface JAXRSLibraryProvider { - String getLibraryProviderID(); - void setLibraryProviderID(String value); - boolean getShowUpdateDDCheckBox(); - void setShowUpdateDDCheckBox(boolean show); - boolean getUpdateDDCheckBoxSelected(); - void setUpdateDDCheckBoxSelected(boolean show); - String getServletClassName(); - void setServletClassName(String sevletClassName); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderCreationHelper.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderCreationHelper.java deleted file mode 100644 index 25bb146f9..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderCreationHelper.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create JAXRS Library Providers from the - * <code>org.eclipse.jst.ws.jaxrs.core.jaxrsLibraryProvider</code> - * extension-point. - * - */ - -public final class JAXRSLibraryProviderCreationHelper { - private JAXRSLibraryProviderImpl newLibraryProvider; - private IConfigurationElement config_element; - /** - * Key of the 'libraryProviderID' attribute of the extension point. - */ - public final static String LibraryProviderID = "libraryProviderID"; //$NON-NLS-1$ - - - /** - * Key of the 'showUpdateDD' attribute of the extension point. - */ - public final static String ShowUpdateDD = "showUpdateDD"; //$NON-NLS-1$ - /** - * Key of the 'updateDDSelected' attribute of the extension point. - */ - public final static String UpdateDDSelected = "updateDDSelected"; //$NON-NLS-1$ - /** - * Key of the 'isSelected' attribute of the extension point. - */ - public final static String SevletClassName = "sevletClassName"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param JAXRSLibraryProvider - * IConfigurationElement instance - */ - public JAXRSLibraryProviderCreationHelper( - IConfigurationElement JAXRSLibraryProvider) { - this.config_element = JAXRSLibraryProvider; - } - - - /** - * Creates a new LibraryProvider from the <code>org.eclipse.jst.ws.jaxrs.core.jaxrsLibraryProvider</code> - * extension-point. - * - * @return JAXRSLibraryProvider instance. - */ - public JAXRSLibraryProvider create() { - try { - newLibraryProvider = new JAXRSLibraryProviderImpl(); - newLibraryProvider.setLibraryProviderID(config_element.getAttribute(LibraryProviderID)); - newLibraryProvider.setServletClassName(config_element.getAttribute(SevletClassName)); - newLibraryProvider.setShowUpdateDDCheckBox(Boolean.parseBoolean(config_element - .getAttribute(ShowUpdateDD))); - newLibraryProvider.setUpdateDDCheckBoxSelected(Boolean.parseBoolean(config_element - .getAttribute(UpdateDDSelected))); - return newLibraryProvider; - } catch (Exception e) { - JAXRSCorePlugin - .log( - e, - NLS - .bind( - Messages.JAXRSLibraryProviderCreationHelper_ErrorCreating, - newLibraryProvider.getLibraryProviderID())); - } - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderImpl.java deleted file mode 100644 index 86ef07bb8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig; - - -public class JAXRSLibraryProviderImpl implements JAXRSLibraryProvider { - boolean showUpdateDD = false; - boolean updateDDSelected = false; - String libraryProviderID; - String servletClassName; - public JAXRSLibraryProviderImpl() { - } - public String getLibraryProviderID() { - return libraryProviderID; - } - - public void setLibraryProviderID(String id) { - this.libraryProviderID = id; - - } - public boolean getShowUpdateDDCheckBox() { - return showUpdateDD; - } - public void setShowUpdateDDCheckBox(boolean show) { - this.showUpdateDD = show; - } - public boolean getUpdateDDCheckBoxSelected() { - return this.updateDDSelected; - } - public void setUpdateDDCheckBoxSelected(boolean selected) { - this.updateDDSelected = selected; - } - public String getServletClassName() { - return this.servletClassName; - } - public void setServletClassName(String name) { - this.servletClassName = name; - - } - - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderUtil.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderUtil.java deleted file mode 100644 index f2b5c2dba..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryproviderconfig/JAXRSLibraryProviderUtil.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * A singleton maintains lists of Library Providers - * - */ -public class JAXRSLibraryProviderUtil { - private static JAXRSLibraryProviderUtil instance = null; - - private static List<JAXRSLibraryProvider> libraryProviders = new Vector<JAXRSLibraryProvider>(); - - private static final String JAXRS_LIBRARY_PROVIDER_EXT_PT = "jaxrsLibraryProvider"; - - - /** - * Private constructor - */ - private JAXRSLibraryProviderUtil() { - // nothing to do - } - - public static boolean isUpdateDDCheckBoxSelectedByDefault(String libraryID) { - if (libraryID == null) - return false; - - JAXRSLibraryProviderUtil.getInstance(); - java.util.List<JAXRSLibraryProvider> libraryProviders = getLibraryProviders(); - - Iterator<JAXRSLibraryProvider> libraryProvidersIterator = libraryProviders - .iterator(); - while (libraryProvidersIterator.hasNext()) { - JAXRSLibraryProvider thisLibraryProvider = libraryProvidersIterator - .next(); - if (libraryID.equals(thisLibraryProvider.getLibraryProviderID())) { - return thisLibraryProvider.getUpdateDDCheckBoxSelected(); - } - - } - - return false; - } - - public static boolean isUpdateDDCheckBoxSupportAvailable(String libraryID) { - if (libraryID == null || libraryID.length() == 0) - return false; - - JAXRSLibraryProviderUtil.getInstance(); - java.util.List<JAXRSLibraryProvider> libraryProviders = getLibraryProviders(); - - Iterator<JAXRSLibraryProvider> libraryProvidersIterator = libraryProviders - .iterator(); - while (libraryProvidersIterator.hasNext()) { - JAXRSLibraryProvider thisLibraryProvider = libraryProvidersIterator - .next(); - if (libraryID.equals(thisLibraryProvider.getLibraryProviderID())) { - if (thisLibraryProvider.getShowUpdateDDCheckBox()) { - return true; - } - } - - } - - return false; - } - public static boolean servletClassNameHasLibraryProvider(String servletClassName) { - if (servletClassName == null) - return false; - - JAXRSLibraryProviderUtil.getInstance(); - java.util.List<JAXRSLibraryProvider> libraryProviders = getLibraryProviders(); - - Iterator<JAXRSLibraryProvider> libraryProvidersIterator = libraryProviders - .iterator(); - while (libraryProvidersIterator.hasNext()) { - JAXRSLibraryProvider thisLibraryProvider = libraryProvidersIterator - .next(); - if (servletClassName.equals(thisLibraryProvider.getServletClassName())) { - return true; - } - - } - - return false; - } - public static String getServletClassName(String libraryID) { - String toReturn = ""; - if (libraryID == null || libraryID.length() == 0) - return toReturn; - - JAXRSLibraryProviderUtil.getInstance(); - java.util.List<JAXRSLibraryProvider> libraryProviders = getLibraryProviders(); - - Iterator<JAXRSLibraryProvider> libraryProvidersIterator = libraryProviders - .iterator(); - while (libraryProvidersIterator.hasNext()) { - JAXRSLibraryProvider thisLibraryProvider = libraryProvidersIterator - .next(); - if (libraryID.equals(thisLibraryProvider.getLibraryProviderID())) { - return thisLibraryProvider.getServletClassName() != null ? thisLibraryProvider.getServletClassName() : toReturn; - } - - } - - return toReturn; - } - - /** - * Return the singleton instance of JAXRSLibraryProviderUtil. - * - * @return JAXRSLibraryProviderUtil - */ - public synchronized static JAXRSLibraryProviderUtil getInstance() { - if (instance == null) { - instance = new JAXRSLibraryProviderUtil(); - instance.loadLibraryProvidersExtensions(); - } - return instance; - } - - /** - * Creates jax-rs library provider items from extension points. - */ - private void loadLibraryProvidersExtensions() { - try { - IExtensionPoint point = Platform.getExtensionRegistry() - .getExtensionPoint(JAXRSCorePlugin.PLUGIN_ID, JAXRS_LIBRARY_PROVIDER_EXT_PT); - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IExtension ext = extensions[i]; - for (int j = 0; j < ext.getConfigurationElements().length; j++) { - JAXRSLibraryProviderCreationHelper newLibCreator = new JAXRSLibraryProviderCreationHelper( - ext.getConfigurationElements()[j]); - JAXRSLibraryProvider newLibraryProvider = newLibCreator.create(); - - if (newLibraryProvider != null) - libraryProviders.add(newLibraryProvider); - } - } - } catch (InvalidRegistryObjectException e) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSLibraryProvider_ErrorLoadingFromExtPt, e); - } - } - - public static List<JAXRSLibraryProvider> getLibraryProviders() { - return libraryProviders; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/adapter/MaintainDefaultImplementationAdapter.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/adapter/MaintainDefaultImplementationAdapter.java deleted file mode 100644 index 77b57df0d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/adapter/MaintainDefaultImplementationAdapter.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.adapter; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryRegistryUtil; - -/** - * EMF adapter that attempts to always maintain a default implementation - * JAXRSLibrary upon addition and removal of JAXRSLibrary instances * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class MaintainDefaultImplementationAdapter extends AdapterImpl { - - private static MaintainDefaultImplementationAdapter INSTANCE = new MaintainDefaultImplementationAdapter(); - - /** - * Gets the single instance of this adapter. - * - * @return The single instance of this adapter. - */ - public static MaintainDefaultImplementationAdapter getInstance() { - return INSTANCE; - } - - /** - * Called to notify this adapter that a change has occured. - * - * @param notification - * EMF Notification instance - */ - public void notifyChanged(Notification notification) { - Object objNotifier = notification.getNotifier(); - if (objNotifier instanceof JAXRSLibraryRegistry) { - int eventType = notification.getEventType(); - switch (eventType) { - case Notification.ADD: - Object objNewValue = notification.getNewValue(); - if (objNewValue instanceof JAXRSLibrary) { - libraryAdded((JAXRSLibrary) objNewValue); - } - break; - case Notification.REMOVE: - Object objOldValue = notification.getOldValue(); - if (objOldValue instanceof JAXRSLibrary) { - libraryRemoved((JAXRSLibrary) objOldValue); - } - break; - } - } else if (objNotifier instanceof JAXRSLibrary) { - - } - } - - /** - * Checks if the library added is an implementation and, if so, makes it the - * default implementation if it is the only implementation. - * - * @param library - * JAXRSLibrary instance - */ - @SuppressWarnings("unchecked") - protected void libraryAdded(JAXRSLibrary library) { - if (library != null) { - JAXRSLibraryRegistry jaxrsLibReg = JAXRSLibraryRegistryUtil - .getInstance().getJAXRSLibraryRegistry(); - EList impls = jaxrsLibReg.getImplJAXRSLibraries(); - if (impls.size() == 1) { - jaxrsLibReg.setDefaultImplementation(library); - } - } - } - - /** - * Checks if the library removed is the default implementation and, if so, - * makes the first remaining implementation the new default or nulls out the - * default implementation if no other implementation remains. - * - * @param library - * JAXRSLibrary instance - */ - protected void libraryRemoved(JAXRSLibrary library) { - if (library != null) { - JAXRSLibraryRegistry jaxrsLibReg = JAXRSLibraryRegistryUtil - .getInstance().getJAXRSLibraryRegistry(); - JAXRSLibrary defaultImpl = jaxrsLibReg.getDefaultImplementation(); - if (defaultImpl == null - || library.getID().equals(defaultImpl.getID())) { - setNewDefaultImplementation(); - } - } - } - - /** - * Sets the first available JAXRSLibrary marked as an implementation as the - * default implementation or sets the default implementation to null if no - * JAXRSLibrary is marked as an implementation. - */ - @SuppressWarnings("unchecked") - protected void setNewDefaultImplementation() { - JAXRSLibraryRegistry jaxrsLibReg = JAXRSLibraryRegistryUtil - .getInstance().getJAXRSLibraryRegistry(); - EList impls = jaxrsLibReg.getImplJAXRSLibraries(); - if (impls.size() > 0) { - jaxrsLibReg.setDefaultImplementation((JAXRSLibrary) impls.get(0)); - } else { - jaxrsLibReg.setDefaultImplementation(null); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/ArchiveFileImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/ArchiveFileImpl.java deleted file mode 100644 index 74baf48f8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/ArchiveFileImpl.java +++ /dev/null @@ -1,785 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -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.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Bundle; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Archive File</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl#isRelativeToWorkspace - * <em>Relative To Workspace</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl#getSourceLocation - * <em>Source Location</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl#getRelativeDestLocation - * <em>Relative Dest Location</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.ArchiveFileImpl#getJAXRSLibrary - * <em>JAXRS Library</em>}</li> - * </ul> - * </p> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class ArchiveFileImpl extends EObjectImpl implements ArchiveFile { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The default value of the '{@link #isRelativeToWorkspace() - * <em>Relative To Workspace</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #isRelativeToWorkspace() - * @generated - * @ordered - */ - protected static final boolean RELATIVE_TO_WORKSPACE_EDEFAULT = true; - - /** - * The cached value of the '{@link #isRelativeToWorkspace() - * <em>Relative To Workspace</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #isRelativeToWorkspace() - * @generated - * @ordered - */ - protected boolean relativeToWorkspace = RELATIVE_TO_WORKSPACE_EDEFAULT; - - /** - * The default value of the '{@link #getSourceLocation() - * <em>Source Location</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getSourceLocation() - * @generated - * @ordered - */ - protected static final String SOURCE_LOCATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSourceLocation() - * <em>Source Location</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getSourceLocation() - * @generated - * @ordered - */ - protected String sourceLocation = SOURCE_LOCATION_EDEFAULT; - - /** - * The default value of the '{@link #getRelativeDestLocation() - * <em>Relative Dest Location</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getRelativeDestLocation() - * @generated - * @ordered - */ - protected static final String RELATIVE_DEST_LOCATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getRelativeDestLocation() - * <em>Relative Dest Location</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getRelativeDestLocation() - * @generated - * @ordered - */ - protected String relativeDestLocation = RELATIVE_DEST_LOCATION_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ArchiveFileImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the static eClass <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JAXRSLibraryRegistryPackage.Literals.ARCHIVE_FILE; - } - - /** - * <!-- begin-user-doc --> - * - * @return the source location <!-- end-user-doc --> - * @generated - */ - public String getSourceLocation() { - return sourceLocation; - } - - /** - * <!-- begin-user-doc --> Enhanced to not only set the location but also to - * attempt to determine if the location passed is relative to the current - * workspace. If so, only the relative location is stored. If not, the full - * location as passed is stored and the relativeToWorkspace property is set - * to false. To override this behaviour and set the absolute location as - * passed regardless, call setRelativeToWorkspace(false) BEFORE calling this - * method. - * - * @param newSourceLocation - * - * <!-- end-user-doc --> - * @generated NOT - */ - public void setSourceLocation(String newSourceLocation) { - String oldSourceLocation = sourceLocation; - if (relativeToWorkspace) { - IWorkspaceRoot workspaceRoot = getWorkspaceRoot(); - if (workspaceRoot != null) { - IPath wsRootPath = workspaceRoot.getLocation(); - IPath srcPath = new Path(newSourceLocation); - if (workspaceRoot.findMember(srcPath) != null) { - sourceLocation = newSourceLocation; - } else if (wsRootPath.isPrefixOf(srcPath)) { - int segmentsMatched = wsRootPath - .matchingFirstSegments(srcPath); - srcPath = srcPath.removeFirstSegments(segmentsMatched) - .setDevice(null); - sourceLocation = srcPath.toOSString(); - } else { - sourceLocation = newSourceLocation; - relativeToWorkspace = false; - } - } - } else { - sourceLocation = newSourceLocation; - } - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION, - oldSourceLocation, sourceLocation)); - } - - /** - * <!-- begin-user-doc --> - * - * @return true if file is relative to workspace <!-- end-user-doc --> - * @generated - */ - public boolean isRelativeToWorkspace() { - return relativeToWorkspace; - } - - /** - * <!-- begin-user-doc --> To override workspace-relative recognition - * behaviour, be sure to call this method with a false value BEFORE calling - * setLocation(String). - * - * @param newRelativeToWorkspace - * <!-- end-user-doc --> - * @generated - */ - public void setRelativeToWorkspace(boolean newRelativeToWorkspace) { - boolean oldRelativeToWorkspace = relativeToWorkspace; - relativeToWorkspace = newRelativeToWorkspace; - if (eNotificationRequired()) - eNotify(new ENotificationImpl( - this, - Notification.SET, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE, - oldRelativeToWorkspace, relativeToWorkspace)); - } - - /** - * <!-- begin-user-doc --> - * - * @return the relative destination location <!-- end-user-doc --> - * @generated - */ - public String getRelativeDestLocation() { - return relativeDestLocation; - } - - /** - * <!-- begin-user-doc --> - * - * @param newRelativeDestLocation - * <!-- end-user-doc --> - * @generated - */ - public void setRelativeDestLocation(String newRelativeDestLocation) { - String oldRelativeDestLocation = relativeDestLocation; - relativeDestLocation = newRelativeDestLocation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl( - this, - Notification.SET, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION, - oldRelativeDestLocation, relativeDestLocation)); - } - - /** - * <!-- begin-user-doc --> - * - * @return the JAXRS Library instance <!-- end-user-doc --> - * @generated - */ - public JAXRSLibrary getJAXRSLibrary() { - if (eContainerFeatureID != JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY) - return null; - return (JAXRSLibrary) eContainer(); - } - - /** - * <!-- begin-user-doc --> - * - * @param newJAXRSLibrary - * @param msgs - * @return NotificationChain <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetJAXRSLibrary(JAXRSLibrary newJAXRSLibrary, - NotificationChain msgs) { - msgs = eBasicSetContainer((InternalEObject) newJAXRSLibrary, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY, msgs); - return msgs; - } - - /** - * <!-- begin-user-doc --> - * - * @param newJAXRSLibrary - * <!-- end-user-doc --> - * @generated - */ - public void setJAXRSLibrary(JAXRSLibrary newJAXRSLibrary) { - if (newJAXRSLibrary != eInternalContainer() - || (eContainerFeatureID != JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY && newJAXRSLibrary != null)) { - if (EcoreUtil.isAncestor(this, newJAXRSLibrary)) - throw new IllegalArgumentException( - "Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newJAXRSLibrary != null) - msgs = ((InternalEObject) newJAXRSLibrary) - .eInverseAdd( - this, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES, - JAXRSLibrary.class, msgs); - msgs = basicSetJAXRSLibrary(newJAXRSLibrary, msgs); - if (msgs != null) - msgs.dispatch(); - } else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY, - newJAXRSLibrary, newJAXRSLibrary)); - } - - /** - * <!-- begin-user-doc --> - * - * @return the path <!-- end-user-doc --> - * @generated NOT - */ - public String getPath() { - String path = null; - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - int iPos = resolvedSourceLocation.lastIndexOf('/'); - if (iPos < 0) { - iPos = resolvedSourceLocation.lastIndexOf('\\'); - } - if (iPos < 1) { - path = ""; //$NON-NLS-1$ - } else { - path = resolvedSourceLocation.substring(0, iPos); - } - } - return path; - } - - /** - * <!-- begin-user-doc --> - * - * @return the name <!-- end-user-doc --> - * @generated NOT - */ - public String getName() { - String name = null; - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - int iPos = resolvedSourceLocation.lastIndexOf('/'); - if (iPos < 0) { - iPos = resolvedSourceLocation.lastIndexOf('\\'); - } - if (iPos < 0 || iPos == resolvedSourceLocation.length() - 1) { - name = resolvedSourceLocation; - } else { - name = resolvedSourceLocation.substring(iPos + 1); - } - } - return name; - } - - /** - * <!-- begin-user-doc --> - * - * @return true if the archive file exists in the bundle <!-- end-user-doc - * --> - * @generated NOT - */ - public boolean exists() { - boolean exists = false; - if (getJAXRSLibrary() instanceof PluginProvidedJAXRSLibrary && isRelativeToWorkspace()) { - Bundle bundle = getBundle(); - if (bundle != null) { - exists = bundle.getEntry(sourceLocation) != null; - } - } else { - String resolvedSourceLocation = getResolvedSourceLocation(); - if (resolvedSourceLocation != null) { - exists = new File(resolvedSourceLocation).exists(); - } - } - return exists; - } - - /** - * <!-- begin-user-doc --> - * - * @param object - * @return true if equal <!-- end-user-doc --> - * @generated NOT - */ - public boolean equals(Object object) { - boolean equal = false; - if (object instanceof ArchiveFile) { - String resolvedSourceLocation = getResolvedSourceLocation(); - String objResolvedSourceLocation = ((ArchiveFile) object) - .getResolvedSourceLocation(); - if (resolvedSourceLocation == null - && objResolvedSourceLocation == null) { - equal = true; - } else if (resolvedSourceLocation != null) { - equal = resolvedSourceLocation - .equals(objResolvedSourceLocation); - } - } - return equal; - } - - /** - * <!-- begin-user-doc --> - * - * @return a the resolved source location hash or 0 if it is null <!-- - * end-user-doc --> - * @generated NOT - */ - public int hashCode() { - return getResolvedSourceLocation() != null ? getResolvedSourceLocation() - .hashCode() - : 0; - } - - /** - * <!-- begin-user-doc --> - * - * @param baseDestLocation - * @return true if the copy is successful <!-- end-user-doc --> - * @generated NOT - */ - public boolean copyTo(String baseDestLocation) { - boolean copied = false; - InputStream in = null; - OutputStream out = null; - IPath outPath = new Path(baseDestLocation); - if (relativeDestLocation != null) { - outPath = outPath.append(relativeDestLocation); - } - outPath = outPath.append(getName()); - try { - if (!outPath.toFile().exists()) { - out = new FileOutputStream(outPath.toOSString()); - } else { - return copied; - } - if (getJAXRSLibrary() instanceof PluginProvidedJAXRSLibrary) { - Bundle bundle = getBundle(); - URL inURL = bundle.getEntry(sourceLocation); - if (inURL != null) { - in = inURL.openStream(); - } else { - JAXRSCorePlugin - .log( - IStatus.ERROR, - NLS - .bind( - Messages.ArchiveFileImpl_CannotLocatePluginRelativeFile, - sourceLocation)); - return copied; - } - } else { - in = new FileInputStream(getResolvedSourceLocation()); - } - byte[] buf = new byte[1024]; - int len = 0; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - copied = true; - } catch (FileNotFoundException fnfe) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.ArchiveFileImpl_CannotCopyFile, fnfe); - } catch (IOException ioe) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.ArchiveFileImpl_CannotCopyFile, ioe); - } finally { - try { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); - } - } catch (IOException ioe) { - JAXRSCorePlugin.log(IStatus.WARNING, - Messages.ArchiveFileImpl_CannotCloseFile, ioe); - } - } - return copied; - } - - /** - * <!-- begin-user-doc --> - * - * @return the resolved source location <!-- end-user-doc --> - * @generated NOT - */ - public String getResolvedSourceLocation() { - String resolvedSourceLocation = null; - /** - * The implementation to support PluginProvidedJAXRSLibrary assume the - * following. 1. Plugin provided JAXRS Library needs to be distributed - * as an expanded folder. 2. JARs for plugin provided JAXRS Library need - * to reside inside the folder mentioned in item 1 above. 3. Each JAR - * needs to specify a relative path for the folder mentioned in item 1 - * above. - * - * Fix for bug 144954. - */ - if (getJAXRSLibrary() instanceof PluginProvidedJAXRSLibrary) { - PluginProvidedJAXRSLibrary library = (PluginProvidedJAXRSLibrary) getJAXRSLibrary(); - Bundle bundle = getBundle(); - if (bundle != null && isRelativeToWorkspace()) { - // resolvedSourceLocation = appendSeparator(bundleLocation) + - // sourceLocation; - try { - Path srcPath = new Path(sourceLocation); - URL fileURL = FileLocator.find(bundle, srcPath, null); - if (fileURL != null) { - URL url = FileLocator.resolve(fileURL); - resolvedSourceLocation = url.getPath(); - } else - resolvedSourceLocation = sourceLocation; - } catch (IOException e) { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - if (isRelativeToWorkspace()) { - IWorkspaceRoot workspaceRoot = getWorkspaceRoot(); - if (workspaceRoot != null) { - String workspaceLocation = workspaceRoot.getLocation() - .toOSString(); - if (workspaceLocation != null) { - resolvedSourceLocation = appendSeparator(workspaceLocation) - + sourceLocation; - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } else { - resolvedSourceLocation = sourceLocation; - } - } - return resolvedSourceLocation; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, NotificationChain msgs) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - return basicSetJAXRSLibrary((JAXRSLibrary) otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, NotificationChain msgs) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - return basicSetJAXRSLibrary(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * - * @param msgs - * @return NotificationChain <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainerFeature( - NotificationChain msgs) { - switch (eContainerFeatureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - return eInternalContainer().eInverseRemove(this, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES, - JAXRSLibrary.class, msgs); - } - return super.eBasicRemoveFromContainerFeature(msgs); - } - - /** - * <!-- begin-user-doc --> - * - * @param featureID - * @param resolve - * @param coreType - * @return <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - return isRelativeToWorkspace() ? Boolean.TRUE : Boolean.FALSE; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - return getSourceLocation(); - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - return getRelativeDestLocation(); - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - return getJAXRSLibrary(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * - * @param featureID - * @param newValue - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - setRelativeToWorkspace(((Boolean) newValue).booleanValue()); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - setSourceLocation((String) newValue); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - setRelativeDestLocation((String) newValue); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - setJAXRSLibrary((JAXRSLibrary) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - setRelativeToWorkspace(RELATIVE_TO_WORKSPACE_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - setSourceLocation(SOURCE_LOCATION_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - setRelativeDestLocation(RELATIVE_DEST_LOCATION_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - setJAXRSLibrary((JAXRSLibrary) null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_TO_WORKSPACE: - return relativeToWorkspace != RELATIVE_TO_WORKSPACE_EDEFAULT; - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__SOURCE_LOCATION: - return SOURCE_LOCATION_EDEFAULT == null ? sourceLocation != null - : !SOURCE_LOCATION_EDEFAULT.equals(sourceLocation); - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__RELATIVE_DEST_LOCATION: - return RELATIVE_DEST_LOCATION_EDEFAULT == null ? relativeDestLocation != null - : !RELATIVE_DEST_LOCATION_EDEFAULT - .equals(relativeDestLocation); - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY: - return getJAXRSLibrary() != null; - } - return super.eIsSet(featureID); - } - - /** - * Gets the Bundle instance by parent PluginProvidedJAXRSLibrary instance's - * pluginID property, if and only if the parent JAXRSLibrary instance IS a - * PluginProvidedJAXRSLibrary, else returns null. - * - * @return Bundle instance, or null if not located or applicable - */ - protected Bundle getBundle() { - Bundle bundle = null; - if (getJAXRSLibrary() instanceof PluginProvidedJAXRSLibrary) { - String pluginID = ((PluginProvidedJAXRSLibrary) getJAXRSLibrary()) - .getPluginID(); - if (pluginID != null) { - bundle = Platform.getBundle(pluginID); - } - } - return bundle; - } - - /** - * Gets the IWorkspaceRoot instance. - * - * @return IWorkspaceRoot instance - */ - protected IWorkspaceRoot getWorkspaceRoot() { - IWorkspaceRoot workspaceRoot = null; - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace != null) { - workspaceRoot = workspace.getRoot(); - } - return workspaceRoot; - } - - /** - * @param path - * @return the the path string with invalid path separators correctly fixed - */ - protected String appendSeparator(String path) { - String newPath = null; - if (!path.endsWith("\\") && !path.endsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ - newPath = path + System.getProperty("file.separator"); //$NON-NLS-1$ - } else { - newPath = path; - } - return newPath; - } - - /** - * <!-- begin-user-doc --> - * - * @return the string representation of this archive file <!-- end-user-doc - * --> - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (RelativeToWorkspace: "); - result.append(relativeToWorkspace); - result.append(", SourceLocation: "); - result.append(sourceLocation); - result.append(", RelativeDestLocation: "); - result.append(relativeDestLocation); - result.append(')'); - return result.toString(); - } - -} // ArchiveFileImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryImpl.java deleted file mode 100644 index c173f403c..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryImpl.java +++ /dev/null @@ -1,506 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import java.util.Collection; -import java.util.Iterator; - -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.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.adapter.MaintainDefaultImplementationAdapter; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>JAXRS Library</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#getID - * <em>ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#getName - * <em>Name</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#getJAXRSVersion - * <em>JAXRS Version</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#isDeployed - * <em>Deployed</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#isImplementation - * <em>Implementation</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryImpl#getArchiveFiles - * <em>Archive Files</em>}</li> - * </ul> - * </p> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryImpl extends EObjectImpl implements JAXRSLibrary { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The default value of the '{@link #getID() <em>ID</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getID() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = ""; - - /** - * The cached value of the '{@link #getID() <em>ID</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getID() - * @generated - * @ordered - */ - protected String id = ID_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; - - /** - * The default value of the '{@link #isDeployed() <em>Deployed</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #isDeployed() - * @generated - * @ordered - */ - protected static final boolean DEPLOYED_EDEFAULT = true; - - /** - * The cached value of the '{@link #isDeployed() <em>Deployed</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #isDeployed() - * @generated - * @ordered - */ - protected boolean deployed = DEPLOYED_EDEFAULT; - - /** - * The default value of the '{@link #isImplementation() - * <em>Implementation</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #isImplementation() - * @generated - * @ordered - */ - protected static final boolean IMPLEMENTATION_EDEFAULT = false; - - /** - * The cached value of the '{@link #getArchiveFiles() - * <em>Archive Files</em>}' containment reference list. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getArchiveFiles() - * @generated - * @ordered - */ - protected EList<EObject> archiveFiles; - - /** - * <!-- begin-user-doc --> Enhanced to not only create an instance but also - * to set an initial ID (which can be reset later) and to add the - * MaintainDefaultImplementationAdapter to the list of adapters. <!-- - * end-user-doc --> - * - * @generated NOT - */ - protected JAXRSLibraryImpl() { - super(); - // //set initial ID; will be overwritten from XML if already persisted - // setID(String.valueOf(System.currentTimeMillis())); - // add adapter to maintain a default implementation - eAdapters().add(MaintainDefaultImplementationAdapter.getInstance()); - } - - /** - * <!-- begin-user-doc --> - * - * @return the static eClass <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JAXRSLibraryRegistryPackage.Literals.JAXRS_LIBRARY; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getID() { - return getName(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the name <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * - * @param newName - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__NAME, oldName, - name)); - } - - /** - * <!-- begin-user-doc --> - * - * @return true if library is to be deployed <!-- end-user-doc --> - * @generated - */ - public boolean isDeployed() { - return deployed; - } - - /** - * <!-- begin-user-doc --> - * - * @param newDeployed - * <!-- end-user-doc --> - * @generated - */ - public void setDeployed(boolean newDeployed) { - boolean oldDeployed = deployed; - deployed = newDeployed; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__DEPLOYED, - oldDeployed, deployed)); - } - - /** - * <!-- begin-user-doc --> - * - * @return the list of archive files <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getArchiveFiles() { - if (archiveFiles == null) { - archiveFiles = new EObjectContainmentWithInverseEList<EObject>( - ArchiveFile.class, this, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES, - JAXRSLibraryRegistryPackage.ARCHIVE_FILE__JAXRS_LIBRARY); - } - return archiveFiles; - } - - /** - * <!-- begin-user-doc --> - * - * @param fullPath - * @return the true if the fullPath contains an archive file <!-- - * end-user-doc --> - * @generated NOT - */ - public boolean containsArchiveFile(String fullPath) { - boolean contains = false; - if (fullPath != null) { - Iterator<EObject> itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile archiveFile = (ArchiveFile) itArchiveFiles.next(); - if (fullPath.equals(archiveFile.getResolvedSourceLocation())) { - contains = true; - break; - } - } - } - return contains; - } - - /** - * <!-- begin-user-doc --> - * - * @return the working copy <!-- end-user-doc --> - * @generated NOT - */ - @SuppressWarnings("unchecked") - public JAXRSLibrary getWorkingCopy() { - JAXRSLibrary workingCopyLib = JAXRSLibraryRegistryFactory.eINSTANCE - .createJAXRSLibrary(); - // workingCopyLib.setID(getID()); - workingCopyLib.setName(getName()); - workingCopyLib.setDeployed(isDeployed()); - Iterator<EObject> itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile) itArchiveFiles.next(); - ArchiveFile destArchiveFile = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile - .isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile - .getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile - .getRelativeDestLocation()); - workingCopyLib.getArchiveFiles().add(destArchiveFile); - } - return workingCopyLib; - } - - /** - * <!-- begin-user-doc --> - * - * @param otherLibrary - * <!-- end-user-doc --> - * @generated NOT - */ - @SuppressWarnings("unchecked") - public void updateValues(JAXRSLibrary otherLibrary) { - if (otherLibrary != null) { - // setID(otherLibrary.getID()); - setName(otherLibrary.getName()); - setDeployed(otherLibrary.isDeployed()); - Iterator<EObject> itArchiveFiles = otherLibrary.getArchiveFiles() - .iterator(); - getArchiveFiles().clear(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile) itArchiveFiles - .next(); - ArchiveFile destArchiveFile = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile - .isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile - .getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile - .getRelativeDestLocation()); - getArchiveFiles().add(destArchiveFile); - } - } - } - - /** - * <!-- begin-user-doc --> - * - * @param baseDestLocation - * @return the base destination location <!-- end-user-doc --> - * @generated NOT - */ - public boolean copyTo(String baseDestLocation) { - boolean allCopied = true; - Iterator<EObject> itFiles = getArchiveFiles().iterator(); - while (itFiles.hasNext()) { - ArchiveFile archiveFile = (ArchiveFile) itFiles.next(); - boolean copied = archiveFile.copyTo(baseDestLocation); - allCopied = allCopied && copied; - } - return allCopied; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getLabel() { - return getName(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, - int featureID, NotificationChain msgs) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - return ((InternalEList<EObject>) getArchiveFiles()).basicAdd( - otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, NotificationChain msgs) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - return ((InternalEList<EObject>) getArchiveFiles()).basicRemove( - otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ID: - return getID(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__NAME: - return getName(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__DEPLOYED: - return isDeployed() ? Boolean.TRUE : Boolean.FALSE; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - return getArchiveFiles(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @SuppressWarnings("unchecked") - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__NAME: - setName((String) newValue); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__DEPLOYED: - setDeployed(((Boolean) newValue).booleanValue()); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - getArchiveFiles().clear(); - getArchiveFiles().addAll((Collection) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__NAME: - setName(NAME_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__DEPLOYED: - setDeployed(DEPLOYED_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - getArchiveFiles().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT - .equals(name); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__DEPLOYED: - return deployed != DEPLOYED_EDEFAULT; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY__ARCHIVE_FILES: - return archiveFiles != null && !archiveFiles.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * - * @return the string representation <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (ID: "); - result.append(id); - result.append(", Name: "); - result.append(name); - result.append(", Deployed: "); - result.append(deployed); - result.append(')'); - return result.toString(); - } - -} // JAXRSLibraryImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryFactoryImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryFactoryImpl.java deleted file mode 100644 index ab97fa75e..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryFactoryImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import org.eclipse.emf.ecore.EClass; -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.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- - * end-user-doc --> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryFactoryImpl extends EFactoryImpl implements - JAXRSLibraryRegistryFactory { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * Creates the default factory implementation. <!-- begin-user-doc --> - * - * @return the initialized factory <!-- end-user-doc --> - * @generated - */ - public static JAXRSLibraryRegistryFactory init() { - try { - JAXRSLibraryRegistryFactory theJAXRSLibraryRegistryFactory = (JAXRSLibraryRegistryFactory) EPackage.Registry.INSTANCE - .getEFactory("http://www.eclipse.org/webtools/jaxrs/schema/JAXRSLibraryregistry.xsd"); - if (theJAXRSLibraryRegistryFactory != null) { - return theJAXRSLibraryRegistryFactory; - } - } catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new JAXRSLibraryRegistryFactoryImpl(); - } - - /** - * Creates an instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JAXRSLibraryRegistryFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * - * @param eClass - * @return the static eclass <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY: - return createJAXRSLibraryRegistry(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY: - return createJAXRSLibrary(); - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY: - return createPluginProvidedJAXRSLibrary(); - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE: - return createArchiveFile(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() - + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * - * @return the JAXRS Library registry <!-- end-user-doc --> - * @generated - */ - public JAXRSLibraryRegistry createJAXRSLibraryRegistry() { - JAXRSLibraryRegistryImpl JAXRSLibraryRegistry = new JAXRSLibraryRegistryImpl(); - return JAXRSLibraryRegistry; - } - - /** - * <!-- begin-user-doc --> - * - * @return the JAXRS Library <!-- end-user-doc --> - * @generated - */ - public JAXRSLibrary createJAXRSLibrary() { - JAXRSLibraryImpl JAXRSLibrary = new JAXRSLibraryImpl(); - return JAXRSLibrary; - } - - /** - * <!-- begin-user-doc --> - * - * @return the archive file <!-- end-user-doc --> - * @generated - */ - public ArchiveFile createArchiveFile() { - ArchiveFileImpl archiveFile = new ArchiveFileImpl(); - return archiveFile; - } - - /** - * <!-- begin-user-doc --> - * - * @return the plugin provided JAXRS Library <!-- end-user-doc --> - * @generated - */ - public PluginProvidedJAXRSLibrary createPluginProvidedJAXRSLibrary() { - PluginProvidedJAXRSLibraryImpl pluginProvidedJAXRSLibrary = new PluginProvidedJAXRSLibraryImpl(); - return pluginProvidedJAXRSLibrary; - } - - /** - * <!-- begin-user-doc --> - * - * @return the registry package <!-- end-user-doc --> - * @generated - */ - public JAXRSLibraryRegistryPackage getJAXRSLibraryRegistryPackage() { - return (JAXRSLibraryRegistryPackage) getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the package <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static JAXRSLibraryRegistryPackage getPackage() { - return JAXRSLibraryRegistryPackage.eINSTANCE; - } - -} // JAXRSLibraryRegistryFactoryImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryImpl.java deleted file mode 100644 index 147276a27..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryImpl.java +++ /dev/null @@ -1,446 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.BasicEList; -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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>JAXRS Library Registry</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl#getDefaultImplementationID - * <em>Default Implementation ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl#getJAXRSLibraries - * <em>JAXRS Libraries</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.JAXRSLibraryRegistryImpl#getPluginProvidedJAXRSLibraries - * <em>Plugin Provided JAXRS Libraries</em>}</li> - * </ul> - * </p> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryImpl extends EObjectImpl implements - JAXRSLibraryRegistry { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The default value of the '{@link #getDefaultImplementationID() - * <em>Default Implementation ID</em>}' attribute. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getDefaultImplementationID() - * @generated - * @ordered - */ - protected static final String DEFAULT_IMPLEMENTATION_ID_EDEFAULT = ""; - - /** - * The cached value of the '{@link #getDefaultImplementationID() - * <em>Default Implementation ID</em>}' attribute. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getDefaultImplementationID() - * @generated - * @ordered - */ - protected String defaultImplementationID = DEFAULT_IMPLEMENTATION_ID_EDEFAULT; - - /** - * The cached value of the '{@link #getJAXRSLibraries() - * <em>JAXRS Libraries</em>}' containment reference list. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getJAXRSLibraries() - * @generated - * @ordered - */ - protected EList<JAXRSLibrary> jaxrsLibraries; - - /** - * The cached value of the '{@link #getPluginProvidedJAXRSLibraries() - * <em>Plugin Provided JAXRS Libraries</em>}' containment reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getPluginProvidedJAXRSLibraries() - * @generated - * @ordered - */ - protected EList<JAXRSLibrary> pluginProvidedJAXRSLibraries; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected JAXRSLibraryRegistryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the static eClass <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JAXRSLibraryRegistryPackage.Literals.JAXRS_LIBRARY_REGISTRY; - } - - /** - * <!-- begin-user-doc --> - * - * @return the default implementation id <!-- end-user-doc --> - * @generated - */ - public String getDefaultImplementationID() { - return defaultImplementationID; - } - - /** - * <!-- begin-user-doc --> - * - * @param newDefaultImplementationID - * <!-- end-user-doc --> - * @generated - */ - public void setDefaultImplementationID(String newDefaultImplementationID) { - String oldDefaultImplementationID = defaultImplementationID; - defaultImplementationID = newDefaultImplementationID; - if (eNotificationRequired()) - eNotify(new ENotificationImpl( - this, - Notification.SET, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID, - oldDefaultImplementationID, defaultImplementationID)); - } - - /** - * <!-- begin-user-doc --> - * - * @return the list of jaxrs libraries <!-- end-user-doc --> - * @generated - */ - public EList<JAXRSLibrary> getJAXRSLibraries() { - if (jaxrsLibraries == null) { - jaxrsLibraries = new EObjectContainmentEList<JAXRSLibrary>( - JAXRSLibrary.class, - this, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES); - } - return jaxrsLibraries; - } - - /** - * <!-- begin-user-doc --> - * - * @return the list of plugin provided JAXRS libraries <!-- end-user-doc --> - * @generated - */ - public EList<JAXRSLibrary> getPluginProvidedJAXRSLibraries() { - if (pluginProvidedJAXRSLibraries == null) { - pluginProvidedJAXRSLibraries = new EObjectContainmentEList<JAXRSLibrary>( - PluginProvidedJAXRSLibrary.class, - this, - JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES); - } - return pluginProvidedJAXRSLibraries; - } - - /** - * <!-- begin-user-doc --> - * - * @return the default implemention JAXRS Library <!-- end-user-doc --> - * @generated NOT - */ - public JAXRSLibrary getDefaultImplementation() { - return getJAXRSLibraryByID(getDefaultImplementationID()); - } - - /** - * <!-- begin-user-doc --> - * - * @param implementation - * <!-- end-user-doc --> - * @generated NOT - */ - public void setDefaultImplementation(JAXRSLibrary implementation) { - if (implementation != null) { - setDefaultImplementationID(implementation.getID()); - } else { - setDefaultImplementationID(null); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, - int featureID, NotificationChain msgs) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES: - return ((InternalEList<JAXRSLibrary>) getJAXRSLibraries()) - .basicRemove(otherEnd, msgs); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES: - return ((InternalEList<JAXRSLibrary>) getPluginProvidedJAXRSLibraries()) - .basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - return getDefaultImplementationID(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES: - return getJAXRSLibraries(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES: - return getPluginProvidedJAXRSLibraries(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @SuppressWarnings("unchecked") - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - setDefaultImplementationID((String) newValue); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES: - getJAXRSLibraries().clear(); - getJAXRSLibraries().addAll((Collection) newValue); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES: - getPluginProvidedJAXRSLibraries().clear(); - getPluginProvidedJAXRSLibraries().addAll((Collection) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - setDefaultImplementationID(DEFAULT_IMPLEMENTATION_ID_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES: - getJAXRSLibraries().clear(); - return; - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES: - getPluginProvidedJAXRSLibraries().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID: - return DEFAULT_IMPLEMENTATION_ID_EDEFAULT == null ? defaultImplementationID != null - : !DEFAULT_IMPLEMENTATION_ID_EDEFAULT - .equals(defaultImplementationID); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES: - return jaxrsLibraries != null && !jaxrsLibraries.isEmpty(); - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES: - return pluginProvidedJAXRSLibraries != null - && !pluginProvidedJAXRSLibraries.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * - * @param ID - * @return the JAXRS Library of ID or null if none <!-- end-user-doc --> - * @generated NOT - */ - public JAXRSLibrary getJAXRSLibraryByID(String ID) { - JAXRSLibrary library = null; - if (ID != null) { - Iterator<JAXRSLibrary> itLibs = getAllJAXRSLibraries().iterator(); - while (itLibs.hasNext()) { - JAXRSLibrary curLib = itLibs.next(); - if (ID.equals(curLib.getID())) { - library = curLib; - break; - } - } - } - return library; - } - - /** - * <!-- begin-user-doc --> - * - * @param name - * @return the list of libraries named 'name' <!-- end-user-doc --> - * @generated NOT - */ - public EList<JAXRSLibrary> getJAXRSLibrariesByName(String name) { - EList<JAXRSLibrary> libraries = new BasicEList<JAXRSLibrary>(); - if (name != null) { - Iterator<JAXRSLibrary> itLibs = getAllJAXRSLibraries().iterator(); - while (itLibs.hasNext()) { - JAXRSLibrary curLib = itLibs.next(); - if (name.equals(curLib.getName())) { - libraries.add(curLib); - } - } - } - return libraries; - } - - /** - * <!-- begin-user-doc --> This is a convenience method to return an EList - * of JAXRSLibrary instances that are marked as JAXRS implementations; while - * all instances are valid references, the returned EList should not be used - * for additions and/or removals of instances (use the EList returned by - * getJAXRSLibraries()). - * - * @return the list of implemention jaxrs libraries <!-- end-user-doc --> - * @generated NOT - */ - public EList<JAXRSLibrary> getImplJAXRSLibraries() { - EList<JAXRSLibrary> implementations = new BasicEList<JAXRSLibrary>(); - Iterator<JAXRSLibrary> itLibs = getAllJAXRSLibraries().iterator(); - while (itLibs.hasNext()) { - JAXRSLibrary lib = itLibs.next(); - implementations.add(lib); - } - return implementations; - } - - /** - * <!-- begin-user-doc --> This is a convenience method to return an EList - * of JAXRSLibrary instances and PluginProvidedJAXRSLibrary instances; while - * all instances are valid references, the returned EList should not be used - * for additions and/or removals of instances (use the EList returned by - * getJAXRSLibraries()). - * - * @return all JAXRS libraries <!-- end-user-doc --> - * @generated NOT - */ - public EList<JAXRSLibrary> getAllJAXRSLibraries() { - EList<JAXRSLibrary> allLibs = new BasicEList<JAXRSLibrary>(); - allLibs.addAll(getJAXRSLibraries()); - allLibs.addAll(getPluginProvidedJAXRSLibraries()); - return allLibs; - } - - /** - * <!-- begin-user-doc --> - * - * @param library - * @return true if library is successfully added <!-- end-user-doc --> - * @generated NOT - */ - public boolean addJAXRSLibrary(JAXRSLibrary library) { - boolean added = false; - if (library instanceof PluginProvidedJAXRSLibrary) { - added = getPluginProvidedJAXRSLibraries().add(library); - } else { - added = getJAXRSLibraries().add(library); - } - return added; - } - - /** - * <!-- begin-user-doc --> - * - * @param library - * @return true if library is successfully removed <!-- end-user-doc --> - * @generated NOT - */ - public boolean removeJAXRSLibrary(JAXRSLibrary library) { - boolean removed = false; - if (library instanceof PluginProvidedJAXRSLibrary) { - removed = getPluginProvidedJAXRSLibraries().remove(library); - } else { - removed = getJAXRSLibraries().remove(library); - } - return removed; - } - - /** - * <!-- begin-user-doc --> - * - * @return the string representation <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (DefaultImplementationID: "); - result.append(defaultImplementationID); - result.append(')'); - return result.toString(); - } - -} // JAXRSLibraryRegistryImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryPackageImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryPackageImpl.java deleted file mode 100644 index 01292a2e5..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/JAXRSLibraryRegistryPackageImpl.java +++ /dev/null @@ -1,563 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- - * end-user-doc --> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryPackageImpl extends EPackageImpl implements - JAXRSLibraryRegistryPackage { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass JAXRSLibraryRegistryEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass JAXRSLibraryEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass archiveFileEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass pluginProvidedJAXRSLibraryEClass = 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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage#eNS_URI - * @see #init() - * @generated - */ - private JAXRSLibraryRegistryPackageImpl() { - super(eNS_URI, JAXRSLibraryRegistryFactory.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 --> - * - * @return the JAXRS Library registry package <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static JAXRSLibraryRegistryPackage init() { - if (isInited) - return (JAXRSLibraryRegistryPackage) EPackage.Registry.INSTANCE - .getEPackage(JAXRSLibraryRegistryPackage.eNS_URI); - - // Obtain or create and register package - JAXRSLibraryRegistryPackageImpl theJAXRSLibraryRegistryPackage = (JAXRSLibraryRegistryPackageImpl) (EPackage.Registry.INSTANCE - .getEPackage(eNS_URI) instanceof JAXRSLibraryRegistryPackageImpl ? EPackage.Registry.INSTANCE - .getEPackage(eNS_URI) - : new JAXRSLibraryRegistryPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theJAXRSLibraryRegistryPackage.createPackageContents(); - - // Initialize created meta-data - theJAXRSLibraryRegistryPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theJAXRSLibraryRegistryPackage.freeze(); - - return theJAXRSLibraryRegistryPackage; - } - - /** - * <!-- begin-user-doc --> - * - * @return the eclass <!-- end-user-doc --> - * @generated - */ - public EClass getJAXRSLibraryRegistry() { - return JAXRSLibraryRegistryEClass; - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getJAXRSLibraryRegistry_DefaultImplementationID() { - return (EAttribute) JAXRSLibraryRegistryEClass.getEStructuralFeatures() - .get(0); - } - - /** - * <!-- begin-user-doc --> - * - * @return the ereference <!-- end-user-doc --> - * @generated - */ - public EReference getJAXRSLibraryRegistry_JAXRSLibraries() { - return (EReference) JAXRSLibraryRegistryEClass.getEStructuralFeatures() - .get(1); - } - - /** - * <!-- begin-user-doc --> - * - * @return the ereference <!-- end-user-doc --> - * @generated - */ - public EReference getJAXRSLibraryRegistry_PluginProvidedJAXRSLibraries() { - return (EReference) JAXRSLibraryRegistryEClass.getEStructuralFeatures() - .get(2); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eclass <!-- end-user-doc --> - * @generated - */ - public EClass getJAXRSLibrary() { - return JAXRSLibraryEClass; - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getJAXRSLibrary_ID() { - return (EAttribute) JAXRSLibraryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getJAXRSLibrary_Name() { - return (EAttribute) JAXRSLibraryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getJAXRSLibrary_Deployed() { - return (EAttribute) JAXRSLibraryEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * - * @return the ereference <!-- end-user-doc --> - * @generated - */ - public EReference getJAXRSLibrary_ArchiveFiles() { - return (EReference) JAXRSLibraryEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eclass <!-- end-user-doc --> - * @generated - */ - public EClass getArchiveFile() { - return archiveFileEClass; - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_SourceLocation() { - return (EAttribute) archiveFileEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_RelativeToWorkspace() { - return (EAttribute) archiveFileEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getArchiveFile_RelativeDestLocation() { - return (EAttribute) archiveFileEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * - * @return the ereference <!-- end-user-doc --> - * @generated - */ - public EReference getArchiveFile_JAXRSLibrary() { - return (EReference) archiveFileEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * - * @return the eclass <!-- end-user-doc --> - * @generated - */ - public EClass getPluginProvidedJAXRSLibrary() { - return pluginProvidedJAXRSLibraryEClass; - } - - /** - * <!-- begin-user-doc --> - * - * @return the eattribute <!-- end-user-doc --> - * @generated - */ - public EAttribute getPluginProvidedJAXRSLibrary_PluginID() { - return (EAttribute) pluginProvidedJAXRSLibraryEClass - .getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getPluginProvidedJAXRSLibrary_Label() { - return (EAttribute) pluginProvidedJAXRSLibraryEClass - .getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * - * @return the JAXRS Library registry factory <!-- end-user-doc --> - * @generated - */ - public JAXRSLibraryRegistryFactory getJAXRSLibraryRegistryFactory() { - return (JAXRSLibraryRegistryFactory) 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 - JAXRSLibraryRegistryEClass = createEClass(JAXRS_LIBRARY_REGISTRY); - createEAttribute(JAXRSLibraryRegistryEClass, - JAXRS_LIBRARY_REGISTRY__DEFAULT_IMPLEMENTATION_ID); - createEReference(JAXRSLibraryRegistryEClass, - JAXRS_LIBRARY_REGISTRY__JAXRS_LIBRARIES); - createEReference(JAXRSLibraryRegistryEClass, - JAXRS_LIBRARY_REGISTRY__PLUGIN_PROVIDED_JAXRS_LIBRARIES); - - JAXRSLibraryEClass = createEClass(JAXRS_LIBRARY); - createEAttribute(JAXRSLibraryEClass, JAXRS_LIBRARY__ID); - createEAttribute(JAXRSLibraryEClass, JAXRS_LIBRARY__NAME); - createEAttribute(JAXRSLibraryEClass, JAXRS_LIBRARY__DEPLOYED); - createEReference(JAXRSLibraryEClass, JAXRS_LIBRARY__ARCHIVE_FILES); - - pluginProvidedJAXRSLibraryEClass = createEClass(PLUGIN_PROVIDED_JAXRS_LIBRARY); - createEAttribute(pluginProvidedJAXRSLibraryEClass, - PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID); - createEAttribute(pluginProvidedJAXRSLibraryEClass, - PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL); - - archiveFileEClass = createEClass(ARCHIVE_FILE); - createEAttribute(archiveFileEClass, ARCHIVE_FILE__RELATIVE_TO_WORKSPACE); - createEAttribute(archiveFileEClass, ARCHIVE_FILE__SOURCE_LOCATION); - createEAttribute(archiveFileEClass, - ARCHIVE_FILE__RELATIVE_DEST_LOCATION); - createEReference(archiveFileEClass, ARCHIVE_FILE__JAXRS_LIBRARY); - - } - - /** - * <!-- 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); - - // Add supertypes to classes - pluginProvidedJAXRSLibraryEClass.getESuperTypes().add( - this.getJAXRSLibrary()); - - // Initialize classes and features; add operations and parameters - initEClass(JAXRSLibraryRegistryEClass, JAXRSLibraryRegistry.class, - "JAXRSLibraryRegistry", !IS_ABSTRACT, !IS_INTERFACE, - IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJAXRSLibraryRegistry_DefaultImplementationID(), - ecorePackage.getEString(), "DefaultImplementationID", "", 0, 1, - JAXRSLibraryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEReference(getJAXRSLibraryRegistry_JAXRSLibraries(), this - .getJAXRSLibrary(), null, "JAXRSLibraries", null, 0, -1, - JAXRSLibraryRegistry.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, - !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJAXRSLibraryRegistry_PluginProvidedJAXRSLibraries(), - this.getPluginProvidedJAXRSLibrary(), null, - "PluginProvidedJAXRSLibraries", null, 0, -1, - JAXRSLibraryRegistry.class, IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, - !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - EOperation op = addEOperation(JAXRSLibraryRegistryEClass, this - .getJAXRSLibrary(), "getJAXRSLibraryByID", 1, 1); - addEParameter(op, ecorePackage.getEString(), "ID", 1, 1); - - op = addEOperation(JAXRSLibraryRegistryEClass, - ecorePackage.getEEList(), "getJAXRSLibrariesByName", 1, 1); - addEParameter(op, ecorePackage.getEString(), "name", 1, 1); - - addEOperation(JAXRSLibraryRegistryEClass, ecorePackage.getEEList(), - "getImplJAXRSLibraries", 1, 1); - - addEOperation(JAXRSLibraryRegistryEClass, ecorePackage.getEEList(), - "getNonImplJAXRSLibraries", 1, 1); - - addEOperation(JAXRSLibraryRegistryEClass, ecorePackage.getEEList(), - "getAllJAXRSLibraries", 1, 1); - - op = addEOperation(JAXRSLibraryRegistryEClass, ecorePackage - .getEBoolean(), "addJAXRSLibrary", 1, 1); - addEParameter(op, this.getJAXRSLibrary(), "library", 1, 1); - - op = addEOperation(JAXRSLibraryRegistryEClass, ecorePackage - .getEBoolean(), "removeJAXRSLibrary", 1, 1); - addEParameter(op, this.getJAXRSLibrary(), "library", 1, 1); - - addEOperation(JAXRSLibraryRegistryEClass, this.getJAXRSLibrary(), - "getDefaultImplementation", 1, 1); - - op = addEOperation(JAXRSLibraryRegistryEClass, null, - "setDefaultImplementation"); - addEParameter(op, this.getJAXRSLibrary(), "implementation", 1, 1); - - initEClass(JAXRSLibraryEClass, JAXRSLibrary.class, "JAXRSLibrary", - !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJAXRSLibrary_ID(), ecorePackage.getEString(), "ID", - "", 0, 1, JAXRSLibrary.class, IS_TRANSIENT, !IS_VOLATILE, - !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, - IS_ORDERED); - initEAttribute(getJAXRSLibrary_Name(), ecorePackage.getEString(), - "Name", null, 1, 1, JAXRSLibrary.class, !IS_TRANSIENT, - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEAttribute(getJAXRSLibrary_Deployed(), ecorePackage.getEBoolean(), - "Deployed", "true", 1, 1, JAXRSLibrary.class, !IS_TRANSIENT, - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, - !IS_DERIVED, IS_ORDERED); - initEReference(getJAXRSLibrary_ArchiveFiles(), this.getArchiveFile(), - this.getArchiveFile_JAXRSLibrary(), "ArchiveFiles", null, 0, - -1, JAXRSLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, - !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - op = addEOperation(JAXRSLibraryEClass, ecorePackage.getEBoolean(), - "containsArchiveFile", 1, 1); - addEParameter(op, ecorePackage.getEString(), "fullPath", 1, 1); - - addEOperation(JAXRSLibraryEClass, this.getJAXRSLibrary(), - "getWorkingCopy", 1, 1); - - op = addEOperation(JAXRSLibraryEClass, null, "updateValues"); - addEParameter(op, this.getJAXRSLibrary(), "otherLibrary", 1, 1); - - op = addEOperation(JAXRSLibraryEClass, ecorePackage.getEBoolean(), - "copyTo", 1, 1); - addEParameter(op, ecorePackage.getEString(), "baseDestLocation", 1, 1); - - addEOperation(JAXRSLibraryEClass, ecorePackage.getEString(), - "getLabel", 1, 1); - - initEClass(pluginProvidedJAXRSLibraryEClass, - PluginProvidedJAXRSLibrary.class, "PluginProvidedJAXRSLibrary", - !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getPluginProvidedJAXRSLibrary_PluginID(), ecorePackage - .getEString(), "pluginID", null, 1, 1, - PluginProvidedJAXRSLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - initEAttribute(getPluginProvidedJAXRSLibrary_Label(), ecorePackage - .getEString(), "Label", null, 1, 1, - PluginProvidedJAXRSLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, - IS_ORDERED); - - initEClass(archiveFileEClass, ArchiveFile.class, "ArchiveFile", - !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getArchiveFile_RelativeToWorkspace(), ecorePackage - .getEBoolean(), "RelativeToWorkspace", "true", 1, 1, - ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getArchiveFile_SourceLocation(), ecorePackage - .getEString(), "SourceLocation", null, 1, 1, ArchiveFile.class, - !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, - !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getArchiveFile_RelativeDestLocation(), ecorePackage - .getEString(), "RelativeDestLocation", null, 1, 1, - ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, - !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getArchiveFile_JAXRSLibrary(), this.getJAXRSLibrary(), - this.getJAXRSLibrary_ArchiveFiles(), "JAXRSLibrary", null, 1, - 1, ArchiveFile.class, !IS_TRANSIENT, !IS_VOLATILE, - IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, - !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), "getName", - 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), "getPath", - 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), "exists", - 1, 1); - - op = addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), - "equals", 1, 1); - addEParameter(op, ecorePackage.getEJavaObject(), "object", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEInt(), "hashCode", 1, - 1); - - op = addEOperation(archiveFileEClass, ecorePackage.getEBoolean(), - "copyTo", 1, 1); - addEParameter(op, ecorePackage.getEString(), "baseDestLocation", 1, 1); - - addEOperation(archiveFileEClass, ecorePackage.getEString(), - "getResolvedSourceLocation", 1, 1); - - // Create resource - createResource(eNS_URI); - } - -} // JAXRSLibraryRegistryPackageImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/PluginProvidedJAXRSLibraryImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/PluginProvidedJAXRSLibraryImpl.java deleted file mode 100644 index 2df2138e5..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/impl/PluginProvidedJAXRSLibraryImpl.java +++ /dev/null @@ -1,299 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl; - -import java.util.Iterator; - -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.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Plugin Provided JAXRS Library</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl#getPluginID - * <em>Plugin ID</em>}</li> - * <li> - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.impl.PluginProvidedJAXRSLibraryImpl#getLabel - * <em>Label</em>}</li> - * </ul> - * </p> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class PluginProvidedJAXRSLibraryImpl extends JAXRSLibraryImpl implements - PluginProvidedJAXRSLibrary { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The default value of the '{@link #getPluginID() <em>Plugin ID</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getPluginID() - * @generated - * @ordered - */ - protected static final String PLUGIN_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPluginID() <em>Plugin ID</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getPluginID() - * @generated - * @ordered - */ - protected String pluginID = PLUGIN_ID_EDEFAULT; - - /** - * The default value of the '{@link #getLabel() <em>Label</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabel() - * @generated - * @ordered - */ - protected static final String LABEL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getLabel() - * @generated - * @ordered - */ - protected String label = LABEL_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected PluginProvidedJAXRSLibraryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the static eclass <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JAXRSLibraryRegistryPackage.Literals.PLUGIN_PROVIDED_JAXRS_LIBRARY; - } - - /** - * <!-- begin-user-doc --> - * - * @return the plugin id <!-- end-user-doc --> - * @generated - */ - public String getPluginID() { - return pluginID; - } - - /** - * <!-- begin-user-doc --> - * - * @param newPluginID - * <!-- end-user-doc --> - * @generated - */ - public void setPluginID(String newPluginID) { - String oldPluginID = pluginID; - pluginID = newPluginID; - if (eNotificationRequired()) - eNotify(new ENotificationImpl( - this, - Notification.SET, - JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID, - oldPluginID, pluginID)); - } - - /** - * <!-- begin-user-doc --> - * - * @return translatable label <!-- end-user-doc --> - * @generated NOT - */ - public String getLabel() { - if (label == null) - return super.getLabel(); - return label; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setLabel(String newLabel) { - String oldLabel = label; - label = newLabel; - if (eNotificationRequired()) - eNotify(new ENotificationImpl( - this, - Notification.SET, - JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL, - oldLabel, label)); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID: - return getPluginID(); - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL: - return getLabel(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID: - setPluginID((String) newValue); - return; - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL: - setLabel((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID: - setPluginID(PLUGIN_ID_EDEFAULT); - return; - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL: - setLabel(LABEL_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__PLUGIN_ID: - return PLUGIN_ID_EDEFAULT == null ? pluginID != null - : !PLUGIN_ID_EDEFAULT.equals(pluginID); - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY__LABEL: - return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT - .equals(label); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated NOT - */ - public String getID() { - return getPluginID() + ID_SEPARATOR + getName(); - } - - /** - * <!-- begin-user-doc --> - * - * @return the working copy <!-- end-user-doc --> - * @generated NOT - */ - @SuppressWarnings("unchecked") - public JAXRSLibrary getWorkingCopy() { - PluginProvidedJAXRSLibrary workingCopyLib = JAXRSLibraryRegistryFactory.eINSTANCE - .createPluginProvidedJAXRSLibrary(); - workingCopyLib.setName(getName()); - if (label != null) - workingCopyLib.setLabel(getLabel()); - workingCopyLib.setDeployed(isDeployed()); - workingCopyLib.setPluginID(getPluginID()); - Iterator itArchiveFiles = getArchiveFiles().iterator(); - while (itArchiveFiles.hasNext()) { - ArchiveFile srcArchiveFile = (ArchiveFile) itArchiveFiles.next(); - ArchiveFile destArchiveFile = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - destArchiveFile.setRelativeToWorkspace(srcArchiveFile - .isRelativeToWorkspace()); - destArchiveFile.setSourceLocation(srcArchiveFile - .getSourceLocation()); - destArchiveFile.setRelativeDestLocation(srcArchiveFile - .getRelativeDestLocation()); - workingCopyLib.getArchiveFiles().add(destArchiveFile); - } - return workingCopyLib; - } - - /** - * <!-- begin-user-doc --> - * - * @return the string representation <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) - return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (pluginID: "); - result.append(pluginID); - result.append(", Label: "); - result.append(label); - result.append(')'); - return result.toString(); - } - -} // PluginProvidedJAXRSLibraryImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryAdapterFactory.java deleted file mode 100644 index 602edb65f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryAdapterFactory.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.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.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- 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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static JAXRSLibraryRegistryPackage modelPackage; - - /** - * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JAXRSLibraryRegistryAdapterFactory() { - if (modelPackage == null) { - modelPackage = JAXRSLibraryRegistryPackage.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. - * - * @param object - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject) object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected JAXRSLibraryRegistrySwitch modelSwitch = new JAXRSLibraryRegistrySwitch() { - public Object caseJAXRSLibraryRegistry(JAXRSLibraryRegistry object) { - return createJAXRSLibraryRegistryAdapter(); - } - - public Object caseJAXRSLibrary(JAXRSLibrary object) { - return createJAXRSLibraryAdapter(); - } - - public Object casePluginProvidedJAXRSLibrary( - PluginProvidedJAXRSLibrary object) { - return createPluginProvidedJAXRSLibraryAdapter(); - } - - public Object caseArchiveFile(ArchiveFile object) { - return createArchiveFileAdapter(); - } - - public Object 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 - */ - public Adapter createAdapter(Notifier target) { - return (Adapter) modelSwitch.doSwitch((EObject) target); - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry - * <em>JAXRS Library Registry</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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry - * @generated - */ - public Adapter createJAXRSLibraryRegistryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary - * <em>JAXRS Library</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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary - * @generated - */ - public Adapter createJAXRSLibraryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile - * <em>Archive File</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.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile - * @generated - */ - public Adapter createArchiveFileAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary - * <em>Plugin Provided JAXRS Library</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.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary - * @generated - */ - public Adapter createPluginProvidedJAXRSLibraryAdapter() { - 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; - } - -} // JAXRSLibraryRegistryAdapterFactory diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceFactoryImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceFactoryImpl.java deleted file mode 100644 index 667290f69..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceFactoryImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -/** - * <!-- begin-user-doc --> The <b>Resource Factory</b> associated with the - * package. <!-- end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util.JAXRSLibraryRegistryResourceImpl - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryResourceFactoryImpl extends - ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * Creates an instance of the resource factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JAXRSLibraryRegistryResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. <!-- begin-user-doc --> - * - * @param uri - * @return the Resource <!-- end-user-doc --> - * @generated - */ - public Resource createResource(URI uri) { - Resource result = new JAXRSLibraryRegistryResourceImpl(uri); - return result; - } - -} // JAXRSLibraryRegistryResourceFactoryImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceImpl.java deleted file mode 100644 index e4eed6789..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryResourceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util.JAXRSLibraryRegistryResourceFactoryImpl - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryResourceImpl extends XMLResourceImpl { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * Creates an instance of the resource. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param uri - * the URI of the new resource. - * @generated - */ - public JAXRSLibraryRegistryResourceImpl(URI uri) { - super(uri); - } - -} // JAXRSLibraryRegistryResourceImpl diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistrySwitch.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistrySwitch.java deleted file mode 100644 index 1806e7dd4..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistrySwitch.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; - -/** - * <!-- 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.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistrySwitch { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static JAXRSLibraryRegistryPackage modelPackage; - - /** - * Creates an instance of the switch. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public JAXRSLibraryRegistrySwitch() { - if (modelPackage == null) { - modelPackage = JAXRSLibraryRegistryPackage.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 --> - * - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - public Object 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 --> - * - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - @SuppressWarnings("unchecked") - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch( - (EClass) 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 --> - * - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY_REGISTRY: { - JAXRSLibraryRegistry JAXRSLibraryRegistry = (JAXRSLibraryRegistry) theEObject; - Object result = caseJAXRSLibraryRegistry(JAXRSLibraryRegistry); - if (result == null) - result = defaultCase(theEObject); - return result; - } - case JAXRSLibraryRegistryPackage.JAXRS_LIBRARY: { - JAXRSLibrary JAXRSLibrary = (JAXRSLibrary) theEObject; - Object result = caseJAXRSLibrary(JAXRSLibrary); - if (result == null) - result = defaultCase(theEObject); - return result; - } - case JAXRSLibraryRegistryPackage.PLUGIN_PROVIDED_JAXRS_LIBRARY: { - PluginProvidedJAXRSLibrary pluginProvidedJAXRSLibrary = (PluginProvidedJAXRSLibrary) theEObject; - Object result = casePluginProvidedJAXRSLibrary(pluginProvidedJAXRSLibrary); - if (result == null) - result = caseJAXRSLibrary(pluginProvidedJAXRSLibrary); - if (result == null) - result = defaultCase(theEObject); - return result; - } - case JAXRSLibraryRegistryPackage.ARCHIVE_FILE: { - ArchiveFile archiveFile = (ArchiveFile) theEObject; - Object result = caseArchiveFile(archiveFile); - if (result == null) - result = defaultCase(theEObject); - return result; - } - default: - return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of ' - * <em>JAXRS Library Registry</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 interpretting the object as an instance of ' - * <em>JAXRS Library Registry</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJAXRSLibraryRegistry(JAXRSLibraryRegistry object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of ' - * <em>JAXRS Library</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 interpretting the object as an instance of ' - * <em>JAXRS Library</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJAXRSLibrary(JAXRSLibrary object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of ' - * <em>Archive File</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 interpretting the object as an instance of ' - * <em>Archive File</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseArchiveFile(ArchiveFile object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of ' - * <em>Plugin Provided JAXRS Library</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 interpretting the object as an instance of ' - * <em>Plugin Provided JAXRS Library</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object casePluginProvidedJAXRSLibrary( - PluginProvidedJAXRSLibrary object) { - return null; - } - - /** - * Returns the result of interpretting 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 interpretting the object as an instance of ' - * <em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} // JAXRSLibraryRegistrySwitch diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryXMLProcessor.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryXMLProcessor.java deleted file mode 100644 index 17e6da99f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrslibraryregistry/util/JAXRSLibraryRegistryXMLProcessor.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryregistry.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryRegistryXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - - /** - * Public constructor to instantiate the helper. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public JAXRSLibraryRegistryXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - JAXRSLibraryRegistryPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the - * JAXRSLibraryRegistryResourceFactoryImpl factory. <!-- begin-user-doc --> - * - * @return Map of registrations <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, - new JAXRSLibraryRegistryResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, - new JAXRSLibraryRegistryResourceFactoryImpl()); - } - return registrations; - } - -} // JAXRSLibraryRegistryXMLProcessor diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/JAXRSSharedLibConfiguratorDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/JAXRSSharedLibConfiguratorDelegate.java deleted file mode 100644 index c2003454f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/JAXRSSharedLibConfiguratorDelegate.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20101123 330916 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS - facet install should consider Web project associated with multiple EARs - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; - -public abstract class JAXRSSharedLibConfiguratorDelegate { - - /** - * Constructs an instance. - */ - public JAXRSSharedLibConfiguratorDelegate() { - super(); - } - /** - * @deprecated - Use org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.JAXRSSharedLibConfiguratorDelegate.installSharedLibs(IProject, IProject, IProgressMonitor, List<String>) - */ - protected abstract void installSharedLibs(IProject webProject, IProject earProject, IProgressMonitor monitor, String JAXRSLibraryID); - /** - * @param project to uninstall shared libraries from - */ - protected abstract void unInstallSharedLibs(IProject webProject); - /** - * @param project to check if shared libraries are supported - * @param JAXRSLibraryID the ID of the JAX-RS implementation library being used - * @return true if shared library support is available - */ - protected abstract boolean sharedLibSupported(IProject webProject, IProject earProject, boolean addToEAR, String JAXRSLibraryID); - /** - * @param webProject to install shared libraries to - * @param earProject to install shared libraries to - * @param monitor to monitor progress - * @param JAXRSLibraryID the ID of the library being used by the project ( - */ - protected abstract void installSharedLibs(IProject webProject, IProject earProject, IProgressMonitor monitor, List<String> libraryNames); - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfigurator.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfigurator.java deleted file mode 100644 index 09c445f58..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfigurator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -public interface SharedLibraryConfigurator { - String getName(); - void setName(String value); - void installSharedLibs(IProject webProject, IProject earProject, IProgressMonitor monitor, List<String> libraryNames) throws CoreException; - void installSharedLibs(IProject webProject, IProject earProject, IProgressMonitor monitor, String JAXRSLibraryID) throws CoreException; - void unInstallSharedLibs(IProject webProject); - boolean getIsSharedLibSupported(IProject webProject, IProject earProject, boolean addToEAR, String JAXRSLibraryID); - void setRuntimeID(String value); - String getRuntimeID(); - boolean getSelected(); - void setSelected(boolean value); - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorCreationHelper.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorCreationHelper.java deleted file mode 100644 index 253e5b630..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorCreationHelper.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create JAXRS Shared Library Configurators from the - * <code>org.eclipse.jst.ws.jaxrs.core.jaxrsSharedLibrarySupport</code> - * extension-point. <br> - * - */ -public final class SharedLibraryConfiguratorCreationHelper { - private SharedLibraryConfiguratorImpl newSharedLibConfigurator; - private IConfigurationElement config_element; - /** - * Key of the 'name' attribute of the extension point. - */ - public final static String NAME = "name"; //$NON-NLS-1$ - - - /** - * Key of the 'runtimeID' attribute of the extension point. - */ - public final static String SERVERRUNTIME = "runtimeID"; //$NON-NLS-1$ - /** - * Key of the 'jaxrsSharedLibraryConfiguratorDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "jaxrsSharedLibraryConfiguratorDelegate"; //$NON-NLS-1$ - /** - * Key of the 'isSelected' attribute of the extension point. - */ - public final static String SELECTED = "isSelected"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param SharedLibraryConfigurator - * IConfigurationElement instance - */ - public SharedLibraryConfiguratorCreationHelper( - IConfigurationElement SharedLibraryConfigurator) { - this.config_element = SharedLibraryConfigurator; - } - - - /** - * Creates a new SharedLibraryConfigurator from the JAXRSSharedLibrarySupport extension - * point. - * - * @return SharedLibraryConfigurator instance. - */ - public SharedLibraryConfigurator create() { - try { - newSharedLibConfigurator = new SharedLibraryConfiguratorImpl(config_element); - newSharedLibConfigurator.setName(config_element.getAttribute(NAME)); - newSharedLibConfigurator.setRuntimeID(config_element.getAttribute(SERVERRUNTIME)); - newSharedLibConfigurator.setSelected(Boolean.parseBoolean(config_element - .getAttribute(SELECTED))); - return newSharedLibConfigurator; - } catch (Exception e) { - JAXRSCorePlugin - .log( - e, - NLS - .bind( - Messages.PluginProvidedSharedLibraryConfiguratorCreationHelper_ErrorCreating, - newSharedLibConfigurator.getName())); - } - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorImpl.java deleted file mode 100644 index b820ef166..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IProgressMonitor; - -public class SharedLibraryConfiguratorImpl implements SharedLibraryConfigurator { - private IConfigurationElement config_element; - /** - * Key of the 'jaxrsSharedLibraryConfiguratorDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "jaxrsSharedLibraryConfiguratorDelegate"; //$NON-NLS-1$ - boolean selected = false; - String name; - String runtimeID; - public SharedLibraryConfiguratorImpl(IConfigurationElement config_element) { - this.config_element = config_element; - } - public boolean getIsSharedLibSupported(IProject webProject, IProject earProject, boolean addToEAR, String JAXRSLibraryID) { - JAXRSSharedLibConfiguratorDelegate sharedLibConfigurator = null; - - try { - sharedLibConfigurator = (JAXRSSharedLibConfiguratorDelegate) config_element - .createExecutableExtension(DELEGATE); - } catch (CoreException e) { - //not much we want to do here, just return not suported - } - if (sharedLibConfigurator != null) { - return sharedLibConfigurator.sharedLibSupported(webProject, earProject, addToEAR, JAXRSLibraryID); - } - return false; - } - - public String getName() { - return name; - } - - public String getRuntimeID() { - return runtimeID; - } - - public void installSharedLibs(IProject webProject, IProject earProject, IProgressMonitor monitor, String JAXRSLibraryID) throws CoreException { - JAXRSSharedLibConfiguratorDelegate sharedLibConfigurator = null; - - sharedLibConfigurator = (JAXRSSharedLibConfiguratorDelegate) config_element - .createExecutableExtension(DELEGATE); - if (sharedLibConfigurator != null) { - sharedLibConfigurator.installSharedLibs(webProject, earProject, monitor, JAXRSLibraryID); - } - } - - - public void setName(String value) { - this.name = value; - - } - - public void unInstallSharedLibs(IProject webProject) { - JAXRSSharedLibConfiguratorDelegate sharedLibConfigurator = null; - - try { - sharedLibConfigurator = (JAXRSSharedLibConfiguratorDelegate) config_element - .createExecutableExtension(DELEGATE); - } catch (CoreException e) { - //not much we want to do, libraries not uninstalled - } - if (sharedLibConfigurator != null) { - sharedLibConfigurator.unInstallSharedLibs(webProject); - } - } - - public void setRuntimeID(String value) { - this.runtimeID = value; - - } - - public boolean getSelected() { - return this.selected; - } - - public void setSelected(boolean value) { - this.selected = value; - - } - - public void installSharedLibs(IProject webProject, IProject earProject, - IProgressMonitor monitor, List<String> libraryNames) - throws CoreException { - JAXRSSharedLibConfiguratorDelegate sharedLibConfigurator = null; - - sharedLibConfigurator = (JAXRSSharedLibConfiguratorDelegate) config_element - .createExecutableExtension(DELEGATE); - if (sharedLibConfigurator != null) { - sharedLibConfigurator.installSharedLibs(webProject, earProject, monitor, libraryNames); - } - - } - - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorUtil.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorUtil.java deleted file mode 100644 index 095345d8a..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/jaxrssharedlibraryconfig/SharedLibraryConfiguratorUtil.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * A singleton maintains lists of Shared library configurators - * - */ -public class SharedLibraryConfiguratorUtil { - private static SharedLibraryConfiguratorUtil instance = null; - - private static List<SharedLibraryConfigurator> configurators = new Vector<SharedLibraryConfigurator>(); - - private static final String SHAREDLIB_EXT_PT = "jaxrsSharedLibrarySupport"; //$NON-NLS-1$ - - - /** - * Private constructor - */ - private SharedLibraryConfiguratorUtil() { - // nothing to do - } - - public static boolean isSharedLibSelectedByDefault(String targetRuntimeID) { - if (targetRuntimeID == null) - return false; - - SharedLibraryConfiguratorUtil.getInstance(); - java.util.List<SharedLibraryConfigurator> configurators = getConfigurators(); - - Iterator<SharedLibraryConfigurator> sharedLibConfiguratorIterator = configurators - .iterator(); - while (sharedLibConfiguratorIterator.hasNext()) { - SharedLibraryConfigurator thisConfigurator = sharedLibConfiguratorIterator - .next(); - if (targetRuntimeID.equals(thisConfigurator.getRuntimeID())) { - return thisConfigurator.getSelected(); - } - - } - - return false; - } - - public static boolean isSharedLibSupportAvailable(String libraryID, - String targetRuntimeID, IProject webProject, IProject earProject, - boolean addToEAR) { - if (libraryID == null || targetRuntimeID == null - || libraryID.length() == 0 || libraryID.length() == 0) - return false; - - SharedLibraryConfiguratorUtil.getInstance(); - java.util.List<SharedLibraryConfigurator> configurators = getConfigurators(); - - Iterator<SharedLibraryConfigurator> sharedLibConfiguratorIterator = configurators - .iterator(); - while (sharedLibConfiguratorIterator.hasNext()) { - SharedLibraryConfigurator thisConfigurator = sharedLibConfiguratorIterator - .next(); - if (targetRuntimeID.equals(thisConfigurator.getRuntimeID())) { - if (thisConfigurator.getIsSharedLibSupported(webProject, - earProject, addToEAR, libraryID)) { - return true; - } - } - - } - - return false; - } - - /** - * Return the singleton instance of SharedLibraryConfiguratorUtil. - * - * @return SharedLibraryConfiguratorUtil - */ - public synchronized static SharedLibraryConfiguratorUtil getInstance() { - if (instance == null) { - instance = new SharedLibraryConfiguratorUtil(); - instance.loadSharedLibraryConfiguratorExtensions(); - } - return instance; - } - - /** - * Creates jax-rs shared library configurator items from extension points. - */ - private void loadSharedLibraryConfiguratorExtensions() { - try { - IExtensionPoint point = Platform.getExtensionRegistry() - .getExtensionPoint(JAXRSCorePlugin.PLUGIN_ID, SHAREDLIB_EXT_PT); - IExtension[] extensions = point.getExtensions(); - for (int i = 0; i < extensions.length; i++) { - IExtension ext = extensions[i]; - for (int j = 0; j < ext.getConfigurationElements().length; j++) { - SharedLibraryConfiguratorCreationHelper newLibCreator = new SharedLibraryConfiguratorCreationHelper( - ext.getConfigurationElements()[j]); - SharedLibraryConfigurator newconfigurator = newLibCreator.create(); - - if (newconfigurator != null) - configurators.add(newconfigurator); - } - } - } catch (InvalidRegistryObjectException e) { - JAXRSCorePlugin.log(IStatus.ERROR, - Messages.JAXRSSharedLibraryConfigurator_ErrorLoadingFromExtPt, e); - } - } - - public static boolean getAddToEar(IDataModel model) { - return model.getBooleanProperty(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR); - } - public static IProject getEARProject(IDataModel model) { - String projName = model.getStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( - projName); - return project; - } - public static IProject getWebProject(IDataModel model) { - String projName = model.getStringProperty(IJAXRSFacetInstallDataModelProperties.WEBPROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( - projName); - return project; - } - public static List<SharedLibraryConfigurator> getConfigurators() { - return configurators; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/messages.properties b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/messages.properties deleted file mode 100644 index 43b38ab8a..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/messages.properties +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################### -# Copyright (c) 2009, 2010 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# yyyymmdd bug Email and other contact information -# -------- -------- ----------------------------------------------------------- -# 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet -# 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect -# 20100519 313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems -############################################################################### -JAXRSLibraryRegistry_ErrorCreatingURL=Error creating URL for JAX-RS Library Registry -JAXRSLibraryRegistry_ErrorSaving=Error saving JAX-RS Library Registry -JAXRSLibraryRegistry_DEFAULT_IMPL_LABEL=<Default> -JAXRSLibraryConfigModel_Null_Data_Source=Data Source is not provided. -JAXRSLibraryRegistry_ErrorLoadingFromExtPt=Error while loading JAX-RS Libraries from extension points -JAXRSSharedLibraryConfigurator_ErrorLoadingFromExtPt=Error while loading JAX-RS Shared Library Configurators from extension points -JAXRSLibraryProvider_ErrorLoadingFromExtPt=Error while loading JAX-RS Library Providers from extension points -JAXRSLibraryClasspathContainer_IMPL_LIBRARY=[JAX-RS Library] - -JAXRSFacetInstallDataModelProvider_ValidateServletName=Specify a servlet name to use -JAXRSFacetInstallDataModelProvider_ValidateServletClassName=Specify a servlet class name to use -JAXRSLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND=Saved JAX-RS implementation library in {0} is unavailable in JAX-RS Library Registry -JAXRSLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND=Saved JAX-RS component library in {0} is unavailable in JAX-RS Library Registry -JAXRSLibrariesContainerInitializer_missing_library=[missing JAX-RS Library] -JAXRSFacetInstallDataModelProvider_ValidateJAXRSImpl=A JAX-RS implementation library has not been chosen -JAXRSFacetInstallDataModelProvider_DupeJarValidation=Duplicated jar on classpath: {0} -JAXRSFacetInstallDataModelProvider_ClientImplValidationMsg=JAX-RS Implementation library must be specified. - -JAXRSFacetInstallDelegate_InternalErr=Internal Error creating JAX-RS Facet. Missing configuration. -JAXRSFacetInstallDelegate_ConfigErr=''{0}'' : unable to configure web module for JAX-RS -JAXRSFacetInstallDelegate_NonUpdateableWebXML=JAX-RS Facet was not installed on ''{0}''. The web.xml file needs to be updateable. -JAXRSFacetUninstallDelegate_ConfigErr=''{0}'' : unable to de-configure web module for JAX-RS -JAXRSFacetUninstallDelegate_NonUpdateableWebXML=JAX-RS Facet was not un-installed from ''{0}''. The web.xml file needs to be updateable. - -ArchiveFileImpl_CannotCopyFile=Cannot copy file -ArchiveFileImpl_CannotCloseFile=Cannot close file -ArchiveFileImpl_CannotLocatePluginRelativeFile=Cannot locate plugin-relative file "{0}" - -PluginProvidedJAXRSLibraryCreationHelper_ErrorCreating=Unable to create JAX-RS Library: {0} -PluginProvidedSharedLibraryConfiguratorCreationHelper_ErrorCreating=Unable to create JAX-RS Shared Library Configurator: {0} -JAXRSLibraryProviderCreationHelper_ErrorCreating=Unable to create JAX-RS Library Provider: {0} -PluginProvidedJAXRSLibraryCreationHelper_ErrorMultipleDefinition={0} defined multiple times in {1} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSFacetInstallDataModelProperties.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSFacetInstallDataModelProperties.java deleted file mode 100644 index ac572ceab..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSFacetInstallDataModelProperties.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetInstallDataModelProperties; - -/** - * Defines properties used by the JAXRS facet install data model. - * - */ -public interface IJAXRSFacetInstallDataModelProperties extends - IFacetInstallDataModelProperties { - - public static final String ADD_TO_EAR = "IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR"; //$NON-NLS-1$ - - public static final String SHAREDLIBRARY = "IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY"; //$NON-NLS-1$ - - public static final String EARPROJECT_NAME = "IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME"; //$NON-NLS-1$ - - public static final String WEBPROJECT_NAME = "IJAXRSFacetInstallDataModelProperties.WEBPROJECT_NAME"; //$NON-NLS-1$ - - public static final String TARGETRUNTIME = "IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME"; //$NON-NLS-1$ - - public static final String SERVLET_NAME = "IJAXRSFacetInstallDataModelProperties.SERVLET_NAME"; //$NON-NLS-1$ - - public static final String SERVLET_CLASSNAME = "IJAXRSFacetInstallDataModelProperties.SERVLET_CLASSNAME"; //$NON-NLS-1$ - - public static final String SERVLET_URL_PATTERNS = "IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS"; //$NON-NLS-1$ - - public static final String WEBCONTENT_DIR = "IJAXRSFacetInstallDataModelProperties.WEBCONTENT_DIR"; //$NON-NLS-1$ - - public static final String LIBRARY_PROVIDER_DELEGATE = "IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE"; //$NON-NLS-1$ - - public static final String DEPLOY_IMPLEMENTATION = "IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION"; //$NON-NLS-1$ - - public static final String CONFIGURATION_PRESET = "IJAXRSFacetInstallDataModelProperties.CONFIGURATION_PRESET"; //$NON-NLS-1$" - - public static final String SERVER_IRUNTIME = "IJAXRSFacetInstallDataModelProperties.SERVER_IRUNTIME"; //$NON-NLS-1$" - - // Support post-project creation scenario. If WAR is parked in multiple EARs, then we should update all the EARs - public static final String EARPROJECTS = "IJAXRSFacetInstallDataModelProperties.EARPROJECTS"; //$NON-NLS-1$ - - public static final String UPDATEDD = "IJAXRSFacetInstallDataModelProperties.UPDATEDD"; //$NON-NLS-1$ - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSSharedLibraryProviderInstallOperationConfig.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSSharedLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 8a3f797fd..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/IJAXRSSharedLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - - -public interface IJAXRSSharedLibraryProviderInstallOperationConfig { - - public void setSharedLibrary(boolean isSharedLibrary); - - public boolean isSharedLibrary(); - - public void setIsDeploy(boolean isDeploy); - - public boolean isDeploy(); - - public void setModel(IDataModel model); - - public IDataModel getModel(); - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetDefaultVersionProvider.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetDefaultVersionProvider.java deleted file mode 100644 index 1976bc60d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetDefaultVersionProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100302 304405 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet : support JAX-RS 1.1 (JSR 311) - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - - -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.wst.common.project.facet.core.IDefaultVersionProvider; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Provides the default JAX-RS project facet version. - * Currently always returns "1.1" facet version. Eventually should be computed from the project's facet context. - * - */ -public final class JAXRSFacetDefaultVersionProvider implements IDefaultVersionProvider { - - /* (non-Javadoc) - * @see org.eclipse.wst.common.project.facet.core.IDefaultVersionProvider#getDefaultVersion() - */ - public IProjectFacetVersion getDefaultVersion() { - return ProjectFacetsManager.getProjectFacet(IJAXRSCoreConstants.JAXRS_FACET_ID).getVersion(IJAXRSCoreConstants.FACET_VERSION_1_1); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetException.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetException.java deleted file mode 100644 index 9dc7bc7c8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetException.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; - -/** - * Exception for use during JAXRS Facet installation/un-installation - * - */ -public class JAXRSFacetException extends CoreException { - - private static final long serialVersionUID = 1L; - - /** - * Constructor - * - * @param msg - */ - public JAXRSFacetException(String msg) { - super(new Status(IStatus.ERROR, JAXRSCorePlugin.PLUGIN_ID, msg)); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDataModelProvider.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDataModelProvider.java deleted file mode 100644 index dd33774fe..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDataModelProvider.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100519 313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems - * 20110817 355026 kchong@ca.ibm.com - Keith Chong, [JAXRS] JAXRSFacetInstallDataModelProvider dispose method does not remove all listeners it adds - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryRegistryUtil; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Provides a data model used by the JAXRS facet install. - */ -public class JAXRSFacetInstallDataModelProvider extends - FacetInstallDataModelProvider implements - IJAXRSFacetInstallDataModelProperties { - - private String errorMessage; - private LibraryInstallDelegate libraryInstallDelegate = null; - private IPropertyChangeListener propertyChangeListener = null; - - @SuppressWarnings("unchecked") - public Set<String> getPropertyNames() { - Set<String> names = super.getPropertyNames(); - names.add(SHAREDLIBRARY); - names.add(EARPROJECT_NAME); - names.add(WEBPROJECT_NAME); - names.add(ADD_TO_EAR); - names.add(TARGETRUNTIME); - names.add(SERVLET_NAME); - names.add(SERVLET_CLASSNAME); - names.add(SERVLET_URL_PATTERNS); - names.add(WEBCONTENT_DIR); - names.add(LIBRARY_PROVIDER_DELEGATE); - names.add(DEPLOY_IMPLEMENTATION); - names.add(CONFIGURATION_PRESET); - names.add(SERVER_IRUNTIME); - names.add(EARPROJECTS); - names.add(UPDATEDD); - - return names; - } - - public Object getDefaultProperty(String propertyName) { - - if (propertyName.equals(EARPROJECT_NAME)) { - return null; - } else if (propertyName.equals(WEBPROJECT_NAME)) { - return null; - } else if (propertyName.equals(ADD_TO_EAR)) { - return Boolean.FALSE; - } else if (propertyName.equals(TARGETRUNTIME)) { - return null; - } else if (propertyName.equals(SERVLET_NAME)) { - return JAXRSUtils.JAXRS_DEFAULT_SERVLET_NAME; - } else if (propertyName.equals(SERVLET_CLASSNAME)) { - return JAXRSUtils.JAXRS_SERVLET_CLASS; - } else if (propertyName.equals(SERVLET_URL_PATTERNS)) { - return new String[] { JAXRSUtils.JAXRS_DEFAULT_URL_MAPPING }; - } else if (propertyName.equals(FACET_ID)) { - return IJAXRSCoreConstants.JAXRS_FACET_ID; - } else if (propertyName.equals(WEBCONTENT_DIR)) { - return "WebContent"; //$NON-NLS-1$ - } else if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) { - return this.libraryInstallDelegate; - } else if (propertyName.equals(DEPLOY_IMPLEMENTATION)) { - return Boolean.TRUE; - } else if (propertyName.equals(CONFIGURATION_PRESET)) { - return null; - } else if (propertyName.equals(SERVER_IRUNTIME)) { - return null; - } else if (propertyName.equals(EARPROJECTS)) { - return null; - } else if (propertyName.equals(SHAREDLIBRARY)) { - return false; - } else if (propertyName.equals(DEPLOY_IMPLEMENTATION)) { - return true; - } else if (propertyName.equals(UPDATEDD)) { - return true; - } - return super.getDefaultProperty(propertyName); - } - - public IStatus validate(String name) { - errorMessage = null; - if (name.equals(LIBRARY_PROVIDER_DELEGATE)) { - return ((LibraryInstallDelegate) getProperty(LIBRARY_PROVIDER_DELEGATE)) - .validate(); - } else if (name.equals(SERVLET_NAME) || name.equals(SERVLET_CLASSNAME) || name.equals(UPDATEDD)) { - if (this.getBooleanProperty(IJAXRSFacetInstallDataModelProperties.UPDATEDD)) - return validateServletInfo(getStringProperty(SERVLET_NAME), getStringProperty(SERVLET_CLASSNAME)); - else - return super.validate(name); - } - return super.validate(name); - } - - public boolean propertySet(final String propertyName, - final Object propertyValue) { - if (propertyName.equals(FACETED_PROJECT_WORKING_COPY) - || propertyName.equals(FACET_VERSION)) { - initLibraryInstallDelegate(); - - if (this.libraryInstallDelegate != null - && propertyName.equals(FACET_VERSION)) { - final IProjectFacetVersion fv = (IProjectFacetVersion) getProperty(FACET_VERSION); - this.libraryInstallDelegate.setProjectFacetVersion(fv); - } - } - - return super.propertySet(propertyName, propertyValue); - } - @SuppressWarnings("restriction") - private void initLibraryInstallDelegate() - { - final IFacetedProjectWorkingCopy fpjwc = (IFacetedProjectWorkingCopy) getProperty( FACETED_PROJECT_WORKING_COPY ); - final IProjectFacetVersion fv = (IProjectFacetVersion) getProperty( FACET_VERSION ); - - if( this.libraryInstallDelegate == null && fpjwc != null && fv != null ) - { - this.libraryInstallDelegate = new LibraryInstallDelegate( fpjwc, fv ); - this.propertyChangeListener = new IPropertyChangeListener() - { - public void propertyChanged( final String property, - final Object oldValue, - final Object newValue ) - { - final IDataModel dm = getDataModel(); - - if( dm != null ) - { - dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG ); - } - } - }; - this.libraryInstallDelegate.addListener(propertyChangeListener); - } - } - - @SuppressWarnings("restriction") - public void dispose() - { - if (this.libraryInstallDelegate != null) - { - this.libraryInstallDelegate.removeListener(propertyChangeListener); - } - super.dispose(); // empty - } - - private IStatus createErrorStatus(String msg) { - return new Status(IStatus.ERROR, JAXRSCorePlugin.PLUGIN_ID, msg); - } - - private IStatus validateServletInfo(String servletName, String servletClassName) { - if (servletName == null || servletName.trim().length() == 0) { - errorMessage = Messages.JAXRSFacetInstallDataModelProvider_ValidateServletName; - return createErrorStatus(errorMessage); - } - if (servletClassName == null || servletClassName.trim().length() == 0) { - errorMessage = Messages.JAXRSFacetInstallDataModelProvider_ValidateServletClassName; - return createErrorStatus(errorMessage); - } - - return OK_STATUS; - } - - private IProject getProject() { - String projName = (String) getProperty(FACET_PROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( - projName); - return project; - } - - private boolean doesProjectExist() { - IProject project = getProject(); - return (project != null) && project.exists(); - } - - @SuppressWarnings("unchecked") - private IStatus checkForDupeArchiveFiles(Set<String> jars, - JAXRSLibrary aJAXRSLib) { - if (aJAXRSLib == null) - return OK_STATUS; - - for (Iterator it = aJAXRSLib.getArchiveFiles().iterator(); it.hasNext();) { - ArchiveFile jar = (ArchiveFile) it.next(); - if (jars.contains(jar.getResolvedSourceLocation())) { - return createErrorStatus(NLS - .bind( - Messages.JAXRSFacetInstallDataModelProvider_DupeJarValidation, - jar.getResolvedSourceLocation())); - } - jars.add(jar.getResolvedSourceLocation()); - } - return OK_STATUS; - } - - private List<JAXRSLibraryInternalReference> getDefaultJAXRSImplementationLibraries() { - List<JAXRSLibraryInternalReference> list = new ArrayList<JAXRSLibraryInternalReference>(); - if (JAXRSLibraryRegistryUtil.getInstance().getJAXRSLibraryRegistry() != null) { - JAXRSLibrary jaxrsLib = JAXRSLibraryRegistryUtil.getInstance() - .getJAXRSLibraryRegistry().getDefaultImplementation(); - if (jaxrsLib != null) { - JAXRSLibraryInternalReference prjJAXRSLib = new JAXRSLibraryInternalReference( - jaxrsLib, true, true, false); - list.add(prjJAXRSLib); - } - } - return list; - } - - private JAXRSLibraryInternalReference getDefaultImplementationLibrary() { - if (JAXRSLibraryRegistryUtil.getInstance().getJAXRSLibraryRegistry() != null) { - JAXRSLibrary jaxrsLib = JAXRSLibraryRegistryUtil.getInstance() - .getJAXRSLibraryRegistry().getDefaultImplementation(); - return new JAXRSLibraryInternalReference(jaxrsLib, true, true, false); - } - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDelegate.java deleted file mode 100644 index 132f95c6b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDelegate.java +++ /dev/null @@ -1,356 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100310 304405 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet : support JAX-RS 1.1 - * 20100319 306595 ericdp@ca.ibm.com - Eric D. Peters, several install scenarios fail for both user library & non-user library - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100428 310905 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet fails to install due to NPE or runtime exception due to duplicate cp entries - * 20101123 330916 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS - facet install should consider Web project associated with multiple EARs - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.Iterator; -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.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.IClasspathAttribute; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil; -import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfigurator; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfiguratorUtil; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * JAXRS Facet Install Delegate for WTP faceted web projects. Deals with 2.3, - * 2.4 and 2.5 web app models. - * - * Uses - * <code>com.eclispe.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDataModelProvider<code> for model - * <li> updates web.xml for: servlet, servlet-mapping and context-param - * <li> adds implementation jars to WEB-INF/lib if user requests - * - * @see org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDataModelProvider - * @since 1.0 - */ -public final class JAXRSFacetInstallDelegate implements IDelegate { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse - * .core.resources.IProject, - * org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, - * java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public void execute(final IProject project, final IProjectFacetVersion fv, - final Object cfg, final IProgressMonitor monitor) - throws CoreException - - { - - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel config = null; - - if (cfg != null) { - config = (IDataModel) cfg; - } else { - throw new JAXRSFacetException( - Messages.JAXRSFacetInstallDelegate_InternalErr); - } - - // Before we do any configuration, verify that web.xml is available - // for update - IModelProvider provider = JAXRSUtils.getModelProvider(project); - if (provider == null) { - throw new JAXRSFacetException(NLS.bind( - Messages.JAXRSFacetInstallDelegate_ConfigErr, project - .getName())); - } else if (!(provider.validateEdit(null, null).isOK())) { - // checks for web.xml file being read-only and allows user to set writeable - if (!(provider.validateEdit(null, null).isOK())) { - throw new JAXRSFacetException( - NLS - .bind( - Messages.JAXRSFacetInstallDelegate_NonUpdateableWebXML, - project.getName())); //$NON-NLS-2$ - } - } - - - if (((LibraryInstallDelegate) config - .getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)) - .getLibraryProviderOperationConfig() instanceof JAXRSUserLibraryProviderInstallOperationConfig - // deploy is chosen - || (config - .getProperty(IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION) != null && Boolean - .parseBoolean((config - .getProperty(IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION) - .toString()))) - // don't include libraries - || (config - .getProperty(IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION) != null - && !Boolean - .parseBoolean((config - .getProperty(IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION) - .toString())) && (config - .getProperty(IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY) == null || (config - .getProperty(IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY) != null && !Boolean - .parseBoolean((config - .getProperty(IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY) - .toString()))))) - - ) { - // either deploy is chosen, or user chosen not include - // libraries, or it is our shared library install delegate which - // handles both deploy & shared library options - ((LibraryInstallDelegate) config - .getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)) - .execute(new NullProgressMonitor()); - } else { - // Create JAXRS libraries by calling Library installer then - // appropriate SharedLibraryConfigurator - ((LibraryInstallDelegate) config - .getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)) - .execute(new NullProgressMonitor()); - if (!disableLibraryConfigSelected((LibraryInstallDelegate) config - .getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE))) - createSharedLibraries(project, fv, monitor, config); - } - - // Update web model if necessary - if (config.getBooleanProperty(IJAXRSFacetInstallDataModelProperties.UPDATEDD)) - createServletAndModifyWebXML(project, config, monitor); - if (monitor != null) { - monitor.worked(1); - } - - } finally { - if (monitor != null) { - monitor.done(); - } - } - } - - private boolean disableLibraryConfigSelected(LibraryInstallDelegate property) { - return property.getLibraryProvider().getId() != null - && property.getLibraryProvider().getId().equals( - IJAXRSCoreConstants.NO_OP_LIBRARY_ID) ? true : false; - } - - private void createSharedLibraries(IProject project, - IProjectFacetVersion fv, IProgressMonitor monitor, IDataModel config) throws CoreException { - - String targetRuntimeID = config - .getStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME); - SharedLibraryConfiguratorUtil - .getInstance(); - java.util.List<SharedLibraryConfigurator> configurators = SharedLibraryConfiguratorUtil.getConfigurators(); - ILibraryProvider libref = ((LibraryInstallDelegate)config.getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).getLibraryProvider(); - Iterator<SharedLibraryConfigurator> sharedLibConfiguratorIterator = configurators - .iterator(); - while (sharedLibConfiguratorIterator.hasNext()) { - SharedLibraryConfigurator thisConfigurator = sharedLibConfiguratorIterator - .next(); - if (targetRuntimeID.equals(thisConfigurator.getRuntimeID())) { - IProject earProject = getEARProject(config); - Boolean addToEar = getAddToEar(config); - List<IProject> earProjects = (List<IProject>)config.getProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECTS); - // Let's check the EARPROJECTS property first. If it's not null, then we are in the post-project creation mode - // and more than one EAR is referenced. - if (earProjects != null) { - // Iterate over all the referenced EAR projects and update them with shared library support - for (IProject ear : earProjects) - { - if (thisConfigurator.getIsSharedLibSupported(project, - ear, addToEar, libref.getId())) { - thisConfigurator.installSharedLibs(project, ear, - monitor, new ArrayList<String>()); - } - } - } else { // ....otherwise, business as usual, only one ear applies. - if (thisConfigurator.getIsSharedLibSupported(project, - earProject, addToEar, libref.getId())) { - thisConfigurator.installSharedLibs(project, earProject, - monitor, new ArrayList<String>()); - break; - } - } - } - - } - } - - /** - * @param path - * @param lib - * @return creates new IClasspathEntry with WTP dependency attribute set, if - * required - */ - private IClasspathEntry getNewCPEntry(final IPath path, - final JAXRSLibraryInternalReference lib) { - - IClasspathEntry entry = null; - if (lib.isCheckedToBeDeployed()) { - IClasspathAttribute depAttrib = JavaCore - .newClasspathAttribute( - IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY, - ClasspathDependencyUtil.getDefaultRuntimePath(true) - .toString()); - entry = JavaCore.newContainerEntry(path, null, - new IClasspathAttribute[] { depAttrib }, true); - } else { - entry = JavaCore.newContainerEntry(path); - } - - return entry; - } - -// /** -// * @param config -// * @return list of URL patterns from the datamodel -// */ -// private List<String> getServletMappings(final IDataModel config) { -// List<String> mappings = new ArrayList<String>(); -// String[] patterns = (String[]) config -// .getProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS); -// for (int i = 0; i < patterns.length; i++) { -// String pattern = patterns[i]; -// mappings.add(pattern); -// } -// -// return mappings; -// } - - /** - * Create servlet and URL mappings and update the webapp - * - * @param project - * @param config - * @param monitor - */ - private void createServletAndModifyWebXML(final IProject project, - final IDataModel config, final IProgressMonitor monitor) { - - IModelProvider provider = JAXRSUtils.getModelProvider(project); - IPath webXMLPath = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ - if (JAXRSJEEUtils.isWebApp25or30(provider.getModelObject())) { - provider.modify(new UpdateWebXMLForJavaEE(project, config), - doesDDFileExist(project, webXMLPath) ? webXMLPath - : IModelProvider.FORCESAVE); - } else {// must be 2.3 or 2.4 - provider.modify(new UpdateWebXMLForJ2EE(project, config), - webXMLPath); - } - - } - - private boolean doesDDFileExist(IProject project, IPath webXMLPath) { - return project.getProjectRelativePath().append(webXMLPath).toFile() - .exists(); - } - - private IProject getEARProject(IDataModel config) { - String projName = config.getStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( - projName); - return project; - } - - private boolean getAddToEar(IDataModel config) { - return config.getBooleanProperty(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR); - } - -// private class UpdateWebXMLForJavaEE implements Runnable { -// private IProject project; -// private IDataModel config; -// -// UpdateWebXMLForJavaEE(final IProject project, final IDataModel config) { -// this.project = project; -// this.config = config; -// } -// -// public void run() { -// WebApp webApp = (WebApp) ModelProviderManager.getModelProvider( -// project).getModelObject(); -// // create or update servlet ref -// Servlet servlet = JAXRSJEEUtils.findJAXRSServlet(webApp);// check to -// // see -// // if already -// -// servlet = JAXRSJEEUtils.createOrUpdateServletRef(webApp, config, -// servlet); -// -// // init mappings -// List<String> listOfMappings = getServletMappings(config); -// JAXRSJEEUtils.setUpURLMappings(webApp, listOfMappings, servlet); -// -// } -// } -// -// private class UpdateWebXMLForJ2EE implements Runnable { -// private IProject project; -// private IDataModel config; -// -// UpdateWebXMLForJ2EE(IProject project, final IDataModel config) { -// this.project = project; -// this.config = config; -// } -// -// public void run() { -// org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) ModelProviderManager -// .getModelProvider(project).getModelObject(); -// // create or update servlet ref -// org.eclipse.jst.j2ee.webapplication.Servlet servlet = JAXRSJ2EEUtils -// .findJAXRSServlet(webApp);// check to see -// // if already -// // present -// -// servlet = JAXRSJ2EEUtils.createOrUpdateServletRef(webApp, config, -// servlet); -// -// // init mappings -// List<String> listOfMappings = getServletMappings(config); -// JAXRSJ2EEUtils.setUpURLMappings(webApp, listOfMappings, servlet); -// -// } -// -// } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallConfig.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallConfig.java deleted file mode 100644 index 0c6649a99..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallConfig.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.jst.common.project.facet.core.libprov.LibraryUninstallDelegate; -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.wst.common.project.facet.core.ActionConfig; -import org.eclipse.wst.common.project.facet.core.IActionConfigFactory; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Configuration for JAX-RS facet uninstall - * - */ -public class JAXRSFacetUninstallConfig - - extends ActionConfig - -{ - private LibraryUninstallDelegate librariesUninstallDelegate = null; - - /** - * @return the library uninstall delegate - */ - public LibraryUninstallDelegate getLibrariesUninstallDelegate() - { - return this.librariesUninstallDelegate; - } - - @Override - public void setFacetedProjectWorkingCopy( final IFacetedProjectWorkingCopy fpjwc ) - { - super.setFacetedProjectWorkingCopy( fpjwc ); - init(); - } - - - private void init() - { - final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy(); - IProjectFacetVersion fv = null; - IFacetedProject fp = fpjwc.getFacetedProject(); - if (fp != null) { - Set<IProjectFacetVersion> facets = fp.getProjectFacets(); - if (facets != null) { - Iterator<IProjectFacetVersion> it = facets.iterator(); - while (it.hasNext()) { - IProjectFacetVersion next = it.next(); - if (next.getProjectFacet().getId().equals(IJAXRSCoreConstants.JAXRS_FACET_ID)) { - fv = next; - break; - } - } - } - - } - if( this.librariesUninstallDelegate == null && fpjwc != null && fv != null) - { - this.librariesUninstallDelegate = new LibraryUninstallDelegate( fpjwc, fv ); - } - } - - /** - * The action configuration factory for the JAX-RS facet uninstall config - * - */ - public static final class Factory - - implements IActionConfigFactory - - { - public Object create() - { - return new JAXRSFacetUninstallConfig(); - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallDelegate.java deleted file mode 100644 index dfa679df3..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetUninstallDelegate.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100319 306594 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet install fails for Web 2.3 & 2.4 - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * JAXRS Facet Un-install Delegate for WTP faceted projects. - * - * <li>removes JAXRS servlet, servlet-mappings and context-params <li>leaves - * JAXRS configuration files on disk <li>removes JAXRS classpath containers - * - */ -public final class JAXRSFacetUninstallDelegate implements IDelegate { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse - * .core.resources.IProject, - * org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, - * java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public void execute(final IProject project, final IProjectFacetVersion fv, - final Object config, final IProgressMonitor monitor) - throws CoreException { - { - - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - // Before we do any de-configuration, verify that web.xml is - // available for update - IModelProvider provider = JAXRSUtils.getModelProvider(project); - if (provider == null) { - throw new JAXRSFacetException(NLS.bind( - Messages.JAXRSFacetUninstallDelegate_ConfigErr, - project.getName())); - } else if (!(provider.validateEdit(null, null).isOK())) { - throw new JAXRSFacetException( - NLS - .bind( - Messages.JAXRSFacetUninstallDelegate_NonUpdateableWebXML, - project.getName())); - } - - // Remove JAXRS Libraries - ( (JAXRSFacetUninstallConfig) config ).getLibrariesUninstallDelegate().execute( null ); - - // remove servlet stuff from web.xml - uninstallJAXRSReferencesFromWebApp(project, monitor); - - if (monitor != null) { - monitor.worked(1); - } - - } finally { - if (monitor != null) { - monitor.done(); - } - } - } - } - - private void uninstallJAXRSReferencesFromWebApp(final IProject project, - final IProgressMonitor monitor) { - - IModelProvider provider = JAXRSUtils.getModelProvider(project); - Object webAppObj = provider.getModelObject(); - if (webAppObj != null) { - IPath ddPath = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ - if (JAXRSJEEUtils.isWebApp25or30(webAppObj)) { - WebApp webApp = (WebApp) webAppObj; - Servlet servlet = JAXRSJEEUtils.findJAXRSServlet(webApp); - if (servlet == null) - return; - - provider.modify(new RemoveJAXRSFromJavaEEWebAppOperation( - project), ddPath); - } else {// 2.3 or 2.4 web app - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) webAppObj; - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JAXRSJ2EEUtils - .findJAXRSServlet(webApp); - if (servlet == null) - return; - - provider - .modify( - new RemoveJAXRSFromJ2EEWebAppOperation(project), - ddPath); - } - } - } - - static class RemoveJAXRSFromJavaEEWebAppOperation implements Runnable { - private IProject _project; - - RemoveJAXRSFromJavaEEWebAppOperation(final IProject project) { - this._project = project; - } - - public void run() { - WebApp webApp = (WebApp) ModelProviderManager.getModelProvider( - _project).getModelObject(); - Servlet servlet = JAXRSJEEUtils.findJAXRSServlet(webApp); - - // remove jax-rs url mappings - JAXRSJEEUtils.removeURLMappings(webApp, servlet); - // remove servlet - removeJAXRSServlet(webApp, servlet); - - } - - private void removeJAXRSServlet(final WebApp webApp, - final Servlet servlet) { - webApp.getServlets().remove(servlet); - } - - } - - static class RemoveJAXRSFromJ2EEWebAppOperation implements Runnable { - private IProject _project; - - RemoveJAXRSFromJ2EEWebAppOperation(final IProject project) { - this._project = project; - } - - public void run() { - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) ModelProviderManager - .getModelProvider(_project).getModelObject(); - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JAXRSJ2EEUtils - .findJAXRSServlet(webApp); - - // remove jax-rs url mappings - JAXRSJ2EEUtils.removeURLMappings(webApp, servlet); - // remove servlet - removeJAXRSServlet(webApp, servlet); - - } - - private void removeJAXRSServlet( - final org.eclipse.jst.j2ee.webapplication.WebApp webApp, - final org.eclipse.jst.j2ee.webapplication.Servlet servlet) { - webApp.getServlets().remove(servlet); - } - - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetVersionChangeDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetVersionChangeDelegate.java deleted file mode 100644 index 1491368d0..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetVersionChangeDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100819 323081 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS - provide means to change facet versions - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * JAXRS Facet Version change Delegate for WTP faceted web projects. - * - * @since 3.2.2 - */ -public final class JAXRSFacetVersionChangeDelegate implements IDelegate { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse - * .core.resources.IProject, - * org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, - * java.lang.Object, org.eclipse.core.runtime.IProgressMonitor) - */ - public void execute(final IProject project, final IProjectFacetVersion fv, - final Object cfg, final IProgressMonitor monitor) - throws CoreException - - { - - try { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - //presently there is no difference between facet versions, nothing to do - } - - } finally { - if (monitor != null) { - monitor.done(); - } - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJ2EEUtils.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJ2EEUtils.java deleted file mode 100644 index c8d3e0237..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJ2EEUtils.java +++ /dev/null @@ -1,403 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100325 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - * 20100408 308565 kchong@ca.ibm.com - Keith Chong, JAX-RS: Servlet name and class not updated - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.common.Description; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.JSPType; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.j2ee.webapplication.ServletType; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * Utility file for Web 2.3 & 2.4 model - * - */ -public class JAXRSJ2EEUtils extends JAXRSUtils { - - /** - * Convenience method for getting writeable WebApp model - * - * @param project - * @return WebArtifactEdit - * @deprecated - must use IModelProviders - */ - public static WebArtifactEdit getWebArtifactEditForWrite( - final IProject project) { - return WebArtifactEdit.getWebArtifactEditForWrite(project); - } - - /** - * Convenience method for getting read-only WebApp model - * - * @param project - * @return WebArtifactEdit - * @deprecated - must use IModelProviders - */ - public static WebArtifactEdit getWebArtifactEditForRead( - final IProject project) { - return WebArtifactEdit.getWebArtifactEditForRead(project); - } - @SuppressWarnings("unchecked") - private static Servlet findJAXRSServletUsingLibraryProviderID(final Object webApp, String selectedLibraryProviderID) { - Iterator<Servlet> it = null; - Servlet toReturn = null; - if (webApp == null) - return null; - else if (webApp instanceof WebApp) - it = ((WebApp) webApp).getServlets().iterator(); -// See Bug 293103 -// else if (webApp instanceof org.eclipse.jst.javaee.web.WebApp) -// it = ((org.eclipse.jst.javaee.web.WebApp) webApp).getServlets() -// .iterator(); - else - return null; - - while (it.hasNext()) { - Servlet servlet = it.next(); - - Iterator <Description> descIter = servlet.getDescriptions().iterator(); - while (descIter.hasNext()) - { - Description desc = descIter.next(); - String value = desc.getValue(); - if (value != null && value.trim().startsWith(JAXRS_SERVLET_IDENTIFIER)) - { - return servlet; - } - } - - if (servlet != null && servlet.getWebType() != null) { - - if (servlet.getWebType().isServletType()) { - if (servlet.getServletName() != null - && (servlet.getServletName().trim().equals( - getSavedservletName()) || servlet - .getServletName().trim().equals( - JAXRS_DEFAULT_SERVLET_NAME))) { - return servlet; - } - - if (((ServletType) servlet.getWebType()).getClassName() != null - && ((ServletType) servlet.getWebType()).getClassName().trim().equals( - getSavedServletClassName(selectedLibraryProviderID))) { - return servlet; - } - - if (((ServletType) servlet.getWebType()).getClassName() != null - && facetKnowsServletClassName(((ServletType) servlet.getWebType()).getClassName().trim())) - return servlet; - if (((ServletType) servlet.getWebType()).getClassName() != null - && ((ServletType) servlet.getWebType()).getClassName().trim().equals(JAXRS_SERVLET_CLASS)) { - if (toReturn == null) - //found a servlet with empty servlet class, return that if find nothing else - toReturn = servlet; - - } - - } else if (servlet.getWebType().isJspType()) { - if (((JSPType) servlet.getWebType()).getJspFile() != null - && ( ((JSPType) servlet.getWebType()).getJspFile() - .trim().equals(JAXRS_SERVLET_CLASS) || ((JSPType) servlet.getWebType()).getJspFile() - .trim().equals(getSavedservletName())) ) { - return servlet; - } - } - } - } - - // if we get to here then we have finished the loop - // without finding the servlet we're looking for - return toReturn; - - } - public static Servlet findJAXRSServlet(final Object webApp, String selectedLibraryProviderID) { - return findJAXRSServletUsingLibraryProviderID(webApp, selectedLibraryProviderID); - } - /** - * @param webApp - * as Object - * @return Servlet - the JAXRS Servlet for the specified WebApp or null if - * not present - */ - @SuppressWarnings("unchecked") - public static Servlet findJAXRSServlet(final Object webApp) { - return findJAXRSServletUsingLibraryProviderID(webApp, null); - } - - /** - * Creates servlet reference in WebApp if not present or updates servlet - * name if found using the passed configuration. - * - * @param webApp - * @param config - * @param servlet - * @return Servlet servlet - if passed servlet was null, will return created - * servlet - */ - @SuppressWarnings("unchecked") - public static Servlet createOrUpdateServletRef(final WebApp webApp, - final IDataModel config, Servlet servlet) { - - String displayName = getDisplayName(config); - String className = getServletClassname(config); - - return createOrUpdateServletRef(webApp, displayName, className, servlet); - } - - public static Servlet createOrUpdateServletRef(final WebApp webApp, - String displayName, String className, Servlet servlet) { - - if (servlet == null) { - // Create the servlet instance and set up the parameters from data - // model - servlet = WebapplicationFactory.eINSTANCE.createServlet(); - servlet.setServletName(displayName); - servlet.setDescription(JAXRS_SERVLET_IDENTIFIER_DESCRIPTION); - - ServletType servletType = WebapplicationFactory.eINSTANCE - .createServletType(); - servletType.setClassName(className); - servlet.setWebType(servletType); - servlet.setLoadOnStartup(Integer.valueOf(1)); - // Add the servlet to the web application model - webApp.getServlets().add(servlet); - } else { - // update - updateServletMappings(webApp, servlet, servlet.getServletName() - .trim(), displayName); - servlet.setServletName(displayName); - ServletType servletType = WebapplicationFactory.eINSTANCE - .createServletType(); - servletType.setClassName(className); - servlet.setWebType(servletType); - servlet.setLoadOnStartup(Integer.valueOf(1)); - Description jaxrsToolsDescription = null; - Description next = null; - List<Description> descriptions = servlet.getDescriptions(); - if (descriptions != null) { - Iterator<Description> it = descriptions.iterator(); - while (it.hasNext()) { - next = it.next(); - if (JAXRS_SERVLET_IDENTIFIER_DESCRIPTION.equals(next - .getValue())) { - jaxrsToolsDescription = next; - break; - } - } - - } - if (jaxrsToolsDescription == null) { - // add the description for our JAX-RS tools - servlet.setDescription(JAXRS_SERVLET_IDENTIFIER_DESCRIPTION); - } - - } - return servlet; - } - - private static void updateServletMappings(final WebApp webApp, - final Servlet servlet, final String servletName, - final String newServletName) { - List<ServletMapping> mappings = findServletMappings(webApp, servlet, - servletName); - for (ServletMapping map : mappings) { - map.setName(newServletName); - } - - } - - @SuppressWarnings("unchecked") - private static List<ServletMapping> findServletMappings( - final WebApp webApp, final Servlet servlet, final String servletName) { - List<ServletMapping> mappings = new ArrayList<ServletMapping>(); - List<ServletMapping> allMappings = webApp.getServletMappings(); - for (int i = allMappings.size() - 1; i >= 0; --i) { - ServletMapping mapping = allMappings.get(i); - if (mapping != null - && mapping.getServlet() != null - && mapping.getServlet().getServletName() != null - && mapping.getServlet().getServletName().trim().equals( - servletName)) - mappings.add(mapping); - } - return mappings; - } - - /** - * @param webApp - * as Object - * @return true if webApp instanceof org.eclipse.jst.javaee.web.WebApp - */ - public static boolean isWebApp25(final Object webApp) { - if (webApp instanceof org.eclipse.jst.javaee.web.WebApp) - return true; - return false; - } - - /** - * Creates servlet-mappings for the servlet - * - * @param webApp - * @param urlMappingList - * - list of string values to be used in url-pattern for - * servlet-mapping - * @param servlet - */ - @SuppressWarnings("unchecked") - public static void setUpURLMappings(final WebApp webApp, - final List urlMappingList, final Servlet servlet) { - // Add mappings - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingExist(webApp, servlet, pattern))) { - ServletMapping mapping = WebapplicationFactory.eINSTANCE - .createServletMapping(); - mapping.setServlet(servlet); - mapping.setName(servlet.getServletName()); - mapping.setUrlPattern(pattern); - webApp.getServletMappings().add(mapping); - } - } - } - - @SuppressWarnings("unchecked") - public static void updateURLMappings(final WebApp webApp, - final List urlMappingList, final Servlet servlet) { - // TODO - if (urlMappingList != null) { - List<ServletMapping> mappings = findServletMappings(webApp, - servlet, servlet.getServletName()); - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingExist(webApp, servlet, pattern))) { - ServletMapping mapping = WebapplicationFactory.eINSTANCE - .createServletMapping(); - mapping.setServlet(servlet); - mapping.setName(servlet.getServletName()); - mapping.setUrlPattern(pattern); - webApp.getServletMappings().add(mapping); - } - - } - // Now gather up the patterns that aren't defined in the UI... - List<ServletMapping> patternsToRemove = new ArrayList<ServletMapping>(); - for (Iterator<ServletMapping> iter = mappings.iterator(); iter.hasNext();) - { - ServletMapping next = iter.next(); - String patternTypeValue = next.getUrlPattern(); - if (patternTypeValue != null && !urlMappingList.contains(patternTypeValue)) - { - patternsToRemove.add(next); - } - } - //...and remove them from the model - for (Iterator<ServletMapping> iter = patternsToRemove.iterator(); iter.hasNext(); ) - { - webApp.getServletMappings().remove(iter.next()); - } - - - - } - } - - @SuppressWarnings("unchecked") - private static boolean doesServletMappingExist(final WebApp webApp, - final Servlet servlet, final String pattern) { - - List<ServletMapping> mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - for (int i = mappings.size() - 1; i >= 0; --i) { - ServletMapping mapping = mappings.get(i); - if (mapping != null - && mapping.getServlet() != null - && mapping.getServlet().getServletName() != null - && mapping.getServlet().getServletName().trim().equals( - servletName) && mapping.getUrlPattern() != null - && mapping.getUrlPattern().trim().equals(pattern)) { - return true; - } - } - } - return false; - } - - /** - * Removes servlet-mappings for servlet using servlet-name. - * - * @param webApp - * @param servlet - */ - @SuppressWarnings("unchecked") - public static void removeURLMappings(final WebApp webApp, - final Servlet servlet) { - List<ServletMapping> mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - for (int i = mappings.size() - 1; i >= 0; --i) { - ServletMapping mapping = mappings.get(i); - if (mapping != null - && mapping.getServlet() != null - && mapping.getServlet().getServletName() != null - && mapping.getServlet().getServletName().trim().equals( - servletName)) { - mappings.remove(mapping); - } - } - } - } - - /** - * @param webAppObj - * as Object - * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and - * versionID == 24 - */ - public static boolean isWebApp24(final Object webAppObj) { - if (webAppObj instanceof WebApp - && ((WebApp) webAppObj).getVersionID() == 24) - return true; - return false; - } - - /** - * @param webAppObj - * as Object - * @return true if webApp instanceof org.eclipse.jst.j2ee.web.WebApp and - * versionID == 23 - */ - public static boolean isWebApp23(final Object webAppObj) { - if (webAppObj instanceof WebApp - && ((WebApp) webAppObj).getVersionID() == 23) - return true; - return false; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJEEUtils.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJEEUtils.java deleted file mode 100644 index b9ff8c06d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSJEEUtils.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100310 304405 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet : support JAX-RS 1.1 - * 20100319 306594 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet install fails for Web 2.3 & 2.4 - * 20100325 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - * 20100408 308565 kchong@ca.ibm.com - Keith Chong, JAX-RS: Servlet name and class not updated - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jst.javaee.core.Description; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.WebAppVersionType; -import org.eclipse.jst.javaee.web.WebFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * Utility file for Web 2.5 or 3.0 model - */ -public class JAXRSJEEUtils extends JAXRSUtils { - - public static Servlet findJAXRSServlet(final WebApp webApp, String selectedLibraryProviderID) { - return findJAXRSServletUsingLibraryProviderID(webApp, selectedLibraryProviderID); - } - /** - * @param webApp - * @return Servlet - the JAXRS Servlet for the specified WebApp or null if - * not present - */ - @SuppressWarnings("unchecked") - public static Servlet findJAXRSServlet(final WebApp webApp) { - return findJAXRSServletUsingLibraryProviderID(webApp, null); - } - private static Servlet findJAXRSServletUsingLibraryProviderID(final WebApp webApp, String selectedLibraryProviderID) { - Iterator<Servlet> it = webApp.getServlets().iterator(); - Servlet toReturn = null; - while (it.hasNext()) { - Servlet servlet = it.next(); - Iterator <Description> descIter = servlet.getDescriptions().iterator(); - while (descIter.hasNext()) - { - Description desc = descIter.next(); - String value = desc.getValue(); - if (value != null && value.trim().startsWith(JAXRS_SERVLET_IDENTIFIER)) - { - return servlet; - } - } - if (servlet.getServletName() != null - && (servlet.getServletName().trim().equals( - getSavedservletName()) || servlet - .getServletName().trim().equals( - JAXRS_DEFAULT_SERVLET_NAME))) { - return servlet; - } - - if (servlet.getServletClass() != null - && servlet.getServletClass().trim().equals( - getSavedServletClassName(selectedLibraryProviderID))) { - return servlet; - } - - if (servlet.getServletClass() != null - && facetKnowsServletClassName(servlet.getServletClass().trim())) - return servlet; - if (servlet.getServletClass() != null - && servlet.getServletClass().trim().equals(JAXRS_SERVLET_CLASS)) { - if (toReturn == null) - //found a servlet with empty servlet class, return that if find nothing else - toReturn = servlet; - } - - } - - // if we get to here then we have finished the loop - // without finding the servlet we're looking for - return toReturn; - } - - private static String getSavedServletClassName() { - IDialogSettings jaxrsUISettings = JAXRSCorePlugin.getDefault() - .getJaxrsUISettings(); - if (jaxrsUISettings != null) { - String JAXRSUISettingsRoot = "org.eclipse.jst.ws.jaxrs.ui" + ".jaxrsFacetInstall"; //$NON-NLS-1$ - IDialogSettings root = jaxrsUISettings - .getSection(JAXRSUISettingsRoot); - - if (root != null) - return root.get("servletClassname"); - } - return null; - } - - /** - * Creates servlet reference in WebApp if not present or updates servlet - * name if found using the passed configuration. - * - * @param webApp - * @param config - * @param servlet - * @return Servlet servlet - if passed servlet was null, will return created - * servlet - */ - @SuppressWarnings("unchecked") - public static Servlet createOrUpdateServletRef(final WebApp webApp, - final IDataModel config, org.eclipse.jst.javaee.web.Servlet servlet) { - - String displayName = getDisplayName(config); - String className = getServletClassname(config); - - return createOrUpdateServletRef(webApp, displayName, className, servlet); - } - - @SuppressWarnings("unchecked") - public static Servlet createOrUpdateServletRef(final WebApp webApp, - String displayName, String className, org.eclipse.jst.javaee.web.Servlet servlet) { - - if (servlet == null) { - // Create the servlet instance and set up the parameters from data - // model - servlet = WebFactory.eINSTANCE.createServlet(); - servlet.setServletName(displayName); - servlet.setServletClass(className); - servlet.setLoadOnStartup(Integer.valueOf(1)); - Description description = JavaeeFactory.eINSTANCE.createDescription(); - description.setValue(JAXRS_SERVLET_IDENTIFIER_DESCRIPTION); - servlet.getDescriptions().add(description); - // Add the servlet to the web application model - webApp.getServlets().add(servlet); - - } else { - updateServletMappings(webApp, servlet, displayName); - servlet.setServletName(displayName); - servlet.setServletClass(className); - servlet.setLoadOnStartup(Integer.valueOf(1)); - Description jaxrsToolsDescription = null; - Description next = null; - List<Description> descriptions = servlet.getDescriptions(); - if (descriptions != null) { - Iterator<Description> it = descriptions.iterator(); - while (it.hasNext()) { - next = it.next(); - if (JAXRS_SERVLET_IDENTIFIER_DESCRIPTION.equals(next - .getValue())) { - jaxrsToolsDescription = next; - break; - } - } - - } - if (jaxrsToolsDescription == null) { - // add the description for our JAX-RS tools - Description description = JavaeeFactory.eINSTANCE - .createDescription(); - description.setValue(JAXRS_SERVLET_IDENTIFIER_DESCRIPTION); - servlet.getDescriptions().add(description); - } - - } - return servlet; - } - - private static void updateServletMappings(final WebApp webApp, - final Servlet servlet, final String displayName) { - // update mappings for new name - ServletMapping mapping = findServletMapping(webApp, servlet); - if (mapping != null) { - mapping.setServletName(displayName); - } - - } - - /** - * @param webAppObj - * as Object - * @return true if webApp instanceof org.eclipse.jst.javaee.web.WebApp and - * WebAppVersionType._25 - */ - public static boolean isWebApp25(final Object webAppObj) { - if (webAppObj instanceof WebApp - && ((WebApp) webAppObj).getVersion() == WebAppVersionType._25_LITERAL) - return true; - return false; - } - - /** - * @param webAppObj - * as Object - * @return true if webApp instanceof org.eclipse.jst.javaee.web.WebApp and - * WebAppVersionType._25 or WebAppVersionType._30 - */ - public static boolean isWebApp25or30(final Object webAppObj) { - if (webAppObj instanceof WebApp - && (((WebApp) webAppObj).getVersion() == WebAppVersionType._25_LITERAL || ((WebApp) webAppObj).getVersion() == WebAppVersionType._30_LITERAL)) - return true; - return false; - } - - /** - * Creates servlet-mappings for the servlet for 2.5 WebModules or greater - * - * @param webApp - * @param urlMappingList - * - list of string values to be used in url-pattern for - * servlet-mapping - * @param servlet - */ - @SuppressWarnings("unchecked") - public static void setUpURLMappings(final WebApp webApp, - final List urlMappingList, final Servlet servlet) { - - if (urlMappingList.size() > 0) { - ServletMapping mapping = findServletMapping(webApp, servlet); - if (mapping == null) { - mapping = WebFactory.eINSTANCE.createServletMapping(); - mapping.setServletName(servlet.getServletName()); - webApp.getServletMappings().add(mapping); - } - // Add patterns - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingPatternExist(webApp, mapping, pattern))) { - UrlPatternType urlPattern = JavaeeFactory.eINSTANCE - .createUrlPatternType(); - urlPattern.setValue(pattern); - mapping.getUrlPatterns().add(urlPattern); - } - else - { - mapping.getUrlPatterns().remove(pattern); - } - } - } - } - - @SuppressWarnings("unchecked") - public static void updateURLMappings(final WebApp webApp, - final List urlMappingList, final Servlet servlet) { - - if (urlMappingList != null) { - ServletMapping mapping = findServletMapping(webApp, servlet); - if (mapping == null) { - mapping = WebFactory.eINSTANCE.createServletMapping(); - mapping.setServletName(servlet.getServletName()); - webApp.getServletMappings().add(mapping); - } - // Add patterns - Iterator it = urlMappingList.iterator(); - while (it.hasNext()) { - String pattern = (String) it.next(); - if (!(doesServletMappingPatternExist(webApp, mapping, pattern))) { - UrlPatternType urlPattern = JavaeeFactory.eINSTANCE - .createUrlPatternType(); - urlPattern.setValue(pattern); - mapping.getUrlPatterns().add(urlPattern); - } - } - // Now gather up the patterns that aren't defined in the UI... - List<UrlPatternType> patternsToRemove = new ArrayList<UrlPatternType>(); - for (Iterator<UrlPatternType> iter = mapping.getUrlPatterns().iterator(); iter.hasNext();) - { - UrlPatternType aPatternType = iter.next(); - String patternTypeValue = aPatternType.getValue(); - if (patternTypeValue != null && !urlMappingList.contains(patternTypeValue)) - { - patternsToRemove.add(aPatternType); - } - } - //...and remove them from the model - for (Iterator<UrlPatternType> iter = patternsToRemove.iterator(); iter.hasNext(); ) - { - UrlPatternType aPatternType = iter.next(); - mapping.getUrlPatterns().remove(aPatternType); - } - } - } - - @SuppressWarnings("unchecked") - private static ServletMapping findServletMapping(final WebApp webApp, - final Servlet servlet) { - for (Iterator<ServletMapping> it = webApp.getServletMappings() - .iterator(); it.hasNext();) { - ServletMapping mapping = it.next(); - if (mapping.getServletName() != null - && servlet.getServletName() != null - && mapping.getServletName().trim().equals( - servlet.getServletName().trim())) - return mapping; - } - return null; - } - - @SuppressWarnings("unchecked") - private static boolean doesServletMappingPatternExist(final WebApp webApp, - final ServletMapping mapping, final String pattern) { - for (Iterator<UrlPatternType> it = mapping.getUrlPatterns().iterator(); it - .hasNext();) { - String patternTypeValue = it.next().getValue(); - if (patternTypeValue != null - && pattern.equals(patternTypeValue.trim())) - return true; - } - return false; - } - - /** - * Removes servlet-mappings for servlet using servlet-name for >= 2.5 - * WebModules. - * - * @param webApp - * @param servlet - */ - @SuppressWarnings("unchecked") - public static void removeURLMappings(final WebApp webApp, - final Servlet servlet) { - List<ServletMapping> mappings = webApp.getServletMappings(); - String servletName = servlet.getServletName(); - if (servletName != null) { - servletName = servletName.trim(); - for (int i = mappings.size() - 1; i >= 0; --i) { - ServletMapping mapping = mappings.get(i); - if (mapping != null && mapping.getServletName() != null - && mapping.getServletName().trim().equals(servletName)) { - mappings.remove(mapping); - } - } - } - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSLibraryValidator.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSLibraryValidator.java deleted file mode 100644 index a12d26329..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSLibraryValidator.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091109 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.jst.common.project.facet.core.libprov.user.KeyClassesValidator; - -public class JAXRSLibraryValidator extends KeyClassesValidator -{ - - - /** - * Construct a validator for the JAXRS facet. - */ - public JAXRSLibraryValidator () - { - super(); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSSharedLibraryProviderInstallOperationConfig.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSSharedLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 33000f5aa..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSSharedLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class JAXRSSharedLibraryProviderInstallOperationConfig extends UserLibraryProviderInstallOperationConfig implements IJAXRSSharedLibraryProviderInstallOperationConfig { - private boolean isSharedLibrary = true; - private boolean isDeploy = false; - private IDataModel model = null; - - public void setSharedLibrary(boolean isSharedLibrary) - { - this.isSharedLibrary = isSharedLibrary; -// setIncludeWithApplicationEnabled(!isSharedLibrary); - } - - public boolean isSharedLibrary() - { - return this.isSharedLibrary; - } - - public void setIsDeploy(boolean isDeploy) { - this.isDeploy = isDeploy; - } - - public boolean isDeploy() { - return this.isDeploy; - } - - public void setModel(IDataModel model) { - this.model = model; - } - - public IDataModel getModel() { - return model; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperation.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperation.java deleted file mode 100644 index 3cfb15499..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperation.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100319 306595 ericdp@ca.ibm.com - Eric D. Peters, several install scenarios fail for both user library & non-user library - * 20100324 306937 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Properties page- NPE after pressing OK - * 20100407 304749 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet: install fails when choosing <None> runtime - * 20100622 317306 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Property page- RuntimeException when <None> runtime targeted - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -import org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperation; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfigurator; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfiguratorUtil; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; -import org.eclipse.wst.server.core.IRuntimeType; -import org.eclipse.jst.server.core.FacetUtil; - -public class JAXRSUserLibraryProviderInstallOperation extends WtpUserLibraryProviderInstallOperation -{ - - public JAXRSUserLibraryProviderInstallOperation() - { - // TODO Auto-generated constructor stub - } - - public void execute(final LibraryProviderOperationConfig libConfig, final IProgressMonitor monitor) - - throws CoreException - - { - super.execute(libConfig, monitor); - - JAXRSUserLibraryProviderInstallOperationConfig cfg = (JAXRSUserLibraryProviderInstallOperationConfig) libConfig; - // If config is null, we are on the properties page - IDataModel config = cfg.getModel(); - - IRuntime runtime = cfg.getFacetedProject().getPrimaryRuntime(); - IProject project = cfg.getFacetedProject().getProject(); - - String targetRuntimeID = ""; - if (!onPropertiesPage(config)) { - targetRuntimeID = config.getStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME); - } else { - if (runtime != null) { - org.eclipse.wst.server.core.IRuntime iruntime = FacetUtil.getRuntime(runtime); - if (iruntime != null) - { - IRuntimeType rtType = iruntime.getRuntimeType(); - if (rtType != null) - { - targetRuntimeID = rtType.getId(); - } - } - } - } - - IProject[] ears = EarUtilities.getReferencingEARProjects(project); - SharedLibraryConfiguratorUtil.getInstance(); - java.util.List<SharedLibraryConfigurator> configurators = SharedLibraryConfiguratorUtil.getConfigurators(); - Iterator<SharedLibraryConfigurator> sharedLibConfiguratorIterator = configurators.iterator(); - - if (onPropertiesPage(config) || cfg.isDeploy() || (!cfg.isDeploy() && !cfg.isSharedLibrary())) - return; - - while (sharedLibConfiguratorIterator.hasNext()) - { - SharedLibraryConfigurator thisConfigurator = sharedLibConfiguratorIterator.next(); - if (targetRuntimeID.equals(thisConfigurator.getRuntimeID())) - { - IProject earProject = null; - Boolean addToEar = null; - if (!onPropertiesPage(config)) - { - earProject = getEARProject(config); - addToEar = getAddToEar(config); - } - else - { - if (ears.length > 0) - earProject = ears[0]; - else - return; - addToEar = new Boolean(true); - } - if (thisConfigurator.getIsSharedLibSupported(project, earProject, addToEar, ((LibraryInstallDelegate)config.getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).getLibraryProvider().getId())) // libref.getID() - { - thisConfigurator.installSharedLibs(project, earProject, monitor, cfg.getLibraryNames()); // libref.getID() - break; - } - } - } - } - -private boolean onPropertiesPage(IDataModel config) { - return config == null; -} - - private IProject getEARProject(IDataModel config) - { - String projName = config.getStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME); - if (projName == null || "".equals(projName)) - return null; - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName); - return project; - } - - private boolean getAddToEar(IDataModel config) - { - return config.getBooleanProperty(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperationConfig.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 031d4d2c8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUserLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class JAXRSUserLibraryProviderInstallOperationConfig extends - WtpUserLibraryProviderInstallOperationConfig implements IJAXRSSharedLibraryProviderInstallOperationConfig { - - public JAXRSUserLibraryProviderInstallOperationConfig() { - // TODO Auto-generated constructor stub - } - - - private boolean isSharedLibrary = true; - private boolean isDeploy = false; - private IDataModel model = null; - - public void setSharedLibrary(boolean isSharedLibrary) - { - this.isSharedLibrary = isSharedLibrary; -// setIncludeWithApplicationEnabled(!isSharedLibrary); - } - - public boolean isSharedLibrary() - { - return this.isSharedLibrary; - } - - public void setIsDeploy(boolean isDeploy) { - this.isDeploy = isDeploy; - setIncludeWithApplicationEnabled(isDeploy); - } - - public boolean isDeploy() { - return this.isDeploy; - } - - public void setModel(IDataModel model) { - this.model = model; - } - - public IDataModel getModel() { - return model; - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUtils.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUtils.java deleted file mode 100644 index 89db24bb4..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSUtils.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100325 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - * 20100408 308565 kchong@ca.ibm.com - Keith Chong, JAX-RS: Servlet name and class not updated - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig.JAXRSLibraryProviderUtil; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * - */ -public abstract class JAXRSUtils { - /** - * The default name for the JAX-RS servlet - */ - public static final String JAXRS_DEFAULT_SERVLET_NAME = "JAX-RS Servlet"; //$NON-NLS-1$ - /** - * The default name of the JAX-RS servlet class - */ - public static final String JAXRS_SERVLET_CLASS = ""; //$NON-NLS-1$ - - /** - * Default URL mapping to jaxrs servlet - */ - public static final String JAXRS_DEFAULT_URL_MAPPING = "/jaxrs/*"; //$NON-NLS-1$ - - /** - * the key for implementation libraries in persistent properties - */ - public static final String PP_JAXRS_IMPLEMENTATION_LIBRARIES = "jaxrs.implementation.libraries"; //$NON-NLS-1$ - - public static final String JAXRS_SERVLET_IDENTIFIER = "JAX-RS Tools Generated"; //$NON-NLS-1$ - public static final String JAXRS_SERVLET_IDENTIFIER_DESCRIPTION = "JAX-RS Tools Generated - Do not modify"; //$NON-NLS-1$ - - /** - * @param config - * @return servlet display name to use from wizard data model - */ - protected static String getDisplayName(IDataModel config) { - String displayName = config - .getStringProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_NAME); - if (displayName == null || displayName.trim().equals("")) //$NON-NLS-1$ - displayName = JAXRS_DEFAULT_SERVLET_NAME; - return displayName.trim(); - } - - /** - * @param config - * @return servlet display name to use from wizard data model - */ - protected static String getServletClassname(IDataModel config) { - String className = config - .getStringProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_CLASSNAME); - if (className == null || className.trim().equals("")) //$NON-NLS-1$ - className = JAXRS_SERVLET_CLASS; - return className.trim(); - } - - /** - * @param webProject - * @return IModelProvider - */ - public static IModelProvider getModelProvider(IProject webProject) { - IModelProvider provider = ModelProviderManager - .getModelProvider(webProject); - Object webAppObj = provider.getModelObject(); - if (webAppObj == null) { - return null; - } - return provider; - } - - /** - * The result of a servlet mapping search - * - */ - public static class MappingSearchResult { - private final String _extensionMapping; // may be null; - private final String _prefixMapping; // may be null - - MappingSearchResult(final String extensionMapping, - final String prefixMapping) { - _extensionMapping = extensionMapping; - _prefixMapping = prefixMapping; - } - - /** - * @return true if the search yielded a valid result - */ - public boolean isResult() { - return _extensionMapping != null || _prefixMapping != null; - } - - /** - * @return the first extension mapping matching search criteria or null - * if none - */ - public final String getExtensionMapping() { - return _extensionMapping; - } - - /** - * @return the first prefix mapping matching search criteria or null if - * none - */ - public final String getPrefixMapping() { - return _prefixMapping; - } - } - - static String getSavedServletClassName(String libraryProviderID) { - IDialogSettings jaxrsUISettings = JAXRSCorePlugin.getDefault() - .getJaxrsUISettings(); - if (jaxrsUISettings != null) { - - String JAXRSUISettingsRoot = "org.eclipse.jst.ws.jaxrs.ui" + ".jaxrsFacetInstall"; //$NON-NLS-1$ - IDialogSettings root = jaxrsUISettings - .getSection(JAXRSUISettingsRoot); - - if (root != null) { - String toReturn = root.get(libraryProviderID + "servletClassname"); //$NON-NLS-1$ - if (toReturn == null) - toReturn = root.get("servletClassname"); //$NON-NLS-1$ - return toReturn; - } - } - return null; - } - static boolean facetKnowsServletClassName(String servletClassName) { - return JAXRSLibraryProviderUtil.servletClassNameHasLibraryProvider(servletClassName); - } - /** - * @deprecated - * use org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUtils.getSavedservletName() - */ - static String getSavedServletName() { - IDialogSettings jaxrsUISettings = JAXRSCorePlugin.getDefault() - .getJaxrsUISettings(); - if (jaxrsUISettings != null) { - String JAXRSUISettingsRoot = "org.eclipse.jst.ws.jaxrs.ui" + ".jaxrsFacetInstall"; //$NON-NLS-1$ - IDialogSettings root = jaxrsUISettings - .getSection(JAXRSUISettingsRoot); - - if (root != null) - return root.get("servletClassname"); - } - return null; - } - - static String getSavedservletName() { - IDialogSettings jaxrsUISettings = JAXRSCorePlugin.getDefault() - .getJaxrsUISettings(); - if (jaxrsUISettings != null) { - String JAXRSUISettingsRoot = "org.eclipse.jst.ws.jaxrs.ui" + ".jaxrsFacetInstall"; //$NON-NLS-1$ - IDialogSettings root = jaxrsUISettings - .getSection(JAXRSUISettingsRoot); - - if (root != null) - return root.get("servletName"); //$NON-NLS-1$ - } - return null; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLBase.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLBase.java deleted file mode 100644 index 432ed994b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLBase.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public abstract class UpdateWebXMLBase implements Runnable { - - public abstract void run(); - - /** - * @param config - * @return list of URL patterns from the datamodel - */ - protected List<String> getServletMappings(final IDataModel config) { - List<String> mappings = new ArrayList<String>(); - String[] patterns = (String[]) config - .getProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS); - for (int i = 0; i < patterns.length; i++) { - String pattern = patterns[i]; - mappings.add(pattern); - } - - return mappings; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJ2EE.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJ2EE.java deleted file mode 100644 index 0b5c1f647..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJ2EE.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class UpdateWebXMLForJ2EE extends UpdateWebXMLBase implements Runnable { - private IProject project; - private IDataModel config; - - public UpdateWebXMLForJ2EE(IProject project, final IDataModel config) { - this.project = project; - this.config = config; - } - - public void run() { - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) ModelProviderManager - .getModelProvider(project).getModelObject(); - // create or update servlet ref - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JAXRSJ2EEUtils - .findJAXRSServlet(webApp);// check to see - // if already - // present - - servlet = JAXRSJ2EEUtils.createOrUpdateServletRef(webApp, config, - servlet); - - // init mappings - List<String> listOfMappings = getServletMappings(config); - JAXRSJ2EEUtils.setUpURLMappings(webApp, listOfMappings, servlet); - - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJavaEE.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJavaEE.java deleted file mode 100644 index fb6880e2e..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/UpdateWebXMLForJavaEE.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.internal.project.facet; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class UpdateWebXMLForJavaEE extends UpdateWebXMLBase implements Runnable { - private IProject project; - private IDataModel config; - private Servlet servlet; - private ServletMapping servletMapping; - private String newServletName, newServletClass; - - public UpdateWebXMLForJavaEE(final IProject project, final IDataModel config) { - this.project = project; - this.config = config; - } - - public UpdateWebXMLForJavaEE(final IProject project, Servlet servlet, ServletMapping servletMapping, String newServletName, String newServletClass) { - this.project = project; - this.servlet = servlet; - this.servletMapping = servletMapping; - this.newServletName = newServletName; - this.newServletClass = newServletClass; - } - - public void run() { - WebApp webApp = (WebApp) ModelProviderManager.getModelProvider( - project).getModelObject(); - // create or update servlet ref - Servlet servlet = JAXRSJEEUtils.findJAXRSServlet(webApp);// check to - // see - // if already - - servlet = JAXRSJEEUtils.createOrUpdateServletRef(webApp, config, servlet); - - // init mappings - List<String> listOfMappings = getServletMappings(config); - JAXRSJEEUtils.setUpURLMappings(webApp, listOfMappings, servlet); - - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrsappconfig/internal/JAXRSAppConfigUtils.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrsappconfig/internal/JAXRSAppConfigUtils.java deleted file mode 100644 index a12bdc9ea..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrsappconfig/internal/JAXRSAppConfigUtils.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrsappconfig.internal; - -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * JAXRSAppConfigUtils provides utility methods useful in processing of a JAXRS - * application configuration. - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - * - */ -public class JAXRSAppConfigUtils { - - - /** - * Tests if the passed IProject instance is a valid JAXRS project in the - * following ways: - * <ul> - * <li>project is not null and is accessible,</li> - * <li>project has the JAXRS facet set on it.</li> - * </ul> - * - * @param project - * IProject instance to be tested. - * @return true if the IProject instance is a valid JAXRS project, else - * false. - */ - public static boolean isValidJAXRSProject(IProject project) { - boolean isValid = false; - IProjectFacetVersion projectFacet = getProjectFacet(project); - if (projectFacet != null) { - isValid = true; - } - return isValid; - } - - /** - * Get the facet version for the project - * - * @param project - * @return the project facet version or null if could not be found or if - * project is not accessible - */ - @SuppressWarnings("unchecked") - public static IProjectFacetVersion getProjectFacet(IProject project) { - // check for null or inaccessible project - if (project != null && project.isAccessible()) { - // check for JAXRS facet on project - try { - IFacetedProject facetedProject = ProjectFacetsManager - .create(project); - if (facetedProject != null) { - Set projectFacets = facetedProject.getProjectFacets(); - Iterator itProjectFacets = projectFacets.iterator(); - while (itProjectFacets.hasNext()) { - IProjectFacetVersion projectFacetVersion = (IProjectFacetVersion) itProjectFacets - .next(); - if (IJAXRSCoreConstants.JAXRS_FACET_ID - .equals(projectFacetVersion.getProjectFacet() - .getId())) { - return projectFacetVersion; - } - } - } - } catch (CoreException ce) { - // log error - JAXRSCorePlugin - .log(IStatus.ERROR, ce.getLocalizedMessage(), ce); - } - } - return null; - } - - /** - * Gets an IVirtualFolder instance which represents the root context's web - * content folder. - * - * @param project - * IProject instance for which to get the folder. - * @return IVirtualFolder instance which represents the root context's web - * content folder. - */ - public static IVirtualFolder getWebContentFolder(IProject project) { - IVirtualFolder folder = null; - IVirtualComponent component = ComponentCore.createComponent(project); - if (component != null) { - folder = component.getRootFolder(); - } - return folder; - } - - /** - * Gets an IPath instance representing the path of the passed IFile instance - * relative to the web content folder. - * - * @param file - * IFile instance for which a path is required. - * @return IPath instance representing the path relative to the web content - * folder. - */ - public static IPath getWebContentFolderRelativePath(IFile file) { - IPath path = null; - if (file != null) { - IVirtualFolder webContentFolder = getWebContentFolder(file - .getProject()); - if (webContentFolder != null) { - IPath webContentPath = webContentFolder - .getProjectRelativePath(); - IPath filePath = file.getProjectRelativePath(); - int matchingFirstSegments = webContentPath - .matchingFirstSegments(filePath); - path = filePath.removeFirstSegments(matchingFirstSegments); - } - } - return path; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/AbstractJAXRSLibraryReferenceImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/AbstractJAXRSLibraryReferenceImpl.java deleted file mode 100644 index db9dc8943..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/AbstractJAXRSLibraryReferenceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference; -/* -* @deprecated -* -* <p> -* <b>Provisional API - subject to change - do not use</b> -* </p> -*/ -public abstract class AbstractJAXRSLibraryReferenceImpl implements - JAXRSLibraryReference { - - /** - * The - * {@link org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference} - * being wrapped - */ - protected JAXRSLibraryInternalReference libRef; - private String _id; - private String _label; - private boolean _isDeloyed; - - /** - * Constructor for "virtual" JAXRS Library References like "ServerSupplied" - * - * @param id - * @param label - * @param isImplementation - */ - public AbstractJAXRSLibraryReferenceImpl(String id, String label) { - _id = id; - _label = label; - } - - /** - * Constructor non-virtual library references - * - * @param libRef - * @param isDeployed - */ - public AbstractJAXRSLibraryReferenceImpl( - JAXRSLibraryInternalReference libRef, boolean isDeployed) { - this.libRef = libRef; - _isDeloyed = isDeployed; - } - - public String getId() { - if (libRef != null) - return libRef.getID(); - - return _id; - } - - public String getLabel() { - if (libRef != null) - return libRef.getLabel(); - - return _label; - } - - public boolean isDeployed() { - return _isDeloyed; - } - - /** - * @return the JAXRSLibrary underpinning the reference. May be null if the - * library is missing or cannot be resolved from the registry. - */ - protected JAXRSLibrary getLibrary() { - return libRef.getLibrary(); - } - - @SuppressWarnings("unchecked") - public Collection<IClasspathEntry> getJars() { - Set<IClasspathEntry> results = new HashSet<IClasspathEntry>(); - if (getLibrary() != null) { - List jars = getLibrary().getArchiveFiles(); - for (Iterator it = jars.iterator(); it.hasNext();) { - ArchiveFile jar = (ArchiveFile) it.next(); - String path = jar.getResolvedSourceLocation(); - results.add(JavaCore - .newLibraryEntry(new Path(path), null, null)); - } - } - return results; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jst.ws.jaxrs.core.JAXRSLibraryconfiguration.JAXRSLibraryReference - * #getName() - */ - public String getName() { - if (getLibrary() != null) { - return getLibrary().getName(); - } - return getId(); - } - - public String toString() { - StringBuffer buf = new StringBuffer("id: "); - buf.append(getId()); - buf.append(", label: "); - buf.append(getLabel()); - buf.append(", isDeployed: "); - buf.append(isDeployed()); - - return buf.toString(); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryConfigurationHelper.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryConfigurationHelper.java deleted file mode 100644 index dd3146eb5..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryConfigurationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import java.util.Collection; -import java.util.HashSet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; - -/** - * Helper class for adopters needing to deal with JAXRS Library References - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * @deprecated - * - */ -public final class JAXRSLibraryConfigurationHelper { - /** - * container id for JAXRS Library Classpath Containers - */ - public static final String JAXRS_LIBRARY_CP_CONTAINER_ID = "org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibrarycontainer"; - - /** - * @param project - * @return collection of references - */ - public static Collection<JAXRSLibraryReference> getJAXRSLibraryReferences( - IProject project) { - Collection<JAXRSLibraryReference> results = new HashSet<JAXRSLibraryReference>(); - IJavaProject jproj = JavaCore.create(project); - try { - IClasspathEntry[] entries = jproj.getRawClasspath(); - for (int i = 0; i < entries.length; i++) { - JAXRSLibraryReference ref = JAXRSLibraryReferenceFacadeFactory - .create(entries[i]); - if (ref != null) { - results.add(ref); - } - } - } catch (JavaModelException e) { - JAXRSCorePlugin.log(e, - "Exception occurred calling getJAXRSLibraryReferences for " - + project.getName()); - } - return results; - } - - /** - * @param cpEntry - * @return boolean indicating that the classpath entry is a JAXRS Libary - * Classpath Container - */ - public static boolean isJAXRSLibraryContainer(IClasspathEntry cpEntry) { - if (cpEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) - return false; - - IPath path = cpEntry.getPath(); - return path != null && path.segmentCount() == 2 - && JAXRS_LIBRARY_CP_CONTAINER_ID.equals(path.segment(0)); - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReference.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReference.java deleted file mode 100644 index aedec43db..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReference.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import java.util.Collection; - -import org.eclipse.jdt.core.IClasspathEntry; - -/** - * Represents a reference to a JAXRS Library on a project - * - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public abstract interface JAXRSLibraryReference { - /** - * @return id for the library - */ - public String getId(); - - /** - * @return name - */ - public String getName(); - - /** - * @return collection of jars as {@link IClasspathEntry}s - */ - public Collection<IClasspathEntry> getJars(); - - /** - * @return label user sees for this library - */ - public String getLabel(); - - /** - * @return is deployed (marked as J2EE Module Dependency) - */ - public boolean isDeployed(); -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceFacadeFactory.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceFacadeFactory.java deleted file mode 100644 index 26cf4c7a2..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceFacadeFactory.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import org.eclipse.jdt.core.IClasspathAttribute; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryRegistryUtil; - -/** - * Factory for producing facade objects for references to the internal EMF JAXRS - * Library classes - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryReferenceFacadeFactory { - /** - * Returns a JAXRSLibraryReferenceUserSpecified (or - * JAXRSLibraryReferenceUserDefined}) or JAXRSLibraryReferencePluginProvided - * instance. Will not create a JAXRSLibraryReferenceServerSupplied as there - * is no cp entry. Use createServerSuppliedJAXRSLibRef instead. - * - * @param classpathEntry - * @return an instance of JAXRSLibraryInternalReference. Null will be - * returned if the cpEntry is not a JAXRS Library reference. - */ - public static JAXRSLibraryReference create( - final IClasspathEntry classpathEntry) { - if (JAXRSLibraryConfigurationHelper - .isJAXRSLibraryContainer(classpathEntry)) { - return createReference(classpathEntry); - } - return null; - } - - /** - * @param classpathEntry - * @return {@link JAXRSLibraryReference} - */ - private static JAXRSLibraryReference createReference( - final IClasspathEntry classpathEntry) { - - String libID = classpathEntry.getPath().segment(1); - org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference libRef = JAXRSLibraryRegistryUtil - .getInstance().getJAXRSLibraryReferencebyID(libID); - if (libRef != null) { - boolean isDeployed = getJ2EEModuleDependency(classpathEntry); - if (libRef.getLibrary() instanceof PluginProvidedJAXRSLibrary) - return new JAXRSLibraryReferencePluginProvidedImpl(libRef, - isDeployed); - - return new JAXRSLibraryReferenceUserSpecifiedImpl(libRef, - isDeployed); - } - return null; - } - - private static boolean getJ2EEModuleDependency( - IClasspathEntry classpathEntry) { - IClasspathAttribute[] attrs = classpathEntry.getExtraAttributes(); - for (int i = 0; i < attrs.length; i++) { - IClasspathAttribute attr = attrs[i]; - if (attr - .getName() - .equals( - IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY)) { - return true; - } - } - return false; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvided.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvided.java deleted file mode 100644 index 8d5e021cd..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvided.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -/** - * A reference to a plugin-defined JAXRS Library - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface JAXRSLibraryReferencePluginProvided extends - JAXRSLibraryReferenceUserSpecified { - /** - * @return plugin id. May return null if plugin id cannot be determined. - */ - public String getPluginId(); -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvidedImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvidedImpl.java deleted file mode 100644 index befd045e8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferencePluginProvidedImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference; - -/** - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryReferencePluginProvidedImpl extends - AbstractJAXRSLibraryReferenceImpl implements - JAXRSLibraryReferencePluginProvided { - - /** - * Constructor - * - * @param libRef - * @param isDeployed - */ - public JAXRSLibraryReferencePluginProvidedImpl( - JAXRSLibraryInternalReference libRef, boolean isDeployed) { - super(libRef, isDeployed); - } - - public String getPluginId() { - if (getLibrary() != null) - return ((PluginProvidedJAXRSLibrary) getLibrary()).getPluginID(); - - return null; - } - - public String toString() { - StringBuffer buf = new StringBuffer("PluginProvided: ("); - buf.append(super.toString()); - - return buf.toString(); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecified.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecified.java deleted file mode 100644 index a984037b2..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecified.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -/** - * Represents an reference to a user specified JAXRS Library - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface JAXRSLibraryReferenceUserSpecified extends - JAXRSLibraryReference { - // -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecifiedImpl.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecifiedImpl.java deleted file mode 100644 index f5cba4d40..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryconfiguration/internal/JAXRSLibraryReferenceUserSpecifiedImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryconfiguration.internal; - -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryInternalReference; - -/** - * Implementation of a reference to a user specified JAXRS Library - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryReferenceUserSpecifiedImpl extends - AbstractJAXRSLibraryReferenceImpl implements - JAXRSLibraryReferenceUserSpecified { - /** - * @param libRef - * of type {@link JAXRSLibraryInternalReference} - * @param isDeployed - */ - public JAXRSLibraryReferenceUserSpecifiedImpl( - JAXRSLibraryInternalReference libRef, boolean isDeployed) { - - super(libRef, isDeployed); - } - - /* - * (non-Javadoc) - * - * @seeorg.eclipse.jst.ws.jaxrs.core.JAXRSLibraryconfiguration.internal. - * AbstractJAXRSLibraryReferenceImpl#toString() - */ - public String toString() { - StringBuffer buf = new StringBuffer("UserSpecified: ("); - buf.append(super.toString()); - buf.append(")"); - - return buf.toString(); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/InvalidArchiveFilesCreationException.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/InvalidArchiveFilesCreationException.java deleted file mode 100644 index 814027233..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/InvalidArchiveFilesCreationException.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal; - -public class InvalidArchiveFilesCreationException extends Exception { - private static final long serialVersionUID = 1L; - - /** - * Creates an instance with the specified message. - * - * @param msg - * This instance's message - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ - public InvalidArchiveFilesCreationException(String msg) { - super(msg); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/JAXRSLibraryArchiveFilesDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/JAXRSLibraryArchiveFilesDelegate.java deleted file mode 100644 index 730210c55..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/JAXRSLibraryArchiveFilesDelegate.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal; - -import java.util.Collection; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.osgi.framework.Bundle; - -/** - * Abstract delegate class used by jaxrsLibraries ext-pt to return collection of - * ArchiveFiles to PluginProvidedJAXRSLibraryCreationHelper. - * - * Caller must first setConfigurationElement(IConfigurationElement element) - * before a call to getArchiveFiles(). - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * @deprecated along with the jaxrslibraries extension-point - */ -public abstract class JAXRSLibraryArchiveFilesDelegate { - private IConfigurationElement extPtElement; - private String libID = null; - private IPath pluginPath = null; - private String pluginID; - private String relativeDestLocation = "WEB-INF/lib"; //$NON-NLS-1$ - - /** - * Returns a Collection of - * <code>org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryregistry.ArchiveFile</code> - * instances. - * - * @return A Collection of - * <code>org.eclipse.jst.ws.jaxrs.core.internal.JAXRSLibraryregistry.ArchiveFile</code> - * instances - */ - @SuppressWarnings("unchecked") - public abstract Collection getArchiveFiles(); - - /** - * Sets the IConfigurationElement instance to be subsequently used to get - * the plugin ID and the name defined for the JAXRS Library. - * - * @param extPtElement - * IConfigurationElement instance - */ - public final void setConfigurationElement(IConfigurationElement extPtElement) { - this.extPtElement = extPtElement; - } - - /** - * Constructs an instance. - */ - public JAXRSLibraryArchiveFilesDelegate() { - super(); - } - - /** - * Sets the relative destination location subsequently used to set the - * corresponding property on each created ArchiveFile. - * - * @param relPath - * Relative destination location for ArchiveFile instances - */ - protected void setRelativeDestinationLocation(String relPath) { - relativeDestLocation = relPath; - } - - /** - * Returns ArchiveFile where the location is set relative to the plugin. As - * long as the ArchiveFile is on the local machine somewhere, it should be - * locatable. - * - * @param relativePathFileName - * Relative location of the ArchiveFile - * @return ArchiveFile instance. - */ - protected ArchiveFile createArchiveFile(String relativePathFileName) { - ArchiveFile file = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - file.setRelativeToWorkspace(false); - file.setSourceLocation(relativePathFileName); - file.setRelativeDestLocation(relativeDestLocation); - return file; - } - - /** - * Returns the JAXRSLibrary ID as set on the extension point. - * - * @return JAXRSLibrary ID - */ - protected String getLibID() { - if (libID == null) { - StringBuffer buf = new StringBuffer(getPluginID()); - buf - .append("/").append(extPtElement.getAttribute(PluginProvidedJAXRSLibraryCreationHelper.NAME)); //$NON-NLS-1$ - libID = buf.toString(); - } - return libID; - } - - /** - * Returns the plugin's path. - * - * @return The plugin's path. - */ - protected IPath getPluginPath() { - if (pluginPath == null) { - Bundle bundle = Platform.getBundle(getPluginID()); - pluginPath = new Path(bundle.getLocation()); - } - return pluginPath; - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID. - */ - private String getPluginID() { - if (pluginID == null) { - pluginID = extPtElement.getDeclaringExtension().getContributor() - .getName(); - } - return pluginID; - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryArchiveFilesDelegate.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryArchiveFilesDelegate.java deleted file mode 100644 index 11b30894b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryArchiveFilesDelegate.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal; - - -/** - * Abstract class to be used for supplying the jar file names for a plugin - * provided JAXRS Library. <br> - * Adopters must implement getArchiveFiles() making use of the - * addArchiveFile(String pluginRootRelativePath) method. <br> - * <em>Note: A plugin providing jaxrs libraries cannot be jarred at this time. </em> - * <br> - * <br> - * ex. <br> - * - * <pre> - * <code>public void getArchiveFiles() { - * addArchiveFile("/lib/JAR1.jar"); - * addArchiveFile("/lib/JAR2.jar"); - * } - * </code> - * </pre> - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - * - */ -public abstract class PluginProvidedJAXRSLibraryArchiveFilesDelegate { - private PluginProvidedJAXRSLibraryCreationHelper2 helper; - - /** - * Constructs an instance. - */ - public PluginProvidedJAXRSLibraryArchiveFilesDelegate() { - super(); - } - - /** - * Concrete delegate must implement this method to define jars in the - * library. Use addJarFile(String pluginRootRelativePath) within this method - * to add jars to the library. - * @throws Exception - */ - public abstract void getArchiveFiles(); - - /** - * Adds jar file to the library. Verification of file existence does not - * occur at this point. - * - * Jar must be specified as being relative to the plugin. ex. - * "/lib/MyJar.jar" where the lib directory is a child of the root. - * - * @param pluginRootRelativePath - */ - protected void addArchiveFile(String pluginRootRelativePath) { - helper.addArchiveFile(pluginRootRelativePath);// getArchiveFiles().add(helper.createArchiveFile(pluginRootRelativePath)); - } - - - protected void addArchiveFileFromFullPath(String path) throws Exception { - helper.addArchiveFileFromFullPath(path); - } - - /** - * Not to be implemented by subclasses - * - * @param helper - */ - public void setCreationHelper( - PluginProvidedJAXRSLibraryCreationHelper2 helper) { - this.helper = helper; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper.java deleted file mode 100644 index 04fbeff9f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create JAXRS Libraries from the - * <code>org.eclipse.jst.ws.jaxrs.core.jaxrslibraries</code> extension-point. - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * @deprecated - clients should not use - */ -public final class PluginProvidedJAXRSLibraryCreationHelper { - private IConfigurationElement config_element; - - /** - * Key of the 'name' attribute of the extension point. - */ - public final static String NAME = "name"; //$NON-NLS-1$ - /** - * Key of the 'isImplementation' attribute of the extension point. - */ - public final static String IS_IMPL = "isImplementation"; //$NON-NLS-1$ - /** - * Key of the 'archiveFilesDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "archiveFilesDelegate"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param JAXRSLibrary - * IConfigurationElement instance - */ - public PluginProvidedJAXRSLibraryCreationHelper( - IConfigurationElement JAXRSLibrary) { - this.config_element = JAXRSLibrary; - } - - /** - * Creates a new PluginProvidedJAXRSLibrary from the JAXRSLibrary extension - * point. - * - * @return PluginProvidedJAXRSLibrary instance. - */ - public JAXRSLibrary create() { - PluginProvidedJAXRSLibrary newLib = JAXRSLibraryRegistryFactory.eINSTANCE - .createPluginProvidedJAXRSLibrary(); - newLib.setPluginID(getPluginID()); - newLib.setName(config_element.getAttribute(NAME)); - try { - addArchives(newLib); - return newLib; - } catch (Exception e) { - JAXRSCorePlugin - .log( - e, - NLS - .bind( - Messages.PluginProvidedJAXRSLibraryCreationHelper_ErrorCreating, - newLib.getName())); - } - return null; - } - - /** - * Adds ArchiveFile instances to the specified JAXRSLibrary instance. - * - * @param newLib - * JAXRSLibrary instance - * @throws InvalidArchiveFilesCreationException - * on attempt to create multiple instances at same location. - * @throws CoreException - * on core failure. - */ - @SuppressWarnings("unchecked") - private void addArchives(JAXRSLibrary newLib) - throws InvalidArchiveFilesCreationException, CoreException { - JAXRSLibraryArchiveFilesDelegate jarCol = null; - ArchiveFile jar = null; - - jarCol = (JAXRSLibraryArchiveFilesDelegate) config_element - .createExecutableExtension(DELEGATE); - if (jarCol != null) { - jarCol.setConfigurationElement(config_element); - Collection jars = jarCol.getArchiveFiles(); - if (jars == null)// TODO: better validation and error handling - return; - Iterator it = jars.iterator(); - while (it.hasNext()) { - Object aJar = it.next(); - if (aJar instanceof ArchiveFile) {// for now check to see - // ArchiveFiles were being - // returned - jar = (ArchiveFile) aJar; - if (!newLib.containsArchiveFile(jar.getSourceLocation())) - newLib.getArchiveFiles().add(jar); - } else { - throw new InvalidArchiveFilesCreationException( - NLS - .bind( - Messages.PluginProvidedJAXRSLibraryCreationHelper_ErrorMultipleDefinition, - jar.getSourceLocation(), - config_element.getName())); - } - - } - } - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID - */ - private String getPluginID() { - return config_element.getDeclaringExtension().getContributor() - .getName(); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper2.java b/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper2.java deleted file mode 100644 index 68ffe7f4b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.core/src/org/eclipse/jst/ws/jaxrs/core/jaxrslibraryregistry/internal/PluginProvidedJAXRSLibraryCreationHelper2.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.core.jaxrslibraryregistry.internal; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.ArchiveFile; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibrary; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.JAXRSLibraryRegistryFactory; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrsibraryregistry.PluginProvidedJAXRSLibrary; -import org.eclipse.osgi.util.NLS; - -/** - * Helper class used to create plugin-rovided JAXRS Libraries from the - * <code>org.eclipse.jst.ws.jaxrs.core.pluginProvidedJaxrsLibraries</code> - * extension-point. <br> - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public final class PluginProvidedJAXRSLibraryCreationHelper2 { - private PluginProvidedJAXRSLibrary newLib; - private IConfigurationElement config_element; - private String relativeDestLocation = "WEB-INF/lib"; //$NON-NLS-1$ - - /** - * Key of the 'name' attribute of the extension point. - */ - public final static String NAME = "name"; //$NON-NLS-1$ - /** - * Key of the 'archiveFilesDelegate' attribute of the extension point. - */ - public final static String DELEGATE = "archiveFilesDelegate"; //$NON-NLS-1$ - /** - * Key of the 'label' attribute of the extension point. - */ - public final static String LABEL = "label"; //$NON-NLS-1$ - - /** - * Creates an instance with the specified IConfigurationElement instance. - * - * @param JAXRSLibrary - * IConfigurationElement instance - */ - public PluginProvidedJAXRSLibraryCreationHelper2( - IConfigurationElement JAXRSLibrary) { - this.config_element = JAXRSLibrary; - } - - /** - * Add a jar file to the library - * - * @param pluginRootRelativePath - */ - @SuppressWarnings("unchecked") - public void addArchiveFile(String pluginRootRelativePath) { - ArchiveFile jar = createArchiveFile(pluginRootRelativePath); - if (!newLib.containsArchiveFile(jar.getSourceLocation())) - newLib.getArchiveFiles().add(jar); - } - - @SuppressWarnings("unchecked") - public void addArchiveFileFromFullPath(String path) throws Exception { - ArchiveFile jar = createArchiveFileFromFullPath(path); - if (!newLib.containsArchiveFile(jar.getSourceLocation())) - newLib.getArchiveFiles().add(jar); - } - - private ArchiveFile createArchiveFileFromFullPath(String path) { - ArchiveFile file = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - file.setRelativeToWorkspace(false); - file.setSourceLocation(path); - file.setRelativeDestLocation(relativeDestLocation); - return file; - } - - /** - * Creates a new PluginProvidedJAXRSLibrary from the JAXRSLibrary extension - * point. - * - * @return PluginProvidedJAXRSLibrary instance. - */ - public JAXRSLibrary create() { - newLib = JAXRSLibraryRegistryFactory.eINSTANCE - .createPluginProvidedJAXRSLibrary(); - newLib.setPluginID(getPluginID()); - newLib.setName(config_element.getAttribute(NAME)); - String label = config_element.getAttribute(LABEL); - if (label != null && label.length() > 0) { - newLib.setLabel(label); - } - - try { - addArchives(); - return newLib; - } catch (Exception e) { - JAXRSCorePlugin - .log( - e, - NLS - .bind( - Messages.PluginProvidedJAXRSLibraryCreationHelper_ErrorCreating, - newLib.getName())); - } - return null; - } - - /** - * Adds ArchiveFile instances to the specified JAXRSLibrary instance. - * - * @param newLib - * JAXRSLibrary instance - * @throws CoreException - * on core failure. - */ - private void addArchives() throws Exception { - PluginProvidedJAXRSLibraryArchiveFilesDelegate jarCol = null; - - jarCol = (PluginProvidedJAXRSLibraryArchiveFilesDelegate) config_element - .createExecutableExtension(DELEGATE); - if (jarCol != null) { - jarCol.setCreationHelper(this); - jarCol.getArchiveFiles(); - } - } - - /** - * Returns ArchiveFile where the location is set relative to the plugin. As - * long as the ArchiveFile is on the local machine somewhere, it should be - * locatable. - * - * @param relativePathFileName - * Relative location of the ArchiveFile - * @return ArchiveFile instance. - */ - private ArchiveFile createArchiveFile(String pluginRootRelativePath) { - ArchiveFile file = JAXRSLibraryRegistryFactory.eINSTANCE - .createArchiveFile(); - file.setRelativeToWorkspace(false); - file.setSourceLocation(pluginRootRelativePath); - file.setRelativeDestLocation(relativeDestLocation); - return file; - } - - /** - * Returns the plugin's ID. - * - * @return The plugin's ID - */ - private String getPluginID() { - return config_element.getDeclaringExtension().getContributor() - .getName(); - } - -} |