Package dap4.dap4lib
Class D4DSP
- java.lang.Object
-
- dap4.dap4lib.D4DSP
-
public abstract class D4DSP extends Object
This Class takes a DAP4 serialization (as chunked input) stream and exports access to a compiled DMR, a compiled DAP4 data stream, and various parameters such as byteorder of the data stream. Most of the work is done by this class. Its subclasses need only provide a raw byte stream to DAP4 chunked data taken from e.g. a raw data file or an HTTP connection. It cannot be used standalone.
-
-
Field Summary
Fields Modifier and Type Field Description protected ChecksumModechecksummodeprotected Map<DapVariable,D4Array>datamapstatic booleanDEBUGprotected DapDatasetdmrprotected Stringdmrtextprotected Stringlocationprotected RequestModemodeprotected static booleanPARSEDEBUGprotected ByteOrderremoteorderprotected DeChunkedInputStreamstreamprotected booleanstreamclosedprotected XURIxuri
-
Constructor Summary
Constructors Constructor Description D4DSP()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddVariableData(DapVariable var, D4Array cursor)abstract booleandspMatch(String path, DapContext context)Determine if a path refers to an object processable by this DSPMap<DapVariable,Long>getChecksumMap(DapConstants.ChecksumSource src)ChecksumModegetChecksumMode()DapDatasetgetDMR()protected StringgetMethodUrl(RequestMode mode, ChecksumMode csum)DeChunkedInputStreamgetStream()Map<DapVariable,D4Array>getVariableDataMap()voidloadContext(DapContext cxt, RequestMode mode)voidloadDAP()voidloadDMR()Extract the DMR from available dechunked dataD4DSPopen(String location, ChecksumMode cmode)"open" a reference to a data source and return the DSP wrapper.protected DapDatasetparseDMR(String document)It is common to want to parse a DMR text to a DapDataset, so provide this utility.protected voidparseURL(String url)protected voidprocessAttributes(DapDataset dataset)Walk the dataset tree and remove selected attributes such as _Unsignedprotected voidprocessMaps(DapDataset dataset)Walk the dataset tree and linkprotected StringreadDMR()protected voidreportError(String errmsg)protected voidsetDMR(DapDataset dmr)protected D4DSPsetStream(InputStream input, RequestMode mode)protected booleansuppressAttributes(String attrname)Some attributes that are added by the NetcdfDataset need to be kept out of the DMR.
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
-
PARSEDEBUG
protected static final boolean PARSEDEBUG
- See Also:
- Constant Field Values
-
dmrtext
protected String dmrtext
-
dmr
protected DapDataset dmr
-
location
protected String location
-
stream
protected DeChunkedInputStream stream
-
streamclosed
protected boolean streamclosed
-
xuri
protected XURI xuri
-
remoteorder
protected ByteOrder remoteorder
-
checksummode
protected ChecksumMode checksummode
-
mode
protected RequestMode mode
-
datamap
protected Map<DapVariable,D4Array> datamap
-
-
Method Detail
-
open
public D4DSP open(String location, ChecksumMode cmode) throws DapException
"open" a reference to a data source and return the DSP wrapper.- Parameters:
location- - Object that defines the data sourcecmode-- Returns:
- = wrapping dsp
- Throws:
DapException
-
getStream
public DeChunkedInputStream getStream()
-
getChecksumMode
public ChecksumMode getChecksumMode()
-
getVariableDataMap
public Map<DapVariable,D4Array> getVariableDataMap()
-
getChecksumMap
public Map<DapVariable,Long> getChecksumMap(DapConstants.ChecksumSource src)
-
setStream
protected D4DSP setStream(InputStream input, RequestMode mode) throws IOException
- Throws:
IOException
-
addVariableData
protected void addVariableData(DapVariable var, D4Array cursor)
-
getDMR
public DapDataset getDMR()
-
setDMR
protected void setDMR(DapDataset dmr)
-
dspMatch
public abstract boolean dspMatch(String path, DapContext context)
Determine if a path refers to an object processable by this DSP- Parameters:
path-context-- Returns:
- true if this path can be processed by an instance of this DSP
-
loadDMR
public void loadDMR() throws IOExceptionExtract the DMR from available dechunked data- Throws:
DapExceptionIOException
-
loadDAP
public void loadDAP() throws IOException- Throws:
IOException
-
loadContext
public void loadContext(DapContext cxt, RequestMode mode)
-
readDMR
protected String readDMR() throws IOException
- Throws:
IOException
-
parseURL
protected void parseURL(String url) throws DapException
- Throws:
DapException
-
getMethodUrl
protected String getMethodUrl(RequestMode mode, ChecksumMode csum) throws DapException
- Throws:
DapException
-
parseDMR
protected DapDataset parseDMR(String document) throws DapException
It is common to want to parse a DMR text to a DapDataset, so provide this utility.- Parameters:
document- the dmr to parse- Returns:
- the parsed dmr
- Throws:
DapException- on parse errors
-
suppressAttributes
protected boolean suppressAttributes(String attrname)
Some attributes that are added by the NetcdfDataset need to be kept out of the DMR. This function defines that set.- Parameters:
attrname-- Returns:
- true if the attribute should be suppressed, false otherwise.
-
processAttributes
protected void processAttributes(DapDataset dataset) throws DapException
Walk the dataset tree and remove selected attributes such as _Unsigned- Parameters:
dataset-- Throws:
DapException
-
processMaps
protected void processMaps(DapDataset dataset) throws DapException
Walk the dataset tree and link
-
-