Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 126529 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+2 lines)
Lines 17-22 Link Here
17
17
18
# Extension point names
18
# Extension point names
19
XP_WEB_SERVICE_LOCATOR=Web Service Locator
19
XP_WEB_SERVICE_LOCATOR=Web Service Locator
20
X_WEB_SERVICE_LOCATOR_WORKSPACE=Workspace Web Service Locator
21
X_WEB_SERVICE_LOCATOR_CATEGORY_WORKSPACE=Workspace WSDL documents
20
22
21
MSG_ERROR_UNABLE_TO_START_MONITOR=IWAB0001E Unable to monitor port {0} of {1}.
23
MSG_ERROR_UNABLE_TO_START_MONITOR=IWAB0001E Unable to monitor port {0} of {1}.
22
24
(-)plugin.xml (-2 / +10 lines)
Lines 5-19 Link Here
5
5
6
   <!-- The following extension point is internal, though likely to be promoted for public use, possibly with changes, in a future release. -->
6
   <!-- The following extension point is internal, though likely to be promoted for public use, possibly with changes, in a future release. -->
7
   <extension-point id="locator" name="%XP_WEB_SERVICE_LOCATOR" schema="schema/webServiceLocator.exsd"/>
7
   <extension-point id="locator" name="%XP_WEB_SERVICE_LOCATOR" schema="schema/webServiceLocator.exsd"/>
8
9
   <!-- Extension providing workspace WSDL discovery -->   
8
   <extension
10
   <extension
9
         point="org.eclipse.wst.ws.locator">
11
         point="org.eclipse.wst.ws.locator">
12
13
      <webServiceLocatorCategory
14
            id="org.eclipse.wst.ws.internal.wsfinder.category.workspace"
15
            label="%X_WEB_SERVICE_LOCATOR_CATEGORY_WORKSPACE"/>
16
10
      <webServiceLocator
17
      <webServiceLocator
11
            class="org.eclipse.wst.ws.internal.wsfinder.WorkspaceWSDLLocator"
18
            class="org.eclipse.wst.ws.internal.wsfinder.WorkspaceWSDLLocator"
12
            id="org.eclipse.wst.ws.internal.wsfinder.WorkspaceWSDLLocator"
19
            id="org.eclipse.wst.ws.internal.wsfinder.WorkspaceWSDLLocator"
13
            label="workspacewsdllocator">
20
            category="org.eclipse.wst.ws.internal.wsfinder.category.workspace"
21
            label="%X_WEB_SERVICE_LOCATOR_WORKSPACE">
14
         org.eclipse.wst.ws.internal.wsfinder
22
         org.eclipse.wst.ws.internal.wsfinder
15
      </webServiceLocator>
23
      </webServiceLocator>
16
   </extension>
17
24
25
   </extension>
18
    
26
    
19
</plugin>
27
</plugin>
(-)schema/webServiceLocator.exsd (-17 / +89 lines)
Lines 6-38 Link Here
6
         <meta.schema plugin="org.eclipse.wst.ws" id="webServiceLocator" name="Web Service Locator"/>
6
         <meta.schema plugin="org.eclipse.wst.ws" id="webServiceLocator" name="Web Service Locator"/>
7
      </appInfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         Extension point is provided to register locators that extend AbstractWebServiceLocator.  These locators are used by WebServiceFinder to locate web services for the purpose of web service discovery.
9
         This extension point is provided to register locators that extend AbstractWebServiceLocator.
10
         These locators are used by WebServiceFinder to locate Web services for the purpose of Web service discovery.
10
      </documentation>
11
      </documentation>
11
   </annotation>
12
   </annotation>
12
13
13
   <element name="extension">
14
   <element name="extension">
14
      <complexType>
15
      <complexType>
15
         <sequence>
16
         <all>
16
            <element ref="webServiceLocator" minOccurs="1" maxOccurs="unbounded"/>
17
            <element ref="webServiceLocator" minOccurs="1" maxOccurs="unbounded"/>
17
         </sequence>
18
            <element ref="webServiceLocatorCategory" minOccurs="1" maxOccurs="unbounded"/>
19
         </all>
18
         <attribute name="point" type="string" use="required">
20
         <attribute name="point" type="string" use="required">
19
            <annotation>
21
            <annotation>
20
               <documentation>
22
               <documentation>
21
                  a fully qualified identifier of the target extension point
23
                  A fully qualified identifier of the target extension point.
22
               </documentation>
24
               </documentation>
23
            </annotation>
25
            </annotation>
24
         </attribute>
26
         </attribute>
25
         <attribute name="id" type="string">
27
         <attribute name="id" type="string">
26
            <annotation>
28
            <annotation>
27
               <documentation>
29
               <documentation>
28
                  an optional identifier of the extension instance
30
                  An optional identifier of the extension instance.
29
               </documentation>
31
               </documentation>
30
            </annotation>
32
            </annotation>
31
         </attribute>
33
         </attribute>
32
         <attribute name="name" type="string">
34
         <attribute name="name" type="string">
33
            <annotation>
35
            <annotation>
34
               <documentation>
36
               <documentation>
35
                  an optional name of the extension instance
37
                  An optional name of the extension instance.
36
               </documentation>
38
               </documentation>
37
               <appInfo>
39
               <appInfo>
38
                  <meta.attribute translatable="true"/>
40
                  <meta.attribute translatable="true"/>
Lines 44-72 Link Here
44
46
45
   <element name="webServiceLocator">
47
   <element name="webServiceLocator">
46
      <complexType>
48
      <complexType>
47
         <attribute name="id" type="string">
49
         <attribute name="id" type="string" use="required">
50
            <annotation>
51
               <documentation>
52
                  A unique identifier for the Web Service Locator.
53
               </documentation>
54
            </annotation>
55
         </attribute>
56
         <attribute name="class" type="string" use="required">
48
            <annotation>
57
            <annotation>
49
               <documentation>
58
               <documentation>
50
                  &lt;p&gt;
59
                  The fully qualified class name for the locator class which extends AbstractWebServiceLocator.
51
&lt;code&gt;id&lt;/code&gt;Unique identifier for the extension.
52
&lt;p&gt;
53
&lt;code&gt;class&lt;/code&gt;The fully qualified class name for the locator class which extends AbstractWebServiceLocator.
54
&lt;p&gt;
55
&lt;code&gt;label&lt;/code&gt;A label for this locator.
56
               </documentation>
60
               </documentation>
57
            </annotation>
61
            </annotation>
58
         </attribute>
62
         </attribute>
59
         <attribute name="class" type="string">
63
         <attribute name="label" type="string" use="required">
64
            <annotation>
65
               <documentation>
66
                  A short label to identify the Web Service Locator.
67
               </documentation>
68
               <appInfo>
69
                  <meta.attribute translatable="true"/>
70
               </appInfo>
71
            </annotation>
72
         </attribute>
73
         <attribute name="description" type="string">
74
            <annotation>
75
               <documentation>
76
                  Optionally, a description of the purpose of the Web Service Locator.
77
               </documentation>
78
               <appInfo>
79
                  <meta.attribute translatable="true"/>
80
               </appInfo>
81
            </annotation>
82
         </attribute>
83
         <attribute name="icon" type="string">
84
            <annotation>
85
               <documentation>
86
                  Optionally, an icon that represents the Web Service Locator.
87
               </documentation>
88
            </annotation>
89
         </attribute>
90
         <attribute name="category" type="string">
91
            <annotation>
92
               <documentation>
93
                  Optionally, a category to which the Web Service Locator should belong.
94
               </documentation>
95
            </annotation>
96
         </attribute>
97
      </complexType>
98
   </element>
99
100
   <element name="webServiceLocatorCategory">
101
      <complexType>
102
         <attribute name="id" type="string" use="required">
103
            <annotation>
104
               <documentation>
105
                  A unique identifier for the category of Web Service Locators.
106
               </documentation>
107
            </annotation>
108
         </attribute>
109
         <attribute name="label" type="string" use="required">
110
            <annotation>
111
               <documentation>
112
                  A short label for the category of Web Service Locators.
113
               </documentation>
114
               <appInfo>
115
                  <meta.attribute translatable="true"/>
116
               </appInfo>
117
            </annotation>
118
         </attribute>
119
         <attribute name="description" type="string">
120
            <annotation>
121
               <documentation>
122
                  Optionally, a description of the category of Web Service Locators.
123
               </documentation>
124
               <appInfo>
125
                  <meta.attribute translatable="true"/>
126
               </appInfo>
127
            </annotation>
128
         </attribute>
129
         <attribute name="icon" type="string">
60
            <annotation>
130
            <annotation>
61
               <documentation>
131
               <documentation>
62
                  
132
                  Optionally, an icon that represents the category of Web Service Locators.
63
               </documentation>
133
               </documentation>
64
            </annotation>
134
            </annotation>
65
         </attribute>
135
         </attribute>
66
         <attribute name="label" type="string">
136
         <attribute name="category" type="string">
67
            <annotation>
137
            <annotation>
68
               <documentation>
138
               <documentation>
69
                  
139
                  Optionally, a parent category under which the Web Service Locator
140
                  category should be grouped. If absent, the category is considered
141
                  to be a root category.
70
               </documentation>
142
               </documentation>
71
            </annotation>
143
            </annotation>
72
         </attribute>
144
         </attribute>
(-)src/org/eclipse/wst/ws/internal/wsfinder/WebServiceFinder.java (-23 / +89 lines)
Lines 12-19 Link Here
12
package org.eclipse.wst.ws.internal.wsfinder;
12
package org.eclipse.wst.ws.internal.wsfinder;
13
13
14
import java.util.Iterator;
14
import java.util.Iterator;
15
import java.util.LinkedList;
15
import java.util.List;
16
import java.util.List;
16
import java.util.Vector;
17
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.IConfigurationElement;
18
import org.eclipse.core.runtime.IConfigurationElement;
19
19
Lines 26-41 Link Here
26
 */
26
 */
27
27
28
public class WebServiceFinder {
28
public class WebServiceFinder {
29
	
29
30
	private static WebServiceFinder instance = null;
30
	private static WebServiceFinder instance = null;
31
	
31
32
	private static final String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
32
	private static final String ELEMENT_LOCATOR = "webServiceLocator"; //$NON-NLS-1$
33
		
33
	private static final String ELEMENT_CATEGORY = "webServiceLocatorCategory"; //$NON-NLS-1$
34
	public WebServiceFinder()	
34
	private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
35
	private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
36
	private static final String ATTRIBUTE_CATEGORY = "category"; //$NON-NLS-1$
37
//	private static final String ATTRIBUTE_LABEL = "label"; //$NON-NLS-1$
38
//	private static final String ATTRIBUTE_DESCRIPTION = "description"; //$NON-NLS-1$
39
//	private static final String ATTRIBUTE_ICON = "icon"; //$NON-NLS-1$
40
41
	/*
42
	 * Public construction is not allowed.
43
	 * Use WebServiceFinder.instance().
44
	 */
45
	private WebServiceFinder()	
35
	{
46
	{
36
		super();
47
		super();
37
	}
48
	}
38
	
49
50
	/**
51
	 * Returns the singleton of <code>WebServiceFinder</code>.
52
	 * @return The singleton of <code>WebServiceFinder</code>.
53
	 */
39
	public static WebServiceFinder instance()
54
	public static WebServiceFinder instance()
40
	{
55
	{
41
		if (instance == null)
56
		if (instance == null)
Lines 58-84 Link Here
58
	 */
73
	 */
59
	public Iterator getWebServices()
74
	public Iterator getWebServices()
60
	{
75
	{
61
		Vector webServices = new Vector();
76
		return getWebServices(null);
77
	}
62
78
79
	/**
80
	 * Returns an iterator of WebServiceInfo objects which represent web services found by locators that
81
	 * have registered using the org.eclipse.wst.ws.locator extension point under the given category.
82
	 * Locators must extend {@link AbstractWebServiceLocator}.
83
	 * 
84
	 * Callers can use the getter methods on the WebServiceInfo object to retrieve information on the 
85
	 * web services found.  The WebServiceFinder cannot guarantee the level of detail contained in WebServiceInfo
86
	 * objects returned.  This is left to the locator implementations.
87
	 *  
88
	 * @return iterator of WebServiceInfo objects
89
	 * @param category The category of locators to use
90
	 */
91
	public Iterator getWebServices(String category)
92
	{
93
		LinkedList webServices = new LinkedList();
63
		WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance();
94
		WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance();
64
65
		IConfigurationElement[] regElements = wslr.getConfigElements();
95
		IConfigurationElement[] regElements = wslr.getConfigElements();
66
		for (int i = 0; i < regElements.length; i++) {
96
		for (int i = 0; i < regElements.length; i++)
67
			try{
97
		{
68
			    Object obj = regElements[i].createExecutableExtension(CLASS_ATTRIBUTE);
98
			if (ELEMENT_LOCATOR.equals(regElements[i].getName()))
69
			    
99
			{
70
			    if (obj instanceof IWebServiceLocator)
100
				try
71
			    {
101
				{
72
			    	IWebServiceLocator wsl = (IWebServiceLocator)obj;
102
					if (category == null || category.equals(regElements[i].getAttributeAsIs(ATTRIBUTE_CATEGORY)))
73
			    	List wsList = wsl.getWebServices();
103
					{
74
			    	webServices.addAll(wsList);
104
						Object obj = regElements[i].createExecutableExtension(ATTRIBUTE_CLASS);
75
			     }				
105
						if (obj instanceof IWebServiceLocator)
76
			} 
106
						{
77
			catch (CoreException ex){
107
							IWebServiceLocator wsl = (IWebServiceLocator)obj;
78
				
108
							List wsList = wsl.getWebServices();
79
			}		
109
							webServices.addAll(wsList);
110
						}
111
					}
112
				} 
113
				catch (CoreException ex){
114
					// Quietly bypass any IWebServiceLocators that failed to be loaded.
115
				}
116
			}
80
		} 
117
		} 
81
		return webServices.iterator();	
118
		return webServices.iterator();	
82
	} 
119
	} 
120
121
	/**
122
	 * Returns an array of registered Web Service Category IDs.
123
	 *  
124
	 * @return An array, never null but possibly empty,
125
	 * of registered Web Service Category IDs.
126
	 */
127
	public String[] getCategoryIDs()
128
	{
129
		LinkedList categories = new LinkedList();
130
		WebServiceLocatorRegistry wslr = WebServiceLocatorRegistry.getInstance();
131
		IConfigurationElement[] regElements = wslr.getConfigElements();
132
		for (int i = 0; i < regElements.length; i++)
133
		{
134
			if (ELEMENT_CATEGORY.equals(regElements[i].getName()))
135
			{
136
				String id = regElements[i].getAttributeAsIs(ATTRIBUTE_ID);
137
				if (id != null)
138
				{
139
					categories.add(id);
140
				}
141
			}
142
		}
143
		return (String[])categories.toArray(new String[0]);
144
	}
83
	
145
	
146
	//TODO: Need another method to return full Category objects,
147
	//as in "public WebServiceLocatorCategory getCategories()"
148
	//where WebServiceLocatorCategory is a new bean class with properties
149
	//mirroring the attributes of a webServiceLocatorCategory extension.
84
}
150
}

Return to bug 126529