diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java new file mode 100644 index 0000000000..74d9c3df01 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java @@ -0,0 +1,83 @@ +/** + * 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.viz.core.reflect; + +import org.eclipse.osgi.framework.internal.core.AbstractBundle; +import org.eclipse.osgi.framework.internal.core.BundleHost; +import org.eclipse.osgi.internal.loader.BundleLoader; +import org.eclipse.osgi.internal.loader.BundleLoaderProxy; +import org.eclipse.osgi.service.resolver.BundleDescription; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleReference; + +/** + * Utility class to get the BundleLoader object associated with a Bundle, to + * potentially synchronize against that object. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 13, 2014 3500       bclement     Initial creation
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + * @see BundleSynchronizer + */ +public class BundleLoaderGetter { + + private BundleLoaderGetter() { + } + + /** + * Attempts to retrieve the BundleLoader associated with the bundle. Returns + * the BundleLoader or null if it could not be retrieved. + * + * @param bundle + * the bundle to retrieve the associated BundleLoader for + * @return the BundleLoader or null + */ + @SuppressWarnings("restriction") + protected static BundleLoader getBundleLoader(Bundle bundle) { + BundleLoader rval = null; + if (bundle instanceof AbstractBundle) { + BundleDescription bundleDesc = ((AbstractBundle) bundle) + .getBundleDescription(); + if (bundleDesc != null) { + Object o = bundleDesc.getUserObject(); + if (!(o instanceof BundleLoaderProxy)) { + if (o instanceof BundleReference) + o = ((BundleReference) o).getBundle(); + if (o instanceof BundleHost) + o = ((BundleHost) o).getLoaderProxy(); + } + if (o instanceof BundleLoaderProxy) { + rval = ((BundleLoaderProxy) o).getBundleLoader(); + } + } + } + return rval; + } + +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java index ba69c2f5f2..a39a53ddad 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java @@ -25,7 +25,6 @@ import java.util.HashSet; import java.util.Set; import org.eclipse.core.runtime.FileLocator; -import org.eclipse.osgi.framework.internal.core.BundleRepository; import org.osgi.framework.Bundle; import org.osgi.framework.wiring.BundleWiring; import org.reflections.Reflections; @@ -49,6 +48,7 @@ import org.reflections.util.ConfigurationBuilder; * Oct 21, 2013 2491 bsteffen Initial creation * Jan 22, 2014 2062 bsteffen Handle bundles with no wiring. * Apr 16, 2014 3018 njensen Synchronize against BundleRepository + * Aug 13, 2014 3500 bclement uses BundleSynchronizer * * * @@ -60,26 +60,19 @@ public class BundleReflections { private final Reflections reflections; - @SuppressWarnings("restriction") public BundleReflections(Bundle bundle, Scanner scanner) throws IOException { - ConfigurationBuilder cb = new ConfigurationBuilder(); - BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); - BundleRepository bundleRepo = BundleRepositoryGetter - .getFrameworkBundleRepository(bundle); + final ConfigurationBuilder cb = new ConfigurationBuilder(); + final BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); if (bundleWiring != null) { - if (bundleRepo != null) { - synchronized (bundleRepo) { + BundleSynchronizer.runSynchedWithBundle(new Runnable() { + @Override + public void run() { cb.addClassLoader(bundleWiring.getClassLoader()); + } - } else { - /* - * even if we couldn't get the bundle repository to sync - * against, it's probably safe, see BundleRepositoryGetter - * javadoc - */ - cb.addClassLoader(bundleWiring.getClassLoader()); - } + }, bundle); + cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL()); cb.setScanners(scanner); reflections = cb.build(); diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java index c6dc4d4d28..36262c6311 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java @@ -30,28 +30,6 @@ import org.osgi.framework.Bundle; * Utility class to get the BundleRepository object associated with a Bundle, to * potentially synchronize against that object. * - * Specifically if a call to BundleWiring.getClassLoader() is invoked on a - * thread other than main/UI thread, then there is a possible deadlock if the - * application shuts down while the BundleWiring.getClassLoader() call is still - * going. The BundleRepository of the Framework is the primary resource that is - * in contention in this deadlock scenario, due to the BundleRepository being - * used as a synchronization lock both deep in bundleWiring.getClassloader() and - * in Framework shutdown code. The other resource used as a synchronization lock - * and causing the deadlock is the BundleLoader associated with the bundle. - * - * Therefore to avoid this deadlock, if you are going to call - * BundleWiring.getClassLoader() you should attempt to get the BundleRepository - * and synchronize against it. This will ensure the call to getClassLoader() can - * finish and then release synchronization locks of both the BundleRepository - * and BundleLoader. - * - * If we fail to get the BundleRepository due to access restrictions, then you - * should proceed onwards anyway because the odds of the application shutting - * down at the same time as the call to BundleWiring.getClassLoader() is still - * running is low. Even if that occurs, the odds are further reduced that the - * two threads will synchronize against the BundleRepository at the same time - * and deadlock. - * * *
  * 
@@ -60,13 +38,14 @@ import org.osgi.framework.Bundle;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Apr 17, 2014            njensen     Initial creation
+ * Aug 13, 2014 3500       bclement    moved documentation over to BundleSynchronizer
  * 
  * 
* * @author njensen * @version 1.0 + * @see BundleSynchronizer */ - public class BundleRepositoryGetter { private BundleRepositoryGetter() { diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java new file mode 100644 index 0000000000..9f1db071c0 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java @@ -0,0 +1,96 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.core.reflect; + +import org.eclipse.osgi.framework.internal.core.BundleRepository; +import org.eclipse.osgi.internal.loader.BundleLoader; +import org.osgi.framework.Bundle; + +/** + * If a call to BundleWiring.getClassLoader() is invoked on a thread other than + * main/UI thread, then there is a possible deadlock if the application shuts + * down while the BundleWiring.getClassLoader() call is still going. The + * BundleLoader and BundleRepository of the Framework are the primary resources + * that are in contention in this deadlock scenario, due to the BundleRepository + * being used as a synchronization lock both deep in + * bundleWiring.getClassloader() and in Framework shutdown code. The other + * resource used as a synchronization lock and causing the deadlock is the + * BundleLoader associated with the bundle. When BundleLoader.findClass() is + * called, it results in a lock on the BundleLoader and then a lock on the + * BundleRepository. This happens when the DefaultClassLoader loads a class. + * + * Therefore to avoid this deadlock, if you are going to call + * BundleWiring.getClassLoader() you should attempt synchronize against the + * BundleLoader and the BundleRepository. This will ensure the call to + * getClassLoader() can finish and then release synchronization locks of both + * the BundleRepository and BundleLoader. + * + * If we fail to get the BundleLoader or BundleRepository, then you should + * proceed onwards anyway because the odds of the application shutting down at + * the same time as the call to BundleWiring.getClassLoader() is still running + * is low. Even if that occurs, the odds are further reduced that the two + * threads will synchronize against the BundleLoader and the BundleRepository at + * the same time and deadlock. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 13, 2014 3500       bclement     Initial creation
+ * 
+ * 
+ * + * @author bclement + * @version 1.0 + */ +public class BundleSynchronizer { + + private BundleSynchronizer() { + } + + /** + * Attempts to synchronize with the bundle's BundleLoader and + * BundleRepository objects before running the runner. If either the + * BundleLoader or the BundleRepository are unable to be retrieved from the + * bundle, the runner is ran anyway since the likelihood of a deadlock is + * relatively small. + * + * @param runner + * @param bundle + * @see BundleLoaderGetter#getBundleLoader(Bundle) + * @see BundleRepositoryGetter#getFrameworkBundleRepository(Bundle) + */ + protected static void runSynchedWithBundle(Runnable runner, Bundle bundle) { + BundleRepository repo = BundleRepositoryGetter + .getFrameworkBundleRepository(bundle); + BundleLoader loader = BundleLoaderGetter.getBundleLoader(bundle); + if (repo != null && loader != null) { + synchronized (loader) { + synchronized (repo) { + runner.run(); + } + } + } else { + runner.run(); + } + } +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java index f7c568feaa..a6c40caf79 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java @@ -28,7 +28,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.eclipse.osgi.framework.internal.core.BundleRepository; import org.osgi.framework.Bundle; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.PackageNamespace; @@ -58,6 +57,7 @@ import com.raytheon.uf.viz.core.Activator; * bundles. * Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies. * Apr 17, 2014 3018 njensen Synchronize against BundleRepository + * Aug 13, 2014 3500 bclement uses BundleSynchronizer * * * @@ -265,25 +265,20 @@ public class SubClassLocator implements ISubClassLocator { */ private Set> loadClassesFromCache(Bundle bundle, Collection classNames) { - BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); + final BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); if (bundleWiring == null) { return Collections.emptySet(); } - BundleRepository bundleRepo = BundleRepositoryGetter - .getFrameworkBundleRepository(bundle); - ClassLoader loader = null; - if (bundleRepo != null) { - synchronized (bundleRepo) { - loader = bundleWiring.getClassLoader(); + final ClassLoader[] loaderHolder = new ClassLoader[1]; + BundleSynchronizer.runSynchedWithBundle(new Runnable() { + @Override + public void run() { + loaderHolder[0] = bundleWiring.getClassLoader(); } - } else { - /* - * even if we couldn't get the bundle repository to sync against, - * it's probably safe, see BundleRepositoryGetter javadoc - */ - loader = bundleWiring.getClassLoader(); - } + }, bundle); + + ClassLoader loader = loaderHolder[0]; if (loader == null) { return Collections.emptySet(); } diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/DIRC.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/DIRC.xml new file mode 100644 index 0000000000..ee280da415 --- /dev/null +++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/DIRC.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/OGRD.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/OGRD.xml new file mode 100644 index 0000000000..76c03bf1af --- /dev/null +++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/OGRD.xml @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/SPC.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/SPC.xml new file mode 100644 index 0000000000..b1062e53fc --- /dev/null +++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/SPC.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java index 7b4e718e3c..086d4c8b26 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java @@ -237,6 +237,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * 09Apr2014 #3005 lvenable Added calls to mark the tabs as not current when the tabs are changed. * This will show the tab as updating in the header and data text controls. * 07/23/2014 15645 zhao modified checkBasicSyntaxError() + * 08/13/2014 3497 njensen Refactored syntax checking to prevent potential infinite loop * * * @@ -462,11 +463,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, */ private TafRecord[] tafsInViewer; - /** - * Set to true is Python Syntax checker modified the TAF otherwise false. - */ - private boolean pythonModifiedTAF = false; - private FindReplaceDlg findDlg; /** @@ -1100,6 +1096,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, Menu fileMenu = new Menu(menuBar); fileMenuItem.setMenu(fileMenu); fileMenu.addListener(SWT.Show, new Listener() { + @Override public void handleEvent(Event event) { setAltFlagForEditorTafTabComp(); } @@ -1211,6 +1208,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, Menu optionsMenu = new Menu(menuBar); optionsMenuItem.setMenu(optionsMenu); optionsMenu.addListener(SWT.Show, new Listener() { + @Override public void handleEvent(Event event) { setAltFlagForEditorTafTabComp(); } @@ -1246,31 +1244,16 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, autoPrintMI.setText("A&uto Print"); autoPrintMI.setSelection(configMgr .getResourceAsBoolean(ResourceTag.AutoPrint)); - autoPrintMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); // Update Times on Format menu item updateTimesFormatMI = new MenuItem(optionsMenu, SWT.CHECK); updateTimesFormatMI.setText("U&pdate Times on Format"); updateTimesFormatMI.setSelection(configMgr .getResourceAsBoolean(ResourceTag.UpdateTimes)); - updateTimesFormatMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); // Send Collective menu item sendCollectMI = new MenuItem(optionsMenu, SWT.CHECK); sendCollectMI.setText("&Send in Collective"); - sendCollectMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); } /** @@ -1290,6 +1273,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, Menu editMenu = new Menu(menuBar); editMenuItem.setMenu(editMenu); editMenu.addListener(SWT.Show, new Listener() { + @Override public void handleEvent(Event event) { setAltFlagForEditorTafTabComp(); } @@ -1398,6 +1382,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, Menu helpMenu = new Menu(menuBar); helpMenuItem.setMenu(helpMenu); helpMenu.addListener(SWT.Show, new Listener() { + @Override public void handleEvent(Event event) { setAltFlagForEditorTafTabComp(); } @@ -2094,12 +2079,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, wrapChk = new Button(controlsComp, SWT.CHECK); wrapChk.setText("Wrap"); configMgr.setDefaultFontAndColors(wrapChk); - wrapChk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); - String wrapStr = configMgr.getDataAsString(ResourceTag.Wrap); if (wrapStr.compareTo("word") == 0) { @@ -2910,20 +2889,10 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, * @return errorInTaf true when syntax error found otherwise false */ private boolean checkSyntaxInEditor(boolean doLogMessage) { - // Get the content of the Taf Editor. - // Assume editorTafTabComp is for the active tab. - // DR15477: trim blank lines before Syntax Checking - String in = (editorTafTabComp.getTextEditorControl().getText().trim()); - // Declare variables for processing the editor's contents. - boolean errorInTaf = false; - int idx1 = 0; - int currentLineNo = 0; - clearSyntaxErrorLevel(); st = editorTafTabComp.getTextEditorControl(); final Map syntaxMap = new HashMap(); - ArrayList tafList = new ArrayList(); st.addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseHover(MouseEvent e) { @@ -2953,12 +2922,59 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, } }); - ArrayList tList = new ArrayList(); + // Get the content of the Taf Editor. + // Assume editorTafTabComp is for the active tab. + // DR15477: trim blank lines before Syntax Checking + String in = (editorTafTabComp.getTextEditorControl().getText().trim()); + checkSyntax(in, syntaxMap, doLogMessage); + // reset everything since checkSyntax may have altered the TAF + st.setStyleRange(null); + syntaxMap.clear(); + + + /* + * TODO Refactor all of this to be smarter. Right now it's kind of dumb + * in that the python syntax check can potentially alter the datetime of + * the TAF and/or the whitespace/spacing of the TAF. If that occurs, the + * python does NOT return the map of syntax problems detected, so you + * have to run the syntax check again against the properly formatted + * TAF. + * + * Due to the way the code is currently structured, there's not an easy + * way to cleanly do the second syntax check only if necessary while + * keeping the style ranges correctly lined up. Therefore, for now we + * will run the syntax check once against the TAF(s) (ie the code + * above), and just presume that it altered the TAF's datetime or + * whitespace. Then we will run it a second time (ie the code below) + * since it should be guaranteed at that point to return a syntax map if + * there were any syntax issues detected. + */ + in = editorTafTabComp.getTextEditorControl().getText().trim(); + boolean errorInTaf = checkSyntax(in, syntaxMap, doLogMessage); + st.setStyleRange(null); + Set srs = syntaxMap.keySet(); + for (StyleRange sr : srs) { + st.setStyleRange(sr); + } + + return errorInTaf; + } + + private boolean checkSyntax(String in, Map syntaxMap, + boolean doLogMessage) { + boolean errorInTaf = false; + List checkedTafs = new ArrayList(); + List tList = new ArrayList(); Map sMap = new HashMap(); + /* + * Separate each TAF individually and syntax check it, and then + * reassemble the set of TAFs each iteration to ensure the line numbers + * and style range indices will line up correctly. + */ + int idx1 = 0; while (idx1 > -1) { int idx2 = in.indexOf("TAF", idx1 + 1); - boolean errInTaf = false; String taf; sMap.clear(); tList.clear(); @@ -2967,52 +2983,35 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, } else { taf = in.substring(idx1); } - currentLineNo = st.getLineAtOffset(idx1); - errInTaf = checkSyntaxUsingPython(taf, currentLineNo, sMap, tList, - doLogMessage); - if (pythonModifiedTAF == false) { - // TAF not changed prepare to check next taf. - tafList.add(tList.get(0)); - if (errInTaf) { - for (StyleRange skey : sMap.keySet()) { - syntaxMap.put(skey, sMap.get(skey)); - } - } - errorInTaf |= errInTaf; - idx1 = idx2; - } else { - // Python modified the TAF. Assume self correction. - // Ignore errors and set up to check the corrected taf. - StringBuilder sb = new StringBuilder(); - for (String tempTaf : tafList) { - sb.append(tempTaf); - sb.append("\n"); - } - sb.append(tList.get(0)); - sb.append("\n"); - if (idx2 > -1) { - sb.append(in.substring(idx2)); - } - in = sb.toString(); - st.setText(in); + int currentLineNo = st.getLineAtOffset(idx1); + errorInTaf |= checkSyntaxUsingPython(taf, currentLineNo, sMap, + tList, doLogMessage); + for (StyleRange skey : sMap.keySet()) { + syntaxMap.put(skey, sMap.get(skey)); } - } - StringBuilder sb = new StringBuilder(); + String tafAfterCheck = tList.get(0); + checkedTafs.add(tafAfterCheck); + StringBuilder sb = new StringBuilder(); + for (String checkedTaf : checkedTafs) { + sb.append(checkedTaf); + sb.append("\n"); + } + int lengthChecked = sb.length(); - for (String taf : tafList) { - sb.append(taf); - sb.append("\n"); - } + if (idx2 > -1) { + sb.append(in.substring(idx2)); + } + in = sb.toString(); + st.setText(in); - st.setText(sb.toString()); - st.setStyleRange(null); - - Set srs = syntaxMap.keySet(); - - for (StyleRange sr : srs) { - st.setStyleRange(sr); + /* + * Set idx1 to the next TAF after all the text that has already been + * checked. This ensures we won't hit the very rare infinite loop + * that occurs if tafAfterCheck comes back with two TAFS inside it. + */ + idx1 = in.indexOf("TAF", lengthChecked); } return errorInTaf; @@ -3037,32 +3036,19 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, */ @SuppressWarnings("unchecked") private boolean checkSyntaxUsingPython(String in, int currentLineNo, - Map syntaxMap, ArrayList tafList, + Map syntaxMap, List tafList, boolean doLogMessage) { - // TODO remove - getSitesInTaf(in); - // Declare variables for processing the editor's contents. boolean errorInTaf = false; int[] range = new int[] { 0, 0, 0, 0 }; - pythonModifiedTAF = false; - // Assume editorTafTabComp is for the active tab. - st = editorTafTabComp.getTextEditorControl(); - HashMap resultMap = parseText(in, - editorTafTabComp.getBBB()); - HashMap parsedText = (HashMap) resultMap - .get("result"); + in = in.trim(); + Map resultMap = parseText(in, editorTafTabComp.getBBB()); String newText = (String) resultMap.get("text"); + Map parsedText = (Map) resultMap + .get("result"); String newTime = (String) resultMap.get("headerTime"); tafList.add(newText); - // Python may change the TAF let the caller handle it prior to setting - // up any error information. - if (in.trim().equals(newText.trim()) == false) { - pythonModifiedTAF = true; - return true; - } - editorTafTabComp.setLargeTF(newTime); java.util.List results; StringBuilder errorMsg = new StringBuilder(); @@ -3328,7 +3314,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, * @return -- the decoded TAF */ @SuppressWarnings("unchecked") - private HashMap parseText(String text, String bbb) { + private Map parseText(String text, String bbb) { IPathManager pm = PathManagerFactory.getPathManager(); @@ -3340,10 +3326,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, File baseDir = pm.getFile(baseContext, "aviation" + IPathManager.SEPARATOR + "python"); - HashMap resultMap = null; - - HashMap map = new HashMap(); - + Map resultMap = null; + Map argMap = new HashMap(); try { if (parsePythonScript == null) { parsePythonScript = new PythonScript(baseFile.getPath(), @@ -3352,13 +3336,13 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, TafViewerEditorDlg.class.getClassLoader()); } parsePythonScript.instantiatePythonClass("parser", "Decoder", null); - map.put("text", text); - map.put("bbb", bbb); + argMap.put("text", text); + argMap.put("bbb", bbb); Object com = parsePythonScript.execute("parseFromJava", "parser", - map); - resultMap = (HashMap) com; + argMap); + resultMap = (Map) com; } catch (JepException e) { - e.printStackTrace(); + statusHandler.error("Error parsing TAF", e); } return resultMap; } @@ -4433,6 +4417,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, * * @see com.raytheon.viz.aviation.editor.ITafSettable#getViewerTabList() */ + @Override public List getViewerTabList() { return modelsTabs; } diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java index e967fcc336..7366b62bcf 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java @@ -106,6 +106,7 @@ import com.vividsolutions.jts.geom.LineString; * 06-03-14 3191 njensen Fix postData to not retrieve * 06-17-2014 DR17409 mgamazaychikov Fix futurePoints calculation in generateNewTrackInfo() * and generateExistingTrackInfo() + * 08-21-2014 DR 15700 Qinglu Lin handle the situation where frameTime is null in paintTrack(). * * * @@ -693,9 +694,6 @@ public class StormTrackDisplay implements IRenderable { } if (state.geomChanged) { - if (cachedTrack != null) { - cachedTrack.dispose(); - } if (StormTrackState.trackType.equals("lineOfStorms") && state.justSwitchedToLOS) { GeodeticCalculator gc = new GeodeticCalculator(); Coordinate[] coords = state.dragMeGeom.getCoordinates(); @@ -704,9 +702,16 @@ public class StormTrackDisplay implements IRenderable { coords[coords.length - 1].y); state.angle = adjustAngle(gc.getAzimuth() - 90); } - generateTrackInfo(state, paintProps); - if (state.mode == Mode.TRACK) { - createTrack(target, paintProps); + DataTime frameTime = paintProps.getDataTime(); + if (frameTime != null) { + if (cachedTrack != null) { + cachedTrack.dispose(); + } + generateTrackInfo(state, paintProps, frameTime); + if (state.mode == Mode.TRACK) { + createTrack(target, paintProps); + } + state.geomChanged = false; } state.geomChanged = false; } @@ -727,7 +732,7 @@ public class StormTrackDisplay implements IRenderable { * @param currentState */ private void generateTrackInfo(StormTrackState currentState, - PaintProperties paintProps) throws VizException { + PaintProperties paintProps, DataTime frameTime) throws VizException { int frameCount = trackUtil.getFrameCount(paintProps.getFramesInfo()); int currFrame = trackUtil.getCurrentFrame(paintProps.getFramesInfo()); try { @@ -740,7 +745,6 @@ public class StormTrackDisplay implements IRenderable { && currentState.timePoints.length != frameCount) { // need to set theAnchorPoint and theAnchorIndex here // because timePoints get erased before we get to updateAnchorPoint - DataTime frameTime = paintProps.getDataTime(); for (int j=0;j @@ -109,6 +111,8 @@ public class LightningResource extends private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(LightningResource.class); + private static final long MAX_RECORD_BIN_MILLIS = TimeUtil.MILLIS_PER_DAY; + private static class LightningFrame { public LightningFrameMetadata metadata; @@ -515,6 +519,13 @@ public class LightningResource extends for (BinLightningRecord obj : objs) { if (obj.getSource().equals(this.lightSource) || this.lightSource.isEmpty()) { + long duration = obj.getDataTime().getValidPeriod() + .getDuration(); + if (duration > MAX_RECORD_BIN_MILLIS) { + statusHandler.error("Record bin time larger than maximum " + + "supported period. Skipping record: " + obj); + continue; + } DataTime time = new DataTime(obj.getStartTime()); DataTime end = new DataTime(obj.getStopTime()); time = this.getResourceData().getBinOffset() diff --git a/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml b/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml index 34202fab7c..670ff6c3a7 100644 --- a/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml +++ b/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml @@ -1,124 +1,163 @@ - + - - - - - - - - - + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + - + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - - - - - - - - - - + + + + + + + + + + @@ -149,42 +188,41 @@ - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java index ec732ab855..029717e702 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java @@ -57,6 +57,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.warngen.gui.WarngenLayer; +import com.raytheon.viz.warngen.gui.WarngenLayer.GeoFeatureType; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Polygon; @@ -70,6 +71,7 @@ import com.vividsolutions.jts.geom.Polygon; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 17, 2014 3419 jsanchez Initial creation + * Aug 20, 2014 ASM #16703 D. Friedman Ensure watches have a state attribute. * * * @@ -173,7 +175,8 @@ public class WatchUtil { } DbQueryRequest request = buildRequest(simulatedTime, - phenSigConstraint.toString(), warngenLayer.getAllUgcs(), + phenSigConstraint.toString(), + warngenLayer.getAllUgcs(GeoFeatureType.COUNTY), entityClass); DbQueryResponse response = (DbQueryResponse) ThriftClient .sendRequest(request); @@ -190,7 +193,7 @@ public class WatchUtil { System.out.println("create watch area buffer time: " + (System.currentTimeMillis() - t0)); Set validUgcZones = warngenLayer - .getUgcsForWatches(watchArea); + .getUgcsForWatches(watchArea, GeoFeatureType.COUNTY); watches = processRecords(records, validUgcZones); } catch (RuntimeException e) { statusHandler @@ -327,6 +330,14 @@ public class WatchUtil { */ String ugcZone = ar.getUgcZone(); String state = getStateName(ugcZone.substring(0, 2)); + + /* + * Temporary fix for SS DR #16703. Remove when marine watch wording + * is fixed. + */ + if (state == null) + continue; + String action = ar.getAct(); String phenSig = ar.getPhensig(); String etn = ar.getEtn(); @@ -360,7 +371,16 @@ public class WatchUtil { @Override public int compare(Watch watch1, Watch watch2) { - return watch1.getState().compareTo(watch2.getState()); + String state1 = watch1.getState(); + String state2 = watch2.getState(); + if (state1 == state2) + return 0; + else if (state1 == null) + return 1; // null state is greater; put at end + else if (state2 == null) + return -1; + else + return state1.compareTo(state2); } }); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index d0cc50b9ff..171e5e5547 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -215,6 +215,7 @@ import com.vividsolutions.jts.io.WKTReader; * 07/01/2014 DR 17450 D. Friedman Use list of templates from backup site. * 07/28/2014 DR 17475 Qinglu Lin Updated populateStrings() and findLargestQuadrant(), removed findLargestGeometry(), * added createAreaAndCentroidMaps() and movePopulatePt(), updated paintText() to center W. + * 08/20/2014 ASM #16703 D. Friedman Make geo feature types for watches explicit * * * @author mschenke @@ -1521,50 +1522,42 @@ public class WarngenLayer extends AbstractStormTrackResource { return null; } + public enum GeoFeatureType { + COUNTY("county", "FIPS"), MARINE("marinezones", "ID"); + final private String tableName; + final private String fipsField; + private GeoFeatureType(String tableName, String fipsField) { + this.tableName = tableName; + this.fipsField = fipsField; + } + } + /** * Returns a set of UGCs for each area in the CWA that intersects the given * polygon. */ - public Set getUgcsForWatches(Polygon polygon) + public Set getUgcsForWatches(Polygon polygon, GeoFeatureType type) throws Exception { - GeospatialDataAccessor gda = getGeospatialDataAcessor(); - boolean isMarineZone = configuration.getGeospatialConfig() - .getAreaSource().equalsIgnoreCase(MARINE); - if (!isMarineZone) { - Set ugcs = new HashSet(); - for (String fips : gda.getAllFipsInArea(gda.buildArea(polygon))) { - ugcs.add(FipsUtil.getUgcFromFips(fips)); - } - return ugcs; - } else { - Set ids = new HashSet(); - Geometry g = gda.buildArea(polygon); - ids = getAllFipsInArea(g); - return ids; - } + Set ugcs = new HashSet(); + GeospatialDataAccessor gda = getGeospatialDataAcessor(type); + for (String fips : gda.getAllFipsInArea(gda.buildArea(polygon))) + ugcs.add(FipsUtil.getUgcFromFips(fips)); + return ugcs; } - public Set getAllUgcs() throws Exception { - GeospatialDataAccessor gda; + public Set getAllUgcs(GeoFeatureType type) throws Exception { + // TODO: zig + GeospatialDataAccessor gda = getGeospatialDataAcessor(type); Set ugcs = new HashSet(); - gda = getGeospatialDataAcessor(); - boolean isMarineZone = configuration.getGeospatialConfig() - .getAreaSource().equalsIgnoreCase(MARINE); - if (!isMarineZone) { - for (GeospatialData r : gda.geoData.features) { - ugcs.add(FipsUtil.getUgcFromFips(gda.getFips(r))); - } - } else { - for (GeospatialData r : gda.geoData.features) { - ugcs.add(getFips(r)); - } + for (GeospatialData r : gda.geoData.features) { + ugcs.add(FipsUtil.getUgcFromFips(gda.getFips(r))); } return ugcs; } - private GeospatialDataAccessor getGeospatialDataAcessor() + private GeospatialDataAccessor getGeospatialDataAcessor(GeoFeatureType type) throws Exception { - GeospatialDataList gdl = searchGeospatialDataAccessor(); + GeospatialDataList gdl = searchGeospatialDataAccessor(type); if (gdl == null) { // Cause county geospatial data to be loaded /* @@ -1574,36 +1567,33 @@ public class WarngenLayer extends AbstractStormTrackResource { * the filename. What happens in the future if the base file gets * changed again? A ticket should be opened for this to be resolved. */ - WarngenConfiguration torConfig = WarngenConfiguration.loadConfig( - "tornadoWarning", getLocalizedSite(), null); - loadGeodataForConfiguration(torConfig); - gdl = searchGeospatialDataAccessor(); + String templateName; + if (type == GeoFeatureType.COUNTY) + templateName = "tornadoWarning"; + else if (type == GeoFeatureType.MARINE) + templateName = "specialMarineWarning"; + else + throw new IllegalArgumentException("Unsupported geo feature type " + type); + WarngenConfiguration config = WarngenConfiguration.loadConfig( + templateName, getLocalizedSite(), null); + loadGeodataForConfiguration(config); + gdl = searchGeospatialDataAccessor(type); } - // TODO: There should be some way to get the "county" configuration by - // name - // independent of a template + // TODO: FIPS field should not be hardcoded. AreaSourceConfiguration areaConfig = new AreaSourceConfiguration(); - areaConfig.setFipsField("FIPS"); + areaConfig.setFipsField(type.fipsField); return new GeospatialDataAccessor(gdl, areaConfig); } - private GeospatialDataList searchGeospatialDataAccessor() { + private GeospatialDataList searchGeospatialDataAccessor(GeoFeatureType type) { synchronized (siteMap) { for (Map.Entry entry : siteMap .entrySet()) { String[] keyParts = entry.getKey().split("\\."); - boolean isMarineZone = configuration.getGeospatialConfig() - .getAreaSource().equalsIgnoreCase(MARINE); - String mapdataTable = null; - if (!isMarineZone) { - mapdataTable = "county"; - } else { - mapdataTable = "marinezones"; - } if ((keyParts.length == 2) - && mapdataTable.equalsIgnoreCase(keyParts[0]) + && type.tableName.equalsIgnoreCase(keyParts[0]) && getLocalizedSite().equals(keyParts[1])) { return entry.getValue(); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java index f46a62c0d6..e016ffb18f 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java @@ -141,6 +141,7 @@ import com.vividsolutions.jts.io.WKTReader; * added determineAffectedMarinePortions(). * Apr 28, 2014 3033 jsanchez Set the site and backup site in Velocity Engine's properties * Jul 21, 2014 3419 jsanchez Refactored WatchUtil. + * Aug 15, 2014 DR15701 mgamazaychikov Removed static field watchUtil. * * * @author njensen @@ -158,8 +159,6 @@ public class TemplateRunner { private static Hashtable dateFormat; - private static WatchUtil watchUtil; - static { dateFormat = new Hashtable(); dateFormat @@ -854,9 +853,7 @@ public class TemplateRunner { // Store Watches try { t0 = System.currentTimeMillis(); - if (watchUtil == null) { - watchUtil = new WatchUtil(warngenLayer); - } + WatchUtil watchUtil = new WatchUtil(warngenLayer); List watches = watchUtil.getWatches(config, warnPolygon, simulatedTime); System.out.println("getWatches time: " diff --git a/deltaScripts/13.6.1/updateSkewtDisplays.py b/deltaScripts/13.6.1/updateSkewtDisplays.py index 3e298fa01b..01871abb42 100644 --- a/deltaScripts/13.6.1/updateSkewtDisplays.py +++ b/deltaScripts/13.6.1/updateSkewtDisplays.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # This script will update any saved displays which use older skewT displays to # use Nsharp. # diff --git a/deltaScripts/14.2.1/updateTopoFile.py b/deltaScripts/14.2.1/updateTopoFile.py new file mode 100644 index 0000000000..acdfdb7213 --- /dev/null +++ b/deltaScripts/14.2.1/updateTopoFile.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# This script will update any saved displays or procedures with the old Topo file name +# +# This update only needs to be run if there are saved displays being stored +# outside of localization, for procedures saved in localization, +# updateTopoFile.sh will automatically call this. + + +import sys +import xml.etree.ElementTree as ET + +xsitype = '{http://www.w3.org/2001/XMLSchema-instance}type' + +def upgradeBundle(bundleFile): + tree = ET.parse(bundleFile) + root = tree.getroot() + iterpath = 'bundles/bundle/displayList/displays' + if root.tag == 'bundle': + iterpath = 'displayList/displays' + for display in root.iterfind(iterpath): + if display.get(xsitype) == "d2DMapRenderableDisplay": + for resourceData in display.iterfind('descriptor/resource/resourceData'): + if resourceData.get(xsitype) == 'topoResourceData': + for topoFile in resourceData.iterfind('topoFile'): + if topoFile.text == 'srtm30.hdf': + topoFile.text = 'defaultTopo.h5' + tree.write(bundleFile) + +if __name__ == '__main__': + for arg in sys.argv[1:]: + upgradeBundle(arg) \ No newline at end of file diff --git a/deltaScripts/14.2.1/updateTopoFile.sh b/deltaScripts/14.2.1/updateTopoFile.sh new file mode 100644 index 0000000000..924d1790da --- /dev/null +++ b/deltaScripts/14.2.1/updateTopoFile.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# This script will update any D2D procedures files +# which use the old Topo file name + +IFS=$'\n' +files=`ls /awips2/edex/data/utility/cave_static/*/*/procedures/*.xml` + +if [ $? -ne 0 ]; then +echo "No procedures found" +exit 1 +fi + +MY_DIR=`dirname $0` + +for f in $files; do + grep 'srtm30.hdf' $f > /dev/null + if [ $? -eq 0 ]; then + echo Updating $f + python $MY_DIR/updateTopoFile.py $f + fi +done + +echo "INFO: the update has completed successfully!" +exit 0 diff --git a/edexOsgi/build.edex/esb/bin/start.sh b/edexOsgi/build.edex/esb/bin/start.sh index 189c0d6642..16f22224e0 100644 --- a/edexOsgi/build.edex/esb/bin/start.sh +++ b/edexOsgi/build.edex/esb/bin/start.sh @@ -72,6 +72,7 @@ export SHLIB_PATH=$PROJECT/sharedlib ### End AWIPS 1 support ### export HOSTNAME=`hostname` +export SHORT_HOSTNAME=`hostname -s` # set Python & Java into the path export PATH=$awips_home/bin:${JAVA_INSTALL}/bin:${PYTHON_INSTALL}/bin:$PATH diff --git a/edexOsgi/build.edex/esb/bin/yajsw/scripts/wrapperCapture.sh b/edexOsgi/build.edex/esb/bin/yajsw/scripts/wrapperCapture.sh new file mode 100644 index 0000000000..7bf295aebc --- /dev/null +++ b/edexOsgi/build.edex/esb/bin/yajsw/scripts/wrapperCapture.sh @@ -0,0 +1,180 @@ +#!/bin/sh +##################################################################### +# 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. +##################################################################### +##################################################################### +# Script for capturing data from a wrapper java process when the +# wrapper restarts the process +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------- -------- ----------- -------------------------- +# Aug 07, 2014 3470 rjpeter Initial creation +# +##################################################################### +# NOTE: Script must be located at /awips2/qpid/bin/yajsw/scripts for it to work + +# base path to save capture data to, will create subdirectory for each server +basePath="/data/fxa/cave" + +state=$1 +string_state=$2 +pid=$4 + +path_to_script=`readlink -f $0` +curTime=`date +%Y%m%d_%H%M%S` +echo "$curTime: Wrapper running $path_to_script due to state transition for pid $pid. New State $state|$string_state" + +# ensure directory is created and has write permissions +checkDir() { + dir="$1" + if [ ! -d "$dir" ]; then + mkdir -p $dir + if [ ! -d "$dir" ]; then + message="Unable to create qpid capture data directory\n$dir" + echo -e "Capture failed: $message" + exit 1 + fi + fi + + if [ ! -w "$dir" ]; then + message="Do not have write permissions to qpid capture data directory\n$dir" + echo -e "Capture failed: $message" + exit 1 + fi +} + +# gets top output of local server +runTop() { + local curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "$curTime: Capturing top" + echo "$curTime: Capturing top" >> $processFile + local out_file="${dataPath}/top.log" + export COLUMNS=160 + top -b -c -n1 >> $out_file 2>&1 + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: top captured" +} + +# runs jstack 10 times, if it fails will run again with -F +runJstack() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jstacks" + local pid="$1" + local count=1 + local cmd="/awips2/java/bin/jstack" + local prePath="${dataPath}/pid_${pid}_" + local log="" + + while [ "$count" -le "10" ]; do + curTime=`date "+%Y%m%d_%H:%M:%S"` + log="${prePath}jstack_${count}.log" + + echo "${curTime}: Running command: ${cmd} ${pid} >> ${log} 2>&1" >> $processFile + echo "Running for $curTime" >> $log + ${cmd} ${pid} >> ${log} 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jstack for $pid failed to connect, rerunning with -F" >> $processFile + ${cmd} -F ${pid} >> ${log} 2>&1 + fi + let "count+=1" + done + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jstacks captured" +} + +# runs jmap -heap +runJmapHeap() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jmap -heap" + local pid=$1 + local prePath="${dataPath}/pid_${pid}_" + + local log="${prePath}jmapHeap.log" + local cmd="/awips2/java/bin/jmap -heap" + echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile + $cmd $pid >> $log 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile + $cmd -F $pid >> $log 2>&1 + fi + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jmap -heap captured" +} + +# runs jmap, if it fails will run again with -F +runJmap() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jmap -dump" + local pid=$1 + local prePath="${dataPath}/pid_${pid}_jmap" + + local log="${prePath}.log" + local dumpPath="${prePath}.hprof" + local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}" + echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile + $cmd $pid >> $log 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile + $cmd -F $pid >> $log 2>&1 + fi + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jmap -dump captured" +} + + + +if [[ "$pid" != "-1" ]]; then + process=`ps -ef | grep $pid | grep java` + + if [[ "$process" != "" ]]; then + hostName=`hostname -s` + dataPath="${basePath}/${hostName}/wrapperCaptureData_${curTime}_pid_$pid" + checkDir $dataPath + processFile=${dataPath}/capture_info.log + echo "Wrapper running $0 due to state transition for pid $pid. New State $state|$string_state" >> $processFile + echo "Process information:" >> $processFile + ps -ef | grep $pid >> $processFile + runTop & + runJstack $pid & + runJmapHeap $pid & + # TODO: Double check if jvm already dumped one + runJmap $pid & + wait + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Data captured to $dataPath" + else + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: PID $pid is no longer running, nothing to capture" + fi +else + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: PID was -1, process no longer running, nothing to capture" +fi diff --git a/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar b/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar index 11cc89fc8b..1c51679218 100644 Binary files a/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar and b/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar differ diff --git a/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar b/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar index a86807d3b7..bd97cf4919 100644 Binary files a/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar and b/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar differ diff --git a/edexOsgi/build.edex/esb/conf/wrapper.conf b/edexOsgi/build.edex/esb/conf/wrapper.conf index a66a88932d..8f6467fc86 100644 --- a/edexOsgi/build.edex/esb/conf/wrapper.conf +++ b/edexOsgi/build.edex/esb/conf/wrapper.conf @@ -96,6 +96,8 @@ wrapper.java.additional.5=-Duser.timezone=GMT # garbage collection settings wrapper.java.additional.gc.1=-XX:+UseConcMarkSweepGC wrapper.java.additional.gc.2=-XX:+CMSIncrementalMode +wrapper.java.additional.gc.3=-XX:+HeapDumpOnOutOfMemoryError +wrapper.java.additional.gc.4=-XX:HeapDumpPath=/data/fxa/cave/${SHORT_HOSTNAME}/ # use qpid binding URL instead of default address string format wrapper.java.additional.qpid.1=-Dqpid.dest_syntax=BURL @@ -154,7 +156,13 @@ wrapper.java.app.mainclass=com.raytheon.uf.edex.esb.Main # Application parameters. Add parameters as needed starting from 2 wrapper.app.parameter.2=start -wrapper.ping.timeout=300 +wrapper.ping.timeout=30 + +# NOTE: script must be located at /awips2/qpid/bin/yajsw/scripts for it to be found +wrapper.script.ABORT=wrapperCapture.sh +wrapper.script.ABORT.timeout=120 +wrapper.script.RESTART=wrapperCapture.sh +wrapper.script.RESTART.timeout=120 # jvm will be hard killed after 5 minutes of trying to shutdown wrapper.jvm_exit.timeout=0 @@ -169,15 +177,16 @@ wrapper.java.monitor.heap.threshold.percent = 90 wrapper.java.monitor.deadlock = true # application will be restarted and a warning message will be logged -wrapper.filter.action.deadlock.restart=${WRAPPER_DEADLOCK_ACTION} +wrapper.filter.trigger.deadlock=wrapper.java.monitor.deadlock: DEADLOCK IN THREADS: +wrapper.filter.action.deadlock=${WRAPPER_DEADLOCK_ACTION} # restart the application if it crashes wrapper.on_exit.default=${WRAPPER_ON_EXIT_ACTION} # restart the application if it runs out of memory -wrapper.trigger.1=java.lang.OutOfMemoryError -wrapper.trigger.action=${WRAPPER_TRIGGER_ACTION} +wrapper.filter.trigger.oom=java.lang.OutOfMemoryError +wrapper.filter.action.oom=${WRAPPER_TRIGGER_ACTION} -#******************************************************************** +#********************************************************************fil # Wrapper Logging Properties #******************************************************************** # Format of output for the console. (See docs for formats) diff --git a/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/BinLightningDecoder.java b/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/BinLightningDecoder.java index 7c7b0756bc..68a2b8c219 100644 --- a/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/BinLightningDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.binlightning/src/com/raytheon/edex/plugin/binlightning/BinLightningDecoder.java @@ -22,8 +22,14 @@ package com.raytheon.edex.plugin.binlightning; import gov.noaa.nws.ost.edex.plugin.binlightning.BinLigntningDecoderUtil; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; -import java.util.List; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import java.util.TimeZone; import org.apache.commons.logging.Log; @@ -33,12 +39,12 @@ import com.raytheon.edex.esb.Headers; import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint; import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.wmo.message.WMOHeader; @@ -82,6 +88,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader; * Jan 24, 2014 DR 16774 Wufeng Zhou Modified for updated Bin-lightning data spec, * and to used WMO header to distinguish bit-shifted * GLD360 and NLDN data. + * Aug 04, 2014 3488 bclement added checkBinRange(), rebin() and finalizeRecords() * * * @@ -100,6 +107,9 @@ public class BinLightningDecoder extends AbstractDecoder { private final Log logger = LogFactory.getLog(getClass()); + private static final boolean REBIN_INVALID_DATA = Boolean + .getBoolean("rebin.invalid.binlightning"); + /** * Default lightning strike type for FLASH messages. RT_FLASH documents * indicate no default, but D2D code defaults to STRIKE_CG also. @@ -127,7 +137,7 @@ public class BinLightningDecoder extends AbstractDecoder { public PluginDataObject[] decode(byte[] data, Headers headers) throws DecoderException { //String traceId = null; - PluginDataObject[] reports = new PluginDataObject[0]; + PluginDataObject[] rval = new PluginDataObject[0]; if (data != null) { traceId = (String) headers.get(DecoderTools.INGEST_FILE_NAME); @@ -163,11 +173,13 @@ public class BinLightningDecoder extends AbstractDecoder { // both encrypted data and legacy data // - List strikes = BinLigntningDecoderUtil.decodeBinLightningData(data, pdata, traceId, wmoHdr, baseTime.getTime()); + Collection strikes = BinLigntningDecoderUtil + .decodeBinLightningData(data, pdata, traceId, wmoHdr, + baseTime.getTime()); if (strikes == null) { // keep-alive record, log and return logger.info(traceId + " - found keep-alive record. ignore for now."); - return reports; + return rval; } // @@ -186,44 +198,133 @@ public class BinLightningDecoder extends AbstractDecoder { return new PluginDataObject[0]; } - Calendar c = TimeTools.copy(baseTime); - if (c == null) { - throw new DecoderException(traceId + " - Error decoding times"); - } //report.setInsertTime(c); // OB13.4 source code does not have this line anymore, WZ 05/03/2013 - - Calendar cStart = report.getStartTime(); - if (cStart.getTimeInMillis() > (c.getTimeInMillis() + TEN_MINUTES)) { - synchronized (SDF) { - logger.info("Discarding future data for " + traceId - + " at " + SDF.format(cStart.getTime())); - } - } else { - Calendar cStop = report.getStopTime(); - - TimeRange range = new TimeRange(cStart.getTimeInMillis(), - cStop.getTimeInMillis()); - - DataTime dataTime = new DataTime(cStart, range); - report.setDataTime(dataTime); - - if (report != null) { - report.setTraceId(traceId); - //report.setPluginName("binlightning"); // line disappear in OB15.5.3 - try { - report.constructDataURI(); - reports = new PluginDataObject[] { report }; - } catch (PluginException e) { - logger.error("Error constructing datauri", e); - throw new DecoderException("Error constructing datauri", e); - } - } - } + Collection records = checkBinRange(report, + strikes); + rval = finalizeRecords(records, baseTime); } } else { logger.error("No WMOHeader found in data"); } - return reports; + return rval; + } + + /** + * Perform final actions on each record and populate a PDO array with them. + * Any invalid records will be omitted from the return array. + * + * @param records + * @param baseTime + * @return + * @throws DecoderException + */ + private PluginDataObject[] finalizeRecords( + Collection records, Calendar baseTime) + throws DecoderException { + Calendar c = TimeTools.copy(baseTime); + if (c == null) { + throw new DecoderException(traceId + " - Error decoding times"); + } + ArrayList rval = new ArrayList( + records.size()); + for (BinLightningRecord record : records) { + Calendar cStart = record.getStartTime(); + if (cStart.getTimeInMillis() > (c.getTimeInMillis() + TEN_MINUTES)) { + synchronized (SDF) { + logger.info("Discarding future data for " + traceId + + " at " + SDF.format(cStart.getTime())); + } + } else { + Calendar cStop = record.getStopTime(); + + TimeRange range = new TimeRange(cStart.getTimeInMillis(), + cStop.getTimeInMillis()); + + DataTime dataTime = new DataTime(cStart, range); + record.setDataTime(dataTime); + + if (record != null) { + record.setTraceId(traceId); + rval.add(record); + } + } + } + return rval.toArray(new PluginDataObject[rval.size()]); + } + + /** + * Ensure that the record has a valid bin range. If it does, it will be the + * only record in the return value. Otherwise, {@link #REBIN_INVALID_DATA} + * is used to determine if no records should be returned or the strikes + * should be split into valid bin ranges uses {@link #rebin(Collection)} + * + * @param record + * @param strikes + * @return + */ + private Collection checkBinRange( + BinLightningRecord record, Collection strikes) { + Collection rval = Collections.emptyList(); + Calendar cStart = record.getStartTime(); + Calendar cStop = record.getStopTime(); + long binRange = cStop.getTimeInMillis() - cStart.getTimeInMillis(); + if (binRange > TimeUtil.MILLIS_PER_DAY) { + if (REBIN_INVALID_DATA) { + rval = rebin(strikes); + } else { + String rangeStart; + String rangeEnd; + synchronized (SDF) { + rangeStart = SDF.format(cStart.getTime()); + rangeEnd = SDF.format(cStop.getTime()); + } + logger.error("Discarding data with invalid bin range of " + + rangeStart + " to " + rangeEnd); + } + } else { + rval = Arrays.asList(record); + } + return rval; + } + + /** + * Split the strikes into 1 day bins and create a new record for each bin + * + * @param strikes + * @return + */ + private Collection rebin( + Collection strikes) { + Map> binMap = new HashMap>( + 1); + for (LightningStrikePoint strike : strikes) { + Calendar c = TimeTools.getBaseCalendar(strike.getYear(), + strike.getMonth(), strike.getDay()); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.MILLISECOND, 0); + long key = c.getTimeInMillis(); + Collection bin = binMap.get(key); + if (bin == null) { + bin = new ArrayList(strikes.size()); + binMap.put(key, bin); + } + bin.add(strike); + } + Collection rval = new ArrayList( + binMap.size()); + for (Entry> e : binMap + .entrySet()) { + Collection bin = e.getValue(); + BinLightningRecord record = new BinLightningRecord(bin.size()); + for (LightningStrikePoint strike : bin) { + record.addStrike(strike); + } + rval.add(record); + } + + return rval; } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/ifpnetCDF.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/ifpnetCDF.py index 05a65635e6..d7103ad820 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/ifpnetCDF.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/ifpnetCDF.py @@ -31,6 +31,7 @@ except: import NetCDF import JUtil import iscUtil +import logging from java.util import ArrayList from java.io import File @@ -72,6 +73,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization # 09/20/13 2405 dgilling Clip grids before inserting into cache. # 10/22/13 2405 rjpeter Remove WECache and store directly to cube. # 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys() +# 08/14/2014 3526 randerso Fixed to get sampling definition from appropriate site # # Original A1 BATCH WRITE COUNT was 10, we found doubling that @@ -83,7 +85,7 @@ ifpNetcdfLogger=None ## Logging methods ## def initLogger(logFile=None): global ifpNetcdfLogger - ifpNetcdfLogger = iscUtil.getLogger("ifpnetCDF",logFile) + ifpNetcdfLogger = iscUtil.getLogger("ifpnetCDF",logFile, logLevel=logging.INFO) def logEvent(*msg): ifpNetcdfLogger.info(iscUtil.tupleToString(*msg)) @@ -249,7 +251,7 @@ def timeFromComponents(timeTuple): epochDays = epochDays + daysInMonth(pmonth, timeTuple[0]) pmonth = pmonth + 1 - epochDays = epochDays + timeTuple[2] - 1; # but not this day + epochDays = epochDays + timeTuple[2] - 1 # but not this day epochTime = epochDays * 86400 + \ timeTuple[3] * 3600 + timeTuple[4] * 60 + timeTuple[5] @@ -409,7 +411,7 @@ def storeLatLonGrids(client, file, databaseID, invMask, krunch, clipArea): gridLoc = IFPServerConfigManager.getServerConfig(DatabaseID(databaseID).getSiteId()).dbDomain() pDict = gridLoc.getProjection() - latLonGrid = gridLoc.getLatLonGrid().__numpy__[0]; + latLonGrid = gridLoc.getLatLonGrid().__numpy__[0] latLonGrid = numpy.reshape(latLonGrid, (2,gridLoc.getNy().intValue(),gridLoc.getNx().intValue()), order='F') @@ -1188,11 +1190,20 @@ def compressFile(filename, factor): ###------------ # getSamplingDefinition - accesses server to retrieve definition, # returns None or the sampling definition as Python. -def getSamplingDefinition(client, configName): +def getSamplingDefinition(client, configName, siteId): if configName is None: return None - file = PathManagerFactory.getPathManager().getStaticFile("isc/utilities/" + configName + ".py") - if file is None: + pathManager = PathManagerFactory.getPathManager() + fileName = "isc/utilities/" + configName + ".py" + siteContext = pathManager.getContextForSite(LocalizationType.COMMON_STATIC, siteId) + file = pathManager.getFile(siteContext, fileName) + + # if site file not found, try base level + if file is None or not file.exists(): + baseContext = pathManager.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.BASE) + file = pathManager.getFile(baseContext, fileName) + + if file is None or not file.exists(): s = "Sampling Definition " + configName + " not found, using all grids." logProblem(s) return None @@ -1341,7 +1352,8 @@ def main(outputFilename, parmList, databaseID, startTime, #del maskGrid # Determine sampling definition - samplingDef = getSamplingDefinition(client, argDict['configFileName']) + siteId = DatabaseID(argDict['databaseID']).getSiteId() + samplingDef = getSamplingDefinition(client, argDict['configFileName'], siteId) logVerbose("Sampling Definition:", samplingDef) # Open the netCDF file @@ -1385,7 +1397,7 @@ def main(outputFilename, parmList, databaseID, startTime, argDict['krunch'], clipArea) totalGrids = totalGrids + 3 - storeGlobalAtts(file, argDict); + storeGlobalAtts(file, argDict) file.close() diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py index 847dbfb164..0902d47ef0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py @@ -90,6 +90,8 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask # 04/03/2014 2737 randerso Allow iscMosaic to blankOtherPeriods even when no grids received # 04/11/2014 17242 David Gillingham (code checked in by zhao) # 07/22/2014 17484 randerso Update cluster lock time to prevent time out +# 08/07/2014 3517 randerso Improved memory utilization and error handling when unzipping input file. +# 08/14/2014 3526 randerso Fix bug in WECache that could incorrectly delete grids in the destination database # BATCH_DELAY = 0.0 @@ -244,7 +246,7 @@ class WECache(object): If the cache does not have room for a batch of grids to be loaded without exceeding the max cache size the earliest dirty grids (or clean if not enough dirty grids are found) are flushed to disk before reading - the next dash. + the next batch. Args: tr: the missing time range @@ -274,7 +276,7 @@ class WECache(object): def __flushGrids(self, trList): """ - Flush a list time ranges from the cache. + Flush a list of time ranges from the cache. Dirty time ranges will be written to disk. Writes will be done in _batchSize groups @@ -287,10 +289,19 @@ class WECache(object): saveList = [] # python time ranges covered by this saveRequest saveSize = 0 # number of grids in saveRequest + # get full time range for flush + sortedList = sorted(trList, key=lambda t: t[0]) + flushTR = (sortedList[0][0], sortedList[-1][1]) + timeSpan = None # time span if this contiguous batch gridsToSave = ArrayList(self._batchSize) # grids in this contiguous batch saveBatch = False - for tr in sorted(trList, key=lambda t: t[0]): + for tr in self.keys(): + if tr[1] <= flushTR[0]: + continue + if tr[0] >= flushTR[1]: + break + dirty = tr in self._dirty if dirty: logger.debug("WECache storing: %s", printTR(tr)) @@ -315,6 +326,9 @@ class WECache(object): logger.debug("WECache purging: %s", printTR(tr)) self._inv[tr] = None self._populated.remove(tr) + else: + # skip any clean unpopulated grids + logger.debug("WECache skipping: %s", printTR(tr)) if saveBatch: # add this contiguous batch to saveRequest @@ -405,9 +419,9 @@ class WECache(object): self._populated.add(tr) def flush(self): - """Writes the entire contents of the WECache to HDF5/DB""" + """Writes all dirty time ranges in the WECache to HDF5/DB""" # flush entire inventory - self.__flushGrids(self.keys()) + self.__flushGrids(self._dirty) def overlaps(self, tr1, tr2): if (tr1[0] >= tr2[0] and tr1[0] < tr2[1]) or \ @@ -539,25 +553,39 @@ class IscMosaic: gzipFile = None unzippedFile = None + gzipped = True try: import gzip gzipFile = gzip.open(filename, 'rb') unzippedFile = open(filename + ".unzipped", 'w') - unzippedFile.write(gzipFile.read()) + while True: + buffer = gzipFile.read(65536) + if len(buffer) == 0: + break + unzippedFile.write(buffer) + except IOError as e: + if e.message == "Not a gzipped file": + gzipped = False + else: + raise + else: + # no errors, close and rename the file unzippedFile.close() gzipFile.close() os.rename(unzippedFile.name, gzipFile.filename) - except: - # Not gzipped + gzipFile = unzippedFile = None + finally: + # close the files in case of error if gzipFile is not None: gzipFile.close() if unzippedFile is not None: unzippedFile.close() - os.remove(unzippedFile.name) + if not gzipped: + os.remove(unzippedFile.name) a = os.times() - cpu = a[0] + a[1] - stop1 = a[4] + cpugz = a[0] + a[1] + stopgz = a[4] file = NetCDF.NetCDFFile(filename, "r") @@ -657,15 +685,15 @@ class IscMosaic: SendNotifications.send(notification) a = os.times() - cpugz = a[0] + a[1] + cpu = a[0] + a[1] stop = a[4] logger.info("Elapsed/CPU time: " "%-.2f / %-.2f decompress, " "%-.2f / %-.2f processing, " "%-.2f / %-.2f total", - stop1 - start, cpu - cpu0, - stop - stop1, cpugz - cpu, - stop - start, cpugz - cpu0) + stopgz - start, cpugz - cpu0, + stop - stopgz, cpu - cpugz, + stop - start, cpu - cpu0) def __processParm(self, parmName, vars, history, filename): @@ -1102,9 +1130,9 @@ class IscMosaic: #areaMask.setGloc(domain) - areaMask = ReferenceData(domain, ReferenceID("full"), None, CoordinateType.GRID); - areaMask.getGrid(); - areaMask.invert(); + areaMask = ReferenceData(domain, ReferenceID("full"), None, CoordinateType.GRID) + areaMask.getGrid() + areaMask.invert() elif self.__altMask is not None: try: @@ -1278,7 +1306,7 @@ class IscMosaic: else: #FIXME for i in range(0, len(history)): - hist.add(history[i]); + hist.add(history[i]) if gridType == 'SCALAR': data = Grid2DFloat.createGrid(value.shape[1], value.shape[0], value) @@ -1296,7 +1324,7 @@ class IscMosaic: keyList = ArrayList() for key in value[1]: keyList.add(WeatherKey()) - slice = WeatherGridSlice(); + slice = WeatherGridSlice() slice.setValidTime(tr) slice.setGridParmInfo(gpi) slice.setGridDataHistory(hist) @@ -1307,7 +1335,7 @@ class IscMosaic: keyList = ArrayList() for key in value[1]: keyList.add(DiscreteKey()) - slice = DiscreteGridSlice(); + slice = DiscreteGridSlice() slice.setValidTime(tr) slice.setGridParmInfo(gpi) slice.setGridDataHistory(hist) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py b/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py index 1e0996dc7b..3a60639dc0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py +++ b/edexOsgi/com.raytheon.edex.plugin.grib/GribDecoder.py @@ -49,7 +49,7 @@ from com.raytheon.uf.common.dataplugin.level import LevelFactory from com.raytheon.edex.plugin.grib.spatial import GribSpatialCache from com.raytheon.edex.util.grib import GribTableLookup -from com.raytheon.edex.util import Util +from com.raytheon.uf.common.util import GridUtil from com.raytheon.edex.util.grib import GribParamTranslator @@ -123,6 +123,8 @@ logHandler = UFStatusHandler.UFStatusHandler("com.raytheon.edex.plugin.grib", "E # grib files. # Feb 11, 2014 2765 bsteffen Better handling of probability parameters. # Apr 28, 2014 3084 bsteffen Use full grid for looking up parameter aliases. +# Aug 15, 2014 15699 MPorricelli Import GridUtil and update reference +# to GRID_FILL_VALUE # class GribDecoder(): @@ -333,7 +335,7 @@ class GribDecoder(): subGridDataArray = numpy.zeros((subny, subnx), numpy.float32) midx = nx - startx subGridDataArray[0:subny, 0:midx] = numpyDataArray[starty:endY, startx:nx] - subGridDataArray[0:subny, midx:subnx] = Util.GRID_FILL_VALUE + subGridDataArray[0:subny, midx:subnx] = GridUtil.GRID_FILL_VALUE numpyDataArray = subGridDataArray else: numpyDataArray = numpyDataArray[starty:endY, startx:endX] diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml new file mode 100644 index 0000000000..b8be73e955 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-EAST1_6KM + High Frequency Radar (EAST_6KM) total vector velocity (TVV) + Lon/Lat Resolution + + 21.73596 + 262.11615 + LowerLeft + 701 + 460 + 0.058075 + 0.05394 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml new file mode 100644 index 0000000000..5ca706b6ad --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-EAST2_6KM + High Frequency Radar (EAST_6KM) total vector velocity (TVV) + Lon/Lat Resolution + + 14.5 + 289.5 + LowerLeft + 171 + 140 + 0.05574 + 0.05394 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_DELAWARE_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_DELAWARE_1KM.xml new file mode 100644 index 0000000000..8dbab55356 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_DELAWARE_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_EAST_DELAWARE_1KM + High Frequency Radar (US_EAST_DELAWARE_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 38.007858 + 262.11615 + LowerLeft + 4205 + 222 + 0.009682 + 0.008992 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_FLORIDA_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_FLORIDA_2KM.xml new file mode 100644 index 0000000000..f9717da156 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_FLORIDA_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_EAST_FLORIDA_2KM + High Frequency Radar (US_EAST_FLORIDA_2KM) total vector + velocity (TVV) Lon/Lat Resolution + + 25.00832 + 262.11615 + LowerLeft + 2103 + 167 + 0.019356 + 0.01798 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_NORTH_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_NORTH_2KM.xml new file mode 100644 index 0000000000..996fefe182 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_NORTH_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_EAST_NORTH_2KM + High Frequency Radar (US_EAST_NORTH_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 36.012081 + 262.11615 + LowerLeft + 2103 + 222 + 0.019356 + 0.017979 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_SOUTH_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_SOUTH_2KM.xml new file mode 100644 index 0000000000..dfc2bd2f93 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_SOUTH_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_EAST_SOUTH_2KM + High Frequency Radar (US_EAST_SOUTH_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 30.00676 + 262.11615 + LowerLeft + 2103 + 223 + 0.019356 + 0.01798 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_VIRGINIA_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_VIRGINIA_1KM.xml new file mode 100644 index 0000000000..b1926c81b1 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_EAST_VIRGINIA_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_EAST_VIRGINIA_1KM + High Frequency Radar (US_EAST_VIRGINIA_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 36.506531 + 262.11615 + LowerLeft + 4205 + 111 + 0.009682 + 0.008987 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_1KM.xml new file mode 100644 index 0000000000..3a138b9e5e --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_HAWAII_1KM + High Frequency Radar (US_HAWAII_1KM) total vector velocity + (TVV) Lon/Lat Resolution + + 16.2204 + 196.855606 + LowerLeft + 1204 + 963 + 0.009293 + 0.009041 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_2KM.xml new file mode 100644 index 0000000000..d0dd615872 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_HAWAII_2KM + High Frequency Radar (US_HAWAII_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 16.2204 + 196.855606 + LowerLeft + 602 + 482 + 0.018601 + 0.01808 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_500M.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_500M.xml new file mode 100644 index 0000000000..773027179b --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_500M.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_500M + High Frequency Radar (US_WEST_500M) total vector velocity (TVV) + Lon/Lat Resolution + + 37.455486 + 237.406532 + LowerLeft + 106 + 153 + 0.005204 + 0.004494 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_CENCAL_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_CENCAL_2KM.xml new file mode 100644 index 0000000000..ec42d77332 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_CENCAL_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_CENCAL_2KM + High Frequency Radar (US_WEST_CENCAL_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 36.003601 + 229.639999 + LowerLeft + 700 + 167 + 0.020829 + 0.017979 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSANGELES_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSANGELES_1KM.xml new file mode 100644 index 0000000000..4f6ece71db --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSANGELES_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_LOSANGELES_1KM + High Frequency Radar (US_WEST_LOSANGELES_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 32.003052 + 229.639999 + LowerLeft + 1399 + 278 + 0.010407 + 0.008987 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSOSOS_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSOSOS_1KM.xml new file mode 100644 index 0000000000..d6a095d845 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_LOSOSOS_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_LOSOSOS_1KM + High Frequency Radar (US_WEST_LOSOSOS_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 34.50227 + 229.639999 + LowerLeft + 1399 + 145 + 0.010407 + 0.008991 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_NORTH_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_NORTH_2KM.xml new file mode 100644 index 0000000000..ed04516836 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_NORTH_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_NORTH_2KM + High Frequency Radar (US_WEST_NORTH_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 43.0158 + 229.639999 + LowerLeft + 700 + 361 + 0.020829 + 0.017979 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SANFRAN_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SANFRAN_1KM.xml new file mode 100644 index 0000000000..9e9339f065 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SANFRAN_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_SANFRAN_1KM + High Frequency Radar (US_WEST_SANFRAN_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 37.001492 + 229.639999 + LowerLeft + 1399 + 167 + 0.010407 + 0.008987 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SOCAL_2KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SOCAL_2KM.xml new file mode 100644 index 0000000000..7fe4e5c891 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_SOCAL_2KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_SOCAL_2KM + High Frequency Radar (US_WEST_SOCAL_2KM) total vector velocity + (TVV) Lon/Lat Resolution + + 32.012039 + 229.639999 + LowerLeft + 700 + 194 + 0.020829 + 0.017983 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_WASHINGTON_1KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_WASHINGTON_1KM.xml new file mode 100644 index 0000000000..7def25feb4 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_WEST_WASHINGTON_1KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-US_WEST_WASHINGTON_1KM + High Frequency Radar (US_WEST_WASHINGTON_1KM) total vector + velocity (TVV) Lon/Lat Resolution + + 48.005249 + 229.639999 + LowerLeft + 1399 + 222 + 0.010407 + 0.008991 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml new file mode 100644 index 0000000000..d3625d69ad --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-WEST1_6KM + High Frequency Radar (WEST_6KM) total vector velocity (TVV) + Lon/Lat Resolution + + 30.25 + 229.639999 + LowerLeft + 234 + 367 + 0.06247 + 0.05394 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml new file mode 100644 index 0000000000..f3b54b6923 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml @@ -0,0 +1,34 @@ + + + + gridHFR-WEST2_6KM + High Frequency Radar (WEST_6KM) total vector velocity (TVV) + Lon/Lat Resolution + + 16.2204 + 196.855606 + LowerLeft + 201 + 161 + 0.055801 + 0.054239 + degree + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml new file mode 100644 index 0000000000..e3083aca2e --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml @@ -0,0 +1,217 @@ + + + + + + + + + + HFR-US_EAST_FLORIDA_2KM +
9
+ 0 + gridHFR-US_EAST_FLORIDA_2KM + + 255 + +
+ + + HFR-US_WEST_CENCAL_2KM +
9
+ 0 + gridHFR-US_WEST_CENCAL_2KM + + 255 + +
+ + + HFR-US_EAST_DELAWARE_1KM +
9
+ 0 + gridHFR-US_EAST_DELAWARE_1KM + + 255 + +
+ + + HFR-US_HAWAII_1KM +
9
+ 0 + gridHFR-US_HAWAII_1KM + + 255 + +
+ + + HFR-US_WEST_500M +
9
+ 0 + gridHFR-US_WEST_500M + + 255 + +
+ + + HFR-US_WEST_NORTH_2KM +
9
+ 0 + gridHFR-US_WEST_NORTH_2KM + + 255 + +
+ + + HFR-US_WEST_LOSANGELES_1KM +
9
+ 0 + gridHFR-US_WEST_LOSANGELES_1KM + + 255 + +
+ + + HFR-US_EAST_NORTH_2KM +
9
+ 0 + gridHFR-US_EAST_NORTH_2KM + + 255 + +
+ + + HFR-US_EAST_SOUTH_2KM +
9
+ 0 + gridHFR-US_EAST_SOUTH_2KM + + 255 + +
+ + + HFR-US_EAST_VIRGINIA_1KM +
9
+ 0 + gridHFR-US_EAST_VIRGINIA_1KM + + 255 + +
+ + + HFR-US_WEST_SANFRAN_1KM +
9
+ 0 + gridHFR-US_WEST_SANFRAN_1KM + + 255 + +
+ + + HFR-EAST_6KM +
9
+ 0 + gridHFR-EAST1_6KM + + 255 + +
+ + + HFR-EAST_6KM +
9
+ 0 + gridHFR-EAST2_6KM + + 255 + +
+ + + HFR-US_HAWAII_2KM +
9
+ 0 + gridHFR-US_HAWAII_2KM + + 255 + +
+ + + HFR-WEST_6KM +
9
+ 0 + gridHFR-WEST1_6KM + + 255 + +
+ + + HFR-WEST_6KM +
9
+ 0 + gridHFR-WEST2_6KM + + 255 + +
+ + + HFR-US_WEST_WASHINGTON_1KM +
9
+ 0 + gridHFR-US_WEST_WASHINGTON_1KM + + 255 + +
+ + + HFR-US_WEST_LOSOSOS_1KM +
9
+ 0 + gridHFR-US_WEST_LOSOSOS_1KM + + 255 + +
+ + + HFR-US_WEST_SOCAL_2KM +
9
+ 0 + gridHFR-US_WEST_SOCAL_2KM + + 255 + +
+ +
diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java index 6c24d25f92..11e35245c1 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java @@ -126,6 +126,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 06/26/2014 3321 mpduff Fix ingestSwitchMap checks * 07/10/2014 3370 mpduff Fix update/insert issue for riverstatus * 07/14/2014 mpduff Fix data range checks + * 08/05/2014 15671 snaples Fixed check for posting when not found in ingestfilter and token is set for load_shef_ingest * * * @author mduff @@ -2150,7 +2151,6 @@ public class PostShef { ingestSwitchMap.put(key, ingestSwitch); } - matchFound = ingestSwitchMap.containsKey(key); ingestSwitch = ingestSwitchMap.get(key); /* diff --git a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java index 749c48426f..46d8bb05f2 100644 --- a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java +++ b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java @@ -53,9 +53,11 @@ import org.apache.http.HttpResponse; import org.apache.http.HttpResponseInterceptor; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.AuthCache; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.protocol.ClientContext; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.ConnectionPoolTimeoutException; import org.apache.http.conn.params.ConnRoutePNames; @@ -67,9 +69,12 @@ import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.entity.AbstractHttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.StringEntity; +import org.apache.http.impl.auth.BasicScheme; +import org.apache.http.impl.client.BasicAuthCache; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.http.params.HttpConnectionParams; +import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; @@ -108,6 +113,7 @@ import com.raytheon.uf.common.util.ByteArrayOutputStreamPool.ByteArrayOutputStre * Https authentication failures notify handler * Feb 17, 2014 2756 bclement added content type to response object * Feb 28, 2014 2756 bclement added isSuccess() and isNotExists() to response + * Aug 15, 2014 3524 njensen Pass auth credentials on every https request * * * @@ -415,6 +421,20 @@ public class HttpClient { private IHttpsConfiguration httpsConfiguration; + /** + * The authCache is for https requests only. Without the authCache, inside + * DefaultRequestDirector.execute() it will always attempt to connect to the + * https address without the credentials set, therefore receiving a 401 not + * authenticated, THEN apply the credentials we already validated and try + * again. ON EVERY SINGLE REQUEST. Without the authCache therefore every + * https request actually becomes two requests. + * + * There may be other ways to work around this limitation that could be + * investigated as time allows. A newer version of apache httpclient may + * also alleviate this. + */ + private AuthCache authCache; + /** * Private constructor. */ @@ -530,7 +550,11 @@ public class HttpClient { HttpResponse resp = null; if (put.getURI().getScheme().equalsIgnoreCase(HTTPS)) { org.apache.http.client.HttpClient client = getHttpsInstance(); - resp = execute(client, put); + HttpContext context = new BasicHttpContext(); + if (authCache != null) { + context.setAttribute(ClientContext.AUTH_CACHE, authCache); + } + resp = execute(client, put, context); // Check for not authorized, 401 while (resp.getStatusLine().getStatusCode() == 401) { @@ -552,8 +576,9 @@ public class HttpClient { this.setCredentials(host, port, null, credentials[0], credentials[1]); + context.setAttribute(ClientContext.AUTH_CACHE, authCache); try { - resp = execute(client, put); + resp = execute(client, put, context); } catch (Exception e) { statusHandler.handle(Priority.ERROR, "Error retrying http request", e); @@ -581,19 +606,29 @@ public class HttpClient { } /** - * Execute the HttpUriRequest using the provided HttpClient instance. + * Execute the HttpUriRequest using the provided HttpClient instance and + * context. * * @param client * The HttpClient instance * @param request * The request + * @param context + * The context + * * @return HttpResponse * @throws ClientProtocolException * @throws IOException */ private HttpResponse execute(org.apache.http.client.HttpClient client, - HttpUriRequest request) throws ClientProtocolException, IOException { - return client.execute(request); + HttpUriRequest request, HttpContext context) + throws ClientProtocolException, IOException { + /* + * The apache http client will fill in values not set on the context + * with defaults. See AbstractHttpClient line 801 where it does: + * execContext = new DefaultedHttpContext(context, defaultContext); + */ + return client.execute(request, context); } /** @@ -1222,6 +1257,10 @@ public class HttpClient { (HttpsHolder.sslClient).getCredentialsProvider().setCredentials( new AuthScope(host, port), new UsernamePasswordCredentials(username, password)); + if(this.authCache == null) { + this.authCache = new BasicAuthCache(); + } + authCache.put(new HttpHost(host, port, HTTPS), new BasicScheme()); } /** diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/styleRules/d2dContourStyleRules.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/styleRules/d2dContourStyleRules.xml index 355290ef24..8768035fc9 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/styleRules/d2dContourStyleRules.xml +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/utility/common_static/base/styleRules/d2dContourStyleRules.xml @@ -49,7 +49,7 @@ ft - 50 + 1000 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm index f61c8ee837..370ca5642e 100755 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm @@ -189,20 +189,27 @@ ${drainage.name}## ########END MACRO #macro(inserttorwatches $watches $list $secondtimezone $dateUtil $timeFormat) -#set($tornadoWatches = []) +#set($keys = []) +#set($mymap = {}) #foreach(${watch} in ${watches}) #if(${watch.getPhenSig()} == 'TO.A') -#set($success = $tornadoWatches.add($watch)) -#set($endTime = ${watch.endTime}) -#if(!$latestEndTime || ${endTime.after($latestEndTime)}) -#set($latestEndTime = ${endTime}) +#set($key = ${watch.action} + ${watch.etn} + ${watch.startTime} + ${watch.endTime}) +#if (${list.contains(${keys}, $key)}) +#set($value = ${mymap.get($key)}) +#else +#set($value = []) +#set($success = $keys.add($key)) +#end +#set($success = $value.add($watch)) +#set($success = ${mymap.put($key,$value)}) #end #end -#end -#if(!${list.isEmpty($tornadoWatches)}) - -A TORNADO WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${latestEndTime}, ${timeFormat.plain}, 15, ${localtimezone})}## -${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}## +#set($torWatchAlso = "") +#foreach(${key} in ${keys}) +#set($tornadoWatches = ${mymap.get($key)}) +#set($tornadoWatch = ${tornadoWatches.get(0)}) +A TORNADO WATCH ${torWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${tornadoWatch.endTime}, ${timeFormat.plain}, 15, ${localtimezone})}## +${dateUtil.period(${tornadoWatch.endTime},${timeFormat.plain}, 15, ${localtimezone})}## #if(${secondtimezone}) /${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/## #end @@ -218,27 +225,36 @@ ${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}## ...## #end #end +#set($torWatchAlso = "ALSO ") . ## #end - + + #end ########END MACRO #macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat) -#set($severeWatches = []) +#set($keys = []) +#set($mymap = {}) #foreach(${watch} in ${watches}) #if(${watch.getPhenSig()} == 'SV.A') -#set($success = $severeWatches.add($watch)) -#set($endTime = ${watch.endTime}) -#if(!$latestEndTime || ${endTime.after($latestEndTime)}) -#set($latestEndTime = ${endTime}) +#set($key = ${watch.action} + ${watch.etn} + ${watch.startTime} + ${watch.endTime}) +#if (${list.contains(${keys}, $key)}) +#set($value = ${mymap.get($key)}) +#else +#set($value = []) +#set($success = $keys.add($key)) +#end +#set($success = $value.add($watch)) +#set($success = ${mymap.put($key,$value)}) #end #end -#end -#if(!${list.isEmpty($severeWatches)}) - -A SEVERE THUNDERSTORM WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${latestEndTime}, ${timeFormat.plain}, 15, ${localtimezone})}## -${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}## +#set($svrWatchAlso = "") +#foreach(${key} in ${keys}) +#set($severeWatches = ${mymap.get($key)}) +#set($svrWatch = ${severeWatches.get(0)}) +A SEVERE THUNDERSTORM WATCH ${svrWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${svrWatch.endTime}, ${timeFormat.plain}, 15, ${localtimezone})}## +${dateUtil.period(${svrWatch.endTime},${timeFormat.plain}, 15, ${localtimezone})}## #if(${secondtimezone}) /${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/## #end @@ -254,11 +270,13 @@ ${dateUtil.period(${latestEndTime},${timeFormat.plain}, 15, ${localtimezone})}## ...## #end #end +#set($svrWatchAlso = "ALSO ") . ## #end + #end -########END MACRO +########END #macro(printcoords $coordinates $list) #set($count = 0) diff --git a/edexOsgi/com.raytheon.uf.tools.cli/impl/capture b/edexOsgi/com.raytheon.uf.tools.cli/impl/capture index 24aafc8f9a..86eb9fdeab 100644 --- a/edexOsgi/com.raytheon.uf.tools.cli/impl/capture +++ b/edexOsgi/com.raytheon.uf.tools.cli/impl/capture @@ -343,13 +343,13 @@ runJmap() { fi local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}" - echo "${t1}: Running command: $cmd $options $pid >> $log 2>&1 &" >> $processFile - $cmd $options $pid >> $log 2>&1 & + echo "${t1}: Running command: $cmd $options $pid >> $log 2>&1" >> $processFile + $cmd $options $pid >> $log 2>&1 if [[ "$?" != "0" && $FORCE != "y" ]]; then t1=`date "+%Y%m%d %H:%M:%S"` echo "${t1}: jmap for $pid failed to connect, rerunning with -F" >> $processFile - $cmd $options -F $pid >> $log 2>&1 & + $cmd $options -F $pid >> $log 2>&1 fi } diff --git a/javaUtilities/yajsw-scripts/wrapperCapture.sh b/javaUtilities/yajsw-scripts/wrapperCapture.sh new file mode 100755 index 0000000000..7bf295aebc --- /dev/null +++ b/javaUtilities/yajsw-scripts/wrapperCapture.sh @@ -0,0 +1,180 @@ +#!/bin/sh +##################################################################### +# 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. +##################################################################### +##################################################################### +# Script for capturing data from a wrapper java process when the +# wrapper restarts the process +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------- -------- ----------- -------------------------- +# Aug 07, 2014 3470 rjpeter Initial creation +# +##################################################################### +# NOTE: Script must be located at /awips2/qpid/bin/yajsw/scripts for it to work + +# base path to save capture data to, will create subdirectory for each server +basePath="/data/fxa/cave" + +state=$1 +string_state=$2 +pid=$4 + +path_to_script=`readlink -f $0` +curTime=`date +%Y%m%d_%H%M%S` +echo "$curTime: Wrapper running $path_to_script due to state transition for pid $pid. New State $state|$string_state" + +# ensure directory is created and has write permissions +checkDir() { + dir="$1" + if [ ! -d "$dir" ]; then + mkdir -p $dir + if [ ! -d "$dir" ]; then + message="Unable to create qpid capture data directory\n$dir" + echo -e "Capture failed: $message" + exit 1 + fi + fi + + if [ ! -w "$dir" ]; then + message="Do not have write permissions to qpid capture data directory\n$dir" + echo -e "Capture failed: $message" + exit 1 + fi +} + +# gets top output of local server +runTop() { + local curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "$curTime: Capturing top" + echo "$curTime: Capturing top" >> $processFile + local out_file="${dataPath}/top.log" + export COLUMNS=160 + top -b -c -n1 >> $out_file 2>&1 + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: top captured" +} + +# runs jstack 10 times, if it fails will run again with -F +runJstack() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jstacks" + local pid="$1" + local count=1 + local cmd="/awips2/java/bin/jstack" + local prePath="${dataPath}/pid_${pid}_" + local log="" + + while [ "$count" -le "10" ]; do + curTime=`date "+%Y%m%d_%H:%M:%S"` + log="${prePath}jstack_${count}.log" + + echo "${curTime}: Running command: ${cmd} ${pid} >> ${log} 2>&1" >> $processFile + echo "Running for $curTime" >> $log + ${cmd} ${pid} >> ${log} 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jstack for $pid failed to connect, rerunning with -F" >> $processFile + ${cmd} -F ${pid} >> ${log} 2>&1 + fi + let "count+=1" + done + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jstacks captured" +} + +# runs jmap -heap +runJmapHeap() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jmap -heap" + local pid=$1 + local prePath="${dataPath}/pid_${pid}_" + + local log="${prePath}jmapHeap.log" + local cmd="/awips2/java/bin/jmap -heap" + echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile + $cmd $pid >> $log 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile + $cmd -F $pid >> $log 2>&1 + fi + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jmap -heap captured" +} + +# runs jmap, if it fails will run again with -F +runJmap() { + local curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Capturing jmap -dump" + local pid=$1 + local prePath="${dataPath}/pid_${pid}_jmap" + + local log="${prePath}.log" + local dumpPath="${prePath}.hprof" + local cmd="/awips2/java/bin/jmap -dump:format=b,file=${dumpPath}" + echo "${curTime}: Running command: $cmd $pid >> $log 2>&1" >> $processFile + $cmd $pid >> $log 2>&1 + + if [[ "$?" != "0" && $FORCE != "y" ]]; then + curTime=`date "+%Y%m%d_%H:%M:%S"` + echo "${curTime}: jmap for $pid failed to connect, rerunning with -F" >> $processFile + $cmd -F $pid >> $log 2>&1 + fi + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: jmap -dump captured" +} + + + +if [[ "$pid" != "-1" ]]; then + process=`ps -ef | grep $pid | grep java` + + if [[ "$process" != "" ]]; then + hostName=`hostname -s` + dataPath="${basePath}/${hostName}/wrapperCaptureData_${curTime}_pid_$pid" + checkDir $dataPath + processFile=${dataPath}/capture_info.log + echo "Wrapper running $0 due to state transition for pid $pid. New State $state|$string_state" >> $processFile + echo "Process information:" >> $processFile + ps -ef | grep $pid >> $processFile + runTop & + runJstack $pid & + runJmapHeap $pid & + # TODO: Double check if jvm already dumped one + runJmap $pid & + wait + + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: Data captured to $dataPath" + else + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: PID $pid is no longer running, nothing to capture" + fi +else + curTime=`date +%Y%m%d_%H%M%S` + echo "$curTime: PID was -1, process no longer running, nothing to capture" +fi diff --git a/javaUtilities/yajsw/deploy.xml b/javaUtilities/yajsw/deploy.xml index 9b013eaf74..da2ae33587 100644 --- a/javaUtilities/yajsw/deploy.xml +++ b/javaUtilities/yajsw/deploy.xml @@ -3,6 +3,10 @@ determine where the various destination directories are without ant-contrib --> + + + + + + + + + + + (), new DaemonThreadFactory("scriptExecutorInternal")); + static final ExecutorService EXECUTOR = (ThreadPoolExecutor) new ThreadPoolExecutor( + 0, 50, 120L, TimeUnit.SECONDS, new SynchronousQueue(), + new DaemonThreadFactory("scriptExecutorInternal")); volatile Future _future; volatile Timeout _timerTimeout; - - /** * Instantiates a new abstract script. * @@ -58,8 +57,8 @@ public abstract class AbstractScript implements Script * the script * @param timeout */ - public AbstractScript(String script, String id, WrappedProcess process, String[] args, int timeout) - { + public AbstractScript(String script, String id, WrappedProcess process, + String[] args, int timeout) { _name = script; _process = process; _id = id; @@ -76,41 +75,35 @@ public abstract class AbstractScript implements Script * java.lang.String, java.lang.Object) */ public abstract Object execute(String line); + public abstract void interrupt(); + abstract void log(String msg); - synchronized public void executeWithTimeout(final String line) - { - Object result = null; - _timerTimeout = TIMER.newTimeout(new TimerTask() - { - - public void run(Timeout arg0) throws Exception - { - log("script takes too long -> interrupt"); - try - { - interrupt(); - } - catch (Throwable e) - { - - } + synchronized public void executeWithTimeout(final String line) { + /** + * Changed by rjpeter Aug 07, 2014. + */ + _future = EXECUTOR.submit(new Callable() { + @Override + public Object call() { + return execute(line); } - + }); + + // wait for script to finish + try { + _future.get(_timeout, TimeUnit.MILLISECONDS); + } catch (TimeoutException e) { + log("script " + _name + " took too long -> interrupt"); + try { + interrupt(); + } catch (Throwable e1) { + + } + } catch (Exception e) { + } - , _timeout, TimeUnit.MILLISECONDS); - _future = EXECUTOR.submit(new Callable() - { - public Object call() - { - Object result = execute(line); - if (_timerTimeout != null) - _timerTimeout.cancel(); - _timerTimeout = null; - return result; - } - }); } /* @@ -118,8 +111,7 @@ public abstract class AbstractScript implements Script * * @see org.rzo.yajsw.script.Script#getScript() */ - public String getScript() - { + public String getScript() { return _name; } @@ -128,8 +120,7 @@ public abstract class AbstractScript implements Script * * @return the timeout */ - public int getTimeout() - { + public int getTimeout() { return _timeout; } @@ -139,8 +130,7 @@ public abstract class AbstractScript implements Script * @param timeout * the new timeout */ - public void setTimeout(int timeout) - { + public void setTimeout(int timeout) { _timeout = timeout; } diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/script/ShellScript.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/script/ShellScript.java index 4cab0a5210..8e1b699312 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/script/ShellScript.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/script/ShellScript.java @@ -76,8 +76,10 @@ public class ShellScript extends AbstractScript public void executeWithTimeout() { - // TODO Auto-generated method stub - + /* + * Updated by bkowal 08/06/2014 + */ + this.executeWithTimeout(""); } @Override diff --git a/ldm/src/pqact/pqact.c b/ldm/src/pqact/pqact.c index 3936f07e69..3b0378bd5d 100644 --- a/ldm/src/pqact/pqact.c +++ b/ldm/src/pqact/pqact.c @@ -6,6 +6,9 @@ /* * ldm server mainline program module + * + * Updated on: Aug 05, 2014 (Omaha #3458: Increased edexBridge queue size to 10000) + * Author: rjpeter */ #include @@ -251,7 +254,7 @@ main(int ac, char *av[]) prod_class_t clss; int toffset = TOFFSET_NONE; int loggingToStdErr = 0; - unsigned queue_size = 5000; + unsigned queue_size = 10000; conffilename = DEFAULT_CONFFILENAME; diff --git a/nativeLib/edexBridge/edexBridge.cpp b/nativeLib/edexBridge/edexBridge.cpp index 37c6c97036..3c79ca5af2 100644 --- a/nativeLib/edexBridge/edexBridge.cpp +++ b/nativeLib/edexBridge/edexBridge.cpp @@ -7,6 +7,8 @@ * Author: bkowal * Updated on: May 06, 2014 (Issue #3102: Updated to call cleanup if connect failed. Limit number of messages to be sent to QPID on a single send call) * Author: rjpeter + * Updated on: Aug 05, 2014 (Omaha #3458: Added logging of error when issue occurs on send) + * Author: rjpeter */ #include @@ -116,6 +118,7 @@ public: } } catch (const std::exception& error) { // Error occurred during communication. Clean up the connection and return the number of messages processed. + uerror(error.what()); cleanup(); } diff --git a/nativeLib/rary.cots.g2clib/drstemplates.h b/nativeLib/rary.cots.g2clib/drstemplates.h old mode 100755 new mode 100644 index 5e4c7331a3..b94650eb68 --- a/nativeLib/rary.cots.g2clib/drstemplates.h +++ b/nativeLib/rary.cots.g2clib/drstemplates.h @@ -3,6 +3,7 @@ #include "grib2.h" // PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-10-26 +// 2014-07-30 vkorolev Added template 5.4 // // ABSTRACT: This Fortran Module contains info on all the available // GRIB2 Data Representation Templates used in Section 5 (DRS). @@ -31,7 +32,7 @@ // /////////////////////////////////////////////////////////////////////// - #define MAXDRSTEMP 9 // maximum number of templates + #define MAXDRSTEMP 10 // maximum number of templates #define MAXDRSMAPLEN 200 // maximum template map length struct drstemplate @@ -49,6 +50,8 @@ { 2, 16, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1} }, // 5.3: Grid point data - Complex Packing and spatial differencing { 3, 18, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1,1,1} }, + // 5.4: Grid Point Data - IEEE Floating Point Data + { 4, 1, 0, {1} }, // 5.50: Spectral Data - Simple Packing { 50, 5, 0, {4,-2,-2,1,4} }, // 5.51: Spherical Harmonics data - Complex packing diff --git a/nativeLib/rary.cots.g2clib/g2_unpack7.c b/nativeLib/rary.cots.g2clib/g2_unpack7.c old mode 100755 new mode 100644 index 372fea2fd5..d694c1e91c --- a/nativeLib/rary.cots.g2clib/g2_unpack7.c +++ b/nativeLib/rary.cots.g2clib/g2_unpack7.c @@ -34,6 +34,7 @@ g2int g2_unpack7(unsigned char *cgrib,g2int *iofst,g2int igdsnum,g2int *igdstmpl // PNG now allowed to use WMO Template no. 5.41 // 2004-12-16 Taylor - Added check on comunpack return code. // 2008-12-23 Wesley - Initialize Number of data points unpacked +// 2014-07-29 vkorolev - Added processing Template no. 5.4 // // USAGE: int g2_unpack7(unsigned char *cgrib,g2int *iofst,g2int igdsnum, // g2int *igdstmpl, g2int idrsnum, @@ -81,6 +82,9 @@ g2int g2_unpack7(unsigned char *cgrib,g2int *iofst,g2int igdsnum,g2int *igdstmpl g2int ierr,isecnum; g2int ipos,lensec; g2float *lfld; + g2int *ifld; + + ierr=0; *fld=0; //NULL @@ -98,6 +102,7 @@ g2int g2_unpack7(unsigned char *cgrib,g2int *iofst,g2int igdsnum,g2int *igdstmpl ipos=(*iofst/8); lfld=(g2float *)calloc(ndpts ? ndpts : 1,sizeof(g2float)); + if (lfld == 0) { ierr=6; return(ierr); @@ -113,6 +118,18 @@ g2int g2_unpack7(unsigned char *cgrib,g2int *iofst,g2int igdsnum,g2int *igdstmpl return 7; } } + else if(idrsnum == 4) { + ifld=(g2int *)calloc(ndpts ? ndpts : 1, sizeof(g2int)); + if(ifld != 0){ + gbits(cgrib+ipos,ifld,0,32,0,ndpts); + rdieee(ifld,*fld,ndpts); + free(ifld); + } + else { + ierr=6; + return(ierr); + } + } else if (idrsnum == 50) { // Spectral Simple simunpack(cgrib+ipos,idrstmpl,ndpts-1,lfld+1); rdieee(idrstmpl+4,lfld+0,1); diff --git a/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz b/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz index ffd6e85a19..e99b68ab4a 100755 Binary files a/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz and b/rpms/awips2.core/Installer.ldm/src/ldm-6.11.5.tar.gz differ diff --git a/rpms/awips2.core/Installer.python/component.spec b/rpms/awips2.core/Installer.python/component.spec index c4d4b4655f..bb782c87f7 100644 --- a/rpms/awips2.core/Installer.python/component.spec +++ b/rpms/awips2.core/Installer.python/component.spec @@ -9,7 +9,7 @@ Name: awips2-python Summary: AWIPS II Python Distribution Version: 2.7.1 -Release: 10.el6 +Release: 11.el6 Group: AWIPSII BuildRoot: %{_build_root} BuildArch: %{_build_arch} diff --git a/rpms/awips2.core/Installer.python/nativeLib/x86_64/grib2.so b/rpms/awips2.core/Installer.python/nativeLib/x86_64/grib2.so index b8d34088c4..5a7146d85c 100755 Binary files a/rpms/awips2.core/Installer.python/nativeLib/x86_64/grib2.so and b/rpms/awips2.core/Installer.python/nativeLib/x86_64/grib2.so differ diff --git a/rpms/awips2.qpid/0.18/SOURCES/awips2/slf4j-log4j12-1.7.5.jar b/rpms/awips2.qpid/0.18/SOURCES/awips2/slf4j-log4j12-1.7.5.jar new file mode 100644 index 0000000000..afce5c21f1 Binary files /dev/null and b/rpms/awips2.qpid/0.18/SOURCES/awips2/slf4j-log4j12-1.7.5.jar differ diff --git a/rpms/awips2.qpid/0.18/SOURCES/wrapper.conf b/rpms/awips2.qpid/0.18/SOURCES/wrapper.conf index cc20ad535f..55b2f065cb 100644 --- a/rpms/awips2.qpid/0.18/SOURCES/wrapper.conf +++ b/rpms/awips2.qpid/0.18/SOURCES/wrapper.conf @@ -70,7 +70,14 @@ wrapper.java.additional.7=-Dqpid.broker.exceptionHandler.continue=true # Maximum Java Heap Size (in MB) wrapper.java.maxmemory=1536 -wrapper.ping.timeout=300 +wrapper.ping.interval=5 +wrapper.ping.timeout=30 + +# NOTE: script must be located at /awips2/qpid/bin/yajsw/scripts for it to be found +wrapper.script.ABORT=wrapperCapture.sh +wrapper.script.ABORT.timeout=120 +wrapper.script.RESTART=wrapperCapture.sh +wrapper.script.RESTART.timeout=120 #******************************************************************** # Monitor the Application diff --git a/rpms/awips2.qpid/0.18/SOURCES/yajsw-distribution.tar b/rpms/awips2.qpid/0.18/SOURCES/yajsw-distribution.tar index 6836495dee..6cb101c956 100644 Binary files a/rpms/awips2.qpid/0.18/SOURCES/yajsw-distribution.tar and b/rpms/awips2.qpid/0.18/SOURCES/yajsw-distribution.tar differ diff --git a/rpms/awips2.qpid/0.18/SPECS/qpid-java.spec.patch0 b/rpms/awips2.qpid/0.18/SPECS/qpid-java.spec.patch0 index 22e0a772c4..2353119583 100644 --- a/rpms/awips2.qpid/0.18/SPECS/qpid-java.spec.patch0 +++ b/rpms/awips2.qpid/0.18/SPECS/qpid-java.spec.patch0 @@ -14,7 +14,7 @@ diff -crB a/qpid-java.spec b/qpid-java.spec ! ! Name: awips2-qpid-java Version: 0.18 -! Release: 4%{?dist} +! Release: 5%{?dist} Summary: Java implementation of Apache Qpid License: Apache Software License Group: Development/Java