Package opendap.dap

Class 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 an XDAP header or an XDODS-Server header.
    >
    The XDAP 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 an XDAP header value of 3.2 indicates a major version of 3 minor version of 2. An XDAP 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.

    The XDODS-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 an XDAP header, if one is not found then the client should check for an XDODS-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
    • 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 an XDAP header or an XDODS-Server header.
        >
        The XDAP 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 an XDAP header value of 3.2 indicates a major version of 3 minor version of 2. An XDAP 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.

        The XDODS-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 an XDAP header, if one is not found then the client should check for an XDODS-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 to ServerVersion.XDODS_SERVER or ServerVersion.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.
        Overrides:
        toString in class Object
        Returns:
        the full version string.
      • getVersionString

        public final String getVersionString()
        Returns the full version string.
        Returns:
        the full version string.