|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2005, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2013 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 753-758
Link Here
|
| 753 |
{ |
753 |
{ |
| 754 |
if (serverIds[i].equals(serverFactoryId)) |
754 |
if (serverIds[i].equals(serverFactoryId)) |
| 755 |
{ |
755 |
{ |
|
|
756 |
ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId); |
| 757 |
if(desc.allowServiceServersRestriction()) { |
| 758 |
if(desc.isSupportedServer(serverFactoryId)) |
| 759 |
return true; |
| 760 |
else |
| 761 |
continue; |
| 762 |
} |
| 756 |
return true; |
763 |
return true; |
| 757 |
} |
764 |
} |
| 758 |
} |
765 |
} |
|
Lines 967-972
Link Here
|
| 967 |
{ |
974 |
{ |
| 968 |
if (fIds[j].equals(serverFactoryId)) |
975 |
if (fIds[j].equals(serverFactoryId)) |
| 969 |
{ |
976 |
{ |
|
|
977 |
if(desc.allowServiceServersRestriction()) { |
| 978 |
if(desc.isSupportedServer(serverFactoryId)) |
| 979 |
return true; |
| 980 |
else |
| 981 |
continue; |
| 982 |
} |
| 970 |
return true; |
983 |
return true; |
| 971 |
} |
984 |
} |
| 972 |
} |
985 |
} |
|
Lines 1639-1644
Link Here
|
| 1639 |
{ |
1652 |
{ |
| 1640 |
if (serverIds[i].equals(serverFactoryId)) |
1653 |
if (serverIds[i].equals(serverFactoryId)) |
| 1641 |
{ |
1654 |
{ |
|
|
1655 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); |
| 1656 |
if(desc.allowClientServersRestriction()) { |
| 1657 |
if(desc.isSupportedServer(serverFactoryId)) |
| 1658 |
return true; |
| 1659 |
else |
| 1660 |
continue; |
| 1661 |
} |
| 1642 |
return true; |
1662 |
return true; |
| 1643 |
} |
1663 |
} |
| 1644 |
} |
1664 |
} |
|
Lines 1741-1747
Link Here
|
| 1741 |
String[] factoryIds = getServerFactoryIdsByClientRuntime(desc.getId()); |
1761 |
String[] factoryIds = getServerFactoryIdsByClientRuntime(desc.getId()); |
| 1742 |
for (int j=0; j<factoryIds.length; j++) |
1762 |
for (int j=0; j<factoryIds.length; j++) |
| 1743 |
{ |
1763 |
{ |
| 1744 |
if (factoryIds[j].equals(serverFactoryId)) |
1764 |
// Check if the IDs match and the server is supported by the client. |
|
|
1765 |
if (factoryIds[j].equals(serverFactoryId) && !desc.isUnsupportedServer(serverFactoryId)) |
| 1745 |
{ |
1766 |
{ |
| 1746 |
return true; |
1767 |
return true; |
| 1747 |
} |
1768 |
} |
|
Lines 1779-1785
Link Here
|
| 1779 |
if (serverId == null || doesClientRuntimeSupportServer(crIds[i], serverId)) { |
1800 |
if (serverId == null || doesClientRuntimeSupportServer(crIds[i], serverId)) { |
| 1780 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]); |
1801 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]); |
| 1781 |
String thisRuntimeId = desc.getRuntime().getId(); |
1802 |
String thisRuntimeId = desc.getRuntime().getId(); |
| 1782 |
if (thisRuntimeId.equals(runtimeId)) |
1803 |
// Check if the IDs match and the server is supported by the runtime. |
|
|
1804 |
if (thisRuntimeId.equals(runtimeId) && !desc.isUnsupportedServer(serverId)) |
| 1783 |
{ |
1805 |
{ |
| 1784 |
//Get the templates for this clientRuntime |
1806 |
//Get the templates for this clientRuntime |
| 1785 |
Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId()); |
1807 |
Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId()); |
|
Lines 1985-1996
Link Here
|
| 1985 |
*/ |
2007 |
*/ |
| 1986 |
public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId) |
2008 |
public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId) |
| 1987 |
{ |
2009 |
{ |
|
|
2010 |
return getProjectsForClientTypeAndRuntime(typeId, runtimeId, null); |
| 2011 |
} |
| 2012 |
|
| 2013 |
/** |
| 2014 |
* Returns the names of all projects in the workspace which support the given Web service client |
| 2015 |
* implementation type and Web service runtime. |
| 2016 |
* |
| 2017 |
* @param typeId id of a Web service client implementation type |
| 2018 |
* @param runtimeId id of a Web service runtime |
| 2019 |
* @param serverId id of the target server for filtering unsupported server runtimes |
| 2020 |
* @return String[] array of project names. The array may have 0 elements. |
| 2021 |
*/ |
| 2022 |
public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId, String serverId) |
| 2023 |
{ |
| 1988 |
IProject[] projects = FacetUtils.getAllProjects(); |
2024 |
IProject[] projects = FacetUtils.getAllProjects(); |
| 1989 |
ArrayList validProjects = new ArrayList(); |
2025 |
ArrayList validProjects = new ArrayList(); |
| 1990 |
|
2026 |
|
| 1991 |
for (int i=0; i<projects.length;i++) |
2027 |
for (int i=0; i<projects.length;i++) |
| 1992 |
{ |
2028 |
{ |
| 1993 |
if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName())) |
2029 |
if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName(), serverId)) |
| 1994 |
{ |
2030 |
{ |
| 1995 |
validProjects.add(projects[i].getName()); |
2031 |
validProjects.add(projects[i].getName()); |
| 1996 |
} |
2032 |
} |
|
Lines 2016-2022
Link Here
|
| 2016 |
* <li>if projectName is null or empty</li> |
2052 |
* <li>if projectName is null or empty</li> |
| 2017 |
* </ul> |
2053 |
* </ul> |
| 2018 |
*/ |
2054 |
*/ |
| 2019 |
public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) |
2055 |
public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) { |
|
|
2056 |
return doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projectName, null); |
| 2057 |
} |
| 2058 |
|
| 2059 |
/** |
| 2060 |
* Returns whether or not the given project supports the given Web service client implementation type |
| 2061 |
* and Web service runtime. |
| 2062 |
* |
| 2063 |
* @param typeId id of a Web service client implementation type |
| 2064 |
* @param runtimeId id of a Web service runtime |
| 2065 |
* @param projectName name of an IProject in the workspace |
| 2066 |
* @param serverId id of the target server for filtering unsupported server runtimes |
| 2067 |
* @return boolean <code>true</code> if the project supports the given Web service type and |
| 2068 |
* Web service runtime. Returns <code>false</code> |
| 2069 |
* <ul> |
| 2070 |
* <li>if the project does not support the given Web service client implementation type and |
| 2071 |
* Web service runtime or</li> |
| 2072 |
* <li>if the project does not exist or</li> |
| 2073 |
* <li>if projectName is null or empty</li> |
| 2074 |
* </ul> |
| 2075 |
*/ |
| 2076 |
public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName, String serverId) |
| 2020 |
{ |
2077 |
{ |
| 2021 |
String[] descs = getClientRuntimesByType(typeId); |
2078 |
String[] descs = getClientRuntimesByType(typeId); |
| 2022 |
for (int j = 0; j < descs.length; j++) |
2079 |
for (int j = 0; j < descs.length; j++) |
|
Lines 2024-2030
Link Here
|
| 2024 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); |
2081 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); |
| 2025 |
if (desc.getRuntime().getId().equals(runtimeId)) |
2082 |
if (desc.getRuntime().getId().equals(runtimeId)) |
| 2026 |
{ |
2083 |
{ |
| 2027 |
if (doesClientRuntimeSupportProject(descs[j], projectName)) |
2084 |
if (doesClientRuntimeSupportProject(descs[j], projectName, serverId)) |
| 2028 |
{ |
2085 |
{ |
| 2029 |
return true; |
2086 |
return true; |
| 2030 |
} |
2087 |
} |
|
Lines 2049-2056
Link Here
|
| 2049 |
* <li>if projectName is null or empty</li> |
2106 |
* <li>if projectName is null or empty</li> |
| 2050 |
* </ul> |
2107 |
* </ul> |
| 2051 |
*/ |
2108 |
*/ |
| 2052 |
public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) |
2109 |
public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) { |
|
|
2110 |
return doesClientRuntimeSupportProject(clientRuntimeId, projectName, null); |
| 2111 |
} |
| 2112 |
|
| 2113 |
/** |
| 2114 |
* Returns whether or not the given project supports the given clientRuntime. |
| 2115 |
* @param clientRuntimeId id of a clientRuntime |
| 2116 |
* @param projectName name of an IProject in the workspace |
| 2117 |
* @param serverId id of the target server for filtering unsupported server runtimes |
| 2118 |
* @return boolean <code>true</code> if the project supports the given |
| 2119 |
* clientRuntime. Returns <code>false</code> |
| 2120 |
* <ul> |
| 2121 |
* <li>if the project does not support the given clientRuntime or</li> |
| 2122 |
* <li>if the project does not exist or</li> |
| 2123 |
* <li>if projectName is null or empty</li> |
| 2124 |
* </ul> |
| 2125 |
*/ |
| 2126 |
public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName, String serverId) |
| 2053 |
{ |
2127 |
{ |
|
|
2128 |
// Check if there is an unsupported server to filter |
| 2129 |
if(serverId != null) { |
| 2130 |
ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); |
| 2131 |
if(desc.isUnsupportedServer(serverId)) |
| 2132 |
return false; |
| 2133 |
} |
| 2054 |
FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId, projectName); |
2134 |
FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId, projectName); |
| 2055 |
if (fm != null) |
2135 |
if (fm != null) |
| 2056 |
{ |
2136 |
{ |