Search in sources :

Example 1 with URI

use of ch.ethz.iks.r_osgi.URI in project ecf by eclipse.

the class RemoteOSGiServiceImpl method connect.

/**
 * connect to a remote OSGi host.
 *
 * @param uri
 *            the uri of the remote OSGi peer.
 * @return the array of service urls of services offered by the remote peer.
 * @throws RemoteOSGiException
 *             in case of errors.
 * @throws IOException
 *             in case of IO problems.
 * @since 0.6
 */
public RemoteServiceReference[] connect(final URI uri) throws RemoteOSGiException, IOException {
    final URI endpoint = URI.create(getChannelURI(uri));
    final ChannelEndpointImpl test = (ChannelEndpointImpl) channels.get(endpoint.toString());
    if (test != null) {
        test.usageCounter++;
        return test.getAllRemoteReferences(null);
    }
    final ChannelEndpointImpl channel;
    final String protocol = endpoint.getScheme();
    final NetworkChannelFactory factory = getNetworkChannelFactory(protocol);
    channel = new ChannelEndpointImpl(factory, endpoint);
    return channel.sendLease(getServices(endpoint.getScheme()), getTopics());
}
Also used : NetworkChannelFactory(ch.ethz.iks.r_osgi.channels.NetworkChannelFactory) URI(ch.ethz.iks.r_osgi.URI)

Aggregations

URI (ch.ethz.iks.r_osgi.URI)1 NetworkChannelFactory (ch.ethz.iks.r_osgi.channels.NetworkChannelFactory)1