OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
agg_util::DDSLoader Class Reference

#include <DDSLoader.h>

Collaboration diagram for agg_util::DDSLoader:
Collaboration graph

Public Types

enum  ResponseType { eRT_RequestDDX = 0, eRT_RequestDataDDS, eRT_Num }
 For telling the loader what type of BESDapResponse to load and return. More...
 

Public Member Functions

void cleanup () throw ()
 restore dhi to clean state More...
 
 DDSLoader (BESDataHandlerInterface &dhi)
 Create a loader that will hijack dhi on a load call, then restore it's state. More...
 
 DDSLoader (const DDSLoader &proto)
 
BESDataHandlerInterfacegetDHI () const
 Return a reference to the dhi we are using. More...
 
std::auto_ptr< BESDapResponseload (const std::string &location, ResponseType type)
 Load and return a new DDX or DataDDS structure for the local dataset referred to by location. More...
 
void loadInto (const std::string &location, ResponseType type, BESDapResponse *pResponse)
 Load a DDX or DataDDS response into the given pResponse object, which must be non-null. More...
 
DDSLoaderoperator= (const DDSLoader &)
 
virtual ~DDSLoader ()
 Dtor restores the state of dhi Restores the state of the dhi to what it was when object if it is still hijacked (i.e. More...
 

Static Public Member Functions

static bool checkResponseIsValidType (ResponseType type, BESDapResponse *pResponse)
 Return whether the given response's type matches the given ResposneType. More...
 
static std::string getActionForType (ResponseType type)
 Convert the type into the action in BESResponseNames.h for the type. More...
 
static std::string getActionNameForType (ResponseType type)
 Convert the type in the action name in BESResponseNames.h. More...
 
static std::auto_ptr< BESDapResponsemakeResponseForType (ResponseType type)
 Make a new response object for the requested type. More...
 

Detailed Description

Definition at line 64 of file DDSLoader.h.

Member Enumeration Documentation

For telling the loader what type of BESDapResponse to load and return.

It can handle a DDX load or a DataDDS load. The returned BesDapResponse will be of the proper subclass.

Enumerator
eRT_RequestDDX 
eRT_RequestDataDDS 
eRT_Num 

Definition at line 97 of file DDSLoader.h.

Constructor & Destructor Documentation

DDSLoader::DDSLoader ( BESDataHandlerInterface dhi)

Create a loader that will hijack dhi on a load call, then restore it's state.

Parameters
dhiDHI to hijack during load, needs to be a valid object for the scope of this object's life.

Definition at line 65 of file DDSLoader.cc.

DDSLoader::DDSLoader ( const DDSLoader proto)

Definition at line 72 of file DDSLoader.cc.

DDSLoader::~DDSLoader ( )
virtual

Dtor restores the state of dhi Restores the state of the dhi to what it was when object if it is still hijacked (i.e.

exception on load()) Destroys the BESDDSResponse if non-null, which is also the case on failed load() call.

Definition at line 127 of file DDSLoader.cc.

Member Function Documentation

bool DDSLoader::checkResponseIsValidType ( ResponseType  type,
BESDapResponse pResponse 
)
static

Return whether the given response's type matches the given ResposneType.

If type==eRT_RequestDDX, pResponse must be BESDDSResponse If type==eRT_RequeastDataDDS, pResponse must be BESDataDDSResponse

Definition at line 373 of file DDSLoader.cc.

References eRT_RequestDataDDS, and eRT_RequestDDX.

void DDSLoader::cleanup ( )
throw (
)

restore dhi to clean state

Ensures that the resources and dhi are all in the state they were at construction time. Probably not needed by users, but in case they want to catch an exception and then retry or something

Definition at line 209 of file DDSLoader.cc.

std::string DDSLoader::getActionForType ( ResponseType  type)
static

Convert the type into the action in BESResponseNames.h for the type.

Parameters
typethe response type
Returns
either DDX_RESPONSE or DATA_RESPONSE

Definition at line 349 of file DDSLoader.cc.

References DATA_RESPONSE, DDS_RESPONSE, eRT_RequestDataDDS, eRT_RequestDDX, and THROW_NCML_INTERNAL_ERROR.

Referenced by loadInto().

std::string DDSLoader::getActionNameForType ( ResponseType  type)
static

Convert the type in the action name in BESResponseNames.h.

Parameters
typethe response type
Returns
either DDX_RESPONSE_STR or DATA_RESPONSE_STR

Definition at line 361 of file DDSLoader.cc.

References DATA_RESPONSE_STR, DDX_RESPONSE_STR, eRT_RequestDataDDS, eRT_RequestDDX, and THROW_NCML_INTERNAL_ERROR.

Referenced by loadInto().

BESDataHandlerInterface& agg_util::DDSLoader::getDHI ( ) const
inline

Return a reference to the dhi we are using.

A little dangerous to bare this rep, so be careful in its usage!

Returns

Definition at line 121 of file DDSLoader.h.

auto_ptr< BESDapResponse > DDSLoader::load ( const std::string &  location,
ResponseType  type 
)

Load and return a new DDX or DataDDS structure for the local dataset referred to by location.

Ownership of the response object passes to the caller via auto_ptr.

On exception, the dhi will be restored when this is destructed, or the user call directly call cleanup() to ensure this if they catch the exception and need the dhi restored immediately.

Parameters
locationthe filename of the local file
typewhether to load DDX or DataDDS.
Returns
a response object containing the new loaded response object. It will be either a BESDDSResponse or BESDataDDSResponse depending on type.
Exceptions
ifthe underlying location cannot be loaded.

Definition at line 132 of file DDSLoader.cc.

References loadInto(), and makeResponseForType().

Here is the call graph for this function:

void DDSLoader::loadInto ( const std::string &  location,
ResponseType  type,
BESDapResponse pResponse 
)

Load a DDX or DataDDS response into the given pResponse object, which must be non-null.

Similar to load(), but the caller passes in the response object to fill rather than wanting a new one.

If type == eRT_RequestDDX, pResponse MUST have type BESDDSReponse. If type == eRT_RequestDataDDS, pResponse MUST have type BESDataDDSResponse.

The location is loaded in pResponse based on the type of response requested.

Parameters
locationthe file to load
typethe response type requested, must match type of pResponse
pResponsethe response object to fill in, which must match the request type.
See also
load()
Exceptions
Ifthere is a problem loading the location.

Definition at line 141 of file DDSLoader.cc.

References BESDataHandlerInterface::action, BESDataHandlerInterface::action_name, BESDEBUG, BESDataHandlerInterface::container, BESRequestHandlerList::execute_current(), BESDapResponse::get_dap_client_protocol(), BESError::get_file(), BESError::get_line(), BESError::get_message(), BESDapResponse::get_request_xml_base(), getActionForType(), getActionNameForType(), ncml_module::NCMLUtil::getDDSFromEitherResponse(), BESDataHandlerInterface::response_handler, BESResponseHandler::set_response_object(), BESRequestHandlerList::TheList(), THROW_NCML_INTERNAL_ERROR, and VALID_PTR.

Referenced by load().

Here is the call graph for this function:

std::auto_ptr< BESDapResponse > DDSLoader::makeResponseForType ( ResponseType  type)
static

Make a new response object for the requested type.

Definition at line 333 of file DDSLoader.cc.

References eRT_RequestDataDDS, eRT_RequestDDX, and THROW_NCML_INTERNAL_ERROR.

Referenced by ncml_module::NetcdfElement::createResponseObject(), and load().

DDSLoader & DDSLoader::operator= ( const DDSLoader rhs)

Definition at line 79 of file DDSLoader.cc.

References BESDEBUG, and BESDataHandlerInterface::make_copy().

Here is the call graph for this function:


The documentation for this class was generated from the following files: