Package java.rmi.registry

Examples of java.rmi.registry.Registry.lookup()


public class CurrencyConverterRMIClient {

    public static void main(String[] args) throws Exception {
        Registry registry = LocateRegistry.getRegistry("localhost", 8099);
        String name = "CurrencyConverterRMI";
        CurrencyConverter converter = (CurrencyConverter)registry.lookup(name);

        System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
        System.out.println("100 USD = " + converter.convert("USD", "GBP", 100.0) + "GBP");
    }
}
View Full Code Here


        try {
            registry = LocateRegistry.getRegistry(host, portNumber);

            if (registry != null) {
                remoteService = registry.lookup(svcName);
            }
        } catch (RemoteException e) {
            RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
            rmiExec.setStackTrace(e.getStackTrace());
            throw rmiExec;
View Full Code Here

            // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
            // in security policy.
            registry = LocateRegistry.getRegistry(host, portNumber);

            if (registry != null) {
                remoteService = registry.lookup(svcName);
            }
        } catch (RemoteException e) {
            RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
            rmiExec.setStackTrace(e.getStackTrace());
            throw rmiExec;
View Full Code Here

   
    /** Creates a new instance of InstanceQuery */
    public InstanceQuery() throws RemoteException, NotBoundException {
       
        Registry registry = LocateRegistry.getRegistry();          
        m_appstub = (AppMessage) registry.lookup("AppMessage");
    }
   
    public AppMessage getAppMessage() {
        return m_appstub;
    }
View Full Code Here

        String name = url.getPath();
        if (name != null && name.startsWith("/")) {
          name = name.substring(1);
        }
        Registry registry = LocateRegistry.getRegistry(host, port, this.registryClientSocketFactory);
        stub = registry.lookup(name);
      }
      else {
        // Can proceed with standard RMI lookup API...
        stub = Naming.lookup(getServiceUrl());
      }
View Full Code Here

        String name = url.getPath();
        if (name != null && name.startsWith("/")) {
          name = name.substring(1);
        }
        Registry registry = LocateRegistry.getRegistry(host, port, this.registryClientSocketFactory);
        stub = registry.lookup(name);
      }
      else {
        // Can proceed with standard RMI lookup API...
        stub = Naming.lookup(getServiceUrl());
      }
View Full Code Here

    try
      remoteRegistry = LocateRegistry.getRegistry(address, port, new SslRMIClientSocketFactory());

      ClientLogManager.addClientLog(remoteRegistry.toString(), false);
     
      server = (NBOServerIF) remoteRegistry.lookup("NBOServer");
     
      ClientLogManager.addClientLog(server.toString(), false);
     
        if(!server.login(this.user)) {
          this.stop = true;
View Full Code Here

            // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
            // in security policy.
            Registry registry = LocateRegistry.getRegistry(rmiURI.host, rmiURI.port, socketFactory);

            if (registry != null) {
                remoteService = registry.lookup(rmiURI.serviceName);
            }
        } catch (RemoteException e) {
            RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
            rmiExec.setStackTrace(e.getStackTrace());
            throw rmiExec;
View Full Code Here

    }

    @Test
    public void testOSGi() throws Exception {
        Registry registry = LocateRegistry.getRegistry(8085);
        Object add = registry.lookup("AddService");
        AddService addService = OSGiTestUtils.cast(add, AddService.class);
        double sum = addService.add(1.0, 2.0);
        Assert.assertEquals(3.0, sum, 0.0);
    }
View Full Code Here

        try {
            registry = LocateRegistry.getRegistry(host,
                portNumber);

            if (registry != null) {
                remoteService = registry.lookup(svcName);
            }
        } catch (RemoteException e) {
            RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
            rmiExec.setStackTrace(e.getStackTrace());
            throw rmiExec;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.