/* File Name: CrossXClientFactory.java */ package explorer.client; import java.io.*; import java.rmi.*; import java.net.*; import explorer.*; import java.util.*; import explorer.server.*; import java.rmi.registry.*; /** * Use to get the Client Systems List from the Server and to have the list * of the remote clients associated with it. * Looks up the remote object of the destination client system to copy, * move or delete files. */ public class CrossXClientFactory { private ClientRegister clientregister; private Vector clientSystemList; private Vector clientAcceptors; static int serverport; public static int clientport; static String hostname; public static boolean blnEnd=false; /** * Initialize the Server host name,Portnumber from the client.properties file. */ private static ResourceBundle resources; static { try { resources = ResourceBundle.getBundle("resources.client", Locale.getDefault()); hostname=resources.getString("explorer.server.hostname"); serverport=Integer.parseInt(resources.getString("explorer.server.port")); clientport=Integer.parseInt(resources.getString("explorer.client.port")); } catch (MissingResourceException mre) { System.err.println("resources/client.properties not found"); System.exit(1); } } /** * Constructor for CrossXClientFactory. Init the vector Object. */ public CrossXClientFactory() { clientSystemList=new Vector(0); clientAcceptors=new Vector(0); lookUpServer(); } public void lookUpServer() { try { String uri="rmi://" + hostname + ":"+ serverport + "/ClientRegister"; clientregister=(ClientRegister)Naming.lookup(uri); } catch(Exception e) { clientregister=null; e.printStackTrace(); System.out.println("Server is not ready!"); System.exit(0); } } /** * gets the SystemList from the server */ public Vector getSystemList() throws RemoteException { clientSystemList=clientregister.refershSystemList(); for(int i=0;i-->