public class IoHandlerChain extends Object implements IoHandlerCommand
IoHandlerCommand
s.Modifier and Type | Class and Description |
---|---|
class |
IoHandlerChain.Entry
Represents a name-command pair that an
IoHandlerChain contains. |
IoHandlerCommand.NextCommand
Constructor and Description |
---|
IoHandlerChain()
Creates a new, empty chain of
IoHandlerCommand s. |
Modifier and Type | Method and Description |
---|---|
void |
addAfter(String baseName,
String name,
IoHandlerCommand command)
Adds a name-command after a given name-command in the chain
|
void |
addBefore(String baseName,
String name,
IoHandlerCommand command)
Adds a name-command before a given name-command in the chain
|
void |
addFirst(String name,
IoHandlerCommand command)
Adds a name-command pair into the chain
|
void |
addLast(String name,
IoHandlerCommand command)
Adds a name-command at the end of the chain
|
void |
clear()
Remove all the
IoHandlerCommand from the chain |
boolean |
contains(Class<? extends IoHandlerCommand> commandType)
Checks if the chain of
IoHandlerCommand contains a specific IoHandlerCommand |
boolean |
contains(IoHandlerCommand command)
Checks if the chain of
IoHandlerCommand contains a specific IoHandlerCommand |
boolean |
contains(String name)
Checks if the chain of
IoHandlerCommand contains a IoHandlerCommand by its name |
void |
execute(IoHandlerCommand.NextCommand next,
IoSession session,
Object message)
Execute a unit of processing work to be performed.
|
IoHandlerCommand |
get(String name)
Retrieve a
IoHandlerCommand by its name |
List<IoHandlerChain.Entry> |
getAll() |
List<IoHandlerChain.Entry> |
getAllReversed() |
IoHandlerChain.Entry |
getEntry(String name)
Retrieve a name-command pair by its name
|
IoHandlerCommand.NextCommand |
getNextCommand(String name)
Retrieve the
IoHandlerCommand following the IoHandlerCommand we
fetched by its name |
IoHandlerCommand |
remove(String name)
Removes a
IoHandlerCommand by its name |
String |
toString() |
public IoHandlerChain()
IoHandlerCommand
s.public IoHandlerChain.Entry getEntry(String name)
name
- The name of the IoHandlerCommand
we are looking forpublic IoHandlerCommand get(String name)
IoHandlerCommand
by its namename
- The name of the IoHandlerCommand
we are looking forIoHandlerCommand
, if any, null otherwisepublic IoHandlerCommand.NextCommand getNextCommand(String name)
IoHandlerCommand
following the IoHandlerCommand
we
fetched by its namename
- The name of the IoHandlerCommand
IoHandlerCommand
which is next to teh ngiven name, if any, null otherwisepublic void addFirst(String name, IoHandlerCommand command)
name
- The namecommand
- The commandpublic void addLast(String name, IoHandlerCommand command)
name
- The namecommand
- The commandpublic void addBefore(String baseName, String name, IoHandlerCommand command)
baseName
- The IoHandlerCommand name before which we will inject a new name-commandname
- The name The namecommand
- The command The commandpublic void addAfter(String baseName, String name, IoHandlerCommand command)
baseName
- The IoHandlerCommand
name after which we will inject a new name-commandname
- The name The namecommand
- The command The commandpublic IoHandlerCommand remove(String name)
IoHandlerCommand
by its namename
- The nameIoHandlerCommand
public void clear() throws Exception
IoHandlerCommand
from the chainException
- If we faced some exception during the cleanuppublic 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)
.
execute
in interface IoHandlerCommand
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 requestmessage
- the message object of this requestException
- general purpose exception return
to indicate abnormal terminationpublic List<IoHandlerChain.Entry> getAll()
public List<IoHandlerChain.Entry> getAllReversed()
public boolean contains(String name)
IoHandlerCommand
contains a IoHandlerCommand
by its namename
- The IoHandlerCommand
nameIoHandlerCommand
is found in the chainpublic boolean contains(IoHandlerCommand command)
IoHandlerCommand
contains a specific IoHandlerCommand
command
- The IoHandlerCommand
we are looking forIoHandlerCommand
is found in the chainpublic boolean contains(Class<? extends IoHandlerCommand> commandType)
IoHandlerCommand
contains a specific IoHandlerCommand
commandType
- The type of IoHandlerCommand
we are looking forIoHandlerCommand
is found in the chainCopyright © 2004–2022 Apache MINA Project. All rights reserved.