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 ChecksumMode
checksummode
protected Map<DapVariable,D4Array>
datamap
static boolean
DEBUG
protected DapDataset
dmr
protected String
dmrtext
protected String
location
protected RequestMode
mode
protected static boolean
PARSEDEBUG
protected ByteOrder
remoteorder
protected DeChunkedInputStream
stream
protected boolean
streamclosed
protected XURI
xuri
-
Constructor Summary
Constructors Constructor Description D4DSP()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addVariableData(DapVariable var, D4Array cursor)
abstract boolean
dspMatch(String path, DapContext context)
Determine if a path refers to an object processable by this DSPMap<DapVariable,Long>
getChecksumMap(DapConstants.ChecksumSource src)
ChecksumMode
getChecksumMode()
DapDataset
getDMR()
protected String
getMethodUrl(RequestMode mode, ChecksumMode csum)
DeChunkedInputStream
getStream()
Map<DapVariable,D4Array>
getVariableDataMap()
void
loadContext(DapContext cxt, RequestMode mode)
void
loadDAP()
void
loadDMR()
Extract the DMR from available dechunked dataD4DSP
open(String location, ChecksumMode cmode)
"open" a reference to a data source and return the DSP wrapper.protected DapDataset
parseDMR(String document)
It is common to want to parse a DMR text to a DapDataset, so provide this utility.protected void
parseURL(String url)
protected void
processAttributes(DapDataset dataset)
Walk the dataset tree and remove selected attributes such as _Unsignedprotected void
processMaps(DapDataset dataset)
Walk the dataset tree and linkprotected String
readDMR()
protected void
reportError(String errmsg)
protected void
setDMR(DapDataset dmr)
protected D4DSP
setStream(InputStream input, RequestMode mode)
protected boolean
suppressAttributes(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 IOException
Extract the DMR from available dechunked data- Throws:
DapException
IOException
-
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
-
-