// HrClient.java

package hr;

import java.io.*;
import java.util.*;
import java.rmi.RemoteException;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;

/*
 * main client for accessing other clients.
 */

public class HrClient
{
    public static void main(String[] args)
    {
        //run interactive client
        new HrClient().run();
    }

    public void run()
    {
        System.out.println("HrClient.main(): client started...");
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String action;
            while (true) {
                System.out.print("[D]ept | [E]mp | [P]roject | [Q]uit: ");
                System.out.flush();
                action = in.readLine();
                if (action.length() == 0 || action.toUpperCase().charAt(0) == 'Q') break;
                switch (action.toUpperCase().charAt(0)) {
                case 'D':
                    new DeptClient().run();
                    break;
                case 'E':
                    new EmpClient().run();
                    break;
                case 'P':
                    new ProjectClient().run();
                    break;
                default:
                    continue;
                }
            }
        } catch(IOException e) {
            System.err.println("IO Error: " + e.getMessage());
        }
    }
}
