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 167535 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/monitoring/managedagent/wsdm/internal/muse/messages.properties (-1 / +2 lines)
Lines 13-19 Link Here
13
# NLS_MESSAGEFORMAT_VAR
13
# NLS_MESSAGEFORMAT_VAR
14
# NLS_ENCODING=UTF-8
14
# NLS_ENCODING=UTF-8
15
15
16
MuseRuntime.CANT_CONN.ERROR.=IWAT0758E Cannot connect to WSDM resource
16
MuseRuntime.CANT_CONN.ERROR.=IWAT0758E Cannot connect to WSDM resource because resource does not support Metadata Exchange or resource initialization failed. Please see stack trace for exception thrown by resource.
17
MuseRuntime.BAD_WSDL.ERROR.=IWAT0882E Cannot connect to WSDM resource because resource returned empty or bad WSDL during Metadata Exchange.
17
MuseRuntime.CANT_CREATE_DISP_NAME.ERROR.=IWAT0759E Cannot create display name
18
MuseRuntime.CANT_CREATE_DISP_NAME.ERROR.=IWAT0759E Cannot create display name
18
MuseRuntime.CANT_INVOKE.ERROR.=IWAT0760E Cannot invoke WSDM operation
19
MuseRuntime.CANT_INVOKE.ERROR.=IWAT0760E Cannot invoke WSDM operation
19
ServiceGroupHelper.NOT_SG_RESOURCE.INFO.=IWAT0761I This resource is not a service group
20
ServiceGroupHelper.NOT_SG_RESOURCE.INFO.=IWAT0761I This resource is not a service group
(-)src/org/eclipse/tptp/monitoring/managedagent/wsdm/internal/muse/MetadataHelper.java (-5 / +27 lines)
Lines 19-24 Link Here
19
import javax.xml.namespace.QName;
19
import javax.xml.namespace.QName;
20
20
21
import org.apache.muse.tools.inspector.ResourceInspector;
21
import org.apache.muse.tools.inspector.ResourceInspector;
22
import org.apache.muse.ws.addressing.EndpointReference;
22
import org.apache.muse.ws.metadata.remote.MetadataExchangeClient;
23
import org.apache.muse.ws.metadata.remote.MetadataExchangeClient;
23
import org.apache.muse.ws.resource.remote.WsResourceClient;
24
import org.apache.muse.ws.resource.remote.WsResourceClient;
24
import org.eclipse.tptp.monitoring.managedagent.provisional.ManagedResourceAgent;
25
import org.eclipse.tptp.monitoring.managedagent.provisional.ManagedResourceAgent;
Lines 31-50 Link Here
31
	Hashtable _opRetNameMap = new Hashtable();	 
32
	Hashtable _opRetNameMap = new Hashtable();	 
32
	Hashtable _metaData = new Hashtable();
33
	Hashtable _metaData = new Hashtable();
33
	
34
	
35
	Hashtable _wsdls = new Hashtable();	// save WSDLs keyed by EPR to avoid having to get WSDL if it was already retrieved as part of connect/ping
36
	
34
	public Hashtable getMetaData(){
37
	public Hashtable getMetaData(){
35
		return _metaData;
38
		return _metaData;
36
	}
39
	}
37
	
40
	
41
	public void putWSDL(EndpointReference epr, Element wsdl){
42
		_wsdls.put(epr, wsdl);
43
	}
44
	
38
	public boolean doMetaDataExchange(WsResourceClient _resource) throws Exception {
45
	public boolean doMetaDataExchange(WsResourceClient _resource) throws Exception {
39
		ResourceInspector inspector = new ResourceInspector();
40
		if(_resource==null){
46
		if(_resource==null){
41
			return false;
47
			return false;
42
		}
48
		}
43
		MetadataExchangeClient mdxClient = new MetadataExchangeClient(_resource.getDestination());
44
		//mdxClient.setTrace(true);
45
		Element wsdl = mdxClient.getWSDL();
46
49
47
		inspector.run(wsdl);
50
		Element wsdl = null;
51
		try{
52
			wsdl = (Element) _wsdls.get(_resource.getEndpointReference());
53
		}catch(Exception e){
54
			
55
		}
56
		
57
		if(wsdl==null){
58
			MetadataExchangeClient mdxClient = new MetadataExchangeClient(_resource.getDestination());
59
			//mdxClient.setTrace(true);
60
			wsdl = mdxClient.getWSDL();
61
		}
62
63
		ResourceInspector inspector = new ResourceInspector();
64
65
		try{
66
			inspector.run(wsdl);
67
		}catch(Exception e){
68
			throw new Exception("Resource inspector threw the following exception when parsing the WSDL from the resource", e);
69
		}
48
70
49
		loadPropertiesMetaData(inspector, _metaData);
71
		loadPropertiesMetaData(inspector, _metaData);
50
		loadOperationsMetaData(inspector, _metaData);
72
		loadOperationsMetaData(inspector, _metaData);
(-)src/org/eclipse/tptp/monitoring/managedagent/wsdm/internal/muse/MuseRuntime.java (-9 / +34 lines)
Lines 22-27 Link Here
22
import org.apache.muse.ws.metadata.remote.MetadataExchangeClient;
22
import org.apache.muse.ws.metadata.remote.MetadataExchangeClient;
23
import org.apache.muse.ws.notification.WsnConstants;
23
import org.apache.muse.ws.notification.WsnConstants;
24
import org.apache.muse.ws.resource.remote.WsResourceClient;
24
import org.apache.muse.ws.resource.remote.WsResourceClient;
25
import org.apache.muse.ws.resource.sg.WssgConstants;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.tptp.monitoring.managedagent.wsdm.agents.provisional.runtime.WSDMRuntime;
27
import org.eclipse.tptp.monitoring.managedagent.wsdm.agents.provisional.runtime.WSDMRuntime;
27
import org.w3c.dom.Document;
28
import org.w3c.dom.Document;
Lines 48-64 Link Here
48
 	}
49
 	}
49
	
50
	
50
	public boolean connect(String epr) throws Exception {
51
	public boolean connect(String epr) throws Exception {
52
		boolean emptyWSDL = false;
51
		try{
53
		try{
52
			Document doc = XmlUtils.createDocument(epr);
54
			Document doc = XmlUtils.createDocument(epr);
53
			Element eprEl = XmlUtils.getFirstElement(doc);
55
			Element eprEl = XmlUtils.getFirstElement(doc);
54
			_epr = new EndpointReference(eprEl);
56
			_epr = new EndpointReference(eprEl);
55
			_resource = new WsResourceClient(_epr);
57
			_resource = new WsResourceClient(_epr);
56
			
58
			
57
			// try to get the resource properties document to check the connection
59
			// 167535: all WS-resource may not have resource property documents so we cannot
58
			_resource.getResourcePropertyDocument();
60
			// rely on getResourcePropertyDocument as a ping mechanism
61
			// _resource.getResourcePropertyDocument();
62
			
63
			// first check to see if resource is SG, since SGs may not support MEX (double check)
64
			try{
65
				_resource.getResourceProperty(WssgConstants.ENTRY_QNAME);
66
				return true;
67
			}catch(Exception exc){
68
				System.out.println("Resource is not a service group");
69
			}
70
			
71
			// however MAX is guaranteed to work only with resources that support MEX
72
			// hence we will try to get the WSDL using MEX and use that as the ping
73
			MetadataExchangeClient mdxClient = new MetadataExchangeClient(_resource.getDestination());
74
			//mdxClient.setTrace(true);
75
			Element wsdl = mdxClient.getWSDL();
76
			if(wsdl==null){
77
				emptyWSDL=true;
78
				throw new Exception();
79
			}else{
80
				// reuse the WSDL that was retrieved and avoid having to do a new call for the WSDL
81
				_mHelper.putWSDL(_epr, wsdl);
82
			}
83
			
59
			//_resource.setTrace(true);
84
			//_resource.setTrace(true);
60
		}catch(Throwable t){
85
		}catch(Throwable t){
61
			MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.CANT_CONN.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$
86
			if(emptyWSDL){
87
				MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.BAD_WSDL.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$
88
			}else{
89
				MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.CANT_CONN.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$
90
			}
62
			return false;
91
			return false;
63
		}
92
		}
64
		return true;
93
		return true;
Lines 157-166 Link Here
157
		if(_resource==null) return null;
186
		if(_resource==null) return null;
158
		// providesCapability works only for WSDM resources, but this has to be a wsdm resource to 
187
		// providesCapability works only for WSDM resources, but this has to be a wsdm resource to 
159
		// have relationships (MUWS Part 2)
188
		// have relationships (MUWS Part 2)
160
		if(!CommonUtils.providesCapability(_resource, MuwsConstants.RELATIONSHIP_RESOURCE_URI)){
189
		/* if(!CommonUtils.providesCapability(_resource, MuwsConstants.RELATIONSHIP_RESOURCE_URI)){
161
			System.out.println("This is not a relationships resource"); //$NON-NLS-1$
190
			System.out.println("This is not a relationships resource"); //$NON-NLS-1$
162
			//throw new Exception("Not a relationship resource");
191
			//throw new Exception("Not a relationship resource");
163
		}
192
		}*/
164
		return _rHelper.getRelationships(_resource);
193
		return _rHelper.getRelationships(_resource);
165
	}
194
	}
166
	
195
	
Lines 168-177 Link Here
168
		if(_resource==null) return null;
197
		if(_resource==null) return null;
169
		
198
		
170
		Element[] els = _resource.getResourceProperty(WsnConstants.TOPIC_EXPRESSION_QNAME);
199
		Element[] els = _resource.getResourceProperty(WsnConstants.TOPIC_EXPRESSION_QNAME);
171
		if( els == null || els.length <= 0 ){
172
			System.out.println("No topics defined");
173
		}
174
175
		return _tHelper.getTopics(_resource);
200
		return _tHelper.getTopics(_resource);
176
	}
201
	}
177
}
202
}

Return to bug 167535