diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder')
7 files changed, 0 insertions, 941 deletions
diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/AbstractWebServiceLocator.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/AbstractWebServiceLocator.java deleted file mode 100644 index da446710a..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/AbstractWebServiceLocator.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * -------- -------- ----------------------------------------------------------- - * 20060317 127456 cbrealey@ca.ibm.com - Chris Brealey - * 20060620 147862 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * @author joan - * - * Implementation of IWebServiceLocator. Extenders must implement the abstract method getWebServices(). - * This class will be used to provide methods useful to locator implementers. Extenders should register their - * locator implementation with their plugin using the org.eclipse.wst.ws.locator extension point. - * - */ -public abstract class AbstractWebServiceLocator implements IWebServiceLocator { - - /** - * Creates a new instance of this class. - */ - public AbstractWebServiceLocator () - { - super(); - } - - /** - * Returns a list of WebServiceClientInfo objects. - * Subclasses should override this method's - * default behaviour of returning an empty list. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A non-null but possibly empty list of WebServiceClientInfo objects - */ - public List getWebServiceClients ( IProgressMonitor monitor ) - { - return Collections.EMPTY_LIST; - } - - /** - * Returns a list of WebServiceClientInfo objects. - * Subclasses should override this method's - * default behaviour of returning an empty list. - * @param projects One or more projects to which - * the search should be limited. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A non-null but possibly empty list of WebServiceClientInfo objects - */ - public List getWebServiceClients ( IProject[] projects, IProgressMonitor monitor ) - { - return Collections.EMPTY_LIST; - } - - /** - * Returns a list of WebServiceInfo objects. - * Subclasses should override this method's - * default behaviour of returning an empty list. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A non-null but possibly empty list of WebServiceInfo objects - */ - public List getWebServices ( IProgressMonitor monitor ) - { - return Collections.EMPTY_LIST; - } - - /** - * Returns a list of WebServiceInfo objects. - * Subclasses should override this method's - * default behaviour of returning an empty list. - * @param projects One or more projects to which - * the search should be limited. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A non-null but possibly empty list of WebServiceInfo objects - */ - public List getWebServices ( IProject[] projects, IProgressMonitor monitor ) - { - return Collections.EMPTY_LIST; - } -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/IWebServiceLocator.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/IWebServiceLocator.java deleted file mode 100644 index b35331a64..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/IWebServiceLocator.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * -------- -------- ----------------------------------------------------------- - * 20060317 127456 cbrealey@ca.ibm.com - Chris Brealey - * 20060620 147862 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * @author joan - * - * Interface for Web service locators that will be retrieved - * by the WebServiceFinder. This interface should not be - * implemented directly. Instead, subclasses should extend - * AbstractWebServiceLocator and implement the - * getWebServices() and getWebServiceClients() methods. - */ -public interface IWebServiceLocator -{ - /** - * Returns a list of WebServiceClientInfo objects. - * This operation may be long running. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A list of WebServiceClientInfo objects. - * possibly empty, possibly null. - */ - public List getWebServiceClients ( IProgressMonitor monitor ); - - /** - * Returns a list of WebServiceClientInfo objects. - * This operation may be long running. - * @param projects One or more projects to which the - * search should be limited. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A list of WebServiceClientInfo objects. - * possibly empty, possibly null. - */ - public List getWebServiceClients ( IProject[] projects, IProgressMonitor monitor ); - - /** - * Returns a list of WebServiceInfo objects. - * This operation may be long running. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A list of WebServiceInfo objects, - * possibly empty, possibly null. - */ - public List getWebServices ( IProgressMonitor monitor ); - - /** - * Returns a list of WebServiceInfo objects. - * This operation may be long running. - * @param projects One or more projects to which the - * search should be limited. - * @param monitor A progress monitor, - * or null if progress monitoring is not desired. - * @return A list of WebServiceInfo objects, - * possibly empty, possibly null. - */ - public List getWebServices ( IProject[] projects, IProgressMonitor monitor ); -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceCategory.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceCategory.java deleted file mode 100644 index bc5853e60..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceCategory.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * -------- -------- ----------------------------------------------------------- - * 20060317 127456 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import org.eclipse.core.runtime.IConfigurationElement; - -/** - * @author cbrealey - * A WebServiceCategory represents a defined category of - * Web service locators plugged into the WebServiceFinder - * framework. Each category has a non-translatable identifier, - * an optional non-translatable parent category identifier - * (absent for root categories), a translatable short label, - * a translatable long description and an icon. - * @see WebServiceFinder#getWebServiceCategories() - */ -public class WebServiceCategory -{ - private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ - private static final String ATTRIBUTE_CATEGORY = "category"; //$NON-NLS-1$ - private static final String ATTRIBUTE_LABEL = "label"; //$NON-NLS-1$ - private static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$ - private static final String ATTRIBUTE_ICON = "icon"; //$NON-NLS-1$ - - private IConfigurationElement ice_; - - /** - * Constructs a new WebServiceCategory for the given - * configuration element from the extension registry. - * @param ice The configuration element on which this - * new WebServiceCategory is based. - */ - public WebServiceCategory ( IConfigurationElement ice ) - { - ice_ = ice; - } - - /** - * Returns the non-translatable identifier of this category. - * @return The non-translatable identifier of this category. - * This should never be null. - */ - public String getId () - { - return ice_.getAttributeAsIs(ATTRIBUTE_ID); - } - - /** - * Returns the non-translatable identifier of this category's - * immediate parent category, or null if this is a root category - * and, as such, has no parent category. - * @return The non-translatable identifier of this category's - * parent, or null if there is none. - */ - public String getParentId () - { - return ice_.getAttributeAsIs(ATTRIBUTE_CATEGORY); - } - - /** - * Returns this category's immediate parent WebServiceCategory, or - * null if this is a root category and, as such, has no parent category. - * @return This category's immediate parent WebServiceCategory, or - * null if there is none. - */ - public WebServiceCategory getParent () - { - return WebServiceFinder.instance().getWebServiceCategoryById(getParentId()); - } - - /** - * Returns the internationalized short label of this category, - * or null if there is none. Note that user interfaces may - * choose to bypass categories that do not have a label. - * @return The internationalized short label of this category, - * or null if there is none. - */ - public String getLabel () - { - return ice_.getAttributeAsIs(ATTRIBUTE_LABEL); - } - - /** - * Returns the internationalized description of this category, - * or null if there is none. - * @return The internationalized description of this category, - * or null if there is none. - */ - public String getDescription () - { - return ice_.getAttributeAsIs(ATTRIBUTE_DESCRIPTION); - } - - /** - * Returns the icon of this category, or null if there is none. - * @return The icon of this category, or null if there is none. - */ - public String getIcon () - { - return ice_.getAttributeAsIs(ATTRIBUTE_ICON); - } -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceFinder.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceFinder.java deleted file mode 100644 index 210d99f82..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceFinder.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * -------- -------- ----------------------------------------------------------- - * 20060317 127456 cbrealey@ca.ibm.com - Chris Brealey - * 20060620 147862 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import java.util.Iterator; -import java.util.LinkedList; -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; - -/** - * @author joan - * - * WebServiceFinder is a singleton which finds all extenders and returns a comprehensive list of WebServiceInfo objects. - * Finds web services by calling locators extending {@link org.eclipse.wst.ws.internal.wsfinder.AbstractWebServiceLocator} - * which have been registered with {@link org.eclipse.wst.ws.internal.wsfinder.WebServiceLocatorRegistry}. - */ -public class WebServiceFinder { - - private static WebServiceFinder instance = null; - - private static final String ELEMENT_LOCATOR = "webServiceLocator"; //$NON-NLS-1$ - private static final String ELEMENT_CATEGORY = "webServiceLocatorCategory"; //$NON-NLS-1$ - private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ - private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$ - private static final String ATTRIBUTE_CATEGORY = "category"; //$NON-NLS-1$ -// private static final String ATTRIBUTE_LABEL = "label"; //$NON-NLS-1$ -// private static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$ -// private static final String ATTRIBUTE_ICON = "icon"; //$NON-NLS-1$ - - /* - * Public construction is not allowed. - * Use WebServiceFinder.instance(). - */ - private WebServiceFinder () - { - super(); - } - - /** - * Returns the singleton of <code>WebServiceFinder</code>. - * @return The singleton of <code>WebServiceFinder</code>. - */ - public static WebServiceFinder instance () - { - if (instance == null) - { - instance = new WebServiceFinder(); - } - return instance; - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point. Currently returns all web - * services found for all registered locators. Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServices ( IProgressMonitor monitor ) - { - return getWebServicesByCategoryId(null,monitor); - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point. Currently returns all web - * services found in the context of the given projects for all registered locators. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServices ( IProject[] projects, IProgressMonitor monitor ) - { - return getWebServicesByCategoryId(null,projects,monitor); - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param category The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServicesByCategory ( WebServiceCategory category, IProgressMonitor monitor ) - { - return getWebServicesByCategoryId(category == null ? null : category.getId(),monitor); - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * The search is constrained to the given set of one or more projects. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param category The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServicesByCategory ( WebServiceCategory category, IProject[] projects, IProgressMonitor monitor ) - { - return getWebServicesByCategoryId(category == null ? null : category.getId(),projects,monitor); - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param categoryId The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServicesByCategoryId ( String categoryId, IProgressMonitor monitor ) - { - return getWebServicesByCategoryId(categoryId,null,monitor); - } - - /** - * Returns an iterator of WebServiceInfo objects which represent web services found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * The search is constrained to the given set of one or more projects. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the - * web services found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo - * objects returned. This is left to the locator implementations. - * @param categoryId The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceInfo objects, never null. - */ - public Iterator getWebServicesByCategoryId ( String categoryId, IProject[] projects, IProgressMonitor monitor ) - { - LinkedList webServices = new LinkedList(); - WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance(); - IConfigurationElement[] regElements = wslr.getConfigElements(); - for (int i = 0; i < regElements.length; i++) - { - if (ELEMENT_LOCATOR.equals(regElements[i].getName())) - { - try - { - if (categoryId == null || categoryId.equals(regElements[i].getAttributeAsIs(ATTRIBUTE_CATEGORY))) - { - Object obj = regElements[i].createExecutableExtension(ATTRIBUTE_CLASS); - if (obj instanceof IWebServiceLocator) - { - IWebServiceLocator wsl = (IWebServiceLocator)obj; - List wsList = projects == null ? wsl.getWebServices(monitor) : wsl.getWebServices(projects,monitor); - if (wsList != null) - { - webServices.addAll(wsList); - } - } - } - } - catch (CoreException ex) - { - // Quietly bypass any IWebServiceLocators that failed to be loaded. - } - } - } - return webServices.iterator(); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point. Currently returns all web - * service clients found for all registered locators. Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClients ( IProgressMonitor monitor ) - { - return getWebServiceClientsByCategoryId(null,monitor); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point. Currently returns all web - * service clients found for all registered locators in the context of the given projects. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClients ( IProject[] projects, IProgressMonitor monitor ) - { - return getWebServiceClientsByCategoryId(null,projects,monitor); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param category The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClientsByCategory ( WebServiceCategory category, IProgressMonitor monitor ) - { - return getWebServiceClientsByCategoryId(category == null ? null : category.getId(),monitor); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * The search is constrained to the given set of one or more projects. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param category The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClientsByCategory ( WebServiceCategory category, IProject[] projects, IProgressMonitor monitor ) - { - return getWebServiceClientsByCategoryId(category == null ? null : category.getId(),projects,monitor); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param categoryId The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClientsByCategoryId ( String categoryId, IProgressMonitor monitor ) - { - return getWebServiceClientsByCategoryId(categoryId,null,monitor); - } - - /** - * Returns an iterator of WebServiceClientInfo objects which represent web service clients found by locators that - * have registered using the org.eclipse.wst.ws.locator extension point under the given category. - * The search is constrained to the given set of one or more projects. - * Locators must extend {@link AbstractWebServiceLocator}. - * Callers can use the getter methods on the WebServiceClientInfo object to retrieve information on the - * web service clients found. The WebServiceFinder cannot guarantee the level of detail contained in WebServiceClientInfo - * objects returned. This is left to the locator implementations. - * @param categoryId The category of locators to use. - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return An iterator of WebServiceClientInfo objects, never null. - */ - public Iterator getWebServiceClientsByCategoryId ( String categoryId, IProject[] projects, IProgressMonitor monitor ) - { - LinkedList webServiceClients = new LinkedList(); - WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance(); - IConfigurationElement[] regElements = wslr.getConfigElements(); - for (int i = 0; i < regElements.length; i++) - { - if (ELEMENT_LOCATOR.equals(regElements[i].getName())) - { - try - { - if (categoryId == null || categoryId.equals(regElements[i].getAttributeAsIs(ATTRIBUTE_CATEGORY))) - { - Object obj = regElements[i].createExecutableExtension(ATTRIBUTE_CLASS); - if (obj instanceof IWebServiceLocator) - { - IWebServiceLocator wsl = (IWebServiceLocator)obj; - List wsList = projects == null ? wsl.getWebServiceClients(monitor) : wsl.getWebServiceClients(projects,monitor); - if (wsList != null) - { - webServiceClients.addAll(wsList); - } - } - } - } - catch (CoreException ex) - { - // Quietly bypass any IWebServiceLocators that failed to be loaded. - } - } - } - return webServiceClients.iterator(); - } - - /** - * Returns an array of registered Web Service Category IDs. - * @return An array, never null but possibly empty, - * of registered Web Service Category descriptors. - */ - public WebServiceCategory[] getWebServiceCategories () - { - LinkedList categories = new LinkedList(); - WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance(); - IConfigurationElement[] regElements = wslr.getConfigElements(); - for (int i = 0; i < regElements.length; i++) - { - if (ELEMENT_CATEGORY.equals(regElements[i].getName())) - { - categories.add(new WebServiceCategory(regElements[i])); - } - } - return (WebServiceCategory[])categories.toArray(new WebServiceCategory[0]); - - } - - /** - * Returns an array of registered Web Service Category IDs. - * @return An array, never null but possibly empty, - * of registered Web Service Category IDs. - */ - public String[] getWebServiceCategoryIds () - { - LinkedList categories = new LinkedList(); - WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance(); - IConfigurationElement[] regElements = wslr.getConfigElements(); - for (int i = 0; i < regElements.length; i++) - { - if (ELEMENT_CATEGORY.equals(regElements[i].getName())) - { - String id = regElements[i].getAttributeAsIs(ATTRIBUTE_ID); - if (id != null) - { - categories.add(id); - } - } - } - return (String[])categories.toArray(new String[0]); - } - - /** - * Returns the WebServiceCategory with the given ID, - * or null if there is none. - * @param categoryId The ID of the category to find. - * @return The matching category descriptor, or null if there is none. - */ - public WebServiceCategory getWebServiceCategoryById ( String categoryId ) - { - WebServiceCategory category = null; - if (categoryId != null) - { - WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance(); - IConfigurationElement[] regElements = wslr.getConfigElements(); - for (int i = 0; i < regElements.length; i++) - { - if (ELEMENT_CATEGORY.equals(regElements[i].getName())) - { - String id = regElements[i].getAttributeAsIs(ATTRIBUTE_ID); - if (categoryId.equals(id)) - { - return new WebServiceCategory(regElements[i]); - } - } - } - } - return category; - } -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorExtension.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorExtension.java deleted file mode 100644 index 9542b0182..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorExtension.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.ext.WebServiceExtensionImpl; - -/** - * @author joan - * - * This class is provided for the addition of locator extension specific functions - * - */ - -public class WebServiceLocatorExtension extends WebServiceExtensionImpl { - -// Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public WebServiceLocatorExtension(IConfigurationElement configElement) - { - super(configElement); - } -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorRegistry.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorRegistry.java deleted file mode 100644 index 23d6bffd5..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WebServiceLocatorRegistry.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.ws.internal.ext.WebServiceExtension; -import org.eclipse.wst.ws.internal.ext.WebServiceExtensionRegistryImpl; - -/** - * @author joan - * - * Retrieves locators which extend {@link org.eclipse.wst.ws.internal.wsfinder.AbstractWebServiceLocator}. - * Locators must create an extension for the org.eclipse.wst.ws.locator extension point in order to be retrieved by - * the registry. - */ - - -public class WebServiceLocatorRegistry extends WebServiceExtensionRegistryImpl { - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - /* - * This is a singleton becasue it was decided that the memory foot print - * is not as expensive as the time taken retrieving the data - * - */ - - - private static WebServiceLocatorRegistry wslr; - - public static WebServiceLocatorRegistry getInstance() - { - if(wslr == null) wslr = new WebServiceLocatorRegistry(); - return wslr; - } - - private WebServiceLocatorRegistry() - { - super(); - } - - /** - * Children registries will have different extension types - * @return WebserviceExtension holds a config elem - * for that extension capable of creating an executable file - */ - public WebServiceExtension createWebServiceExtension(IConfigurationElement configElement) - { - return new WebServiceLocatorExtension(configElement); - } - - /** - * Contacts platform registry and gets all locators which have registered - * using the org.eclipse.wst.ws.locator extension point. - * @return IConfigurationElement[] an array of elements which contain locators - * extending AbstractWebServiceLocator. - */ - public IConfigurationElement[] getConfigElements() - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.wst.ws", - "locator"); - return config; - } - -} diff --git a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WorkspaceWSDLLocator.java b/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WorkspaceWSDLLocator.java deleted file mode 100644 index 7430dd879..000000000 --- a/bundles/org.eclipse.wst.ws/src/org/eclipse/wst/ws/internal/wsfinder/WorkspaceWSDLLocator.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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 - * -------- -------- ----------------------------------------------------------- - * 20060317 127456 cbrealey@ca.ibm.com - Chris Brealey - * 20060620 147862 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.wsfinder; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo; - -/** - * Extends the Web Services Finder Framework. - * Finds all .wsdl files in the workspace. - * Not intended to be used directly. WorkspaceWSDLLocator registers with WebServiceLocatorRegistry - * and is accessed by the {@link WebServiceFinder}. - */ - -public class WorkspaceWSDLLocator extends AbstractWebServiceLocator -{ - - protected List wsdlServices = null; - private static final String PLATFORM_RES = "platform:/resource"; //$NON-NLS-1$ - private static final String WSDL_EXT = "wsdl"; //$NON-NLS-1$ - - public WorkspaceWSDLLocator() - { - super(); - } - - /** - * Returns the collection of all .wsdl files in the workspace. Currently does not eliminate multiple - * occurences of the same web service. - * - * TODO: add a listener to the workspace resource tree so that getWebServices doesn't always - * use the WSDLVisitor to walk the entire resource tree. That should only happen once. After - * that the resource tree can be monitored for modifications to .wsdl files and changes made to a cache. - * - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return list of WebServiceInfo objects, possibly null. - */ - public List getWebServices (IProgressMonitor monitor) - { - if (wsdlServices == null) - { - try - { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - WSDLVisitor visitor = new WSDLVisitor(); - root.accept(visitor); - wsdlServices = visitor.getWSDL(); - } - catch (Exception ex) - { - // Do nothing. - } - } - return wsdlServices; - } - - /** - * Returns the collection of all .wsdl files in the given project. - * Currently does not eliminate multiple occurences of the same web service. - * - * TODO: add a listener to the workspace resource tree so that getWebServices doesn't always - * use the WSDLVisitor to walk the entire resource tree. That should only happen once. After - * that the resource tree can be monitored for modifications to .wsdl files and changes made to a cache. - * - * @param monitor A progress monitor, or null if progress monitoring is not desired. - * @return list of WebServiceInfo objects - */ - public List getWebServices (IProject[] projects, IProgressMonitor monitor) - { - WSDLVisitor visitor = new WSDLVisitor(); - if (projects != null) - { - for (int p=0; p<projects.length; p++) - { - try - { - projects[p].accept(visitor); - } - catch (CoreException ex) - { - // Do nothing. - } - } - } - return visitor.getWSDL(); - } - - /** - * Uses the Visitor pattern to walk the workspace resource tree - */ - private class WSDLVisitor implements IResourceVisitor - { - - private Vector wsdl = new Vector(); - - /** - * visits every node on the resource tree stopping a file resources - * if file resource has extension .wsdl a WebServiceInfo object is created and added to a vector - * TODO: look at caching to eliminate duplicate web service definitions in the vector returned - * TODO: add more information to the WebServiceInfo object. Currently only the qualified filename is added. - */ - public boolean visit(IResource resource) - { - if (resource.getType() == IResource.FILE) - { - String ext = resource.getFileExtension(); - if (ext != null && ext.equalsIgnoreCase(WSDL_EXT)) - { - String urlString = PLATFORM_RES + resource.getFullPath().toString(); - WebServiceInfo wsInfo = new WebServiceInfo(); - wsInfo.setWsdlURL(urlString); - wsdl.add(wsInfo); - } - } - return true; - } - - /** - * Returns a vector of WebServiceInfo objects. - * @return vector of WebServiceInfo objects - */ - public Vector getWSDL() - { - return wsdl; - } - } -} |