diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java index 32112c59aa..8c5454a7c5 100644 --- a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java +++ b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java @@ -49,7 +49,6 @@ import com.raytheon.viz.volumebrowser.datacatalog.AvailableDataRequest; import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogEntry; import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalogEntry; import com.raytheon.viz.volumebrowser.vbui.SelectedData; -import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; /** * @@ -234,7 +233,7 @@ public class GFEVbDataCatalog extends AbstractDataCatalog { } @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { "gfe" }; } diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/AbstractInventoryDataCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/AbstractInventoryDataCatalog.java index 3d0b6f3e4f..d7b4d43e60 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/AbstractInventoryDataCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/AbstractInventoryDataCatalog.java @@ -44,10 +44,12 @@ import com.raytheon.uf.common.derivparam.inv.AbstractInventory; 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.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.datacube.DataCubeContainer; import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog; import com.raytheon.viz.volumebrowser.datacatalog.AvailableDataRequest; import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalog; +import com.raytheon.viz.volumebrowser.loader.ProductCreatorManager; import com.raytheon.viz.volumebrowser.util.PointLineUtil; import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection; import com.raytheon.viz.volumebrowser.vbui.MenuItemManager; @@ -92,6 +94,19 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog { @Override public void getAvailableData(AvailableDataRequest request) { + ResourceType resourceType = VolumeBrowserAction.getVolumeBrowserDlg() + .getDialogSettings().getViewSelection().getResourceType(); + boolean load = false; + for (String pluginName : getPlugins()) { + if (ProductCreatorManager.getInstance().getCreator(pluginName, + resourceType) != null) { + load = true; + break; + } + } + if (!load) { + return; + } String[] selectedSources = request.getSelectedSources(); String[] selectedFields = request.getSelectedFields(); String[] selectedPlanes = request.getSelectedPlanes(); diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/grid/GridDataCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/grid/GridDataCatalog.java index 49d9e9793c..940736dddc 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/grid/GridDataCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/grid/GridDataCatalog.java @@ -245,7 +245,7 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog { * () */ @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { GridInventory.PLUGIN_NAME }; } diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/DmdDataCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/DmdDataCatalog.java index 77e1469df2..b16d83ab3d 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/DmdDataCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/DmdDataCatalog.java @@ -34,7 +34,6 @@ import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogEntry; import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalogEntry; import com.raytheon.viz.volumebrowser.util.PointLineUtil; import com.raytheon.viz.volumebrowser.vbui.SelectedData; -import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; /** * @@ -46,8 +45,8 @@ import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Aug 3, 2015 bsteffen Initial javadoc - * + * Aug 03, 2015 bsteffen Initial javadoc + * Oct 05, 2015 3861 bsteffen Remove argument from getPlugins * * * @author bsteffen @@ -76,7 +75,7 @@ public class DmdDataCatalog extends AbstractDataCatalog { } @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { "radar" }; } diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/ModelSoundingCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/ModelSoundingCatalog.java index 2426b48286..8f8bb1cbca 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/ModelSoundingCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/ModelSoundingCatalog.java @@ -39,7 +39,6 @@ import com.raytheon.viz.pointdata.StaticPlotInfoPV.SPIEntry; import com.raytheon.viz.volumebrowser.datacatalog.AvailableDataRequest; import com.raytheon.viz.volumebrowser.datacatalog.DelegateAvailableRequest; import com.raytheon.viz.volumebrowser.vbui.SelectedData; -import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; import com.raytheon.viz.volumebrowser.xml.VbSource; import com.raytheon.viz.volumebrowser.xml.VbSourceList; @@ -101,15 +100,8 @@ public class ModelSoundingCatalog extends PointDataCatalog { return new ArrayList(getTypeMap().keySet()); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.volumebrowser.datacatalog.PointDataCatalog#getPlugins - * (com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu) - */ @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { pluginName }; } @@ -245,7 +237,7 @@ public class ModelSoundingCatalog extends PointDataCatalog { if (availableStations.containsKey(sourceKey)) { return availableStations.get(sourceKey); } - if (!Arrays.asList(getPlugins(null)).contains(getPlugin(sourceKey))) { + if (!Arrays.asList(getPlugins()).contains(getPlugin(sourceKey))) { availableStations.put(sourceKey, null); return null; } diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/PointDataCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/PointDataCatalog.java index 2c6ea1cd17..80bf920131 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/PointDataCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/PointDataCatalog.java @@ -137,7 +137,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog { if (availableStations.containsKey(sourceKey)) { return availableStations.get(sourceKey); } - if (!Arrays.asList(getPlugins(null)).contains(getPlugin(sourceKey))) { + if (!Arrays.asList(getPlugins()).contains(getPlugin(sourceKey))) { availableStations.put(sourceKey, null); return null; } @@ -318,7 +318,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog { } @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { "goessounding", "poessounding", "profiler", "bufrua", "obs", "bufrmosLAMP" }; // njensen removed bufrmosAVN, bufrmosETA, bufrmosGFS, bufrmosHPC, @@ -357,7 +357,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog { } protected String getPlugin(String sourceKey) { - for (String plugin : getPlugins(null)) { + for (String plugin : getPlugins()) { if (sourceKey.startsWith(plugin)) { return plugin; } diff --git a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/VwpDataCatalog.java b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/VwpDataCatalog.java index a8fb7e963c..1a4ef4d0d1 100644 --- a/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/VwpDataCatalog.java +++ b/cave/com.raytheon.uf.viz.volumebrowser.dataplugin/src/com/raytheon/uf/viz/volumebrowser/dataplugin/point/VwpDataCatalog.java @@ -27,7 +27,6 @@ import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.viz.core.catalog.DbQuery; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalogEntry; -import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; /** * @@ -50,7 +49,7 @@ import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; public class VwpDataCatalog extends PointDataCatalog { @Override - protected String[] getPlugins(ViewMenu setting) { + protected String[] getPlugins() { return new String[] { "radar" }; } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java index f139e8641d..0482ecc2f4 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java @@ -81,16 +81,16 @@ public abstract class AbstractDataCatalog implements IDataCatalog { /** * - * @return a list of plugin Names used for the given setting + * @return a list of plugin Names this catalog supports */ - protected abstract String[] getPlugins(ViewMenu setting); + protected abstract String[] getPlugins(); /** * * @return the default plugin to use in any case */ protected String getDefaultPlugin() { - return getPlugins(null)[0]; + return getPlugins()[0]; } /* diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductCreatorManager.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductCreatorManager.java index 4eadf40209..d0dd55ad9b 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductCreatorManager.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductCreatorManager.java @@ -32,6 +32,7 @@ import org.eclipse.core.runtime.Platform; 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.viz.core.rsc.ResourceType; /** * @@ -106,6 +107,11 @@ public class ProductCreatorManager { } } + public ProductCreator getCreator(String pluginName, + ResourceType resourceType) { + return getCreator(pluginName, resourceType.toString().toLowerCase()); + } + public static ProductCreatorManager getInstance() { return instance; } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductLoader.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductLoader.java index 8072739f15..753dd41a0a 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductLoader.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/loader/ProductLoader.java @@ -73,6 +73,8 @@ public class ProductLoader { private List displaysToLoad = new ArrayList<>(); + + public void addProduct(IDataCatalogEntry catalogEntry, DisplayType displayType) { IDataCatalog catalog = DataCatalogManager.getDataCatalogManager() @@ -84,7 +86,7 @@ public class ProductLoader { String pluginName = metadataMap.get(PluginDataObject.PLUGIN_NAME_ID) .getConstraintValue(); ProductCreator loader = ProductCreatorManager.getInstance().getCreator( - pluginName, resourceType.toString().toLowerCase()); + pluginName, resourceType); if (loader == null) { throw new RuntimeException("Unable to load product for plugin " + pluginName + " of type " + resourceType); diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java index 762e8e26d9..74c8fc2d81 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java @@ -56,11 +56,17 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.rsc.DisplayType; +import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager; +import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalog; import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalogEntry; +import com.raytheon.viz.volumebrowser.loader.ProductCreator; +import com.raytheon.viz.volumebrowser.loader.ProductCreatorManager; import com.raytheon.viz.volumebrowser.loader.ProductLoader; import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; @@ -931,7 +937,25 @@ public class ProductTableComp extends Composite { } } + protected boolean hasProductCreator(IDataCatalogEntry entry) { + IDataCatalog catalog = DataCatalogManager.getDataCatalogManager() + .getDataCatalog(entry.getSelectedData()); + ResourceType resourceType = entry.getDialogSettings() + .getViewSelection().getResourceType(); + HashMap metadataMap = catalog + .getProductParameters(entry); + String pluginName = metadataMap.get(PluginDataObject.PLUGIN_NAME_ID) + .getConstraintValue(); + ProductCreator creator = ProductCreatorManager.getInstance() + .getCreator(pluginName, resourceType); + return creator != null; + } + protected void addProduct(final ProductTableData tblData) { + if (!hasProductCreator(tblData.getCatalogEntry())) { + return; + } + synchronized (productKeySet) { String uniqueKey = tblData.getSelectedData().getUniqueKey(); if (!productKeySet.contains(uniqueKey)) { diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java index 2dc4bf9a14..5983338909 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/xml/VbSourceList.java @@ -1,5 +1,7 @@ package com.raytheon.viz.volumebrowser.xml; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -28,6 +30,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.menus.xml.CommonAbstractMenuContribution; import com.raytheon.uf.common.menus.xml.CommonMenuContribution; import com.raytheon.uf.common.menus.xml.CommonTitleImgContribution; @@ -57,6 +60,7 @@ import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; * different localization levels instead of overriding. * Jul 07, 2015 4641 mapeters Fix/improve comparators for VbSource sorting. * Jul 10, 2015 4641 mapeters Added check for sources with null key/category fields. + * Oct 05, 2015 3861 bsteffen Remove deprecated method call on LocalizationFile * * * @@ -358,8 +362,16 @@ public class VbSourceList { for (int i = levels.length - 1; i >= 0; i--) { LocalizationFile locFile = localizationFilesMap.get(levels[i]); if (locFile != null) { - List sources = JAXB.unmarshal(locFile.getFile(), - VbSourceList.class).getEntries(); + List sources = null; + try (InputStream is = locFile.openInputStream()) { + sources = JAXB.unmarshal(is, VbSourceList.class) + .getEntries(); + } catch (IOException | LocalizationException e) { + statusHandler + .handle(Priority.ERROR, + locFile.getName() + + " was excluded from sources menu due to error reading file."); + } if (sources != null) { Iterator itr = sources.iterator(); while (itr.hasNext()) {