
package forager.server;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.nio.channels.SocketChannel;

import forager.events.ForagerEventMap;
import forager.events.JoinEvent;

import galileo.event.Event;
import galileo.event.EventHandler;
import galileo.event.EventType;
import galileo.net.GalileoMessage;
import galileo.net.MessageListener;
import galileo.net.NetworkDestination;
import galileo.net.ServerMessageRouter;
import galileo.serialization.SerializationInputStream;

public class Overlord implements MessageListener {

    private int port;
    private ServerMessageRouter messageRouter;

    private ForagerEventMap eventMap = new ForagerEventMap();
    private EventMapper eventMapper = new EventMapper(this, eventMap);

    public Overlord(int port) {
        this.port = port;
        eventMapper.linkEventHandlers();
    }

    public void start()
    throws IOException, Exception {
        messageRouter = new ServerMessageRouter(this.port);
        messageRouter.addListener(this);
        messageRouter.listen();
    }

    @Override
    public void onConnect(NetworkDestination endpoint) {

    }

    @Override
    public void onDisconnect(NetworkDestination endpoint) {

    }

    @Override
    public void onMessage(GalileoMessage message) { }

    @EventHandler
    public void processJoinEvent(JoinEvent join) {

        System.out.println("hello world!");
    }

    public static void main(String[] args)
    throws Exception {
        if (args.length < 1) {
            System.out.println("Usage: forager.server.Overlord <port>");
            System.exit(1);
        }

        int port = Integer.parseInt(args[0]);

        Overlord overlord = new Overlord(port);
        overlord.start();
    }
}

@@ -197,16 +197,81 @@
 Channel;
+%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;
 %0A%0Aimport
@@ -686,24 +686,95 @@
 Listener %7B%0A%0A
+    private static final Logger logger = Logger.getLogger(%22forager%22);%0A%0A
     private 
@@ -1232,16 +1232,64 @@
 (this);%0A
+        messageRouter.addListener(eventMapper);%0A
         
@@ -1618,25 +1618,24 @@
 join) %7B%0A
-%0A
         
 System.o
@@ -1630,40 +1630,65 @@
     
-System.out.println(%22hello world!
+logger.log(Level.INFO, %22Received join request: %7B0%7D%22, %22xxx
 %22);%0A

Add logging