diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py index 2e806aff86..52ca0ddbf3 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JData.py @@ -28,7 +28,7 @@ # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 12/10/12 njensen Initial Creation. -# +# 06/03/13 #2023 dgilling Implement getAttributes(). # # @@ -43,6 +43,14 @@ class JData(IData, JUtil.JavaWrapperClass): def getAttribute(self, key): return self.jobj.getAttribute(key) + def getAttributes(self): + attributes = [] + jattribs = self.jobj.getAttributes() + itr = jattribs.iterator() + while itr.hasNext(): + attributes.append(str(itr.next())) + return attributes + def getDataTime(self): return DataTime.DataTime(self.jobj.getDataTime()) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py index 077508acf6..f9751d49a3 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/dataaccess/JGeometryData.py @@ -28,8 +28,9 @@ # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 12/10/12 njensen Initial Creation. -# -# +# 06/03/13 #2023 dgilling Remove "unit" support from +# __getitem__ as it only threw errors. +# # from ufpy.dataaccess import IGeometryData @@ -46,8 +47,6 @@ class JGeometryData(IGeometryData, JData.JData): return self.getGeometry() elif key == 'parameters': return self.getParameters() - elif key == 'unit': - return self.getUnit() elif key =='locationName': return self.getLocationName() elif key == 'time': diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataaccess/META-INF/MANIFEST.MF index b3f9ed9b15..0f5f3a0922 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/META-INF/MANIFEST.MF @@ -21,4 +21,6 @@ Export-Package: com.raytheon.uf.common.dataaccess, com.raytheon.uf.common.dataaccess.geom, com.raytheon.uf.common.dataaccess.grid, com.raytheon.uf.common.dataaccess.impl, + com.raytheon.uf.common.dataaccess.request, + com.raytheon.uf.common.dataaccess.response, com.raytheon.uf.common.dataaccess.util diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/IData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/IData.java index 6a6180d6bc..d17e4ecf7e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/IData.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/IData.java @@ -19,6 +19,8 @@ **/ package com.raytheon.uf.common.dataaccess; +import java.util.Set; + import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.time.DataTime; @@ -33,6 +35,7 @@ import com.raytheon.uf.common.time.DataTime; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Oct 10, 2012 njensen Initial creation + * Jun 03, 2013 #2023 dgilling Add getAttributes(). * * * @@ -50,6 +53,13 @@ public interface IData { */ public Object getAttribute(String key); + /** + * Gets the list of attributes associated with this data. + * + * @return the attributes + */ + public Set getAttributes(); + /** * Gets the DataTime of the data. May be null if the data is time agnostic. * diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.java index 582ec33f99..61264cee2b 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.java @@ -31,6 +31,8 @@ import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.serialization.XmlGenericMapAdapter; import com.raytheon.uf.common.serialization.adapters.JTSEnvelopeAdapter; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.vividsolutions.jts.geom.Envelope; /** @@ -43,9 +45,10 @@ import com.vividsolutions.jts.geom.Envelope; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Nov 6, 2012 njensen Initial creation + * Nov 06, 2012 njensen Initial creation * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. + * May 28, 2013 2023 dgilling Add support for DynamicSerialize. * * * @@ -54,30 +57,39 @@ import com.vividsolutions.jts.geom.Envelope; */ @XmlAccessorType(XmlAccessType.NONE) +@DynamicSerialize public class DefaultDataRequest implements IDataRequest { @XmlElement + @DynamicSerializeElement protected String datatype; @XmlJavaTypeAdapter(value = XmlGenericMapAdapter.class) + @DynamicSerializeElement protected Map identifiers; @XmlElement(name = "parameter") + @DynamicSerializeElement protected String[] parameters; @XmlElement(name = "level") + @DynamicSerializeElement protected Level[] levels; @XmlElement(name = "locationName") + @DynamicSerializeElement protected String[] locationNames; - + @XmlJavaTypeAdapter(value = JTSEnvelopeAdapter.class) + @DynamicSerializeElement protected Envelope envelope; + @Override public void setDatatype(String datatype) { this.datatype = datatype; } + @Override public void addIdentifier(String key, Object value) { if (identifiers == null) { identifiers = new HashMap(); @@ -85,46 +97,58 @@ public class DefaultDataRequest implements IDataRequest { identifiers.put(key, value); } + public void setIdentifiers(Map identifiers) { + this.identifiers = identifiers; + } + + @Override public void setParameters(String... params) { this.parameters = params; } + @Override public void setLevels(Level... levels) { this.levels = levels; } - + + @Override public void setLocationNames(String... locationNames) { this.locationNames = locationNames; } + @Override public void setEnvelope(Envelope env) { this.envelope = env; } + @Override public String getDatatype() { return datatype; } + @Override public Map getIdentifiers() { return identifiers; } + @Override public String[] getParameters() { return parameters; } + @Override public Level[] getLevels() { return levels; } + @Override public String[] getLocationNames() { return locationNames; } - + + @Override public Envelope getEnvelope() { return envelope; } - - } diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java index 603c4b7d07..74ce85cc70 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java @@ -41,7 +41,8 @@ import com.vividsolutions.jts.geom.Geometry; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Nov 9, 2012 njensen Initial creation + * Nov 09, 2012 njensen Initial creation + * Jun 03, 2013 #2023 dgilling Implement getAttributes(). * * * @@ -83,6 +84,11 @@ public class DefaultGeometryData implements IGeometryData { return result; } + @Override + public Set getAttributes() { + return attributes.keySet(); + } + @Override public DataTime getDataTime() { return time; @@ -290,5 +296,4 @@ public class DefaultGeometryData implements IGeometryData { public void setAttributes(Map attrs) { this.attributes = attrs; } - } diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGridData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGridData.java index 9e37adeccf..f81d8bc987 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGridData.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGridData.java @@ -20,6 +20,7 @@ package com.raytheon.uf.common.dataaccess.impl; import java.util.Map; +import java.util.Set; import javax.measure.unit.Unit; @@ -41,7 +42,8 @@ import com.raytheon.uf.common.time.DataTime; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Nov 5, 2012 njensen Initial creation + * Nov 05, 2012 njensen Initial creation + * Jun 03, 2013 #2023 dgilling Implement getAttributes(). * * * @@ -81,6 +83,11 @@ public class DefaultGridData implements IGridData { return result; } + @Override + public Set getAttributes() { + return attributes.keySet(); + } + @Override public DataTime getDataTime() { return time; diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.java new file mode 100644 index 0000000000..f3db7b526d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.java @@ -0,0 +1,66 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.request; + +import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.serialization.comm.IServerRequest; + +/** + * Abstract base class for Thrift requests made to the Data Access Framework. + * Primarily used by the Python-Thrift implementation. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 23, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public abstract class AbstractDataAccessRequest implements IServerRequest { + + @DynamicSerializeElement + protected IDataRequest requestParameters; + + protected AbstractDataAccessRequest() { + // no-op for serialization + } + + protected AbstractDataAccessRequest(final IDataRequest request) { + requestParameters = request; + } + + public IDataRequest getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(final IDataRequest requestParameters) { + this.requestParameters = requestParameters; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.java new file mode 100644 index 0000000000..85d6c39f75 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.java @@ -0,0 +1,54 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.request; + +import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; + +/** + * Thrift request to retrieve list of available location names from Data Access + * Framework. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 24, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public final class GetAvailableLocationNamesRequest extends + AbstractDataAccessRequest { + + public GetAvailableLocationNamesRequest() { + super(); + } + + public GetAvailableLocationNamesRequest(final IDataRequest request) { + super(request); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.java new file mode 100644 index 0000000000..d3c9d138df --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.java @@ -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. + **/ +package com.raytheon.uf.common.dataaccess.request; + +import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; + +/** + * Thrift request to retrieve list of available times for data from the Data + * Access Framework. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 23, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public final class GetAvailableTimesRequest extends AbstractDataAccessRequest { + + public GetAvailableTimesRequest() { + super(); + } + + public GetAvailableTimesRequest(final IDataRequest request) { + super(request); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.java new file mode 100644 index 0000000000..3b2ba5fd22 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.java @@ -0,0 +1,87 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.request; + +import java.util.Collections; +import java.util.List; + +import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; + +/** + * Thrift request to retrieve geometry data from the Data Access Framework. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 24, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public final class GetGeometryDataRequest extends AbstractDataAccessRequest { + + private List requestedTimes; + + private TimeRange requestedPeriod; + + public GetGeometryDataRequest() { + // no-op, for serialization + } + + public GetGeometryDataRequest(final IDataRequest request, + final List requestedTimes) { + super(request); + this.requestedTimes = requestedTimes; + this.requestedPeriod = null; + } + + public GetGeometryDataRequest(final IDataRequest request, + final TimeRange requestedPeriod) { + super(request); + this.requestedPeriod = requestedPeriod; + this.requestedTimes = Collections.emptyList(); + } + + public List getRequestedTimes() { + return requestedTimes; + } + + public void setRequestedTimes(List requestedTimes) { + this.requestedTimes = requestedTimes; + } + + public TimeRange getRequestedPeriod() { + return requestedPeriod; + } + + public void setRequestedPeriod(TimeRange requestedPeriod) { + this.requestedPeriod = requestedPeriod; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.java new file mode 100644 index 0000000000..fbd1ec4d52 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.java @@ -0,0 +1,87 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.request; + +import java.util.Collections; +import java.util.List; + +import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; + +/** + * Thrift request to retrieve gridded data from the Data Access Framework. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 24, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public final class GetGridDataRequest extends AbstractDataAccessRequest { + + private List requestedTimes; + + private TimeRange requestedPeriod; + + public GetGridDataRequest() { + // no-op, for serialization + } + + public GetGridDataRequest(final IDataRequest request, + final List requestedTimes) { + super(request); + this.requestedTimes = requestedTimes; + this.requestedPeriod = null; + } + + public GetGridDataRequest(final IDataRequest request, + final TimeRange requestedPeriod) { + super(request); + this.requestedPeriod = requestedPeriod; + this.requestedTimes = Collections.emptyList(); + } + + public List getRequestedTimes() { + return requestedTimes; + } + + public void setRequestedTimes(List requestedTimes) { + this.requestedTimes = requestedTimes; + } + + public TimeRange getRequestedPeriod() { + return requestedPeriod; + } + + public void setRequestedPeriod(TimeRange requestedPeriod) { + this.requestedPeriod = requestedPeriod; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.java new file mode 100644 index 0000000000..ee4af91df8 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.java @@ -0,0 +1,112 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.response; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.raytheon.uf.common.dataaccess.IData; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.time.DataTime; + +/** + * Base class for responses returned from the Data Access Framework. Wraps all + * of the data for the IData interface. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public abstract class AbstractResponseData { + + @DynamicSerializeElement + protected DataTime time; + + @DynamicSerializeElement + protected String level; + + @DynamicSerializeElement + protected String locationName; + + @DynamicSerializeElement + protected Map attributes; + + protected AbstractResponseData() { + // no-op, for serialization + } + + protected AbstractResponseData(final IData data) { + time = data.getDataTime(); + locationName = data.getLocationName(); + if (data.getLevel() != null) { + level = data.getLevel().toString(); + } + Set attrNames = data.getAttributes(); + attributes = new HashMap(attrNames.size(), 1); + for (String attr : attrNames) { + attributes.put(attr, data.getAttribute(attr)); + } + } + + public DataTime getTime() { + return time; + } + + public void setTime(DataTime time) { + this.time = time; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getLocationName() { + return locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.java new file mode 100644 index 0000000000..a2878bf5dd --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.java @@ -0,0 +1,96 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.response; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.raytheon.uf.common.dataaccess.geom.IGeometryData; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * IGeometryData wrapper used as part of GetGeometryDataResponse. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 03, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public class GeometryResponseData extends AbstractResponseData { + + @DynamicSerializeElement + private Map dataMap; + + @DynamicSerializeElement + private String geometryWKT; + + public GeometryResponseData() { + // no-op, for serialization + } + + public GeometryResponseData(final IGeometryData data) { + super(data); + + Set parameters = data.getParameters(); + dataMap = new HashMap(parameters.size(), 1); + for (String param : parameters) { + Object[] dataTuple = new Object[3]; + if (IGeometryData.Type.STRING.equals(data.getType(param))) { + dataTuple[0] = data.getString(param); + } else { + dataTuple[0] = data.getNumber(param); + } + dataTuple[1] = data.getType(param).toString(); + if (data.getUnit(param) != null) { + dataTuple[2] = data.getUnit(param).toString(); + } + dataMap.put(param, dataTuple); + } + geometryWKT = data.getGeometry().toText(); + } + + public Map getDataMap() { + return dataMap; + } + + public void setDataMap(Map dataMap) { + this.dataMap = dataMap; + } + + public String getGeometryWKT() { + return geometryWKT; + } + + public void setGeometryWKT(String geometry) { + this.geometryWKT = geometry; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.java new file mode 100644 index 0000000000..4300c7143d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.java @@ -0,0 +1,71 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.response; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import com.raytheon.uf.common.dataaccess.geom.IGeometryData; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * Response for GetGeometryDataRequest. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 3, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public class GetGeometryDataResponse { + + @DynamicSerializeElement + private List geoData; + + public GetGeometryDataResponse() { + // no-op, for serialization only + } + + public GetGeometryDataResponse(final Collection geoData) { + this.geoData = new ArrayList(geoData.size()); + for (IGeometryData element : geoData) { + this.geoData.add(new GeometryResponseData(element)); + } + } + + public List getGeoData() { + return geoData; + } + + public void setGeoData(List geoData) { + this.geoData = geoData; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.java new file mode 100644 index 0000000000..537c22cdad --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.java @@ -0,0 +1,139 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.response; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.geotools.coverage.grid.GridGeometry2D; +import org.opengis.coverage.grid.GridEnvelope; + +import com.raytheon.uf.common.dataaccess.grid.IGridData; +import com.raytheon.uf.common.geospatial.LatLonReprojection; +import com.raytheon.uf.common.geospatial.LatLonWrapper; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * Response for GetGridDataRequest. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public class GetGridDataResponse { + + @DynamicSerializeElement + private List gridData; + + @DynamicSerializeElement + private Map siteNxValues; + + @DynamicSerializeElement + private Map siteNyValues; + + @DynamicSerializeElement + private Map siteLatGrids; + + @DynamicSerializeElement + private Map siteLonGrids; + + public GetGridDataResponse() { + // no-op, for serialization only + } + + public GetGridDataResponse(final Collection gridData) { + this.gridData = new ArrayList(gridData.size()); + siteNxValues = new HashMap(gridData.size(), 1); + siteNyValues = new HashMap(gridData.size(), 1); + siteLatGrids = new HashMap(gridData.size(), 1); + siteLonGrids = new HashMap(gridData.size(), 1); + + for (IGridData grid : gridData) { + this.gridData.add(new GridResponseData(grid)); + + String locationName = grid.getLocationName(); + if (!siteNxValues.containsKey(locationName)) { + GridGeometry2D gridGeometry = grid.getGridGeometry(); + GridEnvelope gridShape = gridGeometry.getGridRange(); + siteNxValues.put(locationName, gridShape.getSpan(0)); + siteNyValues.put(locationName, gridShape.getSpan(1)); + LatLonWrapper latLonData = LatLonReprojection + .getLatLons(gridGeometry); + siteLatGrids.put(locationName, latLonData.getLats()); + siteLonGrids.put(locationName, latLonData.getLons()); + } + } + } + + public List getGridData() { + return gridData; + } + + public void setGridData(List gridData) { + this.gridData = gridData; + } + + public Map getSiteNxValues() { + return siteNxValues; + } + + public void setSiteNxValues(Map siteNxValues) { + this.siteNxValues = siteNxValues; + } + + public Map getSiteNyValues() { + return siteNyValues; + } + + public void setSiteNyValues(Map siteNyValues) { + this.siteNyValues = siteNyValues; + } + + public Map getSiteLatGrids() { + return siteLatGrids; + } + + public void setSiteLatGrids(Map siteLatGrids) { + this.siteLatGrids = siteLatGrids; + } + + public Map getSiteLonGrids() { + return siteLonGrids; + } + + public void setSiteLonGrids(Map siteLonGrids) { + this.siteLonGrids = siteLonGrids; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GridResponseData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GridResponseData.java new file mode 100644 index 0000000000..36b4718378 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GridResponseData.java @@ -0,0 +1,96 @@ +/** + * 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. + **/ +package com.raytheon.uf.common.dataaccess.response; + +import com.raytheon.uf.common.dataaccess.grid.IGridData; +import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * IGridData wrapper used as part of GetGridDataResponse. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public class GridResponseData extends AbstractResponseData { + + @DynamicSerializeElement + private String parameter; + + @DynamicSerializeElement + private String unit; + + @DynamicSerializeElement + private float[] gridData; + + public GridResponseData() { + // no-op, for serialization + } + + public GridResponseData(final IGridData data) { + super(data); + + parameter = data.getParameter(); + if (data.getUnit() != null) { + unit = data.getUnit().toString(); + } + FloatArrayWrapper dataGrid = new FloatArrayWrapper( + data.getGridGeometry()); + dataGrid = data.populateData(dataGrid); + gridData = dataGrid.getArray(); + } + + public String getParameter() { + return parameter; + } + + public void setParameter(String parameter) { + this.parameter = parameter; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public float[] getGridData() { + return gridData; + } + + public void setGridData(float[] gridData) { + this.gridData = gridData; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml index 892b3fdaf4..f8dc7dba14 100644 --- a/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml @@ -111,4 +111,11 @@ install-size="0" version="0.0.0"/> + + diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/.classpath b/edexOsgi/com.raytheon.uf.edex.dataaccess/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/.project b/edexOsgi/com.raytheon.uf.edex.dataaccess/.project new file mode 100644 index 0000000000..990ffd7b5c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.edex.dataaccess + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.dataaccess/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c537b63063 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.dataaccess/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..1e70f1f2a5 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Data Access Framework EDEX +Bundle-SymbolicName: com.raytheon.uf.edex.dataaccess +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: RAYTHEON +Require-Bundle: com.raytheon.uf.common.dataaccess, + com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", + com.raytheon.uf.common.util;bundle-version="1.12.1174" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/build.properties b/edexOsgi/com.raytheon.uf.edex.dataaccess/build.properties new file mode 100644 index 0000000000..5791d48d5f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/ diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/res/spring/dataaccess-request.xml b/edexOsgi/com.raytheon.uf.edex.dataaccess/res/spring/dataaccess-request.xml new file mode 100644 index 0000000000..cd76162782 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/res/spring/dataaccess-request.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableLocationNamesHandler.java b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableLocationNamesHandler.java new file mode 100644 index 0000000000..51876165bb --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableLocationNamesHandler.java @@ -0,0 +1,60 @@ +/** + * 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. + **/ +package com.raytheon.uf.edex.dataaccess.handler; + +import com.raytheon.uf.common.dataaccess.DataAccessLayer; +import com.raytheon.uf.common.dataaccess.request.GetAvailableLocationNamesRequest; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; + +/** + * Request handler for GetAvailableLocationNamesRequest. Returns + * answer as array of String objects containing the location names. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 24, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public final class GetAvailableLocationNamesHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public String[] handleRequest(final GetAvailableLocationNamesRequest request) + throws Exception { + return DataAccessLayer.getAvailableLocationNames(request + .getRequestParameters()); + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableTimesHandler.java b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableTimesHandler.java new file mode 100644 index 0000000000..c53a742755 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetAvailableTimesHandler.java @@ -0,0 +1,62 @@ +/** + * 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. + **/ +package com.raytheon.uf.edex.dataaccess.handler; + +import com.raytheon.uf.common.dataaccess.DataAccessLayer; +import com.raytheon.uf.common.dataaccess.request.GetAvailableTimesRequest; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; +import com.raytheon.uf.common.time.DataTime; + +/** + * Request handler for GetAvailableTimesRequest. Returns answer as + * array of DataTime objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 23, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public final class GetAvailableTimesHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public DataTime[] handleRequest(final GetAvailableTimesRequest request) + throws Exception { + return DataAccessLayer + .getAvailableTimes(request.getRequestParameters()); + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGeometryDataHandler.java b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGeometryDataHandler.java new file mode 100644 index 0000000000..4877419586 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGeometryDataHandler.java @@ -0,0 +1,79 @@ +/** + * 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. + **/ +package com.raytheon.uf.edex.dataaccess.handler; + +import java.util.Arrays; + +import com.raytheon.uf.common.dataaccess.DataAccessLayer; +import com.raytheon.uf.common.dataaccess.geom.IGeometryData; +import com.raytheon.uf.common.dataaccess.request.GetGeometryDataRequest; +import com.raytheon.uf.common.dataaccess.response.GetGeometryDataResponse; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.util.CollectionUtil; + +/** + * Request handler for GetGeometryDataRequest. Data returned is in + * form of GetGeometryDataResponse objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 30, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public final class GetGeometryDataHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public GetGeometryDataResponse handleRequest( + final GetGeometryDataRequest request) throws Exception { + IGeometryData[] geoData = new IGeometryData[0]; + + if (!CollectionUtil.isNullOrEmpty(request.getRequestedTimes())) { + geoData = DataAccessLayer.getGeometryData(request + .getRequestParameters(), request.getRequestedTimes() + .toArray(new DataTime[request.getRequestedTimes().size()])); + } else { + geoData = DataAccessLayer.getGeometryData( + request.getRequestParameters(), + request.getRequestedPeriod()); + } + + GetGeometryDataResponse response = new GetGeometryDataResponse( + Arrays.asList(geoData)); + return response; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGridDataHandler.java b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGridDataHandler.java new file mode 100644 index 0000000000..1ce5055a7d --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dataaccess/src/com/raytheon/uf/edex/dataaccess/handler/GetGridDataHandler.java @@ -0,0 +1,79 @@ +/** + * 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. + **/ +package com.raytheon.uf.edex.dataaccess.handler; + +import java.util.Arrays; + +import com.raytheon.uf.common.dataaccess.DataAccessLayer; +import com.raytheon.uf.common.dataaccess.grid.IGridData; +import com.raytheon.uf.common.dataaccess.request.GetGridDataRequest; +import com.raytheon.uf.common.dataaccess.response.GetGridDataResponse; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.util.CollectionUtil; + +/** + * Request handler for GetGridDataRequest. Data returned is in form + * of GetGridDataResponse objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public final class GetGridDataHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public GetGridDataResponse handleRequest(final GetGridDataRequest request) + throws Exception { + IGridData[] gridData = new IGridData[0]; + + if (!CollectionUtil.isNullOrEmpty(request.getRequestedTimes())) { + gridData = DataAccessLayer.getGridData(request + .getRequestParameters(), request.getRequestedTimes() + .toArray(new DataTime[request.getRequestedTimes().size()])); + } else { + gridData = DataAccessLayer.getGridData( + request.getRequestParameters(), + request.getRequestedPeriod()); + } + + GetGridDataResponse response = new GetGridDataResponse( + Arrays.asList(gridData)); + return response; + } +} diff --git a/pythonPackages/dynamicserialize/adapters/JTSEnvelopeAdapter.py b/pythonPackages/dynamicserialize/adapters/JTSEnvelopeAdapter.py new file mode 100644 index 0000000000..6446e49ae3 --- /dev/null +++ b/pythonPackages/dynamicserialize/adapters/JTSEnvelopeAdapter.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.vividsolutions.jts.geom.Envelope +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/29/13 2023 dgilling Initial Creation. +# +# + +from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Envelope + +ClassAdapter = 'com.vividsolutions.jts.geom.Envelope' + +def serialize(context, envelope): + context.writeDouble(envelope.getMinX()) + context.writeDouble(envelope.getMaxX()) + context.writeDouble(envelope.getMinY()) + context.writeDouble(envelope.getMaxY()) + +def deserialize(context): + env = Envelope() + env.setMinX(context.readDouble()) + env.setMaxX(context.readDouble()) + env.setMinY(context.readDouble()) + env.setMaxY(context.readDouble()) + return env + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/__init__.py index 2c658821b8..33ec91b5cd 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/__init__.py @@ -24,6 +24,7 @@ __all__ = [ 'activetable', 'alertviz', 'auth', + 'dataaccess', 'dataplugin', 'datastorage', 'localization', diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/__init__.py new file mode 100644 index 0000000000..01f7e51227 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/__init__.py @@ -0,0 +1,29 @@ +## +# 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 by PythonFileGenerator + +__all__ = [ + 'impl', + 'request', + 'response' + ] + + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.py new file mode 100644 index 0000000000..a2e198d7d7 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/DefaultDataRequest.py @@ -0,0 +1,91 @@ +## +# 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 then modified post-generation to sub-class IDataRequest. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 2023 dgilling Initial Creation. +# +# + + +from ufpy.dataaccess import IDataRequest + +from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Envelope +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level + + +class DefaultDataRequest(IDataRequest): + + def __init__(self): + self.datatype = None + self.identifiers = {} + self.parameters = [] + self.levels = [] + self.locationNames = [] + self.envelope = None + + def setDatatype(self, datatype): + self.datatype = str(datatype) + + def addIdentifier(self, key, value): + self.identifiers[key] = value + + def setParameters(self, *params): + self.parameters = map(str, params) + + def setLevels(self, *levels): + self.levels = map(self.__makeLevel, levels) + + def __makeLevel(self, level): + if type(level) is Level: + return level + elif type(level) is str: + return Level(level) + else: + raise TypeError("Invalid object type specified for level.") + + def setEnvelope(self, env): + self.envelope = Envelope(env.envelope) + + def setLocationNames(self, *locationNames): + self.locationNames = map(str, locationNames) + + def getDatatype(self): + return self.datatype + + def getIdentifiers(self): + return self.identifiers + + def getParameters(self): + return self.parameters + + def getLevels(self): + return self.levels + + def getEnvelope(self): + return self.envelope + + def getLocationNames(self): + return self.locationNames diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/__init__.py new file mode 100644 index 0000000000..8ceb2f0d24 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/impl/__init__.py @@ -0,0 +1,28 @@ +## +# 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 by PythonFileGenerator + +__all__ = [ + 'DefaultDataRequest' + ] + +from DefaultDataRequest import DefaultDataRequest + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.py new file mode 100644 index 0000000000..6d350f9221 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/AbstractDataAccessRequest.py @@ -0,0 +1,46 @@ +## +# 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 then modified post-generation to make it a abstract base class. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 #2023 dgilling Initial Creation. +# +# + +import abc + + +class AbstractDataAccessRequest(object): + __metaclass__ = abc.ABCMeta + + def __init__(self): + self.requestParameters = None + + def getRequestParameters(self): + return self.requestParameters + + def setRequestParameters(self, requestParameters): + self.requestParameters = requestParameters + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.py new file mode 100644 index 0000000000..23d5962354 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableLocationNamesRequest.py @@ -0,0 +1,40 @@ +## +# 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 then modified post-generation to make it sub class +# AbstractDataAccessRequest. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest + +class GetAvailableLocationNamesRequest(AbstractDataAccessRequest): + + def __init__(self): + super(GetAvailableLocationNamesRequest, self).__init__() + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.py new file mode 100644 index 0000000000..b168f0f322 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetAvailableTimesRequest.py @@ -0,0 +1,41 @@ +## +# 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 then modified post-generation to make it sub class +# AbstractDataAccessRequest. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest + + +class GetAvailableTimesRequest(AbstractDataAccessRequest): + + def __init__(self): + super(GetAvailableTimesRequest, self).__init__() + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.py new file mode 100644 index 0000000000..e5566bc87d --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGeometryDataRequest.py @@ -0,0 +1,54 @@ +## +# 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 then modified post-generation to make it sub class +# AbstractDataAccessRequest. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest + +class GetGeometryDataRequest(AbstractDataAccessRequest): + + def __init__(self): + super(GetGeometryDataRequest, self).__init__() + self.requestedTimes = None + self.requestedPeriod = None + + def getRequestedTimes(self): + return self.requestedTimes + + def setRequestedTimes(self, requestedTimes): + self.requestedTimes = requestedTimes + + def getRequestedPeriod(self): + return self.requestedPeriod + + def setRequestedPeriod(self, requestedPeriod): + self.requestedPeriod = requestedPeriod + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.py new file mode 100644 index 0000000000..e580807ebf --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/GetGridDataRequest.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. +## + +# File auto-generated against equivalent DynamicSerialize Java class +# and then modified post-generation to make it sub class +# AbstractDataAccessRequest. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/28/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import AbstractDataAccessRequest + +class GetGridDataRequest(AbstractDataAccessRequest): + + def __init__(self): + super(GetGridDataRequest, self).__init__() + self.requestedTimes = None + self.requestedPeriod = None + + def getRequestedTimes(self): + return self.requestedTimes + + def setRequestedTimes(self, requestedTimes): + self.requestedTimes = requestedTimes + + def getRequestedPeriod(self): + return self.requestedPeriod + + def setRequestedPeriod(self, requestedPeriod): + self.requestedPeriod = requestedPeriod diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/__init__.py new file mode 100644 index 0000000000..6369b05b14 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/request/__init__.py @@ -0,0 +1,36 @@ +## +# 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 by PythonFileGenerator + +__all__ = [ + 'AbstractDataAccessRequest', + 'GetAvailableLocationNamesRequest', + 'GetAvailableTimesRequest', + 'GetGeometryDataRequest', + 'GetGridDataRequest' + ] + +from AbstractDataAccessRequest import AbstractDataAccessRequest +from GetAvailableLocationNamesRequest import GetAvailableLocationNamesRequest +from GetAvailableTimesRequest import GetAvailableTimesRequest +from GetGeometryDataRequest import GetGeometryDataRequest +from GetGridDataRequest import GetGridDataRequest + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py new file mode 100644 index 0000000000..1c0330a53a --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py @@ -0,0 +1,59 @@ +## +# 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 + +import abc + + +class AbstractResponseData(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def __init__(self): + self.time = None + self.level = None + self.locationName = None + self.attributes = None + + def getTime(self): + return self.time + + def setTime(self, time): + self.time = time + + def getLevel(self): + return self.level + + def setLevel(self, level): + self.level = level + + def getLocationName(self): + return self.locationName + + def setLocationName(self, locationName): + self.locationName = locationName + + def getAttributes(self): + return self.attributes + + def setAttributes(self, attributes): + self.attributes = attributes + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py new file mode 100644 index 0000000000..8df2cd336c --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GeometryResponseData.py @@ -0,0 +1,52 @@ +## +# 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 then modified post-generation to use AbstractResponseData. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/04/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData + +class GeometryResponseData(AbstractResponseData): + + def __init__(self): + super(GeometryResponseData, self).__init__() + self.dataMap = None + self.geometryWKT = None + + def getDataMap(self): + return self.dataMap + + def setDataMap(self, dataMap): + self.dataMap = dataMap + + def getGeometryWKT(self): + return self.geometryWKT + + def setGeometryWKT(self, geometryWKT): + self.geometryWKT = geometryWKT diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.py new file mode 100644 index 0000000000..e1f635f301 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGeometryDataResponse.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. +## + +# File auto-generated against equivalent DynamicSerialize Java class + +class GetGeometryDataResponse(object): + + def __init__(self): + self.geoData = None + + def getGeoData(self): + return self.geoData + + def setGeoData(self, geoData): + self.geoData = geoData + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.py new file mode 100644 index 0000000000..0e2544aec9 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGridDataResponse.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. +## + +# File auto-generated against equivalent DynamicSerialize Java class + +class GetGridDataResponse(object): + + def __init__(self): + self.gridData = None + self.siteNxValues = None + self.siteNyValues = None + self.siteLatGrids = None + self.siteLonGrids = None + + def getGridData(self): + return self.gridData + + def setGridData(self, gridData): + self.gridData = gridData + + def getSiteNxValues(self): + return self.siteNxValues + + def setSiteNxValues(self, siteNxValues): + self.siteNxValues = siteNxValues + + def getSiteNyValues(self): + return self.siteNyValues + + def setSiteNyValues(self, siteNyValues): + self.siteNyValues = siteNyValues + + def getSiteLatGrids(self): + return self.siteLatGrids + + def setSiteLatGrids(self, siteLatGrids): + self.siteLatGrids = siteLatGrids + + def getSiteLonGrids(self): + return self.siteLonGrids + + def setSiteLonGrids(self, siteLonGrids): + self.siteLonGrids = siteLonGrids + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GridResponseData.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GridResponseData.py new file mode 100644 index 0000000000..7a00d47d88 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GridResponseData.py @@ -0,0 +1,59 @@ +## +# 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 then modified post-generation to use AbstractResponseData. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/04/13 #2023 dgilling Initial Creation. +# +# + + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData + +class GridResponseData(AbstractResponseData): + + def __init__(self): + super(GridResponseData, self).__init__() + self.parameter = None + self.unit = None + self.gridData = None + + def getParameter(self): + return self.parameter + + def setParameter(self, parameter): + self.parameter = parameter + + def getUnit(self): + return self.unit + + def setUnit(self, unit): + self.unit = unit + + def getGridData(self): + return self.gridData + + def setGridData(self, gridData): + self.gridData = gridData diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/__init__.py new file mode 100644 index 0000000000..d9ae6823ce --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/__init__.py @@ -0,0 +1,36 @@ +## +# 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 by PythonFileGenerator + +__all__ = [ + 'AbstractResponseData', + 'GeometryResponseData', + 'GetGeometryDataResponse', + 'GetGridDataResponse', + 'GridResponseData' + ] + +from AbstractResponseData import AbstractResponseData +from GeometryResponseData import GeometryResponseData +from GetGeometryDataResponse import GetGeometryDataResponse +from GetGridDataResponse import GetGridDataResponse +from GridResponseData import GridResponseData + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py index 69fe7e3bf4..3effe594ce 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py @@ -24,6 +24,7 @@ __all__ = [ 'gfe', 'grib', 'grid', + 'level', 'message' ] diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py new file mode 100644 index 0000000000..2953f0dd9d --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/Level.py @@ -0,0 +1,90 @@ +## +# 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 then modified post-generation to add additional features to better +# match Java implementation. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/29/13 2023 dgilling Initial Creation. +# +# + + +import numpy +import re + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import MasterLevel + + +LEVEL_NAMING_REGEX = re.compile("(\d*)((_(\d*))??([a-zA-Z]+))") +INVALID_VALUE = numpy.float64(-999999) + +class Level(object): + + def __init__(self, levelString=None): + self.id = 0L + self.identifier = None + self.masterLevel = None + self.levelonevalue = INVALID_VALUE + self.leveltwovalue = INVALID_VALUE + + if levelString is not None: + matcher = LEVEL_NAMING_REGEX.match(str(levelString)) + if matcher is not None: + self.levelonevalue = numpy.float64(matcher.group(1)) + self.masterLevel = MasterLevel.MasterLevel(matcher.group(5)) + levelTwo = matcher.group(4) + if levelTwo: + self.leveltwovalue = numpy.float64(levelTwo) + + def getId(self): + return self.id + + def setId(self, id): + self.id = id + + def getMasterLevel(self): + return self.masterLevel + + def setMasterLevel(self, masterLevel): + self.masterLevel = masterLevel + + def getLevelonevalue(self): + return self.levelonevalue + + def setLevelonevalue(self, levelonevalue): + self.levelonevalue = numpy.float64(levelonevalue) + + def getLeveltwovalue(self): + return self.leveltwovalue + + def setLeveltwovalue(self, leveltwovalue): + self.leveltwovalue = numpy.float64(leveltwovalue) + + def getIdentifier(self): + return self.identifier + + def setIdentifier(self, identifier): + self.identifier = identifier + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py new file mode 100644 index 0000000000..409bae6ae3 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/MasterLevel.py @@ -0,0 +1,71 @@ +## +# 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 then modified post-generation to add additional features to better +# match Java implementation. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/29/13 2023 dgilling Initial Creation. +# +# + +class MasterLevel(object): + + def __init__(self, name=None): + self.name = name + self.description = None + self.unitString = None + self.type = None + self.identifier = None + + def getName(self): + return self.name + + def setName(self, name): + self.name = name + + def getDescription(self): + return self.description + + def setDescription(self, description): + self.description = description + + def getUnitString(self): + return self.unitString + + def setUnitString(self, unitString): + self.unitString = unitString + + def getType(self): + return self.type + + def setType(self, type): + self.type = type + + def getIdentifier(self): + return self.identifier + + def setIdentifier(self, identifier): + self.identifier = identifier + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/__init__.py new file mode 100644 index 0000000000..61f14827e5 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/level/__init__.py @@ -0,0 +1,30 @@ +## +# 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 by PythonFileGenerator + +__all__ = [ + 'Level', + 'MasterLevel' + ] + +from Level import Level +from MasterLevel import MasterLevel + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py index a1b7dda618..badc253449 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/time/DataTime.py @@ -19,11 +19,23 @@ ## # 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. +# 05/28/13 2023 dgilling Implement __str__(). +# +# import calendar import datetime import numpy import time +import StringIO from dynamicserialize.dstypes.java.util import Date from dynamicserialize.dstypes.java.util import EnumSet @@ -39,10 +51,7 @@ class DataTime(object): ValueError("Invalid validPeriod object specified for DataTime.") self.validPeriod = validPeriod if validPeriod is not None else None self.utilityFlags = EnumSet('com.raytheon.uf.common.time.DataTime$FLAG') - # Only way to get a Double type to Java is to use numpy.float64 type, - # which means we need to create an array to hold this single Double value. - # FIXME: Find a better way to store doubles - self.levelValue = numpy.array([-1.0], dtype=numpy.float64) + self.levelValue = numpy.float64(-1.0) if self.refTime is not None: if isinstance(self.refTime, datetime.datetime): @@ -62,11 +71,42 @@ class DataTime(object): self.validPeriod.setEnd(validTimeMills/1000) # figure out utility flags - if fcstTime is not None: + if fcstTime: self.utilityFlags.add("FCST_USED") - if self.validPeriod.getStart() != self.validPeriod.getEnd(): + if self.validPeriod and self.validPeriod.isValid(): self.utilityFlags.add("PERIOD_USED") + def __str__(self): + buffer = StringIO.StringIO() + + if self.refTime is not None: + refTimeInSecs = self.refTime.getTime() / 1000 + dtObj = datetime.datetime.utcfromtimestamp(refTimeInSecs) + buffer.write(dtObj.isoformat(' ')) + + if "FCST_USED" in self.utilityFlags: + hrs = int(self.fcstTime / 3600) + mins = int((self.fcstTime - (hrs * 3600)) / 60) + buffer.write(" (" + str(hrs)) + if mins != 0: + buffer.write(":" + str(mins)) + buffer.write(")") + + if "PERIOD_USED" in self.utilityFlags: + buffer.write("[") + startTimeInSecs = self.validPeriod.getStartInMillis() / 1000 + dtObj = datetime.datetime.utcfromtimestamp(startTimeInSecs) + buffer.write(dtObj.isoformat(' ')) + buffer.write("--") + endTimeInSecs = self.validPeriod.getEndInMillis() / 1000 + dtObj = datetime.datetime.utcfromtimestamp(endTimeInSecs) + buffer.write(dtObj.isoformat(' ')) + buffer.write("]") + + strVal = buffer.getvalue() + buffer.close() + return strVal + def getRefTime(self): return self.refTime @@ -92,8 +132,8 @@ class DataTime(object): self.utilityFlags = utilityFlags def getLevelValue(self): - return self.levelValue[0] + return self.levelValue def setLevelValue(self, levelValue): - self.levelValue[0] = levelValue + self.levelValue = numpy.float64(levelValue) diff --git a/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/Envelope.py b/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/Envelope.py new file mode 100644 index 0000000000..2ad017ecfd --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/Envelope.py @@ -0,0 +1,68 @@ +## +# 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. +## + +# This class is a dummy implementation of the +# com.vividsolutions.jts.geom.Envelope class. It was simply created to allow +# serialization/deserialization of IDataRequest objects from the Data Access +# Framework. This should be re-implemented if useful work needs to be +# performed against serialized Envelope objects. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/29/13 2023 dgilling Initial Creation. +# +# + +class Envelope(object): + + def __init__(self, env=None): + self.maxx = -1.0 + self.maxy = -1.0 + self.minx = 0.0 + self.miny = 0.0 + if env is not None: + (self.minx, self.miny, self.maxx, self.maxy) = env.bounds + + def getMaxX(self): + return self.maxx + + def getMaxY(self): + return self.maxy + + def getMinX(self): + return self.minx + + def getMinY(self): + return self.miny + + def setMaxX(self, value): + self.maxx = value + + def setMaxY(self, value): + self.maxy = value + + def setMinX(self, value): + self.minx = value + + def setMinY(self, value): + self.miny = value + diff --git a/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/__init__.py index 2040f49fdf..f4e07340a8 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/vividsolutions/jts/geom/__init__.py @@ -22,9 +22,11 @@ __all__ = [ 'Coordinate', + 'Envelope', 'Geometry' ] from Coordinate import Coordinate +from Envelope import Envelope from Geometry import Geometry diff --git a/pythonPackages/ufpy/dataaccess/DataAccessLayer.py b/pythonPackages/ufpy/dataaccess/DataAccessLayer.py index 849682c2f2..9e9e85bb2c 100644 --- a/pythonPackages/ufpy/dataaccess/DataAccessLayer.py +++ b/pythonPackages/ufpy/dataaccess/DataAccessLayer.py @@ -27,24 +27,31 @@ # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- -# 12/10/12 njensen Initial Creation. +# 12/10/12 njensen Initial Creation. # Feb 14, 2013 1614 bsteffen refactor data access framework # to use single request. -# 4/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. # # # import sys +import subprocess -if sys.modules.has_key('jep'): +THRIFT_HOST = subprocess.check_output( + "source /awips2/fxa/bin/setup.env; echo $DEFAULT_HOST", + shell=True).strip() +USING_NATIVE_THRIFT = False + +try: import JepRouter - router = JepRouter -else: - # router = ThriftClientRouter() - import exceptions - raise exceptions.NotImplementedError("Must use inside a JVM until ThriftClient support is added") + router = JepRouter +except ImportError: + from ufpy.dataaccess import ThriftClientRouter + router = ThriftClientRouter.ThriftClientRouter(THRIFT_HOST) + USING_NATIVE_THRIFT = True def getAvailableTimes(request): @@ -113,5 +120,16 @@ def newDataRequest(): """ return router.newDataRequest() - - +def changeEDEXHost(newHostName): + """" + Changes the EDEX host the Data Access Framework is communicating with. Only + works if using the native Python client implemenation, otherwise, this + method will throw a TypeError. + """ + if USING_NATIVE_THRIFT: + global THRIFT_HOST + THRIFT_HOST = newHostName + global router + router = ThriftClientRouter.ThriftClientRouter(THRIFT_HOST) + else: + raise TypeError("Cannot call changeEDEXHost when using JepRouter.") diff --git a/pythonPackages/ufpy/dataaccess/PyData.py b/pythonPackages/ufpy/dataaccess/PyData.py new file mode 100644 index 0000000000..0d1a1effe0 --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/PyData.py @@ -0,0 +1,57 @@ +## +# 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. +## + +# +# Implements IData for use by native Python clients to the Data Access +# Framework. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/03/13 dgilling Initial Creation. +# +# + +from ufpy.dataaccess import IData + +class PyData(IData): + + def __init__(self, dataRecord): + self.__time = dataRecord.getTime() + self.__level = dataRecord.getLevel() + self.__locationName = dataRecord.getLocationName() + self.__attributes = dataRecord.getAttributes() + + def getAttribute(self, key): + return self.__attributes[key] + + def getAttributes(self): + return self.__attributes.keys() + + def getDataTime(self): + return self.__time + + def getLevel(self): + return self.__level + + def getLocationName(self): + return self.__locationName diff --git a/pythonPackages/ufpy/dataaccess/PyGeometryData.py b/pythonPackages/ufpy/dataaccess/PyGeometryData.py new file mode 100644 index 0000000000..20926760cb --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/PyGeometryData.py @@ -0,0 +1,77 @@ +## +# 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. +## + +# +# Implements IGeometryData for use by native Python clients to the Data Access +# Framework. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/03/13 dgilling Initial Creation. +# +# + +from ufpy.dataaccess import IGeometryData +from ufpy.dataaccess import PyData +import shapely.wkt + + +class PyGeometryData(IGeometryData, PyData.PyData): + + def __init__(self, geoDataRecord): + PyData.PyData.__init__(self, geoDataRecord) + self.__geometry = shapely.wkt.loads(geoDataRecord.getGeometry()) + self.__dataMap = {} + tempDataMap = geoDataRecord.getDataMap() + for key, value in tempDataMap.items(): + self.__dataMap[key] = (value[0], value[1], value[2]) + + def getGeometry(self): + return self.__geometry + + def getParameters(self): + return self.__dataMap.keys() + + def getString(self, param): + value = self.__dataMap[param][0] + return str(value) + + def getNumber(self, param): + value = self.__dataMap[param][0] + t = self.getType(param) + if t == 'INT': + return int(value) + elif t == 'LONG': + return long(value) + elif t == 'FLOAT': + return float(value) + elif t == 'DOUBLE': + return float(value) + else: + return value + + def getUnit(self, param): + return self.__dataMap[param][2] + + def getType(self, param): + return self.__dataMap[param][1] diff --git a/pythonPackages/ufpy/dataaccess/PyGridData.py b/pythonPackages/ufpy/dataaccess/PyGridData.py new file mode 100644 index 0000000000..eff189871a --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/PyGridData.py @@ -0,0 +1,72 @@ +# # +# 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. +# # + +# +# Implements IGridData for use by native Python clients to the Data Access +# Framework. +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/03/13 #2023 dgilling Initial Creation. +# +# + + +import numpy +import warnings + +from ufpy.dataaccess import IGridData +from ufpy.dataaccess import PyData + +NO_UNIT_CONVERT_WARNING = """ +The ability to unit convert grid data is not currently available in this version of the Data Access Framework. +""" + + +class PyGridData(IGridData, PyData.PyData): + + def __init__(self, gridDataRecord, nx, ny, latLonGrid): + PyData.PyData.__init__(self, gridDataRecord) + nx = nx + ny = ny + self.__parameter = gridDataRecord.getParameter() + self.__unit = gridDataRecord.getUnit() + self.__gridData = numpy.reshape(numpy.array(gridDataRecord.getGridData()), (nx, ny)) + self.__latLonGrid = latLonGrid + + def getParameter(self): + return self.__parameter + + def getUnit(self): + return self.__unit + + def getRawData(self, unit=None): + # TODO: Find a proper python library that deals will with numpy and + # javax.measure style unit strings and hook it in to this method to + # allow end-users to perform unit conversion for grid data. + if unit is not None: + warnings.warn(NO_UNIT_CONVERT_WARNING, stacklevel=2) + return self.__gridData + + def getLatLonCoords(self): + return self.__latLonGrid diff --git a/pythonPackages/ufpy/dataaccess/ThriftClientRouter.py b/pythonPackages/ufpy/dataaccess/ThriftClientRouter.py new file mode 100644 index 0000000000..8e8fac6dd4 --- /dev/null +++ b/pythonPackages/ufpy/dataaccess/ThriftClientRouter.py @@ -0,0 +1,113 @@ +# # +# 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. +# # + +# +# Routes requests to the Data Access Framework through Python Thrift. +# +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 05/21/13 #2023 dgilling Initial Creation. +# + + +import numpy + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.impl import DefaultDataRequest +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetAvailableLocationNamesRequest +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetAvailableTimesRequest +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetGeometryDataRequest +from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetGridDataRequest + +from ufpy import ThriftClient +from ufpy.dataaccess import PyGeometryData +from ufpy.dataaccess import PyGridData + +class ThriftClientRouter(object): + + def __init__(self, host='localhost'): + self._client = ThriftClient.ThriftClient(host) + + def getAvailableTimes(self, request): + timesRequest = GetAvailableTimesRequest() + timesRequest.setRequestParameters(request) + response = self._client.sendRequest(timesRequest) + return response + + def getGridData(self, request, times): + gridDataRequest = GetGridDataRequest() + gridDataRequest.setRequestParameters(request) + # if we have an iterable times instance, then the user must have asked + # for grid data with the List of DataTime objects + # else, we assume it was a single TimeRange that was meant for the + # request + try: + iter(times) + gridDataRequest.setRequestedTimes(times) + except TypeError: + gridDataRequest.setRequestedPeriod(times) + response = self._client.sendRequest(gridDataRequest) + + locSpecificData = {} + locNames = response.getSiteNxValues().keys() + for location in locNames: + nx = response.getSiteNxValues()[location] + ny = response.getSiteNyValues()[location] + latData = numpy.reshape(numpy.array(response.getSiteLatGrids()[location]), (nx, ny)) + lonData = numpy.reshape(numpy.array(response.getSiteLonGrids()[location]), (nx, ny)) + locSpecificData[location] = (nx, ny, (lonData, latData)) + + retVal = [] + for gridDataRecord in response.getGridData(): + locationName = gridDataRecord.getLocationName() + locData = locSpecificData[locationName] + retVal.append(PyGridData.PyGridData(gridDataRecord, locData[0], locData[1], locData[2])) + return retVal + + def getGeometryData(self, request, times): + geoDataRequest = GetGeometryDataRequest() + geoDataRequest.setRequestParameters(request) + # if we have an iterable times instance, then the user must have asked + # for geometry data with the List of DataTime objects + # else, we assume it was a single TimeRange that was meant for the + # request + try: + iter(times) + geoDataRequest.setRequestedTimes(times) + except TypeError: + geoDataRequest.setRequestedPeriod(times) + response = self._client.sendRequest(geoDataRequest) + + retVal = [] + for geoDataRecord in response.getGeoData(): + retVal.append(PyGeometryData.PyGeometryData(geoDataRecord)) + return retVal + + def getAvailableLocationNames(self, request): + locNamesRequest = GetAvailableLocationNamesRequest() + locNamesRequest.setRequestParameters(request) + response = self._client.sendRequest(locNamesRequest) + return response + + def newDataRequest(self): + return DefaultDataRequest() diff --git a/pythonPackages/ufpy/dataaccess/__init__.py b/pythonPackages/ufpy/dataaccess/__init__.py index 482dfb8398..89c8a700d1 100644 --- a/pythonPackages/ufpy/dataaccess/__init__.py +++ b/pythonPackages/ufpy/dataaccess/__init__.py @@ -30,8 +30,9 @@ # 12/10/12 njensen Initial Creation. # Feb 14, 2013 1614 bsteffen refactor data access framework # to use single request. -# Apr 09, 2013 1871 njensen Add doc strings -# +# Apr 09, 2013 1871 njensen Add doc strings +# Jun 03, 2013 2023 dgilling Add getAttributes to IData, add +# getLatLonGrids() to IGridData. # # @@ -182,6 +183,16 @@ class IData(object): """ return + @abc.abstractmethod + def getAttributes(self): + """ + Gets the valid attributes for the data. + + Returns: + a list of strings of the attribute names + """ + return + @abc.abstractmethod def getDataTime(self): """ @@ -249,6 +260,17 @@ class IGridData(IData): a numpy array of the data """ return + + @abc.abstractmethod + def getLatLonCoords(self): + """ + Gets the lat/lon coordinates of the grid data. + + Returns: + a tuple where the first element is a numpy array of lons, and the + second element is a numpy array of lats + """ + return