001    /*
002    
003      $Id: SharpsterClient.java,v 1.2 2003/03/26 23:07:40 culdesac Exp $
004    
005    */
006    
007    package sharpster.client;
008    
009    import sharpster.client.daemoncommunication.DaemonCommunication;
010    import sharpster.client.localplugin.LocalPluginManager;
011    import sharpster.client.userinterface.UserInterface;
012    
013    
014    /**
015     * Main program for the sharpster client.
016     */
017    public class SharpsterClient {
018        DaemonCommunication daemonCommunication;
019        UserInterface userInterface;
020        LocalPluginManager localPluginManager;
021        
022        public static void main(String[] args) {
023            SharpsterClient client = new SharpsterClient();
024            System.out.println("Starting Sharpster client...");
025            client.initialize(args);
026        }
027        
028        private void initialize(String[] args) {
029            //Create all objects
030            daemonCommunication = new DaemonCommunication();
031            localPluginManager = new LocalPluginManager();
032            userInterface = new UserInterface(daemonCommunication,
033                                              localPluginManager);
034    
035            String sharpsterDir = System.getProperty("sharpster.installdir");
036            
037            boolean noError = localPluginManager.loadPlugins(sharpsterDir+"/plugins");
038            if(!noError) {
039                System.out.println("Fatal error: unable to load plugins");
040                System.exit(1);
041            }
042            
043            userInterface.parseUserInput(args);
044            
045            /*
046              if (null == daemonCommunication.viewFileSharing()) 
047              System.out.println("wrong response");
048              else
049              System.out.println("ok!");
050            */
051    
052            /* any necessary initialization 
053              daemonCommunication.initialize();
054              localPluginManager.initialize();
055              userInterface.initialize();
056            */
057        }
058    }
059    
060