Package dap4.dap4lib
Class DMRPrinter
- java.lang.Object
-
- dap4.dap4lib.DMRPrinter
-
public class DMRPrinter extends Object
DMR Printer. Given a constraint and a Dataset, print the constrained subset of the dataset.WARNING: the printDMR code in some cases duplicates code in dap4.dap4.Dap4Print; so changes here should be propagated.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanALLOWFIELDMAPSprotected dap4.core.ce.CEConstraintceprotected dap4.core.dmr.DapDatasetdmrprotected dap4.core.util.ResponseFormatformatprotected static String[]GROUPSPECIALprotected static intNILFLAGSprotected static intNONAMEprotected static intNONNILprotected static intPERLINEprotected dap4.core.util.IndentWriterprinterprotected static String[]RESERVEDTAGSprotected booleantestingprotected static String[]VARSPECIALprotected PrintWriterwriterprotected static intXMLESCAPED
-
Constructor Summary
Constructors Modifier Constructor Description protectedDMRPrinter()DMRPrinter(dap4.core.dmr.DapDataset dmr, dap4.core.ce.CEConstraint ce, PrintWriter writer, dap4.core.util.ResponseFormat format)DMRPrinter(dap4.core.dmr.DapDataset dmr, PrintWriter writer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()static StringfqnXMLEscape(String fqn)XML escape a dap fqn and converting '"' to " Assumes backslash escapes are in effect for '/' and '.'protected static StringgetPrintValue(Object value)protected static booleanhasDimensions(dap4.core.dmr.DapVariable var)protected static booleanhasMaps(dap4.core.dmr.DapVariable var)protected booleanhasMetadata(dap4.core.dmr.DapNode node)voidprint()Print a DapDataset: - as DMR - optionally constrainedprotected voidprintContainerAttribute(dap4.core.dmr.DapAttribute attr)protected voidprintMetadata(dap4.core.dmr.DapNode node)voidprintNode(dap4.core.dmr.DapNode node)Print an arbitrary DapNode and its subnodes as if it is being sent to a client with optional constraint; inclusions are determined by the view.protected voidprintOtherXML(dap4.core.dmr.DapAttribute attr)protected voidprintReserved(dap4.core.dmr.DapNode node)protected voidprintXMLAttribute(String name, String value, int flags)PrintXMLAttributes helper functionvoidtestprint()Same as print() except certain items of information are suppressed.
-
-
-
Field Detail
-
NILFLAGS
protected static final int NILFLAGS
- See Also:
- Constant Field Values
-
PERLINE
protected static final int PERLINE
- See Also:
- Constant Field Values
-
NONAME
protected static final int NONAME
- See Also:
- Constant Field Values
-
NONNIL
protected static final int NONNIL
- See Also:
- Constant Field Values
-
XMLESCAPED
protected static final int XMLESCAPED
- See Also:
- Constant Field Values
-
GROUPSPECIAL
protected static final String[] GROUPSPECIAL
-
VARSPECIAL
protected static final String[] VARSPECIAL
-
RESERVEDTAGS
protected static final String[] RESERVEDTAGS
-
ALLOWFIELDMAPS
public static final boolean ALLOWFIELDMAPS
- See Also:
- Constant Field Values
-
writer
protected PrintWriter writer
-
printer
protected dap4.core.util.IndentWriter printer
-
dmr
protected dap4.core.dmr.DapDataset dmr
-
ce
protected dap4.core.ce.CEConstraint ce
-
format
protected dap4.core.util.ResponseFormat format
-
testing
protected boolean testing
-
-
Constructor Detail
-
DMRPrinter
protected DMRPrinter()
-
DMRPrinter
public DMRPrinter(dap4.core.dmr.DapDataset dmr, PrintWriter writer)
-
DMRPrinter
public DMRPrinter(dap4.core.dmr.DapDataset dmr, dap4.core.ce.CEConstraint ce, PrintWriter writer, dap4.core.util.ResponseFormat format)
-
-
Method Detail
-
flush
public void flush()
-
close
public void close()
-
print
public void print() throws IOExceptionPrint a DapDataset: - as DMR - optionally constrained- Throws:
IOException
-
testprint
public void testprint() throws IOExceptionSame as print() except certain items of information are suppressed.- Throws:
IOException
-
printNode
public void printNode(dap4.core.dmr.DapNode node) throws IOExceptionPrint an arbitrary DapNode and its subnodes as if it is being sent to a client with optional constraint; inclusions are determined by the view.Handling newlines is a bit tricky because they may be embedded for e.g. groups, enums, etc. So the rule is that the last newline is elided and left for the caller to print. Exceptions: printMetadata printDimrefs, printMaps
- Parameters:
node- - the node to print- Throws:
IOException- Note that the PrintWriter is global.
-
printXMLAttribute
protected void printXMLAttribute(String name, String value, int flags) throws dap4.core.util.DapException
PrintXMLAttributes helper function- Parameters:
name-value-flags-- Throws:
dap4.core.util.DapException
-
printReserved
protected void printReserved(dap4.core.dmr.DapNode node) throws dap4.core.util.DapException- Throws:
dap4.core.util.DapException
-
printMetadata
protected void printMetadata(dap4.core.dmr.DapNode node) throws IOException- Throws:
IOException
-
printContainerAttribute
protected void printContainerAttribute(dap4.core.dmr.DapAttribute attr)
-
printOtherXML
protected void printOtherXML(dap4.core.dmr.DapAttribute attr)
-
fqnXMLEscape
public static String fqnXMLEscape(String fqn)
XML escape a dap fqn and converting '"' to " Assumes backslash escapes are in effect for '/' and '.'- Parameters:
fqn- the backslash escaped fqn- Returns:
- escaped string
-
hasMetadata
protected boolean hasMetadata(dap4.core.dmr.DapNode node)
-
hasMaps
protected static boolean hasMaps(dap4.core.dmr.DapVariable var)
-
hasDimensions
protected static boolean hasDimensions(dap4.core.dmr.DapVariable var)
-
-