Omaha #3861 Show VB data types that cannot create products as unavailable.

Former-commit-id: dd1beae239fbe9424bfb881c5427deccd5c98d30
This commit is contained in:
Ben Steffensmeier 2015-10-05 17:41:49 -05:00
parent 386b8abc65
commit 14128e97c9
12 changed files with 76 additions and 28 deletions

View file

@ -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" };
}

View file

@ -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();

View file

@ -245,7 +245,7 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
* ()
*/
@Override
protected String[] getPlugins(ViewMenu setting) {
protected String[] getPlugins() {
return new String[] { GridInventory.PLUGIN_NAME };
}

View file

@ -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
* </pre>
*
* @author bsteffen
@ -76,7 +75,7 @@ public class DmdDataCatalog extends AbstractDataCatalog {
}
@Override
protected String[] getPlugins(ViewMenu setting) {
protected String[] getPlugins() {
return new String[] { "radar" };
}

View file

@ -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<String>(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;
}

View file

@ -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;
}

View file

@ -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" };
}

View file

@ -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];
}
/*

View file

@ -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;
}

View file

@ -73,6 +73,8 @@ public class ProductLoader {
private List<AbstractRenderableDisplay> 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);

View file

@ -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<String, RequestConstraint> 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)) {

View file

@ -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
*
* </pre>
*
@ -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<VbSource> sources = JAXB.unmarshal(locFile.getFile(),
VbSourceList.class).getEntries();
List<VbSource> 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<VbSource> itr = sources.iterator();
while (itr.hasNext()) {