diff --git a/dynamicserialize/SelfDescribingBinaryProtocol.py b/dynamicserialize/SelfDescribingBinaryProtocol.py index 0dd6db1..138cf04 100644 --- a/dynamicserialize/SelfDescribingBinaryProtocol.py +++ b/dynamicserialize/SelfDescribingBinaryProtocol.py @@ -1,19 +1,19 @@ ## # This software was developed and / or modified by Raytheon Company, -# pursuant to Contract DG133W-05-CQ-1067 with the US Government. -# -# U.S. EXPORT CONTROLLED TECHNICAL DATA +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to non-U.S. persons whether in the United States or abroad requires # an export license or other authorization. # -# Contractor Name: Raytheon Company -# Contractor Address: 6825 Pine Street, Suite 340 -# Mail Stop B8 -# Omaha, NE 68106 -# 402.291.0100 -# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## @@ -39,6 +39,7 @@ from struct import pack, unpack # ------------ ---------- ----------- -------------------------- # 11/11/09 chammack Initial Creation. # 06/09/10 njensen Added float, list methods +# Apr 24, 2015 4425 nabowle Add F64List support. # # # @@ -52,6 +53,7 @@ floatList = numpy.dtype(numpy.float32).newbyteorder('>') longList = numpy.dtype(numpy.int64).newbyteorder('>') shortList = numpy.dtype(numpy.int16).newbyteorder('>') byteList = numpy.dtype(numpy.int8).newbyteorder('>') +doubleList = numpy.dtype(numpy.float64).newbyteorder('>') class SelfDescribingBinaryProtocol(TBinaryProtocol): @@ -95,6 +97,11 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol): val = numpy.frombuffer(buff, dtype=floatList, count=sz) return val + def readF64List(self, sz): + buff = self.trans.readAll(8*sz) + val = numpy.frombuffer(buff, dtype=doubleList, count=sz) + return val + def readI64List(self, sz): buff = self.trans.readAll(8*sz) val = numpy.frombuffer(buff, dtype=longList, count=sz) @@ -118,6 +125,10 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol): b = numpy.asarray(buff, floatList) self.trans.write(numpy.getbuffer(b)) + def writeF64List(self, buff): + b = numpy.asarray(buff, doubleList) + self.trans.write(numpy.getbuffer(b)) + def writeI64List(self, buff): b = numpy.asarray(buff, longList) self.trans.write(numpy.getbuffer(b)) @@ -129,4 +140,3 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol): def writeI8List(self, buff): b = numpy.asarray(buff, byteList) self.trans.write(numpy.getbuffer(b)) - diff --git a/dynamicserialize/ThriftSerializationContext.py b/dynamicserialize/ThriftSerializationContext.py index 89d6127..e7a69d4 100644 --- a/dynamicserialize/ThriftSerializationContext.py +++ b/dynamicserialize/ThriftSerializationContext.py @@ -36,7 +36,7 @@ # 06/09/10 njensen Initial Creation. # 06/12/13 #2099 dgilling Implement readObject() and # writeObject(). -# 03/18/16 mjames@ucar Add types.UnicodeType +# Apr 24, 2015 4425 nabowle Add Double support # # @@ -66,7 +66,6 @@ buildObjMap(dstypes) pythonToThriftMap = { types.StringType: TType.STRING, - types.UnicodeType: TType.STRING, types.IntType: TType.I32, types.LongType: TType.I64, types.ListType: TType.LIST, @@ -88,7 +87,7 @@ pythonToThriftMap = { numpy.int64: TType.I64 } -primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64, SelfDescribingBinaryProtocol.FLOAT) +primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64, SelfDescribingBinaryProtocol.FLOAT, TType.DOUBLE) class ThriftSerializationContext(object): @@ -130,14 +129,16 @@ class ThriftSerializationContext(object): TType.I16: self.protocol.readI16List, TType.I32: self.protocol.readI32List, TType.I64: self.protocol.readI64List, - SelfDescribingBinaryProtocol.FLOAT: self.protocol.readF32List + SelfDescribingBinaryProtocol.FLOAT: self.protocol.readF32List, + TType.DOUBLE: self.protocol.readF64List } self.listSerializationMethod = { TType.BYTE: self.protocol.writeI8List, TType.I16: self.protocol.writeI16List, TType.I32: self.protocol.writeI32List, TType.I64: self.protocol.writeI64List, - SelfDescribingBinaryProtocol.FLOAT: self.protocol.writeF32List + SelfDescribingBinaryProtocol.FLOAT: self.protocol.writeF32List, + TType.DOUBLE: self.protocol.writeF64List } @@ -239,7 +240,7 @@ class ThriftSerializationContext(object): return result def _lookupType(self, obj): - pyt = type(obj) # for h5py 2.0+ + pyt = type(obj) if pythonToThriftMap.has_key(pyt): return pythonToThriftMap[pyt] elif pyt.__module__.startswith('dynamicserialize.dstypes'): diff --git a/dynamicserialize/adapters/JobProgressAdapter.py b/dynamicserialize/adapters/JobProgressAdapter.py new file mode 100644 index 0000000..92cb2fa --- /dev/null +++ b/dynamicserialize/adapters/JobProgressAdapter.py @@ -0,0 +1,51 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + + +# +# Adapter for com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation +# +# +# + +from thrift.Thrift import TType +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.svcbu import JobProgress + +ClassAdapter = 'com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress' + +def serialize(context, mode): + context.protocol.writeFieldBegin('__enumValue__', TType.STRING, 0) + context.writeString(mode.value) + +def deserialize(context): + result = JobProgress() + # Read the TType.STRING, "__enumValue__", and id. + # We're not interested in any of those, so just discard them. + context.protocol.readFieldBegin() + # now get the actual enum value + result.value = context.readString() + return result diff --git a/dynamicserialize/adapters/__init__.py b/dynamicserialize/adapters/__init__.py index 2571c61..26cbdcd 100644 --- a/dynamicserialize/adapters/__init__.py +++ b/dynamicserialize/adapters/__init__.py @@ -31,7 +31,7 @@ # 03/20/13 #1774 randerso Added TimeConstraintsAdapter # 04/22/13 #1949 rjpeter Added LockTableAdapter # 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter - +# 06/22/2015 #4573 randerso Added JobProgressAdapter # # @@ -56,8 +56,8 @@ __all__ = [ 'ByteBufferAdapter', 'TimeConstraintsAdapter', 'LockTableAdapter', - 'JTSEnvelopeAdapter' -# 'GridDataHistoryAdapter', + 'JTSEnvelopeAdapter', + 'JobProgressAdapter', ] classAdapterRegistry = {} @@ -80,5 +80,6 @@ def getAdapterRegistry(): raise LookupError('Adapter class ' + x + ' has no ClassAdapter field ' + \ 'and cannot be registered.') + getAdapterRegistry() diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py index 00e1f2c..be1116a 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py @@ -27,6 +27,7 @@ # ------------ ---------- ----------- -------------------------- # 06/04/13 #2023 dgilling Initial Creation. # 01/06/14 #2537 bsteffen Store geometry index instead of WKT. +# 06/30/15 #4569 nabowle Rename *WKT* to *WKB*. # # @@ -38,7 +39,7 @@ class GeometryResponseData(AbstractResponseData): def __init__(self): super(GeometryResponseData, self).__init__() self.dataMap = None - self.geometryWKTindex = None + self.geometryWKBindex = None def getDataMap(self): return self.dataMap @@ -46,8 +47,8 @@ class GeometryResponseData(AbstractResponseData): def setDataMap(self, dataMap): self.dataMap = dataMap - def getGeometryWKTindex(self): - return self.geometryWKTindex + def getGeometryWKBindex(self): + return self.geometryWKBindex - def setGeometryWKTindex(self, geometryWKTindex): - self.geometryWKTindex = geometryWKTindex + def setGeometryWKBindex(self, geometryWKBindex): + self.geometryWKBindex = geometryWKBindex diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py index 1635448..58bd259 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py @@ -23,14 +23,14 @@ class GetGeometryDataResponse(object): def __init__(self): - self.geometryWKTs = None + self.geometryWKBs = None self.geoData = None - def getGeometryWKTs(self): - return self.geometryWKTs + def getGeometryWKBs(self): + return self.geometryWKBs - def setGeometryWKTs(self, geometryWKTs): - self.geometryWKTs = geometryWKTs + def setGeometryWKBs(self, geometryWKBs): + self.geometryWKBs = geometryWKBs def getGeoData(self): return self.geoData diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/__init__.py index 11b9824..3cce4f9 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/__init__.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/__init__.py @@ -17,8 +17,14 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## - -# File auto-generated by PythonFileGenerator +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Added svcbu package +# +## __all__ = [ 'GridDataHistory', @@ -29,6 +35,7 @@ __all__ = [ 'request', 'server', 'slice', + 'svcbu', 'weather' ] diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ExecuteIfpNetCDFGridRequest.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ExecuteIfpNetCDFGridRequest.py index 4de8315..0fc1919 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ExecuteIfpNetCDFGridRequest.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ExecuteIfpNetCDFGridRequest.py @@ -28,7 +28,7 @@ # ------------ ---------- ----------- -------------------------- # xx/xx/?? dgilling Initial Creation. # 03/13/13 1759 dgilling Add software history header. -# +# 05/13/15 4427 dgilling Add siteIdOverride field. # # @@ -40,7 +40,7 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest): def __init__(self, outputFilename=None, parmList=[], databaseID=None, startTime=None, endTime=None, mask=None, geoInfo=False, compressFile=False, configFileName=None, compressFileFactor=0, - trim=False, krunch=False, userID=None, logFileName=None): + trim=False, krunch=False, userID=None, logFileName=None, siteIdOverride=None): super(ExecuteIfpNetCDFGridRequest, self).__init__() self.outputFilename = outputFilename self.parmList = parmList @@ -56,6 +56,7 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest): self.krunch = krunch self.userID = userID self.logFileName = logFileName + self.siteIdOverride = siteIdOverride if self.userID is not None: self.workstationID = WsId(progName='ifpnetCDF', userName=self.userID) if self.databaseID is not None: @@ -78,7 +79,9 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest): retVal += "trim: " + str(self.trim) + ", " retVal += "krunch: " + str(self.krunch) + ", " retVal += "userID: " + str(self.userID) + ", " - retVal += "logFileName: " + str(self.logFileName) + "]" + retVal += "logFileName: " + str(self.logFileName) + ", " + retVal += "siteIdOverride: " + str(self.siteIdOverride) + retVal += "]" return retVal def __repr__(self): @@ -98,7 +101,9 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest): retVal += "trim=" + repr(self.trim) + ", " retVal += "krunch=" + repr(self.krunch) + ", " retVal += "userID=" + repr(self.userID) + ", " - retVal += "logFileName=" + repr(self.logFileName) + ")" + retVal += "logFileName=" + repr(self.logFileName) + ", " + retVal += "siteIdOverride: " + str(self.siteIdOverride) + retVal += ")" return retVal def getOutputFilename(self): @@ -185,3 +190,8 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest): def setLogFileName(self, logFileName): self.logFileName = logFileName + def getSiteIdOverride(self): + return self.siteIdOverride + + def setSiteIdOverride(self, siteIdOverride): + self.siteIdOverride = siteIdOverride diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/PythonWeatherGridSlice.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/RsyncGridsToCWFRequest.py similarity index 50% rename from dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/PythonWeatherGridSlice.py rename to dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/RsyncGridsToCWFRequest.py index 79fdd58..4a4026f 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/PythonWeatherGridSlice.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/RsyncGridsToCWFRequest.py @@ -17,33 +17,21 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# Jul 15, 2015 #4013 randerso Initial creation (hand generated) +# +# -# File auto-generated against equivalent DynamicSerialize Java class - -from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.slice import AbstractGridSlice -from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.weather import WeatherKey +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import AbstractGfeRequest -class PythonWeatherGridSlice(AbstractGridSlice): +class RsyncGridsToCWFRequest(AbstractGfeRequest): - def __init__(self): - super(PythonWeatherGridSlice, self).__init__() - self.weatherGrid = None - self.keys = [] - - def getNumPyGrid(self): - return (self.weatherGrid.getNumPyGrid(), self.keys) - - def getWeatherGrid(self): - return self.weatherGrid - - def setWeatherGrid(self, weatherGrid): - self.weatherGrid = weatherGrid - - def getKeys(self): - return self.keys - - def setKeys(self, keys): - del self.keys[:] - for key in keys: - self.keys.append(WeatherKey(subKeys=key)) + def __init__(self, siteId=None): + super(RsyncGridsToCWFRequest, self).__init__() + if siteId is not None: + self.siteID = str(siteId) diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py index 06a4409..8cea5cd 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py @@ -17,8 +17,13 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## - -# File auto-generated by PythonFileGenerator +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# Jul 15, 2015 #4013 randerso Added RsyncGridsToCWFRequest +# __all__ = [ 'AbstractGfeRequest', @@ -45,8 +50,8 @@ __all__ = [ 'ProcessReceivedDigitalDataRequest', 'PurgeGfeGridsRequest', 'SaveASCIIGridsRequest', - 'ServiceBackupStatusUpdateRequest', - 'SmartInitRequest' + 'SmartInitRequest', + 'RsyncGridsToCWFRequest', ] from AbstractGfeRequest import AbstractGfeRequest @@ -73,6 +78,6 @@ from ProcessReceivedConfRequest import ProcessReceivedConfRequest from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest from PurgeGfeGridsRequest import PurgeGfeGridsRequest from SaveASCIIGridsRequest import SaveASCIIGridsRequest -from ServiceBackupStatusUpdateRequest import ServiceBackupStatusUpdateRequest from SmartInitRequest import SmartInitRequest +from RsyncGridsToCWFRequest import RsyncGridsToCWFRequest diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/CombinationsFileChangedNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/CombinationsFileChangedNotification.py new file mode 100644 index 0000000..6c55f30 --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/CombinationsFileChangedNotification.py @@ -0,0 +1,53 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation (hand generated) +# +## + +import GfeNotification + +class CombinationsFileChangedNotification(GfeNotification.GfeNotification): + + def __init__(self): + super(CombinationsFileChangedNotification, self).__init__() + self.combinationsFileName = None + self.whoChanged = None + + def __str__(self): + msg = "fileName: " + str(self.combinationsFileName) + msg += '\n' + "whoChanged: " + str(self.whoChanged) + return msg + + def getCombinationsFileName(self): + return self.combinationsFileName + + def setCombinationsFileName(self, combinationsFileName): + self.combinationsFileName = combinationsFileName + + def getWhoChanged(self): + return self.whoChanged + + def setWhoChanged(self, whoChanged): + self.whoChanged = whoChanged diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/DBInvChangeNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/DBInvChangeNotification.py index dec6348..090fd97 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/DBInvChangeNotification.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/DBInvChangeNotification.py @@ -17,23 +17,25 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# ??/??/???? ???? njensen Modified to add __repr__ +# 06/22/2015 4573 randerso Change to extend GfeNotification +# removed inventory methods +# +## -# File auto-generated against equivalent DynamicSerialize Java class -# Modified by njensen to add __repr__ +import GfeNotification -class DBInvChangeNotification(object): +class DBInvChangeNotification(GfeNotification.GfeNotification): def __init__(self): - self.inventory = None + super(DBInvChangeNotification, self).__init__() self.additions = None self.deletions = None - self.siteID = None - - def getInventory(self): - return self.inventory - - def setInventory(self, inventory): - self.inventory = inventory def getAdditions(self): return self.additions @@ -47,15 +49,8 @@ class DBInvChangeNotification(object): def setDeletions(self, deletions): self.deletions = deletions - def getSiteID(self): - return self.siteID - - def setSiteID(self, siteID): - self.siteID = siteID - - def __repr__(self): - msg = 'Inventory' + str(self.inventory) + '\n' - msg += 'Additions' + str(self.additions) + '\n' + def __str__(self): + msg = 'Additions' + str(self.additions) + '\n' msg += 'Deletions' + str(self.deletions) return msg diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py index 75e3064..4da53d1 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py @@ -15,11 +15,21 @@ # # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 10/07/2014 3684 randerso Manually updated to add sourceID +# +## +import abc -# File auto-generated against equivalent DynamicSerialize Java class - -class GfeNotification: +class GfeNotification(object): + __metaclass__ = abc.ABCMeta + @abc.abstractmethod def __init__(self): self.siteID = None self.sourceID = None diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridHistoryUpdateNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridHistoryUpdateNotification.py new file mode 100644 index 0000000..f989fde --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridHistoryUpdateNotification.py @@ -0,0 +1,61 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation (hand generated) +# +## + +import GfeNotification + +class GridHistoryUpdateNotification(GfeNotification.GfeNotification): + + def __init__(self): + super(GridHistoryUpdateNotification, self).__init__() + self.parmId = None + self.workstationID = None + self.histories = None + + def getParmId(self): + return self.parmId + + def setParmId(self, parmId): + self.parmId = parmId + + def getWorkstationID(self): + return self.workstationID + + def setWorkstationID(self, workstationID): + self.workstationID = workstationID + + def getHistories(self): + return self.histories + + def setHistories(self, histories): + self.histories = histories + + def __str__(self): + msg = "ParmID: " + str(self.parmId) + msg += '\n' + "Histories: " + str(self.histories) + return msg + diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridUpdateNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridUpdateNotification.py index 4ba55c2..2bc1f16 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridUpdateNotification.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GridUpdateNotification.py @@ -17,17 +17,25 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# ??/??/???? ???? njensen Modified to add __repr__ +# 06/22/2015 4573 randerso Change to extend GfeNotification +# +## -# File auto-generated against equivalent DynamicSerialize Java class -# Modified by njensen to add __repr__ +import GfeNotification -class GridUpdateNotification(object): +class GridUpdateNotification(GfeNotification.GfeNotification): def __init__(self): + super(GridUpdateNotification, self).__init__() self.parmId = None self.replacementTimeRange = None self.workstationID = None - self.siteID = None self.histories = None def getParmId(self): @@ -48,12 +56,6 @@ class GridUpdateNotification(object): def setWorkstationID(self, workstationID): self.workstationID = workstationID - def getSiteID(self): - return self.siteID - - def setSiteID(self, siteID): - self.siteID = siteID - def getHistories(self): return self.histories @@ -61,9 +63,6 @@ class GridUpdateNotification(object): self.histories = histories def __str__(self): - return self.__repr__() - - def __repr__(self): msg = "ParmID: " + str(self.parmId) msg += '\n' + "Replacement TimeRange: " + str(self.replacementTimeRange) msg += '\n' + "Histories: " + str(self.histories) diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/LockNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/LockNotification.py index 113b774..a86a507 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/LockNotification.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/LockNotification.py @@ -17,15 +17,23 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# ??/??/???? ???? njensen Modified to add __repr__ +# 06/22/2015 4573 randerso Change to extend GfeNotification +# +## -# File auto-generated against equivalent DynamicSerialize Java class -# Modified by njensen to add __repr__ +import GfeNotification -class LockNotification(object): +class LockNotification(GfeNotification.GfeNotification): def __init__(self): + super(LockNotification, self).__init__() self.lockTable = None - self.siteID = None def getLockTable(self): return self.lockTable @@ -33,12 +41,6 @@ class LockNotification(object): def setLockTable(self, lockTable): self.lockTable = lockTable - def getSiteID(self): - return self.siteID - - def setSiteID(self, siteID): - self.siteID = siteID - - def __repr__(self): + def __str__(self): return str(self.lockTable) diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/ServiceBackupJobStatusNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/ServiceBackupJobStatusNotification.py new file mode 100644 index 0000000..0081481 --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/ServiceBackupJobStatusNotification.py @@ -0,0 +1,53 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation (hand generated) +# +## + +import GfeNotification + +class ServiceBackupJobStatusNotification(GfeNotification.GfeNotification): + + def __init__(self): + super(ServiceBackupJobStatusNotification, self).__init__() + self.name = None + self.state = "UNKNOWN" + + def __str__(self): + msg = "name: " + str(self.name) + msg += '\n' + "state: " + str(self.state) + return msg + + def getName(self): + return self.name + + def setName(self, name): + self.name = name + + def getState(self): + return self.state + + def setState(self, state): + self.state = state diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/UserMessageNotification.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/UserMessageNotification.py index f537055..06ba5cd 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/UserMessageNotification.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/UserMessageNotification.py @@ -17,16 +17,24 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Change to extend GfeNotification +# +## -# File auto-generated against equivalent DynamicSerialize Java class +import GfeNotification -class UserMessageNotification(object): +class UserMessageNotification(GfeNotification.GfeNotification): def __init__(self): + super(UserMessageNotification, self).__init__() self.category = None self.priority = None self.message = None - self.siteID = None def getCategory(self): return self.category @@ -46,13 +54,7 @@ class UserMessageNotification(object): def setMessage(self, message): self.message = message - def getSiteID(self): - return self.siteID - - def setSiteID(self, siteID): - self.siteID = siteID - - def __repr__(self): + def __str__(self): msg = 'Message: ' + str(self.message) + '\n' msg += 'Priority: ' + str(self.priority) + '\n' msg += 'Category: ' + str(self.category) + '\n' diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/__init__.py index 1c6377b..f58c70b 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/__init__.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/__init__.py @@ -21,16 +21,22 @@ # File auto-generated by PythonFileGenerator __all__ = [ + 'CombinationsFileChangedNotification', 'DBInvChangeNotification', 'GfeNotification', + 'GridHistoryUpdateNotification', 'GridUpdateNotification', 'LockNotification', + 'ServiceBackupJobStatusNotification', 'UserMessageNotification' ] +from CombinationsFileChangedNotification import CombinationsFileChangedNotification from DBInvChangeNotification import DBInvChangeNotification from GfeNotification import GfeNotification +from GridHistoryUpdateNotification import GridHistoryUpdateNotification from GridUpdateNotification import GridUpdateNotification from LockNotification import LockNotification +from ServiceBackupJobStatusNotification import ServiceBackupJobStatusNotification from UserMessageNotification import UserMessageNotification diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/__init__.py index e4fe68e..c2140d8 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/__init__.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/slice/__init__.py @@ -23,7 +23,6 @@ __all__ = [ 'AbstractGridSlice', 'DiscreteGridSlice', - 'PythonWeatherGridSlice', 'ScalarGridSlice', 'VectorGridSlice', 'WeatherGridSlice' @@ -32,7 +31,6 @@ __all__ = [ from AbstractGridSlice import AbstractGridSlice from DiscreteGridSlice import DiscreteGridSlice from ScalarGridSlice import ScalarGridSlice -from PythonWeatherGridSlice import PythonWeatherGridSlice from VectorGridSlice import VectorGridSlice from WeatherGridSlice import WeatherGridSlice diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/JobProgress.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/JobProgress.py new file mode 100644 index 0000000..c9ac45f --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/JobProgress.py @@ -0,0 +1,37 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation (hand generated) +# 08/27/2015 4812 randerso Change __str__ to return the self.value +# instead of __repr__(self.value) to eliminate +# ''s around string. +# +## + +class JobProgress(object): + def __init__(self): + self.value = None + + def __str__(self): + return self.value diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/__init__.py new file mode 100644 index 0000000..5413785 --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/svcbu/__init__.py @@ -0,0 +1,33 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/22/2015 4573 randerso Initial creation (hand generated) +# +## + +__all__ = [ + 'JobProgress', + ] + +from JobProgress import JobProgress diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py index 3544080..e5b56c0 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py @@ -28,6 +28,8 @@ # ------------ ---------- ----------- -------------------------- # 05/29/13 2023 dgilling Initial Creation. # 02/12/14 2672 bsteffen Allow String constructor to parse floats. +# 06/29/15 4480 dgilling Implement __hash__, __eq__, +# __str__ and rich comparison operators. # @@ -58,6 +60,120 @@ class Level(object): if levelTwo: self.leveltwovalue = numpy.float64(levelTwo) + def __hash__(self): + # XOR-ing the 3 items in a tuple ensures that order of the + # values matters + hashCode = hash(self.masterLevel) ^ hash(self.levelonevalue) ^ hash(self.leveltwovalue) + hashCode ^= hash((self.masterLevel, self.levelonevalue, self.leveltwovalue)) + return hashCode + + def __eq__(self, other): + if type(self) != type(other): + return False + else: + return (self.masterLevel, self.levelonevalue, self.leveltwovalue) == \ + (other.masterLevel, other.levelonevalue, other.leveltwovalue) + + def __ne__(self, other): + return not self.__eq__(other) + + def __lt__(self, other): + if type(self) != type(other): + return NotImplemented + elif self.masterLevel.getName() != other.masterLevel.getName(): + return NotImplemented + + myLevel1 = self.levelonevalue + myLevel2 = self.leveltwovalue + otherLevel1 = other.levelonevalue + otherLevel2 = other.leveltwovalue + if myLevel1 == INVALID_VALUE and myLevel2 != INVALID_VALUE: + myLevel1 = myLevel2 + myLevel2 = INVALID_VALUE + if otherLevel1 == INVALID_VALUE and otherLevel2 != INVALID_VALUE: + otherLevel1 = otherLevel2 + otherLevel2 = INVALID_VALUE + + # We default to descending order to make sorting levels from the DAF easier + compareType = self.masterLevel.getType() if self.masterLevel.getType() else "DEC" + if myLevel1 != INVALID_VALUE and otherLevel1 != INVALID_VALUE: + level1Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel1) + if level1Cmp == -1: + if myLevel2 != INVALID_VALUE and otherLevel2 != INVALID_VALUE: + level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel2) + return level2Cmp == -1 + elif myLevel2 != INVALID_VALUE: + level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel1) + return level2Cmp == -1 + else: + return True + return False + + def __le__(self, other): + if type(self) != type(other): + return NotImplemented + elif self.masterLevel.getName() != other.masterLevel.getName(): + return NotImplemented + + return self.__lt__(other) or self.__eq__(other) + + def __gt__(self, other): + if type(self) != type(other): + return NotImplemented + elif self.masterLevel.getName() != other.masterLevel.getName(): + return NotImplemented + + myLevel1 = self.levelonevalue + myLevel2 = self.leveltwovalue + otherLevel1 = other.levelonevalue + otherLevel2 = other.leveltwovalue + if myLevel1 == INVALID_VALUE and myLevel2 != INVALID_VALUE: + myLevel1 = myLevel2 + myLevel2 = INVALID_VALUE + if otherLevel1 == INVALID_VALUE and otherLevel2 != INVALID_VALUE: + otherLevel1 = otherLevel2 + otherLevel2 = INVALID_VALUE + + # We default to descending order to make sorting levels from the DAF easier + compareType = self.masterLevel.getType() if self.masterLevel.getType() else "DEC" + if myLevel1 != INVALID_VALUE and otherLevel1 != INVALID_VALUE: + level1Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel1) + if level1Cmp == 1: + if myLevel2 != INVALID_VALUE and otherLevel2 != INVALID_VALUE: + level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel2) + return level2Cmp == 1 + elif otherLevel2 != INVALID_VALUE: + level2Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel2) + return level2Cmp == 1 + else: + return True + return False + + def __ge__(self, other): + if type(self) != type(other): + return NotImplemented + elif self.masterLevel.getName() != other.masterLevel.getName(): + return NotImplemented + + return self.__gt__(other) or self.__eq__(other) + + def __compareLevelValues(self, compareType, val1, val2): + returnVal = 0 + if val1 < val2: + returnVal = -1 if compareType == 'INC' else 1 + elif val2 < val1: + returnVal = 1 if compareType == 'INC' else -1 + return returnVal + + def __str__(self): + retVal = "" + if INVALID_VALUE != self.levelonevalue: + retVal += str(self.levelonevalue) + if INVALID_VALUE != self.leveltwovalue: + retVal += "_" + str(self.leveltwovalue) + retVal += str(self.masterLevel.getName()) + return retVal + def getId(self): return self.id @@ -87,4 +203,3 @@ class Level(object): def setIdentifier(self, identifier): self.identifier = identifier - diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py index 98d4acb..81fcdff 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py @@ -27,6 +27,8 @@ # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 05/29/13 2023 dgilling Initial Creation. +# 06/29/15 4480 dgilling Implement __hash__, __eq__ +# and __str__. # # @@ -39,6 +41,27 @@ class MasterLevel(object): self.type = None self.identifier = None + def __hash__(self): + return hash(self.name) + + def __eq__(self, other): + if type(self) != type(other): + return False + else: + return self.name == other.name + + def __ne__(self, other): + return not self.__eq__(other) + + def __str__(self): + retVal = "MasterLevel[" + retVal += "name=" + str(self.name) + "," + retVal += "type=" + str(self.type) + "," + retVal += "unit=" + str(self.unitString) + "," + retVal += "description=" + str(self.description) + retVal += "]" + return retVal + def getName(self): return self.name diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/DoubleDataRecord.py b/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/DoubleDataRecord.py new file mode 100644 index 0000000..ca8c188 --- /dev/null +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/DoubleDataRecord.py @@ -0,0 +1,116 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated against equivalent DynamicSerialize Java class and +# modified. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# Sep 8, 2014 kustert Initial Creation +# Apr 24, 2015 4425 nabowle Bring in. + +class DoubleDataRecord(object): + + def __init__(self): + self.sizes = None + self.dimension = None + self.maxChunkSize = None + self.name = None + self.fillValue = None + self.dataAttributes = None + self.group = None + self.minIndex = None + self.props = None + self.doubleData = None + self.maxSizes = None + + def getSizes(self): + return self.sizes + + def setSizes(self, sizes): + self.sizes = sizes + + def getDimension(self): + return self.dimension + + def setDimension(self, dimension): + self.dimension = dimension + + def getMaxChunkSize(self): + return self.maxChunkSize + + def setMaxChunkSize(self, maxChunkSize): + self.maxChunkSize = maxChunkSize + + def getName(self): + return self.name + + def setName(self, name): + self.name = name + + def getFillValue(self): + return self.fillValue + + def setFillValue(self, fillValue): + self.fillValue = fillValue + + def getDataAttributes(self): + return self.dataAttributes + + def setDataAttributes(self, dataAttributes): + self.dataAttributes = dataAttributes + + def getGroup(self): + return self.group + + def setGroup(self, group): + self.group = group + + def getMinIndex(self): + return self.minIndex + + def setMinIndex(self, minIndex): + self.minIndex = minIndex + + def getProps(self): + return self.props + + def setProps(self, props): + self.props = props + + def getDoubleData(self): + return self.doubleData + + def setDoubleData(self, doubleData): + self.doubleData = doubleData + + def getMaxSizes(self): + return self.maxSizes + + def setMaxSizes(self, maxSizes): + self.maxSizes = maxSizes + + def retrieveDataObject(self): + return self.getDoubleData() + + def putDataObject(self, obj): + self.setDoubleData(obj) diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/__init__.py b/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/__init__.py index 667d444..9fa7b23 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/__init__.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/datastorage/records/__init__.py @@ -18,7 +18,6 @@ # further licensing information. ## - # # Package definition for com.raytheon.uf.common.datastorage.records # @@ -27,24 +26,28 @@ # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- -# 08/31/10 njensen Initial Creation. +# 08/31/10 njensen Initial Creation. +# Apr 24, 2015 4425 nabowle Add DoubleDataRecord # # # __all__ = [ - 'ByteDataRecord', - 'FloatDataRecord', - 'IntegerDataRecord', - 'LongDataRecord', - 'ShortDataRecord', - 'StringDataRecord', - ] + 'ByteDataRecord', + 'DoubleDataRecord', + 'FloatDataRecord', + 'IntegerDataRecord', + 'LongDataRecord', + 'ShortDataRecord', + 'StringDataRecord' + ] from ByteDataRecord import ByteDataRecord +from DoubleDataRecord import DoubleDataRecord from FloatDataRecord import FloatDataRecord from IntegerDataRecord import IntegerDataRecord from LongDataRecord import LongDataRecord from ShortDataRecord import ShortDataRecord from StringDataRecord import StringDataRecord + diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py b/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py index c729607..7b20af8 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py @@ -31,6 +31,9 @@ # 01/22/14 2667 bclement preserved milliseconds in string representation # 03/03/14 2673 bsteffen allow construction using a Date for refTime # 06/24/14 3096 mnash implement __cmp__ +# 06/24/15 4480 dgilling implement __hash__ and __eq__, +# replace __cmp__ with rich comparison +# operators. # import calendar @@ -66,9 +69,7 @@ class DataTime(object): self.refTime = long(self.refTime.getTime()) else: self.refTime = long(refTime) - dateObj = Date() - dateObj.setTime(self.refTime) - self.refTime = dateObj + self.refTime = Date(self.refTime) if self.validPeriod is None: validTimeMillis = self.refTime.getTime() + long(self.fcstTime * 1000) @@ -112,38 +113,6 @@ class DataTime(object): def setLevelValue(self, levelValue): self.levelValue = numpy.float64(levelValue) - def __cmp__(self, other): - if other is None : - return 1 - - # compare the valid times, which are the ref times + forecast times - validTimeCmp = cmp(self.getRefTime().getTime() + self.getFcstTime(), - other.getRefTime().getTime() + other.getFcstTime()) - if validTimeCmp != 0 : - return validTimeCmp - - # compare the forecast times - fcstTimeCmp = cmp(self.getFcstTime(), other.getFcstTime()) - if fcstTimeCmp != 0 : - return fcstTimeCmp - - # compare the level values - levelCmp = cmp(self.getLevelValue(), other.getLevelValue()) - if levelValue != 0 : - return levelValue - - # compare the valid periods - period1 = self.getValidPeriod() - period2 = other.getValidPerid() - - if period1 is None : - return -1 - elif period2 is None : - return 1 - - return cmp(period1.getDuration(), period2.getDuration()) - - def __str__(self): buffer = StringIO.StringIO() @@ -172,3 +141,86 @@ class DataTime(object): strVal = buffer.getvalue() buffer.close() return strVal + + def __repr__(self): + return "" + + def __hash__(self): + hashCode = hash(self.refTime) ^ hash(self.fcstTime) + if self.validPeriod is not None and self.validPeriod.isValid(): + hashCode ^= hash(self.validPeriod.getStart()) + hashCode ^= hash(self.validPeriod.getEnd()) + hashCode ^= hash(self.levelValue) + return hashCode + + def __eq__(self, other): + if type(self) != type(other): + return False + + if other.getRefTime() is None: + return self.fcstTime == other.fcstTime + + dataTime1 = (self.refTime, self.fcstTime, self.validPeriod, self.levelValue) + dataTime2 = (other.refTime, other.fcstTime, other.validPeriod, other.levelValue) + return dataTime1 == dataTime2 + + def __ne__(self, other): + return not self.__eq__(other) + + def __lt__(self, other): + if type(self) != type(other): + return NotImplemented + + myValidTime = self.getRefTime().getTime() + self.getFcstTime() + otherValidTime = other.getRefTime().getTime() + other.getFcstTime() + if myValidTime < otherValidTime: + return True + + if self.fcstTime < other.fcstTime: + return True + + if self.levelValue < other.levelValue: + return True + + myValidPeriod = self.validPeriod + otherValidPeriod = other.validPeriod + if myValidPeriod != otherValidPeriod: + if myValidPeriod.duration() < otherValidPeriod.duration(): + return True + return myValidPeriod.getStartInMillis() < otherValidPeriod.getStartInMillis() + return False + + def __le__(self, other): + if type(self) != type(other): + return NotImplemented + + return self.__lt__(other) or self.__eq__(other) + + def __gt__(self, other): + if type(self) != type(other): + return NotImplemented + + myValidTime = self.getRefTime().getTime() + self.getFcstTime() + otherValidTime = other.getRefTime().getTime() + other.getFcstTime() + if myValidTime > otherValidTime: + return True + + if self.fcstTime > other.fcstTime: + return True + + if self.levelValue > other.levelValue: + return True + + myValidPeriod = self.validPeriod + otherValidPeriod = other.validPeriod + if myValidPeriod != otherValidPeriod: + if myValidPeriod.duration() > otherValidPeriod.duration(): + return True + return myValidPeriod.getStartInMillis() > otherValidPeriod.getStartInMillis() + return False + + def __ge__(self, other): + if type(self) != type(other): + return NotImplemented + + return self.__gt__(other) or self.__eq__(other) \ No newline at end of file diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/time/TimeRange.py b/dynamicserialize/dstypes/com/raytheon/uf/common/time/TimeRange.py index ae54701..329bb74 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/time/TimeRange.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/time/TimeRange.py @@ -28,6 +28,7 @@ # ??/??/?? xxxxxxxx Initial Creation. # 01/22/14 2667 bclement fixed millisecond support # 02/28/14 2667 bclement constructor can take extra micros for start and end +# 06/24/15 4480 dgilling fix __eq__. # # # @@ -51,7 +52,15 @@ class TimeRange(object): return "(" + self.start.strftime("%b %d %y %H:%M:%S %Z") + ", " + self.end.strftime("%b %d %y %H:%M:%S %Z") + ")" def __eq__(self, other): - return ((self.start == other.start) and (self.end == other.end)) + if type(self) != type(other): + return False + + if self.isValid() and other.isValid(): + return self.getStart() == other.getStart() and self.getEnd() == other.getEnd() + elif not self.isValid() and not other.isValid(): + return True + else: + return False def __ne__(self, other): return (not self.__eq__(other)) @@ -132,7 +141,7 @@ class TimeRange(object): return convTime == self.start def isValid(self): - return (self.start != self.end) + return bool(self.start != self.end) def overlaps(self, timeRange): return (timeRange.contains(self.start) or self.contains(timeRange.start)) diff --git a/dynamicserialize/dstypes/java/sql/Timestamp.py b/dynamicserialize/dstypes/java/sql/Timestamp.py index 83d29c2..0bf23bf 100644 --- a/dynamicserialize/dstypes/java/sql/Timestamp.py +++ b/dynamicserialize/dstypes/java/sql/Timestamp.py @@ -18,25 +18,22 @@ # further licensing information. ## -## NOTE: This is a dummy class that is only used for deserialization -## support. Further work required if it is need in the pure Python -## environment. +# File auto-generated against equivalent DynamicSerialize Java class +# and then modified post-generation to add additional features to better +# match Java implementation. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# ??/??/?? xxxxxxxx Initial Creation. +# 06/24/15 4480 dgilling implement based on Date class. +# -class Timestamp(object): +from dynamicserialize.dstypes.java.util import Date + + +class Timestamp(Date): def __init__(self, time=None): - self.time = time - - def getTime(self): - return self.time - - def setTime(self, timeInMillis): - self.time = timeInMillis - - def __str__(self): - return self.__repr__() - - def __repr__(self): - from time import gmtime, strftime - - return strftime("%b %d %y %H:%M:%S GMT", gmtime(self.time/1000.0)) + super(Timestamp, self).__init__(time) diff --git a/dynamicserialize/dstypes/java/util/Date.py b/dynamicserialize/dstypes/java/util/Date.py index a80220a..d08d12d 100644 --- a/dynamicserialize/dstypes/java/util/Date.py +++ b/dynamicserialize/dstypes/java/util/Date.py @@ -17,13 +17,24 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# ---------------------------------------------------------------------------- +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 04/28/2015 4027 randerso Added optional construction parameter to set the time +# 06/26/2015 4480 dgilling Implement __eq__ and __hash__. +# +## + +from time import gmtime, strftime -# File auto-generated against equivalent DynamicSerialize Java class class Date(object): - def __init__(self): - self.time = None + def __init__(self, timeInMillis=None): + self.time = timeInMillis def getTime(self): return self.time @@ -35,6 +46,13 @@ class Date(object): return self.__repr__() def __repr__(self): - from time import gmtime, strftime - return strftime("%b %d %y %H:%M:%S GMT", gmtime(self.time/1000.0)) + + def __eq__(self, other): + return self.time == other.time + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return hash(self.time)