Search in sources :

Example 6 with ServiceURL

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);
}
Also used : ServiceURL(ch.ethz.iks.slp.ServiceURL)

Example 7 with ServiceURL

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);
}
Also used : ServiceURL(ch.ethz.iks.slp.ServiceURL)

Example 8 with ServiceURL

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);
    }
}
Also used : Iterator(java.util.Iterator) ServiceURL(ch.ethz.iks.slp.ServiceURL) List(java.util.List) ArrayList(java.util.ArrayList)

Example 9 with ServiceURL

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()]);
}
Also used : ServiceURL(ch.ethz.iks.slp.ServiceURL) ServiceLocationException(ch.ethz.iks.slp.ServiceLocationException)

Example 10 with ServiceURL

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);
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) ServiceURL(ch.ethz.iks.slp.ServiceURL) URI(java.net.URI)

Aggregations

ServiceURL (ch.ethz.iks.slp.ServiceURL)23 ServiceLocationException (ch.ethz.iks.slp.ServiceLocationException)4 ArrayList (java.util.ArrayList)4 IServiceInfo (org.eclipse.ecf.discovery.IServiceInfo)3 IServiceTypeID (org.eclipse.ecf.discovery.identity.IServiceTypeID)3 JSLPServiceInfo (org.eclipse.ecf.provider.jslp.container.JSLPServiceInfo)3 ServiceType (ch.ethz.iks.slp.ServiceType)2 URI (java.net.URI)2 Iterator (java.util.Iterator)2 List (java.util.List)2 IServiceID (org.eclipse.ecf.discovery.identity.IServiceID)2 ServicePropertiesAdapter (org.eclipse.ecf.internal.provider.jslp.ServicePropertiesAdapter)2 ServiceURLAdapter (org.eclipse.ecf.internal.provider.jslp.ServiceURLAdapter)2 Hashtable (java.util.Hashtable)1 Entry (java.util.Map.Entry)1