diff options
author | pmoogk | 2006-08-22 18:22:34 +0000 |
---|---|---|
committer | pmoogk | 2006-08-22 18:22:34 +0000 |
commit | 95acbe3fca146b622bd168a46d3a2cc94495415e (patch) | |
tree | 4bb65afb9717a194618cf7de04a8b76c26390548 /bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal | |
parent | 15a90cdebb8af3a629c57096eec9532017d2856a (diff) | |
download | webtools.webservices-95acbe3fca146b622bd168a46d3a2cc94495415e.tar.gz webtools.webservices-95acbe3fca146b622bd168a46d3a2cc94495415e.tar.xz webtools.webservices-95acbe3fca146b622bd168a46d3a2cc94495415e.zip |
[153833] Allow the Web Service Test extension point to specify the supported client runtime
Diffstat (limited to 'bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal')
3 files changed, 142 insertions, 9 deletions
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java index 5a9456f83..46bea11f7 100644 --- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/WebServiceExtensionRegistryImpl.java @@ -1,12 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 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 + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime *******************************************************************************/ package org.eclipse.jst.ws.internal.ext; @@ -26,9 +29,9 @@ public abstract class WebServiceExtensionRegistryImpl implements WebServiceExten // Copyright public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private Hashtable nameExtensionTable_; - private Vector id_; - private Vector label_; + protected Hashtable nameExtensionTable_; + protected Vector id_; + protected Vector label_; private LabelsAndIds labelsandids_; public WebServiceExtensionRegistryImpl() @@ -58,7 +61,7 @@ public abstract class WebServiceExtensionRegistryImpl implements WebServiceExten * This is done by querying the plugin registry for all extensions * that extend webServiceClientTest */ - private void loadExtensions () + protected void loadExtensions () { IConfigurationElement[] config = getConfigElements(); diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java index 52677cba9..288193988 100644 --- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestExtension.java @@ -10,10 +10,14 @@ * yyyymmdd bug Email and other contact information * -------- -------- ----------------------------------------------------------- * 20060816 104870 kathy@ca.ibm.com - Kathy Chan + * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime *******************************************************************************/ package org.eclipse.jst.ws.internal.ext.test; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.jst.ws.internal.ext.WebServiceExtensionImpl; @@ -29,9 +33,33 @@ public class WebServiceTestExtension extends WebServiceExtensionImpl // Copyright public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; + private List supportedRuntimes_ = new ArrayList(); + public WebServiceTestExtension(IConfigurationElement configElement) { super(configElement); + + String runtimesList = getConfigElement().getAttribute("supportedClientRuntimes"); + + addRuntimes(runtimesList); + } + + /** + * Adds a list of space delimited runtime IDs. + * + * @param runtimesList The list of runtime IDs. + */ + public void addRuntimes(String runtimesList) { + + if (runtimesList == null) + return; + + String[] runtimes = runtimesList.split("\\s+"); + + for (int i = 0; i < runtimes.length; i++) { + if (runtimes[i].length() > 0) + supportedRuntimes_.add(runtimes[i]); + } } /** @@ -115,7 +143,36 @@ public class WebServiceTestExtension extends WebServiceExtensionImpl return false; } - + /** + * Returns the id attribute of this WebServiceTestExtension + * + * @return The value of the id attribute. + */ + public String getId() { + return getConfigElement().getAttribute( "id" ); + } + + /** + * Does this extension allow extenders to restrict the runtimes that are supported? + * + * @return The value of the allowRunimesRestriction attribute, false if not present. + */ + public boolean allowClientRuntimesRestriction() { + return Boolean.valueOf(getConfigElement().getAttribute( "allowClientRuntimesRestriction" )).booleanValue(); + } + + /** + * Determines if this WebServiceTestExtension supports the give client runtime ID. + * + * @return true if the client runtime ID is supported, false otherwise. + */ + public boolean supportsRuntime(String runtimeId) { + + if (!allowClientRuntimesRestriction() || supportedRuntimes_.isEmpty()) + return true; + + return supportedRuntimes_.contains(runtimeId); + } } diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java index 310e3d55c..fdb9adfaf 100644 --- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/ext/test/WebServiceTestRegistry.java @@ -1,16 +1,22 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 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 + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime *******************************************************************************/ package org.eclipse.jst.ws.internal.ext.test; +import java.util.Hashtable; +import java.util.Iterator; + import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.Platform; @@ -42,6 +48,73 @@ public class WebServiceTestRegistry extends WebServiceExtensionRegistryImpl } /** + * Helper method to "join" an existing value and a new value together by + * a space in between. Handles special case when either value is null. + * + * @param existingValue The existing value + * @param newValue The new value + * @return If eiter the existing or new value is null, simply returns the + * new value as is (which could be null). Otherwise returns the value joined + * by a space. + */ + private String genNewValue(String existingValue, String newValue) { + + if (existingValue == null || newValue == null) + return newValue; + + return existingValue + " " + newValue; + } + + /* (non-Javadoc) + * @see org.eclipse.jst.ws.internal.ext.WebServiceExtensionRegistryImpl#loadExtensions() + */ + protected void loadExtensions () + { + // keep track of the support runtimes for each test facility ID + Hashtable supportedClientRuntimes = new Hashtable(); + + IConfigurationElement[] config = getConfigElements(); + + for(int idx=0; idx<config.length; idx++) + { + IConfigurationElement elem = config[idx]; + String label = elem.getAttribute( "label" ); + String id = elem.getAttribute( "id" ); + + // label is found, hence we have a master extension element + if (label != null) { + WebServiceExtension webServiceExtension = createWebServiceExtension(elem); + nameExtensionTable_.put(label,webServiceExtension); + label_.add(label); + id_.add(id); + } + + // slave extension element, which only has the id and supportedClientRuntimes attributes + else { + String existingValue = (String) supportedClientRuntimes.get(id); + String newValue = genNewValue(existingValue, elem.getAttribute("supportedClientRuntimes")); + + if (newValue != null) + supportedClientRuntimes.put(id, newValue); + } + } + + // merge any supportedClientRuntimes attributes from the slave elements back to the master elements + + Iterator iter = nameExtensionTable_.values().iterator(); + + while (iter.hasNext()) { + WebServiceTestExtension webServiceTestExtension = (WebServiceTestExtension) iter.next(); + + // skip if the extension does not allow restriction on the supported client runtimes + if (webServiceTestExtension.allowClientRuntimesRestriction()) { + String id = webServiceTestExtension.getId(); + webServiceTestExtension.addRuntimes((String) supportedClientRuntimes.get(id)); + } + } + } + + /** * Children registries will have different extension types * @return WebserviceExtension holds a config elem * for that extension capable of creating an executable file |