All Downloads are FREE. Search and download functionalities are using the official Maven repository.

remote.RemoteFactory Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
package remote;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.rmi.NotBoundException;
import java.util.Arrays;
import java.util.ServiceLoader;

import remote.spi.RemoteFactoryProvider;

public interface RemoteFactory {
	public  Remote apply(T value) throws IOException;
	public  void rebind(String name, T value) throws IOException;
	public  Remote lookup(String name) throws IOException, NotBoundException;

	public static RemoteFactory apply(final String str) throws IOException, URISyntaxException {
		final URI uri = new URI(str);
		for (final RemoteFactoryProvider provider : ServiceLoader.load(RemoteFactoryProvider.class)) {
			if (Arrays.asList(provider.getSchemes()).contains(uri.getScheme())) {
				return provider.getFactory(uri);
			}
		}
		return null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy