opendap.servers.test
Class testDataset

java.lang.Object
  extended by opendap.servers.test.testDataset
All Implemented Interfaces:
GuardedDataset

public class testDataset
extends java.lang.Object
implements 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.

Version:
$Revision: 23881 $
Author:
Nathan David Potter

Method Summary
 DAS getDAS()
          ************************************************************************

In this (default) implementation of the getDAS() method a locally cached DAS is retrieved and parsed.

 ServerDDS getDDS()
          ************************************************************************ For the test server this method does the following: Makes a new test_ServerFactory (aka BaseTypeFactory) for the dataset requested.
 java.io.DataInputStream openCachedDAS(ReqState rs)
          ************************************************************************ Opens a DAS cached on local disk.
 java.io.DataInputStream openCachedDDS(ReqState rs)
          ************************************************************************ Opens a DDS cached on local disk.
 java.io.DataInputStream openCachedDDX(ReqState rs)
          ************************************************************************ Opens a DDX cached on local disk.
 void release()
          Release the lock, if any, on this dataset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

release

public void release()
Description copied from interface: GuardedDataset
Release the lock, if any, on this dataset.

Specified by:
release in interface GuardedDataset

getDDS

public ServerDDS getDDS()
                 throws DAP2Exception,
                        ParseException
************************************************************************ For the test server this method does the following:

Specified by:
getDDS in interface GuardedDataset
Returns:
The ServerDDS for the named data set.
Throws:
DAP2Exception
ParseException
See Also:
ServerDDS, test_ServerFactory

openCachedDDX

public java.io.DataInputStream openCachedDDX(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 java.io.DataInputStream openCachedDDS(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 DAS getDAS()
           throws DAP2Exception,
                  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:

Specified by:
getDAS in interface GuardedDataset
Returns:
The DAS object for the data set specified in the parameter dataSet
Throws:
DAP2Exception
ParseException
See Also:
DAS

openCachedDAS

public java.io.DataInputStream openCachedDAS(ReqState rs)
                                      throws java.io.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:
java.io.FileNotFoundException
See Also:
ReqState