org.glassfish.grizzly.util
Class LogFilter

java.lang.Object
  extended by org.glassfish.grizzly.util.LogFilter
All Implemented Interfaces:
Filter

public class LogFilter
extends Object
implements Filter

Simple log Filter

Author:
Alexey Stashok

Constructor Summary
LogFilter()
           
LogFilter(Logger logger)
           
LogFilter(Logger logger, Level level)
           
 
Method Summary
 TransformationResult decode(Connection connection, Object originalMessage)
           
 TransformationResult encode(Connection connection, Object originalMessage)
           
 void exceptionOccurred(FilterChainContext ctx, Throwable error)
          Notification about exception, occured on the FilterChain
 int getIndex()
          Gets the Filter index.
 Level getLevel()
           
 Logger getLogger()
           
 NextAction handleAccept(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when server channel has accepted the client connection.
 NextAction handleClose(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when connection has been closed.
 NextAction handleConnect(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel gets connected.
 NextAction handleRead(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel will become available for reading.
 NextAction handleWrite(FilterChainContext ctx, NextAction nextAction)
          Execute a unit of processing work to be performed, when channel will become available for writing.
 boolean isIndexable()
          Defines if this Filter could be indexed by a FilterChain in order to find neighbour Filters faster.
 NextAction postAccept(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleAccept(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 NextAction postClose(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleClose(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 NextAction postConnect(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleConnect(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 NextAction postRead(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleRead(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 NextAction postWrite(FilterChainContext ctx, NextAction nextAction)
          Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleWrite(com.sun.grizzly.FilterChainContext) method of this Filter instance.
 void setIndex(int index)
          Sets the Filter index.
 void setLevel(Level level)
           
 void setLogger(Logger logger)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogFilter

public LogFilter()

LogFilter

public LogFilter(Logger logger)

LogFilter

public LogFilter(Logger logger,
                 Level level)
Method Detail

getLogger

public Logger getLogger()

setLogger

public void setLogger(Logger logger)

getLevel

public Level getLevel()

setLevel

public void setLevel(Level level)

handleRead

public NextAction handleRead(FilterChainContext ctx,
                             NextAction nextAction)
                      throws IOException
Description copied from interface: Filter
Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleRead in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postRead

public NextAction postRead(FilterChainContext ctx,
                           NextAction nextAction)
                    throws IOException
Description copied from interface: Filter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleRead(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postRead in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

handleWrite

public NextAction handleWrite(FilterChainContext ctx,
                              NextAction nextAction)
                       throws IOException
Description copied from interface: Filter
Execute a unit of processing work to be performed, when channel will become available for writing. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleWrite in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postWrite

public NextAction postWrite(FilterChainContext ctx,
                            NextAction nextAction)
                     throws IOException
Description copied from interface: Filter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleWrite(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postWrite in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

handleConnect

public NextAction handleConnect(FilterChainContext ctx,
                                NextAction nextAction)
                         throws IOException
Description copied from interface: Filter
Execute a unit of processing work to be performed, when channel gets connected. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleConnect in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postConnect

public NextAction postConnect(FilterChainContext ctx,
                              NextAction nextAction)
                       throws IOException
Description copied from interface: Filter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleConnect(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postConnect in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

handleAccept

public NextAction handleAccept(FilterChainContext ctx,
                               NextAction nextAction)
                        throws IOException
Description copied from interface: Filter
Execute a unit of processing work to be performed, when server channel has accepted the client connection. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleAccept in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postAccept

public NextAction postAccept(FilterChainContext ctx,
                             NextAction nextAction)
                      throws IOException
Description copied from interface: Filter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleAccept(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postAccept in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

handleClose

public NextAction handleClose(FilterChainContext ctx,
                              NextAction nextAction)
                       throws IOException
Description copied from interface: Filter
Execute a unit of processing work to be performed, when connection has been closed. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Specified by:
handleClose in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

postClose

public NextAction postClose(FilterChainContext ctx,
                            NextAction nextAction)
                     throws IOException
Description copied from interface: Filter
Execute any cleanup activities, such as releasing resources that were acquired during the execution of Filter#handleClose(com.sun.grizzly.FilterChainContext) method of this Filter instance.

Specified by:
postClose in interface Filter
Parameters:
ctx - FilterChainContext
nextAction - default NextAction, which Filter could change in order to control how FilterChain will continue the execution
Returns:
NextAction instruction for FilterChain, how it should continue the execution
Throws:
IOException

exceptionOccurred

public void exceptionOccurred(FilterChainContext ctx,
                              Throwable error)
Description copied from interface: Filter
Notification about exception, occured on the FilterChain

Specified by:
exceptionOccurred in interface Filter
Parameters:
ctx - event processing FilterChainContext
error - error, which occurred during FilterChain execution

decode

public TransformationResult decode(Connection connection,
                                   Object originalMessage)
                            throws TransformationException
Throws:
TransformationException

encode

public TransformationResult encode(Connection connection,
                                   Object originalMessage)
                            throws TransformationException
Throws:
TransformationException

isIndexable

public boolean isIndexable()
Description copied from interface: Filter
Defines if this Filter could be indexed by a FilterChain in order to find neighbour Filters faster. Most of the time it's very desired for a Filters to be indexable, but there are cases, when it's not appropriate, for example if single Filter instance should be shared among several FilterChains.

Specified by:
isIndexable in interface Filter
Returns:
true, if this Filter is indexable, or false otherwise.

getIndex

public int getIndex()
Description copied from interface: Filter
Gets the Filter index.

Specified by:
getIndex in interface Filter
Returns:
the Filter index.

setIndex

public void setIndex(int index)
Description copied from interface: Filter
Sets the Filter index.

Specified by:
setIndex in interface Filter
Parameters:
index - the Filter index.


Copyright © 2009 SUN Microsystems. All Rights Reserved.