From a83301c1e919f831a3b24bd4af6230d138252bfb Mon Sep 17 00:00:00 2001 From: Bryan Kowal Date: Wed, 2 Jul 2014 15:58:50 -0500 Subject: [PATCH 1/9] Omaha #3339 - allow deployment of a WA-specific esb directory to provide EDEX configuration. The WA-specific directory is assumed to be in the edex directory of the work assignment and named deploy.edex-${NAME} where ${NAME} is the name of the Work Assignment. Former-commit-id: 03364fb2cdde0b7d7f5456335c99bae433628711 --- .../build.edex/deploy-common/deploy-esb.xml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/edexOsgi/build.edex/deploy-common/deploy-esb.xml b/edexOsgi/build.edex/deploy-common/deploy-esb.xml index f257cadbeb..040323265b 100644 --- a/edexOsgi/build.edex/deploy-common/deploy-esb.xml +++ b/edexOsgi/build.edex/deploy-common/deploy-esb.xml @@ -10,6 +10,11 @@ + + + + + @@ -17,6 +22,32 @@ + + + + + + + + + + + + + + + + + + + + + + From f064f0d102cca0ff42d05193df465411b1527a36 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Mon, 7 Jul 2014 07:55:29 -0500 Subject: [PATCH 2/9] Omaha #3348 Handle Enter event on Open's tree and text field. Change-Id: I3409e7cdee6c97d7d7f2c320ba0ac233fbf602d4 Former-commit-id: 29cc43c5f9b43a51b24b702f04f0a62fab1bd356 --- .../ui/dialogs/procedures/ProcedureListDlg.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java index 8b7ec79fc1..caa5de2bdf 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java @@ -73,6 +73,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * error, cleaned up code to prevent buttons * from magically appearing, removed dead code, * and other code clean up. + * 03 Jul 2014 #3348 rferrel Handle Enter event. * * * @@ -257,6 +258,15 @@ public class ProcedureListDlg extends CaveSWTDialog { */ if (this.mode == Mode.OPEN) { procedureTF.setEditable(false); + procedureTF.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (procedureTF.getText().length() > 0) { + selectAction(); + } + } + }); } } @@ -332,6 +342,11 @@ public class ProcedureListDlg extends CaveSWTDialog { } } } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + selectAction(); + } }); treeViewer.getTree().addMouseListener(new MouseAdapter() { From 24faa482334ab75e6a4eee931920d235bc7fa455 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Wed, 2 Jul 2014 14:47:47 -0500 Subject: [PATCH 3/9] Omaha #3149 Limit number of grids returned by GFE to constrain size of Thrift response Change-Id: I525cb3a69128425f8dddede0d3b32d44937613bc Former-commit-id: 1e9e5abc477785c5b8cda9dd214da7de83532b9f --- .../viz/gfe/core/internal/IFPClient.java | 35 ++++-- .../res/spring/gfe-request.xml | 9 +- .../edex/plugin/gfe/server/GridParm.java | 9 +- .../server/handler/GetGridDataHandler.java | 106 +++++++++++++++++- .../handler/GetPythonGridDataHandler.java | 94 ---------------- .../edex/plugin/gfe/smartinit/IFPWE.java | 31 +---- .../gfe/dataaccess/GFEDataAccessUtil.java | 8 +- .../gfe/request/GetPythonGridDataRequest.java | 52 --------- .../gfe/server/request/GetGridRequest.java | 60 ++-------- .../gfe/request/GetPythonGridDataRequest.py | 33 ------ .../common/dataplugin/gfe/request/__init__.py | 2 - 11 files changed, 152 insertions(+), 287 deletions(-) delete mode 100644 edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPythonGridDataHandler.java delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.java delete mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.py diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/IFPClient.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/IFPClient.java index 6ab2f7b386..be67141a61 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/IFPClient.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/IFPClient.java @@ -120,6 +120,8 @@ import com.raytheon.viz.gfe.core.parm.Parm; * 11/20/2013 #2331 randerso Added getTopoData method * 04/03/2014 #2737 randerso Moved clientISCSendStatus to SaveGFEGridRequest * 04/09/2014 #3004 dgilling Support moved ClearPracticeVTECTableRequest. + * 07/01/2014 #3149 randerso Changed getGridData to handle limited number of grids returned + * and re-request if not all data returned * * * @@ -563,21 +565,34 @@ public class IFPClient { * @return List of grid slices * @throws GFEServerException */ + @SuppressWarnings("unchecked") public List getGridData(ParmID parmId, List gridTimes) throws GFEServerException { - return getGridData(parmId, gridTimes, false); - } - - @SuppressWarnings("unchecked") - public List getGridData(ParmID parmId, - List gridTimes, boolean convertUnit) - throws GFEServerException { GetGridRequest req = new GetGridRequest(parmId, gridTimes); - req.setConvertUnit(convertUnit); GetGridDataRequest request = new GetGridDataRequest(); request.addRequest(req); - ServerResponse resp = makeRequest(request); - List slices = (List) resp.getPayload(); + + List slices = new ArrayList(gridTimes.size()); + while (slices.size() < gridTimes.size()) { + ServerResponse> resp = (ServerResponse>) makeRequest(request); + slices.addAll(resp.getPayload()); + + // if no slices returned (shouldn't happen unless server code is + // broken) + if (slices.isEmpty()) { + String msg = "No data returned from GetGridDataRequest for " + + parmId + " for times:" + req.getTimes(); + statusHandler.error(msg); + throw new GFEServerException(msg); + } + + // if not all slices returned + if (slices.size() < gridTimes.size()) { + // request remaining times. + req.setTimes(gridTimes.subList(slices.size(), gridTimes.size())); + } + } + return slices; } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml index dd70b126be..2de0a0e13c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml @@ -52,16 +52,13 @@ - + + + - - - - - diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParm.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParm.java index 992f1aa255..b211138f39 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParm.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParm.java @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; import com.raytheon.edex.plugin.gfe.db.dao.GFEDao; -import com.raytheon.edex.plugin.gfe.server.database.D2DGridDatabase; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.lock.LockManager; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; @@ -76,6 +75,7 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory; * 04/23/13 #1949 rjpeter Removed excess validation on retrieval, added * inventory for a given time range. * 06/13/13 #2044 randerso Refactored to use non-singleton LockManager + * 07/01/2014 #3149 randerso Removed unit conversion (unused) * * * @author bphillip @@ -325,12 +325,7 @@ public class GridParm { if (!CollectionUtil.isNullOrEmpty(reqTimes)) { // Get the data - if (getRequest.isConvertUnit() && (db instanceof D2DGridDatabase)) { - sr = ((D2DGridDatabase) db).getGridData(id, reqTimes, - getRequest.isConvertUnit()); - } else { - sr = db.getGridData(id, reqTimes); - } + sr = db.getGridData(id, reqTimes); if (!sr.isOkay()) { sr.addMessage("Failure in retrieving grid data from GridDatabase"); return sr; diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetGridDataHandler.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetGridDataHandler.java index 2be0e9cf5c..db917c20d8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetGridDataHandler.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetGridDataHandler.java @@ -20,23 +20,35 @@ package com.raytheon.edex.plugin.gfe.server.handler; +import java.util.Arrays; import java.util.List; +import com.raytheon.edex.plugin.gfe.server.GridParmManager; +import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo; +import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.request.GetGridDataRequest; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; +import com.raytheon.uf.common.dataplugin.gfe.server.request.GetGridRequest; import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice; import com.raytheon.uf.common.serialization.comm.IRequestHandler; +import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.common.util.SizeUtil; /** * GFE task for getting grid data slices * + * May return less than the full amount of data requested if returned grids + * exceed MAX_BYTES_PER_REQUEST in total size. The requestor is expected to + * re-request remaining data. + * *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * 04/18/08     #875       bphillip    Initial Creation
  * 09/22/09     3058       rjpeter     Converted to IRequestHandler
- * 06/13/13     2044       randerso     Refactored to use IFPServer
+ * 06/13/13     2044       randerso    Refactored to use IFPServer
+ * 07/01/2014  #3149       randerso    Changed to limit size of data returned
  * 
* * @author randerso @@ -44,10 +56,98 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler; */ public class GetGridDataHandler extends BaseGfeRequestHandler implements IRequestHandler { + + private int byteLimitInMB = 100; + + /** + * @return the byteLimitInMB + */ + public int getByteLimitInMB() { + return this.byteLimitInMB; + } + + /** + * @param byteLimitInMB + * the byteLimitInMB to set + */ + public void setByteLimitInMB(int byteLimitInMB) { + this.byteLimitInMB = byteLimitInMB; + } + @Override public ServerResponse> handleRequest( GetGridDataRequest request) throws Exception { - return getIfpServer(request).getGridParmMgr().getGridData( - request.getRequests()); + ServerResponse> sr = new ServerResponse>(); + + GridParmManager gpm = getIfpServer(request).getGridParmMgr(); + int gridCount = 0; + int remaining = (int) (this.byteLimitInMB * SizeUtil.BYTES_PER_MB * 0.9); + List data = null; + for (GetGridRequest req : request.getRequests()) { + ParmID parmId = req.getParmId(); + List times = req.getTimes(); + + ServerResponse ss1 = gpm.getGridParmInfo(parmId); + if (!ss1.isOkay()) { + sr.addMessages(ss1); + return sr; + } + GridParmInfo gpi = ss1.getPayload(); + + int gridSize = gpi.getGridLoc().getNx() * gpi.getGridLoc().getNy(); + switch (gpi.getGridType()) { + case SCALAR: + gridSize *= 4; + break; + + case VECTOR: + gridSize *= 8; + break; + + case WEATHER: + case DISCRETE: + break; + + default: + break; + } + + int maxGrids = remaining / gridSize; + // ensure we return at least 1 grid + if ((maxGrids == 0) && (gridCount == 0)) { + maxGrids = 1; + } + + // no more grids will fit break out of loop + if (maxGrids == 0) { + break; + } + + if (maxGrids < times.size()) { + // truncate the request + times = times.subList(0, maxGrids); + req.setTimes(times); + } + gridCount += times.size(); + remaining -= times.size() * gridSize; + + ServerResponse> ssr = gpm.getGridData(Arrays + .asList(req)); + if (ssr.isOkay()) { + if (data == null) { + data = ssr.getPayload(); + } else { + data.addAll(ssr.getPayload()); + } + } else { + sr.addMessages(ssr); + break; + } + } + + if (sr.isOkay()) { + sr.setPayload(data); + } + return sr; } } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPythonGridDataHandler.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPythonGridDataHandler.java deleted file mode 100644 index 439e74cd3b..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPythonGridDataHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * 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.edex.plugin.gfe.server.handler; - -import java.util.ArrayList; -import java.util.List; - -import com.raytheon.uf.common.dataplugin.gfe.request.GetPythonGridDataRequest; -import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; -import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice; -import com.raytheon.uf.common.dataplugin.gfe.slice.PythonWeatherGridSlice; -import com.raytheon.uf.common.dataplugin.gfe.slice.WeatherGridSlice; -import com.raytheon.uf.common.serialization.comm.IRequestHandler; - -/** - * Handler for GetPythonGridDataRequest - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 4, 2011            dgilling     Initial creation
- * Jun 13, 2013     #2044  randerso     Refactored to use IFPServer
- * 
- * 
- * - * @deprecated use the Data Access Framework - * - * @author dgilling - * @version 1.0 - */ - -// TODO: REMOVE THIS CLASS AND ITS REQUEST TYPE if -// DiscreteDefinition/DiscreteKey and WxDefinition/WeatherKey class hierarchy is -// ever fully-implemented in Python. - -@Deprecated -public class GetPythonGridDataHandler extends BaseGfeRequestHandler implements - IRequestHandler { - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest - * (com.raytheon.uf.common.serialization.comm.IServerRequest) - */ - @Override - public ServerResponse> handleRequest( - GetPythonGridDataRequest request) throws Exception { - ServerResponse> finalResp = new ServerResponse>(); - - ServerResponse> sr = getIfpServer(request) - .getGridParmMgr().getGridData(request.getRequests()); - if (!sr.isOkay()) { - finalResp.addMessages(sr); - finalResp.setPayload(new ArrayList(0)); - return finalResp; - } - - // convert grid slices as needed - List slices = new ArrayList(sr.getPayload() - .size()); - for (IGridSlice slice : sr.getPayload()) { - if (!(slice instanceof WeatherGridSlice)) { - slices.add(slice); - } else { - slices.add(new PythonWeatherGridSlice((WeatherGridSlice) slice)); - } - } - finalResp.setPayload(slices); - - return finalResp; - } -} diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java index 28d5c03562..8ceec41829 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java @@ -89,6 +89,7 @@ import com.raytheon.uf.common.util.Pair; * Added getKeys(tr) to get grid times overlapping a time range * Removed caching of inventory as it was not being updated when * grids were updated/deleted + * Jul 01, 2014 #3149 randerso Changed to use updated GetGridRequest. Cleaned up code * * * @@ -201,39 +202,19 @@ public class IFPWE { * @throws GfeException */ public IGridSlice getItem(TimeRange timeRange) throws GfeException { - GetGridRequest req = new GetGridRequest(); - req.setParmId(parmId); - GFERecord gfeRec = new GFERecord(parmId, timeRange); - ArrayList gfeList = new ArrayList(); - gfeList.add(gfeRec); - req.setRecords(gfeList); + GetGridRequest req = new GetGridRequest(parmId, + Arrays.asList(timeRange)); ArrayList reqList = new ArrayList(); reqList.add(req); - List data = new ArrayList(); ServerResponse> ssr = gridParmMgr.getGridData(reqList); - data = ssr.getPayload(); - - IGridSlice slice = null; - if ((data == null) || (data.size() == 0)) { + if (!ssr.isOkay()) { String msg = "Error getting grid data for " + parmId.toString() - + " at time " + timeRange.toString(); - for (ServerMsg smsg : ssr.getMessages()) { - msg += "\n" + smsg.getMessage(); - } + + " at time " + timeRange.toString() + ssr.message(); throw new GfeException(msg); - } else if (data.size() > 1) { - // theoretically should never get here - String msg = "Retrieved too much data for " + parmId.toString() - + "at time " + timeRange.toString(); - for (ServerMsg smsg : ssr.getMessages()) { - msg += "\n" + smsg.getMessage(); - } - throw new GfeException(msg); - } else { - slice = data.get(0); } + IGridSlice slice = ssr.getPayload().get(0); return slice; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEDataAccessUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEDataAccessUtil.java index 4a32e089d3..a7cb1b06a1 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEDataAccessUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEDataAccessUtil.java @@ -43,9 +43,10 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 9, 2011 bsteffen Initial creation - * May 02, 2013 1949 bsteffen Update GFE data access in Product + * May 02, 2013 1949 bsteffen Update GFE data access in Product * Browser, Volume Browser, and Data Access * Framework. + * Jul 01, 2014 3149 randerso Changed to use updated GetGridRequest * * * @@ -96,9 +97,8 @@ public class GFEDataAccessUtil { * @throws Exception */ public static IGridSlice getSlice(GFERecord gfeRecord) throws Exception { - GetGridRequest gridRequest = new GetGridRequest(); - gridRequest.setParmId(gfeRecord.getParmId()); - gridRequest.setRecords(Arrays.asList(gfeRecord)); + GetGridRequest gridRequest = new GetGridRequest(gfeRecord.getParmId(), + Arrays.asList(gfeRecord.getDataTime().getValidPeriod())); GetGridDataRequest request = new GetGridDataRequest(); request.setSiteID(gfeRecord.getDbId().getSiteId()); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.java deleted file mode 100644 index 70a0cb7184..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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.dataplugin.gfe.request; - -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; - -/** - * This class is only intended for use with Python clients as it returns - * IGridSlices in a way that can be easily deserialized by Python without - * requiring full implementation the Java class hierarchy. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 4, 2011            dgilling     Initial creation
- * 
- * 
- * - * @deprecated use the Data Access Framework - * - * @author dgilling - * @version 1.0 - */ - -// TODO: REMOVE THIS CLASS AND ITS HANDLER if DiscreteDefinition/DiscreteKey and -// WxDefinition/WeatherKey class hierarchy is ever fully-implemented in Python. - -@Deprecated -@DynamicSerialize -public class GetPythonGridDataRequest extends GetGridDataRequest { - -} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/request/GetGridRequest.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/request/GetGridRequest.java index db0be8f9da..830626b6e8 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/request/GetGridRequest.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/request/GetGridRequest.java @@ -20,12 +20,9 @@ package com.raytheon.uf.common.dataplugin.gfe.server.request; -import java.util.ArrayList; import java.util.List; -import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; -import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.time.TimeRange; @@ -38,6 +35,8 @@ import com.raytheon.uf.common.time.TimeRange; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 04/08/08 #875 bphillip Initial Creation + * 07/01/2014 #3149 randerso Simplified to contain only a ParmID and + * list of TimeRanges. * * * @@ -46,41 +45,18 @@ import com.raytheon.uf.common.time.TimeRange; */ @DynamicSerialize -public class GetGridRequest implements ISerializableObject { +public class GetGridRequest { /** The records to be saved */ @DynamicSerializeElement - private List records; + private List times; /** The parmID of the request */ @DynamicSerializeElement private ParmID parmId; - /** - * Denotes whether the data retrieved from this request will be converted to - * match the corresponding grid parm info - */ - - @DynamicSerializeElement - private boolean convertUnit = false; - - /** - * @return the convertUnit - */ - public boolean isConvertUnit() { - return convertUnit; - } - - /** - * @param convertUnit - * the convertUnit to set - */ - public void setConvertUnit(boolean convertUnit) { - this.convertUnit = convertUnit; - } - /** * Creates a new GetGridRequest */ @@ -96,19 +72,9 @@ public class GetGridRequest implements ISerializableObject { * @param times * The times of the requested grids */ - public GetGridRequest(List records) { - if (records.size() > 0) { - parmId = records.get(0).getParmId(); - } - this.records = records; - } - - public GetGridRequest(ParmID parmId, List trs) { + public GetGridRequest(ParmID parmId, List times) { this.parmId = parmId; - records = new ArrayList(); - for (TimeRange tr : trs) { - records.add(new GFERecord(parmId, tr)); - } + this.times = times; } public ParmID getParmId() { @@ -120,19 +86,11 @@ public class GetGridRequest implements ISerializableObject { } public List getTimes() { - List times = new ArrayList(); - for (GFERecord rec : records) { - times.add(rec.getTimeRange()); - } - return times; + return this.times; } - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; + public void setTimes(List times) { + this.times = times; } } diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.py deleted file mode 100644 index 2f7021b78d..0000000000 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/GetPythonGridDataRequest.py +++ /dev/null @@ -1,33 +0,0 @@ -## -# 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 - - -from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import GetGridDataRequest - -class GetPythonGridDataRequest(GetGridDataRequest): - - def __init__(self): - super(GetPythonGridDataRequest, self).__init__() - - ## nothing to implement here that isn't already covered by GetGridDataRequest ## - ## Just need the separate class for de-serialization. ## - diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py index 3c5c9d18e7..da186c3ae7 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py @@ -35,7 +35,6 @@ __all__ = [ 'GetLockTablesRequest', 'GetOfficialDbNameRequest', 'GetParmListRequest', - 'GetPythonGridDataRequest', 'GetSelectTimeRangeRequest', 'GetSingletonDbIdsRequest', 'GetSiteTimeZoneInfoRequest', @@ -64,7 +63,6 @@ from GetLatestModelDbIdRequest import GetLatestModelDbIdRequest from GetLockTablesRequest import GetLockTablesRequest from GetOfficialDbNameRequest import GetOfficialDbNameRequest from GetParmListRequest import GetParmListRequest -from GetPythonGridDataRequest import GetPythonGridDataRequest from GetSelectTimeRangeRequest import GetSelectTimeRangeRequest from GetSingletonDbIdsRequest import GetSingletonDbIdsRequest from GetSiteTimeZoneInfoRequest import GetSiteTimeZoneInfoRequest From e4795f6a13aee9d33b2d7e5cd53061435b5cc79b Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Mon, 7 Jul 2014 14:18:35 -0500 Subject: [PATCH 4/9] Omaha #3333 removed redundant field from viz lightning Change-Id: I3821f7991757f97b976bac8cde502da977ea0978 Former-commit-id: 2e701ade395cb2ec81d86af714fad825e146dc25 --- .../.settings/org.eclipse.jdt.core.prefs | 11 --- .../META-INF/MANIFEST.MF | 2 +- .../viz/lightning/LightningResource.java | 85 +++++++++---------- .../viz/lightning/LightningResourceData.java | 46 +--------- .../binlightning/LightningConstants.java | 5 ++ .../dataaccess/BinLightningAccessFactory.java | 10 ++- 6 files changed, 55 insertions(+), 104 deletions(-) delete mode 100644 cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs diff --git a/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab1683..0000000000 --- a/cave/com.raytheon.viz.lightning/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF index f13676a8cf..753a2728d7 100644 --- a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Lightning Plug-in Bundle-SymbolicName: com.raytheon.viz.lightning;singleton:=true -Bundle-Version: 1.14.0 +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: Raytheon Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0", com.raytheon.viz.core, diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index 09a6dd8303..a29d2fe636 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -39,6 +39,7 @@ import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; @@ -101,7 +102,8 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; * Jan 21, 2014 2667 bclement renamed record's lightSource field to source * Jun 05, 2014 3226 bclement reference datarecords by LightningConstants * Jun 06, 2014 DR 17367 D. Friedman Fix cache object usage. - * Jun 19, 2014 3214 bclement added pulse and could flash support + * Jun 19, 2014 3214 bclement added pulse and cloud flash support + * Jul 07, 2014 3333 bclement removed lightSource field * * * @@ -136,16 +138,13 @@ public class LightningResource extends private DataTime frameTime; - private String lightSource; - private List newRecords = new ArrayList(); private List processed = new ArrayList(); - public LightningFrameMetadata(DataTime frameTime, BinOffset offset, String ls) { + public LightningFrameMetadata(DataTime frameTime, BinOffset offset) { this.frameTime = frameTime; this.offset = offset; - this.lightSource = ls; } @Override @@ -178,11 +177,6 @@ public class LightningResource extends return false; } else if (!offset.equals(other.offset)) return false; - if (lightSource == null) { - if (other.lightSource != null) - return false; - } else if (!lightSource.equals(other.lightSource)) - return false; return true; } @@ -246,8 +240,6 @@ public class LightningResource extends private String resourceName; - private String lightSource; - private int posAdj; private IFont font; @@ -261,13 +253,12 @@ public class LightningResource extends private List currPulseList = Collections.emptyList(); public LightningResource(LightningResourceData resourceData, - LoadProperties loadProperties, String ls, int pa) { + LoadProperties loadProperties, int pa) { super(resourceData, loadProperties); resourceData.addChangeListener(this); this.dataTimes = new ArrayList(); this.cacheObjectMap = new ConcurrentHashMap>(); - this.lightSource = ls; this.posAdj = pa; } @@ -334,26 +325,30 @@ public class LightningResource extends if (this.resourceData.isExclusiveForType()) { String modifier; if (this.resourceData.isHandlingCloudFlashes()) { - modifier = "Cloud Flash"; + modifier = "Cloud Flash "; } else if (this.resourceData.isHandlingNegativeStrikes()) { - modifier = "Negative"; + modifier = "Negative "; } else if (this.resourceData.isHandlingPositiveStrikes()) { - modifier = "Positive"; + modifier = "Positive "; } else if (this.resourceData.isHandlingPulses()) { - modifier = "Pulse"; + modifier = "Pulse "; } else { - modifier = ""; + /* space to preserve formatting */ + modifier = " "; } this.resourceName = timeString + modifier; } else { this.resourceName = timeString; } - String lightType = " "; - if (!this.lightSource.isEmpty()) { - lightType += this.lightSource + " "; + HashMap metadata = this.resourceData + .getMetadataMap(); + if (metadata != null && metadata.containsKey(LightningConstants.SOURCE)) { + this.resourceName += metadata.get(LightningConstants.SOURCE) + .getConstraintValue() + " "; } - this.resourceName += lightType + "Lightning Plot "; + + this.resourceName += "Lightning Plot "; } private String convertTimeIntervalToString(int time) { @@ -575,30 +570,28 @@ public class LightningResource extends Map> recordMap = new HashMap>(); for (BinLightningRecord obj : objs) { - if (obj.getSource().equals(this.lightSource) || this.lightSource.isEmpty()) { - DataTime time = new DataTime(obj.getStartTime()); - DataTime end = new DataTime(obj.getStopTime()); - time = this.getResourceData().getBinOffset() - .getNormalizedTime(time); - end = this.getResourceData().getBinOffset().getNormalizedTime(end); + DataTime time = new DataTime(obj.getStartTime()); + DataTime end = new DataTime(obj.getStopTime()); + time = this.getResourceData().getBinOffset() + .getNormalizedTime(time); + end = this.getResourceData().getBinOffset().getNormalizedTime(end); - // check for frames in the middle - // get interval ( in seconds ) between frames - int interval = this.getResourceData().getBinOffset().getInterval(); - while (end.greaterThan(time) || end.equals(time)) { - List records = recordMap.get(time); - if (records == null) { - records = new ArrayList(); - recordMap.put(time, records); - } - records.add(obj); + // check for frames in the middle + // get interval ( in seconds ) between frames + int interval = this.getResourceData().getBinOffset().getInterval(); + while (end.greaterThan(time) || end.equals(time)) { + List records = recordMap.get(time); + if (records == null) { + records = new ArrayList(); + recordMap.put(time, records); + } + records.add(obj); - // increment to the next time - long newTime = time.getRefTime().getTime() + (interval * 1000); - TimeRange range = new TimeRange(newTime, newTime); - time = new DataTime(newTime, range); - } - } + // increment to the next time + long newTime = time.getRefTime().getTime() + (interval * 1000); + TimeRange range = new TimeRange(newTime, newTime); + time = new DataTime(newTime, range); + } } for (Map.Entry> entry : recordMap @@ -617,7 +610,7 @@ public class LightningResource extends if (co == null) { // New frame LightningFrameMetadata key = new LightningFrameMetadata(dt, - resourceData.getBinOffset(), this.lightSource); + resourceData.getBinOffset()); co = CacheObject.newCacheObject(key, resourceBuilder); cacheObjectMap.put(dt, co); dataTimes.add(dt); diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java index 3335cc48d1..7999d03838 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResourceData.java @@ -28,8 +28,6 @@ import javax.xml.bind.annotation.XmlAttribute; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -47,7 +45,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; * ------------ ---------- ----------- -------------------------- * Feb 18, 2009 chammack Initial creation * Feb 27, 2013 DCS 152 jgerth Support for WWLLN and multiple sources - * Jun 19, 2014 3214 bclement added pulse and could flash support + * Jun 19, 2014 3214 bclement added pulse and cloud flash support + * Jul 07, 2014 3333 bclement removed plotLightSource field * * * @@ -71,29 +70,14 @@ public class LightningResourceData extends AbstractRequestableResourceData { @XmlAttribute private boolean handlingPulses = false; - @XmlAttribute - private String plotLightSource = ""; - @XmlAttribute private int countPosition = 0; @Override protected AbstractVizResource constructResource( LoadProperties loadProperties, PluginDataObject[] objects) { - // jjg add - String ls = ""; - if (this.metadataMap.containsKey("lightSource")) - ls = this.metadataMap.get("lightSource").getConstraintValue(); - else if (!plotLightSource.isEmpty()) { - ls = plotLightSource; - RequestConstraint lsrc = new RequestConstraint(ls, ConstraintType.EQUALS); - this.metadataMap.put("lightSource", lsrc); - } - int pa = 0; - if (countPosition != 0) - pa = countPosition; - // end - LightningResource rsc = new LightningResource(this, loadProperties, ls, pa); + LightningResource rsc = new LightningResource(this, loadProperties, + countPosition); List records = new ArrayList( objects.length); for (PluginDataObject pdo : objects) { @@ -208,21 +192,6 @@ public class LightningResourceData extends AbstractRequestableResourceData { this.handlingPulses = handlingPulses; } - /** - * @return plotLightSource the lightSource to get - JJG - */ - public String getPlotLightSource() { - return plotLightSource; - } - - /** - * @param plotLightSource - * the lightSource to set - JJG - */ - public void setPlotLightSource(String plotLightSource) { - this.plotLightSource = plotLightSource; - } - /** * @return countPosition * the countPosition to get - JJG @@ -253,8 +222,6 @@ public class LightningResourceData extends AbstractRequestableResourceData { result = prime * result + (handlingNegativeStrikes ? 1231 : 1237); result = prime * result + (handlingPositiveStrikes ? 1231 : 1237); result = prime * result + (handlingPulses ? 1231 : 1237); - result = prime * result - + ((plotLightSource == null) ? 0 : plotLightSource.hashCode()); return result; } @@ -282,11 +249,6 @@ public class LightningResourceData extends AbstractRequestableResourceData { return false; if (handlingPulses != other.handlingPulses) return false; - if (plotLightSource == null) { - if (other.plotLightSource != null) - return false; - } else if (!plotLightSource.equals(other.plotLightSource)) - return false; return true; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/LightningConstants.java b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/LightningConstants.java index 28a1787038..73471697bf 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/LightningConstants.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/LightningConstants.java @@ -29,6 +29,7 @@ package com.raytheon.uf.common.dataplugin.binlightning; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 30, 2014 3226 bclement Initial creation + * Jul 07, 2014 3333 bclement added SOURCE * * * @@ -39,6 +40,10 @@ public class LightningConstants { public static final String PULSE_HDF5_GROUP_SUFFIX = "pulse"; + // metadata column names + + public static final String SOURCE = "source"; + // HDF5 dataset names public static final String TIME_DATASET = "obsTime"; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/dataaccess/BinLightningAccessFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/dataaccess/BinLightningAccessFactory.java index 9658cc7a11..5fdc6b1747 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/dataaccess/BinLightningAccessFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/dataaccess/BinLightningAccessFactory.java @@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataaccess.impl.AbstractDataPluginFactory; import com.raytheon.uf.common.dataaccess.impl.DefaultGeometryData; import com.raytheon.uf.common.dataaccess.util.PDOUtil; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; +import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.DataStoreFactory; @@ -70,6 +71,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; * ------------- -------- ----------- -------------------------- * Jan 21, 2014 2667 bclement Initial creation * Feb 06, 2014 2672 bsteffen Add envelope support + * Jul 07, 2014 3333 bclement now uses lightning constants * * * @@ -78,18 +80,18 @@ import com.vividsolutions.jts.geom.GeometryFactory; */ public class BinLightningAccessFactory extends AbstractDataPluginFactory { - private static final String sourceKey = "source"; + private static final String sourceKey = LightningConstants.SOURCE; private static final IUFStatusHandler log = UFStatus .getHandler(BinLightningRecord.class); private static final GeometryFactory geomFactory = new GeometryFactory(); - private static final String timeKey = "obsTime"; + private static final String timeKey = LightningConstants.TIME_DATASET; - private static final String latKey = "latitude"; + private static final String latKey = LightningConstants.LAT_DATASET; - private static final String lonKey = "longitude"; + private static final String lonKey = LightningConstants.LON_DATASET; private static final String[] requiredKeys = { timeKey, latKey, lonKey }; From 886aee2bf9c0e44848c6226f3c9a7b99bd38403e Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 7 Jul 2014 17:32:37 -0500 Subject: [PATCH 5/9] Omaha #3356 remove common register buddies to uf.viz.core Change-Id: I8da0d7bb51c7aa3585c29ada43ba9d6470ec41e4 Former-commit-id: 3fc986e2d7b24a6a3a9642a9bb0c71b296573a68 --- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 9 ++++----- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 20 +++++++++---------- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 6 +++--- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 11 +++++----- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 6 +++--- .../.settings/org.eclipse.jdt.core.prefs | 8 -------- .../META-INF/MANIFEST.MF | 7 +++---- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 6 +++--- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 4 ++-- .../.settings/org.eclipse.jdt.core.prefs | 7 ------- .../META-INF/MANIFEST.MF | 5 ++--- 18 files changed, 35 insertions(+), 103 deletions(-) delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.cwat/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.qc/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.qpf/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.scan/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.taf/.settings/org.eclipse.jdt.core.prefs delete mode 100644 edexOsgi/com.raytheon.uf.edex.plugin.vil/.settings/org.eclipse.jdt.core.prefs diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a9b4b2c48f..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Wed Jun 03 14:27:16 CDT 2009 -eclipse.preferences.version=1 -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.common.dataplugin.cwat/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/META-INF/MANIFEST.MF index 611558179c..0404f6a93e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.cwat/META-INF/MANIFEST.MF @@ -2,17 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Cwat Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.cwat -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.serialization, com.raytheon.uf.common.monitor;bundle-version="1.11.5", - com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.radar, com.raytheon.uf.common.geospatial, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.datastorage -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.common.dataplugin.cwat -Import-Package: org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5374cbb1d2..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Mon Jun 22 13:46:54 CDT 2009 -eclipse.preferences.version=1 -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.common.dataplugin.ffmp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF index 57b6d02bed..a2f275258b 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: FFMP common Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.ffmp -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: com.raytheon.uf.common.dataplugin.ffmp, com.raytheon.uf.common.dataplugin.ffmp.dataaccess Require-Bundle: javax.persistence;bundle-version="1.0.0", @@ -14,16 +14,16 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.hydro;bundle-version="1.11.11", com.raytheon.uf.common.mpe;bundle-version="1.11.11", com.raytheon.uf.common.localization;bundle-version="1.11.13", - com.raytheon.uf.common.status;bundle-version="1.12.1174", + com.raytheon.uf.common.status, com.raytheon.uf.common.site, - com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174", - com.raytheon.uf.common.cache;bundle-version="1.12.1174", - com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", - com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.shef, + com.raytheon.uf.common.cache, + com.raytheon.uf.common.serialization.comm, + com.raytheon.uf.common.dataplugin.grid, + com.raytheon.uf.common.dataaccess, com.google.guava;bundle-version="1.0.0", javax.measure;bundle-version="1.0.0", - com.raytheon.uf.common.message;bundle-version="1.12.1174", + com.raytheon.uf.common.message, com.raytheon.uf.common.dataquery, com.raytheon.uf.common.datastorage, com.raytheon.uf.common.dataplugin diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4347b9fd90..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Wed Jan 20 03:11:47 CST 2010 -eclipse.preferences.version=1 -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.common.dataplugin.ldadmesonet/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/META-INF/MANIFEST.MF index b820892007..cf6035ed6a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ldadmesonet/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Ldadmesonet Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.ldadmesonet -Bundle-Version: 1.12.1174.qualifier -Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization +Bundle-Version: 1.14.0.qualifier +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: com.raytheon.edex.common, com.raytheon.uf.common.pointdata;bundle-version="1.11.16", com.raytheon.uf.edex.pointdata;bundle-version="1.11.16", diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8e2cd0bfa6..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Jan 26 15:25:37 CST 2010 -eclipse.preferences.version=1 -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.common.dataplugin.preciprate/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/META-INF/MANIFEST.MF index e181fabf76..68a6d7bfaa 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.preciprate/META-INF/MANIFEST.MF @@ -2,20 +2,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Perciprate Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.preciprate -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.serialization, org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.monitor;bundle-version="1.11.5", - com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.radar, javax.measure;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.geospatial, com.raytheon.uf.common.datastorage Export-Package: com.raytheon.uf.common.dataplugin.preciprate -Import-Package: com.raytheon.uf.common.status, - org.apache.commons.logging +Import-Package: com.raytheon.uf.common.status diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.qc/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.qc/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d08e0b1b4a..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.qc/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Mon Nov 30 10:06:00 CST 2009 -eclipse.preferences.version=1 -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.common.dataplugin.qc/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.qc/META-INF/MANIFEST.MF index 7be3aae700..6796338a3c 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.qc/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.qc/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Qc Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.qc -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: com.raytheon.edex.common;bundle-version="1.11.17", javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.pointdata;bundle-version="1.12.1161", diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e615689e31..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Dec 16 08:21:55 CST 2010 -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.common.dataplugin.qpf/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/META-INF/MANIFEST.MF index f8dd63b523..7cf7318aba 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.qpf/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: QPF common Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.qpf -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: com.raytheon.uf.common.dataplugin.qpf Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.serialization, @@ -14,4 +14,3 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.uf.common.geospatial, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.datastorage -Import-Package: org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3800bc0605..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Mar 16 15:54:19 CDT 2010 -eclipse.preferences.version=1 -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.common.dataplugin.scan/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF index 49cbb488cf..0a3fa06c13 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: QPF common Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.scan -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Export-Package: com.raytheon.uf.common.dataplugin.scan, com.raytheon.uf.common.dataplugin.scan.data Require-Bundle: javax.persistence;bundle-version="1.0.0", diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.taf/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.taf/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 02f4db20f0..0000000000 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.taf/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Mar 26 10:25:50 CDT 2009 -eclipse.preferences.version=1 -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.common.dataplugin.taf/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.taf/META-INF/MANIFEST.MF index 32db4d81a2..aaa196ab11 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.taf/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.taf/META-INF/MANIFEST.MF @@ -3,12 +3,12 @@ Bundle-ManifestVersion: 1 Bundle-Name: Taf Plug-in Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.taf Bundle-Version: 1.14.0.qualifier -Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Bundle-Vendor: RAYTHEON Export-Package: com.raytheon.uf.common.dataplugin.taf Require-Bundle: org.apache.commons.lang, javax.persistence -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.annotations, com.raytheon.uf.common.dataplugin.persist, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.vil/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.vil/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index dde8ffb174..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.vil/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun Nov 15 13:01:55 CST 2009 -eclipse.preferences.version=1 -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.plugin.vil/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF index 6465f62d6c..3d30f44039 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF @@ -2,9 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Vil Plug-in Bundle-SymbolicName: com.raytheon.uf.edex.plugin.vil -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core Require-Bundle: com.raytheon.uf.common.monitor, com.raytheon.uf.edex.cpgsrv;resolution:=optional, com.raytheon.uf.common.dataplugin.vil, @@ -22,7 +21,7 @@ Import-Package: com.raytheon.edex.urifilter, com.raytheon.uf.common.util.registry, com.raytheon.uf.edex.plugin.scan.common, org.apache.commons.logging -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.edex.plugin.vil, com.raytheon.uf.edex.plugin.vil.common From 29fc7e7ec485bde2a11194ff2c53cadc48b92f60 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Mon, 7 Jul 2014 12:20:23 -0500 Subject: [PATCH 6/9] Omaha #3333 added grid lightning to cave Change-Id: I4e5d21c39168bac285125a39fd148fe69906f221 Former-commit-id: 33736a713a2c360e70f5a06972a7a21937f2b34c --- .../META-INF/MANIFEST.MF | 12 +- .../bundles/GridLightningCGPlot.xml | 50 ++ .../bundles/GridLightningCloudFlashPlot.xml | 50 ++ .../bundles/GridLightningPulsePlot.xml | 50 ++ .../bundles/GridLightningTotalFlashPlot.xml | 50 ++ .../lightning/gridLightningBundleItems.xml | 74 +++ .../lightning/gridLightningMenuItems.xml | 52 ++ .../menus/lightning/lightningMenuItems.xml | 15 + cave/com.raytheon.viz.lightning/plugin.xml | 7 + .../viz/lightning/GridLightningResource.java | 343 +++++++++++++ .../lightning/GridLightningResourceData.java | 119 +++++ .../viz/lightning/LightningResource.java | 465 +++--------------- .../viz/lightning/cache/LightningFrame.java | 148 ++++++ .../cache/LightningFrameMetadata.java | 119 +++++ .../cache/LightningFrameRetriever.java | 398 +++++++++++++++ .../colormaps/Grid Lightning Density.cmap | 259 ++++++++++ .../gridLightningImageryStyleRules.xml | 35 ++ 17 files changed, 1839 insertions(+), 407 deletions(-) create mode 100644 cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCGPlot.xml create mode 100644 cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCloudFlashPlot.xml create mode 100644 cave/com.raytheon.viz.lightning/localization/bundles/GridLightningPulsePlot.xml create mode 100644 cave/com.raytheon.viz.lightning/localization/bundles/GridLightningTotalFlashPlot.xml create mode 100644 cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningBundleItems.xml create mode 100644 cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningMenuItems.xml create mode 100644 cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/GridLightningResource.java create mode 100644 cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/GridLightningResourceData.java create mode 100644 cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrame.java create mode 100644 cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameMetadata.java create mode 100644 cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameRetriever.java create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/colormaps/Grid Lightning Density.cmap create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/styleRules/gridLightningImageryStyleRules.xml diff --git a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF index 753a2728d7..30167a4d8e 100644 --- a/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.lightning/META-INF/MANIFEST.MF @@ -2,12 +2,18 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Lightning Plug-in Bundle-SymbolicName: com.raytheon.viz.lightning;singleton:=true -Bundle-Version: 1.14.0.qualifier +Bundle-Version: 1.14.1.qualifier Bundle-Vendor: Raytheon Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0", com.raytheon.viz.core, - com.raytheon.viz.ui + com.raytheon.viz.ui, + com.raytheon.viz.grid;bundle-version="1.14.0", + com.raytheon.uf.common.style;bundle-version="1.0.0", + com.raytheon.uf.common.colormap;bundle-version="1.14.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.lightning Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Import-Package: com.raytheon.uf.viz.productbrowser +Import-Package: com.raytheon.uf.common.numeric.buffer, + com.raytheon.uf.common.numeric.filter, + com.raytheon.uf.common.numeric.source, + com.raytheon.uf.viz.productbrowser diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCGPlot.xml b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCGPlot.xml new file mode 100644 index 0000000000..31d0870bfe --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCGPlot.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCloudFlashPlot.xml b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCloudFlashPlot.xml new file mode 100644 index 0000000000..29fa54ea2e --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningCloudFlashPlot.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningPulsePlot.xml b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningPulsePlot.xml new file mode 100644 index 0000000000..f0fde0d580 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningPulsePlot.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningTotalFlashPlot.xml b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningTotalFlashPlot.xml new file mode 100644 index 0000000000..d724651116 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/bundles/GridLightningTotalFlashPlot.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningBundleItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningBundleItems.xml new file mode 100644 index 0000000000..b6f0a391b9 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningBundleItems.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningMenuItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningMenuItems.xml new file mode 100644 index 0000000000..6785227b61 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/gridLightningMenuItems.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/localization/menus/lightning/lightningMenuItems.xml b/cave/com.raytheon.viz.lightning/localization/menus/lightning/lightningMenuItems.xml index 7b8e8c08f1..81f32286f9 100644 --- a/cave/com.raytheon.viz.lightning/localization/menus/lightning/lightningMenuItems.xml +++ b/cave/com.raytheon.viz.lightning/localization/menus/lightning/lightningMenuItems.xml @@ -24,14 +24,29 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.lightning/plugin.xml b/cave/com.raytheon.viz.lightning/plugin.xml index 11af5d972e..9192637f31 100644 --- a/cave/com.raytheon.viz.lightning/plugin.xml +++ b/cave/com.raytheon.viz.lightning/plugin.xml @@ -29,6 +29,13 @@ renderingOrderId="PLOT" resourceType="PLAN_VIEW"> + + + * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Jul 7, 2014 3333 bclement Initial creation + * + * + * + * @author bclement + * @version 1.0 + */ +public class GridLightningResource extends + AbstractGridResource { + + public static final String DENSITY_PARAM = "lightning density"; + + private final Map> cacheObjectMap = new ConcurrentHashMap<>(); + + /** + * @param resourceData + * @param loadProperties + */ + protected GridLightningResource(GridLightningResourceData resourceData, + LoadProperties loadProperties) { + super(resourceData, loadProperties); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.grid.rsc.general.AbstractGridResource#getMatchCriteria() + */ + @Override + public ParamLevelMatchCriteria getMatchCriteria() { + ParamLevelMatchCriteria rval = new ParamLevelMatchCriteria(); + rval.setParameterName(Arrays.asList(DENSITY_PARAM)); + return rval; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.grid.rsc.general.AbstractGridResource# + * createColorMapParameters + * (com.raytheon.viz.grid.rsc.general.GeneralGridData) + */ + @Override + protected ColorMapParameters createColorMapParameters(GeneralGridData data) + throws VizException { + ColorMapParameters rval = super.createColorMapParameters(data); + rval.setNoDataValue(0); + return rval; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.grid.rsc.general.AbstractGridResource#disposeInternal() + */ + @Override + protected void disposeInternal() { + cacheObjectMap.clear(); + super.disposeInternal(); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.grid.rsc.general.AbstractGridResource#remove(com.raytheon + * .uf.common.time.DataTime) + */ + @Override + public void remove(DataTime dataTime) { + cacheObjectMap.remove(dataTime); + super.remove(dataTime); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.grid.rsc.general.AbstractGridResource#getData(com.raytheon + * .uf.common.time.DataTime, java.util.List) + */ + @Override + public List getData(DataTime time, + List pdos) throws VizException { + CoordinateReferenceSystem crs = descriptor.getCRS(); + GeneralGridGeometry gridGeom = descriptor.getGridGeometry(); + int kmResolution = resourceData.getKmResolution(); + /* convert to meters to match projection dimension units */ + int mResolution = kmResolution * 1000; + int nx = getAxisDimension(0, mResolution); + int ny = getAxisDimension(1, mResolution); + GridEnvelope gridRange = new GridEnvelope2D(0, 0, nx, ny); + GeneralGridGeometry imageGeometry = new GeneralGridGeometry(gridRange, + gridGeom.getEnvelope()); + + MathTransform latLonToGrid = getLonLatTransform(crs, imageGeometry); + + /* + * use shorts to save space, a grid cell is unlikely to contain over 64K + * strikes + */ + short[] data = new short[nx * ny]; + + LightningFrame frame = getFrame(time, pdos); + + List> iterators = new ArrayList<>(4); + if (resourceData.isHandlingPositiveStrikes()) { + iterators.add(frame.getPosLatLonList().iterator()); + } + if (resourceData.isHandlingNegativeStrikes()) { + iterators.add(frame.getNegLatLonList().iterator()); + } + if (resourceData.isHandlingCloudFlashes()) { + iterators.add(frame.getCloudLatLonList().iterator()); + } + if (resourceData.isHandlingPulses()) { + iterators.add(frame.getPulseLatLonList().iterator()); + } + + for (Iterator iter : iterators) { + while (iter.hasNext()) { + double[] lonLat = iter.next(); + DirectPosition2D src = new DirectPosition2D(lonLat[0], + lonLat[1]); + DirectPosition2D dest = new DirectPosition2D(); + try { + latLonToGrid.transform(src, dest); + } catch (Exception e) { + throw new VizException(e.getLocalizedMessage(), e); + } + int gridX = (int) Math.round(dest.x); + int gridY = (int) Math.round(dest.y); + int index = (nx * gridY) + gridX; + if (index < data.length) { + data[(nx * gridY) + gridX] += 1; + } + } + } + + ShortBufferWrapper source = new ShortBufferWrapper(data, nx, ny); + GeneralGridData gridData = GeneralGridData.createScalarData( + imageGeometry, UnsignedFilter.apply(source), Unit.ONE); + return Arrays.asList(gridData); + } + + /** + * Get updated frame from cache + * + * @param time + * @param pdos + * @return + */ + private LightningFrame getFrame(DataTime time, List pdos) { + LightningFrameRetriever retriever = LightningFrameRetriever + .getInstance(); + CacheObject co; + synchronized (cacheObjectMap) { + co = cacheObjectMap.get(time); + if (co == null) { + /* + * no local reference to cache object, create key and get cache + * object which may be new or from another resource + */ + LightningFrameMetadata key = new LightningFrameMetadata(time, + resourceData.getBinOffset()); + co = CacheObject.newCacheObject(key, retriever); + cacheObjectMap.put(time, co); + } + } + + return retriever.updateAndGet(ensurePdoType(pdos), co); + } + + /** + * @param pdos + * @return list of all BinLightningRecords in pdos + */ + private List ensurePdoType(List pdos) { + List rval = new ArrayList<>(pdos.size()); + for (PluginDataObject pdo : pdos) { + if (pdo instanceof BinLightningRecord) { + rval.add((BinLightningRecord) pdo); + } + } + return rval; + } + + /** + * Get grid dimension for ordinal axis using the provided resolution. Uses + * the CRS and grid geometry of the descriptor. + * + * @param axis + * 0 for x, 1 for y + * @param mResolution + * in meters + * @return + */ + private int getAxisDimension(int axis, int mResolution) { + CoordinateReferenceSystem crs = descriptor.getCRS(); + GeneralGridGeometry gridGeometry = descriptor.getGridGeometry(); + CoordinateSystemAxis csa = crs.getCoordinateSystem().getAxis(axis); + Unit crsUnit = csa.getUnit(); + UnitConverter converter = crsUnit.getConverterTo(SI.METER); + Envelope env = gridGeometry.getEnvelope(); + return (int) Math.round(converter.convert(env.getSpan(axis)) + / mResolution); + } + + /** + * Create a new transform from lon/lat to grid coordinates + * + * @param crs + * coordinate reference system of display + * @param gridGeom + * target grid geometry + * @return + * @throws VizException + */ + private MathTransform getLonLatTransform(CoordinateReferenceSystem crs, + GeneralGridGeometry gridGeom) + throws VizException { + try { + MathTransform latLonToCrs = MapUtil.getTransformFromLatLon(crs); + MathTransform crsToGrid = gridGeom.getGridToCRS( + PixelInCell.CELL_CENTER).inverse(); + DefaultMathTransformFactory dmtf = new DefaultMathTransformFactory(); + return dmtf.createConcatenatedTransform( + latLonToCrs, crsToGrid); + } catch (Exception e) { + throw new VizException( + "Problem converting from lon/lat to requested grid geometry", + e); + } + } + + /** + * Add all plugin data objects to resource + * + * @param pdos + */ + public void add(List pdos) { + for (PluginDataObject pdo : pdos) { + addDataObject(pdo); + } + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName() + */ + @Override + public String getName() { + int res = resourceData.getKmResolution(); + return LightningResource.formatResourceName(resourceData) + + "Lightning " + res + "km Grid "; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.grid.rsc.general.AbstractGridResource#project(org.opengis + * .referencing.crs.CoordinateReferenceSystem) + */ + @Override + public void project(CoordinateReferenceSystem crs) throws VizException { + clearRequestedData(); + super.project(crs); + } + +} diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/GridLightningResourceData.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/GridLightningResourceData.java new file mode 100644 index 0000000000..92b7c0ea41 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/GridLightningResourceData.java @@ -0,0 +1,119 @@ +/** + * 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.viz.lightning; + +import java.util.Arrays; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.LoadProperties; + +/** + * Configuration data needed to render lightning as grids + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jul 7, 2014  3333      bclement     Initial creation
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public class GridLightningResourceData extends LightningResourceData { + + @XmlAttribute + /* defaults to 40km if not specified in bundle */ + private int kmResolution = 40; + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.lightning.LightningResourceData#constructResource(com + * .raytheon.uf.viz.core.rsc.LoadProperties, + * com.raytheon.uf.common.dataplugin.PluginDataObject[]) + */ + @Override + protected AbstractVizResource constructResource( + LoadProperties loadProperties, PluginDataObject[] objects) { + GridLightningResource rval = new GridLightningResource(this, + loadProperties); + rval.add(Arrays.asList(objects)); + return rval; + } + + /** + * @return the kmResolution + */ + public int getKmResolution() { + return kmResolution; + } + + /** + * @param kmResolution + * the kmResolution to set + */ + public void setKmResolution(int kmResolution) { + this.kmResolution = kmResolution; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + kmResolution; + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + GridLightningResourceData other = (GridLightningResourceData) obj; + if (kmResolution != other.kmResolution) + return false; + return true; + } + +} diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index a29d2fe636..37f8acc4e5 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -20,11 +20,8 @@ package com.raytheon.viz.lightning; import java.awt.Font; -import java.io.File; -import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,28 +30,13 @@ import java.util.concurrent.ConcurrentHashMap; import org.eclipse.swt.graphics.RGB; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import com.raytheon.uf.common.dataplugin.HDF5Util; import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; -import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.datastorage.DataStoreFactory; -import com.raytheon.uf.common.datastorage.IDataStore; -import com.raytheon.uf.common.datastorage.Request; -import com.raytheon.uf.common.datastorage.StorageException; -import com.raytheon.uf.common.datastorage.records.ByteDataRecord; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; -import com.raytheon.uf.common.datastorage.records.LongDataRecord; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; @@ -63,7 +45,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.PointStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.cache.CacheObject; -import com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetrieverAndDisposer; import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont.Style; import com.raytheon.uf.viz.core.drawables.PaintProperties; @@ -76,6 +57,9 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; +import com.raytheon.viz.lightning.cache.LightningFrame; +import com.raytheon.viz.lightning.cache.LightningFrameMetadata; +import com.raytheon.viz.lightning.cache.LightningFrameRetriever; /** * LightningResource @@ -104,6 +88,8 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; * Jun 06, 2014 DR 17367 D. Friedman Fix cache object usage. * Jun 19, 2014 3214 bclement added pulse and cloud flash support * Jul 07, 2014 3333 bclement removed lightSource field + * Jul 10, 2014 3333 bclement moved cache object inner classes to own package + * moved name formatting to static method * * * @@ -114,124 +100,6 @@ public class LightningResource extends AbstractVizResource implements IResourceDataChanged { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(LightningResource.class); - - private static class LightningFrame { - - public LightningFrameMetadata metadata; - - public DataTime frameTime; - - public List posLatLonList = new ArrayList(); - - public List negLatLonList = new ArrayList(); - - public List cloudLatLonList = new ArrayList(); - - public List pulseLatLonList = new ArrayList(); - } - - private static class LightningFrameMetadata { - - private BinOffset offset; - - private DataTime frameTime; - - private List newRecords = new ArrayList(); - - private List processed = new ArrayList(); - - public LightningFrameMetadata(DataTime frameTime, BinOffset offset) { - this.frameTime = frameTime; - this.offset = offset; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((frameTime == null) ? 0 : frameTime.hashCode()); - result = prime * result - + ((offset == null) ? 0 : offset.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - LightningFrameMetadata other = (LightningFrameMetadata) obj; - if (frameTime == null) { - if (other.frameTime != null) - return false; - } else if (!frameTime.equals(other.frameTime)) - return false; - if (offset == null) { - if (other.offset != null) - return false; - } else if (!offset.equals(other.offset)) - return false; - return true; - } - - } - - private static class LightningFrameRetriever implements - IObjectRetrieverAndDisposer { - - @Override - public LightningFrame retrieveObject(LightningFrameMetadata metadata) { - synchronized (metadata) { - LightningFrame bundle = new LightningFrame(); - bundle.frameTime = metadata.frameTime; - bundle.metadata = metadata; - populateData(metadata, bundle); - return bundle; - } - } - - @Override - public int getSize(LightningFrame object) { - int doubleCount = 0; - if (object != null) { - synchronized (object) { - for (double[] arr : object.posLatLonList) { - doubleCount += arr.length; - } - for (double[] arr : object.negLatLonList) { - doubleCount += arr.length; - } - } - } - // 8 bytes per double - return doubleCount * 8; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetrieverAndDisposer - * #disposeObject(java.lang.Object) - */ - @Override - public void disposeObject(LightningFrame object) { - LightningFrameMetadata metadata = object.metadata; - synchronized (metadata) { - metadata.newRecords.addAll(metadata.processed); - metadata.processed.clear(); - } - } - } - - private static final LightningFrameRetriever resourceBuilder = new LightningFrameRetriever(); - private Map> cacheObjectMap; private DataTime lastPaintedTime; @@ -309,56 +177,71 @@ public class LightningResource extends } }); + this.resourceName = formatResourceName(resourceData) + + "Lightning Plot "; + } - String timeString = ""; - int absTimeInterval = Math.abs(this.resourceData.getBinOffset() + /** + * Create a resource name string from resource data configuration. Includes + * time interval, cloud flash, pos/neg, pulse and source name. + * + * @param resourceData + * @return + */ + public static String formatResourceName(LightningResourceData resourceData) { + String rval = ""; + int absTimeInterval = Math.abs(resourceData.getBinOffset() .getInterval()); // If a virtual offset is provided, it is aged lightning, so use // the virtual offset to provide the "Old" time - int virtualOffset = this.resourceData.getBinOffset().getVirtualOffset(); + int virtualOffset = resourceData.getBinOffset().getVirtualOffset(); if (virtualOffset != 0) { - timeString = convertTimeIntervalToString(virtualOffset) + "Old "; + rval = convertTimeIntervalToString(virtualOffset) + "Old "; } else { - timeString = convertTimeIntervalToString(absTimeInterval); + rval = convertTimeIntervalToString(absTimeInterval); } - if (this.resourceData.isExclusiveForType()) { + if (resourceData.isExclusiveForType()) { String modifier; - if (this.resourceData.isHandlingCloudFlashes()) { + if (resourceData.isHandlingCloudFlashes()) { modifier = "Cloud Flash "; - } else if (this.resourceData.isHandlingNegativeStrikes()) { + } else if (resourceData.isHandlingNegativeStrikes()) { modifier = "Negative "; - } else if (this.resourceData.isHandlingPositiveStrikes()) { + } else if (resourceData.isHandlingPositiveStrikes()) { modifier = "Positive "; - } else if (this.resourceData.isHandlingPulses()) { + } else if (resourceData.isHandlingPulses()) { modifier = "Pulse "; } else { /* space to preserve formatting */ modifier = " "; } - this.resourceName = timeString + modifier; - } else { - this.resourceName = timeString; + rval += modifier; } - HashMap metadata = this.resourceData + HashMap metadata = resourceData .getMetadataMap(); if (metadata != null && metadata.containsKey(LightningConstants.SOURCE)) { - this.resourceName += metadata.get(LightningConstants.SOURCE) + rval += metadata.get(LightningConstants.SOURCE) .getConstraintValue() + " "; } - - this.resourceName += "Lightning Plot "; + return rval; } - private String convertTimeIntervalToString(int time) { + /** + * Format time interval to human readable display string + * + * @param time + * in seconds + * @return + */ + private static String convertTimeIntervalToString(int time) { time = Math.abs(time); String timeString = null; - if (time >= 60 * 60) { - int hrs = time / (60 * 60); + if (time >= TimeUtil.SECONDS_PER_HOUR) { + int hrs = time / (TimeUtil.SECONDS_PER_HOUR); timeString = hrs + " Hour "; - } else if (time < 60 * 60) { - int mins = time / 60; + } else { + int mins = time / TimeUtil.SECONDS_PER_MINUTE; timeString = mins + " Minute "; } @@ -414,16 +297,20 @@ public class LightningResource extends if (needsUpdate) { needsUpdate = false; if (resourceData.isHandlingNegativeStrikes()) { - currNegList = convertToPixel(bundle.negLatLonList); + currNegList = convertToPixel(bundle + .getNegLatLonList()); } if (resourceData.isHandlingPositiveStrikes()) { - currPosList = convertToPixel(bundle.posLatLonList); + currPosList = convertToPixel(bundle + .getPosLatLonList()); } if (resourceData.isHandlingCloudFlashes()) { - currCloudList = convertToPixel(bundle.cloudLatLonList); + currCloudList = convertToPixel(bundle + .getCloudLatLonList()); } if (resourceData.isHandlingPulses()) { - currPulseList = convertToPixel(bundle.pulseLatLonList); + currPulseList = convertToPixel(bundle + .getPulseLatLonList()); } } @@ -555,7 +442,8 @@ public class LightningResource extends if (co != null) { LightningFrameMetadata metadata = co.getMetadata(); synchronized (metadata) { - if (metadata.newRecords.size() + metadata.processed.size() < 2) { + if (metadata.getNewRecords().size() + + metadata.getProcessed().size() < 2) { return; } } @@ -603,40 +491,25 @@ public class LightningResource extends List records = entry.getValue(); - LightningFrameMetadata frame; + LightningFrameRetriever retriever = LightningFrameRetriever + .getInstance(); CacheObject co; synchronized (cacheObjectMap) { co = cacheObjectMap.get(dt); if (co == null) { - // New frame + /* + * no local reference to cache object, create key and get + * cache object which may be new or from another resource + */ LightningFrameMetadata key = new LightningFrameMetadata(dt, resourceData.getBinOffset()); - co = CacheObject.newCacheObject(key, resourceBuilder); + co = CacheObject.newCacheObject(key, retriever); cacheObjectMap.put(dt, co); dataTimes.add(dt); } } - frame = co.getMetadata(); - synchronized (frame) { - // Add as new records - for (BinLightningRecord record : records) { - if (frame.newRecords.contains(record) == false - && frame.processed.contains(record) == false) { - frame.newRecords.add(record); - } - } - - if (frame.processed.size() > 0 && frame.newRecords.size() > 0) { - // if we've already processed some records, request the - // new ones now and merge - LightningFrame existing = co.getObjectSync(); - LightningFrame newBundle = resourceBuilder - .retrieveObject(frame); - existing.posLatLonList.addAll(newBundle.posLatLonList); - existing.negLatLonList.addAll(newBundle.negLatLonList); - } - } + retriever.updateAndGet(records, co); } issueRefresh(); } @@ -670,220 +543,4 @@ public class LightningResource extends issueRefresh(); } - private static void populateData(LightningFrameMetadata frame, - LightningFrame bundle) { - long t0 = System.currentTimeMillis(); - long strikeCount = 0; - long dsTime = 0; - - // Bin up requests to the same hdf5 - Map> fileMap = new HashMap>(); - - for (BinLightningRecord record : frame.newRecords) { - File f = HDF5Util.findHDF5Location(record); - List recList = fileMap.get(f); - if (recList == null) { - recList = new ArrayList(); - fileMap.put(f, recList); - } - recList.add(record); - frame.processed.add(record); - } - frame.newRecords.clear(); - - for (File f : fileMap.keySet()) { - List recList = fileMap.get(f); - String[] groups = new String[recList.size()]; - for (int i = 0; i < recList.size(); i++) { - groups[i] = recList.get(i).getDataURI(); - } - - // Go fetch data - try { - long tDS0 = System.currentTimeMillis(); - IDataStore ds = DataStoreFactory.getDataStore(f); - IDataRecord[] records = ds.retrieveGroups(groups, Request.ALL); - - long tDS1 = System.currentTimeMillis(); - dsTime += (tDS1 - tDS0); - // Throw in a map for easy accessibility - Map> recordMap = createRecordMap(records); - - List times = recordMap - .get(LightningConstants.TIME_DATASET); - List intensities = recordMap - .get(LightningConstants.INTENSITY_DATASET); - List lats = recordMap - .get(LightningConstants.LAT_DATASET); - List lons = recordMap - .get(LightningConstants.LON_DATASET); - List types = recordMap - .get(LightningConstants.STRIKE_TYPE_DATASET); - List pulseIndexes = recordMap - .get(LightningConstants.PULSE_INDEX_DATASET); - - int k = 0; - for (IDataRecord timeRec : times) { - if (hasPulseData(pulseIndexes, k)) { - populatePulseData(frame, bundle, timeRec.getGroup(), ds); - } - LongDataRecord time = (LongDataRecord) timeRec; - // Now loop through the obs times and intensities and - // start categorizing strikes - int numRecords = (int) time.getSizes()[0]; - - long[] timeData = time.getLongData(); - - int[] intensityData = ((IntegerDataRecord) intensities - .get(k)).getIntData(); - float[] latitudeData = ((FloatDataRecord) lats.get(k)) - .getFloatData(); - float[] longitudeData = ((FloatDataRecord) lons.get(k)) - .getFloatData(); - byte[] typeData = ((ByteDataRecord) types.get(k)) - .getByteData(); - - for (int i = 0; i < numRecords; i++) { - - DataTime dt = new DataTime(new Date(timeData[i])); - dt = frame.offset.getNormalizedTime(dt); - List list; - LtgStrikeType type = LtgStrikeType.getById(typeData[i]); - switch(type){ - case CLOUD_TO_CLOUD: - list = bundle.cloudLatLonList; - break; - default: - if (intensityData[i] > 0) { - list = bundle.posLatLonList; - } else { - list = bundle.negLatLonList; - } - break; - } - - double[] latLon = new double[] { longitudeData[i], - latitudeData[i] }; - - // only add the strike to the list if the data time - // of the strike matches the data time of the frame - if (dt.equals(bundle.frameTime)) { - list.add(latLon); - strikeCount++; - } - - } - k++; - } - } catch (StorageException e) { - statusHandler.handle(Priority.PROBLEM, - "Storage error retrieving lightning data", e); - } catch (FileNotFoundException e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to open lightning file", e); - } - - } - - long t1 = System.currentTimeMillis(); - - System.out.println("Decoded: " + strikeCount + " strikes in " - + (t1 - t0) + "ms (hdf5 time = " + dsTime + "ms)"); - } - - /** - * Unpack records into map keyed by record name - * - * @param records - * @return - */ - private static Map> createRecordMap( - IDataRecord[] records) { - Map> recordMap = new HashMap>(); - for (IDataRecord rec : records) { - List recordList = recordMap.get(rec.getName()); - if (recordList == null) { - recordList = new ArrayList(); - recordMap.put(rec.getName(), recordList); - } - recordList.add(rec); - } - return recordMap; - } - - /** - * Search records and return first found with name - * - * @param records - * @param name - * @return null if none found - */ - private static IDataRecord findDataRecord(IDataRecord[] records, String name) { - IDataRecord rval = null; - for (IDataRecord record : records) { - if (record.getName().equals(name)) { - rval = record; - break; - } - } - return rval; - } - - /** - * @param pulseIndexes - * @param recordIndex - * @return true if any data record in list has a valid pulse index - */ - private static boolean hasPulseData(List pulseIndexes, - int recordIndex) { - if (pulseIndexes != null) { - IDataRecord record = pulseIndexes.get(recordIndex); - int[] indexData = ((IntegerDataRecord) record).getIntData(); - for (int i = 0; i < indexData.length; ++i) { - if (indexData[i] >= 0) { - return true; - } - } - } - return false; - } - - /** - * Read pulse data from datastore and populate in frame - * - * @param frame - * @param bundle - * @param group - * @param ds - */ - private static void populatePulseData(LightningFrameMetadata frame, - LightningFrame bundle, String group, IDataStore ds) { - try { - IDataRecord[] records = ds.retrieve(group + DataURI.SEPARATOR - + LightningConstants.PULSE_HDF5_GROUP_SUFFIX); - FloatDataRecord latRecord = (FloatDataRecord) findDataRecord( - records, LightningConstants.LAT_DATASET); - FloatDataRecord lonRecord = (FloatDataRecord) findDataRecord( - records, LightningConstants.LON_DATASET); - if (latRecord == null || lonRecord == null) { - throw new StorageException( - "Missing pulse latitude and/or longitude data", null); - } - float[] lats = latRecord.getFloatData(); - float[] lons = lonRecord.getFloatData(); - if (lats.length != lons.length) { - throw new StorageException( - "Mismatched pulse latitude/longitude data", latRecord); - } - for (int i = 0; i < lats.length; ++i) { - bundle.pulseLatLonList.add(new double[] { lons[i], lats[i] }); - } - } catch (FileNotFoundException e) { - statusHandler.error("Unable to open lightning file", e); - } catch (StorageException e) { - statusHandler.error("Unable to read pulse datasets for group " - + group, e); - } - } - } diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrame.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrame.java new file mode 100644 index 0000000000..16a974634e --- /dev/null +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrame.java @@ -0,0 +1,148 @@ +/** + * 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.viz.lightning.cache; + +import java.util.ArrayList; +import java.util.List; + +import com.raytheon.uf.common.time.DataTime; + +/** + * Lightning location data for a single time frame. Data is separated out by + * flash/pulse category. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jul 9, 2014  3333      bclement     moved from LightningResource
+ *                                      added merge() and getDataSize()
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +public class LightningFrame { + + private final LightningFrameMetadata metadata; + + private final DataTime frameTime; + + private final List posLatLonList = new ArrayList(); + + private final List negLatLonList = new ArrayList(); + + private final List cloudLatLonList = new ArrayList(); + + private final List pulseLatLonList = new ArrayList(); + + private static final int BYTES_PER_DOUBLE = Double.SIZE / Byte.SIZE; + + /** + * @param frameTime + * @param metadata + */ + public LightningFrame(DataTime frameTime, LightningFrameMetadata metadata) { + this.frameTime = frameTime; + this.metadata = metadata; + } + + /** + * Add all locations from other to this frame + * + * @param other + */ + public void merge(LightningFrame other) { + this.posLatLonList.addAll(other.posLatLonList); + this.negLatLonList.addAll(other.negLatLonList); + this.cloudLatLonList.addAll(other.cloudLatLonList); + this.pulseLatLonList.addAll(other.pulseLatLonList); + } + + /** + * @return total size of location data in bytes + */ + public int getDataSize() { + int doubleCount = 0; + doubleCount += getSize(getPosLatLonList()); + doubleCount += getSize(getNegLatLonList()); + doubleCount += getSize(getCloudLatLonList()); + doubleCount += getSize(getPulseLatLonList()); + return doubleCount * BYTES_PER_DOUBLE; + } + + /** + * @param lonLatList + * @return total number of doubles in list + */ + private static int getSize(List lonLatList) { + int rval = 0; + for (double[] arr : lonLatList) { + rval += arr.length; + } + return rval; + } + + /** + * @return the metadata + */ + public LightningFrameMetadata getMetadata() { + return metadata; + } + + /** + * @return the frameTime + */ + public DataTime getFrameTime() { + return frameTime; + } + + /** + * @return the posLatLonList + */ + public List getPosLatLonList() { + return posLatLonList; + } + + /** + * @return the negLatLonList + */ + public List getNegLatLonList() { + return negLatLonList; + } + + /** + * @return the cloudLatLonList + */ + public List getCloudLatLonList() { + return cloudLatLonList; + } + + /** + * @return the pulseLatLonList + */ + public List getPulseLatLonList() { + return pulseLatLonList; + } + +} diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameMetadata.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameMetadata.java new file mode 100644 index 0000000000..4b1d5e7dce --- /dev/null +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameMetadata.java @@ -0,0 +1,119 @@ +/** + * 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.viz.lightning.cache; + +import java.util.ArrayList; +import java.util.List; + +import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; +import com.raytheon.uf.common.time.BinOffset; +import com.raytheon.uf.common.time.DataTime; + +/** + * Time and record data used to create a LightningFrame + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jul 9, 2014  3333      bclement     moved from LightningResource
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +public class LightningFrameMetadata { + + private final BinOffset offset; + + private final DataTime frameTime; + + private final List newRecords = new ArrayList(); + + private final List processed = new ArrayList(); + + public LightningFrameMetadata(DataTime frameTime, BinOffset offset) { + this.frameTime = frameTime; + this.offset = offset; + } + + /** + * @return the offset + */ + public BinOffset getOffset() { + return offset; + } + + /** + * @return the frameTime + */ + public DataTime getFrameTime() { + return frameTime; + } + + /** + * @return the newRecords + */ + public List getNewRecords() { + return newRecords; + } + + /** + * @return the processed + */ + public List getProcessed() { + return processed; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((frameTime == null) ? 0 : frameTime.hashCode()); + result = prime * result + ((offset == null) ? 0 : offset.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + LightningFrameMetadata other = (LightningFrameMetadata) obj; + if (frameTime == null) { + if (other.frameTime != null) + return false; + } else if (!frameTime.equals(other.frameTime)) + return false; + if (offset == null) { + if (other.offset != null) + return false; + } else if (!offset.equals(other.offset)) + return false; + return true; + } +} diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameRetriever.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameRetriever.java new file mode 100644 index 0000000000..f15e532258 --- /dev/null +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/cache/LightningFrameRetriever.java @@ -0,0 +1,398 @@ +/** + * 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.viz.lightning.cache; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.raytheon.uf.common.dataplugin.HDF5Util; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; +import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; +import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; +import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; +import com.raytheon.uf.common.datastorage.DataStoreFactory; +import com.raytheon.uf.common.datastorage.IDataStore; +import com.raytheon.uf.common.datastorage.Request; +import com.raytheon.uf.common.datastorage.StorageException; +import com.raytheon.uf.common.datastorage.records.ByteDataRecord; +import com.raytheon.uf.common.datastorage.records.FloatDataRecord; +import com.raytheon.uf.common.datastorage.records.IDataRecord; +import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; +import com.raytheon.uf.common.datastorage.records.LongDataRecord; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.viz.core.cache.CacheObject; +import com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetrieverAndDisposer; + +/** + * Cache object retriever for lighting frame data. Singleton to ensure that + * cached data is shared between resources. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jul 9, 2014  3333      bclement     moved from LightningResource
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +public class LightningFrameRetriever implements + IObjectRetrieverAndDisposer { + + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(LightningFrameRetriever.class); + + private static final LightningFrameRetriever instance = new LightningFrameRetriever(); + + /** + * @return singleton instance + */ + public static LightningFrameRetriever getInstance() { + return instance; + } + + /** + * singleton constructor + */ + private LightningFrameRetriever() { + } + + /** + * Add any new records to cache and return the updated frame + * + * @param records + * @param co + * @return + */ + public LightningFrame updateAndGet(List records, + CacheObject co) { + LightningFrameMetadata metadata = co.getMetadata(); + LightningFrame rval; + synchronized (metadata) { + // Add as new records + List newRecords = metadata.getNewRecords(); + List processed = metadata.getProcessed(); + for (BinLightningRecord record : records) { + if (newRecords.contains(record) == false + && processed.contains(record) == false) { + newRecords.add(record); + } + } + rval = co.getObjectAsync(); + if (processed.size() > 0 && newRecords.size() > 0) { + // if we've already processed some records, request the + // new ones now and merge + LightningFrame newBundle = retrieveObject(metadata); + rval.merge(newBundle); + } + } + return rval; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetriever#retrieveObject + * (java.lang.Object) + */ + @Override + public LightningFrame retrieveObject(LightningFrameMetadata metadata) { + synchronized (metadata) { + LightningFrame bundle = new LightningFrame(metadata.getFrameTime(), + metadata); + populateData(metadata, bundle); + return bundle; + } + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetriever#getSize(java + * .lang.Object) + */ + @Override + public int getSize(LightningFrame object) { + int rval = 0; + if (object != null) { + synchronized (object) { + rval = object.getDataSize(); + } + } + return rval; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetrieverAndDisposer + * #disposeObject(java.lang.Object) + */ + @Override + public void disposeObject(LightningFrame object) { + LightningFrameMetadata metadata = object.getMetadata(); + synchronized (metadata) { + List newRecords = metadata.getNewRecords(); + List processed = metadata.getProcessed(); + newRecords.addAll(processed); + processed.clear(); + } + } + + /** + * Populate frame with data from HDF5 + * + * @param frame + * @param bundle + */ + private static void populateData(final LightningFrameMetadata frame, + LightningFrame bundle) { + long t0 = System.currentTimeMillis(); + long strikeCount = 0; + long dsTime = 0; + + // Bin up requests to the same hdf5 + Map> fileMap = new HashMap>(); + List newRecords = frame.getNewRecords(); + List processed = frame.getProcessed(); + for (BinLightningRecord record : newRecords) { + File f = HDF5Util.findHDF5Location(record); + List recList = fileMap.get(f); + if (recList == null) { + recList = new ArrayList(); + fileMap.put(f, recList); + } + recList.add(record); + processed.add(record); + } + newRecords.clear(); + + for (File f : fileMap.keySet()) { + List recList = fileMap.get(f); + String[] groups = new String[recList.size()]; + for (int i = 0; i < recList.size(); i++) { + groups[i] = recList.get(i).getDataURI(); + } + + // Go fetch data + try { + long tDS0 = System.currentTimeMillis(); + IDataStore ds = DataStoreFactory.getDataStore(f); + IDataRecord[] records = ds.retrieveGroups(groups, Request.ALL); + + long tDS1 = System.currentTimeMillis(); + dsTime += (tDS1 - tDS0); + // Throw in a map for easy accessibility + Map> recordMap = createRecordMap(records); + + List times = recordMap + .get(LightningConstants.TIME_DATASET); + List intensities = recordMap + .get(LightningConstants.INTENSITY_DATASET); + List lats = recordMap + .get(LightningConstants.LAT_DATASET); + List lons = recordMap + .get(LightningConstants.LON_DATASET); + List types = recordMap + .get(LightningConstants.STRIKE_TYPE_DATASET); + List pulseIndexes = recordMap + .get(LightningConstants.PULSE_INDEX_DATASET); + + int k = 0; + for (IDataRecord timeRec : times) { + if (hasPulseData(pulseIndexes, k)) { + populatePulseData(frame, bundle, timeRec.getGroup(), ds); + } + LongDataRecord time = (LongDataRecord) timeRec; + // Now loop through the obs times and intensities and + // start categorizing strikes + int numRecords = (int) time.getSizes()[0]; + + long[] timeData = time.getLongData(); + + int[] intensityData = ((IntegerDataRecord) intensities + .get(k)).getIntData(); + float[] latitudeData = ((FloatDataRecord) lats.get(k)) + .getFloatData(); + float[] longitudeData = ((FloatDataRecord) lons.get(k)) + .getFloatData(); + byte[] typeData = ((ByteDataRecord) types.get(k)) + .getByteData(); + + for (int i = 0; i < numRecords; i++) { + + DataTime dt = new DataTime(new Date(timeData[i])); + dt = frame.getOffset().getNormalizedTime(dt); + List list; + LtgStrikeType type = LtgStrikeType.getById(typeData[i]); + switch (type) { + case CLOUD_TO_CLOUD: + list = bundle.getCloudLatLonList(); + break; + default: + if (intensityData[i] > 0) { + list = bundle.getPosLatLonList(); + } else { + list = bundle.getNegLatLonList(); + } + break; + } + + double[] latLon = new double[] { longitudeData[i], + latitudeData[i] }; + + // only add the strike to the list if the data time + // of the strike matches the data time of the frame + if (dt.equals(bundle.getFrameTime())) { + list.add(latLon); + strikeCount++; + } + + } + k++; + } + } catch (StorageException e) { + statusHandler.handle(Priority.PROBLEM, + "Storage error retrieving lightning data", e); + } catch (FileNotFoundException e) { + statusHandler.handle(Priority.PROBLEM, + "Unable to open lightning file", e); + } + + } + + long t1 = System.currentTimeMillis(); + + System.out.println("Decoded: " + strikeCount + " strikes in " + + (t1 - t0) + "ms (hdf5 time = " + dsTime + "ms)"); + } + + /** + * Unpack records into map keyed by record name + * + * @param records + * @return + */ + public static Map> createRecordMap( + IDataRecord[] records) { + Map> recordMap = new HashMap>(); + for (IDataRecord rec : records) { + List recordList = recordMap.get(rec.getName()); + if (recordList == null) { + recordList = new ArrayList(); + recordMap.put(rec.getName(), recordList); + } + recordList.add(rec); + } + return recordMap; + } + + /** + * Search records and return first found with name + * + * @param records + * @param name + * @return null if none found + */ + private static IDataRecord findDataRecord(IDataRecord[] records, String name) { + IDataRecord rval = null; + for (IDataRecord record : records) { + if (record.getName().equals(name)) { + rval = record; + break; + } + } + return rval; + } + + /** + * @param pulseIndexes + * @param recordIndex + * @return true if any data record in list has a valid pulse index + */ + private static boolean hasPulseData(List pulseIndexes, + int recordIndex) { + if (pulseIndexes != null) { + IDataRecord record = pulseIndexes.get(recordIndex); + int[] indexData = ((IntegerDataRecord) record).getIntData(); + for (int i = 0; i < indexData.length; ++i) { + if (indexData[i] >= 0) { + return true; + } + } + } + return false; + } + + /** + * Read pulse data from datastore and populate in frame + * + * @param frame + * @param bundle + * @param group + * @param ds + */ + private static void populatePulseData(LightningFrameMetadata frame, + LightningFrame bundle, String group, IDataStore ds) { + try { + IDataRecord[] records = ds.retrieve(group + DataURI.SEPARATOR + + LightningConstants.PULSE_HDF5_GROUP_SUFFIX); + FloatDataRecord latRecord = (FloatDataRecord) findDataRecord( + records, LightningConstants.LAT_DATASET); + FloatDataRecord lonRecord = (FloatDataRecord) findDataRecord( + records, LightningConstants.LON_DATASET); + if (latRecord == null || lonRecord == null) { + throw new StorageException( + "Missing pulse latitude and/or longitude data", null); + } + float[] lats = latRecord.getFloatData(); + float[] lons = lonRecord.getFloatData(); + if (lats.length != lons.length) { + throw new StorageException( + "Mismatched pulse latitude/longitude data", latRecord); + } + for (int i = 0; i < lats.length; ++i) { + bundle.getPosLatLonList() + .add(new double[] { lons[i], lats[i] }); + } + } catch (FileNotFoundException e) { + statusHandler.error("Unable to open lightning file", e); + } catch (StorageException e) { + statusHandler.error("Unable to read pulse datasets for group " + + group, e); + } + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/colormaps/Grid Lightning Density.cmap b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/colormaps/Grid Lightning Density.cmap new file mode 100644 index 0000000000..caa725d55f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/colormaps/Grid Lightning Density.cmap @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/styleRules/gridLightningImageryStyleRules.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/styleRules/gridLightningImageryStyleRules.xml new file mode 100644 index 0000000000..ccd5291a29 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/utility/common_static/base/styleRules/gridLightningImageryStyleRules.xml @@ -0,0 +1,35 @@ + + + + + + lightning density + + + false + + 0 + 1000 + + Grid/gridded data + + + From faa29355b08a566f4fc7d1f332e013b076b0e8c2 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Mon, 14 Jul 2014 08:40:05 -0500 Subject: [PATCH 7/9] Omaha #2587 update script to set reftime as non null in db Change-Id: Ibcfb61b607645fcbb91e793f2088c8fb7432ecf4 Former-commit-id: dfafe89ab5cb4589d2408564b82a03adc9fc1143 --- deltaScripts/15.1.1/DR2587/nonNullTimes.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 deltaScripts/15.1.1/DR2587/nonNullTimes.sh diff --git a/deltaScripts/15.1.1/DR2587/nonNullTimes.sh b/deltaScripts/15.1.1/DR2587/nonNullTimes.sh new file mode 100755 index 0000000000..1eff14f33f --- /dev/null +++ b/deltaScripts/15.1.1/DR2587/nonNullTimes.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +tables=$(psql -U awips -d metadata -tc "select table_name from information_schema.columns where column_name = 'reftime'") + +echo "Updating record tables to disallow null times" +for table in $tables +do + echo "Updating $table" + psql -U awips -d metadata -c "ALTER TABLE $table ALTER COLUMN reftime SET NOT NULL" +done +echo "Done" From a1dadba524493676d8cc784580af81342704cb52 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 14 Jul 2014 14:25:51 -0500 Subject: [PATCH 8/9] Omaha #3184 throw incompatible request exceptions when trying to get levels on FFMP or IHFS Change-Id: I599799cc95835708fdb48b6ce8a8e977daceff26 Former-commit-id: 2fdb210c8fe8e6763b6a6422b5710c35ee7e48a8 --- .../dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java | 9 +++++++++ .../uf/common/hydro/dataaccess/HydroGeometryFactory.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java index fd380ca5a9..b70ec75948 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java @@ -28,6 +28,7 @@ import javax.measure.unit.Unit; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; +import com.raytheon.uf.common.dataaccess.exception.IncompatibleRequestException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; import com.raytheon.uf.common.dataaccess.impl.AbstractDataPluginFactory; import com.raytheon.uf.common.dataaccess.impl.DefaultGeometryData; @@ -40,6 +41,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates.MODE; import com.raytheon.uf.common.dataplugin.ffmp.HucLevelGeometriesFactory; +import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; @@ -70,6 +72,7 @@ import com.vividsolutions.jts.geom.Geometry; * May 1, 2014 3099 bkowal No longer use an empty pfaf list when the * data request locationNames list is empty. * Jun 24, 2014 3170 mnash Get the accumulated time if multiple times are requested + * Jul 14, 2014 3184 njensen Overrode getAvailableLevels() * * * @@ -354,4 +357,10 @@ public class FFMPGeometryFactory extends AbstractDataPluginFactory { return pfafList.toArray(new String[pfafList.size()]); } + + @Override + public Level[] getAvailableLevels(IDataRequest request) { + throw new IncompatibleRequestException(request.getDatatype() + + " data does not support the concept of levels"); + } } diff --git a/edexOsgi/com.raytheon.uf.common.hydro/src/com/raytheon/uf/common/hydro/dataaccess/HydroGeometryFactory.java b/edexOsgi/com.raytheon.uf.common.hydro/src/com/raytheon/uf/common/hydro/dataaccess/HydroGeometryFactory.java index a28a7551c4..b67b6a5533 100644 --- a/edexOsgi/com.raytheon.uf.common.hydro/src/com/raytheon/uf/common/hydro/dataaccess/HydroGeometryFactory.java +++ b/edexOsgi/com.raytheon.uf.common.hydro/src/com/raytheon/uf/common/hydro/dataaccess/HydroGeometryFactory.java @@ -23,10 +23,12 @@ import java.sql.Timestamp; import java.util.Map; import com.raytheon.uf.common.dataaccess.IDataRequest; +import com.raytheon.uf.common.dataaccess.exception.IncompatibleRequestException; import com.raytheon.uf.common.dataaccess.exception.TimeAgnosticDataException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; import com.raytheon.uf.common.dataaccess.impl.AbstractGeometryDatabaseFactory; import com.raytheon.uf.common.dataaccess.impl.FactoryUtil; +import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; @@ -51,6 +53,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. * Mar 03, 2014 2673 bsteffen Add ability to query only ref times. + * Jul 14, 2014 3184 njensen Overrode getAvailableLevels() * * * @@ -194,4 +197,10 @@ public class HydroGeometryFactory extends AbstractGeometryDatabaseFactory { protected String assembleGetAvailableLocationNames(IDataRequest request) { return "select lid from location;"; } + + @Override + public Level[] getAvailableLevels(IDataRequest request) { + throw new IncompatibleRequestException(request.getDatatype() + + " data does not support the concept of levels"); + } } \ No newline at end of file From e428f257cbaf12db705f0a2532765900c87e6bab Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Tue, 15 Jul 2014 15:13:26 -0500 Subject: [PATCH 9/9] Omaha #3373 jaxb manager refactor api changes reworked ogc jaxb manager to use parent class Change-Id: I92b4cd6a48faf80462b9ca483a4f5d6cba78de48 Former-commit-id: 125c31f035057676d8c97a9b6c7a1d7b1b7f5bcb --- .../comm/packet/SessionPayload.java | 7 +- .../provider/CollaborationXmlManager.java | 37 +- .../common/registry/RegistryJaxbManager.java | 38 +- .../registry/RegistryNamespaceMapper.java | 3 +- .../schemas/ebxml/util/EbxmlJaxbManager.java | 3 +- .../edex/ogc/common/jaxb/OgcJaxbManager.java | 329 +++++------------- .../common/jaxb/OgcMarshallerStrategy.java | 106 ++++++ .../text/dbsrv/impl/TextViewAdapter.java | 4 +- .../uf/edex/wfs/reg/WfsRegistryImpl.java | 44 ++- .../uf/edex/wfs/v2_0_0/Wfs2_0_0Provider.java | 7 +- 10 files changed, 255 insertions(+), 323 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcMarshallerStrategy.java diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/packet/SessionPayload.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/packet/SessionPayload.java index b4564d915d..aec0ba9a2c 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/packet/SessionPayload.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/packet/SessionPayload.java @@ -23,6 +23,7 @@ import java.util.Arrays; import org.jivesoftware.smack.util.Base64; +import com.raytheon.uf.common.serialization.MarshalOptions; import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -46,6 +47,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.SerializationMode; * Dec 11, 2013 2562 bclement Initial creation * Feb 27, 2013 2756 bclement extends BaseExtension * Jun 12, 2013 2903 bclement default to wrap jaxb xml in base64 + * Jul 15, 2014 3373 bclement added fragment marshal options * * * @@ -69,6 +71,9 @@ public class SessionPayload extends BaseExtension { public static final String ENCODING_ATTRIBUTE = "encoding"; + private static final MarshalOptions UNFORMATTED_FRAGMENT = new MarshalOptions( + false, true); + private final PayloadType payloadType; private final SerializationMode mode; @@ -135,7 +140,7 @@ public class SessionPayload extends BaseExtension { try { CollaborationXmlManager jaxb = CollaborationXmlManager .getInstance(); - String xml = jaxb.marshalToFragment(data); + String xml = jaxb.marshalToXml(data, UNFORMATTED_FRAGMENT); /* * wrap JAXB XML in base64 to avoid problems with openfire * disconnecting due to complex XML diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationXmlManager.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationXmlManager.java index ece70e17fa..fe3706da2a 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationXmlManager.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationXmlManager.java @@ -19,13 +19,12 @@ **/ package com.raytheon.uf.viz.collaboration.comm.provider; -import java.io.StringWriter; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.UnmarshallerHandler; @@ -60,6 +59,7 @@ import com.raytheon.uf.viz.core.reflect.SubClassLocator; * ------------- -------- ----------- -------------------------- * Oct 31, 2013 2491 bsteffen Initial creation * Dec 18, 2013 2562 bclement extend jaxb manager, xpp/fragment support + * Jul 15, 2014 3373 bclement jaxb manager changes, unmarshalFromXPP() doesn't pool * * * @@ -147,43 +147,14 @@ public class CollaborationXmlManager extends JAXBManager { */ public Object unmarshalFromXPP(XmlPullParser parser) throws CollaborationException { - Unmarshaller unmarshaller = null; try { - unmarshaller = getUnmarshaller(); + JAXBContext ctx = getJaxbContext(); + Unmarshaller unmarshaller = ctx.createUnmarshaller(); UnmarshallerHandler handler = unmarshaller.getUnmarshallerHandler(); PullParserJaxbAdapter adapter = new PullParserJaxbAdapter(parser, handler); return adapter.unmarshal(); } catch (Exception e) { throw new CollaborationException("Unable to unmarshal data", e); - } finally { - // TODO magic number 10 because QUEUE_SIZE isn't visible - if ((unmarshaller != null) && (unmarshallers.size() < 10)) { - unmarshallers.add(unmarshaller); - } - } - } - - /** - * Marshal object to unformatted (not pretty-printed) XML fragment (no XML - * preamble) - * - * @param obj - * @return - * @throws JAXBException - */ - public String marshalToFragment(Object obj) throws JAXBException { - Marshaller msh = getMarshaller(); - try { - StringWriter writer = new StringWriter(); - msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE); - msh.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); - msh.marshal(obj, writer); - return writer.toString(); - } finally { - // TODO magic number 10 because QUEUE_SIZE isn't visible - if ((msh != null) && (marshallers.size() < 10)) { - marshallers.add(msh); - } } } diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryJaxbManager.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryJaxbManager.java index e58d994d65..cf7710f9d4 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryJaxbManager.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryJaxbManager.java @@ -19,10 +19,12 @@ **/ package com.raytheon.uf.common.registry; +import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import com.raytheon.uf.common.serialization.JAXBManager; +import com.raytheon.uf.common.serialization.jaxb.JaxbMarshallerStrategy; import com.sun.xml.bind.marshaller.NamespacePrefixMapper; /** @@ -38,6 +40,7 @@ import com.sun.xml.bind.marshaller.NamespacePrefixMapper; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 8/8/2013 1692 bphillip Initial implementation + * Jul 15, 2014 3373 bclement jaxb manager changes * * * @author bphillip @@ -48,17 +51,6 @@ public class RegistryJaxbManager extends JAXBManager { /** The namespace mapper property name on the marshaller */ private static final String NAMESPACE_PREFIX_MAPPER_PROPERTY = "com.sun.xml.bind.namespacePrefixMapper"; - protected NamespacePrefixMapper namespaceMapper; - - /** - * Creates a new RegistryJaxbManager. Hidden from public use - * - * @throws JAXBException - */ - protected RegistryJaxbManager() throws JAXBException { - super(); - } - /** * Creates a new RegistryJaxbManager with the given namespace mapper * @@ -72,25 +64,29 @@ public class RegistryJaxbManager extends JAXBManager { public RegistryJaxbManager(RegistryNamespaceMapper namespaceMapper) throws JAXBException { super( + createStrategy(namespaceMapper), oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory.class, oasis.names.tc.ebxml.regrep.xsd.query.v4.ObjectFactory.class, oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class, oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectFactory.class, oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory.class, com.raytheon.uf.common.registry.services.rest.response.RestCollectionResponse.class); - this.namespaceMapper = namespaceMapper; } - @Override - protected Marshaller getMarshaller() throws JAXBException { - Marshaller m = marshallers.poll(); - if (m == null) { - m = getJaxbContext().createMarshaller(); - if (namespaceMapper != null) { - m.setProperty(NAMESPACE_PREFIX_MAPPER_PROPERTY, namespaceMapper); + private static JaxbMarshallerStrategy createStrategy( + final NamespacePrefixMapper namespaceMapper) { + return new JaxbMarshallerStrategy() { + @Override + protected Marshaller createMarshaller(JAXBContext context) + throws JAXBException { + Marshaller rval = super.createMarshaller(context); + if (namespaceMapper != null) { + rval.setProperty(NAMESPACE_PREFIX_MAPPER_PROPERTY, + namespaceMapper); + } + return rval; } - } - return m; + }; } } diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryNamespaceMapper.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryNamespaceMapper.java index 65d1d763fd..887327e9ca 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryNamespaceMapper.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryNamespaceMapper.java @@ -38,6 +38,7 @@ import com.sun.xml.bind.marshaller.NamespacePrefixMapper; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 8/8/2013 1692 bphillip Initial implementation + * Jul 15, 2014 3373 bclement removed warning * * * @author bphillip @@ -73,7 +74,7 @@ public class RegistryNamespaceMapper extends NamespacePrefixMapper implements } @Override - public Iterator getPrefixes(String namespaceURI) { + public Iterator getPrefixes(String namespaceURI) { throw new UnsupportedOperationException(); } diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java index e83be90f8d..68ce843ad2 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java @@ -50,6 +50,7 @@ import com.raytheon.uf.common.util.ReflectionUtil; * ------------ ---------- ----------- -------------------------- * Nov 12, 2013 ---- njensen Initial release. * Nov 24, 2013 2584 dhladky versioning + * Jul 15, 2014 3373 bclement pooling jaxb manager * * * @author njensen @@ -118,7 +119,7 @@ public class EbxmlJaxbManager { public synchronized JAXBManager getJaxbManager() throws JAXBException { if (jaxb == null) { - jaxb = new JAXBManager(jaxables.toArray(new Class[0])); + jaxb = new JAXBManager(true, jaxables.toArray(new Class[0])); } return jaxb; } diff --git a/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcJaxbManager.java b/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcJaxbManager.java index 92830231f7..bbbf4029e6 100644 --- a/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcJaxbManager.java +++ b/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcJaxbManager.java @@ -16,46 +16,20 @@ * * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Mar 30, 2011 bclement Initial creation - * Aug 18, 2013 #2097 dhladky extended JAXBManager - * */ package com.raytheon.uf.edex.ogc.common.jaxb; -import java.io.ByteArrayOutputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.StringReader; import java.util.HashMap; import java.util.Map; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Document; import org.w3c.dom.Node; import com.raytheon.uf.common.serialization.JAXBManager; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; import com.sun.xml.bind.api.JAXBRIContext; import com.sun.xml.bind.marshaller.NamespacePrefixMapper; @@ -68,7 +42,9 @@ import com.sun.xml.bind.marshaller.NamespacePrefixMapper; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 2011 bclement Initial creation + * Mar 30, 2011 bclement Initial creation + * Aug 18, 2013 #2097 dhladky extended JAXBManager + * Jul 15, 2014 3373 bclement rewritten to use JAXBManager * * * @@ -77,31 +53,72 @@ import com.sun.xml.bind.marshaller.NamespacePrefixMapper; */ public class OgcJaxbManager extends JAXBManager { - protected final JAXBContext jaxbContext; - - protected static final int QUEUE_SIZE = 10; - - protected final Queue unmarshallers = new ConcurrentLinkedQueue(); - - protected final Queue marshallers = new ConcurrentLinkedQueue(); - - protected volatile int unmarshallersCreated = 0; - - protected volatile int marshallersCreated = 0; - - protected final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - private volatile NamespacePrefixMapper mapper; - - protected final ReadWriteLock prefixLock = new ReentrantReadWriteLock(); - protected static final String JAXB_NAMESPACE_MAPPER = "com.sun.xml.bind.namespacePrefixMapper"; - public OgcJaxbManager(Class[] classes) throws JAXBException { - jaxbContext = JAXBContext.newInstance(classes, getJaxbConfig()); + private final OgcMarshallerStrategy marshStrategy; + + /** + * @param classes + * @throws JAXBException + */ + public OgcJaxbManager(Class[] classes) throws JAXBException { + this(new OgcMarshallerStrategy(), classes); } - private static Map getJaxbConfig() throws JAXBException { + /** + * @param mapper + * mapping of namespaces to namespace prefixes + * @param classes + * @throws JAXBException + */ + public OgcJaxbManager(NamespacePrefixMapper mapper, Class[] classes) + throws JAXBException { + this(createStrategy(mapper), classes); + } + + /** + * @see JAXBManager#JAXBManager(boolean, + * com.raytheon.uf.common.serialization.jaxb.JaxbMarshallerStrategy, + * Class...) + * @param strategy + * @param classes + * @throws JAXBException + */ + public OgcJaxbManager(OgcMarshallerStrategy strategy, Class[] classes) + throws JAXBException { + super(strategy, classes); + this.marshStrategy = strategy; + } + + /** + * Create a marshaller strategy that uses the provided namespace prefix + * mapping + * + * @param mapper + * @return + */ + private static OgcMarshallerStrategy createStrategy( + final NamespacePrefixMapper mapper) { + return new OgcMarshallerStrategy() { + @Override + protected Marshaller createMarshaller(JAXBContext context) + throws JAXBException { + Marshaller rval = super.createMarshaller(context); + if (mapper != null) { + rval.setProperty(JAXB_NAMESPACE_MAPPER, mapper); + } + return rval; + } + }; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.common.serialization.JAXBManager#getJaxbConfig() + */ + @Override + protected Map getJaxbConfig() throws JAXBException { Map jaxbConfig = new HashMap(); TransientAnnotationReader reader = new TransientAnnotationReader(); try { @@ -116,210 +133,28 @@ public class OgcJaxbManager extends JAXBManager { return jaxbConfig; } - protected Unmarshaller getUnmarshaller() throws JAXBException { - Unmarshaller m = unmarshallers.poll(); - if (m == null) { - if (unmarshallersCreated < QUEUE_SIZE) { - synchronized (unmarshallers) { - m = jaxbContext.createUnmarshaller(); - ++unmarshallersCreated; - } - } else { - int tries = 0; - do { - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // ignore - } - m = unmarshallers.poll(); - tries++; - if (tries >= 20) { - log.debug("Unable to get jaxb unmarshaller from pool after " - + tries + " tries. Growing pool size."); - synchronized (unmarshallers) { - m = jaxbContext.createUnmarshaller(); - ++unmarshallersCreated; - } - } - } while (m == null); - } - } - return m; - } - - protected Marshaller getMarshaller() throws JAXBException { - Marshaller m = marshallers.poll(); - if (m == null) { - if (marshallersCreated < QUEUE_SIZE) { - synchronized (marshallers) { - m = jaxbContext.createMarshaller(); - ++marshallersCreated; - } - } else { - int tries = 0; - do { - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // ignore - } - m = marshallers.poll(); - tries++; - if (tries >= 20) { - log.debug("Unable to get jaxb marshaller from pool after " - + tries + " tries. Growing pool size."); - synchronized (marshallers) { - m = jaxbContext.createMarshaller(); - ++marshallersCreated; - } - } - } while (m == null); - } - } - return m; - } - - public Object unmarshal(String xml) throws JAXBException { - Unmarshaller msh = null; - try { - msh = getUnmarshaller(); - StringReader reader = new StringReader(xml); - Object obj = msh.unmarshal(reader); - if (obj instanceof JAXBElement) { - obj = ((JAXBElement) obj).getValue(); - } - return obj; - } finally { - if (msh != null) { - unmarshallers.add(msh); - } - } - } - + /** + * @see OgcMarshallerStrategy#unmarshal(JAXBContext, Node) + * @param node + * @return + * @throws JAXBException + */ public Object unmarshal(Node node) throws JAXBException { - Unmarshaller msh = null; - try { - msh = getUnmarshaller(); - Object obj = msh.unmarshal(node); - if (obj instanceof JAXBElement) { - obj = ((JAXBElement) obj).getValue(); - } - return obj; - } finally { - if (msh != null) { - unmarshallers.add(msh); - } - } - } - - public Object unmarshal(FileReader reader) throws JAXBException { - Unmarshaller msh = null; - try { - msh = getUnmarshaller(); - Object obj = msh.unmarshal(reader); - if (obj instanceof JAXBElement) { - obj = ((JAXBElement) obj).getValue(); - } - return obj; - } finally { - if (msh != null) { - unmarshallers.add(msh); - } - } - } - - public Object unmarshal(InputStream xml) throws JAXBException { - Unmarshaller msh = null; - try { - msh = getUnmarshaller(); - Object obj = msh.unmarshal(xml); - if (obj instanceof JAXBElement) { - obj = ((JAXBElement) obj).getValue(); - } - return obj; - } finally { - if (msh != null) { - unmarshallers.add(msh); - } - } - } - - public String marshal(Object obj) throws JAXBException { - return marshal(obj, true); - } - - public String marshal(Object obj, boolean formatted) throws JAXBException { - return marshal(obj, null, formatted, false); - } - - public String marshal(Object obj, boolean formatted, boolean fragment) - throws JAXBException { - return marshal(obj, null, formatted, fragment); + JAXBContext ctx = getJaxbContext(); + return marshStrategy.unmarshal(ctx, node); } + /** + * @see OgcMarshallerStrategy#marshalToNode(JAXBContext, Object) + * @param obj + * @return + * @throws JAXBException + * @throws ParserConfigurationException + */ public Node marshalToNode(Object obj) throws JAXBException, ParserConfigurationException { - Marshaller msh = getMarshaller(); - try { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document doc = db.newDocument(); - msh.marshal(obj, doc); - return doc.getFirstChild(); - } finally { - marshallers.add(msh); - } + JAXBContext ctx = getJaxbContext(); + return marshStrategy.marshalToNode(ctx, obj); } - public void marshal(Object obj, OutputStream out, String schemaLocation, - boolean formatted, boolean fragment) throws JAXBException { - Marshaller msh = getMarshaller(); - try { - - msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, formatted); - msh.setProperty(Marshaller.JAXB_FRAGMENT, fragment); - if (mapper != null) { - Lock read = prefixLock.readLock(); - read.lock(); - try { - msh.setProperty(JAXB_NAMESPACE_MAPPER, mapper); - } finally { - read.unlock(); - } - } - if (schemaLocation != null && !schemaLocation.isEmpty()) { - msh.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation); - } - msh.marshal(obj, out); - } finally { - marshallers.add(msh); - } - } - - public String marshal(Object obj, String schemaLocation, boolean formatted, - boolean fragment) - throws JAXBException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - marshal(obj, out, schemaLocation, formatted, fragment); - return out.toString(); - } - - public void setPrefixMap(final Map prefixMap) { - Lock write = prefixLock.writeLock(); - write.lock(); - try { - this.mapper = new NamespacePrefixMapper() { - @Override - public String getPreferredPrefix(String namespaceUri, - String suggestion, boolean requirePrefix) { - return prefixMap.get(namespaceUri); - } - }; - } finally { - write.unlock(); - } - } - } diff --git a/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcMarshallerStrategy.java b/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcMarshallerStrategy.java new file mode 100644 index 0000000000..6fcab90f11 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ogc.common/src/com/raytheon/uf/edex/ogc/common/jaxb/OgcMarshallerStrategy.java @@ -0,0 +1,106 @@ +/** + * 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.ogc.common.jaxb; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.raytheon.uf.common.serialization.jaxb.PooledJaxbMarshallerStrategy; + +/** + * Marshaller strategy for OGC XML operations. Includes w3c dom operations. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jul 15, 2014 3373       bclement     Initial creation
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +public class OgcMarshallerStrategy extends PooledJaxbMarshallerStrategy { + + /** + * + */ + public OgcMarshallerStrategy() { + super(); + } + + /** + * @param poolSize + * @param pooledObjectSizeLimit + */ + public OgcMarshallerStrategy(int poolSize, int pooledObjectSizeLimit) { + super(poolSize, pooledObjectSizeLimit); + } + + /** + * Unmarshal object from w3c node. + * + * @param ctx + * @param node + * @return + * @throws JAXBException + */ + public Object unmarshal(JAXBContext ctx, Node node) throws JAXBException { + Unmarshaller msh = createUnmarshaller(ctx); + Object obj = msh.unmarshal(node); + if (obj instanceof JAXBElement) { + obj = ((JAXBElement) obj).getValue(); + } + return obj; + } + + /** + * Marshal object to w3c node + * + * @param ctx + * @param obj + * @return + * @throws JAXBException + * @throws ParserConfigurationException + */ + public Node marshalToNode(JAXBContext ctx, Object obj) + throws JAXBException, ParserConfigurationException { + Marshaller msh = createMarshaller(ctx); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.newDocument(); + msh.marshal(obj, doc); + return doc.getFirstChild(); + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dbsrv/impl/TextViewAdapter.java b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dbsrv/impl/TextViewAdapter.java index 5005e201d5..6d3f11ad83 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dbsrv/impl/TextViewAdapter.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dbsrv/impl/TextViewAdapter.java @@ -43,6 +43,7 @@ import com.raytheon.uf.common.message.Header; import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Property; import com.raytheon.uf.common.serialization.JAXBManager; +import com.raytheon.uf.common.serialization.MarshalOptions; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.site.SiteMap; @@ -72,6 +73,7 @@ import com.raytheon.uf.edex.plugin.text.db.TextDB; * -------------------------------- * 27Apr2012 564 jkorman Added sort to ALL times retrieval. * May 15, 2014 2536 bclement moved from uf.edex.textdbsrv, added marshalToStream() + * Jul 15, 2014 3373 bclement jaxb manager api changes * * * @@ -457,7 +459,7 @@ public class TextViewAdapter implements ICommandExecutor { } catch (JAXBException e) { throw new SerializationException("Unable to create JAXB manager", e); } - jaxbManager.marshalToStream(prod, stream, false); + jaxbManager.marshalToStream(prod, stream, MarshalOptions.UNFORMATTED); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/reg/WfsRegistryImpl.java b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/reg/WfsRegistryImpl.java index cdfbddf64f..7f395b031f 100644 --- a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/reg/WfsRegistryImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/reg/WfsRegistryImpl.java @@ -38,6 +38,8 @@ import net.opengis.gml.v_3_1_1.ObjectFactory; import org.apache.commons.lang.ArrayUtils; import org.w3c.dom.Node; +import com.raytheon.uf.common.serialization.MarshalOptions; +import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.util.registry.RegistryException; @@ -47,6 +49,7 @@ import com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager; import com.raytheon.uf.edex.wfs.WfsException; import com.raytheon.uf.edex.wfs.WfsFeatureType; import com.raytheon.uf.edex.wfs.request.QualifiedName; +import com.sun.xml.bind.marshaller.NamespacePrefixMapper; /** * Wfs registry implementation. Handles wfs sources and the JAXB context @@ -59,6 +62,7 @@ import com.raytheon.uf.edex.wfs.request.QualifiedName; * ------------ ---------- ----------- -------------------------- * Apr 11, 2011 bclement Initial creation * May 30, 2013 753 dhladky reverted to original + * Jul 15, 2014 3373 bclement jaxb manager api changes * * * @@ -173,8 +177,14 @@ public class WfsRegistryImpl implements IWfsRegistry { write.lock(); try { jaxbContextVersion = currentVersion; - jaxbManager = new OgcJaxbManager(jaxbClasses); - jaxbManager.setPrefixMap(NS_MAP); + NamespacePrefixMapper mapper = new NamespacePrefixMapper() { + @Override + public String getPreferredPrefix(String uri, + String suggestion, boolean requirePrefix) { + return NS_MAP.get(uri); + } + }; + jaxbManager = new OgcJaxbManager(mapper, jaxbClasses); } finally { write.unlock(); } @@ -188,7 +198,7 @@ public class WfsRegistryImpl implements IWfsRegistry { * @throws JAXBException */ public Object unmarshal(String xml) throws JAXBException { - return getManager().unmarshal(xml); + return getManager().unmarshalFromXml(xml); } public Object unmarshal(Node node) throws JAXBException { @@ -199,9 +209,11 @@ public class WfsRegistryImpl implements IWfsRegistry { * @param in * @return * @throws JAXBException + * @throws SerializationException */ - public Object unmarshal(InputStream in) throws JAXBException { - return getManager().unmarshal(in); + public Object unmarshal(InputStream in) throws JAXBException, + SerializationException { + return getManager().unmarshalFromInputStream(in); } /** @@ -210,30 +222,32 @@ public class WfsRegistryImpl implements IWfsRegistry { * @throws JAXBException */ public String marshal(Object obj) throws JAXBException { - return getManager().marshal(obj, false); + return getManager().marshalToXml(obj, MarshalOptions.UNFORMATTED); } + public String marshal(Object obj, boolean fragment) throws JAXBException { + MarshalOptions options = new MarshalOptions(false, fragment); + return getManager().marshalToXml(obj, options); + } + public Node marshalToNode(Object obj) throws JAXBException, ParserConfigurationException { return getManager().marshalToNode(obj); } - public String marshal(Object obj, boolean fragment) throws JAXBException { - return getManager().marshal(obj, false, fragment); + public String marshal(Object obj, MarshalOptions options) throws JAXBException { + return getManager().marshalToXml(obj, options); } /** * @param obj * @param out * @throws JAXBException + * @throws SerializationException */ - public void marshal(Object obj, OutputStream out) throws JAXBException { - getManager().marshal(obj, out, null, false, false); - } - - public void marshal(Object obj, OutputStream out, boolean fragment) - throws JAXBException { - getManager().marshal(obj, out, null, false, fragment); + public void marshal(Object obj, OutputStream out) throws JAXBException, + SerializationException { + getManager().marshalToStream(obj, out, MarshalOptions.UNFORMATTED); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/v2_0_0/Wfs2_0_0Provider.java b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/v2_0_0/Wfs2_0_0Provider.java index afa2484116..a2036d7871 100644 --- a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/v2_0_0/Wfs2_0_0Provider.java +++ b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/v2_0_0/Wfs2_0_0Provider.java @@ -116,8 +116,9 @@ import com.raytheon.uf.edex.wfs.util.XMLGregorianCalendarConverter; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Oct 17, 2012 bclement Initial creation - * Sep 18, 2013 #411 skorolev Added required RESPONSE METADATA - * Nov 11, 2013 2539 bclement moved registry/marshal to parent + * Sep 18, 2013 #411 skorolev Added required RESPONSE METADATA + * Nov 11, 2013 2539 bclement moved registry/marshal to parent + * Jul 15, 2014 3373 bclement jaxb manager api changes * * * @@ -1063,7 +1064,7 @@ public class Wfs2_0_0Provider extends AbstractWfsProvider implements try { String xml = registry.marshal(object, true); rval.put(key, xml); - } catch (JAXBException e) { + } catch (Exception e) { log.error("Problem marshalling parameter value", e); // is it possible that this isn't our fault? throw new WfsException(Code.OperationProcessingFailed);