1 6 7 package com.quikj.client.raccess; 8 9 import java.rmi.*; 10 import java.net.*; 11 12 16 public class RemoteAccessClient 17 { 18 19 20 private AceRMIInterface remoteAccess = null; 21 22 private String lookupName; 23 24 25 public RemoteAccessClient(String registry_url, 26 String service_name, 27 String host) 28 { 29 if (registry_url.endsWith("/") == false) 30 { 31 registry_url += "/"; 32 } 33 34 if (service_name.endsWith("/") == false) 35 { 36 service_name += "/"; 37 } 38 39 lookupName = registry_url + service_name + host; 40 } 41 42 public RemoteAccessClient(String host, String service_name) 43 { 44 this("rmi://localhost:1099", service_name, host); 45 } 46 47 public AceRMIInterface getRemoteAccess() 48 throws NotBoundException, MalformedURLException, RemoteException 49 { 50 return (AceRMIInterface)Naming.lookup(lookupName); 51 } 52 53 58 public static void main(String [] args) 59 { 60 try 61 { 62 RemoteAccessClient com = new RemoteAccessClient(args[0], args[1]); 63 AceRMIInterface rmi = com.getRemoteAccess(); 64 65 System.out.println(args[3] + "=" 66 + rmi.getParam(args[2], 67 args[3])); 68 } 69 catch (Exception ex) 70 { 71 System.err.println(ex.getClass().getName() + ": " 72 + ex.getMessage());; 73 } 74 75 System.exit(0); 76 } 77 } 78 | Popular Tags |