Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.mina.handler.chain
Interface IoHandlerCommand

All Known Implementing Classes:
  IoHandlerChain

    public interface IoHandlerCommand

A `IoHandlerCommand` encapsulates a unit of processing work to be performed, whose purpose is to examine and/or modify the state of a transaction that is represented by custom attributes provided by `IoSession`. Individual `IoHandlerCommand`s can be assembled into a `IoHandlerChain`, which allows them to either complete the required processing or delegate further processing to the next `IoHandlerCommand` in the `IoHandlerChain`.

`IoHandlerCommand` implementations typically retrieve and store state information in the `IoSession` that is passed as a parameter to the `execute(NextCommand,IoSession,Object)` method, using custom session attributes. If you think getting attributes is tedious process, you can create a bean which contains getters and setters of all properties and store the bean as a session attribute:

     public class MyContext {
       public String getPropertyX() { ... };
       public void setPropertyX(String propertyX) { ... };
       public int getPropertyZ() { ... };
       public void setPropertyZ(int propertyZ) { ... };
     }

     public class MyHandlderCommand implements IoHandlerCommand {
       public void execute( NextCommand next, IoSession session, Object message ) throws Exception {
         MyContext ctx = session.getAttribute( "mycontext" );
         ...
       }
     }

Version:
  $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (Fri, 13 Jul 2007) $
Author:
  Apache Directory Project

Nested Class Summary
`static interface` | `IoHandlerCommand.NextCommand` Represents an indirect reference to the next `IoHandlerCommand` of the `IoHandlerChain`.

Method Summary
`void` | `execute(IoHandlerCommand.NextCommand next, IoSession session, Object message)` Execute a unit of processing work to be performed.

Method Detail

### execute

    void execute(IoHandlerCommand.NextCommand next,
                 IoSession session,
                 Object message)
                 throws Exception

  Execute a unit of processing work to be performed. This `IoHandlerCommand` may either complete the required processing and just return to stop the processing, or delegate remaining processing to the next `IoHandlerCommand` in a `IoHandlerChain` containing this `IoHandlerCommand` by calling `IoHandlerCommand.NextCommand.execute(IoSession,Object)`.

  Parameters:
    `next` - an indirect reference to the next `IoHandlerCommand` that provides a way to forward the request to the next `IoHandlerCommand`.
    `session` - the `IoSession` which is associated with this request
    `message` - the message object of this request
  Throws:
    `Exception` - general purpose exception return to indicate abnormal termination

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 Apache MINA Project. All Rights Reserved.