|
Lines 48-64
Link Here
|
| 48 |
} |
48 |
} |
| 49 |
|
49 |
|
| 50 |
public boolean connect(String epr) throws Exception { |
50 |
public boolean connect(String epr) throws Exception { |
|
|
51 |
boolean emptyWSDL = false; |
| 51 |
try{ |
52 |
try{ |
| 52 |
Document doc = XmlUtils.createDocument(epr); |
53 |
Document doc = XmlUtils.createDocument(epr); |
| 53 |
Element eprEl = XmlUtils.getFirstElement(doc); |
54 |
Element eprEl = XmlUtils.getFirstElement(doc); |
| 54 |
_epr = new EndpointReference(eprEl); |
55 |
_epr = new EndpointReference(eprEl); |
| 55 |
_resource = new WsResourceClient(_epr); |
56 |
_resource = new WsResourceClient(_epr); |
| 56 |
|
57 |
|
| 57 |
// try to get the resource properties document to check the connection |
58 |
// 167535: all WS-resource may not have resource property documents so we cannot |
| 58 |
_resource.getResourcePropertyDocument(); |
59 |
// rely on getResourcePropertyDocument as a ping mechanism |
|
|
60 |
// _resource.getResourcePropertyDocument(); |
| 61 |
// however MAX is guaranteed to work only with resources that support MEX |
| 62 |
// hence we will try to get the WSDL using MEX and use that as the ping |
| 63 |
MetadataExchangeClient mdxClient = new MetadataExchangeClient(_resource.getDestination()); |
| 64 |
//mdxClient.setTrace(true); |
| 65 |
Element wsdl = mdxClient.getWSDL(); |
| 66 |
if(wsdl==null){ |
| 67 |
emptyWSDL=true; |
| 68 |
throw new Exception(); |
| 69 |
} |
| 70 |
|
| 59 |
//_resource.setTrace(true); |
71 |
//_resource.setTrace(true); |
| 60 |
}catch(Throwable t){ |
72 |
}catch(Throwable t){ |
| 61 |
MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.CANT_CONN.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$ |
73 |
if(emptyWSDL){ |
|
|
74 |
MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.BAD_WSDL.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$ |
| 75 |
}else{ |
| 76 |
MuseRuntimePlugin.getDefault().log(Messages.getString("MuseRuntime.CANT_CONN.ERROR."), t, IStatus.ERROR); //$NON-NLS-1$ |
| 77 |
} |
| 62 |
return false; |
78 |
return false; |
| 63 |
} |
79 |
} |
| 64 |
return true; |
80 |
return true; |
|
Lines 157-166
Link Here
|
| 157 |
if(_resource==null) return null; |
173 |
if(_resource==null) return null; |
| 158 |
// providesCapability works only for WSDM resources, but this has to be a wsdm resource to |
174 |
// providesCapability works only for WSDM resources, but this has to be a wsdm resource to |
| 159 |
// have relationships (MUWS Part 2) |
175 |
// have relationships (MUWS Part 2) |
| 160 |
if(!CommonUtils.providesCapability(_resource, MuwsConstants.RELATIONSHIP_RESOURCE_URI)){ |
176 |
/* if(!CommonUtils.providesCapability(_resource, MuwsConstants.RELATIONSHIP_RESOURCE_URI)){ |
| 161 |
System.out.println("This is not a relationships resource"); //$NON-NLS-1$ |
177 |
System.out.println("This is not a relationships resource"); //$NON-NLS-1$ |
| 162 |
//throw new Exception("Not a relationship resource"); |
178 |
//throw new Exception("Not a relationship resource"); |
| 163 |
} |
179 |
}*/ |
| 164 |
return _rHelper.getRelationships(_resource); |
180 |
return _rHelper.getRelationships(_resource); |
| 165 |
} |
181 |
} |
| 166 |
|
182 |
|
|
Lines 168-177
Link Here
|
| 168 |
if(_resource==null) return null; |
184 |
if(_resource==null) return null; |
| 169 |
|
185 |
|
| 170 |
Element[] els = _resource.getResourceProperty(WsnConstants.TOPIC_EXPRESSION_QNAME); |
186 |
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); |
187 |
return _tHelper.getTopics(_resource); |
| 176 |
} |
188 |
} |
| 177 |
} |
189 |
} |