package x;

import com.sun.corba.se.impl.corba.ServerRequestImpl;
import com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl;
import com.sun.corba.se.spi.ior.ObjectKey;
import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
import com.sun.corba.se.spi.oa.OADestroyed;
import com.sun.corba.se.spi.oa.ObjectAdapter;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;

public class MyCorbaServerRequestDispatcher extends CorbaServerRequestDispatcherImpl {

    public MyCorbaServerRequestDispatcher(ORB orb) {
        super(orb);
    }

    @Override
    protected void consumeServiceContexts(CorbaMessageMediator request) {
        // Nothing to do
    }

    @Override
    protected void checkServerId(ObjectKey okey) {
        // Yo, looks good....
    }

    @Override
    protected Object getServantWithPI(CorbaMessageMediator request,
            ObjectAdapter objectAdapter, byte[] objectId,
            ObjectKeyTemplate oktemp, String operation) throws OADestroyed {
        return new MyNamingContextImplBase();
    }

    @Override
    protected CorbaMessageMediator handleDynamicResult(ServerRequestImpl sreq,
            CorbaMessageMediator req) {
        //System.out.println("Handling result!");
        new RuntimeException("What am I doing here?").printStackTrace();

        return super.handleDynamicResult(sreq, req);
    }

}
