/** * Public constructor. * <p/> * Constructs a SmooksDOMFilter instance for delivering content for the supplied execution context. * * @param executionContext Execution context. This instance * is bound to the current Thread of execution. See <a href="#threading">Threading Issues</a>. */ public SmooksDOMFilter(ExecutionContext executionContext) { if (executionContext == null) { throw new IllegalArgumentException("null 'executionContext' arg passed in constructor call."); } this.executionContext = executionContext; deliveryConfig = (DOMContentDeliveryConfig) executionContext.getDeliveryConfig(); eventListener = executionContext.getEventListener(); closeSource = ParameterAccessor.getBoolParameter(Filter.CLOSE_SOURCE, true, executionContext.getDeliveryConfig()); closeResult = ParameterAccessor.getBoolParameter(Filter.CLOSE_RESULT, true, executionContext.getDeliveryConfig()); reverseVisitOrderOnVisitAfter = ParameterAccessor.getBoolParameter(Filter.REVERSE_VISIT_ORDER_ON_VISIT_AFTER, true, executionContext.getDeliveryConfig()); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = ParameterAccessor.getBoolParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, true, executionContext.getDeliveryConfig()); } else { terminateOnVisitorException = false; } }
/** * Public constructor. * <p/> * Constructs a SmooksDOMFilter instance for delivering content for the supplied execution context. * * @param executionContext Execution context. This instance * is bound to the current Thread of execution. See <a href="#threading">Threading Issues</a>. */ public SmooksDOMFilter(ExecutionContext executionContext) { if (executionContext == null) { throw new IllegalArgumentException("null 'executionContext' arg passed in constructor call."); } this.executionContext = executionContext; deliveryConfig = (DOMContentDeliveryConfig) executionContext.getDeliveryConfig(); eventListener = executionContext.getEventListener(); closeSource = ParameterAccessor.getBoolParameter(Filter.CLOSE_SOURCE, true, executionContext.getDeliveryConfig()); closeResult = ParameterAccessor.getBoolParameter(Filter.CLOSE_RESULT, true, executionContext.getDeliveryConfig()); reverseVisitOrderOnVisitAfter = ParameterAccessor.getBoolParameter(Filter.REVERSE_VISIT_ORDER_ON_VISIT_AFTER, true, executionContext.getDeliveryConfig()); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = ParameterAccessor.getBoolParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, true, executionContext.getDeliveryConfig()); } else { terminateOnVisitorException = false; } }
/** * Public constructor. * <p/> * Constructs a SmooksDOMFilter instance for delivering content for the supplied execution context. * * @param executionContext Execution context. This instance * is bound to the current Thread of execution. See <a href="#threading">Threading Issues</a>. */ public SmooksDOMFilter(ExecutionContext executionContext) { if (executionContext == null) { throw new IllegalArgumentException("null 'executionContext' arg passed in constructor call."); } this.executionContext = executionContext; deliveryConfig = (DOMContentDeliveryConfig) executionContext.getDeliveryConfig(); eventListener = executionContext.getEventListener(); closeSource = ParameterAccessor.getBoolParameter(Filter.CLOSE_SOURCE, true, executionContext.getDeliveryConfig()); closeResult = ParameterAccessor.getBoolParameter(Filter.CLOSE_RESULT, true, executionContext.getDeliveryConfig()); reverseVisitOrderOnVisitAfter = ParameterAccessor.getBoolParameter(Filter.REVERSE_VISIT_ORDER_ON_VISIT_AFTER, true, executionContext.getDeliveryConfig()); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = ParameterAccessor.getBoolParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, true, executionContext.getDeliveryConfig()); } else { terminateOnVisitorException = false; } }
/** * Public constructor. * * Constructs a SmooksDOMFilter instance for delivering content for the supplied execution context. * * @param executionContext Execution context. This instance * is bound to the current Thread of execution. See <a href="#threading">Threading Issues</a>. */ public SmooksDOMFilter(ExecutionContext executionContext) { if (executionContext == null) { throw new IllegalArgumentException("null 'executionContext' arg passed in constructor call."); } this.executionContext = executionContext; deliveryConfig = (DOMContentDeliveryConfig) executionContext.getDeliveryConfig(); eventListener = executionContext.getEventListener(); closeSource = ParameterAccessor.getBoolParameter(Filter.CLOSE_SOURCE, true, executionContext.getDeliveryConfig()); closeResult = ParameterAccessor.getBoolParameter(Filter.CLOSE_RESULT, true, executionContext.getDeliveryConfig()); reverseVisitOrderOnVisitAfter = ParameterAccessor.getBoolParameter(Filter.REVERSE_VISIT_ORDER_ON_VISIT_AFTER, true, executionContext.getDeliveryConfig()); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = ParameterAccessor.getBoolParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, true, executionContext.getDeliveryConfig()); } else { terminateOnVisitorException = false; } }
eventListener = executionContext.getEventListener(); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = contentDeliveryConfig.isTerminateOnVisitorException(); } else {
eventListener = executionContext.getEventListener(); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = contentDeliveryConfig.isTerminateOnVisitorException(); } else {
eventListener = executionContext.getEventListener(); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = contentDeliveryConfig.isTerminateOnVisitorException(); } else {
eventListener = executionContext.getEventListener(); if(!(executionContext.getEventListener() instanceof AbstractReportGenerator)) { terminateOnVisitorException = contentDeliveryConfig.isTerminateOnVisitorException(); } else {
/** * Public constructor. * @param node Node to be serialized. * @param executionContext Target device context. */ public Serializer(Node node, ExecutionContext executionContext) { if(node == null) { throw new IllegalArgumentException("null 'node' arg passed in method call."); } else if(executionContext == null) { throw new IllegalArgumentException("null 'executionContext' arg passed in method call."); } this.node = node; this.executionContext = executionContext; eventListener = executionContext.getEventListener(); // Get the delivery context for the device. deliveryConfig = (DOMContentDeliveryConfig) executionContext.getDeliveryConfig(); // Initialise the serializationUnits member serializationUnits = deliveryConfig.getSerailizationVisitors(); globalSUs = serializationUnits.getMappings(new String[] {"*", "**"}); // Set the default SerializationUnit defaultSerializationOn = ParameterAccessor.getBoolParameter(Filter.DEFAULT_SERIALIZATION_ON, true, executionContext.getDeliveryConfig()); if(defaultSerializationOn) { defaultSerializationUnit = new DefaultSerializationUnit(); boolean rewriteEntities = ParameterAccessor.getBoolParameter(Filter.ENTITIES_REWRITE, true, executionContext.getDeliveryConfig()); defaultSerializationUnit.setRewriteEntities(rewriteEntities); } terminateOnVisitorException = ParameterAccessor.getBoolParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, true, executionContext.getDeliveryConfig()); }
eventListener = executionContext.getEventListener();
eventListener = executionContext.getEventListener();
eventListener = executionContext.getEventListener();
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { Smooks smooks = getSmooksInstance(); ExecutionContext nestedExecutionContext = smooks.createExecutionContext(); // In case there's an attached event listener... nestedExecutionContext.setEventListener(executionContext.getEventListener()); // Copy over the XMLReader stack... AbstractParser.setReaders(AbstractParser.getReaders(executionContext), nestedExecutionContext); // Attach the NamespaceDeclarationStack to the nested execution context... NamespaceDeclarationStack nsStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext); NamespaceMappings.setNamespaceDeclarationStack(nsStack, nestedExecutionContext); SmooksContentHandler parentContentHandler = SmooksContentHandler.getHandler(executionContext); if(parentContentHandler.getNestedContentHandler() != null) { throw new SmooksException("Illegal use of more than one nested content handler fired on the same element."); } SmooksContentHandler nestedContentHandler = new SAXHandler(nestedExecutionContext, element.getWriter(this), parentContentHandler); DynamicSAXElementVisitorList.propogateDynamicVisitors(executionContext, nestedExecutionContext); // Attach the XMLReader instance to the nested ExecutionContext and then swap the content handler on // the XMLReader to be the nested handler created here. All events wll be forwarded to the .. XMLReader xmlReader = AbstractParser.getXMLReader(executionContext); AbstractParser.attachXMLReader(xmlReader, nestedExecutionContext); xmlReader.setContentHandler(nestedContentHandler); executionContext.setAttribute(NestedExecutionVisitor.class, nestedExecutionContext); // Note we do not execute the Smooks filterSource methods for a nested instance... we just install // the content handler and redirect the reader events to it... }
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { Smooks smooks = getSmooksInstance(); ExecutionContext nestedExecutionContext = smooks.createExecutionContext(); // In case there's an attached event listener... nestedExecutionContext.setEventListener(executionContext.getEventListener()); // Copy over the XMLReader stack... AbstractParser.setReaders(AbstractParser.getReaders(executionContext), nestedExecutionContext); // Attach the NamespaceDeclarationStack to the nested execution context... NamespaceDeclarationStack nsStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext); NamespaceMappings.setNamespaceDeclarationStack(nsStack, nestedExecutionContext); SmooksContentHandler parentContentHandler = SmooksContentHandler.getHandler(executionContext); if(parentContentHandler.getNestedContentHandler() != null) { throw new SmooksException("Illegal use of more than one nested content handler fired on the same element."); } SmooksContentHandler nestedContentHandler = new SAXHandler(nestedExecutionContext, element.getWriter(this), parentContentHandler); DynamicSAXElementVisitorList.propogateDynamicVisitors(executionContext, nestedExecutionContext); // Attach the XMLReader instance to the nested ExecutionContext and then swap the content handler on // the XMLReader to be the nested handler created here. All events wll be forwarded to the .. XMLReader xmlReader = AbstractParser.getXMLReader(executionContext); AbstractParser.attachXMLReader(xmlReader, nestedExecutionContext); xmlReader.setContentHandler(nestedContentHandler); executionContext.setAttribute(NestedExecutionVisitor.class, nestedExecutionContext); // Note we do not execute the Smooks filterSource methods for a nested instance... we just install // the content handler and redirect the reader events to it... }
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { Smooks smooks = getSmooksInstance(); ExecutionContext nestedExecutionContext = smooks.createExecutionContext(); // In case there's an attached event listener... nestedExecutionContext.setEventListener(executionContext.getEventListener()); // Copy over the XMLReader stack... AbstractParser.setReaders(AbstractParser.getReaders(executionContext), nestedExecutionContext); // Attach the NamespaceDeclarationStack to the nested execution context... NamespaceDeclarationStack nsStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext); NamespaceMappings.setNamespaceDeclarationStack(nsStack, nestedExecutionContext); SmooksContentHandler parentContentHandler = SmooksContentHandler.getHandler(executionContext); if(parentContentHandler.getNestedContentHandler() != null) { throw new SmooksException("Illegal use of more than one nested content handler fired on the same element."); } SmooksContentHandler nestedContentHandler = new SAXHandler(nestedExecutionContext, element.getWriter(this), parentContentHandler); DynamicSAXElementVisitorList.propogateDynamicVisitors(executionContext, nestedExecutionContext); // Attach the XMLReader instance to the nested ExecutionContext and then swap the content handler on // the XMLReader to be the nested handler created here. All events wll be forwarded to the .. XMLReader xmlReader = AbstractParser.getXMLReader(executionContext); AbstractParser.attachXMLReader(xmlReader, nestedExecutionContext); xmlReader.setContentHandler(nestedContentHandler); executionContext.setAttribute(NestedExecutionVisitor.class, nestedExecutionContext); // Note we do not execute the Smooks filterSource methods for a nested instance... we just install // the content handler and redirect the reader events to it... }
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException { Smooks smooks = getSmooksInstance(); ExecutionContext nestedExecutionContext = smooks.createExecutionContext(); // In case there's an attached event listener... nestedExecutionContext.setEventListener(executionContext.getEventListener()); // Copy over the XMLReader stack... AbstractParser.setReaders(AbstractParser.getReaders(executionContext), nestedExecutionContext); // Attach the NamespaceDeclarationStack to the nested execution context... NamespaceDeclarationStack nsStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext); NamespaceMappings.setNamespaceDeclarationStack(nsStack, nestedExecutionContext); SmooksContentHandler parentContentHandler = SmooksContentHandler.getHandler(executionContext); if(parentContentHandler.getNestedContentHandler() != null) { throw new SmooksException("Illegal use of more than one nested content handler fired on the same element."); } SmooksContentHandler nestedContentHandler = new SAXHandler(nestedExecutionContext, element.getWriter(this), parentContentHandler); DynamicSAXElementVisitorList.propogateDynamicVisitors(executionContext, nestedExecutionContext); // Attach the XMLReader instance to the nested ExecutionContext and then swap the content handler on // the XMLReader to be the nested handler created here. All events wll be forwarded to the .. XMLReader xmlReader = AbstractParser.getXMLReader(executionContext); AbstractParser.attachXMLReader(xmlReader, nestedExecutionContext); xmlReader.setContentHandler(nestedContentHandler); executionContext.setAttribute(NestedExecutionVisitor.class, nestedExecutionContext); // Note we do not execute the Smooks filterSource methods for a nested instance... we just install // the content handler and redirect the reader events to it... }
private void _filter(ExecutionContext executionContext, Source source, Result... results) { ExecutionEventListener eventListener = executionContext.getEventListener();
private void _filter(ExecutionContext executionContext, Source source, Result... results) { ExecutionEventListener eventListener = executionContext.getEventListener();
private void _filter(ExecutionContext executionContext, Source source, Result... results) { ExecutionEventListener eventListener = executionContext.getEventListener();
private void _filter(ExecutionContext executionContext, Source source, Result... results) { ExecutionEventListener eventListener = executionContext.getEventListener();