Which Methods to Override

AbstractCommandListener.getCommands() must be overridden. We explain more about this method in the section, Registering Commands.

The handleEventPrep(), handleEventPost(), and handleEventException() methods may be overridden. These three methods, along with AbstractCommandListener.handleEvent(), form the core processing for any command received by the framework.

Once the framework determines which command listener to route a command to, it calls that command listener’s handleEvent() method. Since the AbstractCommandListener declares this method as final, the framework always calls the method in AbstractCommandListener. This method then performs the following sequence of steps:

  1. Calls handleEventPrep(); if this method returns true, then continues with step 2.

  2. Gets the command listener's method that handles this specific command. If this method cannot be located, logs an error with the logging utility.

  3. Converts the arguments from the http command into an array of Java objects.

  4. Using Java introspection, invokes the method.

  5. If no exceptions were thrown, invokes handleEventPost().

  6. If exceptions were thrown in steps 4 or 5, calls handleEventException().

Any change to the processing of events before they arrive at a specific method in the command listener must be done by overriding the handleEventPrep() method. For instance, this is where the EssbaseCommandListener class checks Essbase sessions and the AppManCommandListener checks for a valid servlet session.

In most cases, the handleEventPost() method is empty and the handleEventException() method is empty.