org.milyn.delivery
Class Filter

java.lang.Object
  extended by org.milyn.delivery.Filter
Direct Known Subclasses:
SmooksDOMFilter, SmooksSAXFilter

public abstract class Filter
extends Object

Content filter.

Author:
tom.fennelly@gmail.com

Nested Class Summary
static class Filter.StreamFilterType
          Filter type enumeration.
 
Field Summary
static String CLOSE_RESULT
           
static String CLOSE_SOURCE
           
static String DEFAULT_SERIALIZATION_ON
           
static String ENTITIES_REWRITE
           
static String MAINTAIN_ELEMENT_STACK
           
static String REVERSE_VISIT_ORDER_ON_VISIT_AFTER
           
static String STREAM_FILTER_TYPE
          Stream filter type config parameter.
static String TERMINATE_ON_VISITOR_EXCEPTION
           
 
Constructor Summary
Filter()
           
 
Method Summary
abstract  void cleanup()
          Cleanup the Filter.
protected  void close(Result result)
           
protected  void close(Source source)
           
abstract  void doFilter()
          Filter the content in the supplied Source instance, outputing the result to the supplied Result instance.
static ExecutionContext getCurrentExecutionContext()
          Get the ExecutionContext instance bound to the current thread.
static Filter getFilter()
          Get the Filter instance for the current thread.
protected  Reader getReader(Source source, ExecutionContext executionContext)
           
protected  Writer getWriter(Result result, ExecutionContext executionContext)
           
static void removeCurrentExecutionContext()
          Remove the ExecutionContext bound to the current thread.
static void removeCurrentFilter()
          Remove the Filter bound to the current thread.
static void setCurrentExecutionContext(ExecutionContext executionContext)
          Set the ExecutionContext instance for the current thread.
static void setFilter(Filter filter)
          Set the Filter instance for the current thread.
static void setFilterType(Smooks smooks, Filter.StreamFilterType filterType)
          Deprecated. Use setFilterType(org.milyn.Smooks, org.milyn.StreamFilterType).
static void setFilterType(Smooks smooks, StreamFilterType filterType)
          Set the default stream filter type on the supplied Smooks instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_FILTER_TYPE

public static final String STREAM_FILTER_TYPE
Stream filter type config parameter.

See Also:
Constant Field Values

CLOSE_SOURCE

public static final String CLOSE_SOURCE
See Also:
Constant Field Values

CLOSE_RESULT

public static final String CLOSE_RESULT
See Also:
Constant Field Values

ENTITIES_REWRITE

public static final String ENTITIES_REWRITE
See Also:
Constant Field Values

DEFAULT_SERIALIZATION_ON

public static final String DEFAULT_SERIALIZATION_ON
See Also:
Constant Field Values

MAINTAIN_ELEMENT_STACK

public static final String MAINTAIN_ELEMENT_STACK
See Also:
Constant Field Values

REVERSE_VISIT_ORDER_ON_VISIT_AFTER

public static final String REVERSE_VISIT_ORDER_ON_VISIT_AFTER
See Also:
Constant Field Values

TERMINATE_ON_VISITOR_EXCEPTION

public static final String TERMINATE_ON_VISITOR_EXCEPTION
See Also:
Constant Field Values
Constructor Detail

Filter

public Filter()
Method Detail

doFilter

public abstract void doFilter()
                       throws SmooksException
Filter the content in the supplied Source instance, outputing the result to the supplied Result instance.

Implementations use static methods on the FilterSource and FilterResult classes to access the Source and Results objects.

Throws:
SmooksException - Failed to filter.

cleanup

public abstract void cleanup()
Cleanup the Filter.


setFilterType

public static void setFilterType(Smooks smooks,
                                 StreamFilterType filterType)
Set the default stream filter type on the supplied Smooks instance.

Parameters:
smooks - The Smooks instance.
filterType - The filter type.

setFilterType

public static void setFilterType(Smooks smooks,
                                 Filter.StreamFilterType filterType)
Deprecated. Use setFilterType(org.milyn.Smooks, org.milyn.StreamFilterType).

Set the default stream filter type on the supplied Smooks instance.

Parameters:
smooks - The Smooks instance.
filterType - The filter type.

getFilter

public static Filter getFilter()
Get the Filter instance for the current thread.

Returns:
The thread-bound Filter instance.

setFilter

public static void setFilter(Filter filter)
Set the Filter instance for the current thread.

Parameters:
filter - The thread-bound Filter instance.

removeCurrentFilter

public static void removeCurrentFilter()
Remove the Filter bound to the current thread.


getCurrentExecutionContext

public static ExecutionContext getCurrentExecutionContext()
Get the ExecutionContext instance bound to the current thread.

Returns:
The thread-bound ExecutionContext instance.

setCurrentExecutionContext

public static void setCurrentExecutionContext(ExecutionContext executionContext)
Set the ExecutionContext instance for the current thread.

Parameters:
executionContext - The thread-bound ExecutionContext instance.

removeCurrentExecutionContext

public static void removeCurrentExecutionContext()
Remove the ExecutionContext bound to the current thread.


getReader

protected Reader getReader(Source source,
                           ExecutionContext executionContext)

getWriter

protected Writer getWriter(Result result,
                           ExecutionContext executionContext)

close

protected void close(Source source)

close

protected void close(Result result)


Copyright © 2009. All Rights Reserved.