remote.RemoteFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of remote4j Show documentation
Show all versions of remote4j Show documentation
Thin functional layer on top of RMI.
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