modifications for a demo that never happend, and still had to stay all night for :(

ajs248 [2002-02-26 19:53:07]
modifications for a demo that never happend, and still had to stay all night for :(
Filename
GateKeeper.java
Habitat.java
portal/HabitatPortal.java
services/AlertService.java
services/EventService.java
services/MapService.java
services/NYCPassListService.java
services/ResidentsListService.java
diff --git a/GateKeeper.java b/GateKeeper.java
index f88af71..0e27ad1 100644
--- a/GateKeeper.java
+++ b/GateKeeper.java
@@ -1 +1 @@
-package psl.habitats;

import java.io.*;
import java.util.Iterator;
import java.util.Enumeration;
import java.util.Vector;


import java.util.Hashtable;
import siena.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;


// Alpa : need to replace the siena Notification with a generalised service descritpion
// Alpa: need to add someway of removing treaty when recieved BYE


public class GateKeeper implements Notifiable {
    static private Habitat masterHabitat;
    static private Hashtable summits_list; 
    static private final Hashtable currServiceReqList = new Hashtable(); 
    static private String sienaMaster = "senp://canal.psl.cs.columbia.edu:31331";
    static HierarchicalDispatcher hd = null;
    static String myDescription = "Gatekeeper";

    public GateKeeper(Habitat h, String sm) {
	masterHabitat = h;
	summits_list = new Hashtable();

	// connect to siena
	myDescription += "_" + masterHabitat.getName();
	hd = new HierarchicalDispatcher();
	
	try {
	    if (sm != null) sienaMaster = sm;
	    hd.setMaster(sienaMaster);
	    // masterHabitat.log(": master is " + sienaMaster);
	} catch (siena.InvalidSenderException ihe) {
	    ihe.printStackTrace();
	} catch (IOException ioe) {
	    ioe.printStackTrace();
	}
	
	Runtime.getRuntime().addShutdownHook(new Thread() {
		public void run() {
		    System.err.println("Shutting down");
		    hd.shutdown();
		}
	    });
	
	Filter filter = null;
	filter = new Filter();
	filter.addConstraint("habitatCategory", masterHabitat.getCategory());
	new FilterThread(hd, filter, this).start();
	filter = new Filter();
	filter.addConstraint("habitatName", masterHabitat.getName());
	new FilterThread(hd, filter, this).start();
    }
    
    
    public void notify(Notification[] e) {}
    
    public void notify(Notification n) {
	masterHabitat.log("GateKeeper: recevied ");
	AttributeValue rav = n.getAttribute("EventType");
	
	if (rav == null) {
	    masterHabitat.log("Received a null attribute for: EventType");
	    return;
	}
	
	String av = rav.stringValue();
	if(av.equals("ServiceRequest")) {
	    processServiceRequest(n);
	} else if(av.equals("Response2ServiceRequest")) {
	    processResponse2ServiceRequest(n);
	}
    }
    
    private static final String SERVER_S = "ServerService";
    private static final String CLIENT_S = "ClientService";
    private static final String TOTALPARAMS = "totalParams";
    private static final String TOTALRETVALS = "totalRetvals";
    
    public void broadcast_req(String clientService, String serverService, Hashtable h) {
	masterHabitat.log("GateKeeper: broadcast_req for " + serverService);
	
	// maintain local reference to hashTable: h
	currServiceReqList.put(clientService, h);
	
	Notification n = new siena.Notification();
	for (Enumeration e=h.keys(); e.hasMoreElements(); ) {
	    String key = e.nextElement().toString();
	    n.putAttribute(key, "" + h.get(key));
	}
	
	n.putAttribute("source", masterHabitat.getName());
	n.putAttribute(SERVER_S, serverService);     
	n.putAttribute(CLIENT_S, clientService);     
	
	try {
	    masterHabitat.log("GateKeeper: broadcasting: ");
	    
	    // add sleep so that progression is clear
	    try {Thread.sleep(500);} catch (InterruptedException ie) { ; }
	    
	    // send out event
	    hd.publish(n);
	} catch (siena.SienaException se) {
	    se.printStackTrace();
	}
    }
    
    private boolean allowed(String _sName, String _sDesc) {
	return true;
  }
    
    private int getNextID() {
	return (int) (Math.random() * 1000);
    }
    
    public void processServiceRequest(Notification n) {
	
	masterHabitat.log(myDescription + ":: processing a Service Request ");
	// do some simple security clearance
	// assign an ID number
	// create a new treaty and add it to the list of sumits
	// if security cleared create a proxy of the service object
	
	String clientHabitat = null, clientService = null, serverService = null;
	int totalParams = 0, totalRetvals = 0;
	Notification res_notif = new Notification();
	AttributeValue av = n.getAttribute("source");
	
	if (av != null) clientHabitat = av.stringValue();
	av = n.getAttribute(CLIENT_S);
	
	if (av != null) clientService = av.stringValue();
	av = n.getAttribute(SERVER_S);
	
	if (av != null) serverService = av.stringValue();
	av = n.getAttribute(TOTALPARAMS);
	
	if (av != null) totalParams = av.intValue();		// total parameters
	av = n.getAttribute(TOTALRETVALS);
	
	if (av != null)	totalRetvals = av.intValue(); 	// total return values 
	masterHabitat.log("Service Request for -> " + serverService + " from -> " + clientHabitat);
	masterHabitat.localService("Security Check on " + clientHabitat);
	
	if(allowed(clientHabitat, clientService)) {
	    
	    masterHabitat.localService("Security Check Cleared on " + clientHabitat);
	    // send a +ve response
	    int ID = getNextID();
	    res_notif.putAttribute("habitatName", clientHabitat);
	    res_notif.putAttribute("EventType", "Response2ServiceRequest");
	    res_notif.putAttribute("Access", "Allowed");			// could have used ID only but just in case
	    res_notif.putAttribute("Treaty", "AcceptedAll");	
	    
	    /* AcceptAll = all the ip_params and op_params sent in the 
	     *  request were allowed. OR
	     *  New Treaty = the new treaty description follows thsi event 
	     *  that gives a new description of the ip_params and the op_params
	     *  currently only AcceptAll implemented
	     */
	    
	    res_notif.putAttribute(CLIENT_S, clientService);
	    res_notif.putAttribute(SERVER_S, serverService);
	    res_notif.putAttribute("ID", ID); 
	    
	    Vector params = new Vector();
	    Vector retvals = new Vector();
	    
	    for (int i=1; i<=totalParams; i++) {
		av = n.getAttribute("params" + i);
		if (av != null) params.add(av.stringValue());
	    }
	    
	    for (int i=1; i<=totalRetvals; i++) {
		av = n.getAttribute("retvals" + i);
		if (av != null) retvals.add(av.stringValue());
	    }
	    
	    masterHabitat.localService("Negotiating with " + clientHabitat);
	    masterHabitat.localService("New Treaty and Summit ID created for " + clientHabitat);
	    
	    Treaty t = null;
	    summits_list.put(new Integer(ID), 
			     t = new Treaty(serverService, clientService, ID, 
					    clientHabitat, masterHabitat.getName(), 
					    params, retvals));
	    
	    Filter f1 = new Filter();
	    f1.addConstraint("CurrentSummitID", ID + "_" + serverService);
	    new FilterThread(hd, f1, new SummitHandler(clientService, serverService, t, this)).start();
	}
	else {
	    // send a -ve response
	    res_notif.putAttribute("habitatName", clientHabitat);
	    res_notif.putAttribute("EventType", "Response2ServiceRequest");
	    res_notif.putAttribute("Access", "Denied");
	}
	
	try {
	    
	    // add sleep so that progression is clear
	    try {Thread.sleep(500);} catch (InterruptedException ie) { ; }
	    
	    // treaty created, now send reply to requesting habService
	    hd.publish(res_notif);
	} catch (siena.SienaException se) {
	    se.printStackTrace();
	}
    }
    
    private Vector get_IP_params_from_Notification(Notification n) {
	return (new Vector());
    }
    
    public void processResponse2ServiceRequest(Notification n) {
	masterHabitat.log( myDescription + " :: Recieved Response2ServiceRequest");
	AttributeValue av = n.getAttribute("Access");
	int ID;
	
	if (av != null) {
	    
	    if ((av.stringValue()).equals("Allowed")) {
		av = n.getAttribute("ID");
		
		if (av != null) {
		    ID = av.intValue();
		    String clientHabService = n.getAttribute(CLIENT_S).stringValue();
		    String serverHabService = n.getAttribute(SERVER_S).stringValue();
		    masterHabitat.log( myDescription + " :: Allowed access to " + serverHabService);
		    Hashtable oldHash = (Hashtable) currServiceReqList.get(clientHabService);
		    String serverHabitat = oldHash.get("habitatCategory") + "";
		    int totalParams = Integer.parseInt("" + oldHash.get("totalParams"));
		    int totalRetvals = Integer.parseInt("" + oldHash.get("totalRetvals"));
		    
		    // figure out num params/retvals
		    Vector params = new Vector(totalParams), retvals = new Vector(totalRetvals);
		    for (int i=1; i<=totalParams; i++) params.add(oldHash.get("params" + i));
		    for (int i=1; i<=totalRetvals; i++) retvals.add(oldHash.get("retvals" + i));
		    masterHabitat.log( myDescription + " :: Creating New Treaty ");
		    
		    Treaty t = null; 
		    summits_list.put(new Integer(ID), 
				     t = new Treaty(serverHabService, clientHabService, ID, 
						    serverHabitat, masterHabitat.getName(),
						    params, retvals));
		    
		    // t.printIPList(); t.printOPList();
		    // treaty created, now notify requesting habService
		    
		    Hashtable newHash
			= masterHabitat.getService(clientHabService).performService(serverHabService, null);
		    masterHabitat.log( myDescription + "Notifying Service " + clientHabService + "to start using Remote Service " + serverHabService);
		    n = new siena.Notification();
		    for (Enumeration e = newHash.keys(); e.hasMoreElements(); ) {
			String key = e.nextElement().toString();
			if (t.valid_ip_param(key) || t.valid_op_param(key))
			    n.putAttribute(key, "" + newHash.get(key));
			else masterHabitat.log("Invalid IP");
		    }
		    n.putAttribute("CurrentSummitID", ID + "_" + serverHabService);
		    
		    Filter f1 = new Filter();
		    f1.addConstraint("CurrentSummitID", ID + "_" + clientHabService);
		    new FilterThread(hd, f1, new SummitHandler(serverHabService, clientHabService, t, this)).start();
		    
		    try {
			masterHabitat.log("GateKeeper: publishing: ");

			// add sleep so that progression is clear			
			try {Thread.sleep(500);} catch (InterruptedException ie) { ; }
			
			// send out to server 
			hd.publish(n);
		    } catch (SienaException se) {
			se.printStackTrace();
		    }
		} else { /* nothing */ }
	    } else {
		masterHabitat.log("Access Denied");
		// masterHabitat.notifyService(); .. wake up the service waiting for this failure notification
	    }
	    
	    // response to the service request
	    // create a treaty with the params 
	    // save the ID number recieved by the remote GK
	    // notify the service to start using the service
	} else { /* nothing */ }
	
	masterHabitat.log("GateKeeper: processResponse2ServiceRequest ended: ");
    }
    
    class SummitHandler implements Notifiable {
	final Treaty treaty;
	final GateKeeper masterGK;
	final String targetService;
	final String localService;
	
	public SummitHandler(String ts, String ls, Treaty _t, GateKeeper _gk) {
	    
	    treaty = _t;
	    masterGK = _gk;
	    targetService = ts;
	    localService = ls;
	}
	
  	public void notify(Notification n[]) {}
	
  	public void notify(Notification n) {
	    
	    masterHabitat.log("SummitHandler: notify ");

	    // need validation in here
	    Notification send_notif = new Notification();
	    Hashtable retvals = new Hashtable();
	    boolean terminateSummit = false;
	    
	    for (Iterator i = n.attributeNamesIterator(); i.hasNext(); ) {
		String key = "" + i.next();
		if (!key.equals("CurrentSummitID") && !key.equals("habitatCategory")) {
		    if (treaty.valid_ip_param(key) || treaty.valid_op_param(key)) {
			retvals.put(key, n.getAttribute(key).stringValue());            
		    } else {
			send_notif.clear();
			send_notif.putAttribute("Terminate Summit" , "Invalid number of params");
			terminateSummit = true;
			break;
		    }
		}
	    }
	    
	    masterHabitat.log(treaty.printIPList());
	    masterHabitat.log(treaty.printOPList());
	    
	    if (! terminateSummit) {
		ServiceInterface sInf = masterHabitat.getService(localService);
		Hashtable newHash = sInf.performService(treaty.serverHabService, retvals);
		send_notif = new siena.Notification();
		boolean isResultNull = false;
		
		if (newHash == null) {
		    send_notif.clear();
		    send_notif.putAttribute("Terminate Summit" , "Nothing to be returned");
		} else {
		    for (Enumeration e = newHash.keys(); e.hasMoreElements(); ) {
			String key = e.nextElement().toString();
			
			if (treaty.valid_ip_param(key) || treaty.valid_op_param(key)) {
			    send_notif.putAttribute(key, "" + newHash.get(key));
			} else {
			    // masterHabitat.log("SummitHandler: here, terminating, " + key);
			    send_notif.clear();
			    send_notif.putAttribute("Terminate Summit" , "Invalid number of retvals");
			    break;
			}
		    }
		}
	    }
	    
	    send_notif.putAttribute("CurrentSummitID", treaty.getID() + "_" + targetService);
	    
	    try {
		
		// add sleep so that progression is clear			
		try {Thread.sleep(500);} catch (InterruptedException ie) { ; }
		
		// send out to server
		hd.publish(send_notif);
	    } catch (SienaException se) {
		se.printStackTrace();
	    }
	    
	    
	    /* Notification send_notif = new Notification();
	       
	       
	       send_notif.putAttribute("currentSummitID", ID);
	       

			Treaty currTreaty = (Treaty) masterGK.summits_list.get(new Integer(ID)); 


			// check for termination by peer 


			if (send_notif.size() != currTreaty.get_IP_size()) {


				send_notif.putAttribute("Terminate Summit" , "Invalid number of params");


				return;


			} else { 


				Vector ip = (Vector) currTreaty.getIPList();


			  Hashtable forService = new Hashtable();


			  for(int i =0; i < ip.size(); i++) {


			  	String ip_par = (String) ip.elementAt(i);


			  	AttributeValue av = send_notif.getAttribute(ip_par);


			  	if (av!= null) {


			  		forService.put(ip_par, av.stringValue()); // need to pass the list to the params


			  	}


			  }





				// might be replaced by a lookup on a corba object


				ServiceInterface _service = masterHabitat.getService(currTreaty.servUsed);


				Vector result2Bsent = _service.performService(forService);





				for (int _v = 0; _v < result2Bsent.size(); _v++) {


					MyAttributeValuePair _avp = (MyAttributeValuePair) result2Bsent.elementAt(_v);


					if (currTreaty.valid_op_param(_avp.getValue())) {


						send_notif.putAttribute(_avp.getAttribute(), _avp.getValue());


					}


					else {


						send_notif.clear();


						send_notif.putAttribute("Terminate Summit" , "Invalid number of params");


						// break;


					}


				}


			}*/


		}


	}


}
\ No newline at end of file
+package psl.habitats;


import java.io.*;


import java.util.Iterator;


import java.util.Enumeration;


import java.util.Vector;


import java.util.Hashtable;


import siena.*;


import org.omg.CosNaming.*;


import org.omg.CosNaming.NamingContextPackage.*;


import org.omg.CORBA.*;





// Alpa : need to replace the siena Notification with a generalised service descritpion


// Alpa: need to add someway of removing treaty when recieved BYE





public class GateKeeper implements Notifiable {


	static private Habitat masterHabitat;


	static private Hashtable summits_list; 


	static private final Hashtable currServiceReqList = new Hashtable(); 


	static private String sienaMaster = "senp://canal.psl.cs.columbia.edu:31331";


  static HierarchicalDispatcher hd = null;


  static String myDescription = "Gatekeeper";





	public GateKeeper(Habitat h, String sm) {


		masterHabitat = h;


		summits_list = new Hashtable();


		// connect to siena


    myDescription += "_" + masterHabitat.getName();


		hd = new HierarchicalDispatcher();


    try {


      if (sm != null) sienaMaster = sm;


      hd.setMaster(sienaMaster);


      // masterHabitat.log(": master is " + sienaMaster);


    } catch (siena.InvalidSenderException ihe) {


      ihe.printStackTrace();


    } catch (IOException ioe) {


      ioe.printStackTrace();


    }

    Runtime.getRuntime().addShutdownHook(new Thread() {
	public void run() {
	  System.err.println("Shutting down");
	  hd.shutdown();
	}
      });




    Filter filter = null;





    filter = new Filter();


    filter.addConstraint("habitatCategory", masterHabitat.getCategory());


    new FilterThread(hd, filter, this).start();


    


    filter = new Filter();


    filter.addConstraint("habitatName", masterHabitat.getName());


    new FilterThread(hd, filter, this).start();


  }


  


  public void notify(Notification[] e) {}


  public void notify(Notification n) {


    masterHabitat.log("GateKeeper: recevied ");


    AttributeValue rav = n.getAttribute("EventType");


    if (rav == null) {


			masterHabitat.log("Received a null attribute for: EventType");


			return;


		}


    


		String av = rav.stringValue();


    


    if(av.equals("ServiceRequest")) {


			processServiceRequest(n);


    } else if(av.equals("Response2ServiceRequest")) {


			processResponse2ServiceRequest(n);


    }


	}





  private static final String SERVER_S = "ServerService";


  private static final String CLIENT_S = "ClientService";


  private static final String TOTALPARAMS = "totalParams";


  private static final String TOTALRETVALS = "totalRetvals";





	public void broadcast_req(String clientService, String serverService, Hashtable h) {


    masterHabitat.log("GateKeeper: broadcast_req for " + serverService);


    // maintain local reference to hashTable: h


    currServiceReqList.put(clientService, h);


    


    Notification n = new siena.Notification();


    for (Enumeration e=h.keys(); e.hasMoreElements(); ) {


      String key = e.nextElement().toString();


      n.putAttribute(key, "" + h.get(key));


    }


		n.putAttribute("source", masterHabitat.getName());


		n.putAttribute(SERVER_S, serverService);     


		n.putAttribute(CLIENT_S, clientService);     


    


		try {


      masterHabitat.log("GateKeeper: broadcasting: ");


      // send out event


			hd.publish(n);


		} catch (siena.SienaException se) {


			se.printStackTrace();


		}


	}





  private boolean allowed(String _sName, String _sDesc) {


    return true;


  }





	private int getNextID() {


		return (int) (Math.random() * 1000);


	}





  public void processServiceRequest(Notification n) {


    masterHabitat.log(myDescription + ":: processing a Service Request ");


		// do some simple security clearance


		// assign an ID number


		// create a new treaty and add it to the list of sumits


		// if security cleared create a proxy of the service object





		String clientHabitat = null, clientService = null, serverService = null;


		int totalParams = 0, totalRetvals = 0;


		Notification res_notif = new Notification();


    


		AttributeValue av = n.getAttribute("source");


		if (av != null) clientHabitat = av.stringValue();


		


    av = n.getAttribute(CLIENT_S);


		if (av != null) clientService = av.stringValue();


		


    av = n.getAttribute(SERVER_S);


		if (av != null) serverService = av.stringValue();


		


    av = n.getAttribute(TOTALPARAMS);


		if (av != null) totalParams = av.intValue();		// total parameters


		


    av = n.getAttribute(TOTALRETVALS);


		if (av != null)	totalRetvals = av.intValue(); 	// total return values 


		


    masterHabitat.log("Service Request for -> " + serverService + " from -> " + clientHabitat);


    masterHabitat.localService("Security Check on " + clientHabitat);


    if(allowed(clientHabitat, clientService)) {


      masterHabitat.localService("Security Check Cleared on " + clientHabitat);


			// send a +ve response


			int ID = getNextID();


			res_notif.putAttribute("habitatName", clientHabitat);


			res_notif.putAttribute("EventType", "Response2ServiceRequest");


			res_notif.putAttribute("Access", "Allowed");			// could have used ID only but just in case


			res_notif.putAttribute("Treaty", "AcceptedAll");	


			/* AcceptAll = all the ip_params and op_params sent in the 


			*  request were allowed. OR


			*  New Treaty = the new treaty description follows thsi event 


			*  that gives a new description of the ip_params and the op_params


			*  currently only AcceptAll implemented


			*/


			res_notif.putAttribute(CLIENT_S, clientService);


			res_notif.putAttribute(SERVER_S, serverService);


			res_notif.putAttribute("ID", ID); 


			


			Vector params = new Vector();


			Vector retvals = new Vector();





      for (int i=1; i<=totalParams; i++) {


				av = n.getAttribute("params" + i);


				if (av != null) params.add(av.stringValue());


			}


      


			for (int i=1; i<=totalRetvals; i++) {


				av = n.getAttribute("retvals" + i);


				if (av != null) retvals.add(av.stringValue());


			}





      masterHabitat.localService("Negotiating with " + clientHabitat);


      masterHabitat.localService("New Treaty and Summit ID created for " + clientHabitat);


      


      Treaty t = null;


      summits_list.put(new Integer(ID), 


                       t = new Treaty(serverService, clientService, ID, 


                                  clientHabitat, masterHabitat.getName(), 


                                  params, retvals));





      Filter f1 = new Filter();


      f1.addConstraint("CurrentSummitID", ID + "_" + serverService);


      new FilterThread(hd, f1, new SummitHandler(clientService, serverService, t, this)).start();





		}


		else {


			// send a -ve response


			res_notif.putAttribute("habitatName", clientHabitat);


			res_notif.putAttribute("EventType", "Response2ServiceRequest");


			res_notif.putAttribute("Access", "Denied");


		}


    


		try {


      // treaty created, now send reply to requesting habService


			hd.publish(res_notif);


		} catch (siena.SienaException se) {


			se.printStackTrace();


		}


	}


  


	private Vector get_IP_params_from_Notification(Notification n) {


		return (new Vector());


	}


  


  public void processResponse2ServiceRequest(Notification n) {


    masterHabitat.log( myDescription + " :: Recieved Response2ServiceRequest");


    AttributeValue av = n.getAttribute("Access");


    int ID;


    if (av != null) {


      if ((av.stringValue()).equals("Allowed")) {


        av = n.getAttribute("ID");


        if (av != null) {


          ID = av.intValue();


          String clientHabService = n.getAttribute(CLIENT_S).stringValue();


          String serverHabService = n.getAttribute(SERVER_S).stringValue();


          masterHabitat.log( myDescription + " :: Allowed access to " + serverHabService);


          


          Hashtable oldHash = (Hashtable) currServiceReqList.get(clientHabService);


          String serverHabitat = oldHash.get("habitatCategory") + "";





          int totalParams = Integer.parseInt("" + oldHash.get("totalParams"));


          int totalRetvals = Integer.parseInt("" + oldHash.get("totalRetvals"));





          // figure out num params/retvals


          Vector params = new Vector(totalParams), retvals = new Vector(totalRetvals);


          for (int i=1; i<=totalParams; i++) params.add(oldHash.get("params" + i));


          for (int i=1; i<=totalRetvals; i++) retvals.add(oldHash.get("retvals" + i));





          masterHabitat.log( myDescription + " :: Creating New Treaty ");


          Treaty t = null; 


          summits_list.put(new Integer(ID), 


                           t = new Treaty(serverHabService, clientHabService, ID, 


                                      serverHabitat, masterHabitat.getName(),


                                      params, retvals));





          // t.printIPList(); t.printOPList();


          // treaty created, now notify requesting habService


          Hashtable newHash


            = masterHabitat.getService(clientHabService).performService(serverHabService, null);


          


          masterHabitat.log( myDescription + "Notifying Service " + clientHabService + "to start using Remote Service " + serverHabService);





          n = new siena.Notification();


          for (Enumeration e = newHash.keys(); e.hasMoreElements(); ) {


            String key = e.nextElement().toString();


            if (t.valid_ip_param(key) || t.valid_op_param(key))


              n.putAttribute(key, "" + newHash.get(key));


            else masterHabitat.log("Invalid IP");


          }


          n.putAttribute("CurrentSummitID", ID + "_" + serverHabService);


          


          Filter f1 = new Filter();


          f1.addConstraint("CurrentSummitID", ID + "_" + clientHabService);


          new FilterThread(hd, f1, new SummitHandler(serverHabService, clientHabService, t, this)).start();





          try {


            masterHabitat.log("GateKeeper: publishing: ");


            // send out to server 


            hd.publish(n);


          } catch (SienaException se) {


            se.printStackTrace();


          }


          


        } else { /* nothing */ }


      } else {


        masterHabitat.log("Access Denied");


        // masterHabitat.notifyService(); .. wake up the service waiting for this failure notification


      }


      // response to the service request


      // create a treaty with the params 


      // save the ID number recieved by the remote GK


      // notify the service to start using the service


    } else { /* nothing */ }


    masterHabitat.log("GateKeeper: processResponse2ServiceRequest ended: ");


  }


	


	class SummitHandler implements Notifiable {


    final Treaty treaty;


		final GateKeeper masterGK;


    final String targetService;


    final String localService;


		public SummitHandler(String ts, String ls, Treaty _t, GateKeeper _gk) {


      treaty = _t;


			masterGK = _gk;


      targetService = ts;


      localService = ls;


		}


  	public void notify(Notification n[]) {}


  	public void notify(Notification n) {


      masterHabitat.log("SummitHandler: notify ");


      // need validation in here


      


      Notification send_notif = new Notification();


      Hashtable retvals = new Hashtable();





      boolean terminateSummit = false;


      for (Iterator i = n.attributeNamesIterator(); i.hasNext(); ) {


        String key = "" + i.next();


        if (!key.equals("CurrentSummitID") && !key.equals("habitatCategory")) {


          if (treaty.valid_ip_param(key) || treaty.valid_op_param(key)) {


            retvals.put(key, n.getAttribute(key).stringValue());            


          } else {


            send_notif.clear();


            send_notif.putAttribute("Terminate Summit" , "Invalid number of params");


            terminateSummit = true;


		  		  break;


          }


        }


      }





      masterHabitat.log(treaty.printIPList());


      masterHabitat.log(treaty.printOPList());


      if (! terminateSummit) {


        ServiceInterface sInf = masterHabitat.getService(localService);


        Hashtable newHash = sInf.performService(treaty.serverHabService, retvals);


        


        send_notif = new siena.Notification();


        boolean isResultNull = false;





        if (newHash == null) {


          send_notif.clear();


          send_notif.putAttribute("Terminate Summit" , "Nothing to be returned");


        } else {


          for (Enumeration e = newHash.keys(); e.hasMoreElements(); ) {


            String key = e.nextElement().toString();


            if (treaty.valid_ip_param(key) || treaty.valid_op_param(key)) {


              send_notif.putAttribute(key, "" + newHash.get(key));


            } else {


            // masterHabitat.log("SummitHandler: here, terminating, " + key);


              send_notif.clear();


              send_notif.putAttribute("Terminate Summit" , "Invalid number of retvals");


			    	  break;


            }


          }


        }


      }


      send_notif.putAttribute("CurrentSummitID", treaty.getID() + "_" + targetService);


      try {


        // send out to server


        hd.publish(send_notif);


      } catch (SienaException se) {


        se.printStackTrace();


      }


      


      


      /* Notification send_notif = new Notification();


			send_notif.putAttribute("currentSummitID", ID);


			Treaty currTreaty = (Treaty) masterGK.summits_list.get(new Integer(ID)); 


			// check for termination by peer 


			if (send_notif.size() != currTreaty.get_IP_size()) {


				send_notif.putAttribute("Terminate Summit" , "Invalid number of params");


				return;


			} else { 


				Vector ip = (Vector) currTreaty.getIPList();


			  Hashtable forService = new Hashtable();


			  for(int i =0; i < ip.size(); i++) {


			  	String ip_par = (String) ip.elementAt(i);


			  	AttributeValue av = send_notif.getAttribute(ip_par);


			  	if (av!= null) {


			  		forService.put(ip_par, av.stringValue()); // need to pass the list to the params


			  	}


			  }





				// might be replaced by a lookup on a corba object


				ServiceInterface _service = masterHabitat.getService(currTreaty.servUsed);


				Vector result2Bsent = _service.performService(forService);





				for (int _v = 0; _v < result2Bsent.size(); _v++) {


					MyAttributeValuePair _avp = (MyAttributeValuePair) result2Bsent.elementAt(_v);


					if (currTreaty.valid_op_param(_avp.getValue())) {


						send_notif.putAttribute(_avp.getAttribute(), _avp.getValue());


					}


					else {


						send_notif.clear();


						send_notif.putAttribute("Terminate Summit" , "Invalid number of params");


						// break;


					}


				}


			}*/


		}


	}


}
\ No newline at end of file
diff --git a/Habitat.java b/Habitat.java
index eabe0fa..58fd25d 100644
--- a/Habitat.java
+++ b/Habitat.java
@@ -4,111 +4,97 @@ import java.io.*;
 import java.util.*;

 import psl.habitats.portal.HabitatPortal;
-import psl.habitats.portal.HabitatMonitor;
-


 public class Habitat {
-    String roleName, category;
-    Hashtable serviceObjects;
-    HabitatPortal hp = null;
-    HabitatMonitor hm = null;
+  String roleName, category;
+  Hashtable serviceObjects;
+  HabitatPortal hp = null;
+
+	public final GateKeeper gk;
+  public Habitat(String name, String c, String file, String sienaMaster) {
+		roleName = name;
+		category = c;
+		serviceObjects = new Hashtable();
+		FileIO fileRW = new FileIO();
+		Hashtable serviceList;
+
+    /*
+    FrontEnd fe = new FrontEnd();
+		Console ad = new Console();
+	  ad.cf_show("Admin Frame");
+		ad.cf_show("Admin Console");
+    */
+
+		// read the services
+    if (file == null) file = ".serviceList";
+		serviceList = fileRW.readFile(file, ",");

-    public final GateKeeper gk;
-    public Habitat(String name, String c, String file, String sienaMaster) {
-	roleName = name;
-	category = c;
-	serviceObjects = new Hashtable();
-	FileIO fileRW = new FileIO();
-	Hashtable serviceList;
-
-	// read the services
-	if (file == null) file = ".serviceList";
-	serviceList = fileRW.readFile(file, ",");
+    // set the sienaMaster
+    if (sienaMaster == null)
+      sienaMaster = "senp://canal.psl.cs.columbia.edu:31331";

-	// set the sienaMaster
-	if (sienaMaster == null)
-	    sienaMaster = "senp://canal.psl.cs.columbia.edu:31331";
-
-	gk = new GateKeeper(this, sienaMaster);
-	hm = new HabitatMonitor(name);
+		gk = new GateKeeper(this, sienaMaster);

-	// initialize the services
-	for (Enumeration e = serviceList.elements() ; e.hasMoreElements() ;) {
+    // initialize the services
+		for (Enumeration e = serviceList.elements() ; e.hasMoreElements() ;) {
 	    try {
-		Class t = Class.forName((String) e.nextElement());
-		ServiceInterface s = (ServiceInterface) t.newInstance();
-		serviceObjects.put(s.getDescription(), s);
-		s.initialize(this);
-		System.out.println("Started sevice " + s.getDescription()+ "\n");
-
-		// add a monitor for this service
-		hm.addmonitor(s.getDescription());
-
-		// log in habitat monitor
-		log("Found service :" + s.getDescription());
-
-		// log in service monitor
-		svclog(s.getDescription(), "Started service :" + s.getDescription());
+				Class t = Class.forName((String) e.nextElement());
+				ServiceInterface s = (ServiceInterface) t.newInstance();
+				serviceObjects.put(s.getDescription(), s);
+				s.initialize(this);
+				// ad.cf_add("Started sevice " + s.getDescription()+ "\n");
+        System.out.println("Started sevice " + s.getDescription()+ "\n");
+
+        // s.startDisplay();

-	    } catch (Exception ex) {
-		ex.printStackTrace();
+      } catch (Exception ex) {
+				ex.printStackTrace();
 	    }
+		}
+
+    hp = new HabitatPortal(name, serviceObjects.elements());
+  }
+	public String getName() {
+		return roleName;
 	}
-
-	hp = new HabitatPortal(name, serviceObjects.elements());
-
-	// display monitor frame relative to portal frame
-	hm.relativedisplay(hp);
-    }
-
-    // send log messages to service monitors
-    public void svclog(String servname, String message) {
-	hm.writemonitor(message, servname);
-    }
-
-    public String getName() {
-	return roleName;
-    }
-    public String getCategory() {
-	return category;
-    }
-    public ServiceInterface getService(String _svdes) {
-	return((ServiceInterface)serviceObjects.get(_svdes));
-    }
-    static public boolean localService(String servDes) {
-	return false;
-    }
-
-    // send message to habitat monitor
-    public void log(String msg) {
-	hm.log(msg);
-    }
+	public String getCategory() {
+		return category;
+	}
+	public ServiceInterface getService(String _svdes) {
+		return((ServiceInterface)serviceObjects.get(_svdes));
+	}
+  static public boolean localService(String servDes) {
+    return false;
+  }
+  public void log(String msg) {
+    hp.log(msg);
+  }
+
+  private static void usage() {
+    System.out.println("java psl.habitats.Habitat <habName> <habCategory> [-sl <file>] [-sm <uri>]");
+    System.out.println(" <habName>     : habitat name");
+    System.out.println(" <habCategory> : habitat category");
+    System.out.println(" [-sl <file>]  : initial serviceList file [default: .serviceList]");
+    System.out.println(" [-sm <uri>]   : siena master             [default: senp://canal:31331/");
+    System.exit(0);
+  }
+  public static void main(String args[]) {
+    if (args.length < 2) usage();
+
+    String habName = args[0];
+    String habCategory = args[1];
+    String file = null, sm = null;

-    private static void usage() {
-	System.out.println("java psl.habitats.Habitat <habName> <habCategory> [-sl <file>] [-sm <uri>]");
-	System.out.println(" <habName>     : habitat name");
-	System.out.println(" <habCategory> : habitat category");
-	System.out.println(" [-sl <file>]  : initial serviceList file [default: .serviceList]");
-	System.out.println(" [-sm <uri>]   : siena master             [default: senp://canal:31331/");
-	System.exit(0);
+    int i = 2;
+    while (i<args.length) {
+      if (args[i].equals("-sl")) file = args[++i];
+      else if (args[i].equals("-sm")) sm = args[++i];
+      i++;
     }
-    public static void main(String args[]) {
-	if (args.length < 2) usage();
-
-	String habName = args[0];
-	String habCategory = args[1];
-	String file = null, sm = null;
-
-	int i = 2;
-	while (i<args.length) {
-	    if (args[i].equals("-sl")) file = args[++i];
-	    else if (args[i].equals("-sm")) sm = args[++i];
-	    i++;
+
+	  new Habitat(habName, habCategory, file, sm);
 	}
-
-	new Habitat(habName, habCategory, file, sm);
-    }
 }


diff --git a/portal/HabitatPortal.java b/portal/HabitatPortal.java
index dab259c..a8de0da 100644
--- a/portal/HabitatPortal.java
+++ b/portal/HabitatPortal.java
@@ -1 +1 @@
-package psl.habitats.portal;

import psl.habitats.ServiceInterface;
import java.awt.Dimension;
import java.awt.CardLayout;
import java.awt.GridLayout;
import java.awt.BorderLayout;

import javax.swing.JList;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;

import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;


public class HabitatPortal extends JFrame {


  private static final int WIDTH = 800;
  private static final int HEIGHT = 450;
  private static final int CTRL_WIDTH = 200;
  private static final int CTRL_HEIGHT = 200;

  private final Hashtable _portals;
  private final JPanel _mainPanel;
  private final JPanel _ctrlPanel;
  private final JList _servicesList;
  private final JLabel _dataLabel;
  private final JPanel _portalPanel;
  private final CardLayout _cardLayout;

  public HabitatPortal(String habitatName, Enumeration services) {

    // Data struRctures ///////////////////////////////////////////////////
    _portals = new Hashtable();

    // GUI stuff /////////////////////////////////////////////////////////

    //CKL -- for my ease of testing
    if (habitatName.charAt(0) == 'A') {
	setLocation(100, 50);
    } else if (habitatName.charAt(0) == 'T') {
	setLocation(200, 100);
    } else if (habitatName.charAt(0) == 'N') {
	setLocation(300, 150);
    }

    setTitle(habitatName);
    setSize(HabitatPortal.WIDTH, HabitatPortal.HEIGHT);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    _mainPanel = new JPanel(new BorderLayout());
    _ctrlPanel = new JPanel(new GridLayout(2, 1, 5, 5));
    _dataLabel = new JLabel("");
    _portalPanel = new JPanel(_cardLayout = new CardLayout());

    if (services != null) {
      Vector servicesListing = new Vector();
      while (services.hasMoreElements()) {
        ServiceInterface si = (ServiceInterface) services.nextElement();
        String serviceDesc = si.getDescription();
        servicesListing.add(serviceDesc);
        _portalPanel.add(si.startDisplay(), serviceDesc);
        _portals.put(serviceDesc, si);
      }

      _servicesList = new JList(servicesListing.toArray());
    } else _servicesList = new JList(new String[] { "hello", "there" });

    _servicesList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent lse) {
        String service = "" + _servicesList.getSelectedValue();
        try {
          _dataLabel.setText(generateHTML(_portals.get(service)));
          _cardLayout.show(_portalPanel, service);
	  validate();
        } catch (Exception e) { }
      }
    });

    _mainPanel.add(_ctrlPanel, BorderLayout.WEST);
    _mainPanel.add(_portalPanel, BorderLayout.CENTER);

    _ctrlPanel.add(new JScrollPane(_servicesList));
    _ctrlPanel.add(new JScrollPane(_dataLabel));

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(_mainPanel, "Center");

    show();
  }

  public void updatePortal(String key) {
    _cardLayout.show(_portalPanel, key);
  }

  private String generateHTML(Object o) {
    if (o instanceof ServiceInterface) 
      return ((ServiceInterface) o).getDetailDescription();
    else return "INVALID";
  }

  public static void main(String args[]) {
    new HabitatPortal("HabitatPortal", null);
  }
}
\ No newline at end of file
+package psl.habitats.portal;





import psl.habitats.ServiceInterface;





import java.awt.Dimension;


import java.awt.CardLayout;


import java.awt.GridLayout;


import java.awt.BorderLayout;





import javax.swing.JList;


import javax.swing.JFrame;


import javax.swing.JPanel;


import javax.swing.JLabel;


import javax.swing.JTextArea;


import javax.swing.JScrollPane;


import javax.swing.JSplitPane;


import javax.swing.event.ListSelectionEvent;


import javax.swing.event.ListSelectionListener;





import java.util.Vector;


import java.util.Hashtable;


import java.util.Enumeration;





public class HabitatPortal extends JFrame {


  private static final int WIDTH = 800;


  private static final int HEIGHT = 600;


  private static final int CTRL_WIDTH = 200;

  private static final int CTRL_HEIGHT = 200;
  


  private final Hashtable _portals;





  private final JPanel _mainPanel;


  private final JPanel _ctrlPanel;


  private final JList _servicesList;


  private final JLabel _dataLabel;


  private final JPanel _portalPanel;


  private final JTextArea _logArea;


  private final JScrollPane _logPane;


  


  private final CardLayout _cardLayout;


  


  public HabitatPortal(String habitatName, Enumeration services) {


    


    // Data struRctures ///////////////////////////////////////////////////


    _portals = new Hashtable();


    


    // GUI stuff /////////////////////////////////////////////////////////


    setTitle(habitatName);


    setSize(HabitatPortal.WIDTH, HabitatPortal.HEIGHT);


    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


    


    _mainPanel = new JPanel(new BorderLayout());


    _ctrlPanel = new JPanel(new GridLayout(2, 1, 5, 5));


    _dataLabel = new JLabel("");


    _portalPanel = new JPanel(_cardLayout = new CardLayout());

    _logArea = new JTextArea();
    _logPane = new JScrollPane(_logArea);


    _logArea.setEditable(false);

    if (services != null) {
      Vector servicesListing = new Vector();
      while (services.hasMoreElements()) {
        ServiceInterface si = (ServiceInterface) services.nextElement();
        String serviceDesc = si.getDescription();
        servicesListing.add(serviceDesc);
        _portalPanel.add(si.startDisplay(), serviceDesc);
        _portals.put(serviceDesc, si);
      }

      _servicesList = new JList(servicesListing.toArray());
    } else _servicesList = new JList(new String[] { "hello", "there" });

    _servicesList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent lse) {
        String service = "" + _servicesList.getSelectedValue();
        try {
          _dataLabel.setText(generateHTML(_portals.get(service)));
          _cardLayout.show(_portalPanel, service);
	  validate();
        } catch (Exception e) { }
      }
    });

    _mainPanel.add(_ctrlPanel, BorderLayout.WEST);
    _mainPanel.add(_portalPanel, BorderLayout.CENTER);
    //    _mainPanel.add(_logPane, BorderLayout.SOUTH);

    _ctrlPanel.add(new JScrollPane(_servicesList));
    _ctrlPanel.add(new JScrollPane(_dataLabel));
    //    _ctrlPanel.setMinimumSize(new Dimension(CTRL_WIDTH, CTRL_HEIGHT));

    JSplitPane _mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
					   _mainPanel, 
					   _logPane);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(_mainSplit, "Center");
    show();
  }


  


  public void updatePortal(String key) {


    _cardLayout.show(_portalPanel, key);


  }


  public void log(String msg) {


    _logArea.append(msg + "\n");
    
    _logArea.setCaretPosition(_logArea.getDocument().getLength());

  }


  


  private String generateHTML(Object o) {


    if (o instanceof ServiceInterface) 


      return ((ServiceInterface) o).getDetailDescription();


    else return "INVALID";


  }





  public static void main(String args[]) {


    new HabitatPortal("HabitatPortal", null);


  }


}
\ No newline at end of file
diff --git a/services/AlertService.java b/services/AlertService.java
index fcd53fa..e110628 100644
--- a/services/AlertService.java
+++ b/services/AlertService.java
@@ -1 +1 @@
-package psl.habitats.services;

import psl.habitats.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import java.util.Date;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;


public class AlertService implements ServiceInterface {
    
    private static final String myDescription = "AlertService";
    Habitat masterHabitat = null;
    
    public void initialize(Habitat _h) {
	masterHabitat = _h;
    }
    
    public String getDescription(){
	return myDescription;
    }
    
    public String getDetailDescription(){
	StringBuffer _stringBuffer = new StringBuffer();
	_stringBuffer.setLength(0);
	_stringBuffer.append("<html><body>");
	_stringBuffer.append("<h1>" + getDescription() + "</h1>");
	_stringBuffer.append("<table border=4>");
	_stringBuffer.append("<tr><td>Purpose</td><td>Hit Panic Button</td></tr>");
	_stringBuffer.append("<tr><td>Availablity</td><td>Selected</td></tr>");
	_stringBuffer.append("<tr><td>Monitor</td><td>True</td></tr>");
	_stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text</td></tr>");
	_stringBuffer.append("</table>");
	_stringBuffer.append("</body></html>");
	
	return _stringBuffer + "";
    }
    
    private JPanel panel;
    public JPanel startDisplay() {
	return (panel = new JPanel());
    }
    
    private static final String key1 = "First_Name";
    private static final String key2 = "Last_Name";
    private static final String key3 = "Boarding_City";
    private static final String key4 = "Boarding_Date";
    private static final String key5 = "Address";
    private static final String key6 = "Telephone";
    private static final String key7 = "SSN";
    private static final String key8 = "Age";
    private static final String key9 = "Image";
    
    public Hashtable performService(String _senderService, Hashtable ipList) {
	StringBuffer _stringBuffer = new StringBuffer();
	
	_stringBuffer.setLength(0);
	_stringBuffer.append("<html><body>\n");
	_stringBuffer.append("<h1>" + getDescription() + "</h1>\n");
	_stringBuffer.append("<table border=4>\n");
	
	for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {
	    String key = e.nextElement().toString();
	    
	    if (key.equals(key9)) continue; 
	    _stringBuffer.append("<tr><td>"+key+"</td><td>"+ipList.get(key)+"</td></tr>\n");
	    
	}
	
	_stringBuffer.append("<tr><td colspan=2><img src="+ipList.get(key9)+"></td></tr>\n");
	_stringBuffer.append("</table>\n");
	_stringBuffer.append("</body></html>\n");
	
	final JLabel label = new JLabel("" + _stringBuffer);
	
	JOptionPane.showMessageDialog(null, label, "Alert Service", JOptionPane.WARNING_MESSAGE);

	/** Janak's lame attempt at getting flashing to work: either flash
	 * while the JOptionPane is up (Thread must start before
	 * showMessageDialog), or by using a JDialog with a custom border
	 */
	
	//     new Thread() {
	//       public void run() {
	// 	try {
// 	  for(int i=0; i < 10; i++) {
// 	    label.setBackground(Color.red);
// 	    Thread.currentThread().sleep(500);
// 	    label.setBackground(Color.black);
// 	    Thread.currentThread().sleep(500);
// 	  }
// 	} catch(InterruptedException ie) { ; }
//       }
//     }.start();


//     final JDialog d = new JDialog();

//     d.setLayout(new BorderLayout());

//     JLabel alertLabel = new JLabel("ALERT!", SwingConstants.CENTER);
//     d.add(alertLabel, "North");
//     d.add(label, "Center");
//     JButton okButton = new JButton("OK");
//     okButton.addActionListener(new ActionListener() {
// 	public void actionPerformed(ActionEvent e) {
// 	  d.dispose();
// 	}
//       });
//     d.add(okButton, "South");
    
//     d.pack();
//     d.setVisible(true);

	masterHabitat.svclog(myDescription, "" + _stringBuffer);

	System.out.println("JUST LOGGED: " + _stringBuffer);
	
	return null;
    }
}
\ No newline at end of file
+package psl.habitats.services;


import psl.habitats.*;





import java.awt.*;
import java.awt.event.*;
import javax.swing.*;





import java.util.Date;


import java.util.Vector;


import java.util.Hashtable;


import java.util.Enumeration;





public class AlertService implements ServiceInterface {


  private static final String myDescription = "AlertService";


  Habitat masterHabitat = null;


  public void initialize(Habitat _h) {


    masterHabitat = _h;


  }


  public String getDescription(){


    return myDescription;


  }


  public String getDetailDescription(){


    StringBuffer _stringBuffer = new StringBuffer();


    _stringBuffer.setLength(0);


    _stringBuffer.append("<html><body>");


    _stringBuffer.append("<h1>" + getDescription() + "</h1>");


    _stringBuffer.append("<table border=4>");


    _stringBuffer.append("<tr><td>Purpose</td><td>Hit Panic Button</td></tr>");


    _stringBuffer.append("<tr><td>Availablity</td><td>Selected</td></tr>");


    _stringBuffer.append("<tr><td>Monitor</td><td>True</td></tr>");


    _stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text</td></tr>");


    _stringBuffer.append("</table>");


    _stringBuffer.append("</body></html>");


    return _stringBuffer + "";


  }


  private JPanel panel;


  public JPanel startDisplay() {


    return (panel = new JPanel());


  }





  private static final String key1 = "First_Name";


  private static final String key2 = "Last_Name";


  private static final String key3 = "Boarding_City";


  private static final String key4 = "Boarding_Date";


  private static final String key5 = "Address";


  private static final String key6 = "Telephone";


  private static final String key7 = "SSN";


  private static final String key8 = "Age";


  private static final String key9 = "Image";





  public Hashtable performService(String _senderService, Hashtable ipList) {


    StringBuffer _stringBuffer = new StringBuffer();


    _stringBuffer.setLength(0);


    _stringBuffer.append("<html><body>\n");


    _stringBuffer.append("<h1>" + getDescription() + "</h1>\n");


    _stringBuffer.append("<table border=4>\n");


    for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {


      String key = e.nextElement().toString();


      if (key.equals(key9)) continue; 


      _stringBuffer.append("<tr><td>"+key+"</td><td>"+ipList.get(key)+"</td></tr>\n");


    }


    _stringBuffer.append("<tr><td colspan=2><img src="+ipList.get(key9)+"></td></tr>\n");


    _stringBuffer.append("</table>\n");


    _stringBuffer.append("</body></html>\n");





    final JLabel label = new JLabel("" + _stringBuffer);


    JOptionPane.showMessageDialog(null, label, "Alert Service", JOptionPane.WARNING_MESSAGE);

    /** Janak's lame attempt at getting flashing to work: either flash
     * while the JOptionPane is up (Thread must start before
     * showMessageDialog), or by using a JDialog with a custom border
     */

//     new Thread() {
//       public void run() {
// 	try {
// 	  for(int i=0; i < 10; i++) {
// 	    label.setBackground(Color.red);
// 	    Thread.currentThread().sleep(500);
// 	    label.setBackground(Color.black);
// 	    Thread.currentThread().sleep(500);
// 	  }
// 	} catch(InterruptedException ie) { ; }
//       }
//     }.start();


//     final JDialog d = new JDialog();

//     d.setLayout(new BorderLayout());

//     JLabel alertLabel = new JLabel("ALERT!", SwingConstants.CENTER);
//     d.add(alertLabel, "North");
//     d.add(label, "Center");
//     JButton okButton = new JButton("OK");
//     okButton.addActionListener(new ActionListener() {
// 	public void actionPerformed(ActionEvent e) {
// 	  d.dispose();
// 	}
//       });
//     d.add(okButton, "South");
    
//     d.pack();
//     d.setVisible(true);

    masterHabitat.log("" + _stringBuffer);


    System.out.println("JUST LOGGED: " + _stringBuffer);





    return null;


  }


}
\ No newline at end of file
diff --git a/services/EventService.java b/services/EventService.java
index 221bed6..aec5f2a 100644
--- a/services/EventService.java
+++ b/services/EventService.java
@@ -9,305 +9,267 @@ import java.util.Hashtable;
 import java.util.Enumeration;

 public class EventService implements ServiceInterface {
-    String myDescription = "Event_Manager";
-    Habitat masterHabitat = null;
-
-    private final Hashtable informationCatalogue = new Hashtable();
-
-    private static final String key1 = "First_Name";
-    private static final String key2 = "Last_Name";
-    private static final String key3 = "Boarding_City";
-    private static final String key4 = "Boarding_Date";
-    private static final String key5 = "Address";
-    private static final String key6 = "Telephone";
-    private static final String key7 = "SSN";
-    private static final String key8 = "Age";
-    private static final String key9 = "Image";
+  String myDescription = "Event_Manager";
+  Habitat masterHabitat = null;
+
+  private final Hashtable informationCatalogue = new Hashtable();
+
+  private static final String key1 = "First_Name";
+  private static final String key2 = "Last_Name";
+  private static final String key3 = "Boarding_City";
+  private static final String key4 = "Boarding_Date";
+  private static final String key5 = "Address";
+  private static final String key6 = "Telephone";
+  private static final String key7 = "SSN";
+  private static final String key8 = "Age";
+  private static final String key9 = "Image";
+
+  public void initialize(Habitat _h){
+    masterHabitat = _h;
+  }
+  public String getDescription() {
+    return myDescription;
+  }
+  public String getDetailDescription(){
+    StringBuffer _stringBuffer = new StringBuffer();
+    _stringBuffer.setLength(0);
+    _stringBuffer.append("<html><body>");
+    _stringBuffer.append("<h1>" + getDescription() + "</h1>");
+    _stringBuffer.append("<table border=4>");
+    _stringBuffer.append("<tr><td>Purpose</td><td>Receive and Update Events </td></tr>");
+    _stringBuffer.append("<tr><td>Availablity</td><td>Local</td></tr>");
+    _stringBuffer.append("<tr><td>Monitor</td><td>True</td></tr>");
+    _stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text</td></tr>");
+    _stringBuffer.append("</table>");
+    _stringBuffer.append("</body></html>");
+    return _stringBuffer + "";
+  }
+
+  private String phaseOneData;
+  public JPanel startDisplay(){
+    // start the GUI here
+    JPanel panel = new JPanel();
+    panel.setLayout(new BorderLayout(0, 10));
+    panel.add(new JLabel("FOR USE BY AUTHORIZED PERSONNEL!",
+			 SwingConstants.CENTER), "North");
+
+    // Set up the entry fields
+    JPanel gridPanel = new JPanel();
+    gridPanel.setLayout(new GridLayout(4,2));
+
+    gridPanel.add(new JLabel("Type of Event: "));
+    gridPanel.add(new JTextField(10));
+
+    gridPanel.add(new JLabel("Available Data: "));
+    gridPanel.add(new JTextField(10));
+
+    gridPanel.add(new JLabel("Description: "));
+    gridPanel.add(new JTextField(10));
+
+    final JLabel label = new JLabel("Enter name: ");
+    final JTextField text = new JTextField(20);
+    gridPanel.add(label);
+    gridPanel.add(text);
+
+    // Stick the fields and buttons together so that they remain adjacent
+    // in the main panel
+    JPanel fieldsAndButtonsPanel = new JPanel();
+    fieldsAndButtonsPanel.setLayout(new BorderLayout());

-    public void initialize(Habitat _h){
-	masterHabitat = _h;
-    }
-    public String getDescription() {
-	return myDescription;
+    // Now add gridpanel to our parent, but wrap it in a BorderLayout
+    // to "squeeze" it at the top
+    {
+      JPanel fieldPanel = new JPanel();
+      fieldPanel.setLayout(new BorderLayout());
+      fieldPanel.add(gridPanel, "North");
+      fieldsAndButtonsPanel.add(fieldPanel, "North");
     }
-    public String getDetailDescription(){
-	StringBuffer _stringBuffer = new StringBuffer();
-	_stringBuffer.setLength(0);
-	_stringBuffer.append("<html><body>");
-	_stringBuffer.append("<h1>" + getDescription() + "</h1>");
-	_stringBuffer.append("<table border=4>");
-	_stringBuffer.append("<tr><td>Purpose</td><td>Receive and Update Events </td></tr>");
-	_stringBuffer.append("<tr><td>Availablity</td><td>Local</td></tr>");
-	_stringBuffer.append("<tr><td>Monitor</td><td>True</td></tr>");
-	_stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text</td></tr>");
-	_stringBuffer.append("</table>");
-	_stringBuffer.append("</body></html>");
-	return _stringBuffer + "";
-    }
-
-    private String phaseOneData;
-    public JPanel startDisplay(){
-	// start the GUI here
-	JPanel panel = new JPanel();
-	panel.setLayout(new BorderLayout(0, 10));
-	panel.add(new JLabel("FOR USE BY AUTHORIZED PERSONNEL!",
-			     SwingConstants.CENTER), "North");
-
-	// Set up the entry fields
-	JPanel gridPanel = new JPanel();
-	gridPanel.setLayout(new GridLayout(4,2));
-
-	gridPanel.add(new JLabel("Type of Event: "));
-	gridPanel.add(new JTextField(10));
-
-	gridPanel.add(new JLabel("Available Data: "));
-	gridPanel.add(new JTextField(10));
-
-	gridPanel.add(new JLabel("Description: "));
-	gridPanel.add(new JTextField(10));
-
-	final JLabel label = new JLabel("Enter name: ");
-	final JTextField text = new JTextField(20);
-	gridPanel.add(label);
-	gridPanel.add(text);
-
-	// Stick the fields and buttons together so that they remain adjacent
-	// in the main panel
-	JPanel fieldsAndButtonsPanel = new JPanel();
-	fieldsAndButtonsPanel.setLayout(new BorderLayout());
-
-	// Now add gridpanel to our parent, but wrap it in a BorderLayout
-	// to "squeeze" it at the top
-	{
-	    JPanel fieldPanel = new JPanel();
-	    fieldPanel.setLayout(new BorderLayout());
-	    fieldPanel.add(gridPanel, "North");
-	    fieldsAndButtonsPanel.add(fieldPanel, "North");
-	}
-
-	{
-	    // Set up our buttons
-	    JPanel buttonPanel = new JPanel();
-	    buttonPanel.setLayout(new FlowLayout());
-	    JButton button = new JButton("Action!");
-	    buttonPanel.add(button);
-	    fieldsAndButtonsPanel.add(buttonPanel, "Center");
-
-	    button.addActionListener(new ActionListener() {
-		    public void actionPerformed(ActionEvent ae) {
-			phaseOneData = text.getText();

-			if (phaseOneData != null) {
-			    phaseOne();
-			} else {
-			    return;
-			}
-		    }
-		});
-
-	    panel.add(fieldsAndButtonsPanel, "Center");
-
-	}
-
-
-	// Put the whole thing into a BorderLayout so that it squeezes up nicely
-	panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-	return panel;
+    {
+      // Set up our buttons
+      JPanel buttonPanel = new JPanel();
+      buttonPanel.setLayout(new FlowLayout());
+      JButton button = new JButton("Action!");
+      buttonPanel.add(button);
+      fieldsAndButtonsPanel.add(buttonPanel, "Center");
+
+      button.addActionListener(new ActionListener() {
+	  public void actionPerformed(ActionEvent ae) {
+	    phaseOneData = text.getText();
+	    phaseOne();
+	  }
+	});
+
+      panel.add(fieldsAndButtonsPanel, "Center");
+
+    }
+
+
+    // Put the whole thing into a BorderLayout so that it squeezes up nicely
+    panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+    return panel;
+  }
+
+  private static final String PHASE_ONE_PEER = "NYC_Passengers_Query";
+  private static final String PHASE_TWO_PEER = "TexasResidentInfo";
+  private static final String PHASE_THREE_PEER = "AlertService";
+
+  int phaseOneProgress = 0, phaseTwoProgress = 0, phaseThreeProgress = 0;
+
+  private String hashtableListing(Hashtable h) {
+    StringBuffer sb = new StringBuffer("");
+    for (Enumeration e = h.keys(); e.hasMoreElements(); ) {
+      String key = "" + e.nextElement();
+      sb.append("key: " + key + ", val: " + h.get(key));
     }
-
-    private static final String PHASE_ONE_PEER = "NYC_Passengers_Query";
-    private static final String PHASE_TWO_PEER = "TexasResidentInfo";
-    private static final String PHASE_THREE_PEER = "AlertService";
-
-    int phaseOneProgress = 0, phaseTwoProgress = 0, phaseThreeProgress = 0;
-
-    private String hashtableListing(Hashtable h) {
-	StringBuffer sb = new StringBuffer("");
-	for (Enumeration e = h.keys(); e.hasMoreElements(); ) {
-	    String key = "" + e.nextElement();
-	    sb.append("key: " + key + ", val: " + h.get(key));
-	}
-	return "" + sb;
+    return "" + sb;
+  }
+  public Hashtable performService(String _senderService, Hashtable ipList) {
+    Hashtable result = new Hashtable();
+    if(_senderService.equals(PHASE_ONE_PEER)) {
+      masterHabitat.log(myDescription + " :: PHASE_ONE_PEER " + PHASE_ONE_PEER);
+      switch (phaseOneProgress) {
+      case 0:
+        result.put(key1, phaseOneData);
+        phaseOneProgress++;
+        break;
+
+      case 1:
+        for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {
+          String key = e.nextElement().toString();
+          informationCatalogue.put(key, ipList.get(key));
+        }
+        masterHabitat.log(myDescription + ":: Terminating Session with " + PHASE_TWO_PEER);
+        result.put("Terminate_Session", "SESSION_ENDED");
+        phaseOneProgress = 0;
+
+        // initiate phase-II
+        phaseTwo();
+        break;
+
+      }
+
+    } else if(_senderService.equals(PHASE_TWO_PEER)) {
+      masterHabitat.log(myDescription + ":: PHASE_TWO_PEER " + PHASE_TWO_PEER);
+      switch (phaseTwoProgress) {
+      case 0:
+        result.put(key1, informationCatalogue.get(key1));
+        result.put(key2, informationCatalogue.get(key2));
+        phaseTwoProgress++;
+        break;
+
+      case 1:
+        for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {
+          String key = e.nextElement().toString();
+          informationCatalogue.put(key, ipList.get(key));
+        }
+        result.put("Terminate_Session", "SESSION_ENDED");
+				masterHabitat.log(myDescription + " Terminating Session with " + PHASE_TWO_PEER);
+        phaseTwoProgress = 0;
+
+        // initiate phase-III
+        phaseThree();
+        break;
+
+      }
+    } else if(_senderService.equals(PHASE_THREE_PEER)) {
+      masterHabitat.log(myDescription + ":: PHASE_THREE_PEER" + PHASE_THREE_PEER);
+      switch (phaseThreeProgress) {
+      case 0:
+        for (Enumeration e=informationCatalogue.keys(); e.hasMoreElements(); ) {
+          String key = e.nextElement().toString();
+          if (key.equals(key3) || key.equals(key4)) continue;
+          result.put(key, informationCatalogue.get(key));
+          // masterHabitat.log("$$$$$$$$Sending this " + key);
+        }
+        phaseThreeProgress++;
+        break;
+
+      case 1:
+        phaseThreeProgress = 0;
+				masterHabitat.log(myDescription + " Terminating Session with " + PHASE_THREE_PEER);
+        result.put("Terminate_Session", "SESSION_ENDED");
+        break;
+      }
     }
-
-    public Hashtable performService(String _senderService, Hashtable ipList) {
-	Hashtable result = new Hashtable();
-	if(_senderService.equals(PHASE_ONE_PEER)) {
-
-	    masterHabitat.svclog(myDescription, myDescription + " :: PHASE_ONE_PEER " + PHASE_ONE_PEER);
-
-	    switch (phaseOneProgress) {
-	    case 0:
-		if (phaseOneData != null) {
-		    result.put(key1, phaseOneData);
-		    phaseOneProgress++;
-		    break;
-		}
-		return null;
-
-	    case 1:
-		for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {
-		    String key = e.nextElement().toString();
-		    informationCatalogue.put(key, ipList.get(key));
-		}
-
-		masterHabitat.svclog(myDescription, myDescription + ":: Terminating Session with " + PHASE_TWO_PEER);
-
-		result.put("Terminate_Session", "SESSION_ENDED");
-		phaseOneProgress = 0;
-
-		// initiate phase-II
-		phaseTwo();
-		break;
-
-	    }
-
-	} else if(_senderService.equals(PHASE_TWO_PEER)) {
-
-	    masterHabitat.svclog(myDescription, myDescription + ":: PHASE_TWO_PEER " + PHASE_TWO_PEER);
-
-	    switch (phaseTwoProgress) {
-	    case 0:
-		result.put(key1, informationCatalogue.get(key1));
-		result.put(key2, informationCatalogue.get(key2));
-		phaseTwoProgress++;
-		break;
-
-	    case 1:
-		for (Enumeration e=ipList.keys(); e.hasMoreElements(); ) {
-		    String key = e.nextElement().toString();
-		    informationCatalogue.put(key, ipList.get(key));
-		}
-		result.put("Terminate_Session", "SESSION_ENDED");
-
-		masterHabitat.svclog(myDescription, myDescription + " Terminating Session with " + PHASE_TWO_PEER);
-
-		phaseTwoProgress = 0;
-
-		// initiate phase-III
-		phaseThree();
-		break;
-
-	    }
-	} else if(_senderService.equals(PHASE_THREE_PEER)) {
-
-	    masterHabitat.svclog(myDescription, myDescription + ":: PHASE_THREE_PEER" + PHASE_THREE_PEER);
-
-	    switch (phaseThreeProgress) {
-	    case 0:
-		for (Enumeration e=informationCatalogue.keys(); e.hasMoreElements(); ) {
-		    String key = e.nextElement().toString();
-		    if (key.equals(key3) || key.equals(key4)) continue;
-		    result.put(key, informationCatalogue.get(key));
-		}
-		phaseThreeProgress++;
-		break;
-
-	    case 1:
-		phaseThreeProgress = 0;
-
-		masterHabitat.svclog(myDescription, myDescription + " Terminating Session with " + PHASE_THREE_PEER);
+
+    masterHabitat.log(myDescription + ": performService, returning: " + hashtableListing(result));
+    return result;
+  }
+  private void phaseOne() {
+		masterHabitat.log(myDescription + " Received some new Info - processing it .. ");
+		masterHabitat.log(myDescription + " Number of Steps Suggested -> 3 ");
+    masterHabitat.log(myDescription + " Entering Phase One ");
+		masterHabitat.log(myDescription + " Need to gather information on 'NYC Passengers'" );
+		masterHabitat.log(myDescription + " Contact Habitat -> 'NYCTransitHabitat'");
+		masterHabitat.log(myDescription + " Contact Service -> 'NYC_Passengers_Query'");

-		result.put("Terminate_Session", "SESSION_ENDED");
-		break;
-	    }
-	}
-
-	masterHabitat.svclog(myDescription, myDescription + ": performService, returning: " + hashtableListing(result));
-
-	return result;
-    }
-    private void phaseOne() {
-
-	masterHabitat.svclog(myDescription, myDescription + " Received some new Info - processing it .. ");
-	masterHabitat.svclog(myDescription, myDescription + " Number of Steps Suggested -> 3 ");
-	masterHabitat.svclog(myDescription, myDescription + " Entering Phase One ");
-	masterHabitat.svclog(myDescription, myDescription + " Need to gather information on 'NYC Passengers'" );
-	masterHabitat.svclog(myDescription, myDescription + " Contact Habitat -> 'NYCTransitHabitat'");
-	masterHabitat.svclog(myDescription, myDescription + " Contact Service -> 'NYC_Passengers_Query'");
-
-	// invoked by user entering chor's name
-	// some intelligent workflow suggested that service to be contacted
-	String useService = "NYC_Passengers_Query";
-	if(!Habitat.localService(useService)) {
-	    Hashtable ipList = new Hashtable();
-	    ipList.put("habitatCategory","NYCTransitHabitat");
-	    ipList.put("EventType","ServiceRequest");
-	    ipList.put("Request4Service", useService);
-	    ipList.put("totalParams","1");
-	    ipList.put("params1", key1);
-	    ipList.put("totalRetvals", "4");
-	    ipList.put("retvals1", key1);
-	    ipList.put("retvals2", key2);
-	    ipList.put("retvals3", key3);
-	    ipList.put("retvals4", key4);
-
-	    masterHabitat.log(myDescription + " Requesting Gatekeeper to contact Remote Service" + useService);
-	    masterHabitat.svclog(myDescription, myDescription + " Await response from Remote Service" + useService);
-
-	    masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
-	}
-
-	masterHabitat.svclog(myDescription, myDescription + ": phaseOne, returned");
+    // invoked by user entering chor's name
+    // some intelligent workflow suggested that service to be contacted
+    String useService = "NYC_Passengers_Query";
+    if(!Habitat.localService(useService)) {
+      Hashtable ipList = new Hashtable();
+      ipList.put("habitatCategory","NYCTransitHabitat");
+      ipList.put("EventType","ServiceRequest");
+      ipList.put("Request4Service", useService);
+      ipList.put("totalParams","1");
+      ipList.put("params1", key1);
+      ipList.put("totalRetvals", "4");
+      ipList.put("retvals1", key1);
+      ipList.put("retvals2", key2);
+      ipList.put("retvals3", key3);
+      ipList.put("retvals4", key4);
+
+      masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
+			masterHabitat.log(myDescription + " Requesting Gatekeeper to contact Remote Service");
     }
-
-    private void phaseTwo() {
-
-	masterHabitat.svclog(myDescription, myDescription + ": phaseTwo");
-
-	String useService = "TexasResidentInfo";
-	if (!Habitat.localService(useService)) {
-	    Hashtable ipList = new Hashtable();
-	    ipList.put("habitatCategory","TexasStateHabitat");
-	    ipList.put("EventType","ServiceRequest");
-	    ipList.put("Request4Service", useService);
-	    ipList.put("totalParams","2");
-	    ipList.put("params1", key1);
-	    ipList.put("params2", key2);
-	    ipList.put("totalRetvals", "5");
-	    ipList.put("retvals1", key5);
-	    ipList.put("retvals2", key6);
-	    ipList.put("retvals3", key7);
-	    ipList.put("retvals4", key8);
-	    ipList.put("retvals5", key9);
-
-	    masterHabitat.log(myDescription + " Requesting Gatekeeper to contact Remote Service" + useService);
-	    masterHabitat.svclog(myDescription, myDescription + " Await response from Remote Service" + useService);
-
-	    masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
-
-	}
-
-	masterHabitat.svclog(myDescription, myDescription+ ": phaseTwo, returned");
+    masterHabitat.log(myDescription + ": phaseOne, returned");
+  }
+
+  private void phaseTwo() {
+    masterHabitat.log(myDescription + ": phaseTwo");
+    String useService = "TexasResidentInfo";
+    if (!Habitat.localService(useService)) {
+      Hashtable ipList = new Hashtable();
+      ipList.put("habitatCategory","TexasStateHabitat");
+      ipList.put("EventType","ServiceRequest");
+      ipList.put("Request4Service", useService);
+      ipList.put("totalParams","2");
+      ipList.put("params1", key1);
+      ipList.put("params2", key2);
+      ipList.put("totalRetvals", "5");
+      ipList.put("retvals1", key5);
+      ipList.put("retvals2", key6);
+      ipList.put("retvals3", key7);
+      ipList.put("retvals4", key8);
+      ipList.put("retvals5", key9);
+
+      masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
     }
-
-    private void phaseThree() {
-
-	masterHabitat.svclog(myDescription, myDescription + ": phaseThree");
-
-	String useService = "AlertService";
-	if (!Habitat.localService(useService)) {
-	    Hashtable ipList = new Hashtable();
-	    ipList.put("habitatCategory","NYCTransitHabitat");
-	    ipList.put("EventType","ServiceRequest");
-	    ipList.put("Request4Service", useService);
-	    ipList.put("totalParams","7");
-	    ipList.put("params1", key1);
-	    ipList.put("params2", key2);
-	    ipList.put("params3", key5);
-	    ipList.put("params4", key6);
-	    ipList.put("params5", key7);
-	    ipList.put("params6", key8);
-	    ipList.put("params7", key9);
-	    ipList.put("totalRetvals", "0");
-
-	    masterHabitat.log(myDescription + " Requesting Gatekeeper to contact Remote Service" + useService);
-	    masterHabitat.svclog(myDescription, myDescription + " Await response from Remote Service" + useService);
-
-	    masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
-	}
-
-	masterHabitat.svclog (myDescription, myDescription + ": phaseThree, returned");
+    masterHabitat.log(myDescription + ": phaseTwo, returned");
+  }
+
+  private void phaseThree() {
+    masterHabitat.log(myDescription + ": phaseThree");
+    String useService = "AlertService";
+    if (!Habitat.localService(useService)) {
+      Hashtable ipList = new Hashtable();
+      ipList.put("habitatCategory","NYCTransitHabitat");
+      ipList.put("EventType","ServiceRequest");
+      ipList.put("Request4Service", useService);
+      ipList.put("totalParams","7");
+      ipList.put("params1", key1);
+      ipList.put("params2", key2);
+      ipList.put("params3", key5);
+      ipList.put("params4", key6);
+      ipList.put("params5", key7);
+      ipList.put("params6", key8);
+      ipList.put("params7", key9);
+      ipList.put("totalRetvals", "0");
+
+      masterHabitat.gk.broadcast_req(myDescription, useService, ipList);
     }
-
+    masterHabitat.log(myDescription + ": phaseThree, returned");
+  }
+
 }
diff --git a/services/MapService.java b/services/MapService.java
index 5fd3c17..f81321e 100644
--- a/services/MapService.java
+++ b/services/MapService.java
@@ -1,36 +1,36 @@
-package psl.habitats.services;
-
-import psl.habitats.*;
-
-import javax.swing.*;
-import java.util.Hashtable;
-
-public class MapService implements ServiceInterface {    private static String serviceDescription = "MapService";
+package psl.habitats.services;
+
+import psl.habitats.*;
+
+import javax.swing.*;
+import java.util.Hashtable;
+
+public class MapService implements ServiceInterface {  
  private static String serviceDescription = "MapService";
   public MapService() {	}
-  public void initialize(Habitat _h) { }
-  public String getDescription() {
-    return serviceDescription;
-  }
-  public JPanel startDisplay() {
-    return new JPanel();
-  }
-
-  public String getDetailDescription(){
-    StringBuffer _stringBuffer = new StringBuffer();
-    _stringBuffer.setLength(0);
-    _stringBuffer.append("<html><body>");
-    _stringBuffer.append("<h1>" + getDescription() + "</h1>");
-    _stringBuffer.append("<table border=4>");
-    _stringBuffer.append("<tr><td>Purpose</td><td>Maps Database</td></tr>");
-    _stringBuffer.append("<tr><td>Availablity</td><td>Not available</td></tr>");
-    _stringBuffer.append("<tr><td>Monitor</td><td>Probably</td></tr>");
-    _stringBuffer.append("<tr><td>Monitor-Mode</td><td>NA</td></tr>");
-    _stringBuffer.append("</table>");
-    _stringBuffer.append("</body></html>");
-  return _stringBuffer + "";
-  }
-
-  public Hashtable performService(String _senderService, Hashtable ipList) {
-    return null;
-  }
+  public void initialize(Habitat _h) { }
+  public String getDescription() {
+    return serviceDescription;
+  }
+  public JPanel startDisplay() {
+    return new JPanel();
+  }
+
+  public String getDetailDescription(){
+    StringBuffer _stringBuffer = new StringBuffer();
+    _stringBuffer.setLength(0);
+    _stringBuffer.append("<html><body>");
+    _stringBuffer.append("<h1>" + getDescription() + "</h1>");
+    _stringBuffer.append("<table border=4>");
+    _stringBuffer.append("<tr><td>Purpose</td><td>Maps Database</td></tr>");
+    _stringBuffer.append("<tr><td>Availablity</td><td>Not available</td></tr>");
+    _stringBuffer.append("<tr><td>Monitor</td><td>Probably</td></tr>");
+    _stringBuffer.append("<tr><td>Monitor-Mode</td><td>NA</td></tr>");
+    _stringBuffer.append("</table>");
+    _stringBuffer.append("</body></html>");
+  return _stringBuffer + "";
+  }
+
+  public Hashtable performService(String _senderService, Hashtable ipList) {
+    return null;
+  }
 }
diff --git a/services/NYCPassListService.java b/services/NYCPassListService.java
index 6b8df24..5c75b76 100644
--- a/services/NYCPassListService.java
+++ b/services/NYCPassListService.java
@@ -8,75 +8,71 @@ import java.util.Vector;
 import java.util.Hashtable;

 public class NYCPassListService implements ServiceInterface {
-    private static final String myDescription = "NYC_Passengers_Query";
-    Habitat masterHabitat = null;
-    public void initialize(Habitat _h) {
-	masterHabitat = _h;
-    }
-    public String getDescription(){
-	return myDescription;
-    }
-    public JPanel startDisplay() {
-	return new JPanel();
-    }
-
-    public String getDetailDescription(){
-	StringBuffer _stringBuffer = new StringBuffer();
-	_stringBuffer.setLength(0);
-	_stringBuffer.append("<html><body>");
-	_stringBuffer.append("<h1>" + getDescription() + "</h1>");
-	_stringBuffer.append("<table border=4>");
-	_stringBuffer.append("<tr><td>Purpose     </td><td>AmTrak Passenger List</td></tr>");
-	_stringBuffer.append("<tr><td>Availablity </td><td>Local/Remote         </td></tr>");
-	_stringBuffer.append("<tr><td>Monitor     </td><td>True                 </td></tr>");
-	_stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text                 </td></tr>");
-	_stringBuffer.append("</table>");
-	_stringBuffer.append("</body></html>");
-	return _stringBuffer + "";
-    }
-
-    private static final String key1 = "First_Name";
-    private static final String key2 = "Last_Name";
-    private static final String key3 = "Boarding_City";
-    private static final String key4 = "Boarding_Date";
-
-    public Hashtable performService(String _senderService, Hashtable ipList) {
+  private static final String myDescription = "NYC_Passengers_Query";
+  Habitat masterHabitat = null;
+  public void initialize(Habitat _h) {
+    masterHabitat = _h;
+  }
+  public String getDescription(){
+    return myDescription;
+  }
+  public JPanel startDisplay() {
+    return new JPanel();
+  }

-	masterHabitat.svclog(myDescription, myDescription + ": performService for " + _senderService);
+  public String getDetailDescription(){
+    StringBuffer _stringBuffer = new StringBuffer();
+    _stringBuffer.setLength(0);
+    _stringBuffer.append("<html><body>");
+    _stringBuffer.append("<h1>" + getDescription() + "</h1>");
+    _stringBuffer.append("<table border=4>");
+    _stringBuffer.append("<tr><td>Purpose     </td><td>AmTrak Passenger List</td></tr>");
+    _stringBuffer.append("<tr><td>Availablity </td><td>Local/Remote         </td></tr>");
+    _stringBuffer.append("<tr><td>Monitor     </td><td>True                 </td></tr>");
+    _stringBuffer.append("<tr><td>Monitor-Mode</td><td>Text                 </td></tr>");
+    _stringBuffer.append("</table>");
+    _stringBuffer.append("</body></html>");
+    return _stringBuffer + "";
+  }

-	Hashtable result = new Hashtable();
-	if(ipList.containsKey(key1) || ipList.containsKey(key2)){
-	    result.put(key1, lookup("" + ipList.get(key1), key1, masterHabitat.getName()));
-	    result.put(key2, lookup("" + ipList.get(key1), key2, masterHabitat.getName()));
-	    result.put(key3, lookup("" + ipList.get(key1), key3, masterHabitat.getName()));
-	    result.put(key4, lookup("" + ipList.get(key1), key4, masterHabitat.getName()));
-	} else
-	    result = null;
+  private static final String key1 = "First_Name";
+  private static final String key2 = "Last_Name";
+  private static final String key3 = "Boarding_City";
+  private static final String key4 = "Boarding_Date";

-	masterHabitat.svclog(myDescription, myDescription + ": returning requested Data ");
-
-	return result;
-    }
-
-    private static final String HABITAT_NAME = "AmTrak";
-    private String lookup(String key1, String key, String forHab) {
-	if (forHab.equals(HABITAT_NAME)) {
-	    if (key1.equalsIgnoreCase("john")) return "" + johnHash.get(key);
-	    if (key1.equalsIgnoreCase("gail")) return "" + gailHash.get(key);
-	}
-	return null;
-    }
-    private static final Hashtable gailHash = new Hashtable();
-    private static final Hashtable johnHash = new Hashtable();
-    static {
-	gailHash.put(key1, "Gail");
-	gailHash.put(key2, "Kaiser");
-	gailHash.put(key3, "Texas");
-	gailHash.put(key4, "Friday morning");
-
-	johnHash.put(key1, "John");
-	johnHash.put(key2, "Salasin");
-	johnHash.put(key3, "Texas");
-	johnHash.put(key4, "Yesterday");
+  public Hashtable performService(String _senderService, Hashtable ipList) {
+    masterHabitat.log(myDescription + ": performService for " + _senderService);
+    Hashtable result = new Hashtable();
+    if(ipList.containsKey(key1) || ipList.containsKey(key2)){
+      result.put(key1, lookup("" + ipList.get(key1), key1, masterHabitat.getName()));
+      result.put(key2, lookup("" + ipList.get(key1), key2, masterHabitat.getName()));
+      result.put(key3, lookup("" + ipList.get(key1), key3, masterHabitat.getName()));
+      result.put(key4, lookup("" + ipList.get(key1), key4, masterHabitat.getName()));
+    } else
+      result = null;
+    masterHabitat.log(myDescription + ": returning requested Data ");
+    return result;
+  }
+
+  private static final String HABITAT_NAME = "AmTrak";
+  private String lookup(String key1, String key, String forHab) {
+    if (forHab.equals(HABITAT_NAME)) {
+      if (key1.equalsIgnoreCase("john")) return "" + johnHash.get(key);
+      if (key1.equalsIgnoreCase("gail")) return "" + gailHash.get(key);
     }
+    return null;
+  }
+  private static final Hashtable gailHash = new Hashtable();
+  private static final Hashtable johnHash = new Hashtable();
+  static {
+    gailHash.put(key1, "Gail");
+    gailHash.put(key2, "Kaiser");
+    gailHash.put(key3, "Texas");
+    gailHash.put(key4, "Friday morning");
+
+    johnHash.put(key1, "John");
+    johnHash.put(key2, "Salasin");
+    johnHash.put(key3, "Texas");
+    johnHash.put(key4, "Yesterday");
+  }
 }
diff --git a/services/ResidentsListService.java b/services/ResidentsListService.java
index 84f1794..c3e9ba5 100644
--- a/services/ResidentsListService.java
+++ b/services/ResidentsListService.java
@@ -43,9 +43,7 @@ public class ResidentsListService implements ServiceInterface {
   private static final String key9 = "Age";

   public Hashtable performService(String _senderService, Hashtable ipList) {
-
-    masterHabitat.svclog(myDescription, myDescription + ": performService for " + _senderService);
-
+    masterHabitat.log(myDescription + ": performService for " + _senderService);
     Hashtable result = new Hashtable();
     if (ipList.containsKey(key1) && ipList.containsKey(key2)) {
       result.put(key5, lookup("" + ipList.get(key1), key5, masterHabitat.getName()));
@@ -55,8 +53,7 @@ public class ResidentsListService implements ServiceInterface {
       result.put(key9, lookup("" + ipList.get(key1), key9, masterHabitat.getName()));
     } else
       result = null;
-
-    masterHabitat.svclog(myDescription, myDescription + ": returning requested data ");
+    masterHabitat.log(myDescription + ": returning requested data ");
     return result;
   }