dxWebServiceInterface
index
/usr/local/dx-0.1.1/dxWebServiceInterface.py

dxWebServiceInterface.py
========================
 
A web service wrapper around the entire DataExtractor.
 
Wraps the dx functionality into the following Web Services:
 
callControlExtractClass(args)
 
startSession(username=None, password=None, secureToken=None)
 
getOptions(sessionID, secureToken=None)
 
selectOptions(sessionID, opt_1, opt_2, ...,opt_n, secureToken=None)
 
numberOfDatasets(sessionID, n, secureToken=None)
 
summariseRequest(sessionID, secureToken=None)
 
isComplete(sessionID, secureToken=None)
 
getDataSubsetSpecifier(sessionID, secureToken=None)  # This returns XML
 
getExtractionCosts(sessionID, secureToken=None)
 
extractData(sessionID, secureToken=None)  # This extracts actual data
 
newRequest(sessionID, secureToken=None)
 
 
Notes about the sessionID and secureToken object
------------------------------------------------
 
The sessionID carries information about the current request but has no security
implications. It is simply a way for the server to keep track of the request 
between calls.
 
The secureToken is an encoded security object that is time limited and provides
information on what the user is allowed to access on the server. Some dx servers
do not run security and so just send around a None type as the secureToken. Those
implementing security will require that the secureToken (held in a string) is sent
with each call to the dx. During each call it will updated (to ensure it remains 
time valid) and returned.
 
 
 
############# THE FOLLOWING MIGHT BE IMPLEMENTED IN FUTURE #############
getDatasetGroupOptions(sessionID, secureToken=None)
 
selectDatasetGroups(sessionID, datasetGroup_1, datasetGroup_2, ..., datasetGroup_n, secureToken=None)
 
getDatasetOptions(sessionID, secureToken=None)
 
selectDatasets(sessionID, dataset_1, dataset_2, ..., dataset_n, secureToken=None)
 
getVariableOptions(sessionID, secureToken=None)
 
selectVariables(sessionID, variable_1, variable_2, ..., variable_n, secureToken=None)
 
getHorizontalDomainOptions(sessionID, secureToken=None)
 
selectHorizontalDomain(sessionID, northernExtent, westernExtent,
       easternExtent, southernExtent, secureToken=None)
       
getVerticalDomainOptions(sessionID, secureToken=None)
 
selectVerticalDomain(sessionID, verticalDomain_1, verticalDomain_2, ..., 
                        verticalDomain_n, secureToken=None)
                        
getTemporalDomainOptions(sessionID, secureToken=None)
 
selectTemporalDomainOptions(sessionID, startTime_1, endTime_1, startTime_2, endTime_2,
                                ..., startTime_n, endTime_n, secureToken=None)
                # Note that times are expressed as: "YYYY-MM-DD hh:mm:ss" or minimally as "YYYY"
                # which convert to "YYYY-01-01 00:00:00".
                
getOutputFormatOptions(sessionID, secureToken=None)
 
selectOutputFormat(sessionID, outputFormat, secureToken=None)

 
Modules
       
cgi
commands
dx.common
dx.config
dx.datasetdb
dx.dxdmlHandler
dxrmlHandler
dx.errorHandler
dx.extractMetadata
dx.localRules
dx.mailUser
dx.optionHandler
os
dx.products
re
dx.request
dx.requestCost
dx.requestDict
dx.security
smtplib
string
sys
time
dx.times
types
urllib
dx.validate

 
Functions
       
callControlExtractClass(**args)
Function wrapper to ControlExtract class. This can be called directly
to perform all operations or the other Web Services can be called in
the appropriate order.
extractData(sessionID, secureToken=None)
Extracts the actual data you specified in the request. It writes these files
locally and returns a list of paths to the data as either FTP or HTTP 
locations. 
Returns a list of paths and a security token.
getDataSubsetSpecifier(sessionID, secureToken=None)
Returns the dataSubsetSpecifier XML document (which might be S-metadata)
required by a Delivery Service to describe the subset requested, and a
security token.
getExtractionCosts(sessionID, secureToken=None)
Returns an estimated duration for the creation of the output data and the 
estimated volume of the output.
getOptions(sessionID, secureToken=None, optionCategoryRequested=None)
Returns a category description of the next set of options (or the option category 
requested by the user), a list of options based 
on what the user has yet to request, a string explaining some more about this and a
security token.
 
The options will be presented following the heirarchy:
    DatasetGroups
    Datasets
    Variables
    HorizontalDomain
    VerticalDomain
    TemporalDomain
    OutputFormat
isComplete(sessionID, secureToken=None)
Returns 1 if the request is complete (i.e. ready for extraction)
and 0 if not. Also returns a security token.
newRequest(sessionID, secureToken=None)
Deletes content of current request.
Returns the sessionID and the security token..
numberOfDatasets(sessionID, n, secureToken=None)
Re-selects the number of datasets the user wants to deal with in the request.
Default is 1.
Returns 1 if successful and an errorString if not, as well as a security token.
selectOptions(sessionID, **args)
Makes a selection based on user requirements. This will typically follow a call
to getOptions() to find out what the options are.
Returns a call to getOptions() to grab the next set of options available to the 
user. Alternatively, if it fails, an errorString is returned.
serveAll()
Serves all functions via Web Services.
startSession(username=None, password=None, secureToken=None)
Logs a user into the dx and supplies them with a session ID as well
as an encoded security token. The session ID connects them to their
current request serverside whilst the security token is used to 
authorise their access.
summariseRequest(sessionID, secureToken=None)
Returns a listing of the current request in a string and a security token.
uploadRequest(sessionID, requestXMLString, secureToken=None)
Allows the user to send a request in the form of a string containing the 
contents of an XML file conforming to the dx request specification (not
yet written). This is also called a Data Subset Specifier.
This function parses the XML into a dictionary and then uploads the arguments.
Returns a status flag (1=success, None=failure) and the secure token.

 
Data
        ADMIN_MAIL_ADDRESS = 'yourmail@yourhost'
ADMIN_NOTIFICATION = 0
BASEDIR = '/usr/local/dx'
CDAT_BIN_PATH = '/usr/local/cdat/bin'
CF_METADATA_GLOBAL_ATTRIBUTES = {'comments': 'Created by test data extractor.'}
CF_METADATA_GLOBAL_ATTRIBUTE_KEYS = ['Conventions', 'title', 'source', 'institution', 'history', 'references', 'comment']
CGI_NAME = 'http://localhost/cgi-bin/dxui.py'
CONFIRMATION_PAGE = 1
DEBUG = 1
DOMAIN_PARAMS = ('start_time', 'end_time', 'time_interval', 'horiz_domain', 'resolution', 'vertical_units', 'vertical_domain', 'outputFormat')
EXTRAS_DIR = '/dx_extra'
HORIZ_KEYS = ['northernExtent', 'easternExtent', 'southernExtent', 'westernExtent']
HTML_DIR = '/usr/local/dx/html'
HTTP_HEADER = 'Content-Type: text/html\n\n'
HTTP_OUTPUT_DIR = 'http://localhost/output'
HTTP_REQUEST_XML_DIR = 'http://localhost/request_xmls'
INPUT_DATASETS_FILE = '/usr/local/dx/datasets/inputDatasets.xml'
LEFT_LOGO = 'dx_logo.jpg'
LOCAL_CGI_NAME = '/srv/www/cgi-bin/cgiInterface.py'
LOCAL_MAIL_HOST = 'youroutbox.yourdomain'
LOCAL_PYTHONPATH = ['YOUR_CDAT/lib/python2.4', 'YOUR_CDAT/lib/python2.4/site-packages', 'YOUR_CDAT/cdat/lib/python2.4/site-packages/Numeric', 'YOUR_CDAT/lib/python2.3', 'YOUR_CDAT/lib/python2.3/site-packages', 'YOUR_CDAT/cdat/lib/python2.3/site-packages/Numeric']
LOCAL_RULES = 0
LOGO_DIR = '/dx_extra/logos'
MAP_APPLET = '/dx_extra/LiveMap_30/extractorMap.html'
MAX_FILE_SIZE = 1
MAX_NUM_DATASETS = 2
MESSAGE_TO_USERS = 'This is a test version of the Data Extractor so ...error occurs so that we can improve this service.'
NAPPY_PATH = '/usr/local/nappy'
OUTPUT_DIR = '/srv/www/htdocs/output'
OUTPUT_DIR_PERMISSION = 493
OUTPUT_FILE_GROUP = 'users'
OUTPUT_FILE_PERMISSION = 420
OUTPUT_FILE_USER = 'wwwrun'
OUTPUT_FORMATS = ['NetCDF', 'NASA Ames']
PACKAGE_NAME = 'Data Extractor'
PROCESS_LIST_DIR = '/usr/local/dx/processes'
REGISTRATION_PAGE = 'http://yourhost/your_link.html'
REQUEST_DIR = '/usr/local/dx/requests'
REQUEST_SIZE_LIMIT = 100
REQUEST_XML_DIR = '/srv/www/htdocs/request_xmls'
RESTRICTED_DATA = 0
RIGHT_LOGO = 'dx_logo.jpg'
STAGES = ['DatasetGroupPage', 'DatasetPage', 'VariablesPage', 'DomainPage', 'ResultsPage']
TIME_KEYS = ['Year', 'Month', 'Day', 'Hour', 'Minute', 'Second']
TIMING_SCALE_FACTOR = 1.0000000000000001e-05
TOP_LEVEL = 'datasetGroup'
USER_HOMEDIR = '/var/lib/wwwrun'
VISUALISOR_NAME = '/cgi-bin/splatui-0.1.1.py'
helpMessage = '\n\ntimes.py\n========\n\nHolds the class DateTime th...00:00:00", "1999-01-22 12:00:00", (6, "hour"))\n\n\n'
path = 'YOUR_CDAT/cdat/lib/python2.3/site-packages/Numeric'
sessionID = None
timePattern = <_sre.SRE_Pattern object>