org.cdlib.xtf.saxonExt.pipe
Class PipeFopElement.PipeFopInstruction

Object
  extended by Expression
      extended by Instruction
          extended by InstructionWithContent
              extended by PipeFopElement.PipeFopInstruction
All Implemented Interfaces:
Serializable, SourceLocator, Container, EvaluableItem, SequenceIterable, TailCallReturner, InstructionInfoProvider
Enclosing class:
PipeFopElement

private static class PipeFopElement.PipeFopInstruction
extends InstructionWithContent

Worker class for PipeFopElement


Nested Class Summary
private static class PipeFopElement.PipeFopInstruction.PageInfo
           
 
Field Summary
 
Fields inherited from class InstructionWithContent
attribs, content, name
 
Fields inherited from class Expression
EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties
 
Constructor Summary
PipeFopElement.PipeFopInstruction(Map<String,Expression> attribs, Expression content)
           
 
Method Summary
private  FopFactory createFopFactory(XPathContext context)
          Create a FOP factory and configure it, if we don't already have one.
private  void mergeMetadata(HashMap<String,String>[] infos, PdfWriter pdfWriter, XPathContext context)
          Merge metadata from the FOP-generated PDF and a PDF we're merging into it.
private  void mergePdf(XPathContext context, File origPdfData, File fileToAppend, PipeFopElement.MergeMode mergeMode, PipeFopElement.MergeAt mergeAt, OutputStream outStream)
          Do the work of joining the FOP output and a PDF together.
 TailCall processLeavingTail(XPathContext context)
          The real workhorse.
 
Methods inherited from class InstructionWithContent
createsNewNodes, display, dynamicError, getAttribBool, getAttribStr, getAttribStr, getCardinality, getInstructionNameCode, getItemType, iterateSubExpressions, optimize, promoteInst, replaceSubExpression, sequenceToString, simplify, typeCheck
 
Methods inherited from class Instruction
appendItem, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getImplementationMethod, getInstructionInfo, getSourceLocator, isXSLT, iterate, process, promote
 
Methods inherited from class Expression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, getColumnNumber, getConstructType, getContainingProcedure, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeError
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
 

Constructor Detail

PipeFopElement.PipeFopInstruction

public PipeFopElement.PipeFopInstruction(Map<String,Expression> attribs,
                                         Expression content)
Method Detail

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
                            throws XPathException
The real workhorse.

Specified by:
processLeavingTail in interface TailCallReturner
Specified by:
processLeavingTail in class InstructionWithContent
Throws:
XPathException

createFopFactory

private FopFactory createFopFactory(XPathContext context)
                             throws ConfigurationException,
                                    SAXException,
                                    IOException,
                                    XPathException
Create a FOP factory and configure it, if we don't already have one.

Throws:
ConfigurationException
SAXException
IOException
XPathException

mergePdf

private void mergePdf(XPathContext context,
                      File origPdfData,
                      File fileToAppend,
                      PipeFopElement.MergeMode mergeMode,
                      PipeFopElement.MergeAt mergeAt,
                      OutputStream outStream)
               throws IOException,
                      DocumentException,
                      BadPdfFormatException,
                      XPathException
Do the work of joining the FOP output and a PDF together. This involves several steps: 1. Based on parameters specified in the PipeFOP command, determine how the pages will overlap. 2. Merge bookmarks and metadata 3. Output the pages

Throws:
IOException
DocumentException
BadPdfFormatException
XPathException

mergeMetadata

private void mergeMetadata(HashMap<String,String>[] infos,
                           PdfWriter pdfWriter,
                           XPathContext context)
                    throws XPathException
Merge metadata from the FOP-generated PDF and a PDF we're merging into it. Generally metadata in the merge file takes precedence over the FOP metadata, but the "overrideMetadata" option reverses that behavior.

Throws:
XPathException