use of ch.ethz.iks.slp.ServiceURL in project ecf by eclipse.
the class ServiceURLTest method testServiceURL258252c.
public void testServiceURL258252c() throws Exception {
String urlString = "service:test:myservice://localhost/foo/bar#path";
ServiceURL url = new ServiceURL(urlString, 0);
assertEquals(url.getServiceType().toString(), "service:test:myservice");
assertEquals(url.getHost(), "localhost");
assertEquals(url.getPort(), 0);
assertEquals(url.getURLPath(), "/foo/bar#path");
assertEquals(url.getUserInfo(), "");
assertEquals(url.getProtocol(), null);
assertEquals(url.toString(), urlString);
}
use of ch.ethz.iks.slp.ServiceURL in project ecf by eclipse.
the class ServiceURLTest method testServiceURL3.
public void testServiceURL3() throws Exception {
String urlString = "service:test:myservice://localhost:80/path";
ServiceURL url = new ServiceURL(urlString, 0);
assertEquals(url.getServiceType().toString(), "service:test:myservice");
assertEquals(url.getHost(), "localhost");
assertEquals(url.getPort(), 80);
assertEquals(url.getURLPath(), "/path");
assertEquals(url.getUserInfo(), "");
assertEquals(url.getProtocol(), null);
assertEquals(url.toString(), urlString);
}
use of ch.ethz.iks.slp.ServiceURL in project ecf by eclipse.
the class ServiceReply method sign.
/**
* sign the ServiceReply.
*
* @param spiStr
* the SPI String.
* @throws ServiceLocationException
* in case of IO errors.
*/
void sign(final String spiStr) throws ServiceLocationException {
List spiList = stringToList(spiStr, ",");
for (Iterator urlIter = urlList.iterator(); urlIter.hasNext(); ) {
ServiceURL url = (ServiceURL) urlIter.next();
url.sign(spiList);
}
}
use of ch.ethz.iks.slp.ServiceURL in project ecf by eclipse.
the class JSLPDiscoveryContainer method getServiceTypes.
/* (non-Javadoc)
* @see org.eclipse.ecf.discovery.IDiscoveryContainerAdapter#getServiceTypes()
*/
public IServiceTypeID[] getServiceTypes() {
Set result = new HashSet();
try {
List aList = Activator.getDefault().getLocator().getServiceURLs((String) null, null);
for (Iterator itr = aList.iterator(); itr.hasNext(); ) {
ServiceURL serviceURL = (ServiceURL) itr.next();
IServiceTypeID serviceTypeId = (IServiceTypeID) getConnectNamespace().createInstance(new Object[] { serviceURL, new String[] {} });
result.add(serviceTypeId);
}
} catch (ServiceLocationException e) {
// $NON-NLS-1$
Trace.catching(Activator.PLUGIN_ID, JSLPDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "getServiceTypes(int)", e);
} catch (IDCreateException e) {
// $NON-NLS-1$
Trace.catching(Activator.PLUGIN_ID, JSLPDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "getServiceTypes(int)", e);
}
return (IServiceTypeID[]) result.toArray(new IServiceTypeID[result.size()]);
}
use of ch.ethz.iks.slp.ServiceURL in project ecf by eclipse.
the class JSLPServiceInfo method getServiceURL.
public ServiceURL getServiceURL() throws ServiceLocationException {
final IServiceTypeID stid = getServiceID().getServiceTypeID();
final URI location = getLocation();
final String scheme = location.getScheme();
final String authority = location.getAuthority();
// $NON-NLS-1$
final String path = location.getPath() == null ? "" : location.getPath();
// $NON-NLS-1$ //$NON-NLS-2$
return new ServiceURL(stid.getInternal() + "://" + scheme + "://" + authority + path, ServiceURL.LIFETIME_PERMANENT);
}
Aggregations