diff options
author | kchong | 2013-08-27 17:00:33 +0000 |
---|---|---|
committer | kchong | 2013-08-27 17:00:33 +0000 |
commit | b18154dc34e9763c81ac5481be4051369f848277 (patch) | |
tree | 0c9f2c46b81deaee3e896b60d6397484b784f10b | |
parent | 636bfb46656bd1b4f9d1c1c285bd24f136b07100 (diff) | |
download | webtools.webservices-R3_4_2_patches.tar.gz webtools.webservices-R3_4_2_patches.tar.xz webtools.webservices-R3_4_2_patches.zip |
[400036] Restrict supported servers for client and service runtimes v201308271701R3_4_2_patches
[415168] Restrict supported servers for client and service runtimes -
supportedServers bug
3 files changed, 87 insertions, 4 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java index 39b5413a6..31343645f 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 @@ -49,6 +49,7 @@ public class ClientRuntimeDescriptor private Set<String> suitableProjectTemplates; private Set<String> unsuitableProjectTemplates; private boolean allowClientServerRestriction; + private List<String> supportedServers; private List<String> unsupportedServers; public ClientRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceClientImpls, Hashtable allRuntimes) @@ -229,7 +230,39 @@ public class ClientRuntimeDescriptor public boolean allowClientServersRestriction() { return allowClientServerRestriction; } - + + /** + * Note that only the supported or unsupported attribute should be used, not both. + */ + public boolean isSupportedServer(String id) { + if(!allowClientServerRestriction) + return false; + + String serverElements = elem.getAttribute("supportedServers"); + // Extension defines supportedServers + if (supportedServers == null) + supportedServers = parseServers(serverElements); + // If the extension does not define supportedServers but defines unsupportedServers + // This is for the case when a server does not support a particular client runtime + if (serverElements == null) + { + String unsupportedServerElements = elem.getAttribute("unsupportedServers"); + if (unsupportedServers == null) + unsupportedServers = parseServers(unsupportedServerElements); + // If it is not in the unsupported list, then it must be supported, as extensions should + // not have to list off all the possible supported servers (and since currently only one + // of unsupportedServer or supportedServers is recognized). + if (!unsupportedServers.contains(id) && !supportedServers.contains(id)) + { + supportedServers.add(id); + } + } + return supportedServers.contains(id); + } + + /** + * Note that only the supported or unsupported attribute should be used, not both. + */ public boolean isUnsupportedServer(String id) { if(!allowClientServerRestriction) return false; diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java index 2397cbee7..b653469f1 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 @@ -22,6 +22,7 @@ package org.eclipse.jst.ws.internal.consumption.ui.wsrt; import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; +import java.util.List; import java.util.Set; import org.eclipse.core.runtime.CoreException; @@ -39,6 +40,7 @@ public class ServiceRuntimeDescriptor private IConfigurationElement elem; private Hashtable allWebServiceImpls; private Hashtable allRuntimes; + private boolean allowServiceServerRestriction; private String id; private WebServiceImpl serviceImplementationType; private RuntimeDescriptor runtime; @@ -52,6 +54,7 @@ public class ServiceRuntimeDescriptor private String runtimePreferredServerType; private Set<String> suitableProjectTemplates; private Set<String> unsuitableProjectTemplates; + private List<String> supportedServers; public ServiceRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceImpls, Hashtable allRuntimes) { @@ -59,6 +62,7 @@ public class ServiceRuntimeDescriptor this.allWebServiceImpls = allWebServiceImpls; this.allRuntimes = allRuntimes; + allowServiceServerRestriction = Boolean.parseBoolean(elem.getAttribute("allowServiceServerRestriction")); bottomUp = (Boolean.valueOf(elem.getAttribute("bottomUp"))).booleanValue(); topDown = (Boolean.valueOf(elem.getAttribute("topDown"))).booleanValue(); } @@ -252,4 +256,30 @@ public class ServiceRuntimeDescriptor } return runtimePreferredServerType; } + + public boolean allowServiceServersRestriction() { + return allowServiceServerRestriction; + } + + public boolean isSupportedServer(String id) { + if(!allowServiceServerRestriction) + return false; + if(supportedServers == null) { + String serverElements = elem.getAttribute("supportedServers"); + supportedServers = parseServers(serverElements); + } + return supportedServers.contains(id); + } + + private List<String> parseServers(String serverElements) { + List<String> serverList = new ArrayList<String>(); + if(serverElements != null) { + String[] servers = serverElements.split("\\s+"); + for (int i = 0; i < servers.length; i++) { + if (servers[i].length() > 0) + serverList.add(servers[i]); + } + } + return serverList; + } } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java index 5342c0925..ef218729f 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 @@ -753,6 +753,13 @@ public class WebServiceRuntimeExtensionUtils2 { if (serverIds[i].equals(serverFactoryId)) { + ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId); + if(desc.allowServiceServersRestriction()) { + if(desc.isSupportedServer(serverFactoryId)) + return true; + else + continue; + } return true; } } @@ -967,6 +974,12 @@ public class WebServiceRuntimeExtensionUtils2 { if (fIds[j].equals(serverFactoryId)) { + if(desc.allowServiceServersRestriction()) { + if(desc.isSupportedServer(serverFactoryId)) + return true; + else + continue; + } return true; } } @@ -1639,6 +1652,13 @@ public class WebServiceRuntimeExtensionUtils2 { if (serverIds[i].equals(serverFactoryId)) { + ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); + if(desc.allowClientServersRestriction()) { + if(desc.isSupportedServer(serverFactoryId)) + return true; + else + continue; + } return true; } } |