import java.awt.*; import java.awt.event.*; import java.applet.*; import java.net.*; import java.io.*; //for Stack class import java.util.*; //for SWING set interface import javax.swing.*; public class adminappl3 extends JInternalFrame implements ActionListener { //cariables that are extracted from the envoking HTML //allows changing configuration by changing HTML PARAM only private String Display; private String ConfFile; private String IorFile; private String MyClassPath; private String servletURL; private String HashTableFile; //inerface elements private CardLayout cl = new CardLayout(); String status = new String(); protected JProgressBar progressBar; protected JPanel norhtPanel; private JTextArea logText; //Action Log private JTextField disp = new JTextField("aga.npac.syr.edu:0",20); private JLabel statusLabel = new JLabel ("Lookig for the server..."); private JLabel logTitle = new JLabel ("Your action log is here:"); //Action buttons, their command, labels, and a command stack final int ButtonNum = 6; protected JButton jb[]; String Buttons[] = {"Turn Server ON", "Turn Server OFF", "Test Server Status", "Configuration", "Help" , "Reload HashTable"}; private Stack stack = new Stack(); //Keywords passed to the servlet String command[]={"start","kill","ping","conf","help", "SystemConf"}; //Keywords passed by the servlet String KWord[]={"Object is active","Object is NOT ACTIVE", "Error", "conf", "help", "SystemConf"}; //Prompts printed for user String stateWord[]={"Server Status: SERVER IS ON", "Server Status: SERVER IS OFF", "Check the log file for problem and ping the server later"}; private Color color[] = { Color.green, Color.red, Color.yellow }; private int ActionCount = 0; //two helper classes private Timer timer; private LongTask task = new LongTask(1); int attempts[] = {100, 5, 1, 1, 1, 1}; public final static int ONE_SECOND = 1000; public final static int TIMER_LENGTH=100; /////////////////////////////////////////////////////////////// // Function Declaration /////////////////////////////////////////////////////////////// //draws the user interface and sets up the timer // public void init() { //servletURL = setParameters(); public adminappl3(String Display, String ConfFile, String IorFile, String MyClassPath, String servletURL, String HashTableFile){ super("Master Server Administrator", true, true, true, true); this.Display = Display; this.ConfFile = ConfFile; this.IorFile = IorFile; this.MyClassPath = MyClassPath; this.servletURL = servletURL; this.HashTableFile = HashTableFile; this.servletURL += "?MasterConfFile="+ConfFile+"&MasterIorFile="+IorFile; this.servletURL += "&ClassPath="+MyClassPath+"&display="+Display; this.servletURL += "&HashTableFile="+ HashTableFile + "&command="; getContentPane().setLayout( new BorderLayout()); //initialize North Panel consisting of interchangeble status statusLabel=new JLabel("Checking server status..."); statusLabel.setVerticalTextPosition(JLabel.CENTER); statusLabel.setHorizontalAlignment(JLabel.CENTER); progressBar = new JProgressBar(0, TIMER_LENGTH); progressBar.setValue(3); progressBar.setStringPainted(true); norhtPanel = new JPanel(); norhtPanel.setLayout(cl); norhtPanel.add("text", statusLabel); norhtPanel.add("bar", progressBar); getContentPane().add(norhtPanel, BorderLayout.NORTH); //setting the central Control Panel consisting of ButtonNum buttons JPanel controlPanel = new JPanel(); controlPanel.setLayout(new GridLayout(ButtonNum,1)); jb = new JButton [ButtonNum]; for (int i = 0 ; i0) logText.append("\n----Action# " + (++ActionCount) + "----\n" + MSG); } //returns server status based on the message passed public int getState(String MSG) { if (-1