@SuppressWarnings({ "unchecked", "WeakerAccess", "UnusedReturnValue" }) public Document popCreator(ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { throw new IllegalStateException("No DOM Creator Stack available."); } else { try { // Remove the current DOMCreators from the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DOMCreator removedCreator = domCreatorStack.pop(); DynamicSAXElementVisitorList.removeDynamicVisitor(removedCreator, executionContext); return removedCreator.document; } else { return null; } } finally { // Reinstate parent DOMCreators in the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DynamicSAXElementVisitorList.addDynamicVisitor(domCreatorStack.peek(), executionContext); } } } }
public Document popCreator(ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { throw new IllegalStateException("No DOM Creator Stack available."); } else { try { // Remove the current DOMCreators from the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DOMCreator removedCreator = domCreatorStack.pop(); DynamicSAXElementVisitorList.removeDynamicVisitor(removedCreator, executionContext); return removedCreator.document; } else { return null; } } finally { // Reinstate parent DOMCreators in the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DynamicSAXElementVisitorList.addDynamicVisitor(domCreatorStack.peek(), executionContext); } } } }
@SuppressWarnings({ "unchecked", "WeakerAccess", "UnusedReturnValue" }) public Document popCreator(ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { throw new IllegalStateException("No DOM Creator Stack available."); } else { try { // Remove the current DOMCreators from the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DOMCreator removedCreator = domCreatorStack.pop(); DynamicSAXElementVisitorList.removeDynamicVisitor(removedCreator, executionContext); return removedCreator.document; } else { return null; } } finally { // Reinstate parent DOMCreators in the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DynamicSAXElementVisitorList.addDynamicVisitor(domCreatorStack.peek(), executionContext); } } } }
@SuppressWarnings({ "unchecked", "WeakerAccess", "UnusedReturnValue" }) public Document popCreator(ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { throw new IllegalStateException("No DOM Creator Stack available."); } else { try { // Remove the current DOMCreators from the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DOMCreator removedCreator = domCreatorStack.pop(); DynamicSAXElementVisitorList.removeDynamicVisitor(removedCreator, executionContext); return removedCreator.document; } else { return null; } } finally { // Reinstate parent DOMCreators in the dynamic visitor list... if(!domCreatorStack.isEmpty()) { DynamicSAXElementVisitorList.addDynamicVisitor(domCreatorStack.peek(), executionContext); } } } }
private void pushCreator(DOMCreator domCreator, ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { domCreatorStack = new Stack<DOMCreator>(); executionContext.setAttribute(DOMCreator.class, domCreatorStack); } else if(!domCreatorStack.isEmpty()) { // We need to remove the current DOMCreator from the dynamic visitor list because // we want to stop nodes being added to it and instead, have them added to the new // DOM. This prevents a single huge DOM being created for a huge message (being processed // via SAX) because it maintains a hierarchy of model. Inner model can represent collection // entry instances, with a single model for a single collection entry only being held in memory // at any point in time i.e. old ones are overwritten and so freed for GC. DynamicSAXElementVisitorList.removeDynamicVisitor(domCreatorStack.peek(), executionContext); } DynamicSAXElementVisitorList.addDynamicVisitor(domCreator, executionContext); domCreatorStack.push(domCreator); }
@SuppressWarnings("unchecked") private void pushCreator(DOMCreator domCreator, ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { domCreatorStack = new Stack<DOMCreator>(); executionContext.setAttribute(DOMCreator.class, domCreatorStack); } else if(!domCreatorStack.isEmpty()) { // We need to remove the current DOMCreator from the dynamic visitor list because // we want to stop nodes being added to it and instead, have them added to the new // DOM. This prevents a single huge DOM being created for a huge message (being processed // via SAX) because it maintains a hierarchy of model. Inner model can represent collection // entry instances, with a single model for a single collection entry only being held in memory // at any point in time i.e. old ones are overwritten and so freed for GC. DynamicSAXElementVisitorList.removeDynamicVisitor(domCreatorStack.peek(), executionContext); } DynamicSAXElementVisitorList.addDynamicVisitor(domCreator, executionContext); domCreatorStack.push(domCreator); }
@SuppressWarnings("unchecked") private void pushCreator(DOMCreator domCreator, ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { domCreatorStack = new Stack<DOMCreator>(); executionContext.setAttribute(DOMCreator.class, domCreatorStack); } else if(!domCreatorStack.isEmpty()) { // We need to remove the current DOMCreator from the dynamic visitor list because // we want to stop nodes being added to it and instead, have them added to the new // DOM. This prevents a single huge DOM being created for a huge message (being processed // via SAX) because it maintains a hierarchy of model. Inner model can represent collection // entry instances, with a single model for a single collection entry only being held in memory // at any point in time i.e. old ones are overwritten and so freed for GC. DynamicSAXElementVisitorList.removeDynamicVisitor(domCreatorStack.peek(), executionContext); } DynamicSAXElementVisitorList.addDynamicVisitor(domCreator, executionContext); domCreatorStack.push(domCreator); }
@SuppressWarnings("unchecked") private void pushCreator(DOMCreator domCreator, ExecutionContext executionContext) { Stack<DOMCreator> domCreatorStack = (Stack<DOMCreator>) executionContext.getAttribute(DOMCreator.class); if(domCreatorStack == null) { domCreatorStack = new Stack<DOMCreator>(); executionContext.setAttribute(DOMCreator.class, domCreatorStack); } else if(!domCreatorStack.isEmpty()) { // We need to remove the current DOMCreator from the dynamic visitor list because // we want to stop nodes being added to it and instead, have them added to the new // DOM. This prevents a single huge DOM being created for a huge message (being processed // via SAX) because it maintains a hierarchy of model. Inner model can represent collection // entry instances, with a single model for a single collection entry only being held in memory // at any point in time i.e. old ones are overwritten and so freed for GC. DynamicSAXElementVisitorList.removeDynamicVisitor(domCreatorStack.peek(), executionContext); } DynamicSAXElementVisitorList.addDynamicVisitor(domCreator, executionContext); domCreatorStack.push(domCreator); }
@SuppressWarnings("unchecked") public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException { Map<String, SAXSerializer> fragmentSerializers = (Map<String, SAXSerializer>) executionContext.getAttribute(FragmentSerializer.class); SAXSerializer serializer = fragmentSerializers.get(bindTo); try { executionContext.getBeanContext().addBean(bindTo, serializer.fragmentWriter.toString().trim(), new Fragment(saxElement)); } finally { DynamicSAXElementVisitorList.removeDynamicVisitor(serializer, executionContext); } }
@SuppressWarnings("unchecked") public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException { Map<String, SAXSerializer> fragmentSerializers = (Map<String, SAXSerializer>) executionContext.getAttribute(FragmentSerializer.class); SAXSerializer serializer = fragmentSerializers.get(bindTo); try { executionContext.getBeanContext().addBean(bindTo, serializer.fragmentWriter.toString().trim(), new Fragment(saxElement)); } finally { DynamicSAXElementVisitorList.removeDynamicVisitor(serializer, executionContext); } }