Package opendap.dts

Class testDataset

java.lang.Object
opendap.dts.testDataset
All Implemented Interfaces:
opendap.servlet.GuardedDataset

public class testDataset extends Object implements opendap.servlet.GuardedDataset
This is the OPeNDAP Test servlet (dts). It allows the owner of the server to deliver data in ANY valid DDS to a client. This DDS will be filled with invented data if the client requests a DataDDS. This kind of test fixture is useful for evaluating a clients ability to handle the various complexities of the OPeNDAP data types.
  • Constructor Summary

    Constructors
    Constructor
    Description
    testDataset(opendap.servlet.ReqState rs)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    opendap.dap.DAS
    ************************************************************************
    opendap.servers.ServerDDS
    ************************************************************************ For the test server this method does the following: Makes a new test_ServerFactory (aka BaseTypeFactory) for the dataset requested.
    openCachedDAS(opendap.servlet.ReqState rs)
    ************************************************************************ Opens a DAS cached on local disk.
    openCachedDDS(opendap.servlet.ReqState rs)
    ************************************************************************ Opens a DDS cached on local disk.
    openCachedDDX(opendap.servlet.ReqState rs)
    ************************************************************************ Opens a DDX cached on local disk.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • testDataset

      public testDataset(opendap.servlet.ReqState rs)
  • Method Details

    • release

      public void release()
      Specified by:
      release in interface opendap.servlet.GuardedDataset
    • close

      public void close()
      Specified by:
      close in interface opendap.servlet.GuardedDataset
    • getDDS

      public opendap.servers.ServerDDS getDDS() throws opendap.dap.DAP2Exception, opendap.dap.parsers.ParseException
      ************************************************************************ For the test server this method does the following:
      • Makes a new test_ServerFactory (aka BaseTypeFactory) for the dataset requested.
      • Instantiates a ServerDDS using the test_ServerFactory and populates it (this is accomplished by opening a locally cached DDS from a file and parsing it)
      • Returns this freshly minted ServerDDS object (to the servlet code where it is used.)
      Specified by:
      getDDS in interface opendap.servlet.GuardedDataset
      Returns:
      The ServerDDS for the named data set.
      Throws:
      opendap.dap.DAP2Exception
      opendap.dap.parsers.ParseException
      See Also:
    • openCachedDDX

      public DataInputStream openCachedDDX(opendap.servlet.ReqState rs)
      ************************************************************************ Opens a DDX cached on local disk. This can be used on OPeNDAP servers (such as the OPeNDAP SQL Server) that rely on locally cached DDX files as opposed to dynamically generated DDS's.

      This method uses the ServletConfig object cached by in the ReqState object to locate the servlet init parameter DDXcache to determine where to look for the cached DDX document. If the init parameter was not set then the ReqState.defaultDDXcache variable is used as the location of the DDX cache.

      If the DDX cannot be found an error is sent back to the client.

      Parameters:
      rs - The ReqState object for this invocation of the servlet.
      Returns:
      An open DataInputStream from which the DDX can be read.
      See Also:
      • ReqState
    • openCachedDDS

      public DataInputStream openCachedDDS(opendap.servlet.ReqState rs)
      ************************************************************************ Opens a DDS cached on local disk. This can be used on OPeNDAP servers (such as the OPeNDAP SQL Server) that rely on locally cached DDS files as opposed to dynamically generated DDS's.

      This method uses the ServletConfig object cached by in the ReqState object to locate the servlet init parameter DDScache to determine where to look for the cached DDS. If the init parameter was not set then the ReqState.defaultDDScache variable is used as the location of the DDS cache.

      If the DDS cannot be found an error is sent back to the client.

      Parameters:
      rs - The ReqState object for this invocation of the servlet.
      Returns:
      An open DataInputStream from which the DDS can be read.
      See Also:
      • ReqState
    • getDAS

      public opendap.dap.DAS getDAS() throws opendap.dap.DAP2Exception, opendap.dap.parsers.ParseException
      ************************************************************************

      In this (default) implementation of the getDAS() method a locally cached DAS is retrieved and parsed. In this method the DAS for the passed dataset is loaded from the "DAScache" <init-param> in the web.xml file. If the there is no file available a DAP2Exception is thrown. It is certainly possible (and possibly very desirable) to override this method when overriding the getDDS() method. One reason for doing this is if the OPeNDAP server being implemented can generate the DAS information dynamically.

      When overriding this method be sure that it does the following:

      • Instantiates the DAS for the indicated (passed) dataset and populates it. This is accomplished in the default implementation by opening a (cached?) DAS stored in a file and parsing it. In a different implementation it could be created dynamically.
      • Returns this freshly minted DAS object. (to the servlet code where it is used.)
      Specified by:
      getDAS in interface opendap.servlet.GuardedDataset
      Returns:
      The DAS object for the data set specified in the parameter dataSet
      Throws:
      opendap.dap.DAP2Exception
      opendap.dap.parsers.ParseException
      See Also:
      • DAS
    • openCachedDAS

      public DataInputStream openCachedDAS(opendap.servlet.ReqState rs) throws FileNotFoundException
      ************************************************************************ Opens a DAS cached on local disk. This can be used on OPeNDAP servers (such as the OPeNDAP SQL Server) that rely on locally cached DAS files as opposed to dynamically generated DAS's.

      This method uses the ServletConfig object cached by in the ReqState object to locate the servlet init parameter DAScache to determine where to look for the cached DAS. If the init parameter was not set then the ReqState.defaultDAScache variable is used as the location of the DAS cache.

      If the DAS cannot be found an error is sent back to the client.

      Parameters:
      rs - The ReqState object for this invocation of the servlet.
      Returns:
      An open DataInputStream from which the DAS can be read.
      Throws:
      FileNotFoundException
      See Also:
      • ReqState