diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/rsc/DrawBoxResource.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/rsc/DrawBoxResource.java index ba0bd4db62..6340c8023d 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/rsc/DrawBoxResource.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/rsc/DrawBoxResource.java @@ -25,7 +25,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; -import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.viz.core.IDisplayPaneContainer; @@ -58,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Jun 21, 2013 2132 mpduff Convert coordinates to East/West before drawing. * Oct 10, 2013 2428 skorolev Fixed memory leak for Regions * Oct 24, 2013 2486 skorolev Fixed an error of editing subset box. + * Nov 06, 2013 2486 skorolev Corrected the regions and zoom handling defects. * * * @@ -165,6 +165,7 @@ public class DrawBoxResource extends double[] lr = descriptor.worldToPixel(new double[] { c2.x, c2.y }); PixelExtent pe = new PixelExtent(ul[0], lr[0], ul[1], lr[1]); target.drawRect(pe, boxColor, 3, 1); + getMapRectangle(); } } @@ -191,17 +192,6 @@ public class DrawBoxResource extends getMapRectangle(); - // Create initial regions - if ((c1 != null) && (c2 != null)) { - double[] luBox = getResourceContainer().translateInverseClick(c1); - x1 = (int) luBox[0]; - y1 = (int) luBox[1]; - double[] rbBox = getResourceContainer().translateInverseClick(c2); - x2 = (int) rbBox[0]; - y2 = (int) rbBox[1]; - createRegions(); - } - } /* @@ -274,8 +264,10 @@ public class DrawBoxResource extends if (c != null) { if (boxSide == 0) { c1.y = c.y; + y1 = y; } else if (boxSide == 1) { c1.x = c.x; + x1 = x; c1.x = spatialUtils.convertToEasting(c1.x); if (spatialUtils.getLongitudinalShift() > 0 && x >= x360) { @@ -283,8 +275,10 @@ public class DrawBoxResource extends } } else if (boxSide == 2) { c2.y = c.y; + y2 = y; } else if (boxSide == 3) { c2.x = c.x; + x2 = x; c2.x = spatialUtils.convertToEasting(c2.x); if (spatialUtils.getLongitudinalShift() > 0 && x >= x360) { @@ -310,9 +304,7 @@ public class DrawBoxResource extends } } else if (mouseButton == 2) { super.handleMouseDownMove(x, y, 1); - } - return true; } @@ -407,20 +399,6 @@ public class DrawBoxResource extends } return true; } - - /* - * Turn off mouse wheel. - * - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.input.PanHandler#handleMouseWheel(org.eclipse - * .swt.widgets.Event, int, int) - */ - @Override - public boolean handleMouseWheel(Event event, int x, int y) { - return false; - } } /** @@ -574,7 +552,7 @@ public class DrawBoxResource extends } /** - * Map's rectangle in pixels + * Get map's rectangle in pixels after changing. */ private void getMapRectangle() { Coordinate top = new Coordinate(); @@ -592,5 +570,16 @@ public class DrawBoxResource extends int yBottom = (int) Math.round(pointBot[1]); mapRctgl = new Rectangle(xTop, yTop, (xBottom - xTop), (yBottom - yTop)); + + // Re-calculate regions + if ((c1 != null) && (c2 != null)) { + double[] luBox = getResourceContainer().translateInverseClick(c1); + x1 = (int) luBox[0]; + y1 = (int) luBox[1]; + double[] rbBox = getResourceContainer().translateInverseClick(c2); + x2 = (int) rbBox[0]; + y2 = (int) rbBox[1]; + createRegions(); + } } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionConfigurationManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionConfigurationManager.java index cd45be53e6..338bdaf266 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionConfigurationManager.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionConfigurationManager.java @@ -22,8 +22,6 @@ package com.raytheon.uf.viz.datadelivery.subscription; import java.io.File; import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -38,6 +36,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.LocalizationOpFailedException; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -61,7 +60,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.SubColumnNames; * Jun 07, 2012 687 lvenable Table data refactor. * Jan 03, 2013 1437 bgonzale Put default configuration file code here. * Jun 21, 2013 2130 mpduff Fix ordering of columns. - * + * Nov 06, 2013 2358 mpduff Remove default configuration code. * * * @author mpduff @@ -106,6 +105,9 @@ public class SubscriptionConfigurationManager { /** File name */ String fileName; + /** Current Configuration File */ + private LocalizationFile currentConfigFile = null; + /** * Private Constructor */ @@ -181,10 +183,8 @@ public class SubscriptionConfigurationManager { } try { - marshaller.marshal(xml, file); locFile.save(); - } catch (JAXBException e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } catch (Exception e) { @@ -274,53 +274,27 @@ public class SubscriptionConfigurationManager { /** * Set the current configuration file. * - * @param currentConfigFile + * @param configFile */ public void setConfigFile(LocalizationFile configFile) { File file = configFile.getFile(); fileName = configFile.getName(); - try { - xml = (SubscriptionManagerConfigXML) unmarshaller.unmarshal(file); - } catch (JAXBException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + this.currentConfigFile = configFile; + if (!file.exists()) { + if (xml == null) { + xml = new SubscriptionManagerConfigXML(); + } + } else { + try { + xml = (SubscriptionManagerConfigXML) unmarshaller + .unmarshal(file); + } catch (JAXBException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } } } - /** - * Get the available configuration files to list. - * - * @return Map of context:name to LocalizationFile. - */ - public Map getConfigFileNameMap() { - String[] extensions = new String[] { ".xml" }; - IPathManager pm = PathManagerFactory.getPathManager(); - TreeMap locFileMap = new TreeMap(); - ArrayList contextList = new ArrayList(); - contextList.add(pm.getContext(LocalizationType.CAVE_STATIC, - LocalizationLevel.BASE)); - contextList.add(pm.getContext(LocalizationType.CAVE_STATIC, - LocalizationLevel.SITE)); - contextList.add(pm.getContext(LocalizationType.CAVE_STATIC, - LocalizationLevel.USER)); - LocalizationFile[] locFiles = pm.listFiles(contextList - .toArray(new LocalizationContext[contextList.size()]), - CONFIG_PATH, extensions, false, true); - - if (locFiles == null) { - return new TreeMap(); - } - - for (int i = 0; i < locFiles.length; i++) { - String locFile = locFiles[i].getName(); - int idx = locFile.lastIndexOf("/"); - String newStr = locFile.substring(idx + 1); - - locFileMap.put(locFiles[i].getContext().getLocalizationLevel() - + ":" + newStr, locFiles[i]); - } - return locFileMap; - } - /** * Set the hidden and visible columns in the configuration. * @@ -352,7 +326,6 @@ public class SubscriptionConfigurationManager { } xml.setColumnList(columnList); - saveXml(); } /** @@ -394,15 +367,91 @@ public class SubscriptionConfigurationManager { saveXml(); } + /** + * Get the localization (config) file path + * + * @return + */ public String getLocalizationPath() { return CONFIG_PATH; } + /** + * Get the default config file's full path + * + * @return + */ public String getDefaultXMLConfig() { return DEFAULT_CONFIG_XML; } + /** + * Get the default config file's name + * + * @return + */ + public String getDefaultXMLConfigFileName() { + return DEFAULT_CONFIG_XML_FILE; + } + + /** + * Set the sorted Column + * + * @param columnName + * @param sortDirection + */ public void setSortedColumn(String columnName, SortDirection sortDirection) { xml.setSortColumn(columnName, sortDirection); } + + /** + * Unmarshal the file. + * + * @param file + * @return + * @throws JAXBException + */ + public SubscriptionManagerConfigXML unmarshall(File file) + throws JAXBException { + Object obj = unmarshaller.unmarshal(file); + if (obj instanceof SubscriptionManagerConfigXML) { + return (SubscriptionManagerConfigXML) obj; + } + + return null; + } + + /** + * @return the currentConfigFile + */ + public LocalizationFile getCurrentConfigFile() { + return currentConfigFile; + } + + /** + * @param currentConfigFile + * the currentConfigFile to set + */ + public void setCurrentConfigFile(LocalizationFile currentConfigFile) { + this.currentConfigFile = currentConfigFile; + } + + /** + * Delete the localization file. + * + * @param file + * the file to delete + */ + public void deleteXml(LocalizationFile file) { + try { + boolean success = file.delete(); + if (!success) { + statusHandler.handle(Priority.WARN, + "Error deleting " + file.getName()); + } + } catch (LocalizationOpFailedException e) { + statusHandler.handle(Priority.PROBLEM, + "Error deleting " + file.getName(), e); + } + } } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerConfigDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerConfigDlg.java index accfa3d2f4..c94f688f91 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerConfigDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerConfigDlg.java @@ -20,10 +20,6 @@ package com.raytheon.uf.viz.datadelivery.subscription; import java.util.ArrayList; -import java.util.Map; -import java.util.Map.Entry; - -import javax.xml.bind.JAXBException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -31,25 +27,15 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import com.raytheon.uf.common.localization.LocalizationFile; -import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; -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.datadelivery.common.ui.ITableChange; -import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg; -import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType; import com.raytheon.uf.viz.datadelivery.common.xml.ColumnXML; import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; -import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.widgets.duallist.DualList; import com.raytheon.viz.ui.widgets.duallist.DualListConfig; @@ -68,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig; * instead. Added configuration file management controls to * this dialog. * Sep 04, 2013 2314 mpduff Load/save config dialog now non-blocking. + * Nov 06, 2013 2358 mpduff Removed configuration file management from this dialog. * * * @@ -76,11 +63,6 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig; */ public class SubscriptionManagerConfigDlg extends CaveSWTDialog { - - /** Status Handler */ - private final IUFStatusHandler statusHandler = UFStatus - .getHandler(SubscriptionManagerDlg.class); - /** Callback to SubscriptionManagerDialog */ private final ITableChange callback; @@ -90,31 +72,11 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog { /** Dual list widget */ private DualList dualList; - /** - * Configuration file selection combo. - */ - private Combo fileCombo; - - /** - * Map of context level:file name to LocalizationFile. - */ - private Map configFileMap; - /** * Configuration manager. */ private final SubscriptionConfigurationManager configManager; - /** - * Delete saved configuration file dialog. - */ - private LoadSaveConfigDlg deleteDialog; - - /** - * Load saved configuration file dialog. - */ - private LoadSaveConfigDlg loadDlg; - /** * Initialization Constructor. * @@ -143,70 +105,10 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog { shell.setLayout(gl); shell.setLayoutData(gd); - createTopControls(); createMain(); createBottomButtons(); } - private void createTopControls() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - GridLayout gl = new GridLayout(2, false); - - gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - gl = new GridLayout(2, false); - Composite topComp = new Composite(shell, SWT.NONE); - topComp.setLayout(gl); - topComp.setLayoutData(gd); - - Composite comp = new Composite(topComp, SWT.NONE); - - gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gl = new GridLayout(4, false); - comp.setLayout(gl); - comp.setLayoutData(gd); - - Label configurationFileLabel = new Label(comp, SWT.NONE); - configurationFileLabel.setText("Configuration:"); - - GridData comboData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - fileCombo = new Combo(comp, SWT.READ_ONLY); - fileCombo.setLayoutData(comboData); - fileCombo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - try { - handleConfigSelected(); - } catch (JAXBException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - } - } - }); - updateFileCombo(); - } - - /** - * Update the file combo based on the available configurations and currently - * selected config. - */ - private void updateFileCombo() { - configFileMap = configManager.getConfigFileNameMap(); - fileCombo.removeAll(); - - int index = 0; - for (Entry entry : configFileMap.entrySet()) { - fileCombo.add(entry.getKey()); - if (configManager.isCurrentConfig(entry.getValue())) { - fileCombo.select(index); - } - ++index; - } - - if (fileCombo.getSelectionIndex() < 0 && index > 0) { - fileCombo.select(0); - } - } - private void createMain() { GridData groupData = new GridData(SWT.CENTER, SWT.CENTER, true, true); GridLayout groupLayout = new GridLayout(1, false); @@ -291,80 +193,6 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog { close(); } }); - - Button newBtn = new Button(bottomComp, SWT.PUSH); - newBtn.setText("New"); - newBtn.setLayoutData(btnData); - newBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - handleNew(); - } - }); - Button deleteBtn = new Button(bottomComp, SWT.PUSH); - deleteBtn.setText("Delete"); - deleteBtn.setLayoutData(btnData); - deleteBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - handleDelete(); - } - }); - } - - /** - * Open dialog to remove a configuration. - */ - protected void handleDelete() { - if (deleteDialog == null || deleteDialog.isDisposed()) { - deleteDialog = new LoadSaveConfigDlg(shell, DialogType.DELETE, - configManager.getLocalizationPath(), - configManager.getDefaultXMLConfig()); - deleteDialog.setCloseCallback(new ICloseCallback() { - @Override - public void dialogClosed(Object returnValue) { - if (returnValue instanceof LocalizationFile) { - LocalizationFile file = (LocalizationFile) returnValue; - try { - file.delete(); - } catch (LocalizationOpFailedException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - } - updateFileCombo(); - handleApply(); - } - } - }); - deleteDialog.open(); - } else { - deleteDialog.bringToTop(); - } - } - - /** - * Open dialog for a new configuration. - */ - protected void handleNew() { - if (loadDlg == null || loadDlg.isDisposed()) { - loadDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS, - configManager.getLocalizationPath(), - configManager.getDefaultXMLConfig(), true); - loadDlg.setCloseCallback(new ICloseCallback() { - @Override - public void dialogClosed(Object returnValue) { - if (returnValue instanceof LocalizationFile) { - LocalizationFile file = (LocalizationFile) returnValue; - configManager.saveXml(file); - handleApply(); - updateFileCombo(); - } - } - }); - loadDlg.open(); - } else { - loadDlg.bringToTop(); - } } /** @@ -389,19 +217,4 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog { handleApply(); close(); } - - /** - * Load a selected configuration. - * - * @throws JAXBException - */ - private void handleConfigSelected() throws JAXBException { - String selectedKey = fileCombo.getItem(fileCombo.getSelectionIndex()); - LocalizationFile selectedFile = configFileMap.get(selectedKey); - - configManager.setConfigFile(selectedFile); - updateDualListSelections(); - callback.tableChanged(); - } - } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java index eb6df16f58..b77cd64892 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.datadelivery.subscription; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -28,6 +29,8 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import javax.xml.bind.JAXBException; + import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; @@ -57,6 +60,12 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext; +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.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -67,16 +76,20 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction; import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction; import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange; +import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg; +import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType; import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig; import com.raytheon.uf.viz.datadelivery.help.HelpManager; import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp.SubscriptionType; import com.raytheon.uf.viz.datadelivery.subscription.approve.SubscriptionApprovalDlg; +import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.presenter.IDisplay; /** @@ -128,6 +141,7 @@ import com.raytheon.viz.ui.presenter.IDisplay; * Jul 26, 2013 2232 mpduff Refactored Data Delivery permissions. * Sep 25. 2013 2409 mpduff Add check for widget disposed after calling configuration. * Oct 25, 2013 2292 mpduff Move overlap checks to edex. + * Nov 06, 2013 2358 mpduff Resurrected file management code. * * * @author mpduff @@ -225,6 +239,15 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements /** The office display list */ private final SortedSet officeDisplayItems = new TreeSet(); + /** Load config dialog */ + private LoadSaveConfigDlg loadDlg; + + /** Delete config dialog */ + private LoadSaveConfigDlg deleteDlg; + + /** SaveAs config dialog */ + private LoadSaveConfigDlg saveAsDlg; + /** * Constructor * @@ -242,13 +265,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements setText("Data Delivery Subscription Manager"); } - @Override - protected void disposed() { - super.disposed(); - // save any table sort direction changes - SubscriptionConfigurationManager.getInstance().saveXml(); - } - /* * (non-Javadoc) * @@ -371,6 +387,59 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements new MenuItem(fileMenu, SWT.SEPARATOR); + MenuItem setDefaultMI = new MenuItem(fileMenu, SWT.NONE); + setDefaultMI.setText("Set as Default"); + setDefaultMI.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + handleSetDefault(); + } + }); + + MenuItem loadConfigMI = new MenuItem(fileMenu, SWT.NONE); + loadConfigMI.setText("Load Configuration..."); + loadConfigMI.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + try { + handleLoadConfig(); + } catch (JAXBException e) { + statusHandler + .handle(com.raytheon.uf.common.status.UFStatus.Priority.ERROR, + e.getLocalizedMessage(), e); + } + } + }); + + MenuItem saveConfigMI = new MenuItem(fileMenu, SWT.NONE); + saveConfigMI.setText("Save Configuration"); + saveConfigMI.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + handleSaveConfig(); + } + }); + + MenuItem saveConfigAsMI = new MenuItem(fileMenu, SWT.NONE); + saveConfigAsMI.setText("Save Configuration As..."); + saveConfigAsMI.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + handleSaveAsConfig(); + } + }); + + MenuItem deleteConfigMI = new MenuItem(fileMenu, SWT.NONE); + deleteConfigMI.setText("Delete Configuration..."); + deleteConfigMI.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleDeleteConfig(); + } + }); + + new MenuItem(fileMenu, SWT.SEPARATOR); + MenuItem exitMI = new MenuItem(fileMenu, SWT.NONE); exitMI.setText("Exit"); exitMI.addSelectionListener(new SelectionAdapter() { @@ -690,6 +759,138 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements } } + /** + * Set the default configuration file. + */ + private void handleSetDefault() { + SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager + .getInstance(); + + String fileName = configMan.getDefaultXMLConfig(); + + IPathManager pm = PathManagerFactory.getPathManager(); + LocalizationContext context = pm.getContext( + LocalizationType.CAVE_STATIC, LocalizationLevel.USER); + + LocalizationFile locFile = pm.getLocalizationFile(context, fileName); + + try { + configMan.setCurrentConfigFile(locFile); + configMan.saveXml(); + } catch (Exception e) { + statusHandler.handle( + com.raytheon.uf.common.status.UFStatus.Priority.ERROR, + e.getLocalizedMessage(), e); + } + } + + /** + * Load configuration action. + */ + private void handleLoadConfig() throws JAXBException { + if (loadDlg == null || loadDlg.isDisposed()) { + final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager + .getInstance(); + loadDlg = new LoadSaveConfigDlg(shell, DialogType.OPEN, + configMan.getLocalizationPath(), + configMan.getDefaultXMLConfigFileName(), true); + loadDlg.setCloseCallback(new ICloseCallback() { + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof LocalizationFile) { + try { + LocalizationFile fileName = (LocalizationFile) returnValue; + // Get the name of the selected file + if (fileName != null && fileName.exists()) { + File file = fileName.getFile(); + + if (file != null) { + SubscriptionManagerConfigXML xml = configMan + .unmarshall(file); + configMan.setXml(xml); + configMan.setCurrentConfigFile(fileName); + tableChanged(); + } + } + } catch (JAXBException e) { + statusHandler.error(e.getLocalizedMessage(), e); + } + } + loadDlg = null; + } + }); + + loadDlg.open(); + } else { + loadDlg.bringToTop(); + } + } + + /** + * Save configuration action. + */ + private void handleSaveConfig() { + final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager + .getInstance(); + if (configMan.getCurrentConfigFile() == null) { + handleSaveAsConfig(); + } else { + // configMan.setConfigFile(configMan.getCurrentConfigFile()); + configMan.saveXml(); + } + } + + /** + * Save as configuration action. + */ + private void handleSaveAsConfig() { + final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager + .getInstance(); + if (saveAsDlg == null || saveAsDlg.isDisposed()) { + saveAsDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS, + configMan.getLocalizationPath(), + configMan.getDefaultXMLConfigFileName()); + saveAsDlg.setCloseCallback(new ICloseCallback() { + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof LocalizationFile) { + LocalizationFile fileName = (LocalizationFile) returnValue; + configMan.setConfigFile(fileName); + configMan.saveXml(); + } + } + }); + saveAsDlg.open(); + } else { + saveAsDlg.bringToTop(); + } + } + + /** + * Delete configuration action. + */ + private void handleDeleteConfig() { + final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager + .getInstance(); + if (deleteDlg == null || deleteDlg.isDisposed()) { + deleteDlg = new LoadSaveConfigDlg(shell, DialogType.DELETE, + configMan.getLocalizationPath(), true); + deleteDlg.setCloseCallback(new ICloseCallback() { + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof LocalizationFile) { + LocalizationFile fileName = (LocalizationFile) returnValue; + configMan.deleteXml(fileName); + tableChanged(); + } + } + }); + deleteDlg.open(); + } else { + deleteDlg.bringToTop(); + } + } + /** * Handle the copy action. */ @@ -850,7 +1051,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements try { if (DataDeliveryServices.getPermissionsService() .checkPermission(user, msg, permission).isAuthorized()) { - final List updatedList = new ArrayList(); int count = tableComp.getTable().getSelectionCount(); @@ -1143,21 +1343,33 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements return exceptions; } + /** + * {@inheritDoc} + */ @Override public void activateButtonUpdate(String text) { activateBtn.setText(text); } + /** + * {@inheritDoc} + */ @Override public void groupSelectionUpdate(String fileName) { // unused } + /** + * {@inheritDoc} + */ @Override public String getGroupNameTxt() { return null; } + /** + * {@inheritDoc} + */ @Override public void tableSelection() { // not currently used @@ -1171,6 +1383,9 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements return DataDeliveryUtils.showYesNoMessage(shell, title, message) == SWT.YES; } + /** + * {@inheritDoc} + */ @Override public void tableLock(boolean isLocked) { // no-op diff --git a/cave/com.raytheon.viz.pointdata/plugin.xml b/cave/com.raytheon.viz.pointdata/plugin.xml index 37c3f89616..4933c46302 100644 --- a/cave/com.raytheon.viz.pointdata/plugin.xml +++ b/cave/com.raytheon.viz.pointdata/plugin.xml @@ -20,25 +20,14 @@ --> - + - - + sortID="115"/> + --> * SOFTWARE HISTORY - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 11/20/2006 brockwoo Initial creation. - * 02/17/2009 njensen Refactored to new rsc architecture. - * 03/17/2009 2105 jsanchez Plot goessounding/poessounding availability. - * 03/30/2009 2169 jsanchez Updated initNewFrame. - * 04/09/2009 952 jsanchez Plot acars. - * 04/13/2009 2251 jsanchez Plot profilers. - * 05/12/2009 2338 jsanchez Updated resourceChanged. Registered units. - * 06/08/2009 2450 jsanchez Updated inpsect method to find closest plot. - * ====================================== - * AWIPS2 DR Work - * 08/09/2012 1011 jkorman Added screenToWorldRatio calc to paintInternal. + * Date Ticket# Engineer Description + * ------------- -------- ----------- -------------------------- + * Nov 20, 2006 brockwoo Initial creation. + * Feb 17, 2009 njensen Refactored to new rsc architecture. + * Mar 17, 2009 2105 jsanchez Plot goessounding/poessounding + * availability. + * Mar 30, 2009 2169 jsanchez Updated initNewFrame. + * Apr 09, 2009 952 jsanchez Plot acars. + * Apr 13, 2009 2251 jsanchez Plot profilers. + * May 12, 2009 2338 jsanchez Updated resourceChanged. Registered + * units. + * Jun 08, 2009 2450 jsanchez Updated inpsect method to find closest + * plot. + * Aug 09, 2012 1011 jkorman Added screenToWorldRatio calc to + * paintInternal. + * Nov 06, 2013 2493 bsteffen Removed IPlotDataResource + * * * * @@ -97,7 +100,7 @@ import com.vividsolutions.jts.geom.Envelope; */ public class PlotResource extends AbstractVizResource implements - IPlotDataResource, IResourceDataChanged { + IResourceDataChanged { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(PlotResource.class); @@ -109,10 +112,6 @@ public class PlotResource extends private DataTime displayedObsTime; - private boolean metarEnabled; - - private boolean mesowestEnabled; - private VA_Advanced progDisc; private double actualPlotWidth; @@ -197,8 +196,6 @@ public class PlotResource extends public PlotResource(PlotResourceData data, LoadProperties props) { super(data, props); this.dataTimes = new ArrayList(); - metarEnabled = true; - mesowestEnabled = true; this.progDisc = new VA_Advanced(); this.stationsToParse = new ArrayList(); this.frameInfo = new HashMap(); @@ -446,46 +443,6 @@ public class PlotResource extends generator.shutdown(); } - /** - * Returns if mesowest data is being displayed by the layer . - * - * @return Whether mesowest is enabled or not - */ - public boolean isMesowestEnabled() { - return mesowestEnabled; - } - - /** - * Returns if metar data is being displayed by the layer. - * - * @return Whether metar is enabled or not - */ - public boolean isMetarEnabled() { - return metarEnabled; - } - - /** - * Enables/disables mesowest data. - * - * @param flag - * Enable or disable mesowest on the display - */ - public void setMesowestMode(boolean flag) { - mesowestEnabled = flag; - // aTarget.setNeedsRefresh(true); - } - - /** - * Enables/disables metar data. - * - * @param flag - * Enable or disable metar on the display - */ - public void setMetarMode(boolean flag) { - metarEnabled = flag; - // aTarget.setNeedsRefresh(true); - } - @Override public DataTime[] getDataTimes() { try { diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMesowestAction.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMesowestAction.java deleted file mode 100644 index 2116331259..0000000000 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMesowestAction.java +++ /dev/null @@ -1,82 +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.viz.pointdata.ui.cmenu; - -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource; -import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; - -/** - * - * Enable/Disable metar data within a layer - * - *
- * 
- *  SOFTWARE HISTORY
- * 
- *  Date         Ticket#     Engineer    Description
- *  ------------ ----------  ----------- --------------------------
- *  Nov 28, 2006             brockwoo    Initial Creation.
- * 
- * 
- * - * @author brockwoo - * @version 1 - */ - -public class EnableDisableMesowestAction extends AbstractRightClickAction { - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc(); - boolean isEnabled = rsc.isMesowestEnabled(); - rsc.setMesowestMode(!isEnabled); - this.setChecked(!isEnabled); - if (isEnabled && !rsc.isMetarEnabled()) { - rsc.setMetarMode(true); - } - } - - @Override - public void setSelectedRsc(ResourcePair selectedRsc) { - super.setSelectedRsc(selectedRsc); - IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc(); - - boolean curState = rsc.isMesowestEnabled(); - this.setChecked(curState); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#getText() - */ - @Override - public String getText() { - return "Enable Mesowest"; - } - -} diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMetarAction.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMetarAction.java deleted file mode 100644 index 123104226e..0000000000 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/ui/cmenu/EnableDisableMetarAction.java +++ /dev/null @@ -1,82 +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.viz.pointdata.ui.cmenu; - -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource; -import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; - -/** - * - * Enable/Disable metar data within a layer - * - *
- * 
- *  SOFTWARE HISTORY
- * 
- *  Date         Ticket#     Engineer    Description
- *  ------------ ----------  ----------- --------------------------
- *  Nov 28, 2006             brockwoo    Initial Creation.
- * 
- * 
- * - * @author brockwoo - * @version 1 - */ - -public class EnableDisableMetarAction extends AbstractRightClickAction { - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc(); - boolean isEnabled = rsc.isMetarEnabled(); - rsc.setMetarMode(!isEnabled); - this.setChecked(!isEnabled); - if (isEnabled && !rsc.isMesowestEnabled()) { - rsc.setMesowestMode(true); - } - } - - @Override - public void setSelectedRsc(ResourcePair selectedRsc) { - super.setSelectedRsc(selectedRsc); - IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc(); - - boolean curState = rsc.isMetarEnabled(); - this.setChecked(curState); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#getText() - */ - @Override - public String getText() { - return "Enable METAR"; - } - -} diff --git a/deltaScripts/14.2.1/dropMesowest.sh b/deltaScripts/14.2.1/dropMesowest.sh new file mode 100644 index 0000000000..b80d32fc24 --- /dev/null +++ b/deltaScripts/14.2.1/dropMesowest.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# DR #2493 remove mesowest from the database + +PSQL="/awips2/psql/bin/psql" + +SQL_COMMAND=" +delete from plugin_info where name = 'mesowest'; +drop table if exists mesowest; +drop sequence if exists mesowestseq; +" +${PSQL} -U awips -d metadata -c "${SQL_COMMAND}" diff --git a/edexOsgi/build.edex/esb/conf/logback-registry.xml b/edexOsgi/build.edex/esb/conf/logback-registry.xml index bfb6ca2234..7aed0ec22d 100644 --- a/edexOsgi/build.edex/esb/conf/logback-registry.xml +++ b/edexOsgi/build.edex/esb/conf/logback-registry.xml @@ -90,12 +90,13 @@ - HarvesterLog:harvesterThreadPool.*,crawlerThreadPool.*,Crawler.* + HarvesterLog:harvesterThreadPool.*,crawlerThreadPool.*,Crawler.*,RetrievalLog:retrievalThreadPool.*,retrievalThreadPool.*,Retrieval.* console + - + @@ -201,16 +202,6 @@ - - - - - - - - - - diff --git a/edexOsgi/build.edex/esb/conf/modes.xml b/edexOsgi/build.edex/esb/conf/modes.xml index ebcf64e368..e36452e92f 100644 --- a/edexOsgi/build.edex/esb/conf/modes.xml +++ b/edexOsgi/build.edex/esb/conf/modes.xml @@ -234,7 +234,7 @@ ebxml.*\.xml dataDeliveryTemplate - adhoc-datadelivery-wfo.xml + datadelivery-wfo-cron.xml .*datadelivery-ncf.* harvester-* crawler-* diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/harvester/MADIS-harvester.xml b/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/harvester/MADIS-harvester.xml index 9dd86c86f8..34e548d512 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/harvester/MADIS-harvester.xml +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/harvester/MADIS-harvester.xml @@ -8,7 +8,7 @@ - http://your.url.here:8085 + http://your.url.here:8085/wfs user password CLEAR diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java index f8a7ea1c7e..91ce3e4601 100644 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java @@ -19,8 +19,6 @@ **/ package com.raytheon.uf.common.monitor.data; -import java.text.SimpleDateFormat; -import java.util.TimeZone; /** * Constants for Observations within the Decision Assistance Tool Suite that @@ -29,10 +27,13 @@ import java.util.TimeZone; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 10, 2009 1999       grichard    Initial creation.
- * Jan 26, 2010 4268       skorolev    Corrected DisplayVarName according to VarName for SWELL
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Feb 10, 2009  1999     grichard    Initial creation.
+ * Jan 26, 2010  4268     skorolev    Corrected DisplayVarName according to
+ *                                    VarName for SWELL
+ * Nov 06, 2013  2493     bsteffen    Remove unused constants.
+ * 
  * 
* * @author grichard @@ -45,16 +46,6 @@ public final class ObConst { private ObConst() { } - // Date Format - public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat( - "yyyy-MM-dd HH:mm"); - - public static SimpleDateFormat obTimeFormat = DATE_FORMAT; - - static { - obTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - } - // Time Window in units of hours public static final int THREAT_INTERVAL_HOURS = 2; @@ -85,21 +76,6 @@ public final class ObConst { public static final String SKC_SKY_STRING = "SKC"; - // Image type used for Fog Monitor - public enum ImageType { - VIS, IR3_9, IR10_7, Undefined_ImageType - } - - // Intensity Level - public enum IntensityLevel { - LIGHT, MODERATE, HEAVY - }; - - // Monitor Area - // public enum MonitorArea { - // SS, FM, SS_FM - // } - // Chosen Application Key public enum ChosenAppKey { SNOW, FOG, SAFESEAS @@ -115,11 +91,6 @@ public final class ObConst { BLACK, GRAY, GREEN, YELLOW, RED, YELLOW_LO, YELLOW_HI, RED_LO, RED_HI, UNDEFINED_THREATLEVEL } - // Threat Level Strings - public static final String[] THREAT_LEVEL_STRINGS = { "black", "gray", - "green", "yellow", "red", "yellow_lo", "yellow_hi", "red_lo", - "red_hi" }; - // Report Type public enum ReportType { SYNOPTIC_FIXED_LAND, @@ -158,19 +129,6 @@ public final class ObConst { VISIBILITY, WIND_SPEED, MAX_WIND_SPEED, GUST_SPEED, TEMPERATURE, WIND_CHILL, SNOW_DEPTH, PRIM_SWELL_HT, PRIM_SWELL_PD, PRIM_SWELL_DIR, SEC_SWELL_HT, SEC_SWELL_PD, SEC_SWELL_DIR, STATIONARY, WAVE_HEIGHT, WAVE_PERIOD, WAVE_STEEPNESS, LATITUDE, LONGITUDE, NOMINAL_DATETIME, OBSERVATION_DATETIME, PLATFORM_ID, PRESSURE, PRES_CHANGE, WIND_DIR, FOG, ZONE_ID, DEWPOINT, PRES_WX, SEA_SURFACE_TEMPERATURE, HOURLY_PRECIP, SNINCR_HOURLY, SNINCR_TOTAL, FROSTBITE_TIME, RELATIVE_HUMIDITY, CEILING, DEWPOINT_DEPR, SEA_LEVEL_PRESS, UNDEFINED_VARIABLE } - // Variable Name Strings - public static final String[] VAR_NAME_TEXT = { "GUST_SPEED", "LATITUDE", - "LONGITUDE", "NOMINAL_DATETIME", "OBSERVATION_DATETIME", - "PLATFORM_ID", "PRESSURE", "PRES_CHANGE", "PRIM_SWELL_DIR", - "PRIM_SWELL_HT", "PRIM_SWELL_PD", "SEC_SWELL_DIR", "SEC_SWELL_HT", - "SEC_SWELL_PD", "STATIONARY", "TEMPERATURE", "VISIBILITY", - "WAVE_HEIGHT", "WAVE_PERIOD", "WAVE_STEEPNESS", "WIND_DIR", - "WIND_SPEED", "MAX_WIND_SPEED", "FOG", "ZONE_ID", "DEWPOINT", - "PRES_WX", "SEA_SURFACE_TEMPERATURE", "HOURLY_PRECIP", - "SNOW_DEPTH", "SNINCR_HOURLY", "SNINCR_TOTAL", "WIND_CHILL", - "FROSTBITE_TIME", "RELATIVE_HUMIDITY", "CEILING", "DEWPOINT_DEPR", - "SEA_LEVEL_PRESS", "UNDEFINED_VARIABLE" }; - // Display Variable Names public enum DisplayVarName { SCA_WIND_SPEED, SCA_GUST_SPEED, SCA_MAX_WIND_SPEED, SCA_WAVE_HEIGHT, GALE_WIND_SPEED, GALE_GUST_SPEED, GALE_MAX_WIND_SPEED, STORM_WIND_SPEED, STORM_GUST_SPEED, STORM_MAX_WIND_SPEED, HURRICANE_WIND_SPEED, HURRICANE_GUST_SPEED, HURRICANE_MAX_WIND_SPEED, VAR_WIND_DIR, VAR_WIND_SPEED, VAR_MAX_WIND_SPEED, VAR_GUST_SPEED, VAR_VISIBILITY, VAR_TEMPERATURE, VAR_DEWPOINT, VAR_SEA_SURFACE_TEMPERATURE, VAR_WAVE_HEIGHT, VAR_WAVE_STEEPNESS, VAR_TIME, VAR_LATITUDE, VAR_LONGITUDE, VAR_PRESSURE, VAR_PRES_CHANGE, VAR_SNOW_DEPTH, VAR_SNINCR_HOURLY, VAR_SNINCR_TOTAL, VAR_WIND_CHILL, VAR_FROSTBITE_TIME, VAR_HOURLY_PRECIP, VAR_PRIM_SWELL_HT, VAR_PRIM_SWELL_PD, VAR_PRIM_SWELL_DIR, VAR_SEC_SWELL_HT, VAR_SEC_SWELL_PD, VAR_SEC_SWELL_DIR, VAR_FOG, BLIZ_WIND_SPEED, BLIZ_GUST_SPEED, BLIZ_MAX_WIND_SPEED, BLIZ_VISIBILITY, FRZ_HOURLY_PRECIP, FRZ_TEMPERATURE, HSW_SNOW_DEPTH, HSW_SNINCR_HOURLY, HSW_SNINCR_TOTAL, VAR_RELATIVE_HUMIDITY, VAR_CEILING, VAR_DEWPOINT_DEPR, VAR_SEA_LEVEL_PRESS @@ -200,24 +158,6 @@ public final class ObConst { "kts", "kts", "nm", "in", "F", "in", "in", "in", "%", "ftx100", "F", "mb" }; - // Remarks section delimiter in METAR - public static final String REMARK_EXPR = "RMK"; - - // Snow increasing rapidly remark expression in a METAR's remarks section - public static final String SNINCR_EXPR = "(SNINCR )(\\d+)/(\\d+)"; - - // Snow depth remark expression in a METAR's remarks section - public static final String SNOW_DEPTH_EXPR = "4/\\(d{3})"; - - // Metar plugin name - public static final String METAR_PLUGIN_NAME = "obs"; - - // Marine plugin name - public static final String MARINE_PLUGIN_NAME = "scfobs"; - - // Meso plugin name - public static final String MESO_PLUGIN_NAME = "mesowest"; - // Default station identifier public static final String DEFAULT_STATION_NAME = "KOMA"; diff --git a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml index 6376546ab5..7b50503a88 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml @@ -160,7 +160,7 @@ Local 168 - (ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc) + (ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|qc) .*(\d{4})-(\d{2})-(\d{2})-(\d{2}).* {1} 2,3,4,5 diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.core.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.core.feature/feature.xml index 4ef2c03400..51ee27c088 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.core.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.core.feature/feature.xml @@ -18,7 +18,7 @@ - + - - - - - + - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/datadelivery-wfo-cron.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/datadelivery-wfo-cron.xml new file mode 100644 index 0000000000..4b97227ca8 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/datadelivery-wfo-cron.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/resources/com.raytheon.uf.edex.datadelivery.retrieval.properties b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/resources/com.raytheon.uf.edex.datadelivery.retrieval.properties index 5f3bc456f0..24e25148d9 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/resources/com.raytheon.uf.edex.datadelivery.retrieval.properties +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/resources/com.raytheon.uf.edex.datadelivery.retrieval.properties @@ -10,4 +10,9 @@ sbn.retrieval.transfer.wmo.header=LZ{0}{1}9{2} KWBC {3,date,ddHH00}\r\r\n retrieval.task.frequency=1 MINUTES # How often to check for retrieved subscriptions to notify of # Valid units: [MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS] -subnotify.task.frequency=1 MINUTES \ No newline at end of file +subnotify.task.frequency=1 MINUTES + +# Cron for Subscription Expiration Checker - currently 2 minutes past the hour +checkExpiredSubscription.cron=0+2+*+*+*+? +# Cron for subscriptions nearing the end of their active period - currently once/day at 00:15Z +checkEndingSubscription.cron=0+15+0+*+*+? \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/SubscriptionChecker.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/SubscriptionChecker.java new file mode 100644 index 0000000000..698f38028c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/SubscriptionChecker.java @@ -0,0 +1,271 @@ +/** + * 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.datadelivery.retrieval.util; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.transaction.annotation.Transactional; + +import com.google.common.annotations.VisibleForTesting; +import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord; +import com.raytheon.uf.common.datadelivery.registry.Subscription; +import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; +import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; +import com.raytheon.uf.common.registry.handler.RegistryHandlerException; +import com.raytheon.uf.common.serialization.SerializationException; +import com.raytheon.uf.common.serialization.SerializationUtil; +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.util.TimeUtil; +import com.raytheon.uf.edex.core.EDEXUtil; +import com.raytheon.uf.edex.core.EdexException; +import com.raytheon.uf.edex.datadelivery.event.notification.NotificationDao; + +/** + * A class to hold various subscription checks. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 29, 2013    2450    mpduff      Initial creation
+ * 
+ * 
+ * + * @author mpduff + * @version 1.0 + */ +@Transactional +public class SubscriptionChecker { + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(SubscriptionChecker.class); + + /** Notification DAO for sending/storing notification messages */ + private NotificationDao notificationDao; + + /** End point URI */ + private String uri; + + /** + * Constructor. + */ + public SubscriptionChecker() { + + } + + /** + * Constructor with notification URI parameter. + * + * @param uri + * Notification uri + */ + public SubscriptionChecker(String uri) { + this.uri = uri; + } + + /** + * Check for subscriptions that have expired in the last hour. + */ + public void expirationCheck() { + statusHandler.info("Starting expiration check..."); + ISubscriptionHandler handler = DataDeliveryHandlers + .getSubscriptionHandler(); + List subList = null; + try { + subList = handler.getAll(); + + List expiredList = getNewlyExpiredSubscriptions( + subList, TimeUtil.MILLIS_PER_HOUR); + + if (!expiredList.isEmpty()) { + StringBuilder buffer = new StringBuilder( + "Expired Subscriptions: "); + + for (Subscription sub : expiredList) { + buffer.append(sub.getName()).append(" "); + } + + NotificationRecord record = new NotificationRecord(); + record.setCategory("Subscription"); + record.setDate(TimeUtil.newGmtCalendar()); + record.setMessage(buffer.toString()); + record.setPriority(3); + record.setUsername("System"); + + // Send the notification + storeAndSend(record, uri); + statusHandler.debug(buffer.toString()); + } + } catch (RegistryHandlerException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + } + + /** + * Check for subscriptions that will become inactive in the next 24 hours. + */ + public void activePeriodEndCheck() { + statusHandler.info("Starting active period check..."); + ISubscriptionHandler handler = DataDeliveryHandlers + .getSubscriptionHandler(); + List subList = null; + try { + subList = handler.getAll(); + + List stoppingList = getSubscriptionsNearingEndOfActivePeriod(subList); + + if (!stoppingList.isEmpty()) { + StringBuilder buffer = new StringBuilder( + "Subscriptions becoming inactive in Next 24 hrs: "); + + for (Subscription sub : stoppingList) { + buffer.append(sub.getName()).append(" "); + } + + NotificationRecord record = new NotificationRecord(); + record.setCategory("Subscription"); + record.setDate(TimeUtil.newGmtCalendar()); + record.setMessage(buffer.toString()); + record.setPriority(3); + record.setUsername("System"); + + // Send the notification + storeAndSend(record, uri); + statusHandler.debug(buffer.toString()); + } + } catch (RegistryHandlerException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + + } + + /** + * Check for subscriptions that have expired within a time period defined by + * expiredPeriod. + * + * If expiredPeriod is one hour then a subscription will be flagged as + * expired if it expired within the last hour + * + * @param subList + * List of subscriptions to check + * @param expiredPeriod + * amount of time for expiration, in milliseconds + * + * @return List of subscriptions marked as expired + */ + @VisibleForTesting + List getNewlyExpiredSubscriptions(List subList, + long expiredPeriod) { + List expired = new ArrayList(); + statusHandler.debug("Checking for expired subs"); + if (subList != null && !subList.isEmpty()) { + Date now = TimeUtil.newGmtCalendar().getTime(); + for (Subscription sub : subList) { + Date end = sub.getSubscriptionEnd(); + if (end == null) { + continue; + } else if (end.before(now)) { + if (now.getTime() - end.getTime() < expiredPeriod) { + expired.add(sub); + } + } + } + } + + return expired; + } + + /** + * Check for subscriptions that are nearing the end of their active period. + * + * @param subList + * List of subscriptions to check + * @return List of subscriptions that are nearing the end of their active + * period + */ + @VisibleForTesting + List getSubscriptionsNearingEndOfActivePeriod( + List subList) { + List endingList = new ArrayList(); + statusHandler.debug("Checking for subs nearing end of active period"); + + if (subList != null && !subList.isEmpty()) { + Calendar now = TimeUtil.newGmtCalendar(); + Calendar cal = TimeUtil.newGmtCalendar(); + + for (Subscription sub : subList) { + Date end = sub.getActivePeriodEnd(); + if (end == null) { + continue; + } + + cal.setTimeInMillis(end.getTime()); + cal.set(Calendar.YEAR, now.get(Calendar.YEAR)); + if (now.before(cal) + && (cal.getTimeInMillis() - now.getTimeInMillis() < TimeUtil.MILLIS_PER_DAY)) { + endingList.add(sub); + } + } + } + + return endingList; + } + + /** + * Stores the record in the notification table. + * + * @param record + */ + private void storeAndSend(NotificationRecord record, String endpoint) { + if (record != null) { + notificationDao.createOrUpdate(record); + try { + byte[] bytes = SerializationUtil.transformToThrift(record); + EDEXUtil.getMessageProducer().sendAsyncUri(endpoint, bytes); + } catch (EdexException e) { + statusHandler.error("Error sending record to " + endpoint, e); + } catch (SerializationException e) { + statusHandler.error("Error serializing record to " + endpoint, + e); + } + } + } + + /** + * @return the notificationDao + */ + public NotificationDao getNotificationDao() { + return notificationDao; + } + + /** + * @param notificationDao + * the notificationDao to set + */ + public void setNotificationDao(NotificationDao notificationDao) { + this.notificationDao = notificationDao; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 2f2e470f33..f1550f4b66 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -269,13 +269,6 @@ version="0.0.0" unpack="false"/> - - * @@ -316,8 +317,6 @@ public class WfsRegistryCollectorAddon - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.project b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.project deleted file mode 100644 index ba7a96dbda..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.plugin.dataset.urn - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 781580a7fe..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Apr 02 10:27:06 CDT 2013 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/META-INF/MANIFEST.MF deleted file mode 100644 index 534dbdaad6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Dataset-URN -Bundle-SymbolicName: com.raytheon.uf.edex.plugin.dataset.urn -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.springframework;bundle-version="2.5.6", - com.raytheon.uf.edex.core;bundle-version="1.12.1174", - org.apache.commons.lang;bundle-version="2.3.0", - com.raytheon.uf.common.status;bundle-version="1.12.1174" -Export-Package: com.raytheon.uf.edex.plugin.dataset.urn diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/build.properties deleted file mode 100644 index ea64e28012..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - res/,\ - bin/ diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/res/spring/wxsrv-dataset-urn.xml b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/res/spring/wxsrv-dataset-urn.xml deleted file mode 100644 index ffc9251453..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/res/spring/wxsrv-dataset-urn.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - file:///${edex.home}/data/utility/edex_static/base/wxsrv/namedata/ncep_to_cf_mapping.csv - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameLookup.java b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameLookup.java deleted file mode 100644 index 7475866751..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameLookup.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.plugin.dataset.urn; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; - -/** - * Singleton to facilitate the lookup of the CF Standard name from a shortened - * name such as those in GRIB processing. Also maintains a mapping of the CF names - * to ontology individuals to facilitate dynamic ontology updates and individual - * creation. - * @author behemmi - * - */ -public class CFNameLookup { - - private static CFNameLookup instance; - - private IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - private Map ncepToCFMapping; - - protected Map cfToNcepMapping; - private Map cfToOntologyRelationMapping; - private Map cfToOntologyClassMapping; - - private CFNameLookup(CFNameResource resource) { - ncepToCFMapping = new HashMap(); - cfToOntologyRelationMapping = new HashMap(); - cfToOntologyClassMapping = new HashMap(); - cfToNcepMapping = new HashMap(); - - try { - if (resource.getConfigFileResource() != null) { - InputStream configStream = resource.getConfigFileResource().getInputStream(); - BufferedReader in = new BufferedReader(new InputStreamReader(configStream)); - String line = null; - - while((line = in.readLine()) != null) { - if(line.startsWith("#") || line.length() == 0) { - //comment, ignore - continue; - } - - //limit splitting to 2 to account for multiple tabs and trim for map insert - String[] parts = line.split("\t", 2); - if(parts != null && parts.length > 1) { - - //check for an Ontology relation after the CF Name - String[] ontRelParts = parts[1].trim().split("\t", 2); - if(ontRelParts != null && ontRelParts.length > 1) { - - //check for an Ontology class after the Ontoogy relation - String[] ontClassParts = ontRelParts[1].trim().split("\t", 2); - if(ontClassParts != null && ontClassParts.length > 1) { - //this line has everything, populate all the HashMaps - cfToOntologyClassMapping.put(ontRelParts[0].trim(), ontClassParts[1].trim()); - cfToOntologyRelationMapping.put(ontRelParts[0].trim(), ontClassParts[0].trim()); - ncepToCFMapping.put(parts[0].toUpperCase().trim(), ontRelParts[0].trim()); - cfToNcepMapping.put(ontRelParts[0].trim(), - parts[0].toUpperCase().trim()); - } else { - //only entries up the relation are present - cfToOntologyRelationMapping.put(ontRelParts[0].trim(), ontRelParts[1].trim()); - ncepToCFMapping.put(parts[0].toUpperCase().trim(), ontRelParts[0].trim()); - cfToNcepMapping.put(ontRelParts[0].trim(), - parts[0].toUpperCase().trim()); - log.warn("CF Name " - + ontRelParts[0].trim() - + " not mapped to Ontology Class in Config"); - } - } else { - //only the cf and ncep entries are on this line - ncepToCFMapping.put(parts[0].toUpperCase().trim(), parts[1].trim()); - cfToNcepMapping.put(parts[1].trim(), parts[0] - .toUpperCase().trim()); - log.warn("CF Name " + parts[1].trim() - + " not mapped to Ontology Info in Config"); - } - } else { - log.warn("NCEP Name " + parts[0] - + " not mapped to CF Name in Config"); - } - } - } else { - throw new IOException("Config File Resource null"); - } - } catch (IOException e) { - log.error("Configured mapping to CF Names not available", e); - } - instance = this; - } - - public static CFNameLookup getInstance(){ - //expecting instantiation from spring so no 'new' call here - //like in the normal singleton pattern - return instance; - } - - /** - * Returns the CF Name if available, defaults to the ncep name otherwise - * - * @param ncepName - * @return - */ - public String getCFFromNCEP(String ncepName) { - String cfName = ncepName; - if(ncepToCFMapping.containsKey(ncepName.toUpperCase())) { - cfName = ncepToCFMapping.get(ncepName.toUpperCase()); - } - return cfName; - } - - /** - * Returns the NCEP name if available, defaults to the cf name otherwise - * - * @param cfName - * @return - */ - public String getNCEPFromCF(String cfName) { - String ncepName = cfName; - if (cfToNcepMapping.containsKey(cfName)) { - ncepName = cfToNcepMapping.get(cfName).toUpperCase(); - } - - return ncepName; - } - - /** - * Looks up the associated ontology axiom for a given CF Name, returns null - * if no entities are associated - * @param cfName - * @return - */ - public String getOntologyRelationFromCF(String cfName) { - return cfToOntologyRelationMapping.get(cfName); - } - - /** - * Looks up the associated ontology class for a given CF Name, returns null - * if no entities are associated - * @param cfName - * @return - */ - public String getOntologyclassFromCF(String cfName) { - return cfToOntologyClassMapping.get(cfName); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameResource.java b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameResource.java deleted file mode 100644 index 5882fa421b..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/CFNameResource.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.plugin.dataset.urn; - -import org.springframework.core.io.Resource; - -public class CFNameResource { - - /** - * Spring resource for properties file, this is preferred over a filepath - * string - */ - protected Resource configFileResource = null; - - public Resource getConfigFileResource() { - return configFileResource; - } - - public void setConfigFileResource(Resource configFileResource) { - this.configFileResource = configFileResource; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/URNLookup.java b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/URNLookup.java deleted file mode 100644 index 5bada70675..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/src/com/raytheon/uf/edex/plugin/dataset/urn/URNLookup.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.dataset.urn; - - -/** - * Lookup URNs. - * - * @author ekladstrup - * @version 1.0 - */ -public class URNLookup { - - public static final String WXSRV_URN_PREFIX = "urn:x-wxsrv:"; - - public static final String MODEL_URN_PREFIX = WXSRV_URN_PREFIX + "Dataset"; - - // From ucar.edu WXCM primer - public static final String FDC_AIRCRAFT_REPORT = "urn:fdc:icao:procedure:AircraftReport"; - - // From ucar.edu WXCM primer - public static final String ICAO_CODE_PREFIX = "urn:icao:code:weatherStation"; - - private static enum State { - START, ONE_SLASH, MULT_SLASH, ONE_COLON - } - - /** - * Convert EDEX internal ID to external URN - * - * Single slashes are replaced by single colons. Any additional slashes - * immediately following are converted into URN escape sequences. 'foo/bar' - * -> 'foo:bar', 'foo//bar' -> 'foo:%2fbar'. Any colons in the local string - * are escaped with another colon. 'foo:bar/baz' -> 'foo::bar:baz'. Other - * non-URN characters are escaped using URN escape formatting. - * - * Dataset URN prefix is attached. - * - * @param local - * dataURI based ID - * @return - */ - public static String localToUrn(String local) { - State s = State.START; - StringBuilder sb = new StringBuilder(MODEL_URN_PREFIX).append(':'); - for (int i = 0; i < local.length(); ++i) { - char curr = local.charAt(i); - switch (curr) { - case '/': - if (s.equals(State.START)) { - s = State.ONE_SLASH; - sb.append(':'); - } else if (s.equals(State.ONE_SLASH)) { - s = State.MULT_SLASH; - sb.append("%2f"); - } else if (s.equals(State.MULT_SLASH)) { - sb.append("%2f"); - } - break; - case ':': - sb.append("::"); - s = State.START; - break; - case '%': - case '?': - case '#': - case ' ': - sb.append(String.format("%%%02x", (short) curr)); - s = State.START; - break; - default: - sb.append(curr); - s = State.START; - } - } - return sb.toString(); - } - - /** - * Convert external URN to internal EDEX ID - * - * URN escaped characters are converted to ASCII. Single colons are - * converted to slashes. Colon pairs are converted to single colons. - * - * Dataset URN prefix is assumed to be on input. - * - * @param urn - * @return dataURI based ID - */ - public static String urnToLocal(String urn) { - // add 1 since the last ":" is not included in the length - String unique = urn.substring(MODEL_URN_PREFIX.length() + 1); - State s = State.START; - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < unique.length(); ++i) { - char curr = unique.charAt(i); - char next; - switch (curr) { - case ':': - if (s.equals(State.START)) { - s = State.ONE_COLON; - continue; - } else { - sb.append(':'); - s = State.START; - continue; - } - case '%': - next = (char) Short.parseShort(unique.substring(i + 1, i + 3), - 16); - i += 2; - break; - default: - next = curr; - break; - } - if (s.equals(State.ONE_COLON)) { - sb.append('/'); - s = State.START; - } - sb.append(next); - } - return sb.toString(); - } - - public static String getAircraftReportURN() { - return FDC_AIRCRAFT_REPORT; - } - - public static String icaoToUrn(String station) { - return ICAO_CODE_PREFIX + ":" + station; - } - - /** - * Slice the icao urn and return the local part - * - * @param urn - * @return Blank string or local part if prefix is the proper icao prefix, - * null if the prefix does not match expectations - */ - public static String urnToIcao(String urn) { - if (urn.startsWith(ICAO_CODE_PREFIX)) { - // add 1 since the last ":" is not included in the length - return urn.substring(ICAO_CODE_PREFIX.length() + 1); - } else { - return null; - } - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/utility/edex_static/base/wxsrv/namedata/ncep_to_cf_mapping.csv b/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/utility/edex_static/base/wxsrv/namedata/ncep_to_cf_mapping.csv deleted file mode 100644 index 9a30f8e7bf..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.dataset.urn/utility/edex_static/base/wxsrv/namedata/ncep_to_cf_mapping.csv +++ /dev/null @@ -1,278 +0,0 @@ -#This file contains a user editable mapping of names that would be seen as part of data ingest to -#more standardized CF (NetCDF Climate and Forecast) names. The first list is taken directly from -#the NetCDF Climate and Forecast (CF) Metadata Convention website and the entries that follow -#are as needed additions based on what is being seen in data. The third column is a listing -#of ontology names that map to the cf names. This allows for updates and additions to both -#the ontology and the CF list while maintaining the codes ability to generate ontology individuals. -#note that the third column is case sensitive. - -#all values from http://cf-pcmdi.llnl.gov/documents/cf-standard-names/ncep-grib-code-cf-standard-name-mapping -#NCEP #CF Name #Ontology Axiom IRI #Ontology Class IRI -PRES air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -PRMSL air_pressure_at_sea_level http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -PTEND tendency_of_air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -ICAHT standard_atmosphere_reference_height -GP geopotential http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -HGT geopotential_height http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -DIST altitude -HSTDV height_standard_deviation -TOZNE equivalent_thickness_at_stp_of_atmosphere_o3_content -TMP air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -VTMP virtual_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -POT air_potential_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -EPOT pseudo_equivalent_potential_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -T MAX max_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -T MIN min_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -DPT dew_point_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -DEPR dew_point_depression http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -LAPR air_temperature_lapse_rate http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -VIS visibility_in_air -RDSP1 radar_spectra_1 -RDSP2 radar_spectra_2 -RDSP3 radar_spectra_3 -PLI parcel_lifted_index -TMP A air_temperature_anomaly http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -PRESA air_pressure_anomaly http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -GP A geopotential_height_anomaly http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -WVSP1 wave_spectra_1 -WVSP2 wave_spectra_2 -WVSP3 wave_spectra_3 -WDIR wind_from_direction http://wxsrv/ontology/weather.owl#hasWindDirection http://wxsrv/ontology/weather.owl#WindDirection -WIND wind_speed http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -U GRD eastward_wind http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -V GRD northward_wind http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -STRM atmosphere_horizontal_streamfunction -V POT atmosphere_horizontal_velocity_potential http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -MNTSF montgomery_stream_function -SGCVV vertical_air_velocity_expressed_as_tendency_of_sigma http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -V VEL vertical_air_velocity_expressed_as_tendency_of_pressure http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -DZDT upward_air_velocity http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -ABS V atmosphere_absolute_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -ABS D atmosphere_absolute_divergence -REL V atmosphere_relative_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -REL D divergence_of_wind http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -VUCSH eastward_wind_shear http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -VVCSH northward_wind_shear http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -DIR C direction_of_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterDirection http://wxsrv/ontology/weather.owl#SeaWaterDirection -SP C sea_water_speed http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -UOGRD eastward_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -VOGRD northward_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -SPF H specific_humidity -R H relative_humidity http://wxsrv/ontology/weather.owl#hasRelativeHumidity http://wxsrv/ontology/weather.owl#RelativeHumidity -MIXR humidity_mixing_ratio -P WAT atmosphere_water_vapour_content -VAPP water_vapour_pressure -SAT D water_vapour_saturation_deficit -EVP water_evaporation_amount -C ICE atmosphere_cloud_ice_content -PRATE precipitation_flux -TSTM thunderstorm_probability -A PCP precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -NCPCP large_scale_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -ACPCP convective_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -SRWEQ snowfall_flux -WEASD surface_snow_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -SNO D surface_snow_thickness http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -MIXHT ocean_mixed_layer_thickness -TTHDP transient_thermocline_depth -MTHD main_thermocline_depth -MTHA main_thermocline_anomoly -T CDC cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -CDCON convective_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -L CDC low_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -M CDC medium_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -H CDC high_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -C WAT atmosphere_cloud_condensed_water_content -BLI best_lifted_index -SNO C convective_snowfall_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -SNO L large_scale_snowfall_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -WTMP sea_water_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -LAND land_area_fraction http://wxsrv/ontology/weather.owl#hasLandAreaFraction http://wxsrv/ontology/weather.owl#LandAreaFraction -DSL M sea_surface_height_above_sea_level -SFC R surface_roughness_length -ALBDO surface_albedo -TSOIL soil_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -SOIL soil_moisture_content -VEG vegetation_area_fraction -SALTY sea_water_salinity -DEN density -WATR surface_runoff_amount -ICE C sea_ice_area_fraction -ICETK sea_ice_thickness -DICED direction_of_sea_ice_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterDirection http://wxsrv/ontology/weather.owl#SeaWaterDirection -SICED sea_ice_speed http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -U ICE sea_ice_eastward_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -V ICE sea_ice_northward_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -ICE G tendency_of_sea_ice_thickness_due_to_thermodynamics -ICE D divergence_of_sea_ice_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed -SNO M surface_snow_melt_amount -HTSGW significant_height_of_wind_and_swell_waves -WVDIR direction_of_wind_wave_velocity -WVHGT significant_height_of_wind_waves -WVPER wind_wave_period -SWDIR direction_of_swell_wave_velocity -SWELL significant_height_of_swell_waves -SWPER swell_wave_period -DIRPW primary_wave_direction -PERPW primary_wave_mean_period -DIRSW secondary_wave_direction -PERSW secondary_wave_mean_period -NSWRS surface_net_upward_shortwave_flux -NLWRS surface_net_upward_longwave_flux -NSWRT toa_net_upward_shortwave_flux -NLWRT toa_net_upward_longwave_flux -LWAVR net_upward_longwave_flux_in_air -SWAVR net_upward_shortwave_flux_in_air -G RAD surface_downwelling_shortwave_flux -BRTMP brightness_temperature -LWRAD wave_number_radiance -SWRAD wave_length_radiance -LHTFL surface_upward_latent_heat_flux -SHTFL surface_upward_sensible_heat_flux -BLYDP boundary_layer_dissipation -U FLX downward_eastward_momentum_flux_in_air -V FLX downward_northward_momentum_flux_in_air -WMIXE wind_mixing_energy_flux_into_ocean -IMG image_data -MSLSA standard_atmospheric_reduction_mean_sea_level_pressure -MSLMA maps_system_reduction_mean_sea_level_pressure -MSLET nam_model_reduction_mean_sea_level_pressure -LFTX surface_lifted_index -4LFTX best_four_layer_lifted_index -KX k_index -SX sweat_index -MCONV horizontal_moisture_divergence -VW SH wind_speed_shear -TSLSA standard_atmospheric_reduction_three_hour pressure_tendency -BVF2 brunt_vaisala_frequency -PVMW density_weighted_potontial_vorticity -CRAIN categorical_rain -CFRZR categorical_freezing_rain -CICEP categorical_ice_pellets -CSNOW categorical_snow -SOILW volumetric_soil_moisture_content -PEVPR potential_evaporation_rate -CWORK cloud_work_function -UGWD gravity_wave_stress_zonal_flux -VGWD gravity_wave_stress_meridonial_flux -PV potential_vorticity -COVMZ meridonail_zonal_wind_covariance -COVTZ temperature_zonal_wind_covariance -COVTM temperature_meridonail_wind_covariance -CLWMR cloud_mixing_ratio -O3MR ozone_mixing_ratio -GFLUX ground_heat_flux -CIN convective_inhibition -CAPE atmosphere_specific_convective_available_potential_energy -TKE turbulent_kinetic_energy -CONDP surface_parcel_condensation_pressure -CSUSF clear_sky_upward_solar_flux -CSDSF clear_sky_downward_solar_flux -CSULF clear_sky_upward_long_wave_flux -CSDLF clear_sky_downward_long_wave_flux -CFNSF cloud_forcing_net_solar_flux -CFNLF cloud_forcing_net_long_wave_flux -VBDSF visible_beam_downward_solar_flux -VDDSF visible_diffuse_downward_solar_flux -NBDSF near_ir_beam_downward_solar_flux -NDDSF near_ir_diffuse_downward_solar_flux -MFLX momentum_flux -LMH mass_point_model_surface -LMV velocity_point_model_surface -MLYNO model_layer_number -NLAT latitude -ELON east_longitude -LPSX log_pressure_x_gradient -LPSY log_pressure_y_gradient -HGTX height_x_gradient -HGTY height_y_gradient -VPTMP virtual_potential_temperature -HLCY storm_relative_helicity -PROB probability_from_ensemble -PROBN climate_normalized_probability_from_ensemble -POP probability_of_precipitation -CPOFP percent_of_frozen_precipitation -CPOZP probability_of_freezing_precipitation -USTM u_component_of_storm_motion -VSTM v_component_of_storm_motion -ICWAT ice_free_water_surface -DSWRF downward_short_wave_rad_flux -DLWRF downward_long_wave_rad_flux -UVI untra_violet_index -MSTAV moisture_availability -SFEXC exchange_coefficient -MIXLY surface_mixed_layers -USWRF upward_short_wave_rad_flux -ULWRF upward_long_wave_rad_flux -CDLYR amound_of_non_convective_cloud -CPRAT convective_precipitation_rate -TTDIA temperature_tendency_by_all_physics -TTRAD temperature_tendency_by_all_radiation -TTPHY temperature_tendency_by_nonradiation_physics -PREIX precipitation_index -TSD1D std_dev_irt_over_1x1_deg_area -NLGSP natural_log_of_surface_pressure -HPBL planetary_boundary_layer_height -5WAVH 5_wave_geopotential_height -CNWAT plant_canopy_surface_water -BMIXL blackadars_mixing_length_scale -AMIXL asymptotic_mixing_length_scale -PEVAP potential_evaporation -SNOHF snow_phase_change_heat_flux -MFLUX convective_cloud_mass_flux -DTRF downward_total_radiation_flux -UTRF upward_total_radiation_flux -BGRUN baseflow_groundwater_runoff -SSRUN storm_surface_runoff -03TOT total_ozone -SNOWC snow_cover -SNOWT snow_temperature -LRGHR large_scale_condensate_heat_rate -CNVHR deep_convective_heating_rate -CNVMR deep_convective_moistening_rate -SHAHR shallow_convective_heating_rate -SHAMR shallow_convectine_moistening_rate -VDFHR vertical_diffusion_heating_rate -VDFUA vertical_diffusion_zonal_acceleration -VDFVA vertical_diffusion_meridonal_acceleration -VDFMR vertical_diffusion_moistening_rate -SWHR solar_radiative_heating_rate -LWHR long_wave_radiative_heating_rate -CD drag_coefficient -FRICV friction_velocity -RI richardson_number -HLCY storm_relative_helicity - -#other mapping added based on what was seen in data -GH geopotential_height http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -T temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -RH relative_humidity http://wxsrv/ontology/weather.owl#hasRelativeHumidity http://wxsrv/ontology/weather.owl#RelativeHumidity -UW horizontal_wind_vector http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -VW vertical_wind_vector http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -ICIP icing_probability http://wxsrv/ontology/weather.owl#hasIcingProbability http://wxsrv/ontology/weather.owl#IcingProbability -PVV pressure_vertical_velocity - -#eta218 xml short name entries that do not already exist in the cf mapping -HELI helicity_sigma -TCC cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction -TP precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -STATICCORIOLIS coriolis_parameter -MNT min_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -MXT max_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -P air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -T air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature -STATICSPACING grid_spacing -WD wind_from_direction http://wxsrv/ontology/weather.owl#hasWindDirection http://wxsrv/ontology/weather.owl#WindDirection -WS wind_speed http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed -PLI parcel_lifted_index -PMSL air_pressure_at_sea_level http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure -EMSP eta_mean_sea_level_pressure -CP convective_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -PW precipitable_water -STATICTOPO tolography -SLI surface_lifted_index -AV atmosphere_absolute_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear -REFC composite_radar_reflectivity -REFD derived_radar_reflectivity -SND surface_snow_thickness http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount -THP thunderstorm_probability diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.project b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.project deleted file mode 100644 index e0c6cc143e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.plugin.grib.ogc - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2c609c7dad..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Jun 07 13:59:55 CDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/MANIFEST.MF deleted file mode 100644 index fc5d44c26d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/MANIFEST.MF +++ /dev/null @@ -1,37 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Ogc -Bundle-SymbolicName: com.raytheon.uf.edex.plugin.grib.ogc -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: RAYTHEON -Require-Bundle: org.springframework;bundle-version="2.5.6", - com.raytheon.uf.common.serialization;bundle-version="1.12.1174", - com.raytheon.uf.common.time;bundle-version="1.12.1174", - com.raytheon.uf.edex.ogc.common;bundle-version="1.0.0", - javax.persistence;bundle-version="1.0.0", - org.apache.commons.lang;bundle-version="2.3.0", - com.raytheon.uf.edex.database;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", - org.hibernate;bundle-version="1.0.0", - org.geotools;bundle-version="2.6.4", - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", - com.raytheon.uf.edex.wms;bundle-version="1.0.0", - com.raytheon.uf.edex.wcs;bundle-version="1.0.0", - com.raytheon.uf.edex.core;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - org.apache.camel;bundle-version="1.0.0", - com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - javax.measure;bundle-version="1.0.0", - org.apache.commons.collections;bundle-version="3.2.0", - com.raytheon.uf.edex.plugin.dataset.urn;bundle-version="1.0.0", - ucar.nc2;bundle-version="1.0.0", - com.raytheon.uf.edex.plugin.unitconverter;bundle-version="1.0.0", - com.raytheon.uf.common.spatial;bundle-version="1.0.0", - com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", - com.raytheon.uf.common.parameter;bundle-version="1.0.0", - com.raytheon.uf.edex.plugin.grid;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ActivationPolicy: lazy -Export-Package: com.raytheon.uf.edex.plugin.grib.ogc diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 9d22ff0cf3..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,2 +0,0 @@ -com.raytheon.uf.edex.plugin.grib.ogc.GribDimension -com.raytheon.uf.edex.plugin.grib.ogc.GribLayer \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/build.properties deleted file mode 100644 index 5791d48d5f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - res/ diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/com.raytheon.uf.edex.plugin.grib.ogc.ecl b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/com.raytheon.uf.edex.plugin.grib.ogc.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-decode-ogc.xml b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-decode-ogc.xml deleted file mode 100644 index 70566f39fc..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-decode-ogc.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - grid - - - - - - - ${header.CamelSplitSize} == 1 - - - - - - - - - - - - - - - java.lang.Throwable - - - - - - - - - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc-routes.xml b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc-routes.xml deleted file mode 100644 index 5031190744..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc-routes.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc.xml b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc.xml deleted file mode 100644 index e95fa7c1e9..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/res/spring/grib-ogc.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribDimension.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribDimension.java deleted file mode 100644 index ece41ef2a8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribDimension.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeMap; -import java.util.TreeSet; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.commons.lang.StringUtils; - -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; -import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil; -import com.raytheon.uf.edex.ogc.common.time.ForecastTimeUtil; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public class GribDimension extends SimpleDimension { - - private static final long serialVersionUID = 1232298678216203380L; - - public static final String REFTIME_DIM = "REFTIME"; - - public static final String FORECAST_OFFSET_DIM = "FORECAST_OFFSET"; - - public static final String PARAM_DIM = "PARAMETER"; - - private transient DataTime defaultTime = null; - - protected transient IUFStatusHandler log = UFStatus.getHandler(this - .getClass()); - - @XmlElement - @DynamicSerializeElement - protected Set values; - - public GribDimension() { - } - - public GribDimension(String name, String units) { - this.name = name; - this.units = units; - this.values = new TreeSet(); - } - - /** - * @param otherDim - */ - public GribDimension(GribDimension other) { - super(other); - this.values = new TreeSet(other.values); - } - - public void setValues(Set values) { - this.values = values; - } - - @Override - public Set getValues() { - return values; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.ogc.common.db.SimpleDimension#getDefaultValue() - */ - @Override - public String getDefaultValue(SimpleLayer layer) { - String rval = null; - if (GribDimension.REFTIME_DIM.equals(name)) { - DataTime time = getDefaultTime(layer); - rval = LayerTransformer.format(time.getRefTime()); - } else if (GribDimension.FORECAST_OFFSET_DIM.equals(name)) { - DataTime time = getDefaultTime(layer); - rval = time.getFcstTime() + "S"; - } else if (name.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX)) { - rval = getLevel(true); - } else { - rval = getString(true); - } - return rval; - } - - private String getLevel(boolean lowest) { - TreeMap sorted = new TreeMap(); - if (this.getValues().isEmpty()) { - return null; - } - for (String val : this.getValues()) { - String level1 = StringUtils.split(val, '_')[0]; - sorted.put(Double.parseDouble(level1), val); - } - Double key = lowest ? sorted.firstKey() : sorted.lastKey(); - return sorted.get(key); - } - - protected DataTime getDefaultTime(SimpleLayer layer) { - if (defaultTime == null){ - try { - SortedSet times = new ForecastTimeUtil() - .getDataTimes(layer, layer.getDefaultTime(), - new HashMap(0)); - defaultTime = times.last(); - } catch (OgcException e) { - log.error("Problem getting default times", e); - return new DataTime(layer.getDefaultTime()); - } - } - return defaultTime; - } - - /** - * Copy contents of from into to - * - * @param to - * @param from - */ - public static void copy(Collection to, - Collection from) { - for (GribDimension d : from) { - to.add(new GribDimension(d)); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayer.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayer.java deleted file mode 100644 index 9f00d89748..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayer.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.Date; -import java.util.TreeSet; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public abstract class GribLayer extends SimpleLayer { - - private static final long serialVersionUID = 6934503885157257766L; - - @XmlElement - @DynamicSerializeElement - protected String coverageName; - - @XmlElement - @DynamicSerializeElement - protected String crsWkt; - - @XmlElement - @DynamicSerializeElement - protected double nativeMinX; - - @XmlElement - @DynamicSerializeElement - protected double nativeMinY; - - @XmlElement - @DynamicSerializeElement - protected double nativeMaxX; - - @XmlElement - @DynamicSerializeElement - protected double nativeMaxY; - - @XmlElement - @DynamicSerializeElement - protected boolean vertical = true; - - public GribLayer() { - } - - public GribLayer(GribLayer other) { - super(other); - this.times = new TreeSet(other.getTimes()); - this.coverageName = other.getCoverageName(); - this.crsWkt = other.getCrsWkt(); - this.nativeMaxX = other.nativeMaxX; - this.nativeMaxY = other.nativeMaxY; - this.nativeMinX = other.nativeMinX; - this.nativeMinY = other.nativeMinY; - this.vertical = other.vertical; - } - - /** - * @return the coverageName - */ - public String getCoverageName() { - return coverageName; - } - - /** - * @param coverageName - * the coverageName to set - */ - public void setCoverageName(String coverageName) { - this.coverageName = coverageName; - } - - /** - * @return the crsWkt - */ - public String getCrsWkt() { - return crsWkt; - } - - /** - * @param crsWkt - * the crsWkt to set - */ - public void setCrsWkt(String crsWkt) { - this.crsWkt = crsWkt; - } - - /** - * @return the nativeMinX - */ - public double getNativeMinX() { - return nativeMinX; - } - - /** - * @param nativeMinX - * the nativeMinX to set - */ - public void setNativeMinX(double nativeMinX) { - this.nativeMinX = nativeMinX; - } - - /** - * @return the nativeMinY - */ - public double getNativeMinY() { - return nativeMinY; - } - - /** - * @param nativeMinY - * the nativeMinY to set - */ - public void setNativeMinY(double nativeMinY) { - this.nativeMinY = nativeMinY; - } - - /** - * @return the nativeMaxX - */ - public double getNativeMaxX() { - return nativeMaxX; - } - - /** - * @param nativeMaxX - * the nativeMaxX to set - */ - public void setNativeMaxX(double nativeMaxX) { - this.nativeMaxX = nativeMaxX; - } - - /** - * @return the nativeMaxY - */ - public double getNativeMaxY() { - return nativeMaxY; - } - - /** - * @param nativeMaxY - * the nativeMaxY to set - */ - public void setNativeMaxY(double nativeMaxY) { - this.nativeMaxY = nativeMaxY; - } - - /** - * @return the vertical - */ - public boolean isVertical() { - return vertical; - } - - /** - * @param vertical - * the vertical to set - */ - public void setVertical(boolean vertical) { - this.vertical = vertical; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayerCollector.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayerCollector.java deleted file mode 100644 index d11256352e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribLayerCollector.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.Set; -import java.util.TreeSet; - -import javax.measure.unit.SI; -import javax.measure.unit.Unit; - -import org.geotools.geometry.jts.JTS; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.opengis.geometry.MismatchedDimensionException; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.TransformException; - -import com.raytheon.uf.common.dataplugin.grid.GridInfoRecord; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataplugin.level.Level; -import com.raytheon.uf.common.dataplugin.level.MasterLevel; -import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.gridcoverage.GridCoverage; -import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.OgcLayer; -import com.raytheon.uf.edex.ogc.common.db.DefaultLayerCollector; -import com.raytheon.uf.edex.ogc.common.db.ILayerStore; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil; -import com.raytheon.uf.edex.ogc.common.spatial.AltUtil; -import com.vividsolutions.jts.geom.Envelope; - -public class GribLayerCollector extends - DefaultLayerCollector { - - public GribLayerCollector(ILayerStore store) { - super(GridCompositeLayer.class, GridRecord.class, store); - } - - @Override - protected void addToDims(GridCompositeLayer layer, GridRecord rec) { - DataTime dt = rec.getDataTime(); - GridInfoRecord info = rec.getInfo(); - Level level = info.getLevel(); - Set dims = layer.getDimensions(); - for (SimpleDimension d : dims) { - String name = d.getName(); - Set values = d.getValues(); - if (GribDimension.REFTIME_DIM.equals(name)) { - values.add(LayerTransformer.format(dt.getRefTime())); - } else if (GribDimension.FORECAST_OFFSET_DIM.equals(name)) { - values.add(dt.getFcstTime() + "S"); - } else if (name.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX)) { - values.add(LevelDimUtil.formatLevelValue(level)); - } else if (GribDimension.PARAM_DIM.equals(name)) { - values.add(getParameter(rec)); - } else { - log.warn("Unknown grib dimension: " + name); - } - } - } - - /** - * Get parameter string from record - * - * @param rec - * @return - */ - private String getParameter(GridRecord rec) { - String fieldName = rec.getInfo().getParameter().getAbbreviation(); - return GribRecordFinder.dbToOgcParameter(fieldName); - } - - @Override - protected void addToTimes(GridCompositeLayer layer, GridRecord rec) { - String parameter = getParameter(rec); - layer.addTime(parameter, rec.getDataTime().getValidTime().getTime()); - } - - @Override - protected boolean initializeLayer(GridCompositeLayer layer, GridRecord rec) { - GridInfoRecord info = rec.getInfo(); - Level level = info.getLevel(); - Parameter parameter = info.getParameter(); - if (parameter.getAbbreviation().startsWith("static")) { - return false; - } - Unit unit = level.getMasterLevel().getUnit(); - if (unit == null) { - layer.setVertical(false); - } - try { - AltUtil.convert(SI.METER, unit, 1); - } catch (Exception e) { - layer.setVertical(false); - } - GridCoverage cov = info.getLocation(); - if (cov == null) { - log.warn("Recieved record without coverage!"); - return false; - } - layer.setCoverageName(cov.getName()); - String crsWkt = cov.getCrsWKT(); - if (crsWkt == null) { - crsWkt = cov.getCrs().toWKT(); - } - layer.setCrsWkt(crsWkt); - layer.setNx(cov.getNx()); - layer.setNy(cov.getNy()); - layer.setTargetCrsCode("CRS:84"); - try { - Envelope env = getProperBounds(layer, cov, info); - layer.setTargetMinx(env.getMinX()); - layer.setTargetMiny(env.getMinY()); - layer.setTargetMaxx(env.getMaxX()); - layer.setTargetMaxy(env.getMaxY()); - layer.setCrs84Bounds(JTS.toGeometry(env)); - } catch (Exception e) { - log.error("Unable to get crs84 bounds", e); - return false; - } - String levelUnit = level.getMasterLevel().getUnitString(); - MasterLevel master = level.getMasterLevel(); - TreeSet dims = new TreeSet(); - dims.add(new GribDimension(GribDimension.REFTIME_DIM, "ISO8601")); - dims.add(new GribDimension(GribDimension.FORECAST_OFFSET_DIM, "ISO8601")); - String levelName = LevelDimUtil.LEVEL_DIM_PREFIX + master.getName(); - dims.add(new GribDimension(levelName, levelUnit)); - dims.add(new GribDimension(GribDimension.PARAM_DIM, parameter.getUnit() - .toString())); - layer.addDimensions(getParameter(rec), dims); - return true; - } - - protected ReferencedEnvelope getProperBounds(GribLayer layer, - GridCoverage cov, GridInfoRecord info) throws FactoryException, - MismatchedDimensionException, TransformException { - String dataset = info.getDatasetId(); - // the gemglobal and gfs global grids are already in a crs:84 - // projection, - // so there is no transformation needed. - if (dataset.equals("GEMGlobal") || dataset.equals("GFS230") - || dataset.equals("GlobalWave")) { - return new ReferencedEnvelope(-180.0, 180.0, -90.0, 90.0, - cov.getCrs()); - } - - // the polygon is not projected properly, must get native bounds and - // reproject into crs:84 - CoordinateReferenceSystem nativeCrs = cov.getCrs(); - Envelope env = JTS.transform(cov.getGeometry(), - MapUtil.getTransformFromLatLon(nativeCrs)) - .getEnvelopeInternal(); - ReferencedEnvelope nativeEnv = new ReferencedEnvelope(env.getMinX(), - env.getMaxX(), env.getMinY(), env.getMaxY(), nativeCrs); - layer.setNativeMinX(env.getMinX()); - layer.setNativeMinY(env.getMinY()); - layer.setNativeMaxX(env.getMaxX()); - layer.setNativeMaxY(env.getMaxY()); - ReferencedEnvelope crs84Env = nativeEnv.transform( - MapUtil.LATLON_PROJECTION, true); - // This is to fix when non-polar coverages cross poles or opposite - // meridian - // This will completely break polar coverages - double minx = crs84Env.getMinX(); - double miny = crs84Env.getMinY(); - double maxx = crs84Env.getMaxX(); - double maxy = crs84Env.getMaxY(); - if (maxx > 180 || minx < -180) { - // coverage crosses opposite meridian, advertise all the way around - minx = -180; - maxx = 180; - } - if (maxy > 90) { - // coverage crosses north pole, truncate - maxy = 90; - } - if (miny < -90) { - // coverage crosses south pole, truncate - miny = -90; - } - return new ReferencedEnvelope(minx, maxx, miny, maxy, - crs84Env.getCoordinateReferenceSystem()); - } - - @Override - public String getLayerName(GridRecord rec) { - return createLayerName(rec); - } - - public static String createLayerName(GridRecord rec) { - GridInfoRecord info = rec.getInfo(); - GridCoverage cov = info.getLocation(); - String levelName = info.getLevel().getMasterLevel().getName(); - return info.getDatasetId() + OgcLayer.keySeparator + cov.getName() - + OgcLayer.keySeparator + levelName; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.db.LayerCollector#copy(com.raytheon.uf - * .edex.ogc.common.db.SimpleLayer) - */ - @Override - protected GridCompositeLayer copy(GridCompositeLayer orig) { - return new GridCompositeLayer(orig); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribNativeCrsAuthority.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribNativeCrsAuthority.java deleted file mode 100644 index 3a3903993a..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribNativeCrsAuthority.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.List; - -import org.opengis.parameter.ParameterValueGroup; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.ProjectedCRS; -import org.opengis.referencing.operation.Projection; - -import com.raytheon.uf.common.gridcoverage.GridCoverage; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.database.dao.CoreDao; -import com.raytheon.uf.edex.database.dao.DaoConfig; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcException.Code; -import com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 6, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GribNativeCrsAuthority implements NativeCrsAuthority { - - public static final String ID = "grib"; - - private final CoreDao covDao = new CoreDao( - DaoConfig.forClass(GridCoverage.class)); - - private final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - /* (non-Javadoc) - * @see com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority#lookup(java.lang.String) - */ - @Override - public CoordinateReferenceSystem lookup(String urn) throws OgcException { - if ( urn == null){ - return null; - } - String local = urn.substring(NATIVE_CRS_PREFIX.length()); - String[] parts = local.split(":"); - try { - List res = covDao.queryBySingleCriteria("name", parts[0]); - if (res == null || res.isEmpty()) { - return null; - } - GridCoverage cov = (GridCoverage) res.get(0); - return cov.getCrs(); - } catch (DataAccessLayerException e) { - log.error("Unable to lookup coverage", e); - throw new OgcException(Code.InternalServerError, e); - } - } - - /** - * @param cov - * @return Native CRS URN for coverage - */ - public static String createURN(GridCoverage cov) { - String name = cov.getName(); - // TODO assumption that all native grid systems are projected - ProjectedCRS crs = (ProjectedCRS) cov.getCrs(); - return createURN(name, crs); - } - - /** - * @param coverageName - * @param crs - * @return Native CRS URN for coverage - */ - public static String createURN(String coverageName, ProjectedCRS crs) { - Projection conv = crs.getConversionFromBase(); - ParameterValueGroup params = conv.getParameterValues(); - String projName = params.getDescriptor().getName().getCode(); - return NATIVE_CRS_PREFIX + coverageName + ":" + projName; - } - - /* (non-Javadoc) - * @see com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority#getId() - */ - @Override - public String getId() { - return ID; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribRecordFinder.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribRecordFinder.java deleted file mode 100644 index 50cb9593e8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribRecordFinder.java +++ /dev/null @@ -1,402 +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.edex.plugin.grib.ogc; - -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.SortedSet; - -import org.hibernate.Criteria; -import org.hibernate.SessionFactory; -import org.hibernate.classic.Session; -import org.hibernate.criterion.Conjunction; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Disjunction; -import org.hibernate.criterion.Restrictions; - -import com.raytheon.uf.common.dataplugin.grid.GridInfoRecord; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataplugin.level.Level; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.database.plugin.PluginDao; -import com.raytheon.uf.edex.database.plugin.PluginFactory; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcException.Code; -import com.raytheon.uf.edex.ogc.common.OgcLayer; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil; -import com.raytheon.uf.edex.ogc.common.time.ForecastTimeUtil; -import com.raytheon.uf.edex.plugin.dataset.urn.CFNameLookup; - -/** - * - * @author bclement - * @version 1.0 - */ -public class GribRecordFinder { - - public static final String INFO_ALIAS = "info_alias"; - - public static final String LEVEL_ALIAS = "level_alias"; - - public static final String MASTER_LEVEL_ALIAS = "master_level_alias"; - - public static final String COV_ALIAS = "cov_alias"; - - public static final String INFO = "info"; - - public static final String LEVEL = "info_alias.level"; - - public static final String LEVLE_ONE = LEVEL_ALIAS + ".levelonevalue"; - - public static final String LEVLE_TWO = LEVEL_ALIAS + ".leveltwovalue"; - - public static final String MASTER_LEVEL = LEVEL_ALIAS + ".masterLevel"; - - public static final String LEVEL_UNIT = MASTER_LEVEL_ALIAS + ".unitString"; - - public static final String LEVEL_NAME = MASTER_LEVEL_ALIAS + ".name"; - - public static final String DS_NAME = INFO_ALIAS + ".datasetId"; - - public static final String COVERAGE = INFO_ALIAS + ".location"; - - public static final String COVERAGE_NAME = COV_ALIAS + ".name"; - - public static final String PARAM = INFO_ALIAS + ".parameter"; - - public static final String PARAM_ALIAS = "param_alias"; - - public static final String PARAM_ABBV = PARAM_ALIAS + ".abbreviation"; - - public static final String REF_TIME = "dataTime.refTime"; - - public static final String FCST_TIME = "dataTime.fcstTime"; - - public static class Comp implements Comparator { - /* - * (non-Javadoc) - * - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - @Override - public int compare(GridRecord left, GridRecord right) { - Date rightRef = right.getDataTime().getRefTime(); - Date leftRef = left.getDataTime().getRefTime(); - int rval = rightRef.compareTo(leftRef); - if (rval == 0) { - GridInfoRecord leftInfo = left.getInfo(); - GridInfoRecord rightInfo = right.getInfo(); - // FIXME this doesn't take units into account - Level leftLevel = leftInfo.getLevel(); - Level rightLevel = rightInfo.getLevel(); - rval = (int) (leftLevel.getLevelonevalue() - rightLevel - .getLevelonevalue()); - if (rval == 0) { - if (leftInfo.getEnsembleId() != null) { - if (rightInfo.getEnsembleId() != null) { - rval = leftInfo.getEnsembleId().compareTo( - rightInfo.getEnsembleId()); - } else { - rval = 1; - } - } else { - if (rightInfo.getEnsembleId() != null) { - rval = -1; - } else { - rval = 0; - } - } - } - } - return rval; - } - } - - public static List findWms( - LayerTransformer transformer, - String key, String layerName, Date time, - Map dimensions) throws OgcException { - GridParamLayer l = getLayer(transformer, layerName); - SortedSet times = new ForecastTimeUtil().getDataTimes(l, - time, dimensions); - return findInternal(l, transformer, key, times, dimensions, - parseWmsId(layerName)); - } - - public static List findWms( - LayerTransformer transformer, - String key, String layerName, String time, - Map dimensions) throws OgcException { - GridParamLayer l = getLayer(transformer, layerName); - SortedSet times = new ForecastTimeUtil().getDataTimes(l, - time, dimensions); - return findInternal(l, transformer, key, times, dimensions, - parseWmsId(layerName)); - } - - protected static List findInternal(GridParamLayer l, - LayerTransformer transformer, - String key, SortedSet times, - Map dimensions, Criterion idCrit) - throws OgcException { - Criterion levelCrit = getLevel(dimensions, l); - String param = ogcToDbParameter(l.getParameter()); - // TODO ensure consistency in which level gets returned - // TODO add support for more dimensions - return query(key, times, param, idCrit, levelCrit); - } - - public static GridParamLayer getLayer( - LayerTransformer transformer, - String layerName) throws OgcException { - GridParamLayer rval; - try { - rval = transformer.find(layerName); - } catch (OgcException e) { - throw new OgcException(Code.InternalServerError, e); - } - if (rval == null) { - throw new OgcException(Code.LayerNotDefined); - } - return rval; - } - - protected static String getIntDim(Map dimensions, - String key, GribLayer layer) throws OgcException { - String rval = getDim(dimensions, key, layer); - if (rval != null) { - try { - Integer i = Integer.parseInt(rval); - rval = i.toString(); - } catch (Exception e) { - throw new OgcException(Code.InvalidDimensionValue, key - + " must be a bare integer"); - } - } - return rval; - } - - protected static String getDim(Map dimensions, String key, - GribLayer layer) { - String rval = dimensions.get(key); - if (rval == null) { - SimpleDimension dim = layer.getDimension(key); - rval = dim.getDefaultValue(layer); - } - return rval; - } - - /** - * @param dimensions - * @param l - * @return null if level value not in dimensions and not in layer - * @throws OgcException - */ - protected static Criterion getLevel(Map dimensions, - GribLayer layer) throws OgcException { - String dimName = null; - // find level dimension in request - for (String dim : dimensions.keySet()) { - String lower = dim.toLowerCase(); - if (lower.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX.toLowerCase())) { - dimName = dim; - break; - } - } - SimpleDimension dim; - String value; - if (dimName == null) { - return null; - } else { - dim = layer.getDimension(dimName); - if (dim == null) { - return null; - } - value = dimensions.get(dimName); - } - // undo any case changes - dimName = dim.getName(); - return parseLevel(dimName, value, dim.getUnits()); - } - - @SuppressWarnings("unchecked") - protected static List query(String key, - SortedSet times, String param, Criterion idCrit, - Criterion levelCrit) throws OgcException { - Session sess = null; - try { - PluginDao dao = PluginFactory.getInstance().getPluginDao(key); - SessionFactory sessFact = dao.getSessionFactory(); - sess = sessFact.openSession(); - Criteria criteria = sess.createCriteria(GridRecord.class); - criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); - Disjunction or = Restrictions.disjunction(); - Criterion paramCrit = Restrictions.eq(PARAM_ABBV, param); - for (DataTime dt : times) { - Conjunction and = Restrictions.conjunction(); - and.add(idCrit).add(paramCrit); - if (levelCrit != null) { - and.add(levelCrit); - } - and.add(getTimeCrit(dt)); - or.add(and); - } - criteria.add(or); - modCriteria(criteria); - List res = (List) criteria.list(); - return res; - } catch (Exception e) { - throw new OgcException(Code.InternalServerError); - } finally { - if (sess != null) { - sess.close(); - } - } - } - - /** - * @param dt - * @return - */ - private static Criterion getTimeCrit(DataTime dt) { - return Restrictions.and(Restrictions.eq(FCST_TIME, dt.getFcstTime()), - Restrictions.eq(REF_TIME, dt.getRefTime())); - } - - /** - * @param dimName - * @param value - * @param defaultUnits - * @return - * @throws OgcException - */ - public static Criterion parseLevel(String dimName, String value, - String defaultUnits) throws OgcException { - Level level = LevelDimUtil.parseLevel(dimName, value, defaultUnits); - if (level == null) { - return Restrictions.eq(LEVEL_NAME, - dimName.substring(LevelDimUtil.LEVEL_DIM_PREFIX.length())); - } - Criterion nameEq = Restrictions.eq(LEVEL_NAME, level.getMasterLevel() - .getName()); - Conjunction and = Restrictions.conjunction(); - and.add(nameEq); - and.add(Restrictions.eq(LEVLE_ONE, level.getLevelonevalue())); - and.add(Restrictions.eq(LEVLE_TWO, level.getLeveltwovalue())); - - String units = level.getMasterLevel().getUnitString(); - if (units != null) { - and.add(Restrictions.eq(LEVEL_UNIT, units)); - } else { - and.add(Restrictions.isNull(LEVEL_UNIT)); - } - - return and; - } - - /** - * @param id - * @return - * @throws OgcException - */ - public static Criterion parseWcsId(String id) throws OgcException { - String[] parts = id.split(OgcLayer.keySeparator); - String model; - String coverage; - String level; - if (parts.length < 3) { - throw new OgcException(Code.InvalidFormat, "Invalid id format"); - } else { - level = parts[2]; - coverage = parts[1]; - model = parts[0]; - } - Conjunction and = Restrictions.conjunction(); - and.add(Restrictions.eq(DS_NAME, model)); - and.add(Restrictions.eq(COVERAGE_NAME, coverage)); - and.add(Restrictions.eq(LEVEL_NAME, level)); - return and; - } - - /** - * @param id - * @return - * @throws OgcException - */ - public static Criterion parseWmsId(String id) throws OgcException { - String[] parts = id.split(OgcLayer.keySeparator); - String model; - String coverage; - String level; - String param; - if (parts.length < 4) { - throw new OgcException(Code.InvalidFormat, "Invalid id format"); - } else { - level = parts[3]; - coverage = parts[1]; - model = parts[0]; - param = ogcToDbParameter(parts[2]); - } - Conjunction and = Restrictions.conjunction(); - and.add(Restrictions.eq(DS_NAME, model)); - and.add(Restrictions.eq(COVERAGE_NAME, coverage)); - and.add(Restrictions.eq(LEVEL_NAME, level)); - and.add(Restrictions.eq(PARAM_ABBV, param)); - return and; - } - - /** - * Add grid aliases to criteria - * - * @param criteria - * @return - */ - public static Criteria modCriteria(Criteria criteria) { - criteria = criteria.createAlias(INFO, INFO_ALIAS); - criteria = criteria.createAlias(PARAM, PARAM_ALIAS); - criteria = criteria.createAlias(LEVEL, LEVEL_ALIAS); - criteria = criteria.createAlias(MASTER_LEVEL, MASTER_LEVEL_ALIAS); - return criteria.createAlias(COVERAGE, COV_ALIAS); - } - - /** - * Convert OGC parameter name to name stored in database - * - * @param parameter - * @return - */ - public static String ogcToDbParameter(String parameter) { - return CFNameLookup.getInstance().getNCEPFromCF(parameter); - } - - /** - * Convert parameter name stored in database to OGC name - * - * @param parameter - * @return - */ - public static String dbToOgcParameter(String parameter) { - return CFNameLookup.getInstance().getCFFromNCEP(parameter); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWcsSource.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWcsSource.java deleted file mode 100644 index 34f59e306d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWcsSource.java +++ /dev/null @@ -1,459 +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.edex.plugin.grib.ogc; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Matcher; - -import javax.measure.unit.Unit; -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.collections.map.LRUMap; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.referencing.CRS; -import org.hibernate.Criteria; -import org.hibernate.criterion.Conjunction; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Disjunction; -import org.hibernate.criterion.Restrictions; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.ProjectedCRS; - -import com.raytheon.uf.common.dataplugin.PluginProperties; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataplugin.level.MasterLevel; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil; -import com.raytheon.uf.edex.ogc.common.spatial.AltUtil; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference; -import com.raytheon.uf.edex.plugin.unitconverter.UnitLookup; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.raytheon.uf.edex.wcs.reg.CoverageTransform; -import com.raytheon.uf.edex.wcs.reg.DefaultWcsSource; -import com.raytheon.uf.edex.wcs.reg.RangeAxis; -import com.raytheon.uf.edex.wcs.reg.RangeField; - - -/** - * TODO Add Description - * - * @author jelkins - * @version 1.0 - */ -public class GribWcsSource extends - DefaultWcsSource { - - private CoverageTransform _cTransform; - - private static final String PARAM_KEY = GribDimension.PARAM_DIM; - - /** - * @param props - * @param layerTable - */ - public GribWcsSource(PluginProperties props, - LayerTransformer transformer, - GribLayerCollector collector) { - super(props, transformer); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getCoverageTransform() - */ - @Override - public CoverageTransform getCoverageTransform() { - if (_cTransform == null) { - _cTransform = new CoverageTransform( - transformer.getKey()) { - @Override - protected List getRangeFields(GribLayer layer) { - List rval = new ArrayList(); - SimpleDimension params = layer - .getDimension(GribDimension.PARAM_DIM); - for (String name : params.getValues()) { - rval.add(new RangeField(name, null)); - } - SimpleDimension refDim = layer - .getDimension(GribDimension.REFTIME_DIM); - rval.add(convert(refDim)); - return rval; - } - - protected RangeField convert(SimpleDimension dim) { - String name = dim.getName(); - Set fromVals = dim.getValues(); - String units = dim.getUnits(); - RangeField rf = new RangeField(name, null); - List axis = new ArrayList(1); - if (units == null) { - // use dim name as axis label - units = name; - } - axis.add(new RangeAxis(units, fromVals)); - rf.setAxis(axis); - return rf; - } - - @SuppressWarnings("unchecked") - private final Map> cache = Collections - .synchronizedMap(new LRUMap(3)); - - private Unit getUnit(String str) { - Unit rval = cache.get(str); - if (rval == null) { - rval = Unit.valueOf(str); - cache.put(str, rval); - } - return rval; - } - - @Override - protected VerticalCoordinate getVertical(GribLayer layer) - throws WcsException { - if (!layer.isVertical()) { - return null; - } - List levels = LayerTransformer - .getDimsByPrefix(layer, - LevelDimUtil.LEVEL_DIM_PREFIX); - if (levels.isEmpty()) { - log.error("attempted to get vertical component of empty layer"); - throw new WcsException(Code.InternalServerError); - } - // TODO get sample that represents majority - SimpleDimension sample = levels.get(0); - Unit targetUnits = getUnit(sample.getUnits()); - String levelName = sample.getName().substring( - LevelDimUtil.LEVEL_DIM_PREFIX.length()); - Reference targetRef = VerticalLevelLookup - .getReference(levelName); - double min = Double.POSITIVE_INFINITY; - double max = Double.NEGATIVE_INFINITY; - for (SimpleDimension l : levels) { - String unitStr = l.getUnits(); - Unit unit = cache.get(unitStr); - if (unit == null) { - unit = Unit.valueOf(unitStr); - cache.put(unitStr, unit); - } - levelName = sample.getName().substring( - LevelDimUtil.LEVEL_DIM_PREFIX.length()); - Reference ref = VerticalLevelLookup - .getReference(levelName); - for ( String val : l.getValues()){ - VerticalCoordinate vert = parseLevelValue(val, - unit, ref); - VerticalCoordinate convert = AltUtil.convert( - targetUnits, targetRef, vert); - min = Math.min(min, convert.getMin()); - max = Math.max(max, convert.getMax()); - } - } - return new VerticalCoordinate(min, max, targetUnits, - targetRef); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.CoverageTransform#getBboxes( - * com.raytheon.uf.edex.ogc.common.db.SimpleLayer) - */ - @Override - protected List getBboxes(GribLayer layer) - throws WcsException { - List rval = new ArrayList( - 2); - VerticalCoordinate vert = getVertical(layer); - ReferencedEnvelope crs84Horiz = getHorizontal(layer); - rval.add(new Composite3DBoundingBox(crs84Horiz, vert)); - try { - GribLayer griblayer = (GribLayer) layer; - CoordinateReferenceSystem crs = CRS.parseWKT(griblayer - .getCrsWkt()); - ReferencedEnvelope nativeHoriz = new ReferencedEnvelope( - griblayer.getNativeMinX(), - griblayer.getNativeMaxX(), - griblayer.getNativeMinY(), - griblayer.getNativeMaxY(), crs); - String native2DCrsUrn = GribNativeCrsAuthority - .createURN(griblayer.getCoverageName(), - (ProjectedCRS) crs); - rval.add(new Composite3DBoundingBox(nativeHoriz, - native2DCrsUrn, vert)); - } catch (FactoryException e) { - log.error("Unable to determine native BBOX", e); - } - return rval; - } - - }; - } - return _cTransform; - } - - private void addToMap(Map> map, String key, String item) { - Set list = map.get(key); - if (list == null) { - list = new TreeSet(); - map.put(key, list); - } - list.add(item); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#parseFields(java.util.List) - */ - @Override - protected Map> parseFields(List fields) - throws WcsException { - if (fields == null) { - return new HashMap>(0); - } - Map> rval = new HashMap>( - fields.size()); - for (RangeField rf : fields) { - String key = rf.getIdentifier().toLowerCase(); - if (rf.getAxis() == null || rf.getAxis().isEmpty()) { - addToMap(rval, PARAM_KEY, rf.getIdentifier()); - continue; - } - for (RangeAxis ra : rf.getAxis()) { - Set keys = ra.getKeys(); - if (keys != null && !keys.isEmpty()) { - rval.put(key, keys); - break; - } - } - } - return rval; - } - - /** - * @param val - * @return - * @throws WcsException - */ - private VerticalCoordinate parseLevelValue(String val, Unit unit, - Reference ref) throws WcsException { - Matcher m = LevelDimUtil.levelPattern.matcher(val); - if (m.matches()) { - double val1 = Double.parseDouble(m.group(1)); - if (m.group(3) == null) { - return new VerticalCoordinate(val1, unit, ref); - } else { - double val2 = Double.parseDouble(m.group(3)); - return new VerticalCoordinate(val1, val2, unit, ref); - } - } - throw new WcsException(Code.InvalidParameterValue, - "Invalid level field value: " + val); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarField() - */ - @Override - protected String getScalarField() { - return GribRecordFinder.PARAM_ABBV; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getFilterClause(java.lang - * .String, com.raytheon.uf.common.time.DataTime, java.util.Map) - */ - @Override - protected Conjunction getFilterClause(String id, DataTime time, - Map> fields) throws WcsException { - Conjunction and = Restrictions.conjunction(); - try { - and.add(GribRecordFinder.parseWcsId(id)); - } catch (OgcException e) { - throw new WcsException(e); - } - for (Entry> e : fields.entrySet()) { - if (e.getKey().equalsIgnoreCase(GribDimension.REFTIME_DIM)) { - Set values = e.getValue(); - if (values == null || values.isEmpty()) { - continue; - } - if (values.size() == 1) { - Calendar cal = DatatypeConverter.parseDateTime(values - .iterator().next()); - and.add(Restrictions.eq(GribRecordFinder.REF_TIME, - cal.getTime())); - continue; - } - Disjunction or = Restrictions.disjunction(); - Iterator iter = values.iterator(); - while (iter.hasNext()) { - String val = iter.next(); - Calendar cal = DatatypeConverter.parseDateTime(val); - or.add(Restrictions.eq(GribRecordFinder.REF_TIME, - cal.getTime())); - } - and.add(or); - } - } - addIfNotNull(and, parseTime(time)); - and.add(Restrictions.not(Restrictions.like(GribRecordFinder.PARAM_ABBV, - "static%"))); - return and; - } - - /** - * Add criteria to conjunction if not null - * - * @param and - * @param crit - */ - private void addIfNotNull(Conjunction and, Criterion crit) { - if (crit != null) { - and.add(crit); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarValue(com.raytheon - * .uf.common.dataplugin.PluginDataObject) - */ - @Override - protected String getScalarValue(GridRecord record) throws WcsException { - return GribRecordFinder.dbToOgcParameter(new GridFieldAdapter() - .getCoverageField(record)); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getAltitude(com.raytheon - * .uf.common.dataplugin.PluginDataObject) - */ - @Override - protected VerticalCoordinate getAltitude(GridRecord record) - throws WcsException { - return new GridVerticalEnabler().getVerticalCoordinate(record); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarUnit(com.raytheon - * .uf.common.dataplugin.PluginDataObject) - */ - @Override - protected Unit getScalarUnit(GridRecord record) { - return record.getInfo().getParameter().getUnit(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#isUpPositive(com.raytheon - * .uf.common.dataplugin.PluginDataObject) - */ - @Override - protected boolean isUpPositive(GridRecord record) { - MasterLevel masterLevel = record.getInfo().getLevel() - .getMasterLevel(); - return !"DEC".equalsIgnoreCase(masterLevel.getType()); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#modCriteria(org.hibernate - * .Criteria) - */ - @Override - protected Criteria modCriteria(Criteria criteria) { - return GribRecordFinder.modCriteria(criteria); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarKey() - */ - @Override - protected String getScalarKey() { - return PARAM_KEY; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getUcarUnit(com.raytheon - * .uf.common.dataplugin.PluginDataObject) - */ - @Override - protected ucar.units.Unit getUcarUnit(GridRecord record) { - Unit parameterUnitObject = record.getInfo().getParameter().getUnit(); - return UnitLookup.getInstance().getUcarFromJsr(parameterUnitObject); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarCrit(java.lang - * .String) - */ - @Override - protected Criterion getScalarCrit(String value) { - return super.getScalarCrit(GribRecordFinder.ogcToDbParameter(value)); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWmsSource.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWmsSource.java deleted file mode 100644 index 2ac8dbedfd..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GribWmsSource.java +++ /dev/null @@ -1,103 +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.edex.plugin.grib.ogc; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.PluginProperties; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.reg.DefaultWmsSource; -import com.raytheon.uf.edex.wms.styling.ColormapStyleProvider; -import com.raytheon.uf.edex.wms.styling.ICoverageStyleProvider; - -/** - * - * @author jelkins - * @version 1.0 - */ -public class GribWmsSource extends - DefaultWmsSource { - - protected ColormapStyleProvider styler = new GridStyleProvider( - this, "Grid/Default"); - - public GribWmsSource(PluginProperties props, - LayerTransformer transformer) - throws PluginException { - super(props, props.getPluginName(), transformer); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.reg.DefaultWmsSource#getRecord(java.lang.String, - * java.lang.String, java.lang.String, java.util.Map) - */ - @Override - protected GridRecord getRecord(String layer, String time, String elevation, - Map dimensions) throws WmsException { - LayerTransformer transformer; - List res; - try { - transformer = getTransformer(); - res = GribRecordFinder.findWms(transformer, key, layer, time, - dimensions); - } catch (OgcException e) { - WmsException err = new WmsException(e); - if (err.getCode().equals(Code.InternalServerError)) { - log.error("Problem getting grib layer: " + layer); - } - throw err; - } catch (PluginException e) { - log.error("Unable to get transformer for grib", e); - throw new WmsException(Code.InternalServerError); - } - if (res.isEmpty()) { - throw new WmsException(Code.LayerNotDefined, - "No layer matching all specified dimensions found"); - } - if (res.size() > 1) { - Collections.sort(res, new GribRecordFinder.Comp()); - } - return res.get(0); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.reg.DefaultWmsSource#getStyleProvider(java.lang - * .String) - */ - @Override - protected ICoverageStyleProvider getStyleProvider(String layer) - throws WmsException { - return styler; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridCompositeLayer.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridCompositeLayer.java deleted file mode 100644 index 64fd5f6d29..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridCompositeLayer.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; - -import javax.xml.bind.annotation.XmlElement; - -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; - -/** - * Grid layer that sorts dimensions by parameter - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 27, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridCompositeLayer extends GribLayer { - - private static final long serialVersionUID = 6178813246077412635L; - - @XmlElement - @DynamicSerializeElement - protected HashMap> dimensions = new HashMap>(); - - @XmlElement - @DynamicSerializeElement - protected HashMap> timeMap = new HashMap>(); - - /** - * - */ - public GridCompositeLayer() { - super(); - } - - /** - * @param other - */ - public GridCompositeLayer(GridCompositeLayer other) { - super(other); - this.dimensions = new HashMap>( - other.dimensions.size()); - for (Entry> e : other.dimensions - .entrySet()) { - TreeSet set = new TreeSet(); - GribDimension.copy(set, e.getValue()); - this.dimensions.put(e.getKey(), set); - } - this.timeMap = new HashMap>(other.timeMap.size()); - for (Entry> e : other.timeMap.entrySet()) { - this.timeMap.put(e.getKey(), new TreeSet(e.getValue())); - } - } - - @Override - public Set getDimensions() { - HashMap byDim = new HashMap(); - for (Entry> e : dimensions.entrySet()) { - for (GribDimension dim : e.getValue()) { - GribDimension aggregate = byDim.get(dim.getName()); - if (aggregate == null) { - byDim.put(dim.getName(), dim); - continue; - } - aggregate.getValues().addAll(dim.getValues()); - } - } - return new TreeSet(byDim.values()); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.ogc.common.db.SimpleLayer#getTimes() - */ - @Override - public TreeSet getTimes() { - TreeSet rval = new TreeSet(); - for (Entry> e : timeMap.entrySet()) { - rval.addAll(e.getValue()); - } - return rval; - } - - /** - * Add time for parameter - * - * @param parameter - * @param time - */ - public void addTime(String parameter, Date time) { - TreeSet set = timeMap.get(parameter); - if (set == null) { - set = new TreeSet(); - timeMap.put(parameter, set); - } - set.add(time); - } - - /** - * @param parameter - * @return empty list if parameter has no times - */ - public TreeSet getTimes(String parameter) { - TreeSet treeSet = timeMap.get(parameter); - if (treeSet == null) { - return new TreeSet(); - } else { - return new TreeSet(treeSet); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.db.SimpleLayer#updateDates(com.raytheon - * .uf.edex.ogc.common.db.SimpleLayer) - */ - @Override - public void updateDates(SimpleLayer other) { - if (!(other instanceof GridCompositeLayer)) { - return; - } - GridCompositeLayer shiny = (GridCompositeLayer) other; - for (Entry> e : shiny.timeMap.entrySet()) { - TreeSet thisSet = this.timeMap.get(e.getKey()); - if (thisSet == null) { - this.timeMap.put(e.getKey(), new TreeSet(e.getValue())); - } else { - thisSet.addAll(e.getValue()); - } - } - } - - /** - * @param parameter - * @return empty set if no dimensions for parameter - */ - public TreeSet getDimensions(String parameter) { - TreeSet rval = dimensions.get(parameter); - if (rval == null) { - return new TreeSet(); - } - return rval; - } - - /** - * @param parameter - * @param dims - */ - public void addDimensions(String parameter, TreeSet dims) { - dimensions.put(parameter, dims); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.db.SimpleLayer#updateDims(com.raytheon - * .uf.edex.ogc.common.db.SimpleLayer) - */ - @Override - public void updateDims(SimpleLayer other) { - if (!(other instanceof GridCompositeLayer)) { - return; - } - GridCompositeLayer shiny = (GridCompositeLayer) other; - for (String key : shiny.dimensions.keySet()) { - TreeSet otherDims = shiny.dimensions.get(key); - TreeSet thisDims = dimensions.get(key); - if (thisDims == null) { - thisDims = new TreeSet(); - GribDimension.copy(thisDims, otherDims); - dimensions.put(key, thisDims); - } else { - updateDimLists(thisDims, otherDims); - } - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.db.SimpleLayer#getDimension(java.lang - * .String) - */ - @Override - public GribDimension getDimension(String dimension) { - // TODO slow - return getDimMap(getDimensions()).get(dimension); - } - - /** - * @return set of parameter names for composite layer - */ - public Set getParameters() { - return dimensions.keySet(); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridFieldAdapter.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridFieldAdapter.java deleted file mode 100644 index 8980f8c05d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridFieldAdapter.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.edex.plugin.dataset.urn.CFNameLookup; -import com.raytheon.uf.edex.wcs.reg.IFieldAdapted; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 5, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridFieldAdapter implements IFieldAdapted { - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.FieldAdapted#getCoverageField(java.lang. - * Object) - */ - @Override - public String getCoverageField(GridRecord record) { - CFNameLookup lookup = CFNameLookup.getInstance(); - String abbr = record.getInfo().getParameter().getAbbreviation(); - return lookup.getCFFromNCEP(abbr); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.FieldAdapted#getSupportedClass() - */ - @Override - public Class getSupportedClass() { - return GridRecord.class; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridNotifyDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridNotifyDao.java deleted file mode 100644 index bf0fa4ceb3..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridNotifyDao.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridConstants; -import com.raytheon.uf.edex.database.plugin.PurgeResults; -import com.raytheon.uf.edex.ogc.common.db.PurgeNotification; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; - -/** - * Dao with purge notification for grid - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 6, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridNotifyDao extends GridDao { - - private final PurgeNotification notify; - - /** - * @throws PluginException - */ - public GridNotifyDao() throws PluginException { - this(GridConstants.GRID); - } - - /** - * @param pluginName - * @throws PluginException - */ - public GridNotifyDao(String pluginName) throws PluginException { - super(pluginName); - this.notify = new PurgeNotification(pluginName); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.plugin.grid.dao.GridDao#purgeExpiredData() - */ - @Override - public void purgeExpiredData() throws PluginException { - PurgeResults res = super.purgeExpiredDataWithResults(); - notify.purgeExpiredData(res); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.plugin.grid.dao.GridDao#purgeAllData() - */ - @Override - public void purgeAllData() throws PluginException { - super.purgeAllData(); - notify.purgeAllData(); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridParamLayer.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridParamLayer.java deleted file mode 100644 index 4ab1bb8292..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridParamLayer.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.Date; -import java.util.Set; -import java.util.TreeSet; - -import javax.xml.bind.annotation.XmlElement; - -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; - -/** - * Grid layer that has dimensions for a single parameter - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 27, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridParamLayer extends GribLayer { - - private static final long serialVersionUID = -5614814725742630980L; - - @XmlElement - @DynamicSerializeElement - protected TreeSet dimensions; - - @XmlElement - @DynamicSerializeElement - protected String parameter; - - /** - * - */ - public GridParamLayer() { - super(); - dimensions = new TreeSet(); - } - - /** - * @param other - */ - public GridParamLayer(GridParamLayer other) { - super(other); - this.parameter = other.parameter; - this.dimensions = new TreeSet(); - GribDimension.copy(this.dimensions, other.dimensions); - } - - /** - * @param other - */ - public GridParamLayer(String parameter, GridCompositeLayer other) { - super(other); - this.parameter = parameter; - this.times = new TreeSet(other.getTimes(parameter)); - TreeSet otherDims = other.getDimensions(parameter); - this.dimensions = new TreeSet(); - for (GribDimension dim : otherDims) { - if (dim.getName().equalsIgnoreCase(GribDimension.PARAM_DIM)) { - continue; - } - this.dimensions.add(new GribDimension(dim)); - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.plugin.grib.ogc.GribLayer#getDimensions() - */ - @Override - public Set getDimensions() { - return dimensions; - } - - /** - * @return the parameter - */ - public String getParameter() { - return parameter; - } - - /** - * @param parameter - * the parameter to set - */ - public void setParameter(String parameter) { - this.parameter = parameter; - } - - /** - * @param dimensions - * the dimensions to set - */ - public void setDimensions(TreeSet dimensions) { - this.dimensions = dimensions; - } - -} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridStyleProvider.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridStyleProvider.java deleted file mode 100644 index bd1e69016d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridStyleProvider.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import javax.measure.unit.Unit; - -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataplugin.grid.util.GridStyleUtil; -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.style.ParamLevelMatchCriteria; -import com.raytheon.uf.edex.ogc.common.IStyleLookupCallback; -import com.raytheon.uf.edex.plugin.grid.dao.GridDao; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.styling.ColormapStyleProvider; - -/** - * Style provider specific to grid colormapped imagery - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 2, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridStyleProvider extends ColormapStyleProvider { - - - - /** - * @param styleLibraryFileName - * @param defaultColormap - */ - public GridStyleProvider(IStyleLookupCallback callback, - String defaultColormap) { - super(callback, defaultColormap); - } - - /** - * @param styleLibraryFileName - */ - public GridStyleProvider(IStyleLookupCallback callback) { - super(callback); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getCriteria(com - * .raytheon.uf.common.dataplugin.PluginDataObject) - */ - @Override - protected ParamLevelMatchCriteria getCriteria(GridRecord record) - throws WmsException { - return GridStyleUtil - .getMatchCriteria((GridRecord) record); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getParamUnits( - * com.raytheon.uf.common.dataplugin.PluginDataObject) - */ - @Override - protected Unit getParamUnits(GridRecord record) throws WmsException { - Parameter parameter = record.getInfo().getParameter(); - return parameter.getUnit(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getRawData(com - * .raytheon.uf.common.dataplugin.PluginDataObject) - */ - @Override - protected Object getRawData(GridRecord record) throws WmsException { - Object data; - try { - GridDao dao = new GridDao(); - IDataRecord[] res = dao.getHDF5Data(record, 0); - FloatDataRecord datarecord = (FloatDataRecord) res[0]; - data = datarecord.getFloatData(); - } catch (PluginException e) { - log.error("Unable to retrieve grib data", e); - throw new WmsException(Code.InternalServerError); - } - return data; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridVerticalEnabler.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridVerticalEnabler.java deleted file mode 100644 index 3eda2aaeb7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridVerticalEnabler.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import javax.measure.unit.SI; -import javax.measure.unit.Unit; - -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.dataplugin.level.Level; -import com.raytheon.uf.common.dataplugin.level.MasterLevel; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 30, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridVerticalEnabler implements VerticalEnabled { - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled#getVerticalCoordinate - * (java.lang.Object) - */ - @Override - public VerticalCoordinate getVerticalCoordinate(GridRecord rec) { - if (rec.getInfo() == null) { - return null; - } - Level level = rec.getInfo().getLevel(); - if (level == null) { - return null; - } - double l1 = level.getLevelonevalue(); - double l2 = level.getLeveltwovalue(); - MasterLevel master = level.getMasterLevel(); - VerticalCoordinate.Reference ref; - if (master.getUnit() == null) { - ref = Reference.UNKNOWN; - } else if (SI.PASCAL.isCompatible(master.getUnit())) { - ref = Reference.PRESSURE_LEVEL; - } else if ("FHAG".equalsIgnoreCase(master.getName())) { - ref = Reference.ABOVE_GROUND; - } else if (SI.METER.isCompatible(master.getUnit())) { - ref = Reference.ABOVE_MSL; - } else { - ref = Reference.UNKNOWN; - } - if (l2 == Level.INVALID_VALUE) { - return new VerticalCoordinate(l1, master.getUnit(), ref); - } else { - return new VerticalCoordinate(l1, l2, master.getUnit(), ref); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled#getSupportedClass - * () - */ - @Override - public Class getSupportedClass() { - return GridRecord.class; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled# - * getDefaultVerticalUnit() - */ - @Override - public Unit getDefaultVerticalUnit() { - return null; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridWmsLayerCache.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridWmsLayerCache.java deleted file mode 100644 index 65cbb48e72..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/GridWmsLayerCache.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; - -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcLayer; -import com.raytheon.uf.edex.ogc.common.db.ILayerCache; - -/** - * Layer cache adapter to split composite levels into parameter levels - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 26, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class GridWmsLayerCache implements ILayerCache { - - private final ILayerCache cache; - - /** - * @param cache - */ - public GridWmsLayerCache(ILayerCache cache) { - this.cache = cache; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.ogc.common.db.LayerCache#getLayers() - */ - @Override - public List getLayers() throws OgcException { - List origLayers = cache.getLayers(); - List rval = new ArrayList(origLayers.size()); - for (GridCompositeLayer orig : origLayers) { - String[] parts = StringUtils.split(orig.getName(), - OgcLayer.keySeparator); - for (String param : orig.getParameters()) { - rval.add(getParamLayer(orig, parts, param)); - } - } - return rval; - } - - /** - * @param orig - * @param name - * @param param - * @return - */ - private GridParamLayer getParamLayer(GridCompositeLayer orig, String name, - String param) { - GridParamLayer paramLayer = new GridParamLayer(param, orig); - paramLayer.setName(name); - return paramLayer; - } - - /** - * @param orig - * @param parts - * @param param - * @return - */ - private GribLayer getParamLayer(GridCompositeLayer orig, String[] parts, - String param) { - LinkedList partList = new LinkedList( - Arrays.asList(parts)); - partList.add(parts.length - 1, param); - return getParamLayer(orig, - StringUtils.join(partList, OgcLayer.keySeparator), param); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.db.LayerCache#getLayer(java.lang.String) - */ - @Override - public GribLayer getLayer(String name) throws OgcException { - String[] parts = StringUtils.split(name, - OgcLayer.keySeparator); - LinkedList partList = new LinkedList( - Arrays.asList(parts)); - String param = partList.remove(parts.length - 2); - GridCompositeLayer layer = cache.getLayer(StringUtils.join(partList, - OgcLayer.keySeparator)); - if (layer == null) { - return null; - } - return getParamLayer(layer, name, param); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/VerticalLevelLookup.java b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/VerticalLevelLookup.java deleted file mode 100644 index 7ae5b7657e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/src/com/raytheon/uf/edex/plugin/grib/ogc/VerticalLevelLookup.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.grib.ogc; - -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 26, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class VerticalLevelLookup { - - public static Reference getReference(String masterLevel) { - if ("FH".equalsIgnoreCase(masterLevel)) { - return Reference.ABOVE_MSL; - } - if ("MB".equalsIgnoreCase(masterLevel)) { - return Reference.PRESSURE_LEVEL; - } - if ("FHAG".equalsIgnoreCase(masterLevel)) { - return Reference.ABOVE_GROUND; - } - return Reference.UNKNOWN; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/utility/common_static/base/styleRuleLib/grib_style_library.xml b/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/utility/common_static/base/styleRuleLib/grib_style_library.xml deleted file mode 100644 index b30a8c89eb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.grib.ogc/utility/common_static/base/styleRuleLib/grib_style_library.xml +++ /dev/null @@ -1,241 +0,0 @@ - - - - - .*/DpT/SFC.* - - 90 - -60 - - Grid/gridded data - - - - .*/DpT/MB.* - - 1050 - 500 - - - 308.15 - 278.15 - 213.15 - 213.15 - - Grid/gridded data - - - - .*/DpT/MB.* - - 500 - 250 - - - 278.15 - 233.15 - 213.15 - 173.15 - - Grid/gridded data - - - - .*/WGS/SFC.* - - 36.0111111 - 0 - - Grid/gridded data - - - - .*/T/SFC.* - - - 319.261111 - - 233.15 - - Grid/gridded data - - - - .*/T/MB.* - - 1050 - 500 - - - 318.15 - 233.15 - - - Grid/gridded data - - 10 - - - - - .*/AV/[^/]*.* - - - 0.00030 - -0.00005 - - Grid/gridded data - - - - .*/BLI/[^/]*.* - - - 15 - -15 - - Grid/gridded data - - - - .*/CAPE/SFC.* - - 5000 - 0 - - Grid/gridded data - - - - .*/TCC/SFC.* - - - - - Grid/gridded data - - 25 50 75 - - - - - .*/WS/MB.* - - 1050 - 850 - - - 75 - 0 - - Grid/gridded data - - 10 - - - - - .*/WS/MB.* - - 850 - 200 - - - 0 - 0 - 200 - 75 - - Grid/gridded data - - 20 - - - - - .*/WS/SFC.* - - 75 - 0 - - Grid/gridded data - - 10 - - - - - .*/HTSGW/SFC.* - - 20 - 0 - - Grid/gridded data - - 5 - - - - - .*/ICIP/.* - - 1 - 0 - - Grid/gridded data - - 0.1 - - - - - .*/ICI/.* - - 5 - 0 - - Grid/icing_severity - - 1 - - - - - .*/SLDP/.* - - 1 - 0 - - Grid/icing_sld - - 0.25 - - - - - .*/TPFI/.* - - 1 - 0 - - Grid/aviation_turbulence_index - - 0.25 - - - - - .* - Grid/gridded data - - 255 - 0 - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.classpath deleted file mode 100644 index 1fa3e6803d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.project b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.project deleted file mode 100644 index bf30ba8a92..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - com.raytheon.uf.edex.plugin.mesowest - - - - - - org.python.pydev.PyDevBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.python.pydev.pythonNature - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.pydevproject b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.pydevproject deleted file mode 100644 index faf12629d9..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.pydevproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - -python 2.5 -Default - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4eb46e052d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Mar 03 17:15:37 GMT+00:00 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.mesowest/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/META-INF/MANIFEST.MF deleted file mode 100644 index 999b13ce1e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,17 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Mesowest Plug-in -Bundle-SymbolicName: com.raytheon.uf.edex.plugin.mesowest -Bundle-Version: 1.12.1174.qualifier -Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.edex.common, - com.raytheon.uf.common.pointdata, - com.raytheon.uf.edex.decodertools;bundle-version="1.0.0", - com.raytheon.uf.common.localization, - org.geotools, - javax.persistence, - javax.measure -Export-Package: com.raytheon.uf.edex.plugin.mesowest, - com.raytheon.uf.edex.plugin.mesowest.common -Import-Package: org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/MesowestDecoder.py b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/MesowestDecoder.py deleted file mode 100644 index d4bdd64cb8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/MesowestDecoder.py +++ /dev/null @@ -1,129 +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. -## -import sys, os, time, re, string, getopt -import copy -import LogStream -import pupynere -from com.raytheon.uf.common.pointdata.spatial import SurfaceObsLocation -from java.lang import Double -from java.lang import Integer - -class MesowestDecoder(): - - def __init__(self, text=None, filePath=None): - - self._parameters = ['altimeter', 'dewpoint', 'relHumidity', 'stationId', 'rawMessage', 'temperature', 'windDir', 'windGust', 'windSpeed', 'precipAccum'] - self._mappings = ['altimeter', 'dwpt', 'humidity', 'stationId', 'obsText', 'temp', 'windDirection', 'windGust', 'windSpeed', 'precip'] - - - #to ensure time calls are based on Zulu - os.environ['TZ'] = "GMT0" - - self._deleteAfterProcessing = 0 - if filePath is None: - self._incomingFilename = None - else: - self._incomingFilename = filePath - - def decode(self): - fillValue = None - missing = None - mesowestReports = list() - obsList = dict() - net = pupynere.netcdf_file(self._incomingFilename,"r") - records = net._recs - for x in range(records): - stationId = ''.join(net.variables['stationId'][x]) - reportTime = net.variables['reportTime'][x] * 1000 - if obsList.has_key(reportTime): - if stationId in obsList[reportTime]: - continue - else: - obsList[reportTime].append(stationId) - else: - obsList[reportTime] = list() - obsList[reportTime].append(stationId) - mesowestReport = dict() - for paramNum in range(len(self._parameters)): - param = self._parameters[paramNum] - mapping = self._mappings[paramNum] - variable = net.variables[param] - # Set the missing value if available - try: - missing = variable.missing_value - except AttributeError: - missing = None - # Set the fill value if available - try: - fillValue = variable._FillValue - except AttributeError: - fillValue = None - if len(variable.shape) == 1: - if fillValue != None and variable[x] == fillValue: - mesowestReport[mapping] = Double(-9999.0) - continue - if missing != None: - # Odd case where certain values are -764 in the netcdf - if variable[x] == missing or variable[x] < -600: - mesowestReport[mapping] = Double(-9999.0) - continue - mesowestReport[mapping] = Double.valueOf(str(variable[x])) - elif len(variable.shape) > 1 and variable.shape[1] > 3: - mesowestReport[mapping] = ''.join(variable[x]) - - location = SurfaceObsLocation() - lat = Double.valueOf(str(net.variables['latitude'][x])) - lon = Double.valueOf(str(net.variables['longitude'][x])) - elv = Double.valueOf(str(net.variables['elevation'][x])) - location.assignLocation(lat.doubleValue(),lon.doubleValue()); - location.setElevation(Integer(elv.intValue())); - location.setStationId(stationId) - mesowestReport['location'] = location - mesowestReport['timeObs'] = long(reportTime) - mesowestReport['dataTime'] = mesowestReport['timeObs'] - mesowestReport['networkType'] = ''.join(net.variables['stationType'][x]) - mesowestReports.append(mesowestReport) - net.close() - return mesowestReports - - - def _usage(self): - #Prints out usage information if started without sufficient command - #line arguments. - s = "This tool is not meant to be run from the command line." - print s - LogStream.logProblem(s) - - - -def main(): - try: - LogStream.logEvent("MesowestDecoder Starting") - decoder = MesowestDecoder() - decoder.decode() - decoder = None - LogStream.logEvent("MesowestDecoder Finished") - except: - LogStream.logProblem("Caught Exception: ", LogStream.exc()) - sys.exit(1) - -if __name__ == "__main__": - main() - sys.exit(0) diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/build.properties deleted file mode 100644 index 9410ee96ef..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - res/,\ - MesowestDecoder.py diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/com.raytheon.uf.edex.plugin.mesowest.ecl b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/com.raytheon.uf.edex.plugin.mesowest.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-common.xml b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-common.xml deleted file mode 100644 index 94e7d40126..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-common.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-ingest.xml deleted file mode 100644 index 23a5694be6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/res/spring/mesowest-ingest.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Throwable - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestDecoder.java deleted file mode 100644 index 3b90cfe1bc..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestDecoder.java +++ /dev/null @@ -1,148 +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.edex.plugin.mesowest; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.edex.exception.DecoderException; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.edex.decodertools.core.IDecoderInput; -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; -import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants; -import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestParser; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 03, 2009            jkorman     Initial creation
- * Aug 30, 2013 2298       rjpeter     Make getPluginName abstract
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MESOWestDecoder { - - private final Log logger = LogFactory.getLog(getClass()); - - private String pluginName = "mesowest"; - - private final Map parserMap = new HashMap(); - - /** - * - * @param name - */ - public MESOWestDecoder(String name) { - this.pluginName = name; - } - - /** - * Get the next decoded data record. - * - * @return One record of decoded data. - * @throws DecoderException - * Thrown if no data is available. - */ - public PluginDataObject[] decode(IDecoderInput input) { - - PluginDataObject[] decodedData = null; - String traceId = null; - - logger.debug("MESOWestDecoder.decode()"); - - if (input != null) { - traceId = input.getProperty(MESOWestConstants.TRACEID); - - MESOWestRecord record = null; - - String type = input.getProperty(MESOWestConstants.K_DATATYPE); - if (MESOWestConstants.T_PARMHEADER.equals(type)) { - parserMap.put(input.getProperty("uuid"), new MESOWestParser( - input.getReport())); - logger.debug("Created parser "); - } else if (MESOWestConstants.T_LASTITEM.equals(type)) { - parserMap.remove(input.getProperty("uuid")); - logger.debug("Destroyed parser "); - } else { - MESOWestParser parser = parserMap - .get(input.getProperty("uuid")); - if (parser != null) { - if (input.getReport().length() > 10) { - if ((record = parser.decode(input.getReport())) != null) { - record.setTraceId(traceId); - record.setObsText(input.getReport() + "\n"); - } - } - } else { - logger.error("Unexpected data in data stream"); - } - } - - try { - if (record != null) { - logger.info("Decoded obs " + record.getStationId()); - - try { - record.constructDataURI(); - } catch (PluginException e) { - throw new DecoderException( - "Unable to construct dataURI", e); - } - - decodedData = new PluginDataObject[] { record }; - } else { - logger.info(String.format("%s - Decoded no obs", traceId)); - } - } catch (Exception e) { - logger.error("Error in MESOWestDecoder", e); - } finally { - if (decodedData == null) { - decodedData = new PluginDataObject[0]; - } - } - } else { - logger.error("null input data in MESOWestDecoder"); - } - - return decodedData; - } - - /** - * @return the pluginName - */ - public String getPluginName() { - return pluginName; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestFilter.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestFilter.java deleted file mode 100644 index e3c0f8d9db..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestFilter.java +++ /dev/null @@ -1,212 +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.edex.plugin.mesowest; - -import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -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.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.common.serialization.JAXBManager; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement; -import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter; -import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter; -import com.raytheon.uf.edex.decodertools.core.filterimpl.RectFilterElement; - -/** - * A filter for mesowest data that is configured through XML. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 23, 2009            jkorman     Initial creation
- * Oct 22, 2013 2361       njensen     Use JAXBManager for XML
- * 
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public class MESOWestFilter extends AbstractObsFilter { - - private Log logger = LogFactory.getLog(getClass()); - - private static final String FILTER_CONFIG = "mesowest_filters.xml"; - - public MESOWestFilter() { - } - - public MESOWestFilter(String site) { - try { - IPathManager manager = PathManagerFactory.getPathManager(); - - LocalizationContext siteContext = manager.getContextForSite( - EDEX_STATIC, site); - - File siteDir = manager.getFile(siteContext, ""); - if (siteDir.exists()) { - try { - File srcFile = new File(siteDir, FILTER_CONFIG); - JAXBManager jaxb = new JAXBManager(MESOWestFilter.class, - PluginDataObjectFilter.class); - AbstractObsFilter filter = jaxb.unmarshalFromXmlFile( - AbstractObsFilter.class, srcFile); - this.setFilterElements(filter.getFilterElements()); - this.setFilterName(filter.getFilterName()); - } catch (JAXBException e) { - logger.error("Unable to unmarshall filter config", e); - } - } - - } catch (Exception e) { - logger.error("Error creating filter. Creating default empty", e); - setFilterName("Default"); - } - } - - /** - * Apply the list of filters against given input data. - * - */ - @Override - public PluginDataObject[] filter(PluginDataObject[] reports) { - int reportCount = 0; - if (reports != null) { - for (int i = 0; i < reports.length; i++) { - boolean keep = false; - for (AbstractFilterElement element : filterElements) { - PluginDataObject r = element.filter(reports[i]); - if (r != null) { - if (AbstractObsFilter.INCLUDE_TYPE.equals(element - .getFilterType())) { - keep = keep | true; - } - } - } - if (!keep) { - reports[i] = null; - } else { - reportCount++; - } - } - } - if (reportCount == 0) { - reports = new PluginDataObject[0]; - } else { - PluginDataObject[] newReports = new PluginDataObject[reportCount]; - int i = 0; - for (PluginDataObject report : reports) { - if (report != null) { - newReports[i++] = report; - } - } - reports = newReports; - } - return reports; - } - - public static final void main(String[] args) { - - AbstractObsFilter filter = new MESOWestFilter(); - filter.setFilterName("TestFilter"); - - RectFilterElement rect = new RectFilterElement(); - rect.setLowerRightLat(40.0); - rect.setLowerRightLon(-90.0); - rect.setUpperLeftLat(45.0); - rect.setUpperLeftLon(-95.0); - rect.setFilterElementName("OAX.WFO"); - rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE); - filter.addFilterElement(rect); - - rect = new RectFilterElement(); - rect.setLowerRightLat(46.0); - rect.setLowerRightLon(-90.0); - rect.setUpperLeftLat(49.0); - rect.setUpperLeftLon(-100.0); - rect.setFilterElementName("Upperbasin"); - rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE); - filter.addFilterElement(rect); - - String s = null; - - try { - JAXBContext ctx = JAXBContext.newInstance(MESOWestFilter.class, - RectFilterElement.class); - - Marshaller msh = ctx.createMarshaller(); - - msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - - ByteArrayOutputStream istrm = new ByteArrayOutputStream(); - msh.marshal(filter, istrm); - - s = istrm.toString(); - - System.out.println(s); - - rect = null; - filter = null; - - Unmarshaller umsh = ctx.createUnmarshaller(); - - ByteArrayInputStream ostrm = new ByteArrayInputStream(s.getBytes()); - filter = (AbstractObsFilter) umsh.unmarshal(ostrm); - - System.out.println(filter.getFilterName()); - System.out.println(filter.getClass().getName()); - - List elements = filter.getFilterElements(); - for (AbstractFilterElement element : elements) { - System.out.println(element.getFilterElementName()); - } - - } catch (JAXBException e) { - - e.printStackTrace(); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestSeparator.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestSeparator.java deleted file mode 100644 index 9eda63dbc8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/MESOWestSeparator.java +++ /dev/null @@ -1,218 +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.edex.plugin.mesowest; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.edex.esb.Headers; -import com.raytheon.edex.plugin.AbstractRecordSeparator; -import com.raytheon.uf.edex.decodertools.core.DecoderInput; -import com.raytheon.uf.edex.decodertools.core.IDecoderInput; -import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants; - -/** - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 20090310           1969 jkorman     Initial Coding.
- * 
- * - * @author jkorman - * @version 1.0 - */ -public class MESOWestSeparator extends AbstractRecordSeparator { - - private Log logger = LogFactory.getLog(getClass()); - - private static final int MIN_LINE_LEN = 10; - - private byte[] messageData = null; - - private Headers headerData = null; - - private List reports = null; - - private String traceId = null; - - private int currentReport = -1; - - private UUID uuid = null; - - /** - * - * @param data - * @param headers - */ - private MESOWestSeparator(byte[] data, Headers headers) { - headerData = headers; - if (headerData != null) { - traceId = (String) headerData.get(MESOWestConstants.TRACEID); - } - - uuid = UUID.randomUUID(); - - setData(data, headers); - } - - /** - * Empty constructor so Spring doesn't complain. TODO : Make sure this is - * needed. - */ - public MESOWestSeparator() { - } - - /** - * Create an instance of a separator using the supplied data. - * - * @param data - * @param headers - * @return - * @throws Exception - */ - public static MESOWestSeparator separate(byte[] data, Headers headers) - throws Exception { - return new MESOWestSeparator(data, headers); - } - - /** - * Get the next record. This implementation returns the record as a String. - * - * @return The next observation record as a String. - */ - @Override - public IDecoderInput next() { - IDecoderInput data = null; - if (hasNext()) { - - String rpt = reports.get(currentReport++); - data = new DecoderInput(null, rpt); - data.setProperty("uuid", uuid.toString()); - - if (rpt.startsWith(MESOWestConstants.D_PARMLEADER)) { - data.setProperty(MESOWestConstants.K_DATATYPE, - MESOWestConstants.T_PARMHEADER); - } else if (rpt.startsWith(MESOWestConstants.LAST_DATA_ITEM)) { - data.setProperty(MESOWestConstants.K_DATATYPE, - MESOWestConstants.T_LASTITEM); - } else { - data.setProperty(MESOWestConstants.K_DATATYPE, - MESOWestConstants.T_REPORTDATA); - } - data.setProperty(MESOWestConstants.TRACEID, traceId); - } - logger.debug("Separator.next()"); - return data; - } - - /** - * Is there another record available? - * - * @return Is there another record available? - */ - @Override - public boolean hasNext() { - logger.debug("Separator.hasNext()"); - boolean hasNext = false; - if (reports != null) { - if (reports.size() > 0) { - hasNext = currentReport < reports.size(); - } else { - reports.clear(); - reports = null; - } - } - return hasNext; - } - - /** - * Set the raw message data and invoke the internal message separation - * process. - * - * @param rawMessage - * The raw weather text message. - */ - @Override - public void setData(byte[] rawMessage, Headers headers) { - currentReport = -1; - reports = new ArrayList(); - if (rawMessage != null) { - - InputStream strm = new ByteArrayInputStream(rawMessage); - - separate(strm); - } - - if ((reports != null) && (reports.size() > 0)) { - currentReport = 0; - } else { - logger.info("No reports found in data."); - } - } - - /** - * Get the message data. - * - * @return The cleaned message data. - */ - public byte[] getMessage() { - return messageData; - } - - /** - * Separate the mesonet data, one report per line. No need to account for - * reports spanning lines. - * - * @param strm - * An input stream to the meso data. - */ - private void separate(InputStream strm) { - BufferedReader in = null; - - try { - in = new BufferedReader(new InputStreamReader(strm)); - - String s = null; - while ((s = in.readLine()) != null) { - if (s.length() > MIN_LINE_LEN) { - reports.add(s.trim()); - } - } - reports.add(MESOWestConstants.LAST_DATA_ITEM); - - } catch (IOException ioe) { - logger.error("Error reading mesowest data " + ioe); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/common/MESOWestRecord.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/common/MESOWestRecord.java deleted file mode 100644 index 83bef6ec7f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/common/MESOWestRecord.java +++ /dev/null @@ -1,772 +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.edex.plugin.mesowest.common; - -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; - -import javax.measure.quantity.Angle; -import javax.measure.quantity.Length; -import javax.measure.quantity.Pressure; -import javax.measure.quantity.Temperature; -import javax.measure.quantity.Velocity; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; -import javax.measure.unit.Unit; -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.Column; -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; - -import com.raytheon.uf.common.dataplugin.IDecoderGettable; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.geospatial.ISpatialEnabled; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.vividsolutions.jts.geom.Geometry; - -/** - * Record for mesowest data - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 03, 2009            jkorman     Initial creation
- * Apr 12, 2013 1857       bgonzale    Added SequenceGenerator annotation.
- * May 07, 2013 1869       bsteffen    Remove dataURI column from
- *                                     PluginDataObject.
- * Aug 30, 2013 2298       rjpeter     Make getPluginName abstract
- * Oct 22, 2013 2361       njensen     Remove XML annotations
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ -@Entity -@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "mesowestseq") -@Table(name = "mesowest", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) -@DynamicSerialize -public class MESOWestRecord extends PluginDataObject implements - ISpatialEnabled, IDecoderGettable { - - private static final long serialVersionUID = 1L; - - public static final String OBS_TEXT = "text"; - - public static final Unit LENGTH_UNIT = SI.METER; - - public static final Unit TEMPERATURE_UNIT = SI.KELVIN; - - public static final Unit WIND_SPEED_UNIT = SI.METERS_PER_SECOND; - - public static final Unit WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; - - public static final Unit PRESSURE_UNIT = SI.PASCAL; - - public static final Unit LOCATION_UNIT = NonSI.DEGREE_ANGLE; - - private static final HashMap PARM_MAP = new HashMap(); - static { - PARM_MAP.put("T", SFC_TEMP); - PARM_MAP.put("DpT", SFC_DWPT); - PARM_MAP.put("WS", SFC_WNDSPD); - PARM_MAP.put("WD", SFC_WNDDIR); - PARM_MAP.put("WGS", SFC_WNDGST); - PARM_MAP.put("ASET", "SFC.PRESS.ALTIMETER"); - PARM_MAP.put("PMSL", PRES_SLP); - PARM_MAP.put("NLAT", STA_LAT); - PARM_MAP.put("NLON", STA_LON); - PARM_MAP.put("STA", "STA"); - PARM_MAP.put("stationid", "STA"); - PARM_MAP.put("message", OBS_TEXT); - PARM_MAP.put(OBS_TEXT, OBS_TEXT); - } - - @DataURI(position = 1) - @DynamicSerializeElement - private String networkType; - - // Time of the observation. - @DataURI(position = 2) - @DynamicSerializeElement - private Calendar timeObs; - - @Embedded - @DataURI(position = 3, embedded = true) - @DynamicSerializeElement - private SurfaceObsLocation location; - - // Observation air temperature in degrees Kelvin. - @Column - @DynamicSerializeElement - private Double temp; - - // Observation dewpoint temperature in degrees Kelvin. - @Column - @DynamicSerializeElement - private Double dwpt; - - // 24 Hour maximum temperature in degrees Kelvin. - @Column - @DynamicSerializeElement - private Double maxT24; - - // 24 Hour minimum temperature in degrees Kelvin. - @Column - @DynamicSerializeElement - private Double minT24; - - // Relative Humidity in percent. - @Column - @DynamicSerializeElement - private Double humidity; - - // Observation wind direction in angular degrees. Integer - @Column - @DynamicSerializeElement - private Double windDirection; - - // Observation wind speed in meters per second. - @Column - @DynamicSerializeElement - private Double windSpeed; - - // Observation wind gust in meters per second. - @Column - @DynamicSerializeElement - private Double windGust; - - // Observation pressure in Pa. - @Column - @DynamicSerializeElement - private Double pressure; - - // Observation pressure in Pa. - @Column - @DynamicSerializeElement - private Double seaLevelPressure; - - // Observation pressure in Pa. - @Column - @DynamicSerializeElement - private Double altimeter; - - // Observation precip in mm. - @Column - @DynamicSerializeElement - private Double precip; - - // 1 minute precip in inches. - @Column - @DynamicSerializeElement - private Double precip_01M; - - // 5 minute precip in inches. - @Column - @DynamicSerializeElement - private Double precip_05M; - - // 10 minute precip in inches. - @Column - @DynamicSerializeElement - private Double precip_10M; - - // 15 minute precip in inches. - @Column - @DynamicSerializeElement - private Double precip_15M; - - // 30 minute precip in inches. - @Column - @DynamicSerializeElement - private Double precip_30M; - - // 1 hour precip in inches. - @Column - @DynamicSerializeElement - private Double precip_01H; - - // 3 hour precip in inches. - @Column - @DynamicSerializeElement - private Double precip_03H; - - // 6 hour precip in inches. - @Column - @DynamicSerializeElement - private Double precip_06H; - - // 24 hour precip in inches. - @Column - @DynamicSerializeElement - private Double precip_24H; - - // Raw observation text - @Column - @DynamicSerializeElement - private String obsText; - - /** - * - */ - public MESOWestRecord() { - } - - /** - * Constructor for DataURI construction through base class. This is used by - * the notification service. - * - * @param uri - * A data uri applicable to this class. - */ - public MESOWestRecord(String uri) { - super(uri); - } - - /** - * Get this observation's geometry. - * - * @return The geometry for this observation. - */ - public Geometry getGeometry() { - return location.getGeometry(); - } - - /** - * Get the geometry latitude. - * - * @return The geometry latitude. - */ - public double getLatitude() { - return location.getLatitude(); - } - - /** - * Get the geometry longitude. - * - * @return The geometry longitude. - */ - public double getLongitude() { - return location.getLongitude(); - } - - /** - * Get the station identifier for this observation. - * - * @return the stationId - */ - public String getStationId() { - return location.getStationId(); - } - - /** - * Get the elevation, in meters, of the observing platform or location. - * - * @return The observation elevation, in meters. - */ - public Integer getElevation() { - return location.getElevation(); - } - - /** - * @return the location - */ - public SurfaceObsLocation getLocation() { - return location; - } - - /** - * @param location - * the location to set - */ - public void setLocation(SurfaceObsLocation location) { - this.location = location; - } - - /** - * - * @return - */ - public String getNetworkType() { - return networkType; - } - - /** - * - * @return - */ - public void setNetworkType(String type) { - networkType = type; - } - - /** - * @return the timeObs - */ - public Calendar getTimeObs() { - return timeObs; - } - - /** - * @param timeObs - * the timeObs to set - */ - public void setTimeObs(Calendar timeObs) { - this.timeObs = timeObs; - } - - // ****************************************** - - /** - * @return the temp - */ - public Double getTemp() { - return temp; - } - - /** - * @param temp - * the temp to set - */ - public void setTemp(Double temp) { - this.temp = temp; - } - - /** - * @return the dwpt - */ - public Double getDwpt() { - return dwpt; - } - - /** - * @param dwpt - * the dwpt to set - */ - public void setDwpt(Double dwpt) { - this.dwpt = dwpt; - } - - /** - * @return the maxT24 - */ - public Double getMaxT24() { - return maxT24; - } - - /** - * @param maxT24 - * the maxT24 to set - */ - public void setMaxT24(Double maxT24) { - this.maxT24 = maxT24; - } - - /** - * @return the minT24 - */ - public Double getMinT24() { - return minT24; - } - - /** - * @param minT24 - * the minT24 to set - */ - public void setMinT24(Double minT24) { - this.minT24 = minT24; - } - - /** - * @return the humidity - */ - public Double getHumidity() { - return humidity; - } - - /** - * @param humidity - * the humidity to set - */ - public void setHumidity(Double humidity) { - this.humidity = humidity; - } - - /** - * @return the windDirection - */ - public Double getWindDirection() { - return windDirection; - } - - /** - * @param windDirection - * the windDirection to set - */ - public void setWindDirection(Double windDirection) { - this.windDirection = windDirection; - } - - /** - * @return the windSpeed - */ - public Double getWindSpeed() { - return windSpeed; - } - - /** - * @param windSpeed - * the windSpeed to set - */ - public void setWindSpeed(Double windSpeed) { - this.windSpeed = windSpeed; - } - - /** - * @return the windGust - */ - public Double getWindGust() { - return windGust; - } - - /** - * @param windGust - * the windGust to set - */ - public void setWindGust(Double windGust) { - this.windGust = windGust; - } - - /** - * @return the pressure - */ - public Double getPressure() { - return pressure; - } - - /** - * @param pressure - * the pressure to set - */ - public void setPressure(Double pressure) { - this.pressure = pressure; - } - - /** - * @return the seaLevelPressure - */ - public Double getSeaLevelPressure() { - return seaLevelPressure; - } - - /** - * @param seaLevelPressure - * the seaLevelPressure to set - */ - public void setSeaLevelPressure(Double seaLevelPressure) { - this.seaLevelPressure = seaLevelPressure; - } - - /** - * @return the altimeter - */ - public Double getAltimeter() { - return altimeter; - } - - /** - * @param altimeter - * the altimeter to set - */ - public void setAltimeter(Double altimeter) { - this.altimeter = altimeter; - } - - /** - * @return the precip - */ - public Double getPrecip() { - return precip; - } - - /** - * @param precip - * the precip to set - */ - public void setPrecip(Double precip) { - this.precip = precip; - } - - /** - * @return the precip_01M - */ - public Double getPrecip_01M() { - return precip_01M; - } - - /** - * @param precip_01M - * the precip_01M to set - */ - public void setPrecip_01M(Double precip_01M) { - this.precip_01M = precip_01M; - } - - /** - * @return the precip_05M - */ - public Double getPrecip_05M() { - return precip_05M; - } - - /** - * @param precip_05M - * the precip_05M to set - */ - public void setPrecip_05M(Double precip_05M) { - this.precip_05M = precip_05M; - } - - /** - * @return the precip_10M - */ - public Double getPrecip_10M() { - return precip_10M; - } - - /** - * @param precip_10M - * the precip_10M to set - */ - public void setPrecip_10M(Double precip_10M) { - this.precip_10M = precip_10M; - } - - /** - * @return the precip_15M - */ - public Double getPrecip_15M() { - return precip_15M; - } - - /** - * @param precip_15M - * the precip_15M to set - */ - public void setPrecip_15M(Double precip_15M) { - this.precip_15M = precip_15M; - } - - /** - * @return the precip_30M - */ - public Double getPrecip_30M() { - return precip_30M; - } - - /** - * @param precip_30M - * the precip_30M to set - */ - public void setPrecip_30M(Double precip_30M) { - this.precip_30M = precip_30M; - } - - /** - * @return the precip_01H - */ - public Double getPrecip_01H() { - return precip_01H; - } - - /** - * @param precip_01H - * the precip_01H to set - */ - public void setPrecip_01H(Double precip_01H) { - this.precip_01H = precip_01H; - } - - /** - * @return the precip_03H - */ - public Double getPrecip_03H() { - return precip_03H; - } - - /** - * @param precip_03H - * the precip_03H to set - */ - public void setPrecip_03H(Double precip_03H) { - this.precip_03H = precip_03H; - } - - /** - * @return the precip_06H - */ - public Double getPrecip_06H() { - return precip_06H; - } - - /** - * @param precip_06H - * the precip_06H to set - */ - public void setPrecip_06H(Double precip_06H) { - this.precip_06H = precip_06H; - } - - /** - * @return the precip_24H - */ - public Double getPrecip_24H() { - return precip_24H; - } - - /** - * @param precip_24H - * the precip_24H to set - */ - public void setPrecip_24H(Double precip_24H) { - this.precip_24H = precip_24H; - } - - /** - * @return the obsText - */ - public String getObsText() { - return obsText; - } - - /** - * @param obsText - * the obsText to set - */ - public void setObsText(String obsText) { - this.obsText = obsText; - } - - // ****************************************** - - /** - * - */ - public void setSpatialObject(SurfaceObsLocation loc) { - location = loc; - } - - /** - * - */ - @Override - public SurfaceObsLocation getSpatialObject() { - return location; - } - - /** - * This class implements IDecoderGettable so return this instance. - * - * @return The reference to this instance. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - - /** - * - */ - @Override - public String getString(String paramName) { - String retValue = null; - String pName = PARM_MAP.get(paramName); - if ("STA".matches(pName)) { - retValue = getStationId(); - } else if (OBS_TEXT.equals(pName)) { - retValue = getStationId(); - } - - return retValue; - } - - @Override - public String[] getStrings(String paramName) { - return null; - } - - @Override - public Amount getValue(String paramName) { - Amount a = null; - String pName = PARM_MAP.get(paramName); - - if (SFC_TEMP.equals(pName)) { - a = new Amount(temp, TEMPERATURE_UNIT); - } else if (SFC_DWPT.equals(pName)) { - a = new Amount(dwpt, TEMPERATURE_UNIT); - } else if (SFC_WNDSPD.equals(pName)) { - a = new Amount(windSpeed, WIND_SPEED_UNIT); - } else if (SFC_WNDGST.equals(pName)) { - a = new Amount(windGust, WIND_SPEED_UNIT); - } else if (SFC_WNDDIR.equals(pName)) { - a = new Amount(windDirection, WIND_DIR_UNIT); - } else if (PRES_ALTSG.equals(pName)) { - a = new Amount(altimeter, PRESSURE_UNIT); - } else if (STA_LAT.equals(pName)) { - a = new Amount(getLatitude(), LOCATION_UNIT); - } else if (STA_LON.equals(pName)) { - a = new Amount(getLongitude(), LOCATION_UNIT); - } else if (PRES_SLP.equals(pName)) { - a = new Amount(seaLevelPressure, PRESSURE_UNIT); - } - - return a; - } - - /** - * - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - @Override - @Column - @Access(AccessType.PROPERTY) - public String getDataURI() { - return super.getDataURI(); - } - - @Override - public String getPluginName() { - return "mesowest"; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/dao/MESOWestDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/dao/MESOWestDao.java deleted file mode 100644 index c9a23f3824..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/dao/MESOWestDao.java +++ /dev/null @@ -1,77 +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.edex.plugin.mesowest.dao; - -import java.util.List; - -import com.raytheon.edex.db.dao.DefaultPluginDao; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.edex.database.DataAccessLayerException; -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 9, 2009        1939 jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MESOWestDao extends DefaultPluginDao { - - - /** - * Creates a new ReccoDao - * @throws PluginException - */ - public MESOWestDao(String pluginName) throws PluginException { - super(pluginName); - } - - /** - * Retrieves an bufrua report using the datauri . - * - * @param dataURI - * The dataURI to match against. - * @return The report record if it exists. - */ - public MESOWestRecord queryByDataURI(String dataURI) { - MESOWestRecord report = null; - List obs = null; - try { - obs = queryBySingleCriteria("dataURI", dataURI); - } catch (DataAccessLayerException e) { - e.printStackTrace(); - } - if((obs != null)&&(obs.size() > 0)) { - report = (MESOWestRecord) obs.get(0); - } - return report; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestConstants.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestConstants.java deleted file mode 100644 index 0de41611d8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestConstants.java +++ /dev/null @@ -1,164 +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.edex.plugin.mesowest.decoder; - -import java.util.HashMap; -import java.util.Map; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 10, 2009            jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MESOWestConstants { - - public static final String LAST_DATA_ITEM = "##### LAST DATA ITEM #####"; - - public static final String TRACEID = "traceId"; - - public static final String K_DATATYPE = "datatype"; - - public static final String T_PARMHEADER = "parmheader"; - - public static final String T_REPORTDATA = "report"; - - public static final String T_LASTITEM = LAST_DATA_ITEM; - - public static final String D_PARMLEADER = "PARM ="; - - public static final String D_PARM_DELIMIT = ";"; - - public static final String P_STNID = "STNID"; - - public static final String P_LAT = "latitude"; - - public static final String P_LON = "longitude"; - - public static final String P_ELEV = "ELEV"; - - public static final String P_STNTYPE = "STNTYPE"; - - public static final String P_DATATIME = "DATETIME"; - - //******************************************* - - public static final String P_SFCTEMP = "TMPF"; - - public static final String P_SFCDWPT = "DWPF"; - //************************ - - public static final String P_MIN_T_24H = "LO24"; - - public static final String P_MAX_T_24H = "HI24"; - - //************************ - public static final String P_WINDSPD = "SKNT"; - - public static final String P_WINDDIR = "DRCT"; - - public static final String P_WINDGST = "GUST"; - - public static final String P_HUMIDITY = "RELH"; - - public static final String P_PRESSURE = "PRES"; - - public static final String P_ALTIMETER = "ALTI"; - - public static final String P_SEA_LVL_PRES = "PMSL"; - - //************************ - public static final String P_PRECIP_01M = "P1MI"; - - public static final String P_PRECIP_05M = "P05I"; - - public static final String P_PRECIP_10M = "P10I"; - - public static final String P_PRECIP_15M = "P15I"; - - public static final String P_PRECIP_30M = "P30I"; - - public static final String P_PRECIP_01H = "P01I"; - - public static final String P_PRECIP_03H = "P03I"; - - public static final String P_PRECIP_06H = "P06I"; - - public static final String P_PRECIP_24H = "P24I"; - - private static int PARM_POS = 0; - private static Map parmMap = new HashMap(); - static { - parmMap.put(PARM_POS++,P_STNID); - parmMap.put(PARM_POS++,P_LAT); - parmMap.put(PARM_POS++,P_LON); - parmMap.put(PARM_POS++,P_ELEV); - parmMap.put(PARM_POS++,P_STNTYPE); - parmMap.put(PARM_POS++,P_DATATIME); - } - - // YYYYMMDD/HHMM - // 20090303/1950 - - public static final String D_DATEFMT = "yyyyMMdd/HHmm"; - - - /** - * - * @return - */ - public static int getParmPos() { - return PARM_POS; - } - - /** - * - * @return - */ - public static Map getParmMap() { - Map map = new HashMap(); - map.putAll(parmMap); - - return map; - } - - /** - * - * @return - */ - public static Map getValuesMap() { - Map values = new HashMap(); - for(String s : parmMap.values()) { - values.put(s, new MESOWestElement(s)); - } - return values; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestElement.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestElement.java deleted file mode 100644 index 8ed23581c9..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestElement.java +++ /dev/null @@ -1,91 +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.edex.plugin.mesowest.decoder; - -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 10, 2009            jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MESOWestElement { - - private final String elementName; - - private String elementValue = null; - - public MESOWestElement(String name) { - elementName = name; - } - - /** - * - * @return - */ - public String getElementName() { - return elementName; - } - - /** - * - * @return - */ - public String getElementValue() { - return elementValue; - } - - /** - * - * @param value - */ - public void setElementValue(String value) { - elementValue = value; - } - - /** - * - * @param record - * @return - */ - public MESOWestRecord getDecodedData(MESOWestRecord record) { - - return record; - } - - - @Override - public String toString() { - return elementValue; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestParser.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestParser.java deleted file mode 100644 index d51993815f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MESOWestParser.java +++ /dev/null @@ -1,345 +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.edex.plugin.mesowest.decoder; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; -import com.raytheon.uf.edex.decodertools.time.TimeTools; -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 10, 2009            jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MESOWestParser { - - private Log logger = LogFactory.getLog(getClass()); - - private Map paramMap = null; - - private Map valuesMap = null; - - private SimpleDateFormat dateFormat = new SimpleDateFormat( - MESOWestConstants.D_DATEFMT); - - /** - * - * @param parameters - */ - public MESOWestParser(String parameters) { - - paramMap = MESOWestConstants.getParmMap(); - valuesMap = MESOWestConstants.getValuesMap(); - parameters = parameters.trim(); - if (parameters.startsWith(MESOWestConstants.D_PARMLEADER)) { - - parameters = parameters.substring( - MESOWestConstants.D_PARMLEADER.length()).trim(); - - String[] parms = parameters.split(MESOWestConstants.D_PARM_DELIMIT, - -1); - - int index = MESOWestConstants.getParmPos(); - for (String s : parms) { - paramMap.put(index, s); - valuesMap.put(s, new MESOWestElement(s)); - - index++; - } - } - } - - /** - * - * @param report - * @return - */ - public MESOWestRecord decode(String report) { - // Clear out the old data! - clearValueMap(); - String[] parts = report.split(",", -1); - - if ((parts != null) && (parts.length > 5)) { - int index = 0; - for (String s : parts) { - String elementName = paramMap.get(index++); - - MESOWestElement element = valuesMap.get(elementName); - if (element != null) { - element.setElementValue(s); - } - } - } - - return getDecodedData(); - } - - /** - * - * @return - */ - private MESOWestRecord getDecodedData() { - - MESOWestRecord record = getLocationInfo(new MESOWestRecord()); - if (record != null) { - // Now go get specific data elements - Double val = getFloatValue(MESOWestConstants.P_SFCTEMP); - val = DecoderTools.fahrenheitToCelsius(val); - record.setTemp(DecoderTools.celsiusToKelvin(val)); - - val = getFloatValue(MESOWestConstants.P_SFCDWPT); - val = DecoderTools.fahrenheitToCelsius(val); - record.setDwpt(DecoderTools.celsiusToKelvin(val)); - - val = getFloatValue(MESOWestConstants.P_MAX_T_24H); - val = DecoderTools.fahrenheitToCelsius(val); - record.setMaxT24(DecoderTools.celsiusToKelvin(val)); - - val = getFloatValue(MESOWestConstants.P_MIN_T_24H); - val = DecoderTools.fahrenheitToCelsius(val); - record.setMinT24(DecoderTools.celsiusToKelvin(val)); - - record.setHumidity(getFloatValue(MESOWestConstants.P_HUMIDITY)); - - val = getFloatValue(MESOWestConstants.P_WINDSPD); - record.setWindSpeed(DecoderTools.ktsToMSec(val)); - - val = getFloatValue(MESOWestConstants.P_WINDGST); - record.setWindGust(DecoderTools.ktsToMSec(val)); - - record.setWindDirection(getFloatValue(MESOWestConstants.P_WINDDIR)); - - val = getFloatValue(MESOWestConstants.P_PRESSURE); - record.setPressure(DecoderTools.hPaToPa(val)); - - val = getFloatValue(MESOWestConstants.P_ALTIMETER); - record.setAltimeter(DecoderTools.inToPa(val)); - - val = getFloatValue(MESOWestConstants.P_SEA_LVL_PRES); - record.setSeaLevelPressure(DecoderTools.hPaToPa(val)); - - - record.setPrecip_01M(getFloatValue(MESOWestConstants.P_PRECIP_01M)); - record.setPrecip_05M(getFloatValue(MESOWestConstants.P_PRECIP_05M)); - record.setPrecip_10M(getFloatValue(MESOWestConstants.P_PRECIP_10M)); - record.setPrecip_15M(getFloatValue(MESOWestConstants.P_PRECIP_15M)); - record.setPrecip_30M(getFloatValue(MESOWestConstants.P_PRECIP_30M)); - record.setPrecip_01H(getFloatValue(MESOWestConstants.P_PRECIP_01H)); - record.setPrecip_03H(getFloatValue(MESOWestConstants.P_PRECIP_03H)); - record.setPrecip_06H(getFloatValue(MESOWestConstants.P_PRECIP_06H)); - record.setPrecip_24H(getFloatValue(MESOWestConstants.P_PRECIP_24H)); - } - return record; - } - - /** - * Clear the parsed values from each element prior to accepting new data. - */ - private void clearValueMap() { - for (MESOWestElement element : valuesMap.values()) { - element.setElementValue(null); - } - } - - /** - * - * @param data - * @return - */ - private MESOWestRecord getLocationInfo(MESOWestRecord data) { - - Calendar obsTime = null; - - MESOWestElement m = valuesMap.get(MESOWestConstants.P_DATATIME); - if (m != null) { - String s = m.getElementValue(); - if (s != null) { - try { - Date d = dateFormat.parse(s); - if (d != null) { - Calendar c = TimeTools.newCalendar(d.getTime()); - if (c != null) { - obsTime = TimeTools.copy(c); - data.setTimeObs(obsTime); - - DataTime t = new DataTime(TimeTools.copy(obsTime)); - data.setDataTime(t); - } - } - } catch (ParseException e) { - logger.error("Invalid date [" + s + "]"); - } - } - } else { - logger.error("Date missing"); - data = null; - } - - if (obsTime != null) { - - Double lat = getFloatValue(MESOWestConstants.P_LAT); - Double lon = getFloatValue(MESOWestConstants.P_LON); - Integer elev = getIntValue(MESOWestConstants.P_ELEV); - - if ((lat != null) && (lon != null) && (elev != null)) { - SurfaceObsLocation location = new SurfaceObsLocation(); - location.assignLocation(lat, lon); - location.setElevation(elev); - - String stnId = getStringValue(MESOWestConstants.P_STNID); - if (stnId != null) { - location.setStationId(stnId); - - data.setSpatialObject(location); - data.setNetworkType(getStringValue(MESOWestConstants.P_STNTYPE)); - } else { - data = null; - logger.error("Station Id missing"); - } - } else { - data = null; - logger.error("Spatial information missing"); - } - } - - return data; - } - - /** - * - * @param value - * @return - */ - private String getStringValue(String key) { - String sValue = null; - - MESOWestElement value = valuesMap.get(key); - if (value != null) { - sValue = value.getElementValue(); - } - return sValue; - } - - /** - * - * @param value - * @return - */ - private Double getFloatValue(String key) { - Double floatValue = null; - - MESOWestElement value = valuesMap.get(key); - if (value != null) { - try { - floatValue = Double.parseDouble(value.getElementValue()); - } catch (NumberFormatException nfe) { - - } - } - return floatValue; - } - - /** - * - * @param value - * @return - */ - private Integer getIntValue(String key) { - Integer intValue = null; - - MESOWestElement value = valuesMap.get(key); - if (value != null) { - try { - intValue = Integer.parseInt(value.getElementValue()); - } catch (NumberFormatException nfe) { - - } - } - return intValue; - } - - public static final void main(String[] args) { - - String parms = " PARM = TMPF;RELH;SKNT;GUST;DRCT;QFLG;DWPF;PRES;PMSL;ALTI;P03D;SOLR;WNUM;VSBY;CHC1;CHC2;CHC3;CIG;TLKE;FT;FM;HI6;LO6;PEAK;HI24;LO24;PREC;P01I;P03I;P06I;P24I;P05I;P10I;P15I;SNOW;PACM;SACM;WEQS;P30I;PWVP;TSOI;MSOI;STEN;TSRD;EVAP;TRD1;TRD2;TRD3;TRD4;TFZ1;TFZ2;TFZ3;TFZ4;RSS1;RSS2;RSS3;RSS4"; - - String data1 = "KAAT,41.49139,-120.56444,4373,1,20090303/2009,32,92.96,18,27,230,2,30.2,,,29.81,,,740,0.5,36,73,194,700,,,,,,27,,,,0.01,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"; - - String data2 = "KRSP,,,,1,20090312/1254,28.94,53.05,7,19,340,,14,,1031.2,30.39,,,,10,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"; - MESOWestParser parser = new MESOWestParser(parms); - - MESOWestRecord record = parser.decode(data2); - - System.out.println("******************************"); - if (record != null) { - Calendar c = record.getTimeObs(); - if (c != null) { - System.out.println(String.format( - "* time | %1$tY%1$tm%1$td%1$tH%1$tM", record - .getTimeObs())); - } else { - System.out.println("* time | null"); - } - System.out.println("* latitude | " + record.getLatitude()); - System.out.println("* longitude | " + record.getLongitude()); - System.out.println("* station id | " + record.getStationId()); - System.out.println("* network | " + record.getNetworkType()); - - System.out.println("*************"); - System.out.println("* temperature = " + record.getTemp()); - System.out.println("* dewpoint = " + record.getDwpt()); - System.out.println("* humidity % = " + record.getHumidity()); - System.out.println("* wind speed = " + record.getWindSpeed()); - System.out.println("* wind gust = " + record.getWindGust()); - System.out.println("* wind direction = " - + record.getWindDirection()); - System.out.println("* pressure = " + record.getPressure()); - System.out.println("* slp = " - + record.getSeaLevelPressure()); - System.out.println("* altimeter = " + record.getAltimeter()); - } else { - System.out.println("* No data decoded"); - System.out.println("*************"); - System.out.println("******************************"); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWFloatElement.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWFloatElement.java deleted file mode 100644 index b306675e23..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWFloatElement.java +++ /dev/null @@ -1,76 +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.edex.plugin.mesowest.decoder; - -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 10, 2009            jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MWFloatElement extends MESOWestElement { - - private Double floatValue = null; - - public MWFloatElement(String name) { - super(name); - } - - /** - * - * @param value - */ - @Override - public void setElementValue(String value) { - super.setElementValue(value); - - try { - floatValue = Double.parseDouble(value); - } catch(NumberFormatException nfe) { - - } - } - - /** - * - * @param record - * @return - */ - @Override - public MESOWestRecord getDecodedData(MESOWestRecord record) { - - - - return record; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWIntElement.java b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWIntElement.java deleted file mode 100644 index a795db47dc..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/src/com/raytheon/uf/edex/plugin/mesowest/decoder/MWIntElement.java +++ /dev/null @@ -1,109 +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.edex.plugin.mesowest.decoder; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 10, 2009            jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class MWIntElement extends MESOWestElement { - - private Integer intValue = null; - - public MWIntElement(String name) { - super(name); - } - - /** - * - * @param value - */ - @Override - public void setElementValue(String value) { - super.setElementValue(value); - - try { - intValue = Integer.parseInt(value); - } catch(NumberFormatException nfe) { - - } - } - - /** - * - * @param record - * @return - */ - @Override - public MESOWestRecord getDecodedData(MESOWestRecord record) { - - StringBuilder sb = new StringBuilder(getElementName()); - sb.setCharAt(0,Character.toUpperCase(sb.charAt(0))); - sb.insert(0,"get"); - - String methodName = sb.toString(); - Method m = null; - - try { - m = record.getClass().getDeclaredMethod(methodName, Integer.class); - if(m != null) { - - try { - m.invoke(record, intValue); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return record; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/utility/common_static/base/mesowest/MesowestParmTable.txt b/edexOsgi/com.raytheon.uf.edex.plugin.mesowest/utility/common_static/base/mesowest/MesowestParmTable.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.classpath b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.project b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.project deleted file mode 100644 index 67f0a9ae82..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.plugin.unitconverter - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index e2978d4662..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu May 09 11:58:40 CDT 2013 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/META-INF/MANIFEST.MF deleted file mode 100644 index 3e753930ef..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Unitconverter -Bundle-SymbolicName: com.raytheon.uf.edex.plugin.unitconverter -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: ucar.nc2;bundle-version="1.0.0", - javax.measure;bundle-version="1.0.0", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", - com.raytheon.uf.common.status;bundle-version="1.12.1174" -Export-Package: com.raytheon.uf.edex.plugin.unitconverter diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/build.properties b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/build.properties deleted file mode 100644 index 34d2e4d2da..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/src/com/raytheon/uf/edex/plugin/unitconverter/UnitLookup.java b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/src/com/raytheon/uf/edex/plugin/unitconverter/UnitLookup.java deleted file mode 100644 index f4926adbf8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/src/com/raytheon/uf/edex/plugin/unitconverter/UnitLookup.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.plugin.unitconverter; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.text.ParseException; -import java.util.HashMap; -import java.util.Map; - -import javax.measure.unit.UnitFormat; - -import ucar.units.NoSuchUnitException; -import ucar.units.PrefixDBException; -import ucar.units.SpecificationException; -import ucar.units.UnitDBException; -import ucar.units.UnitFormatManager; -import ucar.units.UnitParseException; -import ucar.units.UnitSystemException; - -import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -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.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 9, 2013            ekladstrup     Initial creation
- * 
- * 
- * - * @author ekladstrup - * @version 1.0 - */ - -public class UnitLookup { - - private final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - protected static UnitLookup instance = null; - - protected Map, ucar.units.Unit> jsrToUcarMap = new HashMap, ucar.units.Unit>(); - - protected Map> ucarToJsrMap = new HashMap>(); - - protected UnitLookup() { - init(); - } - - protected void init() { - IPathManager pm = PathManagerFactory.getPathManager(); - - LocalizationContext[] searchHierarchy = pm - .getLocalSearchHierarchy(LocalizationType.EDEX_STATIC); - - LocalizationFile unitFile = null; - - for (LocalizationContext ctx : searchHierarchy) { - LocalizationFile localizationFile = pm.getLocalizationFile(ctx, - "wxsrv" + IPathManager.SEPARATOR + "units" - + IPathManager.SEPARATOR + "unitMapping.tsv"); - - if (localizationFile.exists() && unitFile == null) { - unitFile = localizationFile; - } - } - - File file = unitFile.getFile(); - - BufferedReader reader = null; - - try { - if (file.exists() && file.canRead()) { - reader = new BufferedReader(new FileReader(file)); - - String line = reader.readLine(); - - while (line != null) { - if (!line.startsWith("#") && !line.trim().isEmpty()) { - String[] unitStrings = line.split("\t"); - String jsrUnitString = unitStrings[0]; - String udunitString = unitStrings[1]; - - try { - if (jsrUnitString != null - && !jsrUnitString.isEmpty() - && udunitString != null - && !udunitString.isEmpty()) { - javax.measure.unit.Unit jsrUnit = (javax.measure.unit.Unit) UnitFormat - .getUCUMInstance().parseObject( - jsrUnitString); - ucar.units.Unit udunit = UnitFormatManager - .instance().parse(udunitString); - - jsrToUcarMap.put(jsrUnit, udunit); - ucarToJsrMap.put(udunit, jsrUnit); - } - } catch (ParseException e) { - log.warn("Unable to parse javax unit string \"" - + jsrUnitString + "\""); - } catch (NoSuchUnitException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } catch (UnitParseException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } catch (SpecificationException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } catch (UnitDBException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } catch (PrefixDBException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } catch (UnitSystemException e) { - log.warn("Unable to parse ucar unit string \"" - + udunitString + "\""); - } - } - line = reader.readLine(); - } - } else { - log.error("Unable to open unit mapping file " - + file.getAbsolutePath()); - } - } catch (FileNotFoundException e1) { - // file not found even after file.exists() check - log.error( - "unit mapping file not found at " + file.getAbsolutePath(), - e1); - } catch (IOException e1) { - // failed to read file even after file.canRead() check - log.error( - "Unable to read unit mapping file " - + file.getAbsolutePath(), e1); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (Exception e) { - } - } - } - } - - public static UnitLookup getInstance() { - if (instance == null) { - synchronized (UnitLookup.class) { - if (instance == null) { - instance = new UnitLookup(); - } - } - } - - return instance; - } - - /** - * From a ucar unit return the jsr unit, or null if not found - * - * @param ucarUnit - * @return a jsr unit or null if not found - */ - public javax.measure.unit.Unit getJsrFromUcar(ucar.units.Unit ucarUnit) { - return ucarToJsrMap.get(ucarUnit); - } - - /** - * From a jsr unit return the ucar unit or null if not found - * - * @param jsrUnit - * @return - */ - public ucar.units.Unit getUcarFromJsr(javax.measure.unit.Unit jsrUnit) { - return jsrToUcarMap.get(jsrUnit); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/utility/edex_static/base/wxsrv/units/unitMapping.tsv b/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/utility/edex_static/base/wxsrv/units/unitMapping.tsv deleted file mode 100644 index e9363696b3..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.unitconverter/utility/edex_static/base/wxsrv/units/unitMapping.tsv +++ /dev/null @@ -1,16 +0,0 @@ -# jsr ucar -#tab separated -Pa*s^-1 kg.m-1.s-3 -mm*s^-1 0.0010 m.s-1 -mm 0.0010 m -Pa Pa -s^-1 s-1 -m m -K K -K*s^-1 K.s-1 -m*s^-1 m.s-1 -degree_angle 0.017453292519943295 rad -s s -J*kg^-1 m2.s-2 -% 0.01 -kg*m^-2 kg.m-2 diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/.classpath b/edexOsgi/com.raytheon.uf.edex.wcs/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/.project b/edexOsgi/com.raytheon.uf.edex.wcs/.project deleted file mode 100644 index 1c4fe9c1a5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.wcs - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.wcs/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index afcbd70733..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 16 10:57:42 CST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/MANIFEST.MF deleted file mode 100644 index 9d3faebf25..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/MANIFEST.MF +++ /dev/null @@ -1,36 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wcs -Bundle-SymbolicName: com.raytheon.uf.edex.wcs -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.uf.edex.ogc.common;bundle-version="1.0.0", - net.opengis;bundle-version="1.0.2", - org.geotools;bundle-version="2.6.4", - com.raytheon.edex.common;bundle-version="1.12.1174", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", - javax.measure;bundle-version="1.0.0", - org.apache.commons.codec;bundle-version="1.4.0", - org.apache.commons.pool;bundle-version="1.3.0", - ogc.tools.gml;bundle-version="1.0.2", - org.apache.commons.lang;bundle-version="2.3.0", - org.apache.camel;bundle-version="1.0.0", - org.apache.commons.cxf;bundle-version="1.0.0", - javax.persistence;bundle-version="1.0.0", - com.raytheon.uf.common.nc4;bundle-version="1.0.0", - com.raytheon.uf.edex.plugin.dataset.urn;bundle-version="1.0.0", - ucar.nc2;bundle-version="1.0.0", - org.apache.commons.collections;bundle-version="3.2.0", - com.raytheon.uf.edex.plugin.unitconverter;bundle-version="1.0.0", - com.raytheon.uf.common.spatial;bundle-version="1.0.0", - org.eclipse.jetty;bundle-version="7.6.9", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.edex.log;bundle-version="1.12.1174" -Export-Package: com.raytheon.uf.edex.wcs, - com.raytheon.uf.edex.wcs.format, - com.raytheon.uf.edex.wcs.provider, - com.raytheon.uf.edex.wcs.querystore, - com.raytheon.uf.edex.wcs.reg, - com.raytheon.uf.edex.wcs.request, - com.raytheon.uf.edex.wcs.soap1_1_2 diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/wsdl/wcs.wsdl b/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/wsdl/wcs.wsdl deleted file mode 100644 index c412c5ea99..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/META-INF/wsdl/wcs.wsdl +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/build.properties b/edexOsgi/com.raytheon.uf.edex.wcs/build.properties deleted file mode 100644 index e016089273..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -source.. = src/ -bin.includes = .project,\ - .classpath,\ - META-INF/,\ - build.properties,\ - .settings/,\ - .,\ - res/ diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/com.raytheon.uf.edex.wcs.ecl b/edexOsgi/com.raytheon.uf.edex.wcs/com.raytheon.uf.edex.wcs.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/ingest.uml b/edexOsgi/com.raytheon.uf.edex.wcs/ingest.uml deleted file mode 100644 index 228dace649..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/ingest.uml +++ /dev/null @@ -1,19 +0,0 @@ -@startuml - -node "EDEX Data Plug-in Adapter" { - () "Ingest Endpoint" as ingest - [Plug-in Data Decoder] as decoder - [Plug-in Layer Metadata Collector] as collector -} - -database "PostgreSQL" { - frame "MetaData" { - [Layer Metadata] as layer - } -} - -ingest -> decoder -decoder -> collector -collector -> layer - -@enduml \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/request.uml b/edexOsgi/com.raytheon.uf.edex.wcs/request.uml deleted file mode 100644 index 4c5305e41e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/request.uml +++ /dev/null @@ -1,42 +0,0 @@ -@startuml - -package "EDEX WCS Component" { - [WCS HTTP Endpoint] as wcshttp - [WCS SOAP Endpoint] as wcssoap - () "HTTP/REST/JETTY" -- wcshttp - () "HTTP/SOAP/CXF" -- wcssoap - - [WCS 1.1.2 Provider] as wcs112 - - () "WCS Source" as isrc -} - -node "EDEX Data Plug-in Adapter" { - [Plug-in WCS Source] as psrc -} - -database "PostgreSQL" { - frame "MetaData" { - [Coverage Metadata] as layer - } -} - - -database "PyPies" { - frame "Data" { - [Data Record] as record - } -} - - -wcshttp -- wcs112 -wcssoap -- wcs112 - -wcs112 -- isrc - -isrc -left- psrc - -psrc <-up- record -psrc <-up- layer - -@enduml \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-request.xml b/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-request.xml deleted file mode 100644 index 7c0518bd29..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-request.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - net.opengis.wcs.v_1_1_2.ObjectFactory - net.opengis.ows.v_1_1_0.ObjectFactory - net.opengis.gml.v_3_1_1.ObjectFactory - net.opengis.wms.v_1_3_0.ObjectFactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-rest-request.xml b/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-rest-request.xml deleted file mode 100644 index 9d85bba35b..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-rest-request.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-request.xml b/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-request.xml deleted file mode 100644 index d49df5cb5c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-request.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-wsdl.xml b/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-wsdl.xml deleted file mode 100644 index 21fcd07baf..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/res/spring/wcs-ogc-soap-wsdl.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/.classpath b/edexOsgi/com.raytheon.uf.edex.wcs/src/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/.project b/edexOsgi/com.raytheon.uf.edex.wcs/src/.project deleted file mode 100644 index 1c4fe9c1a5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.wcs - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.wcs/src/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index afcbd70733..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Feb 16 10:57:42 CST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoverageStoreEndpoint.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoverageStoreEndpoint.java deleted file mode 100644 index bfe40508ab..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoverageStoreEndpoint.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.OutputStream; -import java.security.InvalidParameterException; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.cxf.helpers.IOUtils; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.ogc.common.BasicFileStore; -import com.raytheon.uf.edex.wcs.format.NetCdfFormatter; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 25, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageStoreEndpoint implements Processor { - - private final BasicFileStore store; - - private final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - public static final String ID_HEADER = "id"; - - /** - * @param store - */ - public CoverageStoreEndpoint(BasicFileStore store) { - this.store = store; - } - - /* - * (non-Javadoc) - * - * @see org.apache.camel.Processor#process(org.apache.camel.Exchange) - */ - @Override - public void process(Exchange ex) throws Exception { - HttpServletResponse response = ex.getIn().getBody( - HttpServletResponse.class); - Map headers = ex.getIn().getHeaders(); - - OutputStream out = null; - try { - String id = (String) headers.get(ID_HEADER); - File cov = getCoverage(id); - response.setContentType(NetCdfFormatter.CONTENT_TYPE); - out = response.getOutputStream(); - sendFile(out, cov); - out.flush(); - store.remove(id); - } catch (InvalidParameterException e) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST); - } catch (FileNotFoundException e) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } catch (Exception e) { - log.error("Problem retrieving file from store", e); - response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } finally { - if (out != null) { - out.close(); - } - } - } - - /** - * Retrieve file from store - * - * @param id - * @return - * @throws FileNotFoundException - * if file is not in store - */ - private File getCoverage(String id) throws FileNotFoundException { - File rval = store.getFile(id); - if (rval == null) { - throw new FileNotFoundException("No file in store with id: " + id); - } - return rval; - } - - /** - * Stream file to out - * - * @param out - * @param f - * @throws Exception - */ - private void sendFile(OutputStream out, File f) throws Exception { - FileInputStream in = null; - try { - in = new FileInputStream(f); - IOUtils.copy(in, out); - } finally { - if (in != null) { - in.close(); - } - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoveragesHolder.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoveragesHolder.java deleted file mode 100644 index 4aff546a2c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/CoveragesHolder.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs; - -import java.util.Map; - -import net.opengis.wcs.v_1_1_2.CoveragesType; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 19, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoveragesHolder { - - protected CoveragesType metadata; - - protected Map data; - - protected String contentType; - - /** - * @param metadata - * @param data - */ - public CoveragesHolder(CoveragesType metadata, Map data) { - super(); - this.metadata = metadata; - this.data = data; - } - - /** - * - */ - public CoveragesHolder() { - // TODO Auto-generated constructor stub - } - - /** - * @return the metadata - */ - public CoveragesType getMetadata() { - return metadata; - } - - /** - * @param metadata - * the metadata to set - */ - public void setMetadata(CoveragesType metadata) { - this.metadata = metadata; - } - - /** - * @return the data - */ - public Map getData() { - return data; - } - - /** - * @param data - * the data to set - */ - public void setData(Map data) { - this.data = data; - } - - /** - * @return the contentType - */ - public String getContentType() { - return contentType; - } - - /** - * @param contentType - * the contentType to set - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsConfig.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsConfig.java deleted file mode 100644 index 24fd34d937..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsConfig.java +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; - -import org.apache.commons.lang.BooleanUtils; - -import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -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.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; - -/** - * WCS configuration - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 9, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class WcsConfig { - - public static final String FORCE_KM_BBOX = "force.km.altitude"; - - private static final IUFStatusHandler log = UFStatus - .getHandler(WcsConfig.class); - - private static Properties props = null; - - static { - LocalizationFile confFile = findConfigFile(); - if (confFile == null) { - log.warn("Unable to find custom id mapping properties"); - props = new Properties(); - } else { - props = loadConfig(confFile); - } - } - - /** - * Find configuration file in localization - * - * @return null if not found - */ - private static LocalizationFile findConfigFile() { - IPathManager pm = PathManagerFactory.getPathManager(); - LocalizationContext[] searchHierarchy = pm - .getLocalSearchHierarchy(LocalizationType.EDEX_STATIC); - - for (LocalizationContext ctx : searchHierarchy) { - LocalizationFile localizationFile = pm.getLocalizationFile(ctx, - "wcs" + IPathManager.SEPARATOR + "wcsConfig.properties"); - if (localizationFile.exists()) { - return localizationFile; - } - } - return null; - } - - /** - * Load map from config - * - * @param idMapFile - * @return - */ - private static Properties loadConfig(LocalizationFile idMapFile) { - Properties props = new Properties(); - File file = idMapFile.getFile(); - try { - props.load(new FileInputStream(file)); - } catch (Exception e) { - log.error("Unable to load WCS config: " + file, e); - } - return props; - } - - /** - * Get property from config - * - * @param key - * @return null if property not set - */ - public static String getProperty(String key) { - if (props == null) { - return null; - } - return props.getProperty(key); - } - - /** - * Return boolean value of property - * - * @param key - * @return false if property not set - */ - public static boolean isProperty(String key) { - if (props == null) { - return false; - } - return BooleanUtils.toBoolean(props.getProperty(key)); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsCoverageThriftReponse.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsCoverageThriftReponse.java deleted file mode 100644 index ffad4e9d36..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsCoverageThriftReponse.java +++ /dev/null @@ -1,105 +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.edex.wcs; - -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.serialization.ISerializableObject; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; - -/** - * TODO Add Description - * - * @author ekladstrup - * @version 1.0 - */ -@DynamicSerialize -public class WcsCoverageThriftReponse implements ISerializableObject { - - @DynamicSerializeElement - private IDataRecord dataRecord; - @DynamicSerializeElement - private String crsString; - @DynamicSerializeElement - private String timeString; - @DynamicSerializeElement - private String envelopeString; - - /** - * @return the dataRecord - */ - public IDataRecord getDataRecord() { - return dataRecord; - } - - /** - * @param dataRecord - * the dataRecord to set - */ - public void setDataRecord(IDataRecord dataRecord) { - this.dataRecord = dataRecord; - } - - /** - * @return the crsString - */ - public String getCrsString() { - return crsString; - } - - /** - * @param crsString - * the crsString to set - */ - public void setCrsString(String crsString) { - this.crsString = crsString; - } - - /** - * @return the timeString - */ - public String getTimeString() { - return timeString; - } - - /** - * @param timeString - * the timeString to set - */ - public void setTimeString(String timeString) { - this.timeString = timeString; - } - - /** - * @return the envelopeString - */ - public String getEnvelopeString() { - return envelopeString; - } - - /** - * @param envelopeString - * the envelopeString to set - */ - public void setEnvelopeString(String envelopeString) { - this.envelopeString = envelopeString; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsException.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsException.java deleted file mode 100644 index 2dfadc7d86..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsException.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************************** - * COPYRIGHT (c), 2006, RAYTHEON COMPANY - * ALL RIGHTS RESERVED, An Unpublished Work - * - * RAYTHEON PROPRIETARY - * If the end user is not the U.S. Government or any agency thereof, use - * or disclosure of data contained in this source code file is subject to - * the proprietary restrictions set forth in the Master Rights File. - * - * U.S. GOVERNMENT PURPOSE RIGHTS NOTICE - * If the end user is the U.S. Government or any agency thereof, this source - * code is provided to the U.S. Government with Government Purpose Rights. - * Use or disclosure of data contained in this source code file is subject to - * the "Government Purpose Rights" restriction in the Master Rights File. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * Use or disclosure of data contained in this source code file is subject to - * the export restrictions set forth in the Master Rights File. - ******************************************************************************************/ - -package com.raytheon.uf.edex.wcs; - -import com.raytheon.uf.edex.ogc.common.OgcException; - -/** - * TODO - Class comment here - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 
- * 
- * - * @author - * @version 1 - */ - -public class WcsException extends Exception { - - public enum Code { - InvalidFormat, InvalidCRS, LayerNotDefined, StyleNotDefined, LayerNotQueryable, InvalidPoint, CurrentUpdateSequence, InvalidUpdateSequence, MissingDimensionValue, InvalidDimensionValue, OperationNotSupported, MissingParameterValue, InvalidParameterValue, NoApplicableCode, UnsupportedCombination, NotEnoughStorage, InvalidRequest, InternalServerError - } - - private static final long serialVersionUID = 8797482743733419169L; - - protected Code code; - - public WcsException(OgcException ogc) { - this(decode(ogc.getCode().toString()), ogc.getMessage()); - } - - private static Code decode(String code) { - Code rval; - try { - rval = Code.valueOf(code); - } catch (Throwable t) { - rval = Code.NoApplicableCode; - } - return rval; - } - - public WcsException(Code code) { - super(); - this.code = code; - } - - public WcsException(Code code, String message) { - super(message); - this.code = code; - } - - public WcsException(Code code, Throwable cause) { - super(cause); - this.code = code; - } - - public WcsException(Code code, String message, Throwable cause) { - super(message, cause); - this.code = code; - } - - public Code getCode() { - return code; - } - - public void setCode(Code code) { - this.code = code; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsHttpHandler.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsHttpHandler.java deleted file mode 100644 index 0fac660b42..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsHttpHandler.java +++ /dev/null @@ -1,445 +0,0 @@ -/***************************************************************************************** - * COPYRIGHT (c), 2006, RAYTHEON COMPANY - * ALL RIGHTS RESERVED, An Unpublished Work - * - * RAYTHEON PROPRIETARY - * If the end user is not the U.S. Government or any agency thereof, use - * or disclosure of data contained in this source code file is subject to - * the proprietary restrictions set forth in the Master Rights File. - * - * U.S. GOVERNMENT PURPOSE RIGHTS NOTICE - * If the end user is the U.S. Government or any agency thereof, this source - * code is provided to the U.S. Government with Government Purpose Rights. - * Use or disclosure of data contained in this source code file is subject to - * the "Government Purpose Rights" restriction in the Master Rights File. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * Use or disclosure of data contained in this source code file is subject to - * the export restrictions set forth in the Master Rights File. - ******************************************************************************************/ - -package com.raytheon.uf.edex.wcs; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.xml.bind.DatatypeConverter; - -import net.opengis.ows.v_1_1_0.BoundingBoxType; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.ogc.common.http.OgcHttpHandler; -import com.raytheon.uf.edex.ogc.common.http.OgcHttpRequest; -import com.raytheon.uf.edex.ogc.common.output.IOgcHttpResponse; -import com.raytheon.uf.edex.ogc.common.output.OgcResponseOutput; -import com.raytheon.uf.edex.ogc.common.output.ServletOgcResponse; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.raytheon.uf.edex.wcs.provider.OgcWcsProvider.WcsOpType; -import com.raytheon.uf.edex.wcs.reg.RangeField; -import com.raytheon.uf.edex.wcs.reg.RangeParseException; -import com.raytheon.uf.edex.wcs.request.DefactoEnabler; -import com.raytheon.uf.edex.wcs.request.DescCoverageRequest; -import com.raytheon.uf.edex.wcs.request.GetCapRequest; -import com.raytheon.uf.edex.wcs.request.GetCoverageRequest; -import com.raytheon.uf.edex.wcs.request.GetDataRequest; -import com.raytheon.uf.edex.wcs.request.WcsRequest; -import com.raytheon.uf.edex.wcs.request.WcsRequest.Type; - -/** - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 
- * 
- * - * @author - * @version 1 - */ -public class WcsHttpHandler extends OgcHttpHandler { - - protected WcsProvider provider; - - public static final String REQUEST_HEADER = "request"; - - public static final String VERSION_HEADER = "version"; - - public static final String FORMAT_HEADER = "format"; - - public static final String UPDATESEQ_HEADER = "updatesequence"; - - public static final String BBOX_HEADER = "boundingbox"; - - public static final String MIME_HEADER = "Content-Type"; - - protected static final String CAP_PARAM = "getcapabilities"; - - protected static final String GET_PARAM = "getcoverage"; - - protected static final String DESC_PARAM = "describecoverage"; - - protected static final String GET_DATA_PARAM = "getdata"; - - protected static final String IDENTIFIERS = "identifiers"; - - protected static final String IDENTIFIER = "identifier"; - - protected static final String DOMAIN_SUBSET = "domainsubset"; - - protected static final String OUTPUT = "output"; - - protected static final String GROUP = "group"; - - protected static final String DATASET = "dataset"; - - protected static final String RANGE_SUBSET = "rangesubset"; - - protected static final String LAYER = "layer"; - - protected static final String TIME_SEQUENCE = "timesequence"; - - protected static final String STORE = "store"; - - protected static final String GRID_BASE_CRS = "gridbasecrs"; - - protected static final String GRID_TYPE = "gridtype"; - - protected static final String GRID_ORIGIN = "gridorigin"; - - protected static final String GRID_OFFSETS = "gridoffsets"; - - private final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - public WcsHttpHandler(WcsProvider provider) { - this.provider = provider; - } - - @Override - public void handle(OgcHttpRequest request) { - try { - handleInternal(request); - } catch (Exception e) { - log.error("Unable to handle request", e); - } - } - - protected void handleInternal(OgcHttpRequest ogcRequest) throws Exception { - IOgcHttpResponse response = new ServletOgcResponse( - ogcRequest.getResponse()); - HttpServletRequest httpRequest = ogcRequest.getRequest(); - Map headers = ogcRequest.getHeaders(); - OgcResponse rval = null; - - OgcServiceInfo serviceInfo = getServiceInfo(httpRequest); - WcsRequest request; - - if (ogcRequest.isPost()) { - InputStream is = httpRequest.getInputStream(); - request = provider.getRequest(is); - } else { - request = getRequestFromHeaders(headers); - } - - // Validate exception format parameter - rval = validateExceptionFormat(request); - if (rval != null) { - sendResponse(response, rval); - } - - switch (request.getType()) { - case DescribeCoverage: - rval = provider.describeCoverageType(serviceInfo, - (DescCoverageRequest) request); - break; - case GetCapabilities: - rval = provider.getCapabilities(serviceInfo, - (GetCapRequest) request); - break; - case GetCoverage: - // get coverage does it's own output - GetCoverageRequest gcr = (GetCoverageRequest) request; - if (DefactoEnabler.HEADER_VALUE.equals(headers - .get(DefactoEnabler.HEADER_KEY))) { - gcr.setDefacto(true); - } - provider.getCoverage(serviceInfo, gcr, response); - return; - case ERROR: - rval = (OgcResponse) request.getRequest(); - break; - default: - rval = provider.getError(new WcsException( - Code.OperationNotSupported, request.getType() - + " not supported"), null); - break; - } - - sendResponse(response, rval); - } - - /** - * @param request - * @return - */ - private OgcResponse validateExceptionFormat(WcsRequest request) { - if (!request.getExceptionFormat().equalsIgnoreParams( - OgcResponse.TEXT_HTML_MIME) - && !request.getExceptionFormat().equalsIgnoreParams( - OgcResponse.TEXT_XML_MIME)) { - return provider.getError( - new WcsException(Code.InvalidParameterValue, - "exceptions parameter invalid"), - OgcResponse.TEXT_XML_MIME); - } - return null; - } - - private OgcServiceInfo getServiceInfo(HttpServletRequest request) { - // FIXME get address from spring - int port = request.getServerPort(); - String base = "http://" + request.getServerName(); - if (port != 80) { - base += ":" + port; - } - base += request.getPathInfo() + "?service=wcs"; - OgcServiceInfo rval = new OgcServiceInfo(base); - rval.addOperationInfo(getOp(base, base, WcsOpType.GetCapabilities, - request.getServerName())); - rval.addOperationInfo(getOp(base, base, WcsOpType.DescribeCoverage, - request.getServerName())); - rval.addOperationInfo(getOp(base, base, WcsOpType.GetCoverage, - request.getServerName())); - - return rval; - } - - protected OgcOperationInfo getOp(String get, String post, - WcsOpType type, String host) { - OgcOperationInfo rval = new OgcOperationInfo(type); - rval.setHttpBaseHostname(host); - // FIXME get version from provider - rval.setHttpGetRes(get); - rval.setHttpPostRes(post); - rval.addVersion("1.1.2"); - rval.addAcceptVersions("1.1.2"); - rval.addService("WCS"); - rval.addFormat("text/xml"); - rval.setPostEncoding("XML"); - return rval; - } - - protected WcsRequest getRequestFromHeaders(Map headers) - throws OgcException { - WcsRequest rval = null; - Object obj = headers.get(REQUEST_HEADER); - MimeType exceptionFormat = OgcResponse.TEXT_XML_MIME; - if (obj instanceof String) { - exceptionFormat = getMimeType(headers, EXCEP_FORMAT_HEADER); - if (exceptionFormat == null) { - exceptionFormat = OgcResponse.TEXT_XML_MIME; - } - String req = (String) obj; - if (req.equalsIgnoreCase(CAP_PARAM)) { - rval = new GetCapRequest(); - } else if (req.equalsIgnoreCase(DESC_PARAM)) { - rval = buildDescCoverageRequest(headers); - } else if (req.equalsIgnoreCase(GET_PARAM)) { - try { - rval = buildGetCoverageRequest(headers); - } catch (RangeParseException e) { - log.error(e.getLocalizedMessage(), e); - rval = new WcsRequest(Type.ERROR); - String msg = "Invalid range parameter"; - WcsException ex = new WcsException( - Code.InvalidParameterValue, msg); - rval.setRequest(provider.getError(ex, exceptionFormat)); - } - } else if (req.equalsIgnoreCase(GET_DATA_PARAM)) { - rval = buildGetDataRequest(headers); - } - } - - if (rval == null) { - OgcResponse error = provider.getError(new WcsException( - Code.InvalidRequest, "Unable to decode request"), - exceptionFormat); - rval = new WcsRequest(Type.ERROR); - rval.setRequest(error); - } - - rval.setExceptionFormat(exceptionFormat); - - return rval; - } - - private WcsRequest buildGetDataRequest(Map headers) { - GetDataRequest rval = new GetDataRequest(); - - String groupName = getHeader(GROUP, headers); - if (groupName != null) { - rval.setGroup(groupName); - } - - String datasetName = getHeader(DATASET, headers); - if (datasetName != null) { - rval.setDataset(datasetName); - } - - return rval; - } - - private WcsRequest buildGetCoverageRequest(Map headers) - throws RangeParseException { - GetCoverageRequest rval = new GetCoverageRequest(); - - String identifier = getHeader(IDENTIFIER, headers); - rval.setIdentifier(identifier); - - String format = getHeader(FORMAT_HEADER, headers); - rval.setFormat(format); - - String timeSequence = getHeader(TIME_SEQUENCE, headers); - if (timeSequence != null) { - rval.setTimeSequence(parseTime(timeSequence)); - } - - String rangesubset = getHeader(RANGE_SUBSET, headers); - if (rangesubset != null) { - rval.setFields(RangeField.getRanges(rangesubset)); - } - - String bbox = getHeader(BBOX_HEADER, headers); - if (bbox != null) { - try { - rval.setBbox(parseBbox(bbox)); - } catch (OgcException e) { - throw new RangeParseException(e.getMessage()); - } - } - - return rval; - } - - protected DataTime parseTime(String timeStr) { - // TODO handle multi-times and periods in ISO 8601 - Calendar cal = DatatypeConverter.parseDateTime(timeStr); - return new DataTime(cal); - } - - private WcsRequest buildDescCoverageRequest(Map headers) { - DescCoverageRequest rval = new DescCoverageRequest(); - - String outputformat = getHeader(OUTPUT, headers); - if (outputformat != null) { - rval.setOutputformat(outputformat); - } - - String[] identifiers = getHeaderArr(IDENTIFIERS, headers); - if (identifiers != null) { - rval.setIdentifiers(Arrays.asList(identifiers)); - } - - return rval; - } - - protected BoundingBoxType parseBbox(String bbox) throws RangeParseException { - String[] parts = bbox.split(","); - BoundingBoxType rval = null; - if (parts.length == 5 || parts.length == 7) { - rval = new BoundingBoxType(); - try { - final int pivot = parts.length / 2; - List mins = new ArrayList(pivot); - for (int i = 0; i < pivot; ++i) { - mins.add(Double.parseDouble(parts[i])); - } - List maxs = new ArrayList(pivot); - for (int i = pivot; i < pivot * 2; ++i) { - maxs.add(Double.parseDouble(parts[i])); - } - rval.setLowerCorner(mins); - rval.setUpperCorner(maxs); - rval.setCrs(parts[parts.length - 1]); - } catch (NumberFormatException e) { - throw new RangeParseException("Unable to parse bounding box"); - } - } else { - throw new RangeParseException("Invalid bounding box format"); - } - return rval; - } - - protected String[] getHeaderArr(String name, Map headers) { - String[] rval; - String value = getHeader(name, headers); - if (value != null) { - rval = value.split(","); - } else { - rval = new String[0]; - } - return rval; - } - - protected String getHeader(String name, Map headers) { - Object obj = headers.get(name); - String rval = null; - if (obj != null && obj instanceof String) { - rval = (String) obj; - } - return rval; - } - - protected void sendResponse(IOgcHttpResponse httpRes, - OgcResponse response) throws Exception { - OgcResponseOutput.output(response, httpRes); - } - - protected String getLayerLevel(String rangesubset) { - String layerValue = "0"; - - if (rangesubset != null) { - int datasetIndex = rangesubset.indexOf(DATASET); - if (datasetIndex > -1) { - int layerIndex = rangesubset.indexOf(LAYER, datasetIndex); - if (layerIndex > -1) { - int layerStartIndex = rangesubset.indexOf("[", layerIndex); - if (layerStartIndex > -1) { - int layerEndIndex = rangesubset.indexOf("]", - layerStartIndex); - layerValue = rangesubset.substring(layerStartIndex + 1, - layerEndIndex); - } - } - } - } - - return layerValue; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.http.OgcHttpHandler#handleError(com.raytheon - * .uf.edex.ogc.common.OgcException, java.lang.String) - */ - @Override - protected OgcResponse handleError(OgcException e, MimeType exceptionFormat) { - return provider.getError(new WcsException(e), exceptionFormat); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsOperationInfo.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsOperationInfo.java deleted file mode 100644 index cd864e958f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsOperationInfo.java +++ /dev/null @@ -1,123 +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.edex.wcs; - -import java.util.LinkedList; -import java.util.List; - -public class WcsOperationInfo { - - public enum Type { - GetCapabilities, GetCoverage, DescribeCoverage - } - - protected Type type; - - protected String httpPostRes; - - protected String httpGetRes; - - protected List formats = new LinkedList(); - - /** - * - */ - public WcsOperationInfo(Type type) { - this.type = type; - } - - public WcsOperationInfo(Type type, String httpPostRes, String httpGetRes) { - this(type); - this.httpGetRes = httpGetRes; - this.httpPostRes = httpPostRes; - } - - public void addFormat(String format) { - formats.add(format); - } - - public boolean hasHttpPost() { - return httpPostRes != null; - } - - public boolean hasHttpGet() { - return httpGetRes != null; - } - - /** - * @return the httpPostRes - */ - public String getHttpPostRes() { - return httpPostRes; - } - - /** - * @param httpPostRes - * the httpPostRes to set - */ - public void setHttpPostRes(String httpPostRes) { - this.httpPostRes = httpPostRes; - } - - /** - * @return the httpGetRes - */ - public String getHttpGetRes() { - return httpGetRes; - } - - /** - * @param httpGetRes - * the httpGetRes to set - */ - public void setHttpGetRes(String httpGetRes) { - this.httpGetRes = httpGetRes; - } - - /** - * @return the type - */ - public Type getType() { - return type; - } - - /** - * @param type - * the type to set - */ - public void setType(Type type) { - this.type = type; - } - - /** - * @return the formats - */ - public List getFormats() { - return formats; - } - - /** - * @param formats - * the formats to set - */ - public void setFormats(List formats) { - this.formats = formats; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsProvider.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsProvider.java deleted file mode 100644 index 2a512bd5f8..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************************** - * COPYRIGHT (c), 2006, RAYTHEON COMPANY - * ALL RIGHTS RESERVED, An Unpublished Work - * - * RAYTHEON PROPRIETARY - * If the end user is not the U.S. Government or any agency thereof, use - * or disclosure of data contained in this source code file is subject to - * the proprietary restrictions set forth in the Master Rights File. - * - * U.S. GOVERNMENT PURPOSE RIGHTS NOTICE - * If the end user is the U.S. Government or any agency thereof, this source - * code is provided to the U.S. Government with Government Purpose Rights. - * Use or disclosure of data contained in this source code file is subject to - * the "Government Purpose Rights" restriction in the Master Rights File. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * Use or disclosure of data contained in this source code file is subject to - * the export restrictions set forth in the Master Rights File. - ******************************************************************************************/ - -package com.raytheon.uf.edex.wcs; - -import java.io.InputStream; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.ogc.common.output.IOgcHttpResponse; -import com.raytheon.uf.edex.wcs.provider.OgcWcsProvider.WcsOpType; -import com.raytheon.uf.edex.wcs.request.DescCoverageRequest; -import com.raytheon.uf.edex.wcs.request.GetCapRequest; -import com.raytheon.uf.edex.wcs.request.GetCoverageRequest; -import com.raytheon.uf.edex.wcs.request.WcsRequest; - -/** - * TODO - Class comment here - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 
- * 
- * - * @author - * @version 1 - */ - -public interface WcsProvider { - - public OgcResponse getCapabilities(OgcServiceInfo serviceinfo, - GetCapRequest request); - - public OgcResponse describeCoverageType( - OgcServiceInfo serviceinfo, DescCoverageRequest request); - - public void getCoverage(OgcServiceInfo serviceinfo, - GetCoverageRequest request, IOgcHttpResponse response); - - public WcsRequest getRequest(InputStream in); - - public OgcResponse getError(WcsException e, MimeType exceptionFormat); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsServiceInfo.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsServiceInfo.java deleted file mode 100644 index 1b38f5984d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/WcsServiceInfo.java +++ /dev/null @@ -1,72 +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.edex.wcs; - -import java.util.LinkedList; -import java.util.List; - -public class WcsServiceInfo { - - protected String onlineResource; - - protected List operations = new LinkedList(); - - /** - * - */ - public WcsServiceInfo(String onlineResouce) { - this.onlineResource = onlineResouce; - } - - public void addOperationInfo(WcsOperationInfo info) { - operations.add(info); - } - - /** - * @return the onlineResource - */ - public String getOnlineResource() { - return onlineResource; - } - - /** - * @param onlineResource - * the onlineResource to set - */ - public void setOnlineResource(String onlineResource) { - this.onlineResource = onlineResource; - } - - /** - * @return the operations - */ - public List getOperations() { - return operations; - } - - /** - * @param operations - * the operations to set - */ - public void setOperations(List operations) { - this.operations = operations; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ByteNcWriter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ByteNcWriter.java deleted file mode 100644 index 7efc918172..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ByteNcWriter.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.format; - -import com.raytheon.uf.common.datastorage.records.ByteDataRecord; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NcVariable.ByteVariable; -import com.raytheon.uf.common.nc4.NetcdfException; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class ByteNcWriter extends NcWriter { - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.format.NcWriter#getVarClass() - */ - @Override - public Class getVarClass() { - return ByteVariable.class; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.NcWriter#write(com.raytheon.uf.common - * .nc4.NcVariable, com.raytheon.uf.common.datastorage.records.IDataRecord) - */ - @Override - public void write(NcVariable var, int[] start, IDataRecord irecord) - throws NetcdfException { - ByteDataRecord record = (ByteDataRecord) irecord; - ByteVariable variable = (ByteVariable) var; - int[] shape = getShape(record); - variable.putVar(start, shape, record.getByteData()); - } - - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/DataRecordIOSP.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/DataRecordIOSP.java deleted file mode 100644 index ce2b0a7f92..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/DataRecordIOSP.java +++ /dev/null @@ -1,231 +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.edex.wcs.format; - -import java.io.IOException; -import java.nio.channels.WritableByteChannel; - -import ucar.ma2.Array; -import ucar.ma2.InvalidRangeException; -import ucar.ma2.Section; -import ucar.ma2.StructureDataIterator; -import ucar.nc2.NetcdfFile; -import ucar.nc2.ParsedSectionSpec; -import ucar.nc2.Structure; -import ucar.nc2.Variable; -import ucar.nc2.iosp.IOServiceProvider; -import ucar.nc2.util.CancelTask; -import ucar.unidata.io.RandomAccessFile; - -import com.raytheon.uf.common.datastorage.records.IDataRecord; - -/** - * - * @author bclement - * @version 1.0 - */ -public class DataRecordIOSP implements IOServiceProvider { - - protected IDataRecord dataRecord; - - public DataRecordIOSP(IDataRecord dataRecord) { - this.dataRecord = dataRecord; - } - - /* - * (non-Javadoc) - * - * @see - * ucar.nc2.iosp.IOServiceProvider#isValidFile(ucar.unidata.io.RandomAccessFile - * ) - */ - @Override - public boolean isValidFile(RandomAccessFile arg0) throws IOException { - System.out.println(); - return false; - } - - /* - * (non-Javadoc) - * - * @see - * ucar.nc2.iosp.IOServiceProvider#open(ucar.unidata.io.RandomAccessFile, - * ucar.nc2.NetcdfFile, ucar.nc2.util.CancelTask) - */ - @Override - public void open(RandomAccessFile arg0, NetcdfFile arg1, CancelTask arg2) - throws IOException { - System.out.println(); - - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#readData(ucar.nc2.Variable, - * ucar.ma2.Section) - */ - @Override - public Array readData(Variable arg0, Section arg1) throws IOException, - InvalidRangeException { - System.out.println(); - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#close() - */ - @Override - public void close() throws IOException { - System.out.println(); - - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#getDetailInfo() - */ - @Override - public String getDetailInfo() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#getFileTypeDescription() - */ - @Override - public String getFileTypeDescription() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#getFileTypeId() - */ - @Override - public String getFileTypeId() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#getFileTypeVersion() - */ - @Override - public String getFileTypeVersion() { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see - * ucar.nc2.iosp.IOServiceProvider#getStructureIterator(ucar.nc2.Structure, - * int) - */ - @Override - public StructureDataIterator getStructureIterator(Structure arg0, int arg1) - throws IOException { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see - * ucar.nc2.iosp.IOServiceProvider#readSection(ucar.nc2.ParsedSectionSpec) - */ - @Override - public Array readSection(ParsedSectionSpec arg0) throws IOException, - InvalidRangeException { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#readToByteChannel(ucar.nc2.Variable, - * ucar.ma2.Section, java.nio.channels.WritableByteChannel) - */ - @Override - public long readToByteChannel(Variable arg0, Section arg1, - WritableByteChannel arg2) throws IOException, InvalidRangeException { - // TODO Auto-generated method stub - return 0; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#sendIospMessage(java.lang.Object) - */ - @Override - public Object sendIospMessage(Object arg0) { - // TODO Auto-generated method stub - return null; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#sync() - */ - @Override - public boolean sync() throws IOException { - // TODO Auto-generated method stub - return false; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#syncExtend() - */ - @Override - public boolean syncExtend() throws IOException { - // TODO Auto-generated method stub - return false; - } - - /* - * (non-Javadoc) - * - * @see ucar.nc2.iosp.IOServiceProvider#toStringDebug(java.lang.Object) - */ - @Override - public String toStringDebug(Object arg0) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/FloatNcWriter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/FloatNcWriter.java deleted file mode 100644 index 37589d4e4e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/FloatNcWriter.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.format; - -import com.raytheon.uf.common.datastorage.records.FloatDataRecord; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NcVariable.FloatVariable; -import com.raytheon.uf.common.nc4.NetcdfException; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class FloatNcWriter extends NcWriter { - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.format.NcWriter#getVarClass() - */ - @Override - public Class getVarClass() { - return FloatVariable.class; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.NcWriter#write(com.raytheon.uf.common - * .nc4.NcVariable, com.raytheon.uf.common.datastorage.records.IDataRecord) - */ - @Override - public void write(NcVariable var, int[] start, IDataRecord irecord) - throws NetcdfException { - FloatDataRecord record = (FloatDataRecord) irecord; - FloatVariable variable = (FloatVariable) var; - int[] shape = getShape(record); - variable.putVar(start, shape, record.getFloatData()); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IWcsDataFormatter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IWcsDataFormatter.java deleted file mode 100644 index 3fe17b4b99..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IWcsDataFormatter.java +++ /dev/null @@ -1,63 +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.edex.wcs.format; - -import java.io.File; -import java.io.InputStream; - -import com.raytheon.uf.edex.wcs.reg.Coverage; - -/** - * - * @author bclement - * @version 1.0 - */ -public interface IWcsDataFormatter { - - /** - * - * @return - */ - public String getIdentifier(); - - /** - * get coverage identifier - * @param format - * @return - */ - public boolean matchesFormat(String format); - - /** - * Format coverage - * @param coverage - * @return - * @throws Exception - */ - public InputStream format(Coverage coverage) throws Exception; - - /** - * Store coverage - * @param coverage - * @return - * @throws Exception - */ - public File store(Coverage coverage) throws Exception; - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IntNcWriter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IntNcWriter.java deleted file mode 100644 index 62039631e1..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/IntNcWriter.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.format; - -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NcVariable.IntVariable; -import com.raytheon.uf.common.nc4.NetcdfException; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class IntNcWriter extends NcWriter { - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.format.NcWriter#getVarClass() - */ - @Override - public Class getVarClass() { - return IntVariable.class; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.NcWriter#write(com.raytheon.uf.common - * .nc4.NcVariable, com.raytheon.uf.common.datastorage.records.IDataRecord) - */ - @Override - public void write(NcVariable var, int[] start, IDataRecord irecord) - throws NetcdfException { - IntegerDataRecord record = (IntegerDataRecord) irecord; - IntVariable variable = (IntVariable) var; - int[] shape = getShape(record); - variable.putVar(start, shape, record.getIntData()); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NcWriter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NcWriter.java deleted file mode 100644 index 6132f80bec..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NcWriter.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.format; - -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.ShortDataRecord; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NetcdfException; - -/** - * Abstraction for data type specific writing from data record to netcdf file - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public abstract class NcWriter { - - public abstract Class getVarClass(); - - /** - * Write data record to variable - * - * @param var - * @param irecord - * @throws NetcdfException - */ - public abstract void write(NcVariable var, int[] start, IDataRecord irecord) - throws NetcdfException; - - /** - * Converts the dimensions of the record to netcdf shape. This will be - * reverse from the data record sizes; - * - * @param record - * @return - */ - protected int[] getShape(IDataRecord record) { - long[] sizes = record.getSizes(); - return new int[] { 1, 1, (int) sizes[1], (int) sizes[0] }; - } - - /** - * Factory method for ncwriters - * - * @param record - * @return - * @throws Exception - * if the data record's data type is not supported by the netcdf - * library - */ - public static NcWriter create(IDataRecord record) - throws Exception { - if (record instanceof ByteDataRecord) { - return new ByteNcWriter(); - } else if (record instanceof ShortDataRecord) { - return new ShortNcWriter(); - } else if (record instanceof IntegerDataRecord) { - return new IntNcWriter(); - } else if (record instanceof FloatDataRecord) { - return new FloatNcWriter(); - } else { - throw new Exception("Unsupported data record type: " - + record.getClass()); - } - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NetCdfFormatter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NetCdfFormatter.java deleted file mode 100644 index 118919c065..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/NetCdfFormatter.java +++ /dev/null @@ -1,652 +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.edex.wcs.format; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.atomic.AtomicLong; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.geotools.coverage.grid.GridEnvelope2D; -import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.coverage.grid.InvalidGridGeometryException; -import org.geotools.geometry.DirectPosition2D; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.parameter.Parameter; -import org.geotools.referencing.CRS; -import org.geotools.referencing.operation.transform.ConcatenatedTransform; -import org.opengis.geometry.MismatchedDimensionException; -import org.opengis.metadata.spatial.PixelOrientation; -import org.opengis.parameter.GeneralParameterValue; -import org.opengis.parameter.ParameterValueGroup; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ProjectedCRS; -import org.opengis.referencing.cs.CartesianCS; -import org.opengis.referencing.cs.CoordinateSystemAxis; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.Projection; -import org.opengis.referencing.operation.TransformException; - -import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.nc4.NcDimension; -import com.raytheon.uf.common.nc4.NcDimension.DoubleDimension; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NcVariable.ByteVariable; -import com.raytheon.uf.common.nc4.Netcdf; -import com.raytheon.uf.common.nc4.NetcdfException; -import com.raytheon.uf.common.nc4.cf.CfConstants; -import com.raytheon.uf.common.nc4.cf.CfDimensions; -import com.raytheon.uf.common.nc4.cf.CfGridMapper; -import com.raytheon.uf.common.nc4.cf.CfHorizontalDims; -import com.raytheon.uf.common.nc4.cf.CfNetcdf; -import com.raytheon.uf.common.spatial.reprojection.ReferencedDataRecord; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.ogc.common.BasicFileStore; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.raytheon.uf.edex.wcs.reg.Coverage; -import com.raytheon.uf.edex.wcs.reg.CoverageDimensions; -import com.raytheon.uf.edex.wcs.reg.CoverageField; -import com.raytheon.uf.edex.wcs.reg.CoverageTAxis; -import com.raytheon.uf.edex.wcs.reg.CoverageXYAxis; -import com.raytheon.uf.edex.wcs.reg.CoverageZAxis; -import com.raytheon.uf.edex.wcs.reg.TemporalCube; -import com.raytheon.uf.edex.wcs.reg.VerticalSlice; - -/** - * - * @author bclement - * @version 1.0 - */ -public class NetCdfFormatter implements IWcsDataFormatter { - - public static final String CONTENT_TYPE = "application/netcdf4"; - - private final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - private final BasicFileStore store; - - private static final AtomicLong STORAGE_ID = new AtomicLong(); - - public NetCdfFormatter(BasicFileStore store) { - this.store = store; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.format.WcsDataFormatter#getIdentifier() - */ - @Override - public String getIdentifier() { - return CONTENT_TYPE; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.WcsDataFormatter#format(com.raytheon. - * uf.common.datastorage.records.IDataRecord, java.io.OutputStream, boolean) - */ - @Override - public InputStream format(Coverage coverage) throws Exception { - final File file = store(coverage); - // if the constructor throws, the file will be leaked - return new FileInputStream(file) { - @Override - public void close() throws IOException { - try { - super.close(); - } finally { - if (file != null) { - file.delete(); - } - } - } - }; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.WcsDataFormatter#store(com.raytheon.uf - * .edex.wcs.reg.Coverage) - */ - @Override - public File store(Coverage coverage) throws Exception { - String id = createStoreId(coverage); - File file = store.reserveFile(id); - CfNetcdf ncfile = new CfNetcdf(file.getAbsolutePath(), - Netcdf.NETCDF4_CLASSIC_MODE); - try { - ncfile.putStringAttribute(CfConstants.COVERAGE_ID_ATTR, - coverage.getName()); - List fields = coverage.getFields(); - DimMapping dmap = defineDims(ncfile, fields); - List vars = new ArrayList(fields.size()); - for (CoverageField field : fields) { - vars.add(define(ncfile, dmap.fieldMap.get(field.getName()), - field)); - } - ncfile.endFileDefinition(); - for (DimWriter w : dmap.writers) { - w.write(); - } - Iterator iter = vars.iterator(); - for (CoverageField field : fields) { - NcVariable var = iter.next(); - write(field, var); - } - - } finally { - ncfile.close(); - } - return file; - } - - /** - * Write 4D cube in field to variable - * - * @param field - * @param var - * @throws Exception - */ - private void write(CoverageField field, NcVariable var) throws Exception { - List timeCube = field.getTimeCube(); - TemporalCube firstCube = timeCube.get(0); - VerticalSlice firstSlice = firstCube.getSlices().get(0); - ReferencedDataRecord firstRecord = firstSlice.getRecord().get(true); - NcWriter writer = NcWriter.create(firstRecord - .getRecord()); - - Iterator cubeIter = timeCube.iterator(); - for (int i = 0; cubeIter.hasNext(); ++i) { - TemporalCube cube = cubeIter.next(); - Iterator sliceIter = cube.getSlices().iterator(); - for (int j = 0; sliceIter.hasNext(); ++j) { - VerticalSlice slice = sliceIter.next(); - writer.write(var, new int[] { i, j, 0, 0 }, slice.getRecord() - .get(false).getRecord()); - } - } - } - - /** - * Define variable for field - * - * @param ncfile - * @param dims - * @param field - * @return - * @throws Exception - */ - private NcVariable define(CfNetcdf ncfile, - CfDimensions dims, CoverageField field) - throws Exception { - List timeCube = field.getTimeCube(); - TemporalCube firstCube = timeCube.get(0); - VerticalSlice firstSlice = firstCube.getSlices().get(0); - ReferencedDataRecord firstRecord = firstSlice.getRecord().get(true); - NcWriter writer = NcWriter.create(firstRecord - .getRecord()); - NcVariable variable = ncfile.defineVar(field.getName(), dims.toArray(), - writer.getVarClass()); - variable.putStringAttribute(CfConstants.STANDARD_NAME_ATTR, - field.getStandardName()); - variable.putStringAttribute(CfConstants.LONG_NAME_ATTR, - field.getStandardName()); - variable.putStringAttribute(CfConstants.UNITS_ATTR, field.getUnits()); - variable.putNumberAttribute(CfConstants.MISSING_VAL_ATTR, - new Number[] { field.getPaddingValue() }); - CfHorizontalDims xyDims = dims.getXyDims(); - if (xyDims.isMapped()) { - variable.putStringAttribute(CfConstants.GRID_MAP_NAME_ATTR, - xyDims.getGridMapping()); - variable.putStringAttribute(CfConstants.COORDS_ATTR, - xyDims.getCoords()); - } - return variable; - } - - /** - * Interface to postpone writing to dimensions until after definition phase - */ - private static interface DimWriter { - public void write() throws NetcdfException; - } - - /** - * Wrapper for multi-part return - */ - private static class DimMapping { - public final Map> fieldMap; - - public final List writers; - - public DimMapping(Map> fieldMap, - List writers) { - this.fieldMap = fieldMap; - this.writers = writers; - } - } - - /** - * Define dimensions for fields. - * - * @param ncfile - * @param fields - * @return - * @throws Exception - */ - private DimMapping defineDims(CfNetcdf ncfile, List fields) - throws Exception { - Map> horizMap = new HashMap>(); - Map vertMap = new HashMap(); - Map timeMap = new HashMap(); - Map> fieldMap = new HashMap>(); - List writers = new ArrayList(); - - for (CoverageField field : fields) { - CoverageDimensions dims = field.getDimensions(); - CoverageXYAxis xyAxis = dims.getXyAxis(); - CfHorizontalDims horiz = horizMap.get(xyAxis); - if (horiz == null) { - horiz = defineXY(ncfile, xyAxis, writers, horizMap.size()); - horizMap.put(xyAxis, horiz); - } - CoverageZAxis zAxis = dims.getZAxis(); - DoubleDimension vert = vertMap.get(zAxis); - if (vert == null) { - vert = defineZ(ncfile, zAxis, writers, vertMap.size()); - vertMap.put(zAxis, vert); - } - CoverageTAxis tAxis = dims.getTAxis(); - DoubleDimension time = timeMap.get(tAxis); - if (time == null) { - time = defineT(ncfile, tAxis, writers, timeMap.size()); - timeMap.put(tAxis, time); - } - fieldMap.put(field.getName(), - new CfDimensions(horiz, vert, - time)); - } - return new DimMapping(fieldMap, writers); - } - - /** - * Define horizontal dimensions - * - * @param ncfile - * @param xyAxis - * @param writers - * @param count - * @return - * @throws Exception - */ - private CfHorizontalDims defineXY(CfNetcdf ncfile, - CoverageXYAxis xyAxis, List writers, int count) - throws Exception { - double[][] lonLatAxis = getLonLatAxis(xyAxis.getGridGeometry()); - final double[] lonValue = lonLatAxis[0]; - final double[] latValue = lonLatAxis[1]; - final DoubleDimension lon = ncfile.defineXDim("lon" + count, - "longitude", lonValue.length, CfConstants.LON_UNITS, - DoubleDimension.class); - final DoubleDimension lat = ncfile.defineYDim("lat" + count, - "latitude", latValue.length, CfConstants.LAT_UNITS, - DoubleDimension.class); - writers.add(new DimWriter() { - @Override - public void write() throws NetcdfException { - lon.putDim(lonValue); - lat.putDim(latValue); - } - }); - - ReferencedEnvelope env = xyAxis.getEnvelope(); - CoordinateReferenceSystem crs = env.getCoordinateReferenceSystem(); - if (crs instanceof GeographicCRS) { - return new CfHorizontalDims(lon, lat); - } else if (crs instanceof ProjectedCRS) { - return defineMappedXY(ncfile, xyAxis, writers, count, lon, lat); - } else { - log.error("Unsupport CRS object type: " + crs.getClass(), - new Exception()); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * Define non geographic horizontal dimensions - * - * @param ncfile - * @param xyAxis - * @param writers - * @param count - * @param lon - * @param lat - * @return - * @throws NetcdfException - * @throws TransformException - * @throws FactoryException - * @throws MismatchedDimensionException - * @throws InvalidGridGeometryException - */ - private CfHorizontalDims defineMappedXY( - CfNetcdf ncfile, CoverageXYAxis xyAxis, List writers, - int count, DoubleDimension lon, DoubleDimension lat) - throws Exception { - ReferencedEnvelope env = xyAxis.getEnvelope(); - ProjectedCRS crs = (ProjectedCRS) env.getCoordinateReferenceSystem(); - CartesianCS cs = crs.getCoordinateSystem(); - CoordinateSystemAxis xAxis = cs.getAxis(0); - CoordinateSystemAxis yAxis = cs.getAxis(1); - GridGeometry2D geom = xyAxis.getGridGeometry(); - GridEnvelope2D gridEnv = geom.getGridRange2D(); - - final DoubleDimension x = ncfile.defineXDim("x" + count, - CfConstants.X_STD_NAME, gridEnv.width, xAxis.getUnit() - .toString(), DoubleDimension.class); - final DoubleDimension y = ncfile.defineYDim("y" + count, - CfConstants.Y_STD_NAME, gridEnv.height, yAxis.getUnit() - .toString(), DoubleDimension.class); - - double[][] xyVals = getXYAxis(geom, crs); - final double[] xVals = xyVals[0]; - final double[] yVals = xyVals[1]; - - writers.add(new DimWriter() { - @Override - public void write() throws NetcdfException { - x.putDim(xVals); - y.putDim(yVals); - } - }); - - Projection conv = crs.getConversionFromBase(); - ParameterValueGroup params = conv.getParameterValues(); - String projName = params.getDescriptor().getName().getCode(); - - Map> paramMap = getParamMap(params); - NcVariable projVar = defineProjVar(ncfile, projName, paramMap, count); - String coords = StringUtils.join( - new String[] { lat.getName(), lon.getName() }, " "); - return new CfHorizontalDims(x, y, coords, - projVar.getName()); - } - - protected static class NumberedValue implements Comparable { - public int number; - - public Object value; - - public NumberedValue(int number, Object value) { - this.number = number; - this.value = value; - } - - @Override - public int compareTo(NumberedValue o) { - return number - o.number; - } - - } - - /** - * Map parameter base names to values - * - * @param params - * @return - */ - protected Map> getParamMap( - ParameterValueGroup params) { - final Pattern PARAM_PATTERN = Pattern.compile("^(.*)(_([0-9]+))$"); - Map> paramMap = new HashMap>(); - for (GeneralParameterValue v : params.values()) { - Parameter p = (Parameter) v; - String paramName = p.getDescriptor().getName().getCode().trim(); - Matcher m = PARAM_PATTERN.matcher(paramName); - int number = 0; - if (m.matches()) { - paramName = m.group(1); - number = Integer.parseInt(m.group(3)); - } - paramName = CfGridMapper.getMappingAttributeName(paramName); - List values = paramMap.get(paramName); - if (values == null) { - values = new ArrayList(2); - paramMap.put(paramName, values); - } - - values.add(new NumberedValue(number, p.getValue())); - } - return paramMap; - } - - /** - * Define grid projection mapping variable - * - * @param ncfile - * @param projName - * @param paramMap - * @param count - * @return - * @throws NetcdfException - */ - private NcVariable defineProjVar(CfNetcdf ncfile, String projName, - Map> paramMap, int count) - throws NetcdfException { - ByteVariable projVar = ncfile.defineVar(projName + count, - new NcDimension[0], ByteVariable.class); - projVar.putStringAttribute(CfConstants.GRID_MAP_NAME_ATTR, projName); - for (Entry> e : paramMap.entrySet()) { - List list = e.getValue(); - Collections.sort(list); - if (list.get(0).value instanceof Number) { - Number[] vals = new Number[list.size()]; - Iterator iter = list.iterator(); - for (int i = 0; iter.hasNext(); ++i) { - vals[i] = (Number) iter.next().value; - } - projVar.putNumberAttribute(e.getKey(), vals); - } else { - String[] vals = new String[list.size()]; - Iterator iter = list.iterator(); - for (int i = 0; iter.hasNext(); ++i) { - vals[i] = iter.next().value.toString(); - } - projVar.putStringsAttribute(e.getKey(), vals); - } - } - return projVar; - } - - /** - * Define vertical dimension - * - * @param ncfile - * @param zAxis - * @param writers - * @param count - * @return - * @throws NetcdfException - */ - private DoubleDimension defineZ(CfNetcdf ncfile, final CoverageZAxis zAxis, - List writers, int count) throws NetcdfException { - final DoubleDimension z = ncfile.defineZDim("level" + count, - "height level", zAxis.getValue().length, zAxis.getUnits(), - zAxis.isUpIsPositive(), DoubleDimension.class); - writers.add(new DimWriter() { - @Override - public void write() throws NetcdfException { - z.putDim(zAxis.getValue()); - } - }); - return z; - } - - /** - * Define temporal dimension - * - * @param ncfile - * @param tAxis - * @param writers - * @param count - * @return - * @throws NetcdfException - */ - private DoubleDimension defineT(CfNetcdf ncfile, CoverageTAxis tAxis, - List writers, int count) throws NetcdfException { - final DoubleDimension t = ncfile.defineTimeDim("time" + count, "time", - tAxis.getTimes().length, CfConstants.UNIX_TIME_UNITS, - DoubleDimension.class); - final double[] values = getTimes(tAxis.getTimes()); - writers.add(new DimWriter() { - @Override - public void write() throws NetcdfException { - t.putDim(values); - } - }); - return t; - } - - /** - * Convert times to UNIX timestamps with milliseconds as decimal - * - * @param times - * @return - */ - private double[] getTimes(Date[] times) { - double[] rval = new double[times.length]; - for (int i = 0; i < rval.length; ++i) { - rval[i] = times[i].getTime() / 1000; - } - return rval; - } - - /** - * Convert geometry to CRS84. - * - * @param geom - * @return array of size 2. Index 0 contains longitude, index 1 contains - * latitude. Not guaranteed to be the same length. - * @throws InvalidGridGeometryException - * @throws FactoryException - * @throws MismatchedDimensionException - * @throws TransformException - */ - private double[][] getLonLatAxis(GridGeometry2D geom) - throws InvalidGridGeometryException, FactoryException, - MismatchedDimensionException, TransformException { - return getXYAxis(geom, MapUtil.LATLON_PROJECTION); - } - - /** - * Convert geometry to Target CRS. - * - * @param geom - * @param targetCRS - * @return - * @throws InvalidGridGeometryException - * @throws FactoryException - * @throws MismatchedDimensionException - * @throws TransformException - */ - private double[][] getXYAxis(GridGeometry2D geom, - CoordinateReferenceSystem targetCRS) - throws InvalidGridGeometryException, FactoryException, - MismatchedDimensionException, TransformException { - double[][] rval = new double[2][]; - GridEnvelope2D gridEnv = geom.getGridRange2D(); - MathTransform gridToCRS = geom - .getGridToCRS(PixelOrientation.UPPER_LEFT); - CoordinateReferenceSystem origCrs = geom.getCoordinateReferenceSystem(); - MathTransform toTarget = CRS - .findMathTransform(origCrs, targetCRS, true); - MathTransform transform = ConcatenatedTransform.create(gridToCRS, - toTarget); - rval[0] = new double[gridEnv.width]; - rval[1] = new double[gridEnv.height]; - int maxLen = Math.max(gridEnv.width, gridEnv.height); - int xIndex = 0; - int yIndex = 0; - for (int i = 0; i < maxLen; ++i) { - DirectPosition2D point = new DirectPosition2D(xIndex, yIndex); - DirectPosition2D target = new DirectPosition2D(); - transform.transform(point, target); - rval[0][xIndex] = target.getX(); - rval[1][yIndex] = target.getY(); - xIndex = Math.min(++xIndex, gridEnv.width - 1); - yIndex = Math.min(++yIndex, gridEnv.height - 1); - } - return rval; - } - - /** - * Create unique id for file store - * - * @param coverage - * @return - */ - private String createStoreId(Coverage coverage) { - String name = coverage.getName(); - String rval; - do { - HashCodeBuilder builder = new HashCodeBuilder(); - builder.append(name).append(System.currentTimeMillis()); - builder.append(STORAGE_ID.incrementAndGet()); - String hash = Integer.toHexString(builder.toHashCode()); - rval = name + hash + ".nc"; - } while (store.getFile(rval) != null); - - return rval; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.WcsDataFormatter#matchesFormat(java.lang - * .String) - */ - @Override - public boolean matchesFormat(String format) { - return format.toLowerCase().contains("netcdf"); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ShortNcWriter.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ShortNcWriter.java deleted file mode 100644 index c1d8670cde..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/format/ShortNcWriter.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.format; - -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; -import com.raytheon.uf.common.nc4.NcVariable; -import com.raytheon.uf.common.nc4.NcVariable.ShortVariable; -import com.raytheon.uf.common.nc4.NetcdfException; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class ShortNcWriter extends NcWriter { - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.format.NcWriter#getVarClass() - */ - @Override - public Class getVarClass() { - return ShortVariable.class; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.format.NcWriter#write(com.raytheon.uf.common - * .nc4.NcVariable, com.raytheon.uf.common.datastorage.records.IDataRecord) - */ - @Override - public void write(NcVariable var, int[] start, IDataRecord irecord) - throws NetcdfException { - ShortDataRecord record = (ShortDataRecord) irecord; - ShortVariable variable = (ShortVariable) var; - int[] shape = getShape(record); - variable.putVar(start, shape, record.getShortData()); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CapabilitiesBuilder.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CapabilitiesBuilder.java deleted file mode 100644 index 8e299ed0c1..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CapabilitiesBuilder.java +++ /dev/null @@ -1,272 +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.edex.wcs.provider; - -import static com.raytheon.uf.edex.wcs.provider.WcsJaxbUtils.getAsLangString; -import static com.raytheon.uf.edex.wcs.provider.WcsJaxbUtils.getKeywords; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import net.opengis.ows.v_1_1_0.AddressType; -import net.opengis.ows.v_1_1_0.CodeType; -import net.opengis.ows.v_1_1_0.ContactType; -import net.opengis.ows.v_1_1_0.KeywordsType; -import net.opengis.ows.v_1_1_0.LanguageStringType; -import net.opengis.ows.v_1_1_0.OnlineResourceType; -import net.opengis.ows.v_1_1_0.ResponsiblePartySubsetType; -import net.opengis.ows.v_1_1_0.ServiceIdentification; -import net.opengis.ows.v_1_1_0.ServiceProvider; -import net.opengis.ows.v_1_1_0.WGS84BoundingBoxType; -import net.opengis.wcs.v_1_1_2.Capabilities; -import net.opengis.wcs.v_1_1_2.Contents; -import net.opengis.wcs.v_1_1_2.CoverageSummaryType; -import net.opengis.wcs.v_1_1_2.ObjectFactory; - -import com.raytheon.uf.edex.ogc.common.OgcGeoBoundingBox; -import com.raytheon.uf.edex.ogc.common.OgcNamespace; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.wcs.provider.OgcWcsProvider.WcsOpType; -import com.raytheon.uf.edex.wcs.reg.CoverageDescription; - -/** - * - * @author bclement - * @version 1.0 - */ -public class CapabilitiesBuilder { - - protected String version = "1.1.2"; - protected String OWS_NS = OgcNamespace.OWS110; - - protected String WCS_NS = OgcNamespace.WCS112; - - protected String updateSequence = "1"; - - protected String SERV_TYPE = "WCS"; - protected static final String wcsName = "WCS"; - protected String SERV_TITLE = "EDEX WCS"; - - protected static final String svcTitle = "EDEX Coverage Server"; - - protected OperationsDescriber opDesc = new OperationsDescriber(); - - protected ObjectFactory wcsFactory = new ObjectFactory(); - - protected List formats; - - protected net.opengis.ows.v_1_1_0.ObjectFactory owsFactory = new net.opengis.ows.v_1_1_0.ObjectFactory(); - - public CapabilitiesBuilder(List formats) { - this.formats = formats; - } - - public Capabilities getCapabilities(OgcServiceInfo serviceinfo, - List coverages) { - - Capabilities capabilities = new Capabilities(); - capabilities.setVersion(version); - // capabilities.setUpdateSequence(updateSequence); - // capabilities - // .setServiceIdentification(getServiceIdentification(serviceinfo)); - // capabilities.setServiceProvider(getServiceProvider(serviceinfo)); - capabilities.setOperationsMetadata(opDesc.getOpData(serviceinfo)); - capabilities.setContents(getContents(coverages)); - - return capabilities; - } - - protected Contents getContents(List coverages) { - Contents rval = new Contents(); - List cstList = new ArrayList(); - for (CoverageDescription coverage : coverages) { - cstList.add(getCoverageSummaryType(coverage)); - } - rval.setSupportedFormat(formats); - rval.setCoverageSummary(cstList); - return rval; - } - - protected List> getBboxes( - OgcGeoBoundingBox bbox) { - if (bbox == null) { - return new ArrayList>(0); - } - List> rval = new ArrayList>( - 1); - WGS84BoundingBoxType to = owsFactory.createWGS84BoundingBoxType(); - to.setLowerCorner(Arrays.asList(bbox.getMinx(), bbox.getMiny())); - to.setUpperCorner(Arrays.asList(bbox.getMaxx(), bbox.getMaxy())); - to.setDimensions(BigInteger.valueOf(2)); - to.setCrs("urn:ogc:def:crs:OGC:2:84"); - rval.add(owsFactory.createWGS84BoundingBox(to)); - - return rval; - } - - protected CoverageSummaryType getCoverageSummaryType(CoverageDescription cov) { - CoverageSummaryType cst = new CoverageSummaryType(); - - cst.setTitle(getAsLangString(cov.getTitle())); - cst.setAbstract(getAsLangString(cov.getAbstractStr())); - if (cov.getKeywords() != null) { - cst.setKeywords(getKeywords(cov.getKeywords())); - } - - List> jaxbList = new ArrayList>(); - - jaxbList.addAll(getBboxes(cov.getCrs84Bbox())); - - if (cov.getCrs() != null && cov.getCrs().size() > 0) { - for (String crs : cov.getCrs()) { - jaxbList.add(wcsFactory.createCoverageSummaryTypeSupportedCRS(crs)); - } - } - if (cov.getIdentifier() != null) { - jaxbList.add(wcsFactory.createIdentifier(cov.getIdentifier())); - } - cst.setContent(jaxbList); - return cst; - } - - // the following methods are for optional metadata that aren't currently - // used - - protected ResponsiblePartySubsetType getResponsibleParty() { - ResponsiblePartySubsetType rval = new ResponsiblePartySubsetType(); - rval.setIndividualName("Individual Name"); - rval.setPositionName("TBD"); - - CodeType ct = new CodeType(); - ct.setCodeSpace("role"); - ct.setValue("TBD"); - rval.setRole(ct); - - // Contact Information - ContactType contact = new ContactType(); - AddressType address = new AddressType(); - address.setAdministrativeArea("TBD"); - - List addressPointList = new ArrayList(); - addressPointList.add("TBD"); - address.setDeliveryPoint(addressPointList); - - address.setCity("TBD"); - address.setCountry("TBD"); - - List emailList = new ArrayList(); - emailList.add("TBD"); - address.setElectronicMailAddress(emailList); - address.setPostalCode("TBD"); - - contact.setAddress(address); - contact.setContactInstructions("TBD"); - - rval.setContactInfo(contact); - - return rval; - } - - protected OnlineResourceType getOLR(OgcServiceInfo serviceinfo) { - OnlineResourceType rval = new OnlineResourceType(); - - if (serviceinfo != null && serviceinfo.getOnlineResource() != null) { - rval.setHref(serviceinfo.getOnlineResource()); - } - rval.setActuate("TBD"); - rval.setArcrole("TBD"); - rval.setRole("TBD"); - rval.setShow("TBD"); - rval.setTitle("TBD"); - rval.setType("TBD"); - return rval; - } - - protected ServiceIdentification getServiceIdentification( - OgcServiceInfo serviceinfo) { - ServiceIdentification rval = new ServiceIdentification(); - - // Abstract - List lstList = new ArrayList(); - LanguageStringType lst = new LanguageStringType(); - lst.setLang(WcsJaxbUtils.DEFAULT_LANGUAGE); - lst.setValue("TBD"); - rval.setAbstract(lstList); - - // Constraints - List constraints = new ArrayList(); - constraints.add("NONE"); - rval.setAccessConstraints(constraints); - - // Fees - rval.setFees("fees"); - - // Key Words - List keyWordTypeList = new ArrayList(); - KeywordsType kt = new KeywordsType(); - lstList = new ArrayList(); - lst = new LanguageStringType(); - lst.setLang(WcsJaxbUtils.DEFAULT_LANGUAGE); - lst.setValue("keyword"); - lstList.add(lst); - kt.setKeyword(lstList); - keyWordTypeList.add(kt); - rval.setKeywords(keyWordTypeList); - - // Profile - List profileList = new ArrayList(); - profileList.add("TBD"); - profileList.add("TBD"); - rval.setProfile(profileList); - - // Service Type - CodeType codeType = new CodeType(); - codeType.setCodeSpace("codetype"); - rval.setServiceType(codeType); - - // Service Type Version - List serviceTypeVersion = new ArrayList(); - serviceTypeVersion.add("servicetypeversion"); - rval.setServiceTypeVersion(serviceTypeVersion); - - // Title - lstList = new ArrayList(); - lst = new LanguageStringType(); - lst.setLang(WcsJaxbUtils.DEFAULT_LANGUAGE); - lst.setValue(SERV_TITLE); - lstList.add(lst); - rval.setTitle(lstList); - - return rval; - } - - protected ServiceProvider getServiceProvider( - OgcServiceInfo serviceInfo) { - ServiceProvider rval = new ServiceProvider(); - rval.setProviderName(wcsName); - rval.setServiceContact(getResponsibleParty()); - rval.setProviderSite(getOLR(serviceInfo)); - return rval; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CustomIdMap.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CustomIdMap.java deleted file mode 100644 index 0af4c6a654..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/CustomIdMap.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.provider; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; - -import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -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.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; - -/** - * Mapping of custom identifiers to internally generated URNs - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 31, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CustomIdMap { - - private static final Map externalToInternal; - - private static final Map internalToExternal; - - private static final IUFStatusHandler log = UFStatus - .getHandler(CustomIdMap.class); - - static { - LocalizationFile idMapFile = findConfigFile(); - Map map; - if (idMapFile == null) { - log.warn("Unable to find custom id mapping properties"); - map = new HashMap(0); - } else { - map = loadConfig(idMapFile); - } - externalToInternal = Collections.unmodifiableMap(map); - internalToExternal = Collections.unmodifiableMap(reverseMap(map)); - } - - /** - * Find configuration file in localization - * - * @return null if not found - */ - private static LocalizationFile findConfigFile() { - IPathManager pm = PathManagerFactory.getPathManager(); - LocalizationContext[] searchHierarchy = pm - .getLocalSearchHierarchy(LocalizationType.EDEX_STATIC); - - for (LocalizationContext ctx : searchHierarchy) { - LocalizationFile localizationFile = pm.getLocalizationFile(ctx, - "wcs" + IPathManager.SEPARATOR - + "wcsIdentifier.properties"); - if (localizationFile.exists()) { - return localizationFile; - } - } - return null; - } - - /** - * Load map from config - * - * @param idMapFile - * @return - */ - private static Map loadConfig(LocalizationFile idMapFile) { - Properties props = new Properties(); - File file = idMapFile.getFile(); - try { - props.load(new FileInputStream(file)); - } catch (Exception e) { - log.error("Unable to load WCS id map: " + file, e); - return new HashMap(0); - } - // TODO validate entries - Map rval = new HashMap(props.size()); - for (Entry e : props.entrySet()) { - rval.put(e.getKey().toString(), e.getValue().toString()); - } - return rval; - } - - /** - * Return a map of values to keys. - * - * @param map - * @return - */ - private static Map reverseMap(Map map) { - Map rval = new HashMap(map.size()); - for (Entry e : map.entrySet()) { - rval.put(e.getValue(), e.getKey()); - } - return rval; - } - - /** - * @param id - * @return id if no mapping exists - */ - public static String internalToExternal(String id) { - String rval = internalToExternal.get(id); - if (rval == null) { - return id; - } - return rval; - } - - /** - * @param id - * @return id if no mapping exists - */ - public static String externalToInternal(String id) { - String rval = externalToInternal.get(id); - if (rval == null) { - return id; - } - return rval; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/DescCoverageBuilder.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/DescCoverageBuilder.java deleted file mode 100644 index 9b0dbedbee..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/DescCoverageBuilder.java +++ /dev/null @@ -1,408 +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.edex.wcs.provider; - -import static com.raytheon.uf.edex.wcs.provider.WcsJaxbUtils.getAsLangString; -import static com.raytheon.uf.edex.wcs.provider.WcsJaxbUtils.getKeywords; - -import java.math.BigInteger; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.TimeZone; - -import javax.xml.bind.JAXBElement; - -import net.opengis.gml.v_3_1_1.PolygonType; -import net.opengis.gml.v_3_1_1.TimePositionType; -import net.opengis.ows.v_1_1_0.AllowedValues; -import net.opengis.ows.v_1_1_0.AnyValue; -import net.opengis.ows.v_1_1_0.BoundingBoxType; -import net.opengis.ows.v_1_1_0.CodeType; -import net.opengis.ows.v_1_1_0.DomainMetadataType; -import net.opengis.ows.v_1_1_0.ObjectFactory; -import net.opengis.ows.v_1_1_0.UnNamedDomainType; -import net.opengis.ows.v_1_1_0.ValueType; -import net.opengis.wcs.v_1_1_2.AvailableKeys; -import net.opengis.wcs.v_1_1_2.AxisType; -import net.opengis.wcs.v_1_1_2.CoverageDescriptionType; -import net.opengis.wcs.v_1_1_2.CoverageDomainType; -import net.opengis.wcs.v_1_1_2.FieldType; -import net.opengis.wcs.v_1_1_2.GridCrsType; -import net.opengis.wcs.v_1_1_2.InterpolationMethodType; -import net.opengis.wcs.v_1_1_2.InterpolationMethods; -import net.opengis.wcs.v_1_1_2.RangeType; -import net.opengis.wcs.v_1_1_2.SpatialDomainType; -import net.opengis.wcs.v_1_1_2.TimePeriodType; -import net.opengis.wcs.v_1_1_2.TimeSequenceType; - -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.jvnet.ogc.gml.v_3_1_1.jts.JTSToGML311CoordinateConverter; -import org.jvnet.ogc.gml.v_3_1_1.jts.JTSToGML311LinearRingConverter; -import org.jvnet.ogc.gml.v_3_1_1.jts.JTSToGML311PolygonConverter; -import org.jvnet.ogc.gml.v_3_1_1.jts.JTSToGML311SRSReferenceGroupConverter; - -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.CrsLookup; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate; -import com.raytheon.uf.edex.wcs.reg.CoverageDescription; -import com.raytheon.uf.edex.wcs.reg.RangeAxis; -import com.raytheon.uf.edex.wcs.reg.RangeField; -import com.raytheon.uf.edex.wcs.reg.RangeField.InterpolationType; -import com.raytheon.uf.edex.wcs.reg.RangeFieldDefinition; -import com.vividsolutions.jts.geom.Polygon; - -/** - * - * @author bclement - * @version 1.0 - */ -public class DescCoverageBuilder { - - protected ObjectFactory owsFactory = new ObjectFactory(); - - protected org.jvnet.ogc.gml.v_3_1_1.ObjectFactory gmlFactory = new org.jvnet.ogc.gml.v_3_1_1.ObjectFactory(); - - protected List formats; - - protected JTSToGML311PolygonConverter polyConverter; - - /** - * @param formats - */ - public DescCoverageBuilder(List formats) { - super(); - this.formats = formats; - JTSToGML311SRSReferenceGroupConverter srsConv = new JTSToGML311SRSReferenceGroupConverter(); - JTSToGML311CoordinateConverter coordConv = new JTSToGML311CoordinateConverter( - gmlFactory, srsConv); - JTSToGML311LinearRingConverter ringConv = new JTSToGML311LinearRingConverter( - gmlFactory, srsConv, coordConv); - polyConverter = new JTSToGML311PolygonConverter(gmlFactory, srsConv, - ringConv); - } - - protected List> getBboxes(List bboxes) { - if (bboxes == null) { - return null; - } - List> rval = new ArrayList>(bboxes.size()); - for (Composite3DBoundingBox from : bboxes) { - BoundingBoxType to = owsFactory.createBoundingBoxType(); - ReferencedEnvelope horiz = from.getHorizontal(); - List lc = new ArrayList(3); - List uc = new ArrayList(3); - lc.add(horiz.getMinX()); - lc.add(horiz.getMinY()); - uc.add(horiz.getMaxX()); - uc.add(horiz.getMaxY()); - if (from.hasVertical()) { - VerticalCoordinate vert = from.getVertical(); - lc.add(vert.getMin()); - uc.add(vert.getMax()); - } - to.setUpperCorner(uc); - to.setLowerCorner(lc); - to.setCrs(CrsLookup.createCrsURN(from)); - to.setDimensions(BigInteger.valueOf(lc.size())); - rval.add(owsFactory.createBoundingBox(to)); - } - return rval; - } - - protected PolygonType transform(Polygon p) { - if (p == null) { - return null; - } - return polyConverter.createGeometryType(p); - } - - protected List getPolys(Polygon... poly) { - if (poly == null) { - return null; - } - List rval = new ArrayList(poly.length); - for (Polygon p : poly) { - rval.add(transform(p)); - } - return rval; - } - - protected SpatialDomainType getSpatialDomain(CoverageDescription desc) { - SpatialDomainType rval = new SpatialDomainType(); - List> bboxes = getBboxes(desc.getBboxes()); - if (bboxes != null) { - rval.setBoundingBox(bboxes); - } - rval.setPolygon(getPolys(desc.getPolygon())); - rval.setGridCRS(getGridCrs(desc)); - return rval; - } - - /** - * @param dimentions - * @param gridBaseCrs - * @return - */ - protected GridCrsType getGridCrs(CoverageDescription desc) { - GridCrsType rval = new GridCrsType(); - rval.setGridBaseCRS(desc.getGridBaseCrs()); - rval.setGridType(desc.getGridType()); - List gridOrigin = desc.getGridOrigin(); - if (gridOrigin != null) { - rval.setGridOrigin(gridOrigin); - } - List gridOffsets = desc.getGridOffsets(); - if (gridOffsets != null) { - rval.setGridOffsets(gridOffsets); - } - rval.setGridCS(desc.getGridCs()); - - return rval; - } - - private static final ThreadLocal ISO_FORMAT = new ThreadLocal() { - - /* - * (non-Javadoc) - * - * @see java.lang.ThreadLocal#initialValue() - */ - @Override - protected SimpleDateFormat initialValue() { - SimpleDateFormat rval = new SimpleDateFormat( - "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - rval.setTimeZone(TimeZone.getTimeZone("GMT")); - return rval; - } - - }; - - protected TimePositionType transform(Date time) { - TimePositionType rval = new TimePositionType(); - // client can't parse all ISO 8601, and it's our problem for some reason - // String timeStr = LayerTransformer.format(time); - String timeStr = ISO_FORMAT.get().format(time); - rval.setValue(Arrays.asList(timeStr)); - return rval; - } - - protected TimeSequenceType getTimeSequence(List times) { - if (times == null) { - return null; - } - TimeSequenceType timeSequence = new TimeSequenceType(); - List rval = new ArrayList(times.size()); - for (DataTime time : times) { - if (time.getUtilityFlags().contains(DataTime.FLAG.PERIOD_USED)) { - TimePeriodType tp = new TimePeriodType(); - TimeRange vp = time.getValidPeriod(); - tp.setBeginPosition(transform(vp.getStart())); - tp.setEndPosition(transform(vp.getEnd())); - tp.setTimeResolution("PT0S"); - rval.add(tp); - } else { - rval.add(transform(time.getRefTime())); - } - } - timeSequence.setTimePositionOrTimePeriod(rval); - return timeSequence; - } - - protected CoverageDomainType getDomain(CoverageDescription desc) { - CoverageDomainType coverageDomain = new CoverageDomainType(); - coverageDomain.setSpatialDomain(getSpatialDomain(desc)); - coverageDomain.setTemporalDomain(getTimeSequence(desc.getTimes())); - return coverageDomain; - } - - public CoverageDescriptionType getCoverageDescriptionType( - CoverageDescription description) { - CoverageDescriptionType cdt = new CoverageDescriptionType(); - cdt.setIdentifier(description.getIdentifier()); - cdt.setTitle(getAsLangString(description.getTitle())); - cdt.setAbstract(getAsLangString(description.getAbstractStr())); - if (description.getKeywords() != null) { - cdt.setKeywords(getKeywords(description.getKeywords())); - } - cdt.setSupportedCRS(description.getCrs()); - cdt.setSupportedFormat(formats); - cdt.setDomain(getDomain(description)); - cdt.setRange(getRange(description.getRangeFields())); - return cdt; - } - - protected ValueType getAsValue(Object obj) { - if (obj == null) { - return null; - } - ValueType rval = new ValueType(); - rval.setValue(obj.toString()); - return rval; - } - - protected DomainMetadataType getUnits(String units) { - if (units == null) { - return null; - } - DomainMetadataType uom = new DomainMetadataType(); - uom.setValue(units); - return uom; - } - - protected AllowedValues getAllowedValues(RangeFieldDefinition def) { - AllowedValues values = new AllowedValues(); - net.opengis.ows.v_1_1_0.RangeType range = new net.opengis.ows.v_1_1_0.RangeType(); - range.setMaximumValue(getAsValue(def.getMaxValue())); - range.setMinimumValue(getAsValue(def.getMinValue())); - values.setValueOrRange(Arrays.asList((Object) range)); - return values; - } - - protected UnNamedDomainType getUnamed(RangeFieldDefinition def) { - UnNamedDomainType rval = new UnNamedDomainType(); - if (def == null) { - rval.setAnyValue(new AnyValue()); - } else { - rval.setAllowedValues(getAllowedValues(def)); - rval.setUOM(getUnits(def.getUnits())); - } - return rval; - } - - protected FieldType transform(RangeField from) { - if (from == null) { - return null; - } - FieldType rval = new FieldType(); - - rval.setIdentifier(from.getIdentifier()); - rval.setDefinition(getUnamed(from.getDefinition())); - rval.setInterpolationMethods(getInterps(from.getDefaultInterpolation(), - from.getAdditionalInterpolations())); - if (from.getAxis() != null) { - rval.setAxis(getAxis(from.getAxis())); - } - if (from.getNullValue() != null) { - rval.setNullValue(getNullValues(from.getNullValue())); - } - return rval; - } - - /** - * @param nullValue - * @return - */ - protected List getNullValues(String... nullValue) { - if (nullValue == null) { - return null; - } - List rval = new ArrayList(nullValue.length); - for (String val : nullValue) { - CodeType code = new CodeType(); - code.setValue(val); - rval.add(code); - } - return rval; - } - - protected AvailableKeys getKeys(Set keys) { - if (keys == null) { - return null; - } - AvailableKeys rval = new AvailableKeys(); - rval.setKey(new ArrayList(keys)); - return rval; - } - - /** - * @param axis - * @return - */ - private List getAxis(List axis) { - if (axis == null) { - return null; - } - List rval = new ArrayList(axis.size()); - for (RangeAxis ra : axis) { - AxisType at = new AxisType(); - at.setIdentifier(ra.getIdentifier()); - at.setAvailableKeys(getKeys(ra.getKeys())); - rval.add(at); - } - return rval; - } - - protected List transform( - List from) { - if (from == null) { - return null; - } - List rval = new ArrayList( - from.size()); - for (InterpolationType type : from) { - InterpolationMethodType method = new InterpolationMethodType(); - method.setValue(type.toString()); - rval.add(method); - } - return rval; - } - - /** - * @param defaultInterpolation - * @param additionalInterpolations - * @return - */ - protected InterpolationMethods getInterps(InterpolationType defaultInt, - List additional) { - InterpolationMethods rval = new InterpolationMethods(); - if (defaultInt == null) { - defaultInt = InterpolationType.none; - } - rval.setDefault(defaultInt.toString()); - if (additional != null) { - rval.setInterpolationMethod(transform(additional)); - } - return rval; - } - - /** - * @param rangeFields - * @return - */ - protected RangeType getRange(List rangeFields) { - if (rangeFields == null) { - return null; - } - List rval = new ArrayList(rangeFields.size()); - for (RangeField rf : rangeFields) { - rval.add(transform(rf)); - } - RangeType rt = new RangeType(); - rt.setField(rval); - return rt; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OgcWcsProvider.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OgcWcsProvider.java deleted file mode 100644 index 1478440889..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OgcWcsProvider.java +++ /dev/null @@ -1,830 +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.edex.wcs.provider; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import javax.xml.bind.DatatypeConverter; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; - -import net.opengis.gml.v_3_1_1.TimePositionType; -import net.opengis.ows.v_1_1_0.AbstractReferenceBaseType; -import net.opengis.ows.v_1_1_0.BoundingBoxType; -import net.opengis.ows.v_1_1_0.CodeType; -import net.opengis.ows.v_1_1_0.ExceptionReport; -import net.opengis.ows.v_1_1_0.ExceptionType; -import net.opengis.ows.v_1_1_0.GetCapabilitiesType; -import net.opengis.ows.v_1_1_0.ReferenceGroupType; -import net.opengis.ows.v_1_1_0.ReferenceType; -import net.opengis.wcs.v_1_1_2.AxisSubset; -import net.opengis.wcs.v_1_1_2.Capabilities; -import net.opengis.wcs.v_1_1_2.CoverageDescriptionType; -import net.opengis.wcs.v_1_1_2.CoverageDescriptions; -import net.opengis.wcs.v_1_1_2.CoveragesType; -import net.opengis.wcs.v_1_1_2.DescribeCoverage; -import net.opengis.wcs.v_1_1_2.GetCapabilities; -import net.opengis.wcs.v_1_1_2.GetCoverage; -import net.opengis.wcs.v_1_1_2.ObjectFactory; -import net.opengis.wcs.v_1_1_2.RangeSubsetType; -import net.opengis.wcs.v_1_1_2.RangeSubsetType.FieldSubset; -import net.opengis.wcs.v_1_1_2.TimePeriodType; -import net.opengis.wcs.v_1_1_2.TimeSequenceType; - -import org.apache.commons.codec.binary.Base64InputStream; -import org.apache.cxf.helpers.IOUtils; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.ogc.common.OgcBoundingBox; -import com.raytheon.uf.edex.ogc.common.OgcNamespace; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcPrefix; -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcResponse.ErrorType; -import com.raytheon.uf.edex.ogc.common.OgcResponse.TYPE; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.http.EndpointInfo; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager; -import com.raytheon.uf.edex.ogc.common.output.IOgcHttpResponse; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.CrsLookup; -import com.raytheon.uf.edex.wcs.CoverageStoreEndpoint; -import com.raytheon.uf.edex.wcs.CoveragesHolder; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.raytheon.uf.edex.wcs.WcsProvider; -import com.raytheon.uf.edex.wcs.format.IWcsDataFormatter; -import com.raytheon.uf.edex.wcs.reg.Coverage; -import com.raytheon.uf.edex.wcs.reg.CoverageDescription; -import com.raytheon.uf.edex.wcs.reg.IWcsSource; -import com.raytheon.uf.edex.wcs.reg.RangeAxis; -import com.raytheon.uf.edex.wcs.reg.RangeField; -import com.raytheon.uf.edex.wcs.reg.RangeField.InterpolationType; -import com.raytheon.uf.edex.wcs.reg.WcsSourceAccessor; -import com.raytheon.uf.edex.wcs.request.DescCoverageRequest; -import com.raytheon.uf.edex.wcs.request.GetCapRequest; -import com.raytheon.uf.edex.wcs.request.GetCoverageRequest; -import com.raytheon.uf.edex.wcs.request.WcsRequest; -import com.raytheon.uf.edex.wcs.request.WcsRequest.Type; -import com.vividsolutions.jts.geom.Envelope; - -/** - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 
- * 
- * - * @author cwmitche - * @version 1 - */ -public class OgcWcsProvider implements WcsProvider { - - public enum WcsOpType { - GetCapabilities, GetCoverage, DescribeCoverage - } - - protected static final String version = "1.1.2"; - - protected static final String svcTitle = "EDEX Coverage Server"; - - protected final OgcJaxbManager jaxbManager; - - protected final String COVERAGE_ID = "cid:Coverage-"; - - protected final IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - private volatile DescCoverageBuilder _descCoverage; - - private volatile CapabilitiesBuilder _capbuilder; - - protected boolean base64 = true; - - protected final net.opengis.ows.v_1_1_0.ObjectFactory owsFactory = new net.opengis.ows.v_1_1_0.ObjectFactory(); - - protected final ObjectFactory wcsFactory = new ObjectFactory(); - - protected static final Map NS_MAP = new ConcurrentHashMap(); - - private int restPort = 8085; - - private String covStorePath = "coverage"; - - static { - NS_MAP.put(OgcNamespace.EDEX, OgcPrefix.EDEX); - NS_MAP.put(OgcNamespace.GML, OgcPrefix.GML); - NS_MAP.put(OgcNamespace.OGC, OgcPrefix.OGC); - NS_MAP.put(OgcNamespace.OWS110, OgcPrefix.OWS); - NS_MAP.put(OgcNamespace.WFS, OgcPrefix.WFS); - NS_MAP.put(OgcNamespace.XSI, OgcPrefix.XSI); - NS_MAP.put(OgcNamespace.WCS112, OgcPrefix.WCS); - NS_MAP.put(OgcNamespace.XLINK, OgcPrefix.XLINK); - } - - public OgcWcsProvider(OgcJaxbManager manager) throws JAXBException { - this.jaxbManager = manager; - jaxbManager.setPrefixMap(NS_MAP); - } - - protected DescCoverageBuilder getCoverageBuilder() { - if (_descCoverage == null) { - synchronized (wcsFactory) { - if (_descCoverage == null) { - List formats = WcsSourceAccessor.getFormats(); - if (formats.isEmpty()) { - // don't remember list if empty, may not be initialized - // yet - return new DescCoverageBuilder(formats); - } else { - _descCoverage = new DescCoverageBuilder(formats); - } - } - } - } - return _descCoverage; - } - - protected CapabilitiesBuilder getCapBuilder() { - if (_capbuilder == null) { - synchronized (wcsFactory) { - if (_capbuilder == null) { - List formats = WcsSourceAccessor.getFormats(); - if (formats.isEmpty()) { - // don't remember list if empty, may not be initialized - // yet - return new CapabilitiesBuilder(formats); - } else { - _capbuilder = new CapabilitiesBuilder(formats); - } - } - } - } - return _capbuilder; - } - - @Override - public OgcResponse describeCoverageType( - OgcServiceInfo serviceinfo, DescCoverageRequest request) { - CoverageDescriptions rval; - try { - rval = describeCoverage(serviceinfo, request); - return marshalResponse(rval); - } catch (WcsException e) { - return getError(e, request.getExceptionFormat()); - } - } - - public CoverageDescriptions describeCoverage(EndpointInfo info, - DescCoverageRequest request) throws WcsException { - return describeCoverage(getServiceInfo(info), request); - } - - public CoverageDescriptions describeCoverage( - OgcServiceInfo serviceinfo, DescCoverageRequest request) - throws WcsException { - - CoverageDescriptions rval = new CoverageDescriptions(); - String[] externalIds = request.getExternalIds(); - List descs = null; - if (externalIds == null) { - throw new WcsException(Code.MissingParameterValue); - } - String[] internalIds = request.getInternalIds(); - descs = new ArrayList(externalIds.length); - for (int i = 0; i < externalIds.length; ++i) { - String external = externalIds[i]; - String internal = internalIds[i]; - descs.add(descCov(external, internal)); - } - rval.setCoverageDescription(descs); - return rval; - } - - protected CoverageDescriptionType descCov(String externalId, - String internalId) throws WcsException { - IWcsSource source = WcsSourceAccessor.getSource(internalId); - if (source == null) { - throw new WcsException(Code.InvalidParameterValue, - "Coverage ID not found"); - } - CoverageDescription cd = source.describeCoverage(internalId); - cd.setIdentifier(externalId); - return getCoverageBuilder().getCoverageDescriptionType(cd); - } - - @Override - public OgcResponse getCapabilities(OgcServiceInfo serviceinfo, - GetCapRequest request) { - Capabilities capabilities = getCapBuilder().getCapabilities( - serviceinfo, WcsSourceAccessor.getCoverages(true)); - return marshalResponse(capabilities); - } - - public Capabilities getCapabilities(EndpointInfo info, - GetCapabilities request) { - return getCapBuilder().getCapabilities(getServiceInfo(info), - getCoverages(true)); - } - - /** - * @param summary - * @return list of coverages with mapped identifiers - */ - private List getCoverages(boolean summary) { - List coverages = WcsSourceAccessor - .getCoverages(true); - for (CoverageDescription desc : coverages) { - String id = CustomIdMap.internalToExternal(desc.getIdentifier()); - desc.setIdentifier(id); - } - return coverages; - } - - private OgcServiceInfo getServiceInfo(EndpointInfo info) { - int port = info.getPort(); - String base = "http://" + info.getHost(); - if (port != 80) { - base += ":" + port; - } - base += info.getPath(); - OgcServiceInfo rval = new OgcServiceInfo(base); - rval.addOperationInfo(getOp(base, base, WcsOpType.GetCapabilities, info)); - rval.addOperationInfo(getOp(base, base, WcsOpType.DescribeCoverage, - info)); - rval.addOperationInfo(getOp(base, base, WcsOpType.GetCoverage, info)); - return rval; - } - - protected OgcOperationInfo getOp(String get, String post, - WcsOpType type, EndpointInfo info) { - OgcOperationInfo rval = new OgcOperationInfo(type); - rval.setHttpBaseHostname(info.getHost()); - if (!info.isPostOnly()) { - rval.setHttpGetRes(get); - } - rval.setHttpPostRes(post); - rval.addVersion(version); - rval.addAcceptVersions(version); - rval.addService("WCS"); - rval.addFormat("text/xml"); - rval.setPostEncoding(info.getEncoding()); - return rval; - } - - public CoveragesHolder getCoverage(EndpointInfo info, - GetCoverageRequest request) throws WcsException { - String format = request.getFormat(); - // try fast lookup first - Map formatMap = WcsSourceAccessor - .getFormatMap(); - IWcsDataFormatter formatter = formatMap.get(format); - if (formatter == null) { - // check to see if any formatter handles it - for (Entry e : formatMap.entrySet()) { - if (e.getValue().matchesFormat(format)) { - formatter = e.getValue(); - break; - } - } - if (formatter == null) { - // no match found - throw new WcsException(Code.InvalidFormat); - } - - } - String externalId = request.getExternalId(); - Coverage coverage = requestCoverage(request); - coverage.setName(CustomIdMap.internalToExternal(coverage.getName())); - CoveragesHolder holder = new CoveragesHolder(); - holder.setContentType(format); - Map data = new HashMap(); - String href; - if (request.isStore()) { - try { - File f = formatter.store(coverage); - href = String.format("http://%s:%d/%s?%s=%s", info.getHost(), - restPort, covStorePath, - CoverageStoreEndpoint.ID_HEADER, f.getName()); - } catch (Exception e) { - log.error("Problem formatting coverage", e); - throw new WcsException(Code.InternalServerError); - } - } else { - href = getCoverageId(externalId); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - InputStream in = null; - try { - in = formatter.format(coverage); - IOUtils.copy(in, out); - out.flush(); - } catch (Exception e) { - log.error("Problem formatting coverage", e); - throw new WcsException(Code.InternalServerError); - } finally { - close(in, out); - } - data.put(href, out.toByteArray()); - } - CoveragesType rval = getCoverageOgcResponse(externalId, href); - holder.setMetadata(rval); - holder.setData(data); - return holder; - } - - private Coverage requestCoverage(GetCoverageRequest request) - throws WcsException { - String id = request.getInternalId(); - IWcsSource source = WcsSourceAccessor.getSource(id); - if (source == null) { - throw new WcsException(Code.InvalidParameterValue, - "Coverage ID not found"); - } - Composite3DBoundingBox bbox = request.getBbox(); - return source.getCoverage(id, request.getTimeSequence(), bbox, - request.getFields()); - } - - private void close(InputStream in, OutputStream out) { - try { - if (in != null) { - in.close(); - } - if (out != null) { - out.close(); - } - } catch (Throwable t) { - log.error("Unable to close streams", t); - } - } - - @Override - public void getCoverage(OgcServiceInfo serviceinfo, - GetCoverageRequest request, IOgcHttpResponse httpResp) { - try { - String format = request.getFormat(); - IWcsDataFormatter formatter = WcsSourceAccessor.getFormatMap().get( - format); - if (formatter == null) { - throw new WcsException(Code.InvalidFormat); - } - String externalId = request.getExternalId(); - Coverage coverage = requestCoverage(request); - coverage.setName(CustomIdMap.internalToExternal(coverage.getName())); - CoveragesType coveragesType = getCoverageOgcResponse(externalId, - getCoverageId(externalId)); - - try { - // FIXME this code block makes my eyes bleed, needs to be - // refactored - OutputStream out = httpResp.getOutputStream(); - if (request.isDefacto()) { - httpResp.setContentType(formatter.getIdentifier()); - InputStream in = formatter.format(coverage); - if (base64) { - in = new Base64InputStream(in, true); - } - IOUtils.copy(in, out); - out.flush(); - out.close(); - in.close(); - return; - } - long timestamp = System.currentTimeMillis(); - String part = "_Part_" + timestamp; - httpResp.setContentType("multipart/related;boundary=" + part); - - PrintStream stream = new PrintStream(out); - String cid = getCoverageId(externalId); - - stream.println("--" + part); - stream.println("Content-Type: text/xml"); - stream.println("Content-ID: "); - stream.println(); - stream.println(jaxbManager.marshal(wcsFactory - .createCoverages(coveragesType))); - stream.println("--" + part); - stream.println("Content-Type: " + formatter.getIdentifier()); - if (base64) { - stream.println("Content-Transfer-Encoding: base64"); - } - stream.println("Content-ID: <" + cid + ">"); - stream.println(); - stream.flush(); - InputStream in = formatter.format(coverage); - if (base64) { - in = new Base64InputStream(in, true); - } - IOUtils.copy(in, out); - out.flush(); - out.close(); - in.close(); - } catch (Exception e) { - log.error("Problem formatting coverage", e); - throw new WcsException(Code.InternalServerError); - } - } catch (WcsException e) { - sendTextResponse(httpResp, - getError(e, request.getExceptionFormat())); - } - } - - protected void sendTextResponse(IOgcHttpResponse httpRes, - OgcResponse response) { - MimeType mimetype = response.getMimetype(); - httpRes.setContentType(mimetype.toString()); - try { - Writer writer = new OutputStreamWriter(httpRes.getOutputStream()); - writer.write(response.getBody().toString()); - writer.close(); - } catch (IOException e) { - log.error("Problem sending response", e); - } - } - - /** - * @param bbox - * @return - * @throws WcsException - */ - protected Envelope getEnvelope(OgcBoundingBox bbox) throws WcsException { - if (bbox == null) { - throw new WcsException(Code.MissingParameterValue, - "Missing bounding box"); - } - return new Envelope(bbox.getMinx(), bbox.getMaxx(), bbox.getMiny(), - bbox.getMaxy()); - } - - /** - * @param bbox - * @return - * @throws WcsException - */ - protected CoordinateReferenceSystem getCrs(OgcBoundingBox bbox) - throws WcsException { - if (bbox != null) { - try { - return CrsLookup.lookup(bbox.getCrs()); - } catch (Exception e) { - log.error("Unable to decode crs: " + bbox.getCrs(), e); - } - } - throw new WcsException(Code.MissingParameterValue, - "Missing bounding box."); - } - - protected String getCoverageId(String identifier) { - return COVERAGE_ID + identifier; - } - - protected CoveragesType getCoverageOgcResponse(String identifier, - String href) { - - CoveragesType coverages = new CoveragesType(); - List coverageList = new ArrayList(); - ReferenceGroupType rgt = new ReferenceGroupType(); - - // Abstract - // rgt.setAbstract(WcsJaxbUtils.getAsLangString("Abstract for " - // + request.getIdentifier())); - // Title - // rgt.setTitle(WcsJaxbUtils.getAsLangString(request.getIdentifier())); - - // Identifier - CodeType ident = new CodeType(); - ident.setValue(identifier); - rgt.setIdentifier(ident); - - // Data reference - ReferenceType rt = new ReferenceType(); - rt.setHref(href); - - List> refTypeList = new ArrayList>(); - refTypeList.add(owsFactory.createReference(rt)); - rgt.setAbstractReferenceBase(refTypeList); - coverageList.add(rgt); - coverages.setCoverage(coverageList); - - return coverages; - - } - - @Override - public OgcResponse getError(WcsException e, MimeType exceptionFormat) { - - net.opengis.ows.v_1_1_0.ExceptionType et = new ExceptionType(); - et.setExceptionCode(e.getCode().toString()); - et.setExceptionText(getAsList(e.getMessage())); - net.opengis.ows.v_1_1_0.ExceptionReport report = new ExceptionReport(); - report.setException(getAsList(et)); - String rval = ""; - MimeType mimeType = OgcResponse.TEXT_XML_MIME; - if (exceptionFormat.equalsIgnoreParams(OgcResponse.TEXT_XML_MIME)) { - try { - rval = jaxbManager.marshal(report); - mimeType = OgcResponse.TEXT_XML_MIME; - } catch (JAXBException e1) { - log.error("Unable to marshal WCS response", e1); - rval = ""; - rval += ""; - rval += "" + e.getMessage() - + ""; - rval += ""; - mimeType = OgcResponse.TEXT_XML_MIME; - } - } else if (exceptionFormat - .equalsIgnoreParams(OgcResponse.TEXT_HTML_MIME)) { - rval = ""; - rval += "
An error occurred performing the request:
"; - rval += "
Error Code: " + e.getCode().toString(); - rval += "
Message: " + e.getMessage() + ""; - mimeType = OgcResponse.TEXT_HTML_MIME; - } - - OgcResponse resp = new OgcResponse(rval, mimeType, TYPE.TEXT); - switch (e.getCode()) { - case InternalServerError: - resp.setError(ErrorType.INT_ERR); - break; - case OperationNotSupported: - resp.setError(ErrorType.NOT_IMPLEMENTED); - break; - default: - resp.setError(ErrorType.BAD_REQ); - } - return resp; - } - - protected net.opengis.wms.v_1_3_0.Exception getExceptionInfo() { - net.opengis.wms.v_1_3_0.Exception rval = new net.opengis.wms.v_1_3_0.Exception(); - rval.setFormat(getAsList("XML")); - return rval; - } - - @Override - public WcsRequest getRequest(InputStream in) { - Object obj; - WcsRequest rval; - try { - String xml = getXml(in); - obj = jaxbManager.unmarshal(xml); - rval = getType(obj); - } catch (Throwable e) { - log.error("Unable to decode request", e); - rval = new WcsRequest(Type.ERROR); - } - if (rval.getType().equals(Type.ERROR)) { - OgcResponse error = getError(new WcsException(Code.InvalidRequest, - "Unable to decode request"), OgcResponse.TEXT_XML_MIME); - rval.setRequest(error); - } - return rval; - } - - public List getAsList(T... args) { - List rval = new LinkedList(); - for (T t : args) { - rval.add(t); - } - return rval; - } - - protected WcsRequest getType(Object obj) { - WcsRequest rval; - if (obj instanceof GetCapabilitiesType) { - rval = new GetCapRequest(); - } else if (obj instanceof GetCoverage) { - rval = unwrap((GetCoverage) obj); - } else if (obj instanceof DescribeCoverage) { - DescribeCoverage req = (DescribeCoverage) obj; - List ids = req.getIdentifier(); - DescCoverageRequest dcr = new DescCoverageRequest(); - dcr.setIdentifiers(ids); - rval = dcr; - } else { - rval = new WcsRequest(Type.ERROR); - } - return rval; - } - - /** - * @param obj - * @return - */ - protected WcsRequest unwrap(GetCoverage req) { - try { - return new GetCoverageRequest(req); - } catch (WcsException e) { - WcsRequest rval = new WcsRequest(Type.ERROR); - rval.setRequest(e); - return rval; - } - } - - protected List transform(RangeSubsetType subset) { - if (subset == null) { - return null; - } - List fields = subset.getFieldSubset(); - if (fields == null || fields.isEmpty()) { - return null; - } - List rval = new ArrayList(fields.size()); - for (FieldSubset fs : fields) { - rval.add(transform(fs)); - } - return rval; - } - - protected RangeField transform(FieldSubset fs) { - String id = fs.getIdentifier().getValue(); - - RangeField rval = new RangeField(id, null); - String interp = fs.getInterpolationType(); - if (interp != null) { - rval.setDefaultInterpolation(InterpolationType.valueOf(interp)); - } - rval.setAxis(transform(fs.getAxisSubset())); - return rval; - } - - /** - * @param axisSubset - * @return - */ - protected List transform(List axisSubset) { - if (axisSubset == null || axisSubset.isEmpty()) { - return null; - } - List rval = new ArrayList(axisSubset.size()); - for (AxisSubset as : axisSubset) { - Set keys = new HashSet(as.getKey()); - rval.add(new RangeAxis(as.getIdentifier(), keys)); - } - return rval; - } - - protected OgcBoundingBox transform(BoundingBoxType bbox) { - OgcBoundingBox rval = new OgcBoundingBox(); - rval.setCrs(bbox.getCrs()); - List lower = bbox.getLowerCorner(); - List upper = bbox.getUpperCorner(); - rval.setMaxx(upper.get(0)); - rval.setMaxy(upper.get(1)); - rval.setMinx(lower.get(0)); - rval.setMiny(lower.get(1)); - return rval; - } - - protected DataTime getTime(TimeSequenceType tst) { - if (tst == null) { - return null; - } - List times = tst.getTimePositionOrTimePeriod(); - if (times == null || times.isEmpty()) { - return null; - } - if (times.size() != 1) { - log.warn("multiple times not supported in request, taking first"); - } - Object timeObj = times.get(0); - return parseTime(timeObj); - } - - protected DataTime parseTime(Object timeObj) { - if (timeObj instanceof TimePositionType) { - TimePositionType pos = (TimePositionType) timeObj; - return new DataTime(getTime(pos)); - } else { - TimePeriodType period = (TimePeriodType) timeObj; - Date start = getTime(period.getBeginPosition()); - Date end = getTime(period.getEndPosition()); - TimeRange range = new TimeRange(start, end); - DataTime rval = new DataTime(start); - rval.setValidPeriod(range); - return rval; - } - } - - protected Date getTime(TimePositionType pos) { - List values = pos.getValue(); - if (values == null || values.isEmpty()) { - log.error("unable to parse time"); - return null; - } - return DatatypeConverter.parseDateTime(values.get(0)).getTime(); - } - - protected String getXml(InputStream in) throws IOException { - - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String rval = ""; - String line = ""; - while ((line = reader.readLine()) != null) { - rval += line + "\n"; - } - return rval; - } - - protected OgcResponse marshalResponse(Object jaxbobject) { - OgcResponse rval; - try { - String xml = jaxbManager.marshal(jaxbobject); - rval = new OgcResponse(xml, OgcResponse.TEXT_XML_MIME, TYPE.TEXT); - } catch (JAXBException e) { - log.error("Unable to marshal WCS response", e); - // TODO: real error code - rval = getError(new WcsException(Code.OperationNotSupported), - OgcResponse.TEXT_XML_MIME); - } - return rval; - } - - public boolean isBase64() { - return base64; - } - - public void setBase64(boolean base64) { - this.base64 = base64; - } - - /** - * @return the restPort - */ - public int getRestPort() { - return restPort; - } - - /** - * @param restPort - * the restPort to set - */ - public void setRestPort(int restPort) { - this.restPort = restPort; - } - - /** - * @return the covStorePath - */ - public String getCovStorePath() { - return covStorePath; - } - - /** - * @param covStorePath - * the covStorePath to set - */ - public void setCovStorePath(String covStorePath) { - this.covStorePath = covStorePath; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OperationsDescriber.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OperationsDescriber.java deleted file mode 100644 index bdc89ac82e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/OperationsDescriber.java +++ /dev/null @@ -1,123 +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.edex.wcs.provider; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import net.opengis.ows.v_1_1_0.DomainType; -import net.opengis.ows.v_1_1_0.ObjectFactory; - -import com.raytheon.uf.edex.ogc.common.AbstractOpDescriber; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.wcs.provider.OgcWcsProvider.WcsOpType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class OperationsDescriber extends AbstractOpDescriber { - - protected ObjectFactory owsFactory = new ObjectFactory(); - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.AbstractOpDescriber#getParams(com.raytheon - * .uf.edex.ogc.common.OgcServiceInfo) - */ - @Override - protected List getParams(OgcServiceInfo serviceinfo) { - // TODO: this info should be passed in from somewhere - List value = new LinkedList(); - value.add("EPSG:4326"); - return Arrays.asList(getAsDomainType("srsName", value)); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.AbstractOpDescriber#getOpParams(com.raytheon - * .uf.edex.ogc.common.OgcOperationInfo) - */ - @Override - protected List getOpParams(OgcOperationInfo op) { - - List opParamList = new ArrayList(); - - switch (op.getType()) { - case GetCapabilities: - opParamList = Arrays.asList( - getAsDomainType("AcceptVersions", op.getVersions()), - getAsDomainType("AcceptFormats", op.getFormats()), - getAsDomainType("service", op.getServices())); - break; - case DescribeCoverage: - opParamList = Arrays.asList( - getAsDomainType("AcceptVersions", op.getVersions()), - getAsDomainType("AcceptFormats", op.getFormats()), - getAsDomainType("service", op.getServices()));// , - // getAsDomainType("Identifier", getLayerIdentifierList())); - break; - case GetCoverage: - opParamList = Arrays - .asList(getAsDomainType("AcceptVersions", op.getVersions()), - getAsDomainType("AcceptFormats", op.getFormats()), - getAsDomainType("service", op.getServices()), - // getAsDomainType("Identifier", - // getLayerIdentifierList()), - getAsDomainType("InterpolationType", - getInterpolationType()), - getAsDomainType("store", - Arrays.asList("true", "false"))); - break; - default: - - } - - return opParamList; - } - - /** - * @return default interpolation types - */ - protected List getInterpolationType() { - List interpolationType = new ArrayList(); - - interpolationType.add("nearest"); - interpolationType.add("linear"); - - return interpolationType; - } - - /** - * @return default formats - */ - protected List getFormat() { - return new ArrayList(); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/WcsJaxbUtils.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/WcsJaxbUtils.java deleted file mode 100644 index bc35e9604a..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/provider/WcsJaxbUtils.java +++ /dev/null @@ -1,63 +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.edex.wcs.provider; - -import java.util.ArrayList; -import java.util.List; - -import net.opengis.ows.v_1_1_0.KeywordsType; -import net.opengis.ows.v_1_1_0.LanguageStringType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class WcsJaxbUtils { - - protected static final String DEFAULT_LANGUAGE = "english"; - - public static List getAsLangString(String... strs) { - if (strs == null) { - return null; - } - List rval = new ArrayList( - strs.length); - for (String str : strs) { - LanguageStringType lst = new LanguageStringType(); - lst.setLang(DEFAULT_LANGUAGE); - lst.setValue(str); - rval.add(lst); - } - return rval; - } - - public static List getKeywords(List strs) { - if (strs == null) { - return null; - } - List rval = new ArrayList(strs.size()); - for (String str : strs) { - KeywordsType kwt = new KeywordsType(); - kwt.setKeyword(getAsLangString(str)); - } - return rval; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/querystore/WcsQueryStore.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/querystore/WcsQueryStore.java deleted file mode 100644 index a645c76d11..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/querystore/WcsQueryStore.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.querystore; - -import java.io.File; - -import javax.xml.bind.JAXBException; - -import net.opengis.wcs.v_1_1_2.GetCoverage; - -import com.raytheon.uf.edex.ogc.common.AbstractFSQueryStore; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcException.Code; -import com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 18, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class WcsQueryStore extends AbstractFSQueryStore { - - private static final String STORE_NAME = "wcsquerystore"; - - protected final OgcJaxbManager jaxbManager; - - /** - * @param registry - * @param storeLocation - * @throws IllegalArgumentException - * if storage location cannot be created or is not a writable - * directory - */ - public WcsQueryStore(OgcJaxbManager jaxbManager, File storeLocation) - throws IllegalArgumentException { - super(storeLocation); - this.jaxbManager = jaxbManager; - } - - public WcsQueryStore(OgcJaxbManager jaxbManager) { - super(findStore(STORE_NAME)); - this.jaxbManager = jaxbManager; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.AbstractFSQueryStore#marshal(java.lang - * .Object) - */ - @Override - protected String marshal(GetCoverage query) throws OgcException { - try { - return jaxbManager.marshal(query); - } catch (JAXBException e) { - throw new OgcException(Code.InternalServerError, e); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.AbstractFSQueryStore#unmarshal(java.lang - * .String) - */ - @Override - protected GetCoverage unmarshal(String xml) throws OgcException { - try { - return (GetCoverage) jaxbManager.unmarshal(xml); - } catch (JAXBException e) { - throw new OgcException(Code.InternalServerError, e); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/Coverage.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/Coverage.java deleted file mode 100644 index 0b73a92a40..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/Coverage.java +++ /dev/null @@ -1,68 +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.edex.wcs.reg; - -import java.util.List; - -/** - * WCS Coverage - * - * @author bclement - * @version 1.0 - */ -public class Coverage { - - private String name; - - private final List fields; - - /** - * @param name - * @param fields - */ - public Coverage(String name, List fields) { - super(); - this.name = name; - this.fields = fields; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the fields - */ - public List getFields() { - return fields; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDescription.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDescription.java deleted file mode 100644 index 78b2dbbbe6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDescription.java +++ /dev/null @@ -1,186 +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.edex.wcs.reg; - -import java.util.List; - -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.OgcGeoBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.vividsolutions.jts.geom.Polygon; - -/** - * - * @author bclement - * @version 1.0 - */ -public class CoverageDescription { - - protected String identifier; - - protected String title; - - protected String abstractStr; - - protected List crs; - - protected List keywords; - - protected List times; - - protected List bboxes; - - protected List rangeFields; - - protected OgcGeoBoundingBox crs84Bbox; - - protected Polygon polygon; - - protected List gridOffsets; - - protected String gridBaseCrs; - - protected String gridType; - - protected String gridCs; - - protected List gridOrigin; - - public OgcGeoBoundingBox getCrs84Bbox() { - return crs84Bbox; - } - - public void setCrs84Bbox(OgcGeoBoundingBox crs84Bbox) { - this.crs84Bbox = crs84Bbox; - } - - public List getGridOrigin() { - return gridOrigin; - } - - public void setGridOrigin(List gridOrigin) { - this.gridOrigin = gridOrigin; - } - - public String getGridType() { - return gridType; - } - - public void setGridType(String gridType) { - this.gridType = gridType; - } - - public String getGridCs() { - return gridCs; - } - - public void setGridCs(String gridCs) { - this.gridCs = gridCs; - } - - public String getGridBaseCrs() { - return gridBaseCrs; - } - - public void setGridBaseCrs(String gridBaseCrs) { - this.gridBaseCrs = gridBaseCrs; - } - - public List getGridOffsets() { - return gridOffsets; - } - - public void setGridOffsets(List offsets) { - this.gridOffsets = offsets; - } - - public Polygon getPolygon() { - return polygon; - } - - public void setPolygon(Polygon polygon) { - this.polygon = polygon; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAbstractStr() { - return abstractStr; - } - - public void setAbstractStr(String abstractStr) { - this.abstractStr = abstractStr; - } - - public List getCrs() { - return crs; - } - - public void setCrs(List crs) { - this.crs = crs; - } - - public List getKeywords() { - return keywords; - } - - public void setKeywords(List keywords) { - this.keywords = keywords; - } - - public List getTimes() { - return times; - } - - public void setTimes(List times) { - this.times = times; - } - - public List getBboxes() { - return bboxes; - } - - public void setBboxes(List bboxes) { - this.bboxes = bboxes; - } - - public List getRangeFields() { - return rangeFields; - } - - public void setRangeFields(List rangeFields) { - this.rangeFields = rangeFields; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDimensions.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDimensions.java deleted file mode 100644 index 1b2e17a036..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageDimensions.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 2, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageDimensions { - - private final CoverageXYAxis xyAxis; - - private final CoverageZAxis zAxis; - - private final CoverageTAxis tAxis; - - /** - * @param xyAxis - * @param zAxis - * @param times - */ - public CoverageDimensions(CoverageXYAxis xyAxis, CoverageZAxis zAxis, - CoverageTAxis tAxis) { - this.xyAxis = xyAxis; - this.zAxis = zAxis; - this.tAxis = tAxis; - } - - /** - * @return the xyAxis - */ - public CoverageXYAxis getXyAxis() { - return xyAxis; - } - - /** - * @return the zAxis - */ - public CoverageZAxis getZAxis() { - return zAxis; - } - - /** - * @return the tAxis - */ - public CoverageTAxis getTAxis() { - return tAxis; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((tAxis == null) ? 0 : tAxis.hashCode()); - result = prime * result + ((xyAxis == null) ? 0 : xyAxis.hashCode()); - result = prime * result + ((zAxis == null) ? 0 : zAxis.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CoverageDimensions other = (CoverageDimensions) obj; - if (tAxis == null) { - if (other.tAxis != null) - return false; - } else if (!tAxis.equals(other.tAxis)) - return false; - if (xyAxis == null) { - if (other.xyAxis != null) - return false; - } else if (!xyAxis.equals(other.xyAxis)) - return false; - if (zAxis == null) { - if (other.zAxis != null) - return false; - } else if (!zAxis.equals(other.zAxis)) - return false; - return true; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageField.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageField.java deleted file mode 100644 index 5c03cc104d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageField.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import java.util.List; - -/** - * 4D coverage for a specific field value - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 2, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageField { - - private String name; - - private String standardName; - - private final List timeCube; - - private final CoverageDimensions dimensions; - - private String units; - - private Number paddingValue; - - /** - * @param timeCube - */ - public CoverageField(List timeCube, CoverageDimensions dims) { - this.timeCube = timeCube; - this.dimensions = dims; - } - - /** - * @return the timeCube - */ - public List getTimeCube() { - return timeCube; - } - - /** - * @return the units - */ - public String getUnits() { - return units; - } - - /** - * @param units - * the units to set - */ - public void setUnits(String units) { - this.units = units; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the standardName - */ - public String getStandardName() { - return standardName; - } - - /** - * @param standardName - * the standardName to set - */ - public void setStandardName(String standardName) { - this.standardName = standardName; - } - - /** - * May be null - * - * @return the paddingValue - */ - public Number getPaddingValue() { - return paddingValue; - } - - /** - * @param paddingValue - * the paddingValue to set - */ - public void setPaddingValue(Number paddingValue) { - this.paddingValue = paddingValue; - } - - /** - * @return the dimensions - */ - public CoverageDimensions getDimensions() { - return dimensions; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTAxis.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTAxis.java deleted file mode 100644 index ac6bcd1a98..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTAxis.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import java.util.Arrays; -import java.util.Date; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 3, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageTAxis { - - private final Date[] times; - - /** - * @param times - */ - public CoverageTAxis(Date[] times) { - this.times = times; - } - - /** - * @return the times - */ - public Date[] getTimes() { - return times; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode(times); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CoverageTAxis other = (CoverageTAxis) obj; - if (!Arrays.equals(times, other.times)) - return false; - return true; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTransform.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTransform.java deleted file mode 100644 index 37f5cd69e3..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageTransform.java +++ /dev/null @@ -1,286 +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.edex.wcs.reg; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.EnumSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.measure.unit.SI; - -import org.apache.commons.lang.StringUtils; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.DataTime.FLAG; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.ogc.common.OgcGeoBoundingBox; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; -import com.raytheon.uf.edex.ogc.common.spatial.AltUtil; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.CrsLookup; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference; -import com.raytheon.uf.edex.plugin.dataset.urn.URNLookup; -import com.raytheon.uf.edex.wcs.WcsConfig; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.LinearRing; - -/** - * - * @author bclement - * @version 1.0 - */ -public abstract class CoverageTransform> { - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - protected String key; - - public CoverageTransform(String key) { - this.key = key; - } - - public List transform(List layers, - boolean summaryOnly) - throws WcsException { - if (layers == null) { - return null; - } - List rval = new ArrayList( - layers.size()); - for (L layer : layers) { - rval.add(transform(layer, summaryOnly)); - } - return rval; - } - - public CoverageDescription transform(L layer, - boolean summaryOnly) throws WcsException { - CoverageDescription rval = new CoverageDescription(); - rval.setIdentifier(URNLookup.localToUrn(layer.getName())); - OgcGeoBoundingBox bbox = LayerTransformer.getGeoBoundingBox(layer); - List bboxes = getBboxes(layer); - if (!bboxes.isEmpty() && WcsConfig.isProperty(WcsConfig.FORCE_KM_BBOX)) { - List newList = new ArrayList( - bboxes.size()); - for (Composite3DBoundingBox box : bboxes) { - if (box.hasVertical()) { - VerticalCoordinate vert = box.getVertical(); - vert = AltUtil.convert(SI.KILOMETER, Reference.UNKNOWN, - vert); - newList.add(new Composite3DBoundingBox(box.getHorizontal(), - box.getNative2DCrsUrn(), vert)); - } else { - newList.add(box); - } - } - bboxes = newList; - } - if (bbox != null) { - rval.setCrs84Bbox(bbox); - rval.setCrs(getSupportedCrsList(layer.getTargetCrsCode(), bboxes)); - } else { - log.warn("Unable to get geographic information for layer: " - + layer.getName()); - } - if (!summaryOnly) { - describe(rval, layer, bboxes); - } - return rval; - } - - /** - * @param rval - * @param layer - * @throws WcsException - */ - protected void describe(CoverageDescription rval, L layer, - List bboxes) throws WcsException { - - rval.setGridOffsets(Arrays.asList((double) layer.getNx(), - (double) layer.getNy())); - - double minx = layer.getTargetMinx(); - double miny = layer.getTargetMiny(); - double maxx = layer.getTargetMaxx(); - double maxy = layer.getTargetMaxy(); - - GeometryFactory geomFact = new GeometryFactory(); - Coordinate[] coords = new Coordinate[5]; - coords[0] = new Coordinate(minx, miny); - coords[1] = new Coordinate(minx, maxy); - coords[2] = new Coordinate(maxx, maxy); - coords[3] = new Coordinate(maxx, miny); - coords[4] = new Coordinate(minx, miny); - - LinearRing ring = geomFact.createLinearRing(coords); - rval.setTimes(getTimes(layer.getTimes(), layer.isTimesAsRanges())); - rval.setRangeFields(getRangeFields(layer)); - rval.setPolygon(geomFact.createPolygon(ring, new LinearRing[0])); - rval.setGridType("urn:ogc:def:method:WCS:1.1:grid2dIn2dMethod"); - rval.setGridOrigin(Arrays.asList(minx, maxy)); - - int nx = layer.getNx(); - int ny = layer.getNy(); - - rval.setGridOffsets(Arrays.asList(getDn(nx, minx, maxx), 0.0, 0.0, - -getDn(ny, miny, maxy))); - rval.setGridCs("urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS"); - - rval.setBboxes(bboxes); - - String targetCrs = translateCrs(layer.getTargetCrsCode()); - rval.setGridBaseCrs(targetCrs); - - //add all the crs' from the bounding boxes - List crs = new ArrayList(Arrays.asList(targetCrs)); - for(Composite3DBoundingBox bBox : bboxes) { - String bBoxCrs = CrsLookup.createCrsURN(bBox); - if(bBoxCrs != null && !crs.contains(bBoxCrs)) { - crs.add(bBoxCrs); - } - } - rval.setCrs(crs); - - } - - /** - * Create a list composed of target crs and bounding box CRS URNs - * - * @param targetCrs - * @param bboxes - * @return - */ - private List getSupportedCrsList(String targetCrs, - List bboxes) { - List rval = new ArrayList(Arrays.asList(targetCrs)); - for (Composite3DBoundingBox bBox : bboxes) { - String bBoxCrs = CrsLookup.createCrsURN(bBox); - if (bBoxCrs != null && !rval.contains(bBoxCrs)) { - rval.add(bBoxCrs); - } - } - return rval; - } - - protected List getBboxes(L layer) - throws WcsException { - Composite3DBoundingBox bbox = new Composite3DBoundingBox( - getHorizontal(layer), getVertical(layer)); - return Arrays.asList(bbox); - } - - /** - * @param layer - * @return null if layer doesn't have vertical information - * @throws WcsException - */ - protected abstract VerticalCoordinate getVertical(L layer) - throws WcsException; - - /** - * @param layer - * @return - * @throws WcsException - */ - protected ReferencedEnvelope getHorizontal(L layer) - throws WcsException { - CoordinateReferenceSystem crs2d; - try { - crs2d = CrsLookup.lookup(layer.getTargetCrsCode()); - } catch (Exception e) { - log.error("Unable to parse target crs", e); - throw new WcsException(Code.InternalServerError); - } - return new ReferencedEnvelope(layer.getTargetMinx(), - layer.getTargetMaxx(), layer.getTargetMiny(), - layer.getTargetMaxy(), crs2d); - } - - protected double getDn(int nn, double n1, double n2) { - return Math.abs(n1 - n2) / (double) nn; - } - - public static String translateCrs(String crs) { - if ( crs == null){ - return null; - } - if (crs.equalsIgnoreCase("crs:84")) { - return "urn:ogc:def:crs:OGC:2:84"; - } - String[] split = crs.split(":"); - List parts = new ArrayList(split.length + 1); - parts.add("urn:ogc:def:crs"); - if (split.length == 2) { - parts.add(split[0]); - parts.add(""); - parts.add(split[1]); - } else { - parts.addAll(Arrays.asList(split)); - } - return StringUtils.join(parts, ":"); - } - - /** - * @param layer - * @return - */ - protected abstract List getRangeFields(L layer); - - protected List getTimes(Set times, boolean asRanges) { - if (times == null || times.isEmpty()) { - return new ArrayList(0); - } - List rval; - if (asRanges) { - rval = new ArrayList((int) Math.ceil(times.size() / 2.0)); - Iterator iter = times.iterator(); - while (iter.hasNext()) { - Date start = iter.next(); - Date end = (iter.hasNext() ? iter.next() : start); - DataTime time = new DataTime(Calendar.getInstance(), - new TimeRange(start, end)); - time.setUtilityFlags(EnumSet.of(FLAG.PERIOD_USED)); - rval.add(time); - } - } else { - rval = new ArrayList(times.size()); - for (Date d : times) { - rval.add(new DataTime(d)); - } - } - - return rval; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageXYAxis.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageXYAxis.java deleted file mode 100644 index 323823a91e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageXYAxis.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.geometry.jts.ReferencedEnvelope; - -/** - * Metadata for coverage X and Y axis - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageXYAxis { - - private final GridGeometry2D gridGeometry; - - private final ReferencedEnvelope envelope; - - /** - * @param gridGeometry - * @param crs - */ - public CoverageXYAxis(GridGeometry2D gridGeometry,ReferencedEnvelope envelope) { - this.gridGeometry = gridGeometry; - this.envelope = envelope; - } - - /** - * @return the gridGeometry - */ - public GridGeometry2D getGridGeometry() { - return gridGeometry; - } - - /** - * @return the envelope - */ - public ReferencedEnvelope getEnvelope() { - return envelope; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((envelope == null) ? 0 : envelope.hashCode()); - result = prime * result - + ((gridGeometry == null) ? 0 : gridGeometry.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CoverageXYAxis other = (CoverageXYAxis) obj; - if (envelope == null) { - if (other.envelope != null) - return false; - } else if (!envelope.equals(other.envelope)) - return false; - if (gridGeometry == null) { - if (other.gridGeometry != null) - return false; - } else if (!gridGeometry.equals(other.gridGeometry)) - return false; - return true; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageZAxis.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageZAxis.java deleted file mode 100644 index 57ba7b47bb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/CoverageZAxis.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import java.util.Arrays; - -/** - * Metadata for coverage Z axis - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 12, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class CoverageZAxis { - - private final double[] value; - - private final String units; - - private final String reference; - - private final boolean upIsPositive; - - /** - * @param value - * @param units - * @param upIsPositive - */ - public CoverageZAxis(double[] value, String units, String reference, - boolean upIsPositive) { - this.value = value; - this.units = units; - this.reference = reference; - this.upIsPositive = upIsPositive; - } - - /** - * @return the value - */ - public double[] getValue() { - return value; - } - - /** - * @return the units - */ - public String getUnits() { - return units; - } - - /** - * @return the upIsPositive - */ - public boolean isUpIsPositive() { - return upIsPositive; - } - - /** - * @return the reference - */ - public String getReference() { - return reference; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((reference == null) ? 0 : reference.hashCode()); - result = prime * result + ((units == null) ? 0 : units.hashCode()); - result = prime * result + (upIsPositive ? 1231 : 1237); - result = prime * result + Arrays.hashCode(value); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CoverageZAxis other = (CoverageZAxis) obj; - if (reference == null) { - if (other.reference != null) - return false; - } else if (!reference.equals(other.reference)) - return false; - if (units == null) { - if (other.units != null) - return false; - } else if (!units.equals(other.units)) - return false; - if (upIsPositive != other.upIsPositive) - return false; - if (!Arrays.equals(value, other.value)) - return false; - return true; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/DefaultWcsSource.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/DefaultWcsSource.java deleted file mode 100644 index 047596863b..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/DefaultWcsSource.java +++ /dev/null @@ -1,1603 +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.edex.wcs.reg; - -import java.awt.Point; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; - -import javax.measure.unit.Unit; - -import org.apache.commons.collections.map.LRUMap; -import org.geotools.coverage.grid.GeneralGridEnvelope; -import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.geometry.DirectPosition2D; -import org.geotools.geometry.GeneralEnvelope; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.hibernate.Criteria; -import org.hibernate.SessionFactory; -import org.hibernate.classic.Session; -import org.hibernate.criterion.Conjunction; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import org.hibernate.criterion.SimpleExpression; -import org.opengis.geometry.DirectPosition; -import org.opengis.geometry.MismatchedDimensionException; -import org.opengis.metadata.spatial.PixelOrientation; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.MathTransform2D; -import org.opengis.referencing.operation.TransformException; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.PluginProperties; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; -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.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.datastorage.records.ShortDataRecord; -import com.raytheon.uf.common.datastorage.records.StringDataRecord; -import com.raytheon.uf.common.geospatial.ISpatialEnabled; -import com.raytheon.uf.common.geospatial.ISpatialObject; -import com.raytheon.uf.common.spatial.reprojection.AbstractDataReprojector.RequestWrapper; -import com.raytheon.uf.common.spatial.reprojection.ByteDataReprojector; -import com.raytheon.uf.common.spatial.reprojection.DataReprojector; -import com.raytheon.uf.common.spatial.reprojection.FloatDataReprojector; -import com.raytheon.uf.common.spatial.reprojection.IntDataReprojector; -import com.raytheon.uf.common.spatial.reprojection.ReferencedDataRecord; -import com.raytheon.uf.common.spatial.reprojection.ShortDataReprojector; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.database.plugin.PluginDao; -import com.raytheon.uf.edex.database.plugin.PluginFactory; -import com.raytheon.uf.edex.ogc.common.AbstractOgcSource; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.PeekingIterator; -import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; -import com.raytheon.uf.edex.ogc.common.filter.TemporalFilter; -import com.raytheon.uf.edex.ogc.common.spatial.AltUtil; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.ogc.common.spatial.RecordUtil; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate; -import com.raytheon.uf.edex.plugin.dataset.urn.URNLookup; -import com.raytheon.uf.edex.plugin.unitconverter.UnitLookup; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.vividsolutions.jts.geom.Envelope; - -/** - * Default WcsSource - * - * @author jelkins - * @version 1.0 - */ -public abstract class DefaultWcsSource, T extends PluginDataObject> - extends AbstractOgcSource implements IWcsSource { - - protected LayerTransformer transformer; - - private PluginDao _dao; - - protected PluginProperties props; - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - private static final String VALID_START = "dataTime.validPeriod.start"; - - private static final String VALID_END = "dataTime.validPeriod.end"; - - @SuppressWarnings("unchecked") - private final Map fillCache = Collections - .synchronizedMap(new LRUMap(2)); - - /** - * - */ - public DefaultWcsSource(PluginProperties props, - LayerTransformer transformer) { - this.props = props; - this.transformer = transformer; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.WcsSource#listCoverages() - */ - @Override - public List listCoverages(boolean summary) { - return getCoverageList(false, summary); - } - - /** - * @param wait - * @return - */ - protected List getCoverageList(boolean wait, - boolean summary) { - List coverageList = null; - try { - coverageList = getCoverageTransform().transform( - transformer.getLayers(), summary); - } catch (Exception e) { - log.error("Unable to get plugin dao", e); - return new ArrayList(0); - - } - return coverageList; - } - - /** - * @return - * @throws PluginException - */ - protected PluginDao getDao() throws PluginException { - if (_dao == null) { - _dao = PluginFactory.getInstance().getPluginDao( - props.getPluginName()); - } - return _dao; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.reg.WcsSource#describeCoverage(java.lang.String) - */ - @Override - public CoverageDescription describeCoverage(String rawId) - throws WcsException { - String identifier = URNLookup.urnToLocal(rawId); - return describeCoverageParsedId(identifier); - } - - /** - * Describe coverage using a parsed ID - * - * @param parsedId - * @return - * @throws WcsException - */ - public CoverageDescription describeCoverageParsedId(String parsedId) - throws WcsException { - CoverageDescription rval; - try { - L layer = transformer.find(parsedId); - if (layer == null) { - throw new WcsException(Code.LayerNotDefined); - } - rval = getCoverageTransform().transform(layer, false); - } catch (OgcException e) { - log.error("Problem accessing layers", e); - throw new WcsException(Code.InternalServerError, e); - } catch (Exception e) { - log.error("Unable to get plugin dao", e); - throw new WcsException(Code.InternalServerError); - } - return rval; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.WcsSource#getCoverage(java.lang.String, - * com.raytheon.uf.common.time.DataTime, - * org.opengis.referencing.crs.CoordinateReferenceSystem, - * com.vividsolutions.jts.geom.Envelope) - */ - @Override - public Coverage getCoverage(String rawId, DataTime time, - Composite3DBoundingBox bbox, List rangeFields) - throws WcsException { - String identifier = URNLookup.urnToLocal(rawId); - List fields = getRecords(identifier, time, bbox, - rangeFields); - Coverage rval = new Coverage(rawId, fields); - return rval; - } - - /* - * convenience wrapper for query arguments - */ - protected static class QueryPackage { - - public String id; - - public Conjunction query; - - public Composite3DBoundingBox bbox; - - public DataTime time; - - /** - * @param query - * @param bbox - * @param time - */ - public QueryPackage(String id, Conjunction query, - Composite3DBoundingBox bbox, DataTime time) { - this.id = id; - this.query = query; - this.bbox = bbox; - this.time = time; - } - - } - - /** - * Query and organize records for coverage - * - * @param identifier - * @param time - * @param bbox - * @param rangeFields - * @return - * @throws WcsException - */ - protected List getRecords(String identifier, DataTime time, - Composite3DBoundingBox bbox, List rangeFields) - throws WcsException { - Map> fields = parseFields(rangeFields); - Set scalarValues = fields.get(getScalarKey()); - Conjunction and = getFilterClause(identifier, time, fields); - - List rval; - QueryPackage pkg = new QueryPackage(identifier, and, bbox, time); - if (scalarValues == null || scalarValues.isEmpty()) { - // all parameters - rval = queryAllFieldValues(pkg); - } else if (scalarValues.size() == 1) { - // only one requested - String param = scalarValues.iterator().next(); - rval = Arrays.asList(getFieldForScalar(param, pkg)); - } else { - // for each requested - // criterion aren't reusable - byte[] orig = serialize(and); - rval = new ArrayList(scalarValues.size()); - for (String param : scalarValues) { - pkg.query = deserialize(orig); - rval.add(getFieldForScalar(param, pkg)); - } - } - - return rval; - } - - /** - * Extract range fields into keyed values - * - * @param rangeFields - * @return - * @throws WcsException - */ - protected abstract Map> parseFields( - List rangeFields) throws WcsException; - - /** - * @return field name of scalar parameter - */ - protected abstract String getScalarField(); - - /** - * @return key for scalar values in map returned by - * {@link DefaultWcsSource#parseFields(List)} - */ - protected abstract String getScalarKey(); - - /** - * Get query for coverage records - * - * @param identifier - * @param time - * @param fields - * @return - * @throws WcsException - */ - protected abstract Conjunction getFilterClause(String identifier, - DataTime time, Map> fields) throws WcsException; - - /** - * Retrieve data for all values of the scalar field - * - * @param restrictions - * @param crs - * @param bbox - * @return - * @throws WcsException - */ - protected List queryAllFieldValues(QueryPackage pkg) - throws WcsException { - List records = query(pkg.query); - Map> groups = groupByField(records); - List rval = new ArrayList(groups.size()); - for (String param : groups.keySet()) { - CoverageField field = createField(param, groups.get(param), pkg); - if (field != null) { - rval.add(field); - } - } - if (rval.isEmpty()) { - String sampleField; - if (!groups.isEmpty()) { - sampleField = groups.keySet().iterator().next(); - } else { - // panic, get first field for id - CoverageDescription desc = describeCoverageParsedId(pkg.id); - sampleField = desc.getRangeFields().get(0).getIdentifier(); - } - rval.add(createFillField(sampleField, pkg)); - } - return rval; - } - - /** - * Group records by scalar field value - * - * @param records - * @return - * @throws WcsException - */ - protected Map> groupByField(List records) - throws WcsException { - Map> rval = new TreeMap>(); - for (T record : records) { - String value = getScalarValue(record); - List list = rval.get(value); - if (list == null) { - list = new ArrayList(); - rval.put(value, list); - } - list.add(record); - } - return rval; - } - - /** - * Get scalar field value from record - * - * @param record - * @return - * @throws WcsException - */ - protected abstract String getScalarValue(T record) throws WcsException; - - /** - * convert criterion to byte array - * - * @param crit - * @return - * @throws WcsException - */ - protected byte[] serialize(Criterion crit) throws WcsException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = null; - try { - out = new ObjectOutputStream(baos); - out.writeObject(crit); - out.close(); - return baos.toByteArray(); - } catch (IOException e) { - log.error("Problem cloning criterion", e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * convert byte array to criterion - * - * @param arr - * @return - * @throws WcsException - */ - protected Conjunction deserialize(byte[] arr) throws WcsException { - ByteArrayInputStream bais = new ByteArrayInputStream(arr); - try { - ObjectInputStream in = new ObjectInputStream(bais); - Conjunction rval = (Conjunction) in.readObject(); - in.close(); - return rval; - } catch (Exception e) { - log.error("Problem cloning criterion", e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * Build CoverageField for scalar value - * - * @param value - * @return - * @throws WcsException - */ - protected CoverageField getFieldForScalar(String value, QueryPackage pkg) - throws WcsException { - List results = queryScalar(value, pkg); - CoverageField rval = createField(value, results, pkg); - if (rval == null) { - rval = createFillField(value, pkg); - } - return rval; - } - - /** - * Query for records that match specified scalar value - * - * @param value - * @param pkg - * @return - * @throws WcsException - */ - protected List queryScalar(String value, QueryPackage pkg) - throws WcsException { - pkg.query.add(getScalarCrit(value)); - return query(pkg.query); - } - - /** - * Create criterion for scalar value - * - * @param value - * @return - */ - protected Criterion getScalarCrit(String value) { - return Restrictions.eq(getScalarField(), value); - } - - /** - * Group results of query into coverage field - * - * @param param - * @return - * @throws WcsException - */ - protected CoverageField createField(String param, List records, - QueryPackage pkg) throws WcsException { - if (records.isEmpty()) { - return createFillField(param, pkg); - } - LinkedHashMap> map = groupByTime(records); - LinkedHashMap> cubes = new LinkedHashMap>( - map.size()); - T sample = map.get(map.keySet().iterator().next()).get(0); - Composite3DBoundingBox target3d = getTarget3d(pkg.bbox, sample); - for (Date time : map.keySet()) { - List slices = groupByAlt(map.get(time), target3d); - if (!slices.isEmpty()) { - cubes.put(time, slices); - } - } - if (cubes.isEmpty()) { - return null; - } - List rval = fillGaps(sample, pkg, cubes, target3d); - IDataRecordFetcher fetcher = rval.get(0).getSlices().get(0).getRecord(); - ReferencedDataRecord rdr = fetcher.get(true); - CoverageXYAxis xyAxis = new CoverageXYAxis(getGridGeometry(rdr), - rdr.getEnvelope()); - return createField(rval, param, sample, xyAxis); - } - - /** - * Ensure that we have a filter for 3 dimensions. If bbox doesn't have - * vertical bounds, an all-inclusive vertical bounding box is added - * - * @param bbox - * @param sample - * @return - * @throws WcsException - */ - protected Composite3DBoundingBox getTarget3d(Composite3DBoundingBox bbox, - T sample) throws WcsException { - VerticalCoordinate sampleAlt = getAltitude(sample); - if (sampleAlt == null) { - log.error("Sample record has null altitude: " + sample.getDataURI()); - throw new WcsException(Code.InternalServerError); - } - if (bbox.hasVertical()) { - Unit units = sampleAlt.getUnits(); - if (units == null) { - throw new WcsException(Code.InvalidParameterValue, - "3D query not applicable to 2D coverage"); - } - return bbox; - } - VerticalCoordinate allFilter = new VerticalCoordinate( - Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, - sampleAlt.getUnits(), sampleAlt.getRef()); - return new Composite3DBoundingBox(bbox.getHorizontal(), allFilter); - } - - /** - * Construct coverage field - * - * @param cubes - * @param param - * @param sample - * @return - * @throws WcsException - */ - protected CoverageField createField(List cubes, String param, - T sample, CoverageXYAxis xyAxis) throws WcsException { - Date[] times = new Date[cubes.size()]; - Iterator iter = cubes.iterator(); - for (int i = 0; iter.hasNext(); ++i) { - TemporalCube cube = iter.next(); - times[i] = cube.getTime(); - } - CoverageZAxis zAxis = cubes.get(0).getzAxis(); - CoverageDimensions dims = new CoverageDimensions(xyAxis, zAxis, - new CoverageTAxis(times)); - CoverageField rval = new CoverageField(cubes, dims); - rval.setName(param); - rval.setStandardName(param); - rval.setUnits(unidataUnitToString(getUcarUnit(sample))); - rval.setPaddingValue(getFillValue(sample)); - return rval; - } - - /** - * Create a coverage field that is all fill values - * - * @param param - * @param pkg - * @return - * @throws WcsException - */ - protected CoverageField createFillField(String param, QueryPackage pkg) - throws WcsException { - Criterion crit = getScalarCrit(param); - T sample = querySample(crit); - if (sample == null) { - throw new WcsException(Code.InvalidParameterValue, - "Unable to find scalar field: " + param); - } - TemporalCube cube = createFillCube(getTarget3d(pkg.bbox, sample), - sample, pkg); - ReferencedEnvelope bbox = pkg.bbox.getHorizontal(); - CoverageXYAxis xyAxis = new CoverageXYAxis(getFillGeom(sample, bbox), - bbox); - return createField(Arrays.asList(cube), param, sample, xyAxis); - } - - /** - * Create a temporal cube that is all fill values - * - * @param target3d - * @param sample - * @param pkg - * @return - */ - protected TemporalCube createFillCube(Composite3DBoundingBox target3d, - T sample, QueryPackage pkg) { - VerticalCoordinate vert = target3d.getVertical(); - String units = unidataUnitToString(UnitLookup.getInstance() - .getUcarFromJsr(vert.getUnits())); - VerticalSlice slice = createFillSlice(sample, pkg, vert.getMin()); - CoverageZAxis zAxis = new CoverageZAxis( - new double[] { slice.getLevel() }, units, - vert.getRef().longName, isUpPositive(sample)); - Date time; - if (pkg.time != null) { - time = pkg.time.getRefTime(); - } else { - time = sample.getDataTime().getValidTime().getTime(); - } - return new TemporalCube(Arrays.asList(slice), time, zAxis); - } - - /** - * Create a vertical slice that is all fill values - * - * @param sample - * @param pkg - * @param level - * @return - */ - protected VerticalSlice createFillSlice(final T sample, - final QueryPackage pkg, double level) { - final ReferencedEnvelope bbox = pkg.bbox.getHorizontal(); - IDataRecordFetcher fillFetcher = new IDataRecordFetcher() { - @Override - public ReferencedDataRecord get(boolean cache) throws WcsException { - return getFillRecord(sample, bbox); - } - }; - return new VerticalSlice(fillFetcher, level); - } - - /** - * Fill levels that are not in all cubes - * - * @param sample - * @param pkg - * @param cubes - * @param target3d - * @return - * @throws WcsException - */ - protected List fillGaps(T sample, QueryPackage pkg, - LinkedHashMap> cubes, - Composite3DBoundingBox target3d) throws WcsException { - TreeSet union = new TreeSet(); - for (Entry> e : cubes.entrySet()) { - List slices = e.getValue(); - for (VerticalSlice slice : slices) { - union.add(slice.getLevel()); - } - } - - VerticalCoordinate vert = target3d.getVertical(); - double[] levels = new double[union.size()]; - Iterator iter = union.iterator(); - for (int i = 0; iter.hasNext(); ++i) { - levels[i] = iter.next(); - } - String unitStr = vert.getUnits() == null ? "" : vert.getUnits() - .toString(); - String refName = vert.getRef() == null ? "" : vert.getRef().longName; - CoverageZAxis zAxis = new CoverageZAxis(levels, unitStr, refName, - isUpPositive(sample)); - List rval = new ArrayList(cubes.size()); - for (Entry> e : cubes.entrySet()) { - rval.add(fillGaps(sample, pkg, e.getValue(), e.getKey(), zAxis)); - } - return rval; - } - - /** - * Fill levels that are in the expected set of levels but not in the cube - * - * @param sample - * @param pkg - * @param slices - * @param time - * @param zAxis - * @return - */ - protected TemporalCube fillGaps(T sample, QueryPackage pkg, - List slices, Date time, CoverageZAxis zAxis) { - PeekingIterator from = new PeekingIterator( - slices.iterator()); - double[] expected = zAxis.getValue(); - List target = new ArrayList( - expected.length); - for (double level : expected) { - if (!from.hasNext()) { - // ran out of from, rest will be fills - target.add(createFillSlice(sample, pkg, level)); - continue; - } - VerticalSlice possible = from.peek(); - if (possible.getLevel() == level) { - target.add(possible); - from.next(); // progress iterator - } else { - // missing level, use fill - target.add(createFillSlice(sample, pkg, level)); - } - } - return new TemporalCube(target, time, zAxis); - } - - /** - * Safely convert units to string - * - * @param u - * @return - */ - protected String javaxUnitToString(Unit u) { - return u != null ? u.toString() : ""; - } - - protected String unidataUnitToString(ucar.units.Unit u) { - return u != null ? u.toString() : ""; - } - - /** - * get field units from record - * - * @param record - * @return - */ - protected abstract Unit getScalarUnit(T record); - - protected abstract ucar.units.Unit getUcarUnit(T record); - - /** - * @param record - * @return true if increasing z values is up - */ - protected abstract boolean isUpPositive(T record); - - /** - * @param records - * @return - */ - private LinkedHashMap> groupByTime(List records) { - LinkedHashMap> rval = new LinkedHashMap>(); - for (T record : records) { - Date time = record.getDataTime().getValidTime().getTime(); - List list = rval.get(time); - if (list == null) { - list = new ArrayList(); - rval.put(time, list); - } - list.add(record); - } - return rval; - } - - /** - * Group records into vertical slices - * - * @param records - * @param targetUnits - * @param bbox - * @return - * @throws WcsException - */ - protected List groupByAlt(List records, - final Composite3DBoundingBox bbox) throws WcsException { - final ReferencedEnvelope horiz = bbox.getHorizontal(); - VerticalCoordinate vertFilter = bbox.getVertical(); - List rval = new ArrayList(records.size()); - for (final T r : records) { - VerticalCoordinate altitude = getAltitude(r); - if (altitude == null) { - log.error("Record missing altitude: " + r.getDataURI()); - continue; - } - VerticalCoordinate vertValue; - try { - vertValue = AltUtil.convert(vertFilter.getUnits(), - vertFilter.getRef(), altitude); - } catch (Exception e) { - log.debug("Unable to convert level", e.getMessage()); - continue; - } - if (vertFilter.compareTo(vertValue) != 0) { - continue; - } - IDataRecordFetcher fetcher = new IDataRecordFetcher() { - ReferencedDataRecord record; - - @Override - public ReferencedDataRecord get(boolean cache) - throws WcsException { - if (record != null) { - return record; - } - ReferencedDataRecord rval = getDataRecord(r, horiz); - if (cache) { - record = rval; - } - return rval; - } - }; - rval.add(new VerticalSlice(fetcher, vertValue.getValue())); - } - Collections.sort(rval); - return rval; - } - - /** - * get z value for record - * - * @param record - * @return - * @throws WcsException - */ - protected abstract VerticalCoordinate getAltitude(T record) - throws WcsException; - - /** - * @param time - * @return null if time is null - */ - protected Criterion parseTime(DataTime time) { - if (time == null) { - return null; - } - Criterion rval; - // any interacts - if (TemporalFilter.isRange(time)) { - TimeRange period = time.getValidPeriod(); - SimpleExpression lhs = Restrictions - .le(VALID_START, period.getEnd()); - SimpleExpression rhs = Restrictions - .ge(VALID_END, period.getStart()); - rval = Restrictions.and(lhs, rhs); - } else { - SimpleExpression lhs = Restrictions.le(VALID_START, - time.getRefTime()); - SimpleExpression rhs = Restrictions - .ge(VALID_END, time.getRefTime()); - rval = Restrictions.and(lhs, rhs); - } - return rval; - } - - @SuppressWarnings("unchecked") - public T querySample(Criterion crit) throws WcsException { - Session sess = null; - try { - PluginDao dao = getDao(); - SessionFactory sessFact = dao.getSessionFactory(); - sess = sessFact.openSession(); - Criteria criteria = sess.createCriteria(props.getRecord()); - criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); - criteria.setMaxResults(1); - criteria.add(crit); - criteria = modCriteria(criteria); - return (T) criteria.uniqueResult(); - } catch (Exception e) { - log.error("Problem querying", e); - throw new WcsException(Code.InternalServerError); - } finally { - if (sess != null) { - sess.close(); - } - } - } - - @SuppressWarnings("unchecked") - public List query(Criterion crit) throws WcsException { - Session sess = null; - try { - PluginDao dao = getDao(); - SessionFactory sessFact = dao.getSessionFactory(); - sess = sessFact.openSession(); - Criteria criteria = sess.createCriteria(props.getRecord()); - criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); - criteria.add(crit); - criteria = modCriteria(criteria); - criteria.addOrder(Order.asc(VALID_START)); - return (List) criteria.list(); - } catch (Exception e) { - log.error("Problem querying", e); - throw new WcsException(Code.InternalServerError); - } finally { - if (sess != null) { - sess.close(); - } - } - } - - /** - * Hook to add aliases to criteria, default is no change - * - * @param criteria - * @return - */ - protected Criteria modCriteria(Criteria criteria) { - return criteria; - } - - /** - * @param identifier - * @return - */ - protected Date getDefaultTime(String identifier) throws WcsException { - try { - SimpleLayer layer = transformer.find(identifier); - return layer.getDefaultTime(); - } catch (OgcException e) { - log.error("Problem accessing layers", e); - throw new WcsException(Code.InternalServerError, e); - } catch (Exception e) { - log.error("Unable to get plugin dao", e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * @param record - * @param bbox - * @return - * @throws WcsException - */ - protected ReferencedDataRecord getDataRecord(PluginDataObject record, - ReferencedEnvelope bbox) throws WcsException { - try { - // get the projected slice from the DAO - PluginDao dao = getDao(); - ReferencedDataRecord rval = RecordUtil.getProjected(dao, record, - bbox); - - // check if we need to pad ( possibly have no data and need to - // create all "null" response - if (rval == null) { - // Need all "null" response - rval = getFillRecord(record, bbox); - } else if (rval.getEnvelope().equals(bbox) - || rval.getEnvelope().contains((Envelope) bbox)) { - // All is well - } else { - // need to resize (grow only) and pad with nulls - ReferencedDataRecord resultingRecord = padData(rval, bbox); - rval = resultingRecord; - } - - return rval; - } catch (Exception e) { - log.error("Unable to get reprojected data for record: " + record, e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * Get a referenced data record that is full of fill values. This method - * caches internally. - * - * @param record - * example record that is used as a template - * @param bbox - * target bounds of record - * @return - * @throws WcsException - */ - protected ReferencedDataRecord getFillRecord(PluginDataObject record, - ReferencedEnvelope bbox) throws WcsException { - ISpatialObject spatial = ((ISpatialEnabled) record).getSpatialObject(); - String key = toKey(spatial, bbox); - ReferencedDataRecord rval = fillCache.get(key); - if (rval != null) { - return rval; - } - RequestWrapper req = getSlicedRequest(spatial, bbox); - Point slicedDims = getSlicedDims(req); - IDataRecord sample = getSample(record); - Object array = makeArrayTypeFromRecord(sample, slicedDims.x - * slicedDims.y); - IDataRecord fill = makeDataRecordOfSameType(sample, array, 2, - new long[] { slicedDims.x, slicedDims.y }); - ReferencedDataRecord tmp = new ReferencedDataRecord(fill, req.env); - rval = padData(tmp, bbox); - fillCache.put(key, rval); - return rval; - } - - /** - * Create a cache key from spatial object and target bounds - * - * @param spatial - * @param env - * @return - */ - protected String toKey(ISpatialObject spatial, ReferencedEnvelope env) { - StringBuilder b = new StringBuilder(); - b.append(spatial.getCrs().toWKT()).append(":"); - b.append(spatial.getGeometry().toString()).append(":"); - b.append(spatial.getNx()).append(":"); - b.append(spatial.getNy()).append(":"); - b.append(env.getCoordinateReferenceSystem().toWKT()).append(":"); - b.append(env.toString()); - return b.toString(); - } - - /** - * Get target dimensions for fill record - * - * @param req - * @return - * @throws WcsException - */ - protected Point getSlicedDims(RequestWrapper req) throws WcsException { - int[] maxes = req.req.getMaxIndexForSlab(); - int[] mins = req.req.getMinIndexForSlab(); - return new Point(maxes[0] - mins[0], maxes[1] - mins[1]); - } - - /** - * Get grid bounds and associated bounding box for slice - * - * @param record - * @param bbox - * @return - * @throws WcsException - */ - protected RequestWrapper getSlicedRequest(ISpatialObject spatial, - ReferencedEnvelope bbox) throws WcsException { - try { - ReferencedEnvelope nativeEnvelope = RecordUtil - .getNativeEnvelope(spatial); - RequestWrapper rval = DataReprojector.getRequest(spatial, - nativeEnvelope, bbox); - if (rval == null) { - rval = new RequestWrapper(); - rval.req = Request.buildSlab(new int[] { 0, 0 }, new int[] { 1, - 1 }); - CoordinateReferenceSystem targetCrs = bbox - .getCoordinateReferenceSystem(); - ReferencedEnvelope dataBounds = nativeEnvelope.transform( - targetCrs, true); - double dx = dataBounds.getWidth() / spatial.getNx(); - double dy = dataBounds.getHeight() / spatial.getNy(); - double maxx = bbox.getMinX() + dx; - double maxy = bbox.getMinY() + dy; - rval.env = new ReferencedEnvelope(bbox.getMinX(), maxx, - bbox.getMinY(), maxy, - bbox.getCoordinateReferenceSystem()); - } - return rval; - } catch (Exception e) { - log.error("Unable to make fill record", e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * Get grid geometry for fill record - * - * @param record - * example record - * @param bbox - * bounds of return - * @return - * @throws WcsException - */ - protected GridGeometry2D getFillGeom(PluginDataObject record, - ReferencedEnvelope bbox) throws WcsException { - ReferencedDataRecord fill = getFillRecord(record, bbox); - IDataRecord rec = fill.getRecord(); - int nx = (int) rec.getSizes()[0]; - int ny = (int) rec.getSizes()[1]; - return getGridGeometry(0, nx - 1, 0, ny - 1, bbox); - } - - /** - * Get small sample from record - * - * @param record - * @return - * @throws WcsException - */ - protected IDataRecord getSample(PluginDataObject record) - throws WcsException { - try { - IDataStore store = getDao().getDataStore((IPersistable) record); - Request request = Request.buildPointRequest(new Point(0, 0)); - return store.retrieve(record.getDataURI(), - DataStoreFactory.DEF_DATASET_NAME, request); - } catch (Exception e) { - log.error("Unable to sample data", e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * @param projectedRecord - * @return - */ - protected ReferencedDataRecord padData( - ReferencedDataRecord projectedRecord, Envelope targetEnv) - throws WcsException { - GridGeometry2D gridGeom = getGridGeometry(projectedRecord.getRecord(), - projectedRecord.getEnvelope()); - if (projectedRecord.getEnvelope().contains(targetEnv)) { - // no need to pad - return projectedRecord; - } else if (projectedRecord.getEnvelope().intersects(targetEnv)) { - // there is some padding - try { - int[][] dataRange = getContainingGridPoints( - gridGeom.getCRSToGrid2D(PixelOrientation.UPPER_LEFT), - projectedRecord.getEnvelope()); - int[][] targetRange = getContainingGridPoints( - gridGeom.getCRSToGrid2D(PixelOrientation.UPPER_LEFT), - targetEnv); - - int[][] padRange = calculatePadRange(dataRange, targetRange); - - int[] dataSize = new int[2]; - - dataSize[0] = (int) projectedRecord.getRecord().getSizes()[0]; - dataSize[1] = (int) projectedRecord.getRecord().getSizes()[1]; - - IDataRecord paddedDataRecord = padDataInternal( - projectedRecord.getRecord(), dataSize, padRange); - - // make an adjusted grid geometry to account for padding - // shift old grid corners by minimum pad - GridGeometry2D adjustedGridGeom = getGridGeometry( - padRange[0][0], dataSize[0] + padRange[0][0] - 1, - padRange[0][1], dataSize[1] + padRange[0][1] - 1, - projectedRecord.getEnvelope()); - - ReferencedEnvelope finalEnvelope = makeReferencedEnvelope( - adjustedGridGeom, paddedDataRecord); - - ReferencedDataRecord record = new ReferencedDataRecord( - paddedDataRecord, finalEnvelope); - - return record; - - } catch (TransformException e) { - log.error("Transform Exception while padding partial record", e); - throw new WcsException(Code.InternalServerError); - } - - } else { - // need 100% nulls - try { - int[][] targetRange = getContainingGridPoints( - gridGeom.getCRSToGrid2D(), targetEnv); - int[] targetDims = new int[] { - Math.abs(targetRange[0][0]) - + Math.abs(targetRange[1][0]), - Math.abs(targetRange[0][1]) - + Math.abs(targetRange[1][1]) }; - int targetSize = targetDims[0] * targetDims[1]; - - IDataRecord record = projectedRecord.getRecord(); - - Object targetArray = makeArrayTypeFromRecord(record, targetSize); - - fillArray(targetArray); - - IDataRecord paddedDataRecord = makeDataRecordOfSameType(record, - targetArray, 2, new long[] { targetDims[0], - targetDims[1] }); - - ReferencedEnvelope finalEnvelope = makeReferencedEnvelope( - gridGeom, paddedDataRecord); - - ReferencedDataRecord referencedRecord = new ReferencedDataRecord( - paddedDataRecord, finalEnvelope); - - return referencedRecord; - - } catch (TransformException e) { - log.error("Transform Exception while making all null pads", e); - throw new WcsException(Code.InternalServerError); - } - } - } - - /** - * makes a geospatial referenced envelope - * - * @param gridGeom - * @param paddedDataRecord - * @return - */ - protected ReferencedEnvelope makeReferencedEnvelope( - GridGeometry2D gridGeom, IDataRecord dataRecord) - throws WcsException, TransformException { - MathTransform transform = gridGeom - .getGridToCRS(PixelOrientation.UPPER_LEFT); - - DirectPosition srcUpperLeft = new DirectPosition2D(0, 0); - DirectPosition srcLowerRight = new DirectPosition2D( - dataRecord.getSizes()[0], dataRecord.getSizes()[1]); - - try { - DirectPosition destUpperLeft = transform.transform(srcUpperLeft, - null); - DirectPosition destLowerRight = transform.transform(srcLowerRight, - null); - - ReferencedEnvelope rval = new ReferencedEnvelope( - destUpperLeft.getOrdinate(0), - destLowerRight.getOrdinate(0), - destLowerRight.getOrdinate(1), - destUpperLeft.getOrdinate(1), - gridGeom.getCoordinateReferenceSystem()); - - return rval; - } catch (MismatchedDimensionException e) { - log.error( - "error while transforming grid coordinates to referenced envelope", - e); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * @param record - * @param dataSize - * @param padRange - * @return - * @throws WcsBadTypeException - */ - protected IDataRecord padDataInternal(IDataRecord record, int[] dataSize, - int[][] padRange) throws WcsException { - - int[] newSize = new int[] { - dataSize[0] + padRange[0][0] + padRange[1][0], - dataSize[1] + padRange[0][1] + padRange[1][1] }; - int newTotalSize = newSize[0] * newSize[1]; - - int dataArraySize = dataSize[0] * dataSize[1]; - - Object sourceData = record.getDataObject(); - - Object targetArray = makeArrayTypeFromRecord(record, newTotalSize); - fillArray(targetArray); - - for (int srcIndex = 0; srcIndex < dataArraySize; ++srcIndex) { - - // get row and column index from data - int srcRow = srcIndex / dataSize[0]; - int srcColumn = srcIndex % dataSize[0]; - - // calculate new row and column - // add min y pad to source row to get destination row - int destRow = padRange[0][1] + srcRow; - // add min x pad to source column for destination column - int destColumn = padRange[0][0] + srcColumn; - - int targetIndex = (destRow * newSize[0]) + destColumn; - - copyValue(sourceData, srcIndex, targetArray, targetIndex); - } - - IDataRecord rval = makeDataRecordOfSameType(record, targetArray, 2, - new long[] { newSize[0], newSize[1] }); - - return rval; - } - - /** - * @param record - * @param newDataArray - * @param dims - * @param sizes - * @return - * @throws WcsException - */ - protected IDataRecord makeDataRecordOfSameType(IDataRecord record, - Object newDataArray, int dims, long[] sizes) throws WcsException { - IDataRecord rval = null; - - if (record instanceof ByteDataRecord) { - rval = new ByteDataRecord(record.getName(), record.getGroup(), - (byte[]) newDataArray, dims, sizes); - } else if (record instanceof FloatDataRecord) { - rval = new FloatDataRecord(record.getName(), record.getGroup(), - (float[]) newDataArray, dims, sizes); - } else if (record instanceof IntegerDataRecord) { - rval = new IntegerDataRecord(record.getName(), record.getGroup(), - (int[]) newDataArray, dims, sizes); - } else if (record instanceof LongDataRecord) { - rval = new LongDataRecord(record.getName(), record.getGroup(), - (long[]) newDataArray, dims, sizes); - } else if (record instanceof ShortDataRecord) { - rval = new ShortDataRecord(record.getName(), record.getGroup(), - (short[]) newDataArray, dims, sizes); - } else if (record instanceof StringDataRecord) { - rval = new StringDataRecord(record.getName(), record.getGroup(), - (String[]) newDataArray, dims, sizes); - } else { - log.error("Unknown IDataRecord type. type: " - + record.getClass().toString(), new Exception()); - throw new WcsException(Code.InternalServerError); - } - - return rval; - } - - /** - * @param record - * @param size - * @return - * @throws WcsException - */ - protected Object makeArrayTypeFromRecord(IDataRecord record, int size) - throws WcsException { - Object targetArray = null; - - if (record instanceof ByteDataRecord) { - targetArray = new byte[size]; - byte fill = new ByteDataReprojector().getFill(); - Arrays.fill((byte[]) targetArray, fill); - } else if (record instanceof FloatDataRecord) { - targetArray = new float[size]; - float fill = new FloatDataReprojector().getFill(); - Arrays.fill((float[]) targetArray, fill); - } else if (record instanceof IntegerDataRecord) { - targetArray = new int[size]; - int fill = new IntDataReprojector().getFill(); - Arrays.fill((int[]) targetArray, fill); - } else if (record instanceof LongDataRecord) { - targetArray = new long[size]; - long fill = 0l; - Arrays.fill((long[]) targetArray, fill); - } else if (record instanceof ShortDataRecord) { - targetArray = new short[size]; - short fill = new ShortDataReprojector().getFill(); - Arrays.fill((short[]) targetArray, fill); - } else if (record instanceof StringDataRecord) { - targetArray = new String[size]; - } else { - log.error("Unknown IDataRecord type when making array. type: " - + record.getClass().toString(), new Exception()); - throw new WcsException(Code.InternalServerError); - } - - return targetArray; - } - - /** - * Get fill value for record - * - * @param record - * @return - * @throws WcsException - */ - protected Number getFillValue(T record) throws WcsException { - IDataRecord sample = getSample(record); - if (sample instanceof ByteDataRecord) { - return new ByteDataReprojector().getFill(); - } else if (sample instanceof FloatDataRecord) { - return new FloatDataReprojector().getFill(); - } else if (sample instanceof IntegerDataRecord) { - return new IntDataReprojector().getFill(); - } else if (sample instanceof LongDataRecord) { - return 0l; - } else if (sample instanceof ShortDataRecord) { - return new ShortDataReprojector().getFill(); - } else { - log.error( - "Unknown IDataRecord type when getting fill value. type: " - + record.getClass().toString(), new Exception()); - throw new WcsException(Code.InternalServerError); - } - } - - /** - * @param sourceData - * @param srcIndex - * @param targetArray - * @param targetIndex - */ - protected void copyValue(Object sourceData, int srcIndex, - Object targetArray, int targetIndex) throws WcsException { - - if (sourceData instanceof byte[] && targetArray instanceof byte[]) { - ((byte[]) targetArray)[targetIndex] = ((byte[]) sourceData)[srcIndex]; - } else if (sourceData instanceof float[] - && targetArray instanceof float[]) { - ((float[]) targetArray)[targetIndex] = ((float[]) sourceData)[srcIndex]; - } else if (sourceData instanceof short[] - && targetArray instanceof short[]) { - ((short[]) targetArray)[targetIndex] = ((short[]) sourceData)[srcIndex]; - } else if (sourceData instanceof int[] && targetArray instanceof int[]) { - ((int[]) targetArray)[targetIndex] = ((int[]) sourceData)[srcIndex]; - } else if (sourceData instanceof long[] - && targetArray instanceof long[]) { - ((long[]) targetArray)[targetIndex] = ((long[]) sourceData)[srcIndex]; - } else if (sourceData instanceof String[] - && targetArray instanceof String[]) { - ((String[]) targetArray)[targetIndex] = ((String[]) sourceData)[srcIndex]; - } else { - log.error("bad type when making record, " - + sourceData.getClass().toString() + " and " - + targetArray.getClass().toString(), new Exception( - "bad type when making record")); - throw new WcsException(Code.InternalServerError); - } - - } - - /** - * @param targetArray - * @param nullPadValue - */ - protected void fillArray(Object targetArray) throws WcsException { - - if (targetArray instanceof byte[]) { - byte fill = new ByteDataReprojector().getFill(); - Arrays.fill((byte[]) targetArray, fill); - } else if (targetArray instanceof float[]) { - float fill = new FloatDataReprojector().getFill(); - Arrays.fill((float[]) targetArray, fill); - } else if (targetArray instanceof short[]) { - short fill = new ShortDataReprojector().getFill(); - Arrays.fill((short[]) targetArray, fill); - } else if (targetArray instanceof int[]) { - int fill = new IntDataReprojector().getFill(); - Arrays.fill((int[]) targetArray, fill); - } else if (targetArray instanceof long[]) { - long fill = 0l; - Arrays.fill((long[]) targetArray, fill); - } else { - log.error("Unknown array type when trying to fill array. type: " - + targetArray.getClass().toString(), new Exception()); - throw new WcsException(Code.InternalServerError); - } - - } - - /** - * @param dataRange - * @param targetRange - * @return - */ - protected int[][] calculatePadRange(int[][] dataRange, int[][] targetRange) { - // for minimum we expect dataRange to be less than or equal to - // targetRange, if the difference is negative we need to pad - int minxDiff = targetRange[0][0] - dataRange[0][0]; - int minyDiff = targetRange[0][1] - dataRange[0][1]; - // for maximum we expect dataRange to be greater than or equal to - // targetRange, if the difference is positive we need to pad - // swap min/max order because grid and crs count y differently - int maxxDiff = targetRange[1][0] - dataRange[1][0]; - int maxyDiff = targetRange[1][1] - dataRange[1][1]; - - // only pad, do not trim. so we need to check if the dataRange was - // bigger - if (minxDiff > 0) { - minxDiff = 0; - } - if (minyDiff > 0) { - minyDiff = 0; - } - - if (maxxDiff < 0) { - maxxDiff = 0; - } - if (maxyDiff < 0) { - maxyDiff = 0; - } - - return new int[][] { { Math.abs(minxDiff), Math.abs(minyDiff) }, - { Math.abs(maxxDiff), Math.abs(maxyDiff) } }; - } - - /** - * @param crsToGrid - * @param env - * @return - * @throws TransformException - */ - protected int[][] getContainingGridPoints(MathTransform2D crsToGrid, - Envelope env) throws TransformException { - DirectPosition lower = new DirectPosition2D(env.getMinX(), - env.getMinY()); - DirectPosition upper = new DirectPosition2D(env.getMaxX(), - env.getMaxY()); - DirectPosition lowerGrid = crsToGrid.transform(lower, null); - DirectPosition upperGrid = crsToGrid.transform(upper, null); - - // make sure to "grow" in the proper direction - - // x axis "direction" is the same in geo and grid - double minx = lowerGrid.getOrdinate(0); - double maxx = upperGrid.getOrdinate(0); - - // y axis "direction" is swapped between geo and grid - double maxy = lowerGrid.getOrdinate(1); - double miny = upperGrid.getOrdinate(1); - - minx = Math.round(minx); - maxx = Math.round(maxx); - - miny = Math.round(miny); - maxy = Math.round(maxy); - - return new int[][] { { (int) minx, (int) miny }, - { (int) maxx, (int) maxy } }; - } - - /** - * @param ref - * @return - */ - protected GridGeometry2D getGridGeometry(ReferencedDataRecord ref) { - return getGridGeometry(ref.getRecord(), ref.getEnvelope()); - } - - /** - * @param record - * @param env - * @return - */ - protected GridGeometry2D getGridGeometry(IDataRecord record, - ReferencedEnvelope env) { - return getGridGeometry(0, (int) record.getSizes()[0] - 1, 0, - (int) record.getSizes()[1] - 1, env); - } - - /** - * @param gridXmin - * @param gridXmax - * @param gridYmin - * @param gridYmax - * @param env - * @return - */ - protected GridGeometry2D getGridGeometry(int gridXmin, int gridXmax, - int gridYmin, int gridYmax, ReferencedEnvelope env) { - GeneralEnvelope genEnvelope = convertEnvelopeToGeneralEnvelope(env); - genEnvelope.setCoordinateReferenceSystem(env - .getCoordinateReferenceSystem()); - GridGeometry2D gridGeom = new GridGeometry2D(new GeneralGridEnvelope( - new int[] { gridXmin, gridYmin }, new int[] { gridXmax, - gridYmax }, true), genEnvelope); - - return gridGeom; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.WcsSource#getKey() - */ - @Override - public String getKey() { - return props.getPluginName(); - } - - /** - * @param env - * @return - */ - protected GeneralEnvelope convertEnvelopeToGeneralEnvelope(Envelope env) { - GeneralEnvelope rval = new GeneralEnvelope(2); - rval.setRange(0, env.getMinX(), env.getMaxX()); - rval.setRange(1, env.getMinY(), env.getMaxY()); - return rval; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wcs.reg.WcsSource#hasId(java.lang.String) - */ - @Override - public boolean hasCoverage(String id) throws WcsException { - try { - return transformer.find(URNLookup.urnToLocal(id)) != null; - } catch (OgcException e) { - log.error("problem finding coverage", e); - throw new WcsException(e); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/FieldAdapterFactory.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/FieldAdapterFactory.java deleted file mode 100644 index 6677e006e6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/FieldAdapterFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.context.ApplicationContext; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.core.EDEXUtil; -import com.raytheon.uf.edex.ogc.common.spatial.VerticalSpatialFactory; - -/** - * Factory for getting coverage field for plugin data object - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 5, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class FieldAdapterFactory { - private static Map, IFieldAdapted> REGISTRY = null; - - private static final IUFStatusHandler log = UFStatus - .getHandler(FieldAdapterFactory.class); - - private static final class Init implements Runnable { - @Override - public void run() { - while (!EDEXUtil.isRunning()) { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - } - } - try { - ApplicationContext ctx = EDEXUtil.getSpringContext(); - String[] beans = ctx.getBeanNamesForType(IFieldAdapted.class); - HashMap, IFieldAdapted> map = new HashMap, IFieldAdapted>( - beans.length); - for (String bean : beans) { - IFieldAdapted fa = (IFieldAdapted) ctx.getBean(bean); - map.put(fa.getSupportedClass(), fa); - } - REGISTRY = Collections.unmodifiableMap(map); - } catch (Throwable e) { - log.error("Unable to init " + VerticalSpatialFactory.class, e); - } - } - } - - static { - new Thread(new Init()).start(); - } - - /** - * @param c - * @return null if factory isn't initialized or no adapter found for c - */ - @SuppressWarnings("unchecked") - public static IFieldAdapted getAdapted(Class c) { - if (REGISTRY == null) { - return null; - } - return (IFieldAdapted) REGISTRY.get(c); - } - - public static boolean isInitialized() { - return REGISTRY != null; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IDataRecordFetcher.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IDataRecordFetcher.java deleted file mode 100644 index 0330050c69..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IDataRecordFetcher.java +++ /dev/null @@ -1,53 +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.edex.wcs.reg; - -import com.raytheon.uf.common.spatial.reprojection.ReferencedDataRecord; -import com.raytheon.uf.edex.wcs.WcsException; - -/** - * Data Record Fetcher for WCS - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 3, 2013            bclement     Initial creation
- * Aug 18, 2013 #2097      dhladky     interface standards
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public interface IDataRecordFetcher { - - /** - * @param cache - * true if the record will likely be retrieved again - * @return - * @throws Exception - */ - public ReferencedDataRecord get(boolean cache) throws WcsException; - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IFieldAdapted.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IFieldAdapted.java deleted file mode 100644 index 74e1e9b3aa..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IFieldAdapted.java +++ /dev/null @@ -1,53 +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.edex.wcs.reg; - -/** - * Adapter for coverage field information - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 5, 2013            bclement     Initial creation
- * Aug 18, 2013 #2097      dhladky     interface standards
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public interface IFieldAdapted { - - /** - * @param obj - * @return - */ - public String getCoverageField(T obj); - - /** - * @return class supported by adapter - */ - public Class getSupportedClass(); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IWcsSource.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IWcsSource.java deleted file mode 100644 index 4559fab702..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/IWcsSource.java +++ /dev/null @@ -1,68 +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. - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * May 5, 2011 bclement Initial creation - * Aug 18, 2013 #2097 dhladky interface standards - * - */ - -package com.raytheon.uf.edex.wcs.reg; - -import java.util.List; - -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.ogc.common.db.SimpleDimension; -import com.raytheon.uf.edex.ogc.common.db.SimpleLayer; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.wcs.WcsException; - -public interface IWcsSource> { - - /** - * long name attribute for coverages - */ - public static final String LONG_NAME_ATTR = "long_name"; - - public List listCoverages(boolean summary); - - public CoverageDescription describeCoverage(String identifier) - throws WcsException; - - public CoverageTransform getCoverageTransform(); - - public Coverage getCoverage(String identifier, DataTime time, - Composite3DBoundingBox bbox, List rangeFields) - throws WcsException; - - public String getKey(); - - public boolean hasCoverage(String id) throws WcsException; - - /** - * @param c - * extension class - * @return extension object for class, null if none registered - */ - public T getExtension(Class c); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeAxis.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeAxis.java deleted file mode 100644 index 29a58787cb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeAxis.java +++ /dev/null @@ -1,151 +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.edex.wcs.reg; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; - -/** - * - * @author bclement - * @version 1.0 - */ -public class RangeAxis { - - protected String identifier; - - protected Set keys; - - protected static Pattern axisPattern = Pattern - .compile("^([^\\[]+)\\[([^\\]]+)]$"); - - /** - * @param description - * @param identifier - * @param keys - */ - public RangeAxis(String identifier, Set keys) { - super(); - this.identifier = identifier; - this.keys = keys; - } - - /** - * @param axisSubset - * string that conforms to the following grammar
- * AxisSubsets = AxisSubset *( “,” AxisSubset )
- * AxisSubset = AxisId “[” Keys “]”
- * Keys = Key *( “,” Key ) - * @return null if axisSubset is null - * @throws RangeParseException - * if axisSubsets doesn't follow the above grammar - */ - public static List getAxisList(String axisSubsets) - throws RangeParseException { - if (axisSubsets == null || axisSubsets.isEmpty()) { - throw new RangeParseException( - "axis subsets cannot be null or empty"); - } - List parts = axisSplit(axisSubsets); - List rval = new ArrayList(parts.size()); - for (String s : parts) { - rval.add(getAxis(s)); - } - return rval; - } - - /** - * @param axisSubset - * string that conforms to the following grammar
- * AxisSubset = AxisId “[” Keys “]”
- * Keys = Key *( “,” Key ) - * @return - * @throws RangeParseException - * if axisSubset doesn't follow the above grammar - */ - public static RangeAxis getAxis(String axisSubset) - throws RangeParseException { - if (axisSubset == null) { - throw new RangeParseException("axis subset cannot be null"); - } - Matcher m = axisPattern.matcher(axisSubset); - if (m.matches()) { - Set keys = new HashSet(); - keys.addAll(Arrays.asList(m.group(2).split(","))); - return new RangeAxis(m.group(1), keys); - } - throw new RangeParseException("Invalid axis subset: " + axisSubset); - } - - /** - * @param axisStr - * @return - */ - protected static List axisSplit(String axisStr) { - int start = 0; - int end = 0; - int mark = -1; - List rval = new ArrayList(); - do { - mark = axisStr.indexOf(',', end); - if (mark > 0 && axisStr.charAt(mark - 1) == ']') { - rval.add(axisStr.substring(start, mark)); - start = mark + 1; - } - end = mark + 1; - } while (mark > 0); - rval.add(axisStr.substring(start)); - return rval; - } - - @Override - public String toString() { - String rval = String.valueOf(identifier); - if (keys != null && !keys.isEmpty()) { - String keyStr = StringUtils.join(keys, ','); - rval = rval + '[' + keyStr + ']'; - } - return rval; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public Set getKeys() { - return keys; - } - - public void setKeys(Set keys) { - this.keys = keys; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeField.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeField.java deleted file mode 100644 index a58e503984..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeField.java +++ /dev/null @@ -1,212 +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.edex.wcs.reg; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; - -/** - * - * @author bclement - * @version 1.0 - */ -public class RangeField { - - protected static Pattern fieldPattern = Pattern - .compile("^([^\\[:]+)(:([^\\[]+))?(\\[(.*)\\])?$"); - - public enum InterpolationType { - nearest, linear, cubic, quadratic, none - }; - - protected String identifier; - - protected RangeFieldDefinition definition; - - protected InterpolationType defaultInterpolation = InterpolationType.none; - - protected List additionalInterpolations; - - protected List axis; - - protected String nullValue; - - /** - * @param identifier - * @param description - * @param definition - */ - public RangeField(String identifier, RangeFieldDefinition definition) { - super(); - this.identifier = identifier; - this.definition = definition; - } - - /** - * @param rangeSubset - * string that conforms to the following grammar
- * RangeSubset = FieldSubset *( “;” FieldSubset )
- * FieldSubset = FieldId [ “:” Interpolation ] [ “[” AxisSubsets - * “]” ]
- * AxisSubsets = AxisSubset *( “,” AxisSubset )
- * AxisSubset = AxisId “[” Keys “]”
- * Keys = Key *( “,” Key ) - * @return - * @throws RangeParseException - * if argument doesn't match above grammar or interpolation type - * isn't recognized - */ - public static List getRanges(String rangeSubset) - throws RangeParseException { - if (rangeSubset == null || rangeSubset.isEmpty()) { - throw new RangeParseException( - "range subset cannot be null or empty"); - } - String[] parts = rangeSubset.split(";"); - ArrayList rval = new ArrayList(parts.length); - for (String s : parts) { - rval.add(getField(s)); - } - return rval; - } - - /** - * @param fieldSubset - * string that conforms to the following grammar
- * FieldSubset = FieldId [ “:” Interpolation ] [ “[” AxisSubsets - * “]” ]
- * AxisSubsets = AxisSubset *( “,” AxisSubset )
- * AxisSubset = AxisId “[” Keys “]”
- * Keys = Key *( “,” Key ) - * @return - * @throws RangeParseException - * if argument doesn't match above grammar or interpolation type - * isn't recognized - */ - public static RangeField getField(String fieldSubset) - throws RangeParseException { - if (fieldSubset == null) { - throw new RangeParseException("field subset cannot be null"); - } - Matcher m = fieldPattern.matcher(fieldSubset); - if (m.matches()) { - String id = m.group(1); - String interp = m.group(3); - RangeField rval = new RangeField(id, null); - rval.setDefaultInterpolation(getInterp(interp)); - if (m.group(5) != null) { - rval.setAxis(RangeAxis.getAxisList(m.group(5))); - } - return rval; - } - throw new RangeParseException("Invalid field subset: " + fieldSubset); - } - - /** - * @param interp - * @return - * @throws RangeParseException - */ - protected static InterpolationType getInterp(String interp) - throws RangeParseException { - InterpolationType rval = InterpolationType.none; - try { - if (interp != null) { - rval = InterpolationType.valueOf(interp); - } - } catch (Throwable t) { - throw new RangeParseException("Invalid interpolation type: " - + interp, t); - } - return rval; - } - - @Override - public String toString() { - String rval = String.valueOf(identifier); - if (defaultInterpolation != null - && !defaultInterpolation.equals(InterpolationType.none)) { - rval = rval + ':' + defaultInterpolation; - } - if (axis != null && !axis.isEmpty()) { - List strList = new ArrayList(axis.size()); - for (RangeAxis ra : axis) { - strList.add(ra.toString()); - } - String axisStr = StringUtils.join(strList, ','); - rval = rval + '[' + axisStr + ']'; - } - return rval; - } - - public String getNullValue() { - return nullValue; - } - - public void setNullValue(String nullValue) { - this.nullValue = nullValue; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public RangeFieldDefinition getDefinition() { - return definition; - } - - public void setDefinition(RangeFieldDefinition definition) { - this.definition = definition; - } - - public InterpolationType getDefaultInterpolation() { - return defaultInterpolation; - } - - public void setDefaultInterpolation(InterpolationType defaultInterpolation) { - this.defaultInterpolation = defaultInterpolation; - } - - public List getAdditionalInterpolations() { - return additionalInterpolations; - } - - public void setAdditionalInterpolations( - List additionalInterpolations) { - this.additionalInterpolations = additionalInterpolations; - } - - public List getAxis() { - return axis; - } - - public void setAxis(List axis) { - this.axis = axis; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeFieldDefinition.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeFieldDefinition.java deleted file mode 100644 index 078a1684c0..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeFieldDefinition.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.uf.edex.wcs.reg; - -/** - * - * @author bclement - * @version 1.0 - */ -public class RangeFieldDefinition { - - public enum Closure { - open, closed, closedOpen, openClosed - }; - - protected double maxValue; - - protected double minValue; - - protected Closure closure; - - protected String units; - - /** - * @param maxValue - * @param minValue - */ - public RangeFieldDefinition(double maxValue, double minValue) { - this(maxValue, minValue, Closure.closed); - } - - /** - * @param maxValue - * @param minValue - * @param closure - */ - public RangeFieldDefinition(double maxValue, double minValue, - Closure closure) { - super(); - this.maxValue = maxValue; - this.minValue = minValue; - this.closure = closure; - } - - public String getUnits() { - return units; - } - - public void setUnits(String units) { - this.units = units; - } - - public double getMaxValue() { - return maxValue; - } - - public void setMaxValue(double maxValue) { - this.maxValue = maxValue; - } - - public double getMinValue() { - return minValue; - } - - public void setMinValue(double minValue) { - this.minValue = minValue; - } - - public Closure getClosure() { - return closure; - } - - public void setClosure(Closure closure) { - this.closure = closure; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeParseException.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeParseException.java deleted file mode 100644 index f3bef0e8fa..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/RangeParseException.java +++ /dev/null @@ -1,61 +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.edex.wcs.reg; - -/** - * TODO Add Description - * - * @author bclement - * @version 1.0 - */ -public class RangeParseException extends Exception { - - private static final long serialVersionUID = 2555591340601297507L; - - /** - * - */ - public RangeParseException() { - super(); - } - - /** - * @param message - * @param cause - */ - public RangeParseException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param message - */ - public RangeParseException(String message) { - super(message); - } - - /** - * @param cause - */ - public RangeParseException(Throwable cause) { - super(cause); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/TemporalCube.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/TemporalCube.java deleted file mode 100644 index 781a8f56a7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/TemporalCube.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 2, 2013            bclement     Initial creation
- *
- * 
- * - * @author bclement - * @version 1.0 - */ -public class TemporalCube implements Comparable { - - private final List slices; - - private final Date time; - - private final CoverageZAxis zAxis; - - /** - * - */ - public TemporalCube(Date time, CoverageZAxis zAxis) { - this(new ArrayList(), time, zAxis); - } - - /** - * @param cube - */ - public TemporalCube(List slices, Date time, - CoverageZAxis zAxis) { - this.slices = slices; - this.time = time; - this.zAxis = zAxis; - } - - /** - * @return the cube - */ - public List getSlices() { - return slices; - } - - public void add(VerticalSlice slice) { - this.slices.add(slice); - } - - /** - * @return the time - */ - public Date getTime() { - return time; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((time == null) ? 0 : time.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - TemporalCube other = (TemporalCube) obj; - if (time == null) { - if (other.time != null) - return false; - } else if (!time.equals(other.time)) - return false; - return true; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(TemporalCube o) { - if (o == null) { - return 1; - } - return this.time.compareTo(o.time); - } - - /** - * @return the zAxis - */ - public CoverageZAxis getzAxis() { - return zAxis; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/VerticalSlice.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/VerticalSlice.java deleted file mode 100644 index e8803f3651..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/VerticalSlice.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.reg; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 2, 2013            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class VerticalSlice implements Comparable { - - private final IDataRecordFetcher record; - - private final double level; - - /** - * @param record - * @param level - */ - public VerticalSlice(IDataRecordFetcher record, double level) { - this.record = record; - this.level = level; - } - - /** - * @return the record - */ - public IDataRecordFetcher getRecord() { - return record; - } - - /** - * @return the level - */ - public double getLevel() { - return level; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - long temp; - temp = Double.doubleToLongBits(level); - result = prime * result + (int) (temp ^ (temp >>> 32)); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - VerticalSlice other = (VerticalSlice) obj; - if (Double.doubleToLongBits(level) != Double - .doubleToLongBits(other.level)) - return false; - return true; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(VerticalSlice o) { - if (o == null) { - return 1; - } - return Double.compare(this.level, o.level); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/WcsSourceAccessor.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/WcsSourceAccessor.java deleted file mode 100644 index a06e5d0dae..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/reg/WcsSourceAccessor.java +++ /dev/null @@ -1,148 +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.edex.wcs.reg; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.context.ApplicationContext; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.core.EDEXUtil; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.format.IWcsDataFormatter; - -/** - * - * @author bclement - * @version 1.0 - */ -public class WcsSourceAccessor { - - private static Map> cache; - - private static Map formatMap; - - private static IUFStatusHandler log = UFStatus - .getHandler(WcsSourceAccessor.class); - - private WcsSourceAccessor() { - - } - - static { - new Thread(new Runnable() { - @Override - public void run() { - while (!EDEXUtil.isRunning()) { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - } - } - try { - ApplicationContext ctx = EDEXUtil.getSpringContext(); - String[] beans = ctx.getBeanNamesForType(IWcsSource.class); - cache = new HashMap>(beans.length); - for (String bean : beans) { - IWcsSource s = (IWcsSource) ctx - .getBean(bean); - cache.put(s.getKey(), s); - } - } catch (Throwable e) { - log.error("Unable to init wcs sources", e); - } - try { - ApplicationContext ctx = EDEXUtil.getSpringContext(); - String[] beans = ctx - .getBeanNamesForType(IWcsDataFormatter.class); - HashMap map = new HashMap( - beans.length); - for (String bean : beans) { - IWcsDataFormatter df = (IWcsDataFormatter) ctx - .getBean(bean); - map.put(df.getIdentifier(), df); - } - formatMap = Collections.unmodifiableMap(map); - } catch (Throwable e) { - log.error("Unable to init wcs formats", e); - } - } - }).run(); - } - - /** - * @param summary - * @return empty list if accessor isn't initialized - */ - public static List getCoverages(boolean summary) { - if (cache == null) { - return new ArrayList(0); - } - List cd = new ArrayList(); - for (String key : cache.keySet()) { - IWcsSource s = cache.get(key); - cd.addAll(s.listCoverages(summary)); - } - return cd; - } - - /** - * @param id - * @return null if source is not found or accessor isn't initialized - * @throws WcsException - */ - public static IWcsSource getSource(String id) throws WcsException { - if (cache == null) { - return null; - } - for (String key : cache.keySet()) { - IWcsSource s = cache.get(key); - if (s.hasCoverage(id)) { - return s; - } - } - return null; - } - - /** - * @return empty map if accessor isn't initialized - */ - public static Map getFormatMap() { - if (formatMap == null) { - return new HashMap(0); - } - return formatMap; - } - - /** - * @return empty list if accessor isn't initialized - */ - public static List getFormats() { - if (formatMap == null) { - return new ArrayList(0); - } - return new ArrayList(formatMap.keySet()); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DefactoEnabler.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DefactoEnabler.java deleted file mode 100644 index aaec17fede..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DefactoEnabler.java +++ /dev/null @@ -1,54 +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.edex.wcs.request; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.camel.Exchange; -import org.apache.camel.Message; -import org.apache.camel.Processor; -import org.apache.camel.component.http.HttpMessage; - -/** - * TODO Add Description - * - * @author jelkins - * @version 1.0 - */ -public class DefactoEnabler implements Processor { - - public static final String HEADER_KEY = "replyStandard"; - public static final String HEADER_VALUE = "defacto"; - - /* - * (non-Javadoc) - * - * @see org.apache.camel.Processor#process(org.apache.camel.Exchange) - */ - @Override - public void process(Exchange exchange) throws Exception { - Message in = exchange.getIn(); - in.getHeaders().put(HEADER_KEY, HEADER_VALUE); - exchange.getIn().setBody( - new HttpMessage(exchange, in.getBody(HttpServletRequest.class), - in.getBody(HttpServletResponse.class))); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DescCoverageRequest.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DescCoverageRequest.java deleted file mode 100644 index fe3c550d83..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/DescCoverageRequest.java +++ /dev/null @@ -1,98 +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.edex.wcs.request; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import net.opengis.wcs.v_1_1_2.DescribeCoverage; - -public class DescCoverageRequest extends WcsRequest{ - - protected String outputformat = "text/xml; subtype=gml/3.1.1"; - - protected String[] externalIds; - - protected String[] internalIds; - - public DescCoverageRequest() { - super(Type.DescribeCoverage); - } - - public DescCoverageRequest(DescribeCoverage req) { - super(Type.DescribeCoverage); - this.request = req; - List ids = req.getIdentifier(); - this.externalIds = new String[ids.size()]; - this.internalIds = new String[ids.size()]; - setIdentifiers(req.getIdentifier()); - } - - public String getOutputformat() { - return outputformat; - } - - public void setOutputformat(String outputformat) { - this.outputformat = outputformat; - } - - /** - * @return the externalIds - */ - public String[] getExternalIds() { - return externalIds; - } - - /** - * @param externalIds - * the externalIds to set - */ - public void setExternalIds(String[] externalIds) { - this.externalIds = externalIds; - } - - /** - * @return the internalIds - */ - public String[] getInternalIds() { - return internalIds; - } - - /** - * @param internalIds - * the internalIds to set - */ - public void setInternalIds(String[] internalIds) { - this.internalIds = internalIds; - } - - /** - * @param array - */ - public void setIdentifiers(Collection ids) { - Iterator iter = ids.iterator(); - for (int i = 0; iter.hasNext(); ++i) { - externalIds[i] = iter.next(); - internalIds[i] = externalToInternal(externalIds[i]); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCapRequest.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCapRequest.java deleted file mode 100644 index be418af17d..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCapRequest.java +++ /dev/null @@ -1,30 +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.edex.wcs.request; - - -public class GetCapRequest extends WcsRequest { - - public GetCapRequest() { - super(Type.GetCapabilities); - } - - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCoverageRequest.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCoverageRequest.java deleted file mode 100644 index c545b522e0..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetCoverageRequest.java +++ /dev/null @@ -1,496 +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.edex.wcs.request; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashSet; -import java.util.List; - -import javax.xml.bind.DatatypeConverter; - -import net.opengis.gml.v_3_1_1.EnvelopeType; -import net.opengis.gml.v_3_1_1.TimeInstantPropertyType; -import net.opengis.gml.v_3_1_1.TimeInstantType; -import net.opengis.gml.v_3_1_1.TimePeriodPropertyType; -import net.opengis.gml.v_3_1_1.TimePeriodType; -import net.opengis.gml.v_3_1_1.TimePositionType; -import net.opengis.ows.v_1_1_0.BoundingBoxType; -import net.opengis.wcs.v_1_1_2.AxisSubset; -import net.opengis.wcs.v_1_1_2.DomainSubsetType; -import net.opengis.wcs.v_1_1_2.GetCoverage; -import net.opengis.wcs.v_1_1_2.GridCrsType; -import net.opengis.wcs.v_1_1_2.OutputType; -import net.opengis.wcs.v_1_1_2.RangeSubsetType; -import net.opengis.wcs.v_1_1_2.RangeSubsetType.FieldSubset; -import net.opengis.wcs.v_1_1_2.TimeSequenceType; - -import org.geotools.geometry.jts.ReferencedEnvelope; - -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.gml3_1_1.EnvelopeConverter; -import com.raytheon.uf.edex.ogc.common.spatial.BoundingBoxUtil; -import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.reg.RangeAxis; -import com.raytheon.uf.edex.wcs.reg.RangeField; - -public class GetCoverageRequest extends WcsRequest { - - protected String externalId; - - protected String internalId; - - protected String format; - - protected Composite3DBoundingBox bbox; - - protected List fields; - - protected boolean store = false; - - protected DataTime timeSequence; - - protected String gridBaseCrs; - - protected String gridType; - - protected List gridOrigin; - - protected List gridOffsets; - - protected boolean defacto = false; - - public GetCoverageRequest() { - super(Type.GetCoverage); - } - - public GetCoverageRequest(GetCoverage req) throws WcsException { - super(Type.GetCoverage); - this.request = req; - if (req.isSetIdentifier()) { - this.externalId = req.getIdentifier().getValue(); - this.internalId = externalToInternal(this.externalId); - } - if (req.isSetOutput()) { - setOutput(req.getOutput()); - } - if (req.isSetDomainSubset()) { - setDomain(req.getDomainSubset()); - } - if (req.isSetRangeSubset()) { - setRange(req.getRangeSubset()); - } - } - - /** - * Set range fields from jaxb object - * - * @param rangeSubset - */ - private void setRange(RangeSubsetType range) { - List subsets = range.getFieldSubset(); - if (subsets == null) { - return; - } - this.fields = new ArrayList(subsets.size()); - for (FieldSubset sub : subsets) { - this.fields.add(getField(sub)); - } - } - - /** - * Convert jaxb field object to internal representation - * - * @param sub - * @return - */ - private RangeField getField(FieldSubset sub) { - String id = sub.getIdentifier().getValue(); - RangeField rval = new RangeField(id, null); - List axisList = sub.getAxisSubset(); - List target = new ArrayList(axisList.size()); - for (AxisSubset axis : axisList) { - String axisId = axis.getIdentifier(); - List keys = axis.getKey(); - target.add(new RangeAxis(axisId, new HashSet(keys))); - } - rval.setAxis(target); - return rval; - } - - /** - * Set domain from jaxb object - * - * @param domain - * @throws Exception - */ - private void setDomain(DomainSubsetType domain) throws WcsException { - if (domain.isSetBoundingBox()) { - try { - Object obj = domain.getBoundingBox().getValue(); - if (obj instanceof EnvelopeType) { - setBbox((EnvelopeType) obj); - } else if (obj instanceof BoundingBoxType) { - setBbox((BoundingBoxType) obj); - } - } catch (OgcException e) { - throw new WcsException(e); - } - } - if (domain.isSetTemporalSubset()) { - TimeSequenceType tseq = domain.getTemporalSubset(); - setTime(tseq); - } - } - - /** - * Set bounding box from jaxb object - * - * @param etype - * @throws OgcException - */ - public void setBbox(EnvelopeType etype) throws OgcException { - if (EnvelopeConverter.getDims(etype) == 2) { - ReferencedEnvelope ref = BoundingBoxUtil.convert2D(etype); - this.bbox = new Composite3DBoundingBox(ref); - } else if (EnvelopeConverter.getDims(etype) == 3) { - this.bbox = BoundingBoxUtil.separate3DEnvelope(etype); - } else { - throw new OgcException( - com.raytheon.uf.edex.ogc.common.OgcException.Code.InvalidCRS, - "Unsupported number of dimensions"); - } - } - - /** - * Set bounding box from jaxb object - * - * @param bbt - * @throws OgcException - */ - public void setBbox(BoundingBoxType bbt) throws OgcException { - int dims = bbt.getLowerCorner().size(); - if (dims == 2) { - this.bbox = new Composite3DBoundingBox( - BoundingBoxUtil.convert2D(bbt)); - } else if (dims == 3) { - this.bbox = BoundingBoxUtil.separate3DEnvelope(bbt); - } else { - throw new OgcException( - com.raytheon.uf.edex.ogc.common.OgcException.Code.InvalidCRS, - "Unsupported number of dimensions"); - } - } - - /** - * Set time from jaxb object - * - * @param tseq - */ - private void setTime(TimeSequenceType tseq) { - List times = parseTime(tseq); - if (!times.isEmpty()) { - // TODO handle multiple times - this.timeSequence = times.get(0); - } - } - - /** - * Convert jaxb time sequence into internal representation. - * - * Returned data times will have instances in the refTime field and ranges - * in the valid range field - * - * @param tseq - * @return - */ - public static List parseTime(TimeSequenceType tseq) { - if (!tseq.isSetTimePositionOrTimePeriod()) { - return new ArrayList(0); - } - List times = tseq.getTimePositionOrTimePeriod(); - List rval = new ArrayList(times.size()); - for (Object obj : times) { - if (obj instanceof TimeInstantType) { - TimeInstantType inst = (TimeInstantType) obj; - rval.add(getInstant(inst.getTimePosition())); - } else if (obj instanceof TimePositionType) { - rval.add(getInstant((TimePositionType) obj)); - } else if (obj instanceof TimeInstantPropertyType) { - TimeInstantPropertyType prop = (TimeInstantPropertyType) obj; - TimeInstantType inst = prop.getTimeInstant(); - rval.add(getInstant(inst.getTimePosition())); - } else if (obj instanceof TimePeriodType) { - TimePeriodType period = (TimePeriodType) obj; - rval.add(getPeriod(period)); - } else if (obj instanceof TimePeriodPropertyType) { - TimePeriodPropertyType prop = (TimePeriodPropertyType) obj; - rval.add(getPeriod(prop.getTimePeriod())); - } else if (obj instanceof net.opengis.wcs.v_1_1_2.TimePeriodType) { - rval.add(getPeriod((net.opengis.wcs.v_1_1_2.TimePeriodType) obj)); - } - } - return rval; - } - - /** - * Convert jaxb time position to data time - * - * Returned data time will have position value in refTime field - * - * @param pos - * @return - */ - private static DataTime getInstant(TimePositionType pos) { - return new DataTime(getTime(pos)); - } - - /** - * Convert jaxb time period to data time - * - * returned data time will have period value in valid period field - * - * @param period - * @return - */ - private static DataTime getPeriod( - net.opengis.wcs.v_1_1_2.TimePeriodType period) { - TimePositionType begin = period.getBeginPosition(); - TimePositionType end = period.getEndPosition(); - return getPeriod(begin, end); - } - - /** - * Convert jaxb time period to data time - * - * returned data time will have period value in valid period field - * - * @param period - * @return - */ - private static DataTime getPeriod(TimePeriodType period) { - TimePositionType begin; - TimePositionType end; - if (period.isSetBegin()) { - TimeInstantPropertyType b = period.getBegin(); - TimeInstantType inst = b.getTimeInstant(); - begin = inst.getTimePosition(); - } else if (period.isSetBeginPosition()) { - begin = period.getBeginPosition(); - } else { - throw new IllegalArgumentException("No begin found in period"); - } - if (period.isSetEnd()) { - TimeInstantPropertyType b = period.getEnd(); - TimeInstantType inst = b.getTimeInstant(); - end = inst.getTimePosition(); - } else if (period.isSetEndPosition()) { - end = period.getEndPosition(); - } else { - throw new IllegalArgumentException("No end found in period"); - } - return getPeriod(begin, end); - } - - /** - * Convert jaxb time period to data time - * - * returned data time will have period value in valid period field - * - * @param begin - * @param end - * @return - */ - private static DataTime getPeriod(TimePositionType begin, - TimePositionType end) { - Calendar beginCal = getTime(begin); - Calendar endCal = getTime(end); - TimeRange validPeriod = new TimeRange(beginCal, endCal); - return new DataTime(beginCal, validPeriod); - } - - /** - * Convert jaxb object to java calendar - * - * @param pos - * @return - */ - private static Calendar getTime(TimePositionType pos) { - String val = pos.getValue().get(0); - return DatatypeConverter.parseDateTime(val); - } - - /** - * Set output format from jaxb object - * - * @param output - */ - private void setOutput(OutputType output) { - if (output.isSetFormat()) { - this.format = output.getFormat(); - } - if (output.isSetGridCRS()) { - GridCrsType base = output.getGridCRS(); - this.gridBaseCrs = base.getGridBaseCRS(); - this.gridType = base.getGridCS(); - this.gridOffsets = base.getGridOffsets(); - this.gridOrigin = base.getGridOrigin(); - } - if (output.isSetStore()) { - this.store = output.isStore(); - } - } - - /** - * @return the externalId - */ - public String getExternalId() { - return externalId; - } - - /** - * @param externalId - * the externalId to set - */ - public void setExternalId(String externalId) { - this.externalId = externalId; - } - - /** - * @return the internalId - */ - public String getInternalId() { - return internalId; - } - - /** - * @param internalId - * the internalId to set - */ - public void setInternalId(String internalId) { - this.internalId = internalId; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - public boolean isStore() { - return store; - } - - public void setStore(boolean store) { - this.store = store; - } - - /** - * @return the bbox - */ - public Composite3DBoundingBox getBbox() { - return bbox; - } - - /** - * @param bbox - * the bbox to set - */ - public void setBbox(Composite3DBoundingBox bbox) { - this.bbox = bbox; - } - - public DataTime getTimeSequence() { - return timeSequence; - } - - public void setTimeSequence(DataTime timeSequence) { - this.timeSequence = timeSequence; - } - - public String getGridBaseCrs() { - return gridBaseCrs; - } - - public void setGridBaseCrs(String gridBaseCrs) { - this.gridBaseCrs = gridBaseCrs; - } - - public String getGridType() { - return gridType; - } - - public void setGridType(String gridType) { - this.gridType = gridType; - } - - public List getGridOrigin() { - return gridOrigin; - } - - public void setGridOrigin(List gridOrigin) { - this.gridOrigin = gridOrigin; - } - - public List getGridOffsets() { - return gridOffsets; - } - - public void setGridOffsets(List gridOffsets) { - this.gridOffsets = gridOffsets; - } - - /** - * @param defacto - * the defacto to set - */ - public void setDefacto(boolean defacto) { - this.defacto = defacto; - } - - /** - * @return the defacto - */ - public boolean isDefacto() { - return defacto; - } - - /** - * @param identifier - */ - public void setIdentifier(String identifier) { - this.externalId = identifier; - this.internalId = externalToInternal(this.externalId); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetDataRequest.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetDataRequest.java deleted file mode 100644 index c765af1559..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/GetDataRequest.java +++ /dev/null @@ -1,105 +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.edex.wcs.request; - -public class GetDataRequest extends WcsRequest { - - private String group = ""; - - private String dataset = ""; - - protected String xOffset; - - protected String yOffset; - - protected String width; - - protected String height; - - public GetDataRequest() { - super(Type.GetData); - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } - - public String getDataset() { - return dataset; - } - - public void setDataset(String dataset) { - this.dataset = dataset; - } - - public String getxOffset() { - return xOffset; - } - - public void setxOffset(String xOffset) { - this.xOffset = xOffset; - } - - public String getyOffset() { - return yOffset; - } - - public void setyOffset(String yOffset) { - this.yOffset = yOffset; - } - - public String getWidth() { - return width; - } - - public void setWidth(String width) { - this.width = width; - } - - public String getHeight() { - return height; - } - - public void setHeight(String height) { - this.height = height; - } - - public int[] getMinIndex() { - int[] minIndex = { 0, 0 }; - - minIndex[0] = Integer.parseInt(xOffset); - minIndex[1] = Integer.parseInt(yOffset); - - return minIndex; - } - - public int[] getMaxIndex() { - int[] maxIndex = { 0, 0 }; - - maxIndex[0] = Integer.parseInt(xOffset) + Integer.parseInt(width); - maxIndex[1] = Integer.parseInt(yOffset) + Integer.parseInt(height); - - return maxIndex; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/WcsRequest.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/WcsRequest.java deleted file mode 100644 index 79c7cf2be5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/request/WcsRequest.java +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************************** - * COPYRIGHT (c), 2006, RAYTHEON COMPANY - * ALL RIGHTS RESERVED, An Unpublished Work - * - * RAYTHEON PROPRIETARY - * If the end user is not the U.S. Government or any agency thereof, use - * or disclosure of data contained in this source code file is subject to - * the proprietary restrictions set forth in the Master Rights File. - * - * U.S. GOVERNMENT PURPOSE RIGHTS NOTICE - * If the end user is the U.S. Government or any agency thereof, this source - * code is provided to the U.S. Government with Government Purpose Rights. - * Use or disclosure of data contained in this source code file is subject to - * the "Government Purpose Rights" restriction in the Master Rights File. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * Use or disclosure of data contained in this source code file is subject to - * the export restrictions set forth in the Master Rights File. - ******************************************************************************************/ - -package com.raytheon.uf.edex.wcs.request; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.wcs.provider.CustomIdMap; - -/** - * TODO - Class comment here - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 
- * 
- * - * @author - * @version 1 - */ - -public class WcsRequest { - - public enum Type { - GetCoverage, DescribeCoverage, GetCapabilities, GetData, ERROR - } - - protected Type type; - - protected Object request; - - protected MimeType exceptionFormat = OgcResponse.TEXT_XML_MIME; - - public WcsRequest(Type type) { - this.type = type; - } - - /** - * Map external id to internal URN - * - * @param id - * @return id if no mapping exists - */ - public String externalToInternal(String id) { - return CustomIdMap.externalToInternal(id); - } - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public Object getRequest() { - return request; - } - - public void setRequest(Object request) { - this.request = request; - } - - /** - * @return the exceptionFormat - */ - public MimeType getExceptionFormat() { - return exceptionFormat; - } - - /** - * @param exceptionFormat - * the exceptionFormat to set - */ - public void setExceptionFormat(MimeType exceptionFormat) { - this.exceptionFormat = exceptionFormat; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/IWcsPortType.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/IWcsPortType.java deleted file mode 100644 index b3e0f10037..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/IWcsPortType.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ - -package com.raytheon.uf.edex.wcs.soap1_1_2; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.ws.BindingType; - -import net.opengis.wcs.v_1_1_2.Capabilities; -import net.opengis.wcs.v_1_1_2.CoverageDescriptions; -import net.opengis.wcs.v_1_1_2.CoveragesType; -import net.opengis.wcs.v_1_1_2.DescribeCoverage; -import net.opengis.wcs.v_1_1_2.GetCapabilities; -import net.opengis.wcs.v_1_1_2.GetCoverage; - -import com.raytheon.uf.edex.ogc.common.soap.ServiceExceptionReport; - -/** - * This class was generated by the JAX-WS RI. JAX-WS RI 2.1.6 in JDK 6 Generated - * source version: 2.1 - * - */ -@WebService(name = "WcsPortType", targetNamespace = "http://wcs.edex.uf.raytheon.com") -@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface IWcsPortType { - - /** - * - * @param body - * @return returns net.opengis.wcs._1.Capabilities - * @throws ServiceExceptionReport - */ - @WebMethod(operationName = "GetCapabilitiesOperation") - @WebResult(name = "Capabilities", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - public Capabilities getCapabilitiesOperation( - @WebParam(name = "GetCapabilities", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - GetCapabilities body) throws ServiceExceptionReport; - - /** - * - * @param body - * @return returns net.opengis.wcs._1.CoverageDescriptions - * @throws ServiceExceptionReport - */ - @WebMethod(operationName = "DescribeCoverageOperation") - @WebResult(name = "CoverageDescriptions", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - public CoverageDescriptions describeCoverageOperation( - @WebParam(name = "DescribeCoverage", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - DescribeCoverage body) throws ServiceExceptionReport; - - /** - * @param body - * @param response - * @param coverageData - * @throws ServiceExceptionReport - */ - @WebMethod(operationName = "GetCoverageOperation") - @WebResult(name = "Coverages", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - public CoveragesType getCoverageOperation( - @WebParam(name = "GetCoverage", targetNamespace = "http://www.opengis.net/wcs/1.1", partName = "Body") - GetCoverage body) throws ServiceExceptionReport; - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/WcsImpl.java b/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/WcsImpl.java deleted file mode 100644 index 57d3d247fd..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wcs/src/com/raytheon/uf/edex/wcs/soap1_1_2/WcsImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright 09/24/12 Raytheon Company. - * - * Unlimited Rights - * This software was developed pursuant to Contract Number - * DTFAWA-10-D-00028 with the US Government. The US Government’s rights - * in and to this copyrighted software are as specified in DFARS - * 252.227-7014 which was made part of the above contract. - */ -package com.raytheon.uf.edex.wcs.soap1_1_2; - -import java.util.HashMap; -import java.util.Map; - -import javax.activation.DataHandler; -import javax.annotation.Resource; -import javax.xml.ws.WebServiceContext; -import javax.xml.ws.handler.MessageContext; - -import net.opengis.wcs.v_1_1_2.Capabilities; -import net.opengis.wcs.v_1_1_2.CoverageDescriptions; -import net.opengis.wcs.v_1_1_2.CoveragesType; -import net.opengis.wcs.v_1_1_2.DescribeCoverage; -import net.opengis.wcs.v_1_1_2.GetCapabilities; -import net.opengis.wcs.v_1_1_2.GetCoverage; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.log.cxf.RequestLogController; -import com.raytheon.uf.edex.ogc.common.http.EndpointInfo; -import com.raytheon.uf.edex.ogc.common.soap.AbstractOwsService; -import com.raytheon.uf.edex.ogc.common.soap.ServiceExceptionReport; -import com.raytheon.uf.edex.ogc.common.stats.IStatsRecorder; -import com.raytheon.uf.edex.ogc.common.stats.OperationType; -import com.raytheon.uf.edex.ogc.common.stats.ServiceType; -import com.raytheon.uf.edex.ogc.common.stats.StatsRecorderFinder; -import com.raytheon.uf.edex.wcs.CoveragesHolder; -import com.raytheon.uf.edex.wcs.WcsException; -import com.raytheon.uf.edex.wcs.WcsException.Code; -import com.raytheon.uf.edex.wcs.provider.OgcWcsProvider; -import com.raytheon.uf.edex.wcs.request.DescCoverageRequest; -import com.raytheon.uf.edex.wcs.request.GetCoverageRequest; - -/** - * TODO Add Description - * - *
- * R
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 28, 2012            bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ - -public class WcsImpl extends AbstractOwsService implements IWcsPortType { - - protected OgcWcsProvider provider; - - @Resource - protected WebServiceContext context; - - private static final String VERSION = "1.1.2"; - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - public WcsImpl(OgcWcsProvider provider) { - this.provider = provider; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.soap1_1_2.WcsPortType#getCapabilitiesOperation - * (net.opengis.wcs.v_1_1_2.GetCapabilities) - */ - @Override - public Capabilities getCapabilitiesOperation(GetCapabilities body) - throws ServiceExceptionReport { - long start = System.nanoTime(); - boolean success = true; - EndpointInfo endInfo = getInfo(); - try { - return provider.getCapabilities(endInfo, body); - } catch (Exception e) { - success = false; - log.error("Problem with get coverage", e); - throw getReport(Code.InternalServerError.toString(), - "Internal Server Error", VERSION); - } finally { - long duration = System.nanoTime() - start; - IStatsRecorder statRecorder = StatsRecorderFinder.find(); - statRecorder.recordRequest(System.currentTimeMillis(), - duration, ServiceType.WCS, OperationType.QUERY, success); - - logRequestInfo(duration, success, endInfo); - } - } - - protected ServiceExceptionReport getReport(WcsException e) { - return super.getReport(e.getCode().toString(), e.getMessage(), VERSION); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.soap1_1_2.WcsPortType#describeCoverageOperation - * (net.opengis.wcs.v_1_1_2.DescribeCoverage) - */ - @Override - public CoverageDescriptions describeCoverageOperation(DescribeCoverage body) - throws ServiceExceptionReport { - long start = System.nanoTime(); - boolean success = true; - EndpointInfo endInfo = getInfo(); - try { - return provider.describeCoverage(endInfo, - new DescCoverageRequest(body)); - } catch (WcsException e) { - success = false; - throw getReport(e); - } finally { - long duration = System.nanoTime() - start; - IStatsRecorder statRecorder = StatsRecorderFinder.find(); - statRecorder.recordRequest(System.currentTimeMillis(), - duration, ServiceType.WCS, OperationType.QUERY, success); - - logRequestInfo(duration, success, endInfo); - } - } - - - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wcs.soap1_1_2.WcsPortType#getCoverageOperation(net - * .opengis.wcs.v_1_1_2.GetCoverage) - */ - @Override - public CoveragesType getCoverageOperation(GetCoverage body) - throws ServiceExceptionReport { - long start = System.nanoTime(); - boolean success = true; - EndpointInfo endInfo = getInfo(); - try { - CoveragesHolder holder = provider.getCoverage(endInfo, - new GetCoverageRequest(body)); - Map attachments = getAttachments(holder); - context.getMessageContext().put( - MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, attachments); - return holder.getMetadata(); - } catch (WcsException e) { - success = false; - throw getReport(e); - } catch (Exception e) { - success = false; - log.error("Problem with get coverage", e); - throw getReport(Code.InternalServerError.toString(), - "Internal Server Error", VERSION); - } finally { - long duration = System.nanoTime() - start; - IStatsRecorder statRecorder = StatsRecorderFinder.find(); - statRecorder.recordRequest(System.currentTimeMillis(), - duration, ServiceType.WCS, OperationType.QUERY, success); - - logRequestInfo(duration, success, endInfo); - } - } - - /** - * Wrap attachments in data handlers - * - * @param holder - * @return - */ - private Map getAttachments(CoveragesHolder holder) { - String contentType = holder.getContentType(); - Map data = holder.getData(); - Map rval = new HashMap(data.size()); - for (String id : data.keySet()) { - DataHandler h = new DataHandler(data.get(id), contentType); - rval.put(id, h); - } - return rval; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.ogc.common.soap.AbstractOwsService#getContext() - */ - @Override - protected WebServiceContext getContext() { - return context; - } - - private void logRequestInfo(long durationNanos, boolean success, - EndpointInfo endInfo) { - if (endInfo != null && - RequestLogController.getInstance().shouldLogRequestsInfo() && - log.isPriorityEnabled(RequestLogController.getInstance().getRequestLogLevel())) { - String requestLog = ""; - if(success){ - requestLog += "Successfully processed "; - } else { - requestLog += "Failed to process "; - } - requestLog += "request from " + endInfo.getHost() + ". "; - requestLog += "Duration of " + (durationNanos/1000000000.0) + "s."; - log.handle(RequestLogController.getInstance().getRequestLogLevel(), - requestLog); - } - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wfs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.wfs/META-INF/MANIFEST.MF index 79f9d49fe8..725e9d1e01 100644 --- a/edexOsgi/com.raytheon.uf.edex.wfs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.wfs/META-INF/MANIFEST.MF @@ -25,7 +25,6 @@ Require-Bundle: org.geotools;bundle-version="2.6.4", com.raytheon.uf.common.spatial;bundle-version="1.0.0", org.w3.xmlschema;bundle-version="1.0.0", com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", - com.raytheon.uf.edex.plugin.dataset.urn;bundle-version="1.0.0", org.apache.commons.collections;bundle-version="3.2.0", org.apache.commons.cxf;bundle-version="1.0.0" Export-Package: com.raytheon.uf.edex.wfs, diff --git a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/wxxm/AbstractWxxm32Translator.java b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/wxxm/AbstractWxxm32Translator.java index adb32cf22b..35db8b1cee 100644 --- a/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/wxxm/AbstractWxxm32Translator.java +++ b/edexOsgi/com.raytheon.uf.edex.wfs/src/com/raytheon/uf/edex/wfs/wxxm/AbstractWxxm32Translator.java @@ -73,7 +73,6 @@ import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.edex.ogc.common.OgcGeoBoundingBox; import com.raytheon.uf.edex.ogc.common.db.LayerTransformer; import com.raytheon.uf.edex.ogc.common.gml3_2_1.GeometryConverter; -import com.raytheon.uf.edex.plugin.dataset.urn.URNLookup; import com.raytheon.uf.edex.wfs.WfsFeatureType; import com.raytheon.uf.edex.wfs.reg.AbstractWfsSource; import com.raytheon.uf.edex.wfs.request.QualifiedName; @@ -121,6 +120,12 @@ public abstract class AbstractWxxm32Translator // FIXME guess based on aircraft URN public static final String AIRFRAME_URN = "urn:icao:Airframe:type"; + // From ucar.edu WXCM primer + public static final String FDC_AIRCRAFT_REPORT = "urn:fdc:icao:procedure:AircraftReport"; + + // From ucar.edu WXCM primer + public static final String ICAO_CODE_PREFIX = "urn:icao:code:weatherStation"; + // FIXME public static final String FLIGHT_URN = ""; @@ -760,7 +765,7 @@ public abstract class AbstractWxxm32Translator protected void addAircraftObsInformation(ObservationType obs, AircraftObsLocation location) { // Add procedure, this is currently the same in AIREP, PIREP and ACARS - String procedure = URNLookup.getAircraftReportURN(); + String procedure = FDC_AIRCRAFT_REPORT; obs.setProcedure(createProcedure(procedure)); // Add observed property // This is potentially from the ontology, like diff --git a/edexOsgi/com.raytheon.uf.edex.wms/.classpath b/edexOsgi/com.raytheon.uf.edex.wms/.classpath deleted file mode 100644 index bcf9c5c105..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.wms/.project b/edexOsgi/com.raytheon.uf.edex.wms/.project deleted file mode 100644 index 8c2ce000d6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.uf.edex.wms - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/edexOsgi/com.raytheon.uf.edex.wms/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.wms/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 620e405976..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Jan 23 15:47:57 CST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.wms/META-INF/MANIFEST.MF deleted file mode 100644 index 862ec68b5f..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/MANIFEST.MF +++ /dev/null @@ -1,41 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Wms -Bundle-SymbolicName: com.raytheon.uf.edex.wms -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: RAYTHEON -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", - net.opengis;bundle-version="1.0.2", - org.codehaus.jackson;bundle-version="1.7.3", - org.geotools;bundle-version="2.6.4", - org.apache.commons.lang;bundle-version="2.3.0", - org.apache.commons.pool;bundle-version="1.3.0", - com.raytheon.uf.edex.ogc.common;bundle-version="1.0.0", - com.raytheon.uf.common.colormap;bundle-version="1.12.1174", - org.apache.camel;bundle-version="1.0.0", - org.dom4j;bundle-version="1.0.0", - org.apache.velocity;bundle-version="1.5.0", - com.raytheon.uf.common.json;bundle-version="1.0.0", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", - com.raytheon.uf.edex.database, - org.apache.commons.codec;bundle-version="1.4.0", - org.apache.commons.collections;bundle-version="3.2.0", - com.raytheon.uf.common.spatial;bundle-version="1.0.0", - org.eclipse.jetty;bundle-version="7.6.9", - com.raytheon.uf.common.status;bundle-version="1.12.1174" -Import-Package: com.raytheon.uf.common.colormap, - com.raytheon.uf.common.time.util, - com.raytheon.uf.edex.ogc.common, - com.raytheon.uf.edex.ogc.common.colormap, - com.raytheon.uf.edex.ogc.common.db, - com.raytheon.uf.edex.ogc.common.http, - javax.servlet, - javax.servlet.http -Export-Package: com.raytheon.uf.edex.wms, - com.raytheon.uf.edex.wms.format, - com.raytheon.uf.edex.wms.provider, - com.raytheon.uf.edex.wms.reg, - com.raytheon.uf.edex.wms.sld, - com.raytheon.uf.edex.wms.styling, - com.raytheon.uf.edex.wms.util diff --git a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-body.vm b/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-body.vm deleted file mode 100644 index d1f90fc272..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-body.vm +++ /dev/null @@ -1,23 +0,0 @@ - - - - -#foreach( $attribute in $type.getAttributeDescriptors() ) - -#end ##foreach attribute in attributes - -#set( $odd = false ) -#foreach( $feature in $features ) -#if ( $odd ) - -#{else} - -#end ##if odd -#set( $odd = !$odd ) -#foreach( $attribute in $feature.getAttributes() ) - -#end ##foreach attribute in attributes - -#end ##foreach feature in features -
${type.name}
${attribute.getLocalName()}
${attribute.toString()}
-
diff --git a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-header.txt b/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-header.txt deleted file mode 100644 index a1f5c8770a..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/META-INF/templates/gfi-html-header.txt +++ /dev/null @@ -1,31 +0,0 @@ - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wms/build.properties b/edexOsgi/com.raytheon.uf.edex.wms/build.properties deleted file mode 100644 index e016089273..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -source.. = src/ -bin.includes = .project,\ - .classpath,\ - META-INF/,\ - build.properties,\ - .settings/,\ - .,\ - res/ diff --git a/edexOsgi/com.raytheon.uf.edex.wms/com.raytheon.uf.edex.wms.ecl b/edexOsgi/com.raytheon.uf.edex.wms/com.raytheon.uf.edex.wms.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/edexOsgi/com.raytheon.uf.edex.wms/overview.uml b/edexOsgi/com.raytheon.uf.edex.wms/overview.uml deleted file mode 100644 index 160db458f7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/overview.uml +++ /dev/null @@ -1,41 +0,0 @@ -@startuml - -package "EDEX WMS Component" { - [WMS HTTP Endpoint] as wmshttp - - [WMS 1.3.0 Provider] as wms130 - - () "WMS Source" as isrc - - [WMS Source Accessor] as reg - - [Abstract Coverage WMS Source] as covsrc - [Abstract Feature WMS Source] as featsrc - - [Styled Layer Descriptor (SLD) Styler] as fstyle - [Colormap Data Styler] as cstyle -} - -node "EDEX Feature Data Plug-in Adapter" { - [Plug-in WMS Source] as fsrc -} - -node "EDEX Coverage Data Plug-in Adapter" { - [Plug-in WMS Source] as csrc -} - -wmshttp *-- wms130 - -reg o-- "*" isrc - -wms130 *-- reg - -isrc -- covsrc -isrc -- featsrc -csrc -left-|> covsrc -fsrc -left-|> featsrc - -cstyle *-left- covsrc -featsrc *-right- fstyle - -@enduml \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wms/res/spring/wms-ogc-request.xml b/edexOsgi/com.raytheon.uf.edex.wms/res/spring/wms-ogc-request.xml deleted file mode 100644 index 7948aa35df..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/res/spring/wms-ogc-request.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - net.opengis.wms.v_1_3_0.ObjectFactory - net.opengis.sld.v_1_1_0.ObjectFactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/BaseRequest.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/BaseRequest.java deleted file mode 100644 index deeefd3119..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/BaseRequest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Sep 7, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.wms.IWmsProvider.WmsOpType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class BaseRequest { - - protected String version; - - protected MimeType format; - - protected String userName; - - protected String[] roles; - - protected MimeType exceptionFormat = OgcResponse.TEXT_XML_MIME; - - protected String updateSequence; - - protected OgcServiceInfo serviceinfo; - - /** - * - */ - public BaseRequest() { - // TODO Auto-generated constructor stub - } - - public BaseRequest(String version, MimeType format, String userName, - String[] roles) { - super(); - this.version = version; - this.format = format; - this.userName = userName; - this.roles = roles; - } - - @SuppressWarnings("unchecked") - public OgcResponse execute(IWmsProvider provider) { - return provider.getCapabilities((BaseRequest) this); - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @param version - * the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @return the format - */ - public MimeType getFormat() { - return format; - } - - /** - * @param format - * the format to set - */ - public void setFormat(MimeType format) { - this.format = format; - } - - /** - * @return the exceptionFormat - */ - public MimeType getExceptionFormat() { - return exceptionFormat; - } - - /** - * @param exceptionFormat - * the exceptionFormat to set - */ - public void setExceptionFormat(MimeType exceptionFormat) { - this.exceptionFormat = exceptionFormat; - } - - /** - * @return the updateSequence - */ - public String getUpdateSequence() { - return updateSequence; - } - - /** - * @param updateSequence - * the updateSequence to set - */ - public void setUpdateSequence(String updateSequence) { - this.updateSequence = updateSequence; - } - - /** - * @return the serviceinfo - */ - public OgcServiceInfo getServiceinfo() { - return serviceinfo; - } - - /** - * @param serviceinfo - * the serviceinfo to set - */ - public void setServiceinfo(OgcServiceInfo serviceinfo) { - this.serviceinfo = serviceinfo; - } - - /** - * @return the userName - */ - public String getUserName() { - return userName; - } - - /** - * @param userName - * the userName to set - */ - public void setUserName(String userName) { - this.userName = userName; - } - - /** - * @return the roles - */ - public String[] getRoles() { - return roles; - } - - /** - * @param roles - * the roles to set - */ - public void setRoles(String[] roles) { - this.roles = roles; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetFeatureInfoRequest.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetFeatureInfoRequest.java deleted file mode 100644 index fa16b21946..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetFeatureInfoRequest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Aug 4, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.http.MimeType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class GetFeatureInfoRequest extends GetMapRequest { - - protected String[] reqLayers; - - protected int featureCount = 1; - - protected Integer i; - - protected Integer j; - - protected MimeType infoFormat; - - public GetFeatureInfoRequest() { - } - - public GetFeatureInfoRequest(GetMapRequest mapRequest, String[] reqLayers, - Integer i, Integer j, MimeType infoFormat) { - super(mapRequest); - this.reqLayers = reqLayers; - this.i = i; - this.j = j; - this.infoFormat = infoFormat; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.BaseRequest#execute(com.raytheon.uf.edex.wms - * .WmsProvider) - */ - @Override - public OgcResponse execute(IWmsProvider provider) { - return provider.getFeatureInfo(this); - } - - public GetMapRequest getMapRequest() { - return this; - } - - public int getFeatureCount() { - return featureCount; - } - - public void setFeatureCount(int featureCount) { - this.featureCount = featureCount; - } - - public Integer getI() { - return i; - } - - public void setI(Integer i) { - this.i = i; - } - - public Integer getJ() { - return j; - } - - public void setJ(Integer j) { - this.j = j; - } - - /** - * @return the reqLayers - */ - public String[] getReqLayers() { - return reqLayers; - } - - /** - * @param reqLayers - * the reqLayers to set - */ - public void setReqLayers(String[] reqLayers) { - this.reqLayers = reqLayers; - } - - public MimeType getInfoFormat() { - return infoFormat; - } - - public void setInfoFormat(MimeType infoFormat) { - this.infoFormat = infoFormat; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetLegendGraphicRequest.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetLegendGraphicRequest.java deleted file mode 100644 index 09488a36ee..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetLegendGraphicRequest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - */ -package com.raytheon.uf.edex.wms; - -import java.util.Map; - -import org.geotools.styling.StyledLayerDescriptor; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.wms.IWmsProvider.WmsOpType; - -public class GetLegendGraphicRequest extends BaseRequest { - - protected String layer; - - protected String style; - - protected Integer width; - - protected Integer height; - - protected String time; - - protected String elevation; - - protected Map dimensions; - - protected StyledLayerDescriptor sld; - - protected String rule; - - protected String scale; - - protected String featureType; - - protected Boolean transparent; - - protected String bgcolor; - - public GetLegendGraphicRequest(GetLegendGraphicRequest req) { - this.layer = req.getLayer(); - this.style = req.getStyle(); - this.width = req.getWidth(); - this.height = req.getHeight(); - this.time = req.time; - this.elevation = req.elevation; - this.dimensions = req.dimensions; - this.sld = req.getSld(); - this.rule = req.getRule(); - this.scale = req.getScale(); - this.featureType = req.getFeatureType(); - } - - public GetLegendGraphicRequest(String layer, String style, Integer width, - Integer height, String time, String elevation, - Map dimensions, StyledLayerDescriptor sld, - String rule, String scale, String featureType) { - this.layer = layer; - this.style = style; - this.width = width; - this.height = height; - this.time = time; - this.elevation = elevation; - this.dimensions = dimensions; - this.sld = sld; - this.rule = rule; - this.scale = scale; - this.featureType = featureType; - } - - /** - * @return the layers - */ - public String getLayer() { - return layer; - } - - /** - * @param layers - * the layers to set - */ - public void setLayer(String layer) { - this.layer = layer; - } - - /** - * @return the styles - */ - public String getStyle() { - return style; - } - - /** - * @param styles - * the styles to set - */ - public void setStyle(String style) { - this.style = style; - } - - /** - * @return the width - */ - public Integer getWidth() { - return width; - } - - /** - * @param width - * the width to set - */ - public void setWidth(Integer width) { - this.width = width; - } - - /** - * @return the height - */ - public Integer getHeight() { - return height; - } - - /** - * @param height - * the height to set - */ - public void setHeight(Integer height) { - this.height = height; - } - - /** - * @return the time - */ - public String getTime() { - return time; - } - - /** - * @param time - * the time to set - */ - public void setTime(String time) { - this.time = time; - } - - /** - * @return the elevation - */ - public String getElevation() { - return elevation; - } - - /** - * @param elevation - * the elevation to set - */ - public void setElevation(String elevation) { - this.elevation = elevation; - } - - /** - * @return the dimensions - */ - public Map getDimensions() { - return dimensions; - } - - /** - * @param dimensions - * the dimensions to set - */ - public void setDimensions(Map dimensions) { - this.dimensions = dimensions; - } - - /** - * @return the sld - */ - public StyledLayerDescriptor getSld() { - return sld; - } - - /** - * @param sld - * the sld to set - */ - public void setSld(StyledLayerDescriptor sld) { - this.sld = sld; - } - - public String getRule() { - return rule; - } - - public void setRule(String rule) { - this.rule = rule; - } - - public String getScale() { - return scale; - } - - public void setScale(String scale) { - this.scale = scale; - } - - public String getFeatureType() { - return featureType; - } - - public void setFeatureType(String featureType) { - this.featureType = featureType; - } - - /** - * @return the transparent - */ - public Boolean getTransparent() { - return transparent; - } - - /** - * @param transparent - * the transparent to set - */ - public void setTransparent(Boolean transparent) { - this.transparent = transparent; - } - - /** - * @return the bgcolor - */ - public String getBgcolor() { - return bgcolor; - } - - /** - * @param bgcolor - * the bgcolor to set - */ - public void setBgcolor(String bgcolor) { - this.bgcolor = bgcolor; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.BaseRequest#execute(com.raytheon.uf.edex.wms - * .WmsProvider) - */ - @Override - public OgcResponse execute(IWmsProvider provider) { - return provider.getLegendGraphic(this); - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetMapRequest.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetMapRequest.java deleted file mode 100644 index 0ca71562bb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/GetMapRequest.java +++ /dev/null @@ -1,213 +0,0 @@ -/********************************************************************** - * - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - **********************************************************************/ -package com.raytheon.uf.edex.wms; - -import java.util.Map; - -import org.geotools.styling.StyledLayerDescriptor; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.wms.IWmsProvider.WmsOpType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class GetMapRequest extends BaseRequest { - - protected String[] layers; - - protected String[] styles; - - protected String crs; - - protected String bbox; - - protected Integer width; - - protected Integer height; - - protected Boolean transparent; - - protected String bgcolor; - - protected String[] times; - - protected String elevation; - - protected Map dimensions; - - protected StyledLayerDescriptor sld; - - public GetMapRequest() { - } - - public GetMapRequest(GetMapRequest req) { - super(req.getVersion(), req.getFormat(), req.getUserName(), req - .getRoles()); - this.layers = req.getLayers(); - this.styles = req.getStyles(); - this.crs = req.getCrs(); - this.crs = req.crs; - this.bbox = req.bbox; - this.width = req.width; - this.height = req.height; - this.transparent = req.transparent; - this.bgcolor = req.bgcolor; - this.times = req.times; - this.elevation = req.elevation; - this.dimensions = req.dimensions; - this.sld = req.sld; - } - - public GetMapRequest(String[] layers, String[] styles, String crs, - String bbox, Integer width, Integer height, Boolean transparent, - String bgcolor, String[] times, String elevation, - Map dimensions, StyledLayerDescriptor sld) { - super(); - this.layers = layers; - this.styles = styles; - this.crs = crs; - this.bbox = bbox; - this.width = width; - this.height = height; - this.transparent = transparent; - this.bgcolor = bgcolor; - this.times = times; - this.elevation = elevation; - this.dimensions = dimensions; - this.sld = sld; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.BaseRequest#execute(com.raytheon.uf.edex.wms - * .WmsProvider) - */ - @Override - public OgcResponse execute(IWmsProvider provider) { - return provider.getMap(this); - } - - public String[] getLayers() { - return layers; - } - - public void setLayers(String[] layers) { - this.layers = layers; - } - - public String[] getStyles() { - return styles; - } - - public void setStyles(String[] styles) { - this.styles = styles; - } - - public Integer getWidth() { - return width; - } - - public void setWidth(Integer width) { - this.width = width; - } - - public Integer getHeight() { - return height; - } - - public void setHeight(Integer height) { - this.height = height; - } - - public Boolean getTransparent() { - return transparent; - } - - public void setTransparent(Boolean transparent) { - this.transparent = transparent; - } - - public String getBgcolor() { - return bgcolor; - } - - public void setBgcolor(String bgcolor) { - this.bgcolor = bgcolor; - } - - public String[] getTimes() { - return times; - } - - public void setTimes(String[] times) { - this.times = times; - } - - public String getElevation() { - return elevation; - } - - public void setElevation(String elevation) { - this.elevation = elevation; - } - - public Map getDimensions() { - return dimensions; - } - - public void setDimensions(Map dimensions) { - this.dimensions = dimensions; - } - - public StyledLayerDescriptor getSld() { - return sld; - } - - public void setSld(StyledLayerDescriptor sld) { - this.sld = sld; - } - - public String getCrs() { - return crs; - } - - public void setCrs(String crs) { - this.crs = crs; - } - - public String getBbox() { - return bbox; - } - - public void setBbox(String bbox) { - this.bbox = bbox; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/IWmsProvider.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/IWmsProvider.java deleted file mode 100644 index 9cb0758d91..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/IWmsProvider.java +++ /dev/null @@ -1,58 +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.edex.wms; - -import java.io.InputStream; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.http.MimeType; - -/** - * Interface for WMS provider - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Apr 22, 2011 bclement Initial creation - * Aug 18, 2013 #2097 dhladky renamed for standards - */ -public interface IWmsProvider { - - public static final String WMS_NAME = "WMS"; - - public enum WmsOpType { - GetCapabilities, GetMap, GetFeatureInfo, GetLegendGraphic - } - - public OgcResponse getCapabilities(BaseRequest req); - - public OgcResponse getMap(GetMapRequest req); - - public OgcResponse getError(WmsException e, MimeType exceptionFormat); - - public OgcResponse handlePost(InputStream in); - - public OgcResponse getFeatureInfo(GetFeatureInfoRequest req); - - public OgcResponse getLegendGraphic(GetLegendGraphicRequest req); -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsException.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsException.java deleted file mode 100644 index 69cab29ba7..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsException.java +++ /dev/null @@ -1,71 +0,0 @@ -/********************************************************************** - * - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - **********************************************************************/ -package com.raytheon.uf.edex.wms; - -import com.raytheon.uf.edex.ogc.common.OgcException; - -public class WmsException extends Exception { - - private static final long serialVersionUID = 3643250462683412896L; - - public enum Code { - InvalidFormat, InvalidCRS, LayerNotDefined, StyleNotDefined, LayerNotQueryable, InvalidPoint, CurrentUpdateSequence, InvalidUpdateSequence, MissingDimensionValue, InvalidDimensionValue, OperationNotSupported, MissingParameterValue, InvalidParameterValue, InternalServerError - } - - protected Code code; - - public WmsException(OgcException ogc) { - this(Code.valueOf(ogc.getCode().toString()), ogc.getMessage()); - } - - public WmsException(Code code) { - super(); - this.code = code; - } - - public WmsException(Code code, String message) { - super(message); - this.code = code; - } - - public WmsException(Code code, Throwable cause) { - super(cause); - this.code = code; - } - - public WmsException(Code code, String message, Throwable cause) { - super(message, cause); - this.code = code; - } - - public Code getCode() { - return code; - } - - public void setCode(Code code) { - this.code = code; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpFactory.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpFactory.java deleted file mode 100644 index 41729db7e6..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpFactory.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * May 20, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms; - -import org.apache.commons.pool.KeyedPoolableObjectFactory; - -import com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager; -import com.raytheon.uf.edex.wms.provider.OgcGetMapTranslator; -import com.raytheon.uf.edex.wms.provider.OgcWmsProvider; -import com.raytheon.uf.edex.wms.provider.WmsLayerManager; - -/** - * - * @author bclement - * @version 1.0 - */ -public class WmsHttpFactory implements KeyedPoolableObjectFactory { - - protected WmsLayerManager layerManager = new WmsLayerManager(); - - protected OgcJaxbManager jaxbManager; - - protected OgcGetMapTranslator gmTranslator; - - /** - * @param layerManager - * @param jaxbManager - */ - public WmsHttpFactory(OgcJaxbManager jaxbManager, - OgcGetMapTranslator gmTranslator) { - super(); - this.jaxbManager = jaxbManager; - this.gmTranslator = gmTranslator; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.commons.pool.KeyedPoolableObjectFactory#makeObject(java.lang - * .Object) - */ - @Override - public Object makeObject(Object key) throws Exception { - return new WmsHttpHandler(new OgcWmsProvider(layerManager, jaxbManager, - gmTranslator), gmTranslator.getRegistry()); - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.commons.pool.KeyedPoolableObjectFactory#destroyObject(java - * .lang.Object, java.lang.Object) - */ - @Override - public void destroyObject(Object key, Object obj) throws Exception { - // TODO Auto-generated method stub - - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.commons.pool.KeyedPoolableObjectFactory#validateObject(java - * .lang.Object, java.lang.Object) - */ - @Override - public boolean validateObject(Object key, Object obj) { - // TODO Auto-generated method stub - return false; - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.commons.pool.KeyedPoolableObjectFactory#activateObject(java - * .lang.Object, java.lang.Object) - */ - @Override - public void activateObject(Object key, Object obj) throws Exception { - // TODO Auto-generated method stub - - } - - /* - * (non-Javadoc) - * - * @see - * org.apache.commons.pool.KeyedPoolableObjectFactory#passivateObject(java - * .lang.Object, java.lang.Object) - */ - @Override - public void passivateObject(Object key, Object obj) throws Exception { - // TODO Auto-generated method stub - - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpHandler.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpHandler.java deleted file mode 100644 index b182870d88..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/WmsHttpHandler.java +++ /dev/null @@ -1,494 +0,0 @@ -/********************************************************************** - * - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - **********************************************************************/ -package com.raytheon.uf.edex.wms; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.URL; -import java.nio.charset.Charset; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.geotools.styling.StyledLayerDescriptor; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.ogc.common.OgcException; -import com.raytheon.uf.edex.ogc.common.OgcException.Code; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.feature.JsonFeatureFormatter; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.ogc.common.http.OgcHttpHandler; -import com.raytheon.uf.edex.ogc.common.http.OgcHttpRequest; -import com.raytheon.uf.edex.ogc.common.output.IOgcHttpResponse; -import com.raytheon.uf.edex.ogc.common.output.ServletOgcResponse; -import com.raytheon.uf.edex.wms.IWmsProvider.WmsOpType; -import com.raytheon.uf.edex.wms.format.GmlFeatureFormatter; -import com.raytheon.uf.edex.wms.format.HtmlFeatureFormatter; -import com.raytheon.uf.edex.wms.sld.SldParser; -import com.raytheon.uf.edex.wms.sld.SldParserRegistry; -import com.vividsolutions.jts.geom.Envelope; - -public class WmsHttpHandler extends OgcHttpHandler { - - public static final String REQUEST_HEADER = "request"; - - public static final String SLD_HEADER = "sld"; - - public static final String SLD_VERSION_HEADER = "sld_version"; - - public static final String SLD_BODY_HEADER = "sld_body"; - - public static final String VERSION_HEADER = "version"; - - public static final String FORMAT_HEADER = "format"; - - public static final String UPDATESEQ_HEADER = "updatesequence"; - - public static final String LAYERS_HEADER = "layers"; - - public static final String STYLES_HEADER = "styles"; - - public static final String CRS_HEADER = "crs"; - - public static final String BBOX_HEADER = "bbox"; - - public static final String WIDTH_HEADER = "width"; - - public static final String HEIGHT_HEADER = "height"; - - public static final String TRANSPARENT_HEADER = "transparent"; - - public static final String BGCOLOR_HEADER = "bgcolor"; - - public static final String TIME_HEADER = "time"; - - public static final String ELEVATION_HEADER = "elevation"; - - public static final String MIME_HEADER = "Content-Type"; - - public static final String QLAYERS_HEADER = "query_layers"; - - public static final String FCOUNT_HEADER = "feature_count"; - - public static final String IFORMAT_HEADER = "info_format"; - - public static final String I_HEADER = "i"; - - public static final String J_HEADER = "j"; - - public static final String LAYER_HEADER = "layer"; - - public static final String STYLE_HEADER = "style"; - - public static final String RULE_HEADER = "rule"; - - public static final String SCALE_HEADER = "scale"; - - public static final String FEATURE_TYPE_HEADER = "feature_type"; - - public static final String CAP_PARAM = "getcapabilities"; - - public static final String MAP_PARAM = "getmap"; - - public static final String FEAT_PARAM = "getfeatureinfo"; - - public static final String LEG_PARAM = "getlegendgraphic"; - - protected IWmsProvider provider; - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - protected SldParserRegistry sldRegistry; - - public WmsHttpHandler(IWmsProvider provider, SldParserRegistry sldRegistry) { - this.provider = provider; - this.sldRegistry = sldRegistry; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.http.OgcHttpHandler#handle(javax.servlet - * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse, - * java.util.Map) - */ - @Override - public void handle(OgcHttpRequest request) { - try { - handleInternal(request); - } catch (Exception e) { - log.error("Unable to handle request", e); - } - } - - protected void handleInternal(OgcHttpRequest ogcRequest) throws Exception { - IOgcHttpResponse response = new ServletOgcResponse( - ogcRequest.getResponse()); - if (ogcRequest.isPost()) { - InputStream is = ogcRequest.getInputStream(); - sendResponse(response, provider.handlePost(is)); - return; - } - MimeType exceptionFormat = OgcResponse.TEXT_XML_MIME; - OgcResponse rval; - try { - Map headers = ogcRequest.getHeaders(); - String exFormatStr = getString(headers, EXCEP_FORMAT_HEADER); - if (exFormatStr != null && !exFormatStr.isEmpty()) { - exceptionFormat = new MimeType(exFormatStr); - } - - rval = validateExceptionFormat(exceptionFormat); - if (rval != null) { - sendResponse(response, rval); - } - - String reqName = getString(headers, REQUEST_HEADER); - if (reqName == null) { - throw new OgcException(Code.MissingParameterValue, - "Missing parameter: " + REQUEST_HEADER); - } - rval = getResponse(reqName, ogcRequest.getRequest(), headers); - } catch (OgcException e) { - rval = handleError(e, exceptionFormat); - } - - sendResponse(response, rval); - } - - /** - * @param exceptionFormat - * @return - */ - private OgcResponse validateExceptionFormat(MimeType exceptionFormat) { - WmsException ex = validateExceptionFormatAsException(exceptionFormat); - if (ex != null) { - return provider.getError(ex, OgcResponse.TEXT_XML_MIME); - } - return null; - } - - private WmsException validateExceptionFormatAsException( - MimeType exceptionFormat) { - if (!exceptionFormat.equalsIgnoreParams(OgcResponse.TEXT_HTML_MIME) - && !exceptionFormat - .equalsIgnoreParams(OgcResponse.TEXT_XML_MIME) - && !exceptionFormat - .equalsIgnoreParams(OgcResponse.APP_VND_OGC_SE_XML)) { - return new WmsException(WmsException.Code.InvalidParameterValue, - "exceptions parameter invalid"); - } - return null; - } - - protected OgcResponse getResponse(String reqName, - HttpServletRequest request, Map headers) { - BaseRequest req; - OgcResponse rval; - MimeType exceptionFormat = OgcResponse.TEXT_XML_MIME; - try { - exceptionFormat = getMimeType(headers, EXCEP_FORMAT_HEADER); - if (exceptionFormat == null) { - exceptionFormat = OgcResponse.TEXT_XML_MIME; - } - req = getRequest(reqName, request, headers); - if (req != null) { - req.setVersion(getString(headers, VERSION_HEADER)); - req.setFormat(getMimeType(headers, FORMAT_HEADER)); - req.setUpdateSequence(getString(headers, UPDATESEQ_HEADER)); - req.setUserName(getString(headers, USER_HEADER)); - req.setRoles(getStringArr(headers, ROLES_HEADER)); - req.setExceptionFormat(exceptionFormat); - rval = req.execute(provider); - } else { - throw new OgcException(Code.OperationNotSupported, - "No such operation: " + reqName); - } - } catch (OgcException e) { - rval = handleError(e, exceptionFormat); - } - return rval; - } - - protected BaseRequest getRequest(String reqName, - HttpServletRequest request, Map headers) - throws OgcException { - BaseRequest req = null; - if (reqName.equalsIgnoreCase(CAP_PARAM)) { - req = getBaseRequest(request, headers); - } else if (reqName.equalsIgnoreCase(MAP_PARAM)) { - req = parseMapRequest(headers); - } else if (reqName.equalsIgnoreCase(FEAT_PARAM)) { - req = getFeatureInfoReq(headers); - } else if (reqName.equalsIgnoreCase(LEG_PARAM)) { - req = getLegendGraphicReq(headers); - } - - return req; - } - - protected BaseRequest getBaseRequest(HttpServletRequest request, - Map headers) { - OgcServiceInfo serviceInfo = getServiceInfo(request); - BaseRequest req = new BaseRequest(); - req.setServiceinfo(serviceInfo); - return req; - } - - /** - * @param request - */ - private OgcServiceInfo getServiceInfo(HttpServletRequest request) { - int port = request.getServerPort(); - String base = "http://" + request.getServerName(); - if (port != 80) { - base += ":" + port; - } - base += "/wms?service=wms"; - OgcServiceInfo rval = new OgcServiceInfo(base); - - OgcOperationInfo cap = new OgcOperationInfo( - WmsOpType.GetCapabilities); - cap.setHttpGetRes(base); - cap.addFormat("text/xml"); - rval.addOperationInfo(cap); - - OgcOperationInfo map = new OgcOperationInfo( - WmsOpType.GetMap); - map.setHttpGetRes(base); - map.addFormat("image/gif"); - map.addFormat("image/png"); - // map.addFormat("image/tiff"); - map.addFormat("image/jpeg"); - rval.addOperationInfo(map); - - OgcOperationInfo info = new OgcOperationInfo( - WmsOpType.GetFeatureInfo); - info.setHttpGetRes(base); - List formats = Arrays.asList( - GmlFeatureFormatter.mimeType.toString(), - JsonFeatureFormatter.mimeType.toString(), - HtmlFeatureFormatter.mimeType.toString()); - info.setFormats(formats); - rval.addOperationInfo(info); - - OgcOperationInfo legend = new OgcOperationInfo( - WmsOpType.GetLegendGraphic); - legend.setHttpGetRes(base); - legend.addFormat("image/gif"); - legend.addFormat("image/png"); - legend.addFormat("image/jpeg"); - rval.addOperationInfo(legend); - - return rval; - } - - /** - * @param headers - * @return - * @throws OgcException - */ - protected GetFeatureInfoRequest getFeatureInfoReq( - Map headers) throws OgcException { - // TODO lookup provider based on version - // String version = getString(headers, VERSION_HEADER); - GetMapRequest mapReq = parseMapRequest(headers); - - String[] layers = getStringArr(headers, QLAYERS_HEADER); - MimeType format = getMimeType(headers, IFORMAT_HEADER); - Integer i = getInt(headers, I_HEADER); - Integer j = getInt(headers, J_HEADER); - MimeType exFormat = getMimeType(headers, EXCEP_FORMAT_HEADER); - GetFeatureInfoRequest req = new GetFeatureInfoRequest(mapReq, layers, - i, j, format); - Integer count = getInt(headers, FCOUNT_HEADER); - if (count != null) { - req.setFeatureCount(count); - } - req.setExceptionFormat(exFormat); - return req; - } - - protected GetLegendGraphicRequest getLegendGraphicReq( - Map headers) throws OgcException { - String layer = getString(headers, LAYER_HEADER); - String style = getString(headers, STYLE_HEADER); - Integer width = getInt(headers, WIDTH_HEADER); - Integer height = getInt(headers, HEIGHT_HEADER); - String time = getString(headers, TIME_HEADER); - String elevation = getString(headers, ELEVATION_HEADER); - Map dimensions = getDimensions(headers); - StyledLayerDescriptor sld = getSLD(headers); - String rule = getString(headers, RULE_HEADER); - String scale = getString(headers, SCALE_HEADER); - String featureType = getString(headers, FEATURE_TYPE_HEADER); - String bgcolor = getString(headers, BGCOLOR_HEADER); - Boolean transparent = getBool(headers, TRANSPARENT_HEADER); - GetLegendGraphicRequest req = new GetLegendGraphicRequest(layer, style, - width, height, time, elevation, dimensions, sld, rule, scale, - featureType); - req.setTransparent(transparent); - req.setBgcolor(bgcolor); - return req; - } - - protected GetMapRequest parseMapRequest(Map headers) - throws OgcException { - String[] layers = getStringArr(headers, LAYERS_HEADER); - String[] styles = getStringArr(headers, STYLES_HEADER); - if (styles == null) { - throw new OgcException(Code.MissingParameterValue, - "style parameter not in request."); - } - - String crs = getString(headers, CRS_HEADER); - String bbox = getBbox(headers, BBOX_HEADER); - Integer width = getInt(headers, WIDTH_HEADER); - Integer height = getInt(headers, HEIGHT_HEADER); - // String format = getString(headers, FORMAT_HEADER); - Boolean transparent = getBool(headers, TRANSPARENT_HEADER); - String bgcolor = getString(headers, BGCOLOR_HEADER); - // String exceptionFormat = getString(headers, EXCEP_FORMAT_HEADER); - String time = getString(headers, TIME_HEADER); - String[] times = parseTimes(time, layers.length); - String elevation = getString(headers, ELEVATION_HEADER); - StyledLayerDescriptor sld = getSLD(headers); - Map dimensions = getDimensions(headers); - return new GetMapRequest(layers, styles, crs, bbox, width, height, - transparent, bgcolor, times, elevation, dimensions, sld); - } - - protected String[] parseTimes(String timeStr, int layerNum) - throws OgcException { - if (timeStr == null || timeStr.isEmpty()) { - return new String[layerNum]; - } - String[] parts = timeStr.split(",", -1); - String[] rval; - if (parts.length == layerNum) { - rval = copyWithoutEmpties(parts); - } else if (parts.length == 1) { - rval = new String[layerNum]; - for (int i = 0; i < rval.length; ++i) { - rval[i] = parts[0]; - } - } else { - throw new OgcException(Code.InvalidParameterValue, - "invalid time string"); - } - return rval; - } - - /** - * @param arr - * @return copy of array where empty strings are replace with nulls - */ - protected String[] copyWithoutEmpties(String[] arr) { - String[] rval = new String[arr.length]; - for (int i = 0; i < arr.length; ++i) { - if (!arr[i].trim().isEmpty()) { - rval[i] = arr[i]; - } - } - return rval; - } - - protected StyledLayerDescriptor getSLD(Map headers) - throws OgcException { - StyledLayerDescriptor rval = null; - String urlStr = getString(headers, SLD_HEADER); - InputStream body = null; - if (urlStr != null) { - try { - URL url = new URL(urlStr); - body = url.openStream(); - } catch (Exception e) { - String msg = "Unable to open SLD at " + urlStr; - log.error(msg, e); - throw new OgcException(Code.InvalidParameterValue, msg); - } - } else if (headers.containsKey(SLD_BODY_HEADER)) { - String str = getString(headers, SLD_BODY_HEADER); - body = new ByteArrayInputStream(str.getBytes(Charset - .forName("UTF-8"))); - } - if (body != null) { - String version = getString(headers, SLD_VERSION_HEADER); - rval = parseSldXml(version, body); - } - return rval; - } - - protected StyledLayerDescriptor parseSldXml(String version, InputStream body) - throws OgcException { - SldParser parser = sldRegistry.getParser(version); - if (parser == null) { - throw new OgcException(Code.InvalidParameterValue, - "Missing or unknown SLD version"); - } - try { - return parser.parse(body); - } catch (Throwable t) { - String msg = "Unable to parse SLD"; - log.error(msg, t); - throw new OgcException(Code.InvalidParameterValue, msg); - } - } - - /** - * @param object - * @return - * @throws WmsException - */ - protected String getBbox(Map map, String key) - throws OgcException { - Object object = map.get(key); - String rval = null; - if (object instanceof String) { - rval = (String) object; - } else if (object instanceof Envelope) { - Envelope env = (Envelope) object; - rval = String.format("%f,%f,%f,%f", env.getMinX(), env.getMinY(), - env.getMaxX(), env.getMinY()); - } else if (object instanceof String[]) { - throw new OgcException(Code.InvalidParameterValue, - "Multiple values for parameter: " + key); - } - return rval; - } - - @Override - protected OgcResponse handleError(OgcException e, MimeType exceptionFormat) { - return provider.getError(new WmsException(e), exceptionFormat); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/GmlFeatureFormatter.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/GmlFeatureFormatter.java deleted file mode 100644 index 7652f20aa1..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/GmlFeatureFormatter.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Aug 9, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms.format; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.transform.TransformerException; - -import org.geotools.data.memory.MemoryFeatureCollection; -import org.geotools.feature.FeatureCollection; -import org.geotools.gml.producer.FeatureTransformer; -import org.geotools.gml3.GMLConfiguration; -import org.geotools.referencing.CRS; -import org.geotools.xml.Configuration; -import org.geotools.xml.Encoder; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.feature.type.Name; - -import com.raytheon.uf.edex.ogc.common.OgcNamespace; -import com.raytheon.uf.edex.ogc.common.OgcPrefix; -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcResponse.TYPE; -import com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter; -import com.raytheon.uf.edex.ogc.common.http.MimeType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class GmlFeatureFormatter implements SimpleFeatureFormatter { - - public static final MimeType mimeType = new MimeType( - "text/xml; subtype=\"gml/3.1.1\""); - - public static final String empty = "\n" - + "\n" - + ""; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter#format - * (java.util.List, java.io.OutputStream) - */ - @Override - public void format(List> features, OutputStream out) - throws Exception { - if (features == null || features.isEmpty()) { - outputEmpty(out); - return; - } - List> colls = getAsCollections(features); - if (colls == null || colls.isEmpty()) { - outputEmpty(out); - return; - } - // TODO avoid having XML in memory - StringBuilder rval = new StringBuilder(); - populate(rval, colls); - OutputStreamWriter writer = new OutputStreamWriter(out); - writer.write(rval.toString()); - writer.flush(); - writer.close(); - } - - private void outputEmpty(OutputStream out) throws IOException { - OutputStreamWriter writer = new OutputStreamWriter(out); - writer.write(empty); - writer.flush(); - writer.close(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.format.SimpleFeatureFormatter#format(java.util - * .List) - */ - @Override - public OgcResponse format(List> features) - throws Exception { - if (features == null || features.isEmpty()) { - return new OgcResponse(empty, mimeType, TYPE.TEXT); - } - List> colls = getAsCollections(features); - if (colls == null || colls.isEmpty()) { - return new OgcResponse(empty, mimeType, TYPE.TEXT); - } - StringBuilder rval = new StringBuilder(); - populate(rval, colls); - return new OgcResponse(rval.toString(), mimeType, TYPE.TEXT); - } - - protected void populate(StringBuilder sb, - List> colls) - throws IOException { - Configuration conf = new GMLConfiguration(); - Encoder encoder = new Encoder(conf); - Iterator> i = colls - .iterator(); - String xml = toXml(i.next(), encoder); - populate(sb, xml, true, !i.hasNext()); - while (i.hasNext()) { - xml = toXml(i.next(), encoder); - populate(sb, xml, false, !i.hasNext()); - } - } - - protected String toXml( - FeatureCollection coll, - Encoder encoder) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - FeatureTransformer trans = new FeatureTransformer(); - trans.setIndentation(4); - trans.setGmlPrefixing(true); - trans.getFeatureTypeNamespaces().declareDefaultNamespace(OgcPrefix.GML, - OgcNamespace.GML); - SimpleFeatureType schema = coll.getSchema(); - Name name = schema.getName(); - trans.getFeatureTypeNamespaces().declareNamespace(schema, - name.getLocalPart(), name.getNamespaceURI()); - trans.setCollectionNamespace(null); - trans.setCollectionPrefix(null); - trans.setCollectionBounding(true); - trans.getFeatureNamespaces(); - String srs = CRS.toSRS(schema.getCoordinateReferenceSystem()); - if (srs != null) { - trans.setSrsName(srs); - } - try { - trans.transform(coll, out); - } catch (TransformerException e) { - throw new IOException(e); - } - return new String(out.toByteArray(), encoder.getEncoding()); - } - - protected void populate(StringBuilder sb, String xml, boolean header, - boolean footer) { - String[] parts = split(xml); - if (header) { - sb.append(parts[0]); - sb.append('\n'); - } - sb.append(parts[1]); - sb.append('\n'); - if (footer) { - sb.append(parts[2]); - sb.append('\n'); - } - } - - protected String[] split(String xml) { - String[] rval = new String[3]; - int endHeader; - int beginBody; - int endBody; - int beginFooter; - // FIXME xml should not be parsed like this - int i = xml.indexOf("FeatureCollection"); - endHeader = xml.indexOf('>', i) + 1; - i = xml.indexOf("featureMember"); - beginBody = xml.lastIndexOf('<', i); - i = xml.lastIndexOf("featureMember"); - endBody = xml.indexOf('>', i) + 1; - i = xml.lastIndexOf("FeatureCollection"); - beginFooter = xml.lastIndexOf('<', i); - rval[0] = xml.substring(0, endHeader); - rval[1] = xml.substring(beginBody, endBody); - rval[2] = xml.substring(beginFooter); - return rval; - } - - protected List> getAsCollections( - List> features) { - List> colls = new ArrayList>( - features.size()); - SimpleFeature sample; - for (List l : features) { - if (l == null || l.isEmpty()) { - continue; - } - sample = l.get(0); - MemoryFeatureCollection coll = new MemoryFeatureCollection( - sample.getFeatureType()); - coll.addAll(l); - // ListFeatureCollection coll = new ListFeatureCollection( - // sample.getFeatureType(), l); - colls.add(coll); - } - return colls; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wms.format.SimpleFeatureFormatter#getMimeType() - */ - @Override - public MimeType getMimeType() { - return mimeType; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter#matchesFormat - * (java.lang.String) - */ - @Override - public boolean matchesFormat(MimeType format) { - if (mimeType.equalsIgnoreParams(format)) { - return true; - } - if (format.toString().toLowerCase().contains("gml")) { - return true; - } - return false; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/HtmlFeatureFormatter.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/HtmlFeatureFormatter.java deleted file mode 100644 index 4315df895e..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/format/HtmlFeatureFormatter.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Aug 8, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms.format; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.StringWriter; -import java.io.Writer; -import java.util.List; -import java.util.Scanner; - -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.runtime.RuntimeConstants; -import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; - -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcResponse.TYPE; -import com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter; -import com.raytheon.uf.edex.ogc.common.http.MimeType; - -/** - * - * @author bclement - * @version 1.0 - */ -public class HtmlFeatureFormatter implements SimpleFeatureFormatter { - - public static final MimeType mimeType = new MimeType("text/html"); - - private VelocityEngine _ve; - - private Template _bodyTemplate; - - private String _header; - - protected String bodyLocation = "META-INF/templates/gfi-html-body.vm"; - - protected String headerLocation = "META-INF/templates/gfi-html-header.txt"; - - protected Template getBodyTemplate() throws Exception { - if (_bodyTemplate == null) { - _ve = new VelocityEngine(); - _ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); - _ve.setProperty("classpath.resource.loader.class", - ClasspathResourceLoader.class.getName()); - _ve.init(); - _bodyTemplate = _ve.getTemplate(bodyLocation); - } - return _bodyTemplate; - } - - protected String getHeader() throws IOException { - if (_header == null) { - ClassLoader loader = this.getClass().getClassLoader(); - InputStream in = loader.getResourceAsStream(headerLocation); - if (in == null) { - throw new IOException("Unable to find classpath resource: " - + headerLocation); - } - _header = new Scanner(in).useDelimiter("\\A").next(); - } - return _header; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter#format - * (java.util.List, java.io.OutputStream) - */ - @Override - public void format(List> features, OutputStream out) - throws Exception { - if (features == null || features.isEmpty()) { - return; - } - Writer writer = new OutputStreamWriter(out); - writer.write(getHeader()); - for (List typeList : features) { - addFeatures(typeList, writer); - } - writer.write("\n"); - writer.flush(); - writer.close(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.format.SimpleFeatureFormatter#format(java.util - * .List) - */ - @Override - public OgcResponse format(List> features) - throws Exception { - if (features == null || features.isEmpty()) { - return new OgcResponse("", mimeType, TYPE.TEXT); - } - StringBuilder rval = new StringBuilder(getHeader()); - for (List typeList : features) { - addFeatures(typeList, rval); - } - rval.append("\n"); - return new OgcResponse(rval.toString(), mimeType, TYPE.TEXT); - } - - protected void addFeatures(List features, - StringBuilder builder) throws Exception { - StringWriter writer = new StringWriter(); - addFeatures(features, writer); - builder.append(writer.getBuffer()); - writer.close(); - } - - protected void addFeatures(List features, Writer writer) - throws Exception { - if (features == null || features.isEmpty()) { - return; - } - SimpleFeature sample = features.get(0); - SimpleFeatureType type = sample.getType(); - Template t = getBodyTemplate(); - VelocityContext vc = new VelocityContext(); - vc.put("type", type); - vc.put("features", features); - t.merge(vc, writer); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.wms.format.SimpleFeatureFormatter#getKey() - */ - @Override - public MimeType getMimeType() { - return mimeType; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter#matchesFormat - * (java.lang.String) - */ - @Override - public boolean matchesFormat(MimeType format) { - return mimeType.equalsIgnoreParams(format); - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetLegendProcessor.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetLegendProcessor.java deleted file mode 100644 index 1b17a24879..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetLegendProcessor.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - */ -package com.raytheon.uf.edex.wms.provider; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Map; -import java.util.Set; - -import org.geotools.styling.StyledLayerDescriptor; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.reg.WmsSource; -import com.raytheon.uf.edex.wms.styling.SldStyleProvider; -import com.raytheon.uf.edex.wms.util.StyleLibrary; - -public class GetLegendProcessor { - - protected String time; - - protected String elevation; - - protected Map dimensions; - - protected Integer width; - - protected Integer height; - - protected String username; - - protected Set roles; - - protected WmsLayerManager layerManager; - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - public GetLegendProcessor(WmsLayerManager layerManager, String time, - String elevation, Map dimensions, Integer width, - Integer height, String username, String[] roles) { - super(); - this.layerManager = layerManager; - this.time = time; - this.elevation = elevation; - this.dimensions = dimensions; - this.width = width; - this.height = height; - } - - protected WmsSource getSource(String layer) throws WmsException { - return layerManager.getSource(layer, username, roles); - } - - public BufferedImage getLegend(String layerName, String styleName, - boolean includeLabels) throws WmsException { - WmsSource source = getSource(layerName); - return source.getLegend(layerName, styleName, time, elevation, - dimensions, height, width); - } - - public BufferedImage getLegendSld(StyledLayerDescriptor sld) - throws WmsException { - StyleLibrary lib = new StyleLibrary(sld); - return SldStyleProvider.getLegend(lib.getAny(), width, height); - } - - /** - * @param layer - * @param style - * @param sld - * @return - * @throws WmsException - */ - public BufferedImage getLegendStyleLib(String layer, String datauri, - String style, StyledLayerDescriptor sld) throws WmsException { - SldStyleProvider styler = new SldStyleProvider(sld); - return styler.getLegend(layer, null, style, width, height); - } - - public static BufferedImage applyBackground(BufferedImage img, Color bgColor) { - BufferedImage rval = new BufferedImage(img.getWidth(), img.getHeight(), - BufferedImage.TYPE_INT_ARGB); - Graphics2D g = rval.createGraphics(); - g.setColor(bgColor); - g.fillRect(0, 0, img.getWidth(), img.getHeight()); - g.drawImage(img, 0, 0, null); - g.dispose(); - return rval; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetMapProcessor.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetMapProcessor.java deleted file mode 100644 index 4dd1599dce..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/GetMapProcessor.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Sep 8, 2011 bclement Initial creation - * - */ -package com.raytheon.uf.edex.wms.provider; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.geotools.styling.NamedLayer; -import org.geotools.styling.Style; -import org.geotools.styling.StyledLayer; -import org.geotools.styling.StyledLayerDescriptor; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.reg.WmsImage; -import com.raytheon.uf.edex.wms.reg.WmsSource; -import com.raytheon.uf.edex.wms.util.StyleLibrary; -import com.vividsolutions.jts.geom.Envelope; - -/** - * - * @author bclement - * @version 1.0 - */ -public class GetMapProcessor { - - protected CoordinateReferenceSystem crs; - protected Envelope env; - protected String elevation; - protected Map dimensions; - protected int width; - protected int height; - protected String username; - protected Set roles; - protected WmsLayerManager layerManager; - protected double scale; - - public GetMapProcessor(WmsLayerManager layerManager, - CoordinateReferenceSystem crs, Envelope env, - String elevation, Map dimensions, int width, - int height, double scale, String username, String[] roles) { - this(layerManager, crs, env, elevation, dimensions, width, - height, scale); - this.username = username; - this.roles = getAsSet(roles); - } - - public GetMapProcessor(WmsLayerManager layerManager, - CoordinateReferenceSystem crs, Envelope env, - String elevation, Map dimensions, int width, - int height, double scale) { - super(); - this.layerManager = layerManager; - this.crs = crs; - this.env = env; - this.elevation = elevation; - this.dimensions = dimensions; - this.width = width; - this.height = height; - this.scale = scale; - } - - public List getMapSld(StyledLayerDescriptor sld, String[] times) - throws WmsException { - StyledLayer[] layers = sld.getStyledLayers(); - ArrayList rval = new ArrayList(layers.length); - String time; - if (times.length == 1) { - time = times[0]; - } else { - throw new WmsException(Code.InvalidParameterValue, - "times per layer not supported for sld"); - } - for (StyledLayer sl : layers) { - if (sl instanceof NamedLayer) { - NamedLayer layer = (NamedLayer) sl; - String layerName = layer.getName(); - WmsSource source = getSource(layerName); - Style[] styles = layer.getStyles(); - if (styles == null || styles.length < 1) { - // request a layer with default style - WmsImage img = source.getImage(layerName, null, true, crs, - env, time, elevation, dimensions, scale); - rval.add(img); - } else { - for (Style s : styles) { - WmsImage img = source.getImage(layerName, null, false, - crs, env, time, elevation, dimensions, scale); - img.setStyle(s); - rval.add(img); - } - } - } - } - return rval; - } - - protected WmsSource getSource(String layer) throws WmsException { - return layerManager.getSource(layer); - } - - protected Set getAsSet(String[] strs) { - Set rval = null; - if (strs != null) { - rval = new HashSet(Arrays.asList(strs)); - } - return rval; - } - - public List getMapStyleLib(String[] layers, String[] styles, - String[] times, StyledLayerDescriptor sld) throws WmsException { - StyleLibrary lib = new StyleLibrary(sld); - ArrayList rval = new ArrayList(layers.length); - for (int i = 0; i < layers.length; ++i) { - String layerName = layers[i]; - WmsSource source = getSource(layerName); - String styleName = styles[i]; - String time = times[i]; - Style style = null; - if (styleName != null && styleName.trim().isEmpty()) { - // use default - style = lib.getDefault(layerName); - } else { - // use library - style = lib.getNamedStyle(styleName); - } - WmsImage img; - if (style == null) { - // not in library, pass to source to see if they know it - img = source.getImage(layerName, styleName, false, crs, env, - time, elevation, dimensions, scale); - } else { - // get without style - img = source.getImage(layerName, null, false, crs, env, time, - elevation, dimensions, scale); - img.setStyle(style); - } - rval.add(img); - } - return rval; - } - - public List getMap(String[] layers, String[] styles, - String[] times) - throws WmsException { - ArrayList rval = new ArrayList(layers.length); - for (int i = 0; i < layers.length; ++i) { - String layerName = layers[i]; - WmsSource source = getSource(layerName); - String styleName = styles[i]; - String time = times[i]; - boolean defaultStyle = (styleName == null || styleName.isEmpty()); - WmsImage img = source.getImage(layerName, styleName, defaultStyle, - crs, env, time, elevation, dimensions, scale); - if (img != null) { - rval.add(img); - } - } - return rval; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcGetMapTranslator.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcGetMapTranslator.java deleted file mode 100644 index 40a290394c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcGetMapTranslator.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * - */ -package com.raytheon.uf.edex.wms.provider; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; - -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; - -import net.opengis.ows.v_1_0_0.BoundingBoxType; -import net.opengis.sld.v_1_1_0.ElevationType; -import net.opengis.sld.v_1_1_0.GetMapType; -import net.opengis.sld.v_1_1_0.OutputType; -import net.opengis.sld.v_1_1_0.OutputType.Size; -import net.opengis.sld.v_1_1_0.StyledLayerDescriptorElement; - -import org.apache.commons.lang.StringUtils; -import org.dom4j.Element; -import org.dom4j.Namespace; -import org.dom4j.Node; -import org.dom4j.QName; -import org.dom4j.io.DocumentSource; -import org.geotools.styling.StyledLayerDescriptor; -import org.w3c.dom.Document; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.time.util.TimeUtil; -import com.raytheon.uf.edex.ogc.common.OgcNamespace; -import com.raytheon.uf.edex.ogc.common.OgcPrefix; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.wms.GetMapRequest; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.sld.SldParser; -import com.raytheon.uf.edex.wms.sld.SldParserRegistry; - -public class OgcGetMapTranslator { - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - protected SldParserRegistry registry; - - protected Namespace sldNS = new Namespace(OgcPrefix.SLD, OgcNamespace.SLD); - - protected Namespace owsNS = new Namespace(OgcPrefix.OWS, OgcNamespace.OWS); - - protected Namespace wmsNS = new Namespace(OgcPrefix.WMS, OgcNamespace.WMS); - - protected QName sldName = new QName("StyledLayerDescriptor", sldNS); - - protected QName crsName = new QName("CRS", sldNS); - - protected QName bboxName = new QName("BoundingBox", sldNS); - - protected QName lcName = new QName("LowerCorner", owsNS); - - protected QName ucName = new QName("UpperCorner", owsNS); - - protected QName outputName = new QName("Output", sldNS); - - protected QName sizeName = new QName("Size", sldNS); - - protected QName widthName = new QName("Width", sldNS); - - protected QName heightName = new QName("Height", sldNS); - - protected QName formatName = new QName("Format", wmsNS); - - protected QName transparentName = new QName("Transparent", sldNS); - - protected QName execptionsName = new QName("Exceptions", sldNS); - - protected QName elevationName = new QName("Elevation", sldNS); - - protected QName timeName = new QName("Time", sldNS); - - protected QName valueName = new QName("Value", sldNS); - - public OgcGetMapTranslator(SldParserRegistry registry) { - this.registry = registry; - } - - public GetMapRequest translate(Element root) throws WmsException { - GetMapRequest rval = new GetMapRequest(); - rval.setSld(parseSld(root.element(sldName))); - rval.setBbox(parseBbox(root.element(bboxName))); - rval.setCrs(getTextElement(root.element(crsName))); - rval.setElevation(parseElevation(root.element(elevationName))); - parseOutput(root.element(outputName), rval); - rval.setTimes(new String[] { getTextElement(root.element(timeName)) }); - rval.setExceptionFormat(getFormat(root.elementTextTrim(execptionsName))); - return rval; - } - - protected MimeType getFormat(String format) throws WmsException { - try { - return new MimeType(format); - } catch (IllegalArgumentException e) { - throw new WmsException(Code.InvalidParameterValue, e.getMessage()); - } - } - - /** - * @param element - * @param rval - * @throws WmsException - */ - protected void parseOutput(Element output, GetMapRequest rval) - throws WmsException { - if (output == null) { - return; - } - Element size = output.element(sizeName); - if (size != null) { - try { - String width = size.elementTextTrim(widthName); - rval.setWidth(Integer.valueOf(width)); - String height = size.elementTextTrim(heightName); - rval.setHeight(Integer.valueOf(height)); - } catch (NumberFormatException e) { - // leave sizes null - } - } - rval.setFormat(getFormat(output.elementTextTrim(formatName))); - rval.setTransparent(getBoolElement(output.element(transparentName))); - } - - protected Boolean getBoolElement(Element elem) { - if (elem == null) { - return null; - } - String txt = elem.getTextTrim(); - return txt != null && txt.equalsIgnoreCase("true"); - } - - protected String parseElevation(Element elev) { - if (elev == null) { - return null; - } - String rval = null; - // TODO handle intervals - Element val = elev.element(valueName); - if (val != null) { - rval = val.getTextTrim(); - } - return rval; - } - - /** - * @param element - * @return - */ - protected String getTextElement(Element elem) { - if (elem == null) { - return null; - } - return elem.getTextTrim(); - } - - /** - * @param element - * @return - */ - protected String parseBbox(Element bboxElem) { - if (bboxElem == null) { - return null; - } - String lcText = bboxElem.elementTextTrim(lcName); - String ucText = bboxElem.elementTextTrim(ucName); - String[] lc = StringUtils.split(lcText); - String[] uc = StringUtils.split(ucText); - List bounds = Arrays.asList(lc[0], lc[1], uc[0], uc[1]); - return StringUtils.join(bounds, ','); - } - - protected StyledLayerDescriptor parseSld(Element e) throws WmsException { - if (e == null) { - return null; - } - String version = e.attributeValue("version"); - SldParser parser = registry.getParser(version); - if (parser == null) { - throw new WmsException(Code.MissingParameterValue, - "SLD version must be specified"); - } - Document doc; - try { - doc = convert(e); - StyledLayerDescriptor rval = parser.parse(doc); - return rval; - } catch (Exception e1) { - log.error("Unable to parse SLD docuement", e1); - throw new WmsException(Code.InternalServerError); - } - } - - protected Document convert(Node n) throws TransformerException { - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - DocumentSource source = new DocumentSource(n); - DOMResult result = new DOMResult(); - transformer.transform(source, result); - return (Document) result.getNode(); - } - - // below are JAXB utility methods (would need jaxb context) - - /** - * @param req - * @return - * @throws Throwable - */ - @Deprecated - protected GetMapRequest translate(GetMapType req) throws Throwable { - GetMapRequest rval = new GetMapRequest(); - rval.setBbox(formatBbox(req.getBoundingBox())); - rval.setCrs(req.getCRS()); - rval.setElevation(formatElevation(req.getElevation())); - parseOutput(req.getOutput(), rval); - rval.setTimes(new String[] { formatTime(req.getTime()) }); - rval.setSld(translate(req.getStyledLayerDescriptor())); - return rval; - } - - protected String formatBbox(BoundingBoxType bbox) { - if (bbox == null) { - return null; - } - List lc = bbox.getLowerCorner(); - List uc = bbox.getUpperCorner(); - - return String.format("%f,%f,%f,%f", lc.get(0), lc.get(1), uc.get(0), - uc.get(1)); - } - - protected String formatElevation(ElevationType elev) { - if (elev == null) { - return null; - } - List value = elev.getValue(); - if (value != null && !value.isEmpty()) { - return StringUtils.join(value, ","); - } else { - return null; - } - } - - protected void parseOutput(OutputType out, GetMapRequest req) - throws WmsException { - if (out == null) { - return; - } - req.setBgcolor(out.getBGcolor()); - req.setFormat(getFormat(out.getFormat())); - Size size = out.getSize(); - if (size != null) { - BigInteger width = size.getWidth(); - BigInteger height = size.getHeight(); - if (width != null) { - req.setWidth(width.intValue()); - } - if (height != null) { - req.setHeight(height.intValue()); - } - } - } - - protected String formatTime(XMLGregorianCalendar cal) { - if (cal == null) { - return null; - } - return TimeUtil.formatCalendar(cal.toGregorianCalendar()); - } - - protected StyledLayerDescriptor translate(StyledLayerDescriptorElement sld) - throws Throwable { - if (sld == null) { - return null; - } - // FIXME there must be a better way than this - // TODO: Please do it the better way! - // String xml = manager.marshal(sld); - // InputStream in = new StringInputStream(xml); - // SLDParser stylereader = new SLDParser( - // CommonFactoryFinder.getStyleFactory(null), in); - // return stylereader.parseSLD(); - return null; - } - - public SldParserRegistry getRegistry() { - return registry; - } - - public void setRegistry(SldParserRegistry registry) { - this.registry = registry; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcWmsProvider.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcWmsProvider.java deleted file mode 100644 index d731ec5fc3..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/OgcWmsProvider.java +++ /dev/null @@ -1,909 +0,0 @@ -/********************************************************************** - * - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - **********************************************************************/ -package com.raytheon.uf.edex.wms.provider; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.RenderingHints; -import java.awt.image.BufferedImage; -import java.io.InputStream; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.imageio.ImageIO; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; - -import net.opengis.wms.v_1_3_0.Capability; -import net.opengis.wms.v_1_3_0.DCPType; -import net.opengis.wms.v_1_3_0.Exception; -import net.opengis.wms.v_1_3_0.Get; -import net.opengis.wms.v_1_3_0.HTTP; -import net.opengis.wms.v_1_3_0.Layer; -import net.opengis.wms.v_1_3_0.OnlineResource; -import net.opengis.wms.v_1_3_0.OperationType; -import net.opengis.wms.v_1_3_0.Post; -import net.opengis.wms.v_1_3_0.Request; -import net.opengis.wms.v_1_3_0.Service; -import net.opengis.wms.v_1_3_0.ServiceExceptionReport; -import net.opengis.wms.v_1_3_0.ServiceExceptionType; -import net.opengis.wms.v_1_3_0.WMSCapabilities; - -import org.dom4j.Document; -import org.dom4j.Element; -import org.dom4j.Namespace; -import org.dom4j.QName; -import org.dom4j.io.SAXReader; -import org.geotools.coverage.grid.GeneralGridEnvelope; -import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.data.memory.MemoryFeatureCollection; -import org.geotools.factory.CommonFactoryFinder; -import org.geotools.feature.FeatureCollection; -import org.geotools.geometry.DirectPosition2D; -import org.geotools.geometry.GeneralEnvelope; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.map.DefaultMapContext; -import org.geotools.map.MapContext; -import org.geotools.styling.FeatureTypeStyle; -import org.geotools.styling.NamedLayer; -import org.geotools.styling.Style; -import org.geotools.styling.StyleFactory; -import org.geotools.styling.StyledLayer; -import org.geotools.styling.StyledLayerDescriptor; -import org.opengis.coverage.grid.GridEnvelope; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.geometry.DirectPosition; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform2D; -import org.springframework.context.ApplicationContext; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.core.EDEXUtil; -import com.raytheon.uf.edex.ogc.common.OgcNamespace; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcPrefix; -import com.raytheon.uf.edex.ogc.common.OgcResponse; -import com.raytheon.uf.edex.ogc.common.OgcResponse.ErrorType; -import com.raytheon.uf.edex.ogc.common.OgcResponse.TYPE; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.feature.SimpleFeatureFormatter; -import com.raytheon.uf.edex.ogc.common.http.MimeType; -import com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager; -import com.raytheon.uf.edex.ogc.common.spatial.CrsLookup; -import com.raytheon.uf.edex.wms.BaseRequest; -import com.raytheon.uf.edex.wms.GetFeatureInfoRequest; -import com.raytheon.uf.edex.wms.GetLegendGraphicRequest; -import com.raytheon.uf.edex.wms.GetMapRequest; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.WmsHttpHandler; -import com.raytheon.uf.edex.wms.IWmsProvider; -import com.raytheon.uf.edex.wms.reg.WmsImage; -import com.raytheon.uf.edex.wms.reg.WmsSource; -import com.raytheon.uf.edex.wms.util.StyleUtility; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Envelope; - -public class OgcWmsProvider implements IWmsProvider { - - protected static final String svcTitle = "EDEX Map Server"; - - protected WmsLayerManager layerManager; - - protected OgcJaxbManager jaxbManager; - - private IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - protected String resizeHint = "quality"; - - protected OgcGetMapTranslator getMapTranslator; - - protected QName getMapName = new QName("GetMap", new Namespace( - OgcPrefix.SLD, OgcNamespace.SLD)); - - public OgcWmsProvider(WmsLayerManager layerManager, - OgcJaxbManager jaxbManager, OgcGetMapTranslator getMapTranslator) { - this.layerManager = layerManager; - this.jaxbManager = jaxbManager; - this.getMapTranslator = getMapTranslator; - } - - @Override - public OgcResponse getCapabilities(BaseRequest req) { - OgcResponse rval; - try { - WMSCapabilities capabilities = new WMSCapabilities(); - OgcServiceInfo serviceinfo = req.getServiceinfo(); - capabilities.setService(getServiceInfo(serviceinfo)); - capabilities.setCapability(getMainCapability(req)); - rval = marshalResponse(capabilities); - } catch (WmsException e) { - rval = getError(e, req.getExceptionFormat()); - } - return rval; - } - - /** - * @return - */ - protected Service getServiceInfo(OgcServiceInfo serviceInfo) { - Service rval = new Service(); - rval.setName(WMS_NAME); - rval.setTitle(svcTitle); - rval.setOnlineResource(getOLR(serviceInfo.getOnlineResource())); - return rval; - } - - protected OnlineResource getOLR(String href) { - OnlineResource rval = new OnlineResource(); - rval.setHref(href); - return rval; - } - - protected Capability getMainCapability(BaseRequest req) - throws WmsException { - Capability rval = new Capability(); - OgcServiceInfo serviceinfo = req.getServiceinfo(); - rval.setRequest(getValidRequests(serviceinfo.getOperations())); - rval.setException(getExceptionInfo()); - rval.setLayer(getLayerInfo(req)); - return rval; - } - - /** - * @return - * @throws WmsException - */ - protected Layer getLayerInfo(BaseRequest req) - throws WmsException { - Layer rval = new Layer(); - rval.setTitle(svcTitle); - rval.setLayer(getAuthorizedLayers(req)); - return rval; - } - - protected List getAuthorizedLayers(BaseRequest req) - throws WmsException { - - return layerManager.getLayers(req.getServiceinfo()); - } - - /** - * @return - */ - protected Exception getExceptionInfo() { - Exception rval = new Exception(); - rval.setFormat(Arrays.asList("XML")); - return rval; - } - - /** - * @param operations - * @return - */ - protected Request getValidRequests( - List> operations) { - Request rval = new Request(); - for (OgcOperationInfo op : operations) { - OperationType opType = new OperationType(); - populateOpType(opType, op); - switch (op.getType()) { - case GetCapabilities: - rval.setGetCapabilities(opType); - break; - case GetFeatureInfo: - rval.setGetFeatureInfo(opType); - break; - case GetMap: - rval.setGetMap(opType); - break; - case GetLegendGraphic: - break; - } - } - return rval; - } - - protected void populateOpType(OperationType opType, - OgcOperationInfo info) { - opType.setFormat(info.getFormats()); - DCPType dcpt = new DCPType(); - HTTP http = new HTTP(); - if (info.hasHttpGet()) { - Get get = new Get(); - get.setOnlineResource(getOLR(info.getHttpGetRes())); - http.setGet(get); - } - if (info.hasHttpPost()) { - Post post = new Post(); - post.setOnlineResource(getOLR(info.getHttpPostRes())); - http.setPost(post); - } - dcpt.setHTTP(http); - opType.setDCPType(Arrays.asList(dcpt)); - } - - protected OgcResponse marshalResponse(Object jaxbobject) - throws WmsException { - OgcResponse rval; - try { - String xml = jaxbManager.marshal(jaxbobject, false); - rval = new OgcResponse(xml, OgcResponse.TEXT_XML_MIME, TYPE.TEXT); - } catch (JAXBException e) { - log.error("Unable to marshal WFS response", e); - throw new WmsException(Code.InternalServerError); - } - return rval; - } - - @Override - public OgcResponse handlePost(InputStream in) { - Element root; - try { - SAXReader reader = new SAXReader(); - Document doc = reader.read(in); - root = doc.getRootElement(); - } catch (java.lang.Exception e) { - log.error("Unable to read post data", e); - return getError(new WmsException(Code.InternalServerError), - OgcResponse.TEXT_XML_MIME); - } - if (root.getQName().equals(getMapName)) { - return getMapPost(root); - } else { - return getError(new WmsException(Code.InvalidParameterValue, - "Post method only supported for GetMap operation"), - OgcResponse.TEXT_XML_MIME); - } - } - - protected OgcResponse getMapPost(Element root) { - GetMapRequest translated; - try { - translated = getMapTranslator.translate(root); - } catch (Throwable e) { - log.error("Unable to converted getmap request", e); - return getError(new WmsException(Code.InternalServerError), - OgcResponse.TEXT_XML_MIME); - } - return getMap(translated); - } - - @Override - public OgcResponse getMap(GetMapRequest req) { - OgcResponse rval = null; - StyledLayerDescriptor sld = req.getSld(); - String[] layers = req.getLayers(); - String[] styles = req.getStyles(); - String[] times = req.getTimes(); - String elevation = req.getElevation(); - Map dimensions = req.getDimensions(); - Integer width = req.getWidth(); - Integer height = req.getHeight(); - boolean sldOnly = sld != null && layers == null; - if ((rval = checkGetMapArgs(req)) != null) { - // there was a problem, return the error - return rval; - } - boolean clear = parseTransparent(req.getTransparent()); - List images; - try { - Iterator it = ImageIO.getImageWritersByMIMEType(req.getFormat() - .toString()); - if (!it.hasNext()) { - throw new WmsException(Code.InvalidFormat, - "Format not supported: " + req.getFormat()); - } - Color color = parseColor(req.getBgcolor()); - CoordinateReferenceSystem targetCrs = parseCrs(req.getCrs()); - Envelope env = parseEnvString(req.getBbox(), targetCrs); - if (req.getWidth() <= 0 || req.getHeight() <= 0) { - throw new WmsException(Code.InvalidParameterValue, - "Invalid resolution"); - } - String username = req.getUserName(); - String[] roles = req.getRoles(); - double scale = getScale(env, width, height); - GetMapProcessor proc = new GetMapProcessor(layerManager, targetCrs, - env, elevation, dimensions, width, height, scale, username, - roles); - if (sld == null) { - images = proc.getMap(layers, styles, times); - } else if (sldOnly) { - images = proc.getMapSld(sld, times); - } else { - images = proc.getMapStyleLib(layers, styles, times, sld); - } - BufferedImage map = mergeWmsImages(images, clear, color, width, - height, env, targetCrs); - rval = new OgcResponse(map, req.getFormat(), TYPE.IMAGE); - } catch (WmsException e) { - rval = getError(e, req.getExceptionFormat()); - } - return rval; - } - - protected Map getStyleMap(StyledLayerDescriptor sld) { - if (sld == null) { - return null; - } - StyledLayer[] layers = sld.getStyledLayers(); - Map rval = new HashMap(); - for (StyledLayer l : layers) { - if (l instanceof NamedLayer) { - NamedLayer nl = (NamedLayer) l; - Style[] styles = nl.getStyles(); - if (styles != null) { - for (Style s : styles) { - rval.put(s.getName(), s); - } - } - } - } - return rval; - } - - protected Envelope parseEnvString(String str, CoordinateReferenceSystem crs) - throws WmsException { - Envelope rval = null; - try { - if (str != null) { - String[] parts = str.split(","); - if (parts.length >= 4) { - double minx = Double.parseDouble(parts[0]); - double miny = Double.parseDouble(parts[1]); - double maxx = Double.parseDouble(parts[2]); - double maxy = Double.parseDouble(parts[3]); - if (minx > maxx || miny > maxy) { - throw new java.lang.Exception(); - } - if (CrsLookup.isEpsgGeoCrs(crs)) { - // EPSG GeoCRS uses lat/lon axis order. Switch to match - // framework order of lon/lat - rval = new Envelope(miny, maxy, minx, maxx); - } else { - rval = new Envelope(minx, maxx, miny, maxy); - } - } else { - throw new java.lang.Exception(); - } - } - } catch (Throwable e) { - throw new WmsException(Code.InvalidParameterValue, "Invalid bbox"); - } - return rval; - } - - /** - * @param crs - * @return - * @throws WmsException - */ - protected CoordinateReferenceSystem parseCrs(String crs) - throws WmsException { - try { - return CrsLookup.lookup(crs); - } catch (Throwable e) { - throw new WmsException(Code.InvalidCRS); - } - } - - protected Color parseColor(String color) throws WmsException { - if (color == null) { - return Color.white; - } - try { - return Color.decode(color); - } catch (NumberFormatException e) { - throw new WmsException(Code.InvalidParameterValue, - "Invalid bgcolor: " + color); - } - } - - protected BufferedImage resize(BufferedImage input, int width, int height) { - BufferedImage rval = input; - // int type = transparent ? BufferedImage.TYPE_INT_ARGB - // : BufferedImage.TYPE_INT_RGB; - int type = BufferedImage.TYPE_INT_ARGB; - boolean quality = !resizeHint.equalsIgnoreCase("speed"); - Object hint = quality ? RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR - : RenderingHints.VALUE_INTERPOLATION_BILINEAR; - int h = quality ? input.getHeight() : height; - int w = quality ? input.getWidth() : width; - - do { - if (quality && w > width) { - w /= 2; - if (w < width) { - w = width; - } - } else { - w = width; - } - if (quality && h > height) { - h /= 2; - if (h < height) { - h = height; - } - } else { - h = height; - } - BufferedImage tmp = new BufferedImage(w, h, type); - Graphics2D g = tmp.createGraphics(); - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint); - g.drawImage(rval, 0, 0, w, h, null); - g.dispose(); - rval = tmp; - } while (w != width || h != height); - return rval; - } - - /** - * @param width - * @param height - * @return - */ - protected BufferedImage createBlank(Integer width, Integer height) { - return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - } - - public static BufferedImage mergeWmsImages(List images, - boolean clear, Color bgcolor, int width, int height, Envelope env, - CoordinateReferenceSystem crs) throws WmsException { - GeneralEnvelope bounds = new GeneralEnvelope(crs); - bounds.setEnvelope(env.getMinX(), env.getMinY(), env.getMaxX(), - env.getMaxY()); - DefaultMapContext map = new DefaultMapContext(); - try { - populateMap(map, images, bounds); - Rectangle dims = new Rectangle(width, height); - ReferencedEnvelope re = new ReferencedEnvelope(env, crs); - if (clear) { - bgcolor = null; - } - return StyleUtility.mapToImage(map, dims, re, bgcolor); - } finally { - if (map != null) { - // map.dispose(); - } - } - } - - protected static void populateMap(MapContext map, List images, - GeneralEnvelope bounds) { - for (WmsImage i : images) { - switch (i.getType()) { - case COVERAGE: - map.addLayer(i.getCoverage(), i.getStyle()); - break; - case FEATURE: - map.addLayer(i.getFeatures(), i.getStyle()); - break; - case STYLE_EMBEDDED_FEATURE: - handleStyledFeatures(map, i.getFeatures()); - break; - case BLANK: - // skip - break; - default: - throw new IllegalStateException("Unkown WMS data type: " - + i.getType()); - } - } - } - - /** - * @param map - * @param features - */ - protected static void handleStyledFeatures(MapContext map, - FeatureCollection features) { - Iterator i = features.iterator(); - StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null); - while (i.hasNext()) { - SimpleFeature feature = i.next(); - Style style = extractStyle(feature, styleFactory); - MemoryFeatureCollection coll = new MemoryFeatureCollection( - feature.getFeatureType()); - coll.addAll(features); - map.addLayer(coll, style); - } - } - - protected static Style extractStyle(SimpleFeature feature, - StyleFactory factory) { - Object styleObj = feature.getAttribute("Style"); - Style style = null; - if (styleObj == null) { - return null; - } - if (styleObj instanceof FeatureTypeStyle) { - style = factory.createStyle(); - style.featureTypeStyles().add((FeatureTypeStyle) styleObj); - } else if (styleObj instanceof Style) { - style = (Style) styleObj; - } - return style; - } - - @Deprecated - protected BufferedImage mergeImages(List images, - boolean clear, Color bgcolor, int width, int height) - throws WmsException { - Iterator i = images.iterator(); - BufferedImage rval = createBlank(width, height); - Graphics2D graphics = rval.createGraphics(); - if (!clear) { - graphics.setColor(bgcolor); - graphics.fillRect(0, 0, width, height); - } - while (i.hasNext()) { - graphics.drawImage(i.next(), 0, 0, null); - } - graphics.dispose(); - return rval; - } - - protected boolean parseTransparent(Boolean transparent) { - if (transparent == null) { - return false; - } - return transparent; - } - - @Override - public OgcResponse getError(WmsException e, MimeType exceptionFormat) { - if (exceptionFormat == null) { - exceptionFormat = OgcResponse.TEXT_XML_MIME; - } - - String rval = ""; - MimeType mimeType = OgcResponse.TEXT_XML_MIME; - if (exceptionFormat.equalsIgnoreParams(OgcResponse.TEXT_HTML_MIME)) { - rval = ""; - rval += "
An error occurred performing the request:
"; - rval += "
Error Code: " + e.getCode().toString(); - rval += "
Message: " + e.getMessage() + ""; - mimeType = OgcResponse.TEXT_HTML_MIME; - } else if (exceptionFormat - .equalsIgnoreParams(OgcResponse.TEXT_XML_MIME) - || exceptionFormat - .equalsIgnoreParams(OgcResponse.APP_VND_OGC_SE_XML)) { - rval = wmsExceptionToXml(e); - mimeType = OgcResponse.TEXT_XML_MIME; - } - OgcResponse resp = new OgcResponse(rval, mimeType, TYPE.TEXT); - switch (e.getCode()) { - case InternalServerError: - resp.setError(ErrorType.INT_ERR); - break; - case OperationNotSupported: - resp.setError(ErrorType.NOT_IMPLEMENTED); - break; - default: - resp.setError(ErrorType.BAD_REQ); - } - return resp; - } - - private String wmsExceptionToXml(WmsException e) { - ServiceExceptionType exType = new ServiceExceptionType(); - exType.setCode(e.getCode().toString()); - exType.setValue(e.getMessage()); - ServiceExceptionReport report = new ServiceExceptionReport(); - report.setServiceException(Arrays.asList(exType)); - String rval = ""; - try { - JAXBContext context = JAXBContext - .newInstance(ServiceExceptionReport.class); - Marshaller marshaller = context.createMarshaller(); - - StringWriter writer = new StringWriter(); - marshaller.marshal(report, writer); - rval = writer.toString(); - } catch (JAXBException e1) { - log.error(e1.getLocalizedMessage(), e1); - return fallbackXmlError(e); - } - return rval; - } - - private String fallbackXmlError(WmsException e) { - String rval = ""; - rval += ""; - rval += ""; - rval += ""; - rval += e.getMessage(); - rval += ""; - return rval; - } - - protected OgcResponse checkGetMapArgs(GetMapRequest req) { - StyledLayerDescriptor sld = req.getSld(); - String[] layers = req.getLayers(); - boolean sldOnly = sld != null && layers == null; - OgcResponse rval = null; - List missing = new LinkedList(); - if (!sldOnly && (layers == null || layers.length < 1)) { - missing.add(WmsHttpHandler.LAYERS_HEADER); - } - String[] styles = req.getStyles(); - if (!sldOnly && (styles == null || styles.length < 1)) { - missing.add(WmsHttpHandler.STYLES_HEADER); - } - String crs = req.getCrs(); - if (crs == null || crs.isEmpty()) { - missing.add(WmsHttpHandler.CRS_HEADER); - } - if (req.getBbox() == null) { - missing.add(WmsHttpHandler.BBOX_HEADER); - } - if (req.getWidth() == null) { - missing.add(WmsHttpHandler.WIDTH_HEADER); - } - if (req.getHeight() == null) { - missing.add(WmsHttpHandler.HEIGHT_HEADER); - } - MimeType format = req.getFormat(); - if (format == null) { - missing.add(WmsHttpHandler.FORMAT_HEADER); - } - if (!missing.isEmpty()) { - Iterator i = missing.iterator(); - String msg = "Missing the following parameter(s): " + i.next(); - while (i.hasNext()) { - msg += ", " + i.next(); - } - WmsException e = new WmsException(Code.MissingParameterValue, msg); - rval = getError(e, req.getExceptionFormat()); - } else if (!sldOnly && (layers.length != styles.length)) { - WmsException e = new WmsException(Code.MissingParameterValue, - "must have the same number of layers and styles"); - rval = getError(e, req.getExceptionFormat()); - } - return rval; - } - - public String getResizeHint() { - return resizeHint; - } - - public void setResizeHint(String resizeHint) { - this.resizeHint = resizeHint; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.WmsProvider#getFeatureInfo(com.raytheon.uf.edex - * .wms.GetFeatureInfoRequest) - */ - @Override - public OgcResponse getFeatureInfo(GetFeatureInfoRequest req) { - GetMapRequest mapReq = req.getMapRequest(); - OgcResponse rval; - if ((rval = checkGetMapArgs(mapReq)) != null) { - // problem - return rval; - } - try { - String[] layers = req.getReqLayers(); - if (layers == null || layers.length < 1) { - throw new WmsException(Code.MissingParameterValue, - "Missing query_layers parameter"); - } - if (req.getInfoFormat() == null) { - throw new WmsException(Code.MissingParameterValue, - "Missing info_format parameter"); - } - String[] times = req.getTimes(); - GridGeometry2D geom = createGridGeometry(mapReq); - Coordinate coord = getCrsCoord(geom, req); - CoordinateReferenceSystem crs = geom.getCoordinateReferenceSystem(); - Envelope bbox = parseEnvString(mapReq.getBbox(), crs); - List> features = new ArrayList>(); - double scale = getScale(bbox, req.getWidth(), req.getHeight()); - for (int i = 0; i < layers.length; ++i) { - String layer = layers[i]; - String time = times[i]; - WmsSource source = layerManager.getSource(layer); - List res = source.getFeatureInfo(layer, - geom.getCoordinateReferenceSystem(), bbox, time, - mapReq.getElevation(), mapReq.getDimensions(), coord, - scale); - if (!res.isEmpty()) { - features.add(res); - } - } - rval = formatFeatures(features, req.getInfoFormat()); - } catch (WmsException e) { - rval = getError(e, req.getExceptionFormat()); - } - return rval; - } - - public static double getScale(Envelope env, int width, int height) { - double xscale = Math.abs((double) env.getMaxX() - env.getMinX()) - / width; - double yscale = Math.abs((double) env.getMaxY() - env.getMinY()) - / height; - double average = (xscale + yscale) / 2; - return average; - } - - protected OgcResponse formatFeatures(List> features, - MimeType format) throws WmsException { - SimpleFeatureFormatter formatter = getFormatter(format); - if (formatter == null) { - throw new WmsException(Code.InvalidFormat, "Unknown format " - + format); - } - try { - return formatter.format(features); - } catch (java.lang.Exception e) { - log.error("Problem formatting features", e); - throw new WmsException(Code.InternalServerError); - } - } - - public static SimpleFeatureFormatter getFormatter(MimeType format) { - ApplicationContext ctx = EDEXUtil.getSpringContext(); - String[] beans = ctx.getBeanNamesForType(SimpleFeatureFormatter.class); - for (String bean : beans) { - SimpleFeatureFormatter sff = (SimpleFeatureFormatter) ctx - .getBean(bean); - if (sff.matchesFormat(format)) { - return sff; - } - } - return null; - } - - protected Coordinate getCrsCoord(GridGeometry2D geom, - GetFeatureInfoRequest req) throws WmsException { - Integer i = req.getI(); - Integer j = req.getJ(); - if (i == null || j == null) { - throw new WmsException(Code.MissingParameterValue, - "Missing I or J parameter"); - } - try { - return getCrsCoord(geom, i, j); - } catch (Throwable e) { - log.error("Problem getting CRS coordinates", e); - throw new WmsException(Code.InternalServerError); - } - } - - public static Coordinate getCrsCoord(GridGeometry2D geom, Integer i, - Integer j) throws Throwable { - MathTransform2D gridToCRS2D = geom.getGridToCRS2D(); - DirectPosition grid = new DirectPosition2D(i, j); - DirectPosition origCrs = new DirectPosition2D(); - gridToCRS2D.transform(grid, origCrs); - return new Coordinate(origCrs.getOrdinate(0), origCrs.getOrdinate(1)); - } - - protected GridGeometry2D createGridGeometry(GetMapRequest mapReq) - throws WmsException { - CoordinateReferenceSystem crs = parseCrs(mapReq.getCrs()); - Envelope bbox = parseEnvString(mapReq.getBbox(), crs); - GeneralEnvelope env = new GeneralEnvelope(crs); - env.setEnvelope(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), - bbox.getMaxY()); - GridEnvelope gridRange = new GeneralGridEnvelope(new int[] { 0, 0 }, - new int[] { mapReq.getWidth(), mapReq.getHeight() }); - GridGeometry2D rval = new GridGeometry2D(gridRange, env); - return rval; - } - - protected OgcResponse checkGetLegendGraphicArgs(GetLegendGraphicRequest req) { - StyledLayerDescriptor sld = req.getSld(); - String layer = req.getLayer(); - boolean sldOnly = sld != null && layer == null; - OgcResponse rval = null; - List missing = new LinkedList(); - if (!sldOnly && layer == null) { - missing.add(WmsHttpHandler.LAYER_HEADER); - } - MimeType format = req.getFormat(); - if (format == null) { - missing.add(WmsHttpHandler.FORMAT_HEADER); - } - if (!missing.isEmpty()) { - Iterator i = missing.iterator(); - String msg = "Missing the following parameter(s): " + i.next(); - while (i.hasNext()) { - msg += ", " + i.next(); - } - WmsException e = new WmsException(Code.MissingParameterValue, msg); - rval = getError(e, req.getExceptionFormat()); - } - return rval; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.wms.WmsProvider#getFeatureInfo(com.raytheon.uf.edex - * .wms.GetFeatureInfoRequest) - */ - @Override - public OgcResponse getLegendGraphic(GetLegendGraphicRequest req) { - OgcResponse rval = null; - StyledLayerDescriptor sld = req.getSld(); - String layer = req.getLayer(); - String style = req.getStyle(); - String time = req.getTime(); - String elevation = req.getElevation(); - Map dimensions = req.getDimensions(); - Integer width = req.getWidth(); - Integer height = req.getHeight(); - boolean sldOnly = sld != null && layer == null; - if ((rval = checkGetLegendGraphicArgs(req)) != null) { - // problem - return rval; - } - String username = req.getUserName(); - String[] roles = req.getRoles(); - try { - BufferedImage legend = null; - GetLegendProcessor proc = new GetLegendProcessor(layerManager, - time, elevation, dimensions, width, height, username, roles); - if (sld == null) { - legend = proc.getLegend(layer, style, true); - } else if (sldOnly) { - // This should never happen because layers is a required. - legend = proc.getLegendSld(sld); - } else { - // empty datauri assumed non-issue since sld is defined - legend = proc.getLegendStyleLib(layer, "", style, sld); - } - if (!parseTransparent(req.getTransparent())) { - String bgString = req.getBgcolor(); - legend = GetLegendProcessor.applyBackground(legend, - parseColor(bgString)); - } - rval = new OgcResponse(legend, req.getFormat(), TYPE.IMAGE); - } catch (WmsException e) { - rval = getError(e, req.getExceptionFormat()); - } - - return rval; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/WmsLayerManager.java b/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/WmsLayerManager.java deleted file mode 100644 index 0f5b6e1e63..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.wms/src/com/raytheon/uf/edex/wms/provider/WmsLayerManager.java +++ /dev/null @@ -1,351 +0,0 @@ -/********************************************************************** - * - * The following software products were developed by Raytheon: - * - * ADE (AWIPS Development Environment) software - * CAVE (Common AWIPS Visualization Environment) software - * EDEX (Environmental Data Exchange) software - * uFrame™ (Universal Framework) software - * - * Copyright (c) 2010 Raytheon Co. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/epl-v10.php - * - * - * Contractor Name: Raytheon Company - * Contractor Address: - * 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - **********************************************************************/ -/** - * - */ -package com.raytheon.uf.edex.wms.provider; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.opengis.wms.v_1_3_0.BoundingBox; -import net.opengis.wms.v_1_3_0.Dimension; -import net.opengis.wms.v_1_3_0.EXGeographicBoundingBox; -import net.opengis.wms.v_1_3_0.Keyword; -import net.opengis.wms.v_1_3_0.KeywordList; -import net.opengis.wms.v_1_3_0.Layer; -import net.opengis.wms.v_1_3_0.LegendURL; -import net.opengis.wms.v_1_3_0.OnlineResource; -import net.opengis.wms.v_1_3_0.Style; - -import org.apache.commons.lang.StringUtils; - -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.ogc.common.OgcBoundingBox; -import com.raytheon.uf.edex.ogc.common.OgcDimension; -import com.raytheon.uf.edex.ogc.common.OgcGeoBoundingBox; -import com.raytheon.uf.edex.ogc.common.OgcLayer; -import com.raytheon.uf.edex.ogc.common.OgcOperationInfo; -import com.raytheon.uf.edex.ogc.common.OgcServiceInfo; -import com.raytheon.uf.edex.ogc.common.OgcStyle; -import com.raytheon.uf.edex.wms.WmsException; -import com.raytheon.uf.edex.wms.WmsException.Code; -import com.raytheon.uf.edex.wms.WmsHttpHandler; -import com.raytheon.uf.edex.wms.IWmsProvider.WmsOpType; -import com.raytheon.uf.edex.wms.reg.WmsSource; -import com.raytheon.uf.edex.wms.reg.WmsSourceAccessor; - -/** - * @author bclement - * - */ -public class WmsLayerManager { - - protected HashMap> layermap = new HashMap>(); - - protected WmsSourceAccessor registry = new WmsSourceAccessor(); - - protected boolean caching = false; - - protected String componentPrefix = "wms"; - - protected IUFStatusHandler log = UFStatus.getHandler(this.getClass()); - - public WmsSource getSource(String layer) throws WmsException { - return getSource(layer, null, null); - } - - public WmsSource getSource(String layer, String username, Set roles) - throws WmsException { - String key = OgcLayer.getKey(layer); - WmsSource rval = registry.getSources().get(key); - if (rval != null && username != null) { - // if (!OgcAuthUtils.isAuthorized(roles, getSourceRoles(key))) { - // // act like the layer doesn't exist - // rval = null; - // } - } - if (rval == null) { - throw new WmsException(Code.LayerNotDefined, - "No layer registered: " + layer); - } - - return rval; - } - - public List getLayers(OgcServiceInfo ogcServiceInfo) { - if (caching) { - return getLayersCache(ogcServiceInfo); - } else { - return getLayersDirect(ogcServiceInfo); - } - } - - protected List getLayersCache( - OgcServiceInfo ogcServiceInfo) { - List rval = new LinkedList(); - Map sources = registry.getSources(); - for (String key : sources.keySet()) { - WmsSource source = sources.get(key); - List layers; - if (layermap.isEmpty() || source.hasUpdated()) { - layers = getPluginLayers(source, ogcServiceInfo); - layermap.put(key, layers); - } else { - layers = layermap.get(key); - } - rval.addAll(layers); - } - return rval; - } - - protected List getLayersDirect( - OgcServiceInfo ogcServiceInfo) { - List rval = new LinkedList(); - Map sources = registry.getSources(); - for (WmsSource source : sources.values()) { - rval.addAll(getPluginLayers(source, ogcServiceInfo)); - } - return rval; - } - - /** - * @param source - * @param ogcServiceInfo - * @return - */ - protected List getPluginLayers(WmsSource source, - OgcServiceInfo ogcServiceInfo) { - List rval = new LinkedList(); - for (OgcLayer layer : source.listLayers()) { - rval.add(getLayerRecursive(layer, ogcServiceInfo)); - } - return rval; - } - - /** - * @param layer - * @param ogcServiceInfo - * @return - */ - protected Layer getLayerRecursive(OgcLayer layer, - OgcServiceInfo ogcServiceInfo) { - Layer rval = new Layer(); - rval.setTitle(layer.getTitle()); - rval.setName(layer.getName()); - rval.setAbstract(layer.getAbs()); - rval.setKeywordList(getAsKeywordList(layer.getKeywords())); - List crs = layer.getCrs(); - if (crs != null) { - rval.setCRS(crs); - } - rval.setEXGeographicBoundingBox(getExBB(layer.getGeoBoundingBox())); - rval.setBoundingBox(getBB(layer.getBoundingBox())); - rval.setDimension(getDimensions(layer.getDimensions())); - rval.setStyle(getAsStyles(layer.getStyles(), ogcServiceInfo)); - setScaleDenom(rval, layer.getMinScaleDenom(), layer.getMaxScaleDenom()); - List children = new LinkedList(); - if (layer.getChildren() != null) { - for (OgcLayer child : layer.getChildren()) { - children.add(getLayerRecursive(child, ogcServiceInfo)); - } - } - rval.setLayer(children); - return rval; - } - - protected void setScaleDenom(Layer layer, double min, double max) { - if (!Double.isNaN(min)) { - layer.setMinScaleDenominator(min); - } - if (!Double.isNaN(max)) { - layer.setMaxScaleDenominator(max); - } - } - - /** - * @param styles - * @param ogcServiceInfo - * @return - */ - private List