Omaha #3185 python newDataRequest() now supports
optional/default/keyword args Change-Id: Iaab83d9915899d96114c078fb82c99be3b59e0dc Former-commit-id:bab319cf15
[formerly88aa123a5a
] [formerlybab319cf15
[formerly88aa123a5a
] [formerlye1291395b0
[formerly 66804918e06afc9616fcfe0f0a12afd75a8143e1]]] Former-commit-id:e1291395b0
Former-commit-id:8299c6c46e
[formerlye04dff7fa7
] Former-commit-id:8f20278430
This commit is contained in:
parent
397d61cdce
commit
3453fda1a0
6 changed files with 161 additions and 7 deletions
|
@ -5,6 +5,11 @@
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.python.pydev.PyDevBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
|
@ -24,5 +29,6 @@
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.python.pydev.pythonNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
5
edexOsgi/com.raytheon.uf.edex.dataaccess/.pydevproject
Normal file
5
edexOsgi/com.raytheon.uf.edex.dataaccess/.pydevproject
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||||
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||||
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||||
|
</pydev_project>
|
|
@ -33,6 +33,7 @@
|
||||||
# 02/14/13 1614 bsteffen refactor data access framework
|
# 02/14/13 1614 bsteffen refactor data access framework
|
||||||
# to use single request.
|
# to use single request.
|
||||||
# 03/03/14 2673 bsteffen Add ability to query only ref times.
|
# 03/03/14 2673 bsteffen Add ability to query only ref times.
|
||||||
|
# 07/22/14 3185 njensen Added optional/default args to newDataRequest
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -91,6 +92,41 @@ def getGeometryData(request, times):
|
||||||
def getAvailableLocationNames(request):
|
def getAvailableLocationNames(request):
|
||||||
return JavaDataAccessLayer.getAvailableLocationNames(request.toJavaObj())
|
return JavaDataAccessLayer.getAvailableLocationNames(request.toJavaObj())
|
||||||
|
|
||||||
def newDataRequest():
|
def getAvailableParameters(request):
|
||||||
return JDataRequest.JDataRequest(DefaultDataRequest())
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getAvailableLevels(request):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getRequiredIdentifiers(datatype):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getValidIdentifiers(datatype):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def newDataRequest(datatype, parameters=[], levels=[], locationNames = [], envelope=None, **kwargs):
|
||||||
|
req = JDataRequest.JDataRequest(DefaultDataRequest())
|
||||||
|
if datatype:
|
||||||
|
req.setDatatype(datatype)
|
||||||
|
if parameters:
|
||||||
|
req.setParameters(*parameters)
|
||||||
|
if levels:
|
||||||
|
req.setLevels(*levels)
|
||||||
|
if locationNames:
|
||||||
|
req.setLocationNames(*locationNames)
|
||||||
|
if envelope:
|
||||||
|
req.setEnvelope(envelope)
|
||||||
|
if kwargs:
|
||||||
|
# any args leftover are assumed to be identifiers
|
||||||
|
for key in kwargs:
|
||||||
|
req.addIdentifier(key, kwargs[key])
|
||||||
|
return req
|
||||||
|
|
||||||
|
def getSupportedDatatypes():
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
# 04/10/13 1871 mnash move getLatLonCoords to JGridData and add default args
|
# 04/10/13 1871 mnash move getLatLonCoords to JGridData and add default args
|
||||||
# 05/29/13 2023 dgilling Hook up ThriftClientRouter.
|
# 05/29/13 2023 dgilling Hook up ThriftClientRouter.
|
||||||
# 03/03/14 2673 bsteffen Add ability to query only ref times.
|
# 03/03/14 2673 bsteffen Add ability to query only ref times.
|
||||||
|
# 07/22/14 3185 njensen Added optional/default args to newDataRequest
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -115,14 +116,85 @@ def getAvailableLocationNames(request):
|
||||||
"""
|
"""
|
||||||
return router.getAvailableLocationNames(request)
|
return router.getAvailableLocationNames(request)
|
||||||
|
|
||||||
def newDataRequest():
|
def getAvailableParameters(request):
|
||||||
|
"""
|
||||||
|
Gets the available parameters names that match the request without actually
|
||||||
|
requesting the data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request: the request to find matching parameter names for
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a list of strings of available parameter names.
|
||||||
|
"""
|
||||||
|
return router.getAvailableParameters(request)
|
||||||
|
|
||||||
|
def getAvailableLevels(request):
|
||||||
|
"""
|
||||||
|
Gets the available levels that match the request without actually
|
||||||
|
requesting the data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request: the request to find matching levels for
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a list of strings of available levels.
|
||||||
|
"""
|
||||||
|
return router.getAvailableLevels(request)
|
||||||
|
|
||||||
|
def getRequiredIdentifiers(datatype):
|
||||||
|
"""
|
||||||
|
Gets the required identifiers for this datatype. These identifiers
|
||||||
|
must be set on a request for the request of this datatype to succeed.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
datatype: the datatype to find required identifiers for
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a list of strings of required identifiers
|
||||||
|
"""
|
||||||
|
return router.getRequiredIdentifiers(datatype)
|
||||||
|
|
||||||
|
def getValidIdentifiers(datatype):
|
||||||
|
"""
|
||||||
|
Gets the valid identifiers for this datatype.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
datatype: the datatype to find valid identifiers for
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a list of strings of valid identifiers
|
||||||
|
"""
|
||||||
|
return router.getRequiredIdentifiers(datatype)
|
||||||
|
|
||||||
|
def newDataRequest(datatype=None, **kwargs):
|
||||||
""""
|
""""
|
||||||
Creates a new instance of IDataRequest suitable for the runtime environment.
|
Creates a new instance of IDataRequest suitable for the runtime environment.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
|
||||||
|
Args:
|
||||||
|
datatype: the datatype to create a request for
|
||||||
|
parameters: a list of parameters to set on the request
|
||||||
|
levels: a list of levels to set on the request
|
||||||
|
locationNames: a list of locationNames to set on the request
|
||||||
|
envelope: an envelope to limit the request
|
||||||
|
**kwargs: any leftover kwargs will be set as identifiers
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
a new IDataRequest
|
a new IDataRequest
|
||||||
"""
|
"""
|
||||||
return router.newDataRequest()
|
return router.newDataRequest(datatype, **kwargs)
|
||||||
|
|
||||||
|
def getSupportedDatatypes():
|
||||||
|
"""
|
||||||
|
Gets the datatypes that are supported by the framework
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a list of strings of supported datatypes
|
||||||
|
"""
|
||||||
|
return router.getSupportedDatatypes()
|
||||||
|
|
||||||
|
|
||||||
def changeEDEXHost(newHostName):
|
def changeEDEXHost(newHostName):
|
||||||
""""
|
""""
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
# 05/21/13 #2023 dgilling Initial Creation.
|
# 05/21/13 #2023 dgilling Initial Creation.
|
||||||
# 01/06/14 #2537 bsteffen Share geometry WKT.
|
# 01/06/14 #2537 bsteffen Share geometry WKT.
|
||||||
# 03/03/14 #2673 bsteffen Add ability to query only ref times.
|
# 03/03/14 #2673 bsteffen Add ability to query only ref times.
|
||||||
|
# 07/22/14 3185 njensen Added optional/default args to newDataRequest
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,5 +119,39 @@ class ThriftClientRouter(object):
|
||||||
response = self._client.sendRequest(locNamesRequest)
|
response = self._client.sendRequest(locNamesRequest)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def newDataRequest(self):
|
def getAvailableParameters(self, request):
|
||||||
return DefaultDataRequest()
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getAvailableLevels(self, request):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getRequiredIdentifiers(self, datatype):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def getValidIdentifiers(self, datatype):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
||||||
|
def newDataRequest(self, datatype, parameters=[], levels=[], locationNames = [], envelope=None, **kwargs):
|
||||||
|
req = DefaultDataRequest()
|
||||||
|
if datatype:
|
||||||
|
req.setDatatype(datatype)
|
||||||
|
if parameters:
|
||||||
|
req.setParameters(*parameters)
|
||||||
|
if levels:
|
||||||
|
req.setLevels(*levels)
|
||||||
|
if locationNames:
|
||||||
|
req.setLocationNames(*locationNames)
|
||||||
|
if envelope:
|
||||||
|
req.setEnvelope(envelope)
|
||||||
|
if kwargs:
|
||||||
|
# any args leftover are assumed to be identifiers
|
||||||
|
req.identifiers = kwargs
|
||||||
|
return req
|
||||||
|
|
||||||
|
def getSupportedDatatypes(self):
|
||||||
|
# TODO
|
||||||
|
raise Exception('Not implemented yet')
|
||||||
|
|
|
@ -86,7 +86,7 @@ class IDataRequest(object):
|
||||||
Sets the levels of data to request. Not all datatypes support levels.
|
Sets the levels of data to request. Not all datatypes support levels.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
levels: a list of strings of level abbreviations to request
|
levels: a list of strings of level abbreviations to request
|
||||||
"""
|
"""
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue