Package opendap.dap
Class ServerVersion
- java.lang.Object
-
- opendap.dap.ServerVersion
-
- All Implemented Interfaces:
Serializable
public class ServerVersion extends Object implements Serializable
Parses and holds the Server Version information returned by a DAP server. This information is used to determine the version of the DAP protocol used to by the DAP server to encode the data.
Currently the Server Version can come from more than one source. An DAP server responding to a client request over HTTP must include either anXDAP
header or anXDODS-Server
header.
>
TheXDAP
header content is defined as the protocol version of the transmission and must be of the form:
MV.mv[.mmv]
Where:
MV = Major Version Number
mv = Minor Version Number
mmv = An optional sub-minor version number.
For example anXDAP
header value of 3.2 indicates a major version of 3 minor version of 2. AnXDAP
header value of 2.6.3 indicates a major version number of 2, a minor version number of 6, and a subminor version of 3.
TheXDODS-Server
header is a legacy mechanism which identifies the version of the server software generating the response. This is somewhat loosely coupled to the protocol version and was the legacy mechanism for identifying the protocol version. It should be considered deprecated. Thus, clients seeking to read data from OPeNDAP servers should first check the server response for the existence of anXDAP
header, if one is not found then the client should check for anXDODS-Server
header. If the response is missing both headers then an exception should be thrown as the server response is invalid.- See Also:
ClientIO
,DDS
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DAP2_PROTOCOL_VERSION
static int
XDAP
static int
XDODS_SERVER
-
Constructor Summary
Constructors Constructor Description ServerVersion(int major, int minor)
Construct a new ServerVersion, setting major and minor version explicitly.ServerVersion(String ver, int headerType)
Construct a new ServerVersion, setting major and minor version based on the full version string.ServerVersion(URLConnection connection)
Determines Server (Protocol) Version based on the headers associated with the passed java.net.URLConnection.ServerVersion(HTTPMethod method)
Determines Server (Protocol) Version based on the headers associated with the passed GetMethod.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMajor()
Returns the major version number.int
getMinor()
Returns the minor version number.int
getSubMinor()
Returns the sub-minor version number, if it exists.String
getVersionString()
Returns the full version string.String
toString()
Returns the full version string.
-
-
-
Field Detail
-
XDODS_SERVER
public static final int XDODS_SERVER
- See Also:
- Constant Field Values
-
XDAP
public static final int XDAP
- See Also:
- Constant Field Values
-
DAP2_PROTOCOL_VERSION
public static final String DAP2_PROTOCOL_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerVersion
public ServerVersion(HTTPMethod method) throws DAP2Exception
Determines Server (Protocol) Version based on the headers associated with the passed GetMethod.- Parameters:
method
- The GetMethod containing the DAP2 headers.- Throws:
DAP2Exception
- When bad things happen (like the headers are missing or incorrectly constructed.)
-
ServerVersion
public ServerVersion(URLConnection connection) throws DAP2Exception
Determines Server (Protocol) Version based on the headers associated with the passed java.net.URLConnection.- Parameters:
connection
- The URLConnection containing the DAP2 headers- Throws:
DAP2Exception
- When bad things happen (like the headers are missing or incorrectly constructed.)
-
ServerVersion
public ServerVersion(String ver, int headerType) throws DAP2Exception
Construct a new ServerVersion, setting major and minor version based on the full version string. Currently the Server Version can come from more than one source. An OPeNDAP server responding to a client request over HTTP must include either anXDAP
header or anXDODS-Server
header.
>
TheXDAP
header content is defined as the protocol version of the transmission and must be of the form:
MV.mv[.mmv]
Where:
MV = Major Version Number
mv = Minor Version Number
mmv = An optional sub-minor version number.
For example anXDAP
header value of 3.2 indicates a major version of 3 minor version of 2. AnXDAP
header value of 2.6.3 indicates a major version number of 2, a minor version number of 6, and a subminor version of 3.
TheXDODS-Server
header is a legacy mechanism which identifies the version of the server software generating the response. This is somewhat loosely coupled to the protocol version and was the legacy mechanism for identifying the protocol version. It should be considered deprecated. Thus, clients seeking to read data from OPeNDAP servers should first check the server response for the existence of anXDAP
header, if one is not found then the client should check for anXDODS-Server
header. If the response is missing both headers then an exception should be thrown as the server response is invalid.- Parameters:
ver
- the full version string.headerType
- The type of header that the version was read from. May be set toServerVersion.XDODS_SERVER
orServerVersion.XDAP
- Throws:
DAP2Exception
- When the things go wrong.
-
ServerVersion
public ServerVersion(int major, int minor)
Construct a new ServerVersion, setting major and minor version explicitly.- Parameters:
major
- the major version number.minor
- the minor version number.
-
-
Method Detail
-
getMajor
public final int getMajor()
Returns the major version number.- Returns:
- the major version number.
-
getMinor
public final int getMinor()
Returns the minor version number.- Returns:
- the minor version number.
-
getSubMinor
public final int getSubMinor()
Returns the sub-minor version number, if it exists.- Returns:
- the minor version number or -1 if the sub-minor version has not been set.
-
toString
public final String toString()
Returns the full version string.
-
getVersionString
public final String getVersionString()
Returns the full version string.- Returns:
- the full version string.
-
-