org.omg.PortableInterceptor


1. Intercepting invocation

import org.omg.PortableInterceptor.*;
import org.omg.PortableInterceptor.InterceptorOperations;
import org.omg.PortableInterceptor.Invocation;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.ExceptionList;

public class SimpleInterceptor extends InterceptorOperations {

    public String name() {
        return "SimpleInterceptor";
    }

    public void receive_request(Invocation inv) {
        System.out.println("receive_request: " + inv.operation());
    }

    public void receive_request_service_contexts(Invocation inv, ServiceContextList contexts) {
        System.out.println("receive_request_service_contexts: " + inv.operation());
    }

    public void send_request(Invocation inv) {
        System.out.println("send_request: " + inv.operation());
    }

    public void send_poll(Invocation inv) {
        System.out.println("send_poll: " + inv.operation());
    }

    public void receive_reply(Invocation inv) {
        System.out.println("receive_reply: " + inv.operation());
    }

    public void receive_exception(Invocation inv, ExceptionList exceptions) {
        System.out.println("receive_exception: " + inv.operation());
    }

    public void receive_other(Invocation inv) {
        System.out.println("receive_other: " + inv.operation());
    }

}

2. Intercepting reply

3. Intercepting exception

4. Intercepting other