/* (non-Javadoc) * @see org.objectweb.proactive.core.remoteobject.RemoteObjectFactory#list(java.net.URI) */ public URI[] list(URI url) throws ProActiveException { try { Registry registry = getRegistry(url); String[] names = registry.list(); if (names != null) { URI[] uris = new URI[names.length]; for (int i = 0; i < names.length; i++) { uris[i] = URIBuilder.buildURI( URIBuilder.getHostNameFromUrl(url), names[i], protocolIdentifier, URIBuilder.getPortNumber(url)); } return uris; } } catch (Exception e) { throw new ProActiveException(e); } return null; }
/* (non-Javadoc) * @see org.objectweb.proactive.core.remoteobject.RemoteObjectFactory#lookup(java.net.URI) */ public <T> RemoteObject<T> lookup(URI uri) throws ProActiveException { Object o = null; URI modifiedURI = uri; if (uri.getPort() == -1) { LOGGER_RO.debug("No port specified, using the default one"); modifiedURI = URIBuilder.buildURI( URIBuilder.getHostNameFromUrl(uri), URIBuilder.getNameFromURI(uri), this.protocolIdentifier); modifiedURI = RemoteObjectHelper.expandURI(modifiedURI); } // Try if URL is the address of a RmiRemoteBody try { Registry reg = getRegistry(modifiedURI); o = reg.lookup(URIBuilder.getNameFromURI(modifiedURI)); LOGGER_RO.debug(modifiedURI.toString() + " looked up successfully"); } catch (java.rmi.NotBoundException e) { // there are one rmiregistry on target computer but nothing bound to this url is not bound throw new ProActiveException( "The url " + modifiedURI + " is not bound to any known object", e); } catch (RemoteException e) { throw new ProActiveException("Registry could not be contacted, " + modifiedURI, e); } if (o instanceof RmiRemoteObject) { return new RemoteObjectAdapter((RmiRemoteObject) o); } throw new ProActiveException( "The given url does exist but doesn't point to a remote object url=" + modifiedURI + " class found is " + o.getClass().getName()); }