Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 232393 Details for
Bug 410843
Unsupported servers cannot be removed from list of generic client runtimes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Apply to 3.2.5p org.eclipse.jst.ws.consumption.ui
bug410843-410844-325p-patch.txt (text/plain), 15.67 KB, created by
Keith Chong
on 2013-06-14 13:43:26 EDT
(
hide
)
Description:
Apply to 3.2.5p org.eclipse.jst.ws.consumption.ui
Filename:
MIME Type:
Creator:
Keith Chong
Created:
2013-06-14 13:43:26 EDT
Size:
15.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.ws.consumption.ui >Index: src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java >=================================================================== >RCS file: /cvsroot/webtools/webservices/plugins/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java,v >retrieving revision 1.49.2.1 >diff -u -r1.49.2.1 ProjectSelectionWidget.java >--- src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java 15 Oct 2010 15:42:41 -0000 1.49.2.1 >+++ src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java 14 Jun 2013 17:36:10 -0000 >@@ -289,13 +289,14 @@ > listenersOff(); > String selectedModuleProject = moduleProject_.getText(); > String runtimeId = trsIds_.getRuntimeId(); >+ String serverId = trsIds_.getServerId(); > String typeId = trsIds_.getTypeId(); > > //Get all the projects that are compatible with the type and runtime > String[] projectNames = null; > if (isClient_) > { >- projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(typeId, runtimeId); >+ projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(typeId, runtimeId, serverId); > } > else > { >Index: src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java >=================================================================== >RCS file: /cvsroot/webtools/webservices/plugins/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java,v >retrieving revision 1.8.10.1 >diff -u -r1.8.10.1 ClientRuntimeDescriptor.java >--- src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java 17 Aug 2010 19:05:58 -0000 1.8.10.1 >+++ src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java 14 Jun 2013 17:36:10 -0000 >@@ -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 >@@ -20,6 +20,7 @@ > 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; >@@ -47,12 +48,17 @@ > private String runtimePreferredServerType; > 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) > { > this.elem = elem; > this.allWebServiceClientImpls = allWebServiceClientImpls; > this.allRuntimes = allRuntimes; >+ >+ allowClientServerRestriction = Boolean.parseBoolean(elem.getAttribute("allowClientServerRestriction")); > } > > public WebServiceClientImpl getClientImplementationType() >@@ -220,4 +226,46 @@ > } > return runtimePreferredServerType; > } >+ >+ 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; >+ if(supportedServers == null) { >+ String serverElements = elem.getAttribute("supportedServers"); >+ supportedServers = parseServers(serverElements); >+ } >+ 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; >+ if(unsupportedServers == null) { >+ String serverElements = elem.getAttribute("unsupportedServers"); >+ unsupportedServers = parseServers(serverElements); >+ } >+ return unsupportedServers.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; >+ } > } >Index: src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java >=================================================================== >RCS file: /cvsroot/webtools/webservices/plugins/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java,v >retrieving revision 1.12.4.1 >diff -u -r1.12.4.1 ServiceRuntimeDescriptor.java >--- src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java 17 Aug 2010 19:05:58 -0000 1.12.4.1 >+++ src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java 14 Jun 2013 17:36:10 -0000 >@@ -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 @@ > 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 @@ > 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 @@ > 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 @@ > 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 @@ > } > 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; >+ } > } >Index: src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java >=================================================================== >RCS file: /cvsroot/webtools/webservices/plugins/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java,v >retrieving revision 1.25.2.2 >diff -u -r1.25.2.2 WebServiceRuntimeExtensionUtils2.java >--- src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java 8 Dec 2010 16:52:58 -0000 1.25.2.2 >+++ src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java 14 Jun 2013 17:36:10 -0000 >@@ -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 @@ > { > 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 @@ > { > if (fIds[j].equals(serverFactoryId)) > { >+ if(desc.allowServiceServersRestriction()) { >+ if(desc.isSupportedServer(serverFactoryId)) >+ return true; >+ else >+ continue; >+ } > return true; > } > } >@@ -1639,6 +1652,13 @@ > { > if (serverIds[i].equals(serverFactoryId)) > { >+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); >+ if(desc.allowClientServersRestriction()) { >+ if(desc.isSupportedServer(serverFactoryId)) >+ return true; >+ else >+ continue; >+ } > return true; > } > } >@@ -1741,7 +1761,8 @@ > String[] factoryIds = getServerFactoryIdsByClientRuntime(desc.getId()); > for (int j=0; j<factoryIds.length; j++) > { >- if (factoryIds[j].equals(serverFactoryId)) >+ // Check if the IDs match and the server is supported by the client. >+ if (factoryIds[j].equals(serverFactoryId) && !desc.isUnsupportedServer(serverFactoryId)) > { > return true; > } >@@ -1779,7 +1800,8 @@ > if (serverId == null || doesClientRuntimeSupportServer(crIds[i], serverId)) { > ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]); > String thisRuntimeId = desc.getRuntime().getId(); >- if (thisRuntimeId.equals(runtimeId)) >+ // Check if the IDs match and the server is supported by the runtime. >+ if (thisRuntimeId.equals(runtimeId) && !desc.isUnsupportedServer(serverId)) > { > //Get the templates for this clientRuntime > Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId()); >@@ -1985,12 +2007,26 @@ > */ > public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId) > { >+ return getProjectsForClientTypeAndRuntime(typeId, runtimeId, null); >+ } >+ >+ /** >+ * Returns the names of all projects in the workspace which support the given Web service client >+ * implementation type and Web service runtime. >+ * >+ * @param typeId id of a Web service client implementation type >+ * @param runtimeId id of a Web service runtime >+ * @param serverId id of the target server for filtering unsupported server runtimes >+ * @return String[] array of project names. The array may have 0 elements. >+ */ >+ public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId, String serverId) >+ { > IProject[] projects = FacetUtils.getAllProjects(); > ArrayList validProjects = new ArrayList(); > > for (int i=0; i<projects.length;i++) > { >- if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName())) >+ if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName(), serverId)) > { > validProjects.add(projects[i].getName()); > } >@@ -2016,7 +2052,28 @@ > * <li>if projectName is null or empty</li> > * </ul> > */ >- public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) >+ public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) { >+ return doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projectName, null); >+ } >+ >+ /** >+ * Returns whether or not the given project supports the given Web service client implementation type >+ * and Web service runtime. >+ * >+ * @param typeId id of a Web service client implementation type >+ * @param runtimeId id of a Web service runtime >+ * @param projectName name of an IProject in the workspace >+ * @param serverId id of the target server for filtering unsupported server runtimes >+ * @return boolean <code>true</code> if the project supports the given Web service type and >+ * Web service runtime. Returns <code>false</code> >+ * <ul> >+ * <li>if the project does not support the given Web service client implementation type and >+ * Web service runtime or</li> >+ * <li>if the project does not exist or</li> >+ * <li>if projectName is null or empty</li> >+ * </ul> >+ */ >+ public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName, String serverId) > { > String[] descs = getClientRuntimesByType(typeId); > for (int j = 0; j < descs.length; j++) >@@ -2024,7 +2081,7 @@ > ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); > if (desc.getRuntime().getId().equals(runtimeId)) > { >- if (doesClientRuntimeSupportProject(descs[j], projectName)) >+ if (doesClientRuntimeSupportProject(descs[j], projectName, serverId)) > { > return true; > } >@@ -2049,8 +2106,31 @@ > * <li>if projectName is null or empty</li> > * </ul> > */ >- public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) >+ public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) { >+ return doesClientRuntimeSupportProject(clientRuntimeId, projectName, null); >+ } >+ >+ /** >+ * Returns whether or not the given project supports the given clientRuntime. >+ * @param clientRuntimeId id of a clientRuntime >+ * @param projectName name of an IProject in the workspace >+ * @param serverId id of the target server for filtering unsupported server runtimes >+ * @return boolean <code>true</code> if the project supports the given >+ * clientRuntime. Returns <code>false</code> >+ * <ul> >+ * <li>if the project does not support the given clientRuntime or</li> >+ * <li>if the project does not exist or</li> >+ * <li>if projectName is null or empty</li> >+ * </ul> >+ */ >+ public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName, String serverId) > { >+ // Check if there is an unsupported server to filter >+ if(serverId != null) { >+ ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); >+ if(desc.isUnsupportedServer(serverId)) >+ return false; >+ } > FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId, projectName); > if (fm != null) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 410843
: 232393