use of net.jini.space.JavaSpace in project camel by apache.
the class JiniSpaceAccessor method findSpace.
public static JavaSpace findSpace(String url, String spaceName) throws Exception {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
Class<?>[] classes = new Class<?>[] { net.jini.space.JavaSpace.class };
Name sn = new Name(spaceName);
ServiceTemplate tmpl = new ServiceTemplate(null, /* serviceID */
classes, new Entry[] { sn });
// <protocol>://<hostname>
LookupLocator locator = new LookupLocator(url);
ServiceRegistrar sr = locator.getRegistrar();
JavaSpace space = (JavaSpace) sr.lookup(tmpl);
return space;
}
Aggregations