Class NestedSmooksVisitor
- java.lang.Object
-
- org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor
-
- All Implemented Interfaces:
ContentHandler
,Producer
,PreExecutionLifecycle
,AfterVisitor
,BeforeVisitor
,SaxNgVisitor
,Visitor
public class NestedSmooksVisitor extends Object implements BeforeVisitor, AfterVisitor, Producer, PreExecutionLifecycle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NestedSmooksVisitor.Action
-
Field Summary
Fields Modifier and Type Field Description protected NestedSmooksVisitor.Action
action
protected Optional<NestedSmooksVisitor.Action>
actionOptional
protected ApplicationContext
applicationContext
protected BeanId
bindBeanId
protected Optional<String>
bindIdOptional
protected static TypedKey<DocumentBuilder>
CACHED_DOCUMENT_BUILDER_TYPED_KEY
protected DomSerializer
domSerializer
protected Integer
maxNodeDepth
protected static TypedKey<ExecutionContext>
NESTED_EXECUTION_CONTEXT_MEMENTO_TYPED_KEY
protected Smooks
nestedSmooks
protected Optional<String>
outputStreamResourceOptional
protected ResourceConfig
resourceConfig
protected ResourceConfigSeq
resourceConfigSeq
protected Boolean
rewriteEntities
protected static TypedKey<Node>
SOURCE_BRIDGE_TYPED_KEY
-
Constructor Summary
Constructors Constructor Description NestedSmooksVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
append(Fragment<Node> visitedNodeFragment, Element rootElement, NestedSmooksVisitor.Action action, ExecutionContext executionContext)
protected Node
deAttach(Node node, ExecutionContext executionContext)
protected void
filterSource(Fragment<Node> visitedNodeFragment, Fragment<Node> rootNodeFragment, Writer writer, ExecutionContext executionContext, String visit)
int
getMaxNodeDepth()
Smooks
getNestedSmooks()
Optional<String>
getOutputStreamResourceOptional()
Set<String>
getProducts()
Get the set of products produced by this producer instance.void
onPreExecution(ExecutionContext executionContext)
Initialize the resources allocated by this resource for the specified ExecutionContext.void
postConstruct()
void
preDestroy()
protected void
prependAfter(Fragment<Node> visitedNodeFragment, Element rootElement, ExecutionContext executionContext)
protected Writer
prependBefore(Fragment<Node> visitedNodeFragment, NestedSmooksVisitor.Action action, Element rootElement, ExecutionContext executionContext)
protected void
replaceAfter(Fragment<Node> visitedNodeFragment, Node rootNode, ExecutionContext executionContext)
protected Writer
replaceBefore(Fragment<Node> visitedNodeFragment, Node rootNode, ExecutionContext executionContext)
void
setAction(Optional<NestedSmooksVisitor.Action> actionOptional)
void
setApplicationContext(ApplicationContext applicationContext)
void
setBindIdOptional(Optional<String> bindIdOptional)
void
setMaxNodeDepth(Integer maxNodeDepth)
void
setNestedSmooks(Smooks nestedSmooks)
void
setOutputStreamResourceOptional(Optional<String> outputStreamResourceOptional)
void
setResourceConfig(ResourceConfig resourceConfig)
void
setResourceConfigSeq(ResourceConfigSeq resourceConfigSeq)
void
visitAfter(Element element, ExecutionContext executionContext)
Visits the end of anElement
.void
visitBefore(Element element, ExecutionContext executionContext)
Visits the beginning of anElement
.
-
-
-
Field Detail
-
CACHED_DOCUMENT_BUILDER_TYPED_KEY
protected static final TypedKey<DocumentBuilder> CACHED_DOCUMENT_BUILDER_TYPED_KEY
-
NESTED_EXECUTION_CONTEXT_MEMENTO_TYPED_KEY
protected static final TypedKey<ExecutionContext> NESTED_EXECUTION_CONTEXT_MEMENTO_TYPED_KEY
-
bindBeanId
protected BeanId bindBeanId
-
action
protected NestedSmooksVisitor.Action action
-
actionOptional
@Inject @Named("action") protected Optional<NestedSmooksVisitor.Action> actionOptional
-
outputStreamResourceOptional
@Inject @Named("outputStreamResource") protected Optional<String> outputStreamResourceOptional
-
resourceConfig
@Inject protected ResourceConfig resourceConfig
-
maxNodeDepth
@Inject protected Integer maxNodeDepth
-
applicationContext
@Inject protected ApplicationContext applicationContext
-
rewriteEntities
@Inject @Named("entities.rewrite") protected Boolean rewriteEntities
-
resourceConfigSeq
protected ResourceConfigSeq resourceConfigSeq
-
nestedSmooks
protected Smooks nestedSmooks
-
domSerializer
protected DomSerializer domSerializer
-
-
Method Detail
-
postConstruct
@PostConstruct public void postConstruct() throws SAXException, IOException, URISyntaxException, ClassNotFoundException
-
onPreExecution
public void onPreExecution(ExecutionContext executionContext)
Description copied from interface:PreExecutionLifecycle
Initialize the resources allocated by this resource for the specified ExecutionContext. Executes the initialization at the start of the filter execution.- Specified by:
onPreExecution
in interfacePreExecutionLifecycle
- Parameters:
executionContext
- The ExecutionContext.
-
deAttach
protected Node deAttach(Node node, ExecutionContext executionContext)
-
visitBefore
public void visitBefore(Element element, ExecutionContext executionContext)
Description copied from interface:BeforeVisitor
Visits the beginning of anElement
.- Specified by:
visitBefore
in interfaceBeforeVisitor
- Parameters:
element
- theElement
representing the beginning of the fragment. TheElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false. TheElement
's child nodes are not traversable.executionContext
- the currentExecutionContext
-
visitAfter
public void visitAfter(Element element, ExecutionContext executionContext)
Description copied from interface:AfterVisitor
Visits the end of anElement
.- Specified by:
visitAfter
in interfaceAfterVisitor
- Parameters:
element
- theElement
representing the end of the fragment. TheElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false. TheElement
's child nodes are traversable if one of the following conditions are met:max.node.depth
global config parameter is set to 0 or greater than 1, or- this
AfterVisitor
implementsParameterizedVisitor.getMaxNodeDepth()
which returns an integer greater than 1
executionContext
- the currentExecutionContext
-
replaceBefore
protected Writer replaceBefore(Fragment<Node> visitedNodeFragment, Node rootNode, ExecutionContext executionContext)
-
replaceAfter
protected void replaceAfter(Fragment<Node> visitedNodeFragment, Node rootNode, ExecutionContext executionContext)
-
prependBefore
protected Writer prependBefore(Fragment<Node> visitedNodeFragment, NestedSmooksVisitor.Action action, Element rootElement, ExecutionContext executionContext)
-
prependAfter
protected void prependAfter(Fragment<Node> visitedNodeFragment, Element rootElement, ExecutionContext executionContext)
-
append
protected void append(Fragment<Node> visitedNodeFragment, Element rootElement, NestedSmooksVisitor.Action action, ExecutionContext executionContext)
-
filterSource
protected void filterSource(Fragment<Node> visitedNodeFragment, Fragment<Node> rootNodeFragment, Writer writer, ExecutionContext executionContext, String visit)
-
getMaxNodeDepth
public int getMaxNodeDepth()
-
getProducts
public Set<String> getProducts()
Description copied from interface:Producer
Get the set of products produced by this producer instance.- Specified by:
getProducts
in interfaceProducer
- Returns:
- The set of products produced by this producer instance.
-
setMaxNodeDepth
public void setMaxNodeDepth(Integer maxNodeDepth)
-
getNestedSmooks
public Smooks getNestedSmooks()
-
setNestedSmooks
public void setNestedSmooks(Smooks nestedSmooks)
-
setResourceConfig
public void setResourceConfig(ResourceConfig resourceConfig)
-
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
-
setResourceConfigSeq
public void setResourceConfigSeq(ResourceConfigSeq resourceConfigSeq)
-
setAction
public void setAction(Optional<NestedSmooksVisitor.Action> actionOptional)
-
setOutputStreamResourceOptional
public void setOutputStreamResourceOptional(Optional<String> outputStreamResourceOptional)
-
preDestroy
@PreDestroy public void preDestroy()
-
-