Merge branch 'sync_test' (VCModules) into ss_sync
Former-commit-id: e68338cecbe85a62835633e9aba0925344fb80f1
This commit is contained in:
commit
70357d90bc
28 changed files with 937 additions and 359 deletions
|
@ -1,81 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 5, 2011 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ISCParmInitJob extends Job {
|
||||
|
||||
private DataManager dataMgr;
|
||||
|
||||
private List<Parm> parms;
|
||||
|
||||
public ISCParmInitJob(DataManager dataMgr, Parm[] parmList) {
|
||||
super("GFE ISC Parm initialization");
|
||||
setSystem(true);
|
||||
this.dataMgr = dataMgr;
|
||||
this.parms = Arrays.asList(parmList);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
|
||||
* IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
IISCDataAccess iscAccess = dataMgr.getIscDataAccess();
|
||||
for (Parm parm : parms) {
|
||||
if (!monitor.isCanceled()) {
|
||||
iscAccess.getISCParm(parm);
|
||||
} else {
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
|
@ -62,7 +62,6 @@ import com.raytheon.viz.gfe.GFEServerException;
|
|||
import com.raytheon.viz.gfe.PythonPreferenceStore;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.IParmManager;
|
||||
import com.raytheon.viz.gfe.core.ISCParmInitJob;
|
||||
import com.raytheon.viz.gfe.core.internal.NotificationRouter.AbstractGFENotificationObserver;
|
||||
import com.raytheon.viz.gfe.core.msgs.IAvailableSourcesChangedListener;
|
||||
import com.raytheon.viz.gfe.core.msgs.IDisplayedParmListChangedListener;
|
||||
|
@ -85,6 +84,14 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/26/2008 chammack Split non-mock code from MockParmManager
|
||||
* 02/23/2012 #346 dgilling Dispose of VCParms from this class's
|
||||
* dispose method.
|
||||
* 02/23/2012 #346 dgilling Ensure all Parms are disposed when calling
|
||||
* dispose method.
|
||||
* 03/01/2012 #346 dgilling Use identity-based ListenerLists.
|
||||
* 03/01/2012 #354 dgilling Modify setParms to always load (but not
|
||||
* necessarily display) the ISC parms that
|
||||
* correspond to a visible mutable parm.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -235,19 +242,19 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
|
||||
private AbstractGFENotificationObserver<SiteActivationNotification> siteActivationListener;
|
||||
|
||||
private ISCParmInitJob iscInit;
|
||||
|
||||
private JobPool notificationPool;
|
||||
|
||||
protected AbstractParmManager(final DataManager dataManager) {
|
||||
this.dataManager = dataManager;
|
||||
this.parms = new RWLArrayList<Parm>();
|
||||
this.displayedParmListListeners = new ListenerList();
|
||||
this.parmListChangedListeners = new ListenerList();
|
||||
this.systemTimeRangeChangedListeners = new ListenerList();
|
||||
this.availableSourcesListeners = new ListenerList();
|
||||
this.newModelListeners = new ListenerList();
|
||||
this.parmIdChangedListeners = new ListenerList();
|
||||
this.displayedParmListListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.parmListChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.systemTimeRangeChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.availableSourcesListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.newModelListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.parmIdChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
|
||||
// Get virtual parm definitions
|
||||
vcModules = initVirtualCalcParmDefinitions();
|
||||
|
@ -397,12 +404,17 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
dataManager.getNotificationRouter().removeObserver(
|
||||
this.siteActivationListener);
|
||||
|
||||
for (VCModule module : vcModules) {
|
||||
module.dispose();
|
||||
parms.acquireReadLock();
|
||||
try {
|
||||
for (Parm p : parms) {
|
||||
p.dispose();
|
||||
}
|
||||
} finally {
|
||||
parms.releaseReadLock();
|
||||
}
|
||||
|
||||
if (iscInit != null) {
|
||||
iscInit.cancel();
|
||||
for (VCModule module : vcModules) {
|
||||
module.dispose();
|
||||
}
|
||||
|
||||
notificationPool.cancel();
|
||||
|
@ -760,15 +772,46 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
return ret;
|
||||
}
|
||||
|
||||
// -- private
|
||||
// ----------------------------------------------------------------
|
||||
// ParmMgr::setParmsDependencies()
|
||||
// Helper function for setParms(). Takes the toBeLoaded, addedParms,
|
||||
// removeParms, and modParms lists, calculates dependencies, and then
|
||||
// returns the updated lists through the calling arguments.
|
||||
// -- implementation
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
/**
|
||||
* Helper function for <code>setParms</code>. Takes the toBeLoaded and
|
||||
* removeParms lists, calculates non-visible ISC dependencies, and then
|
||||
* returns the updated lists through the calling arguments.
|
||||
*
|
||||
* @param toBeLoaded
|
||||
* @param removeParms
|
||||
*/
|
||||
private void setParmsRemoveISCDeps(List<ParmIDVisDep> toBeLoaded,
|
||||
Collection<ParmID> removeParms) {
|
||||
List<ParmID> removeList = new ArrayList<ParmID>(removeParms);
|
||||
|
||||
for (int i = 0; i < removeList.size(); i++) {
|
||||
List<ParmID> depParms = dependentParms(removeList.get(i), true);
|
||||
for (ParmID pid : depParms) {
|
||||
int index = pivdIndex(toBeLoaded, pid);
|
||||
if ((index != -1) && (!toBeLoaded.get(index).isVisible())) {
|
||||
removeList.add(toBeLoaded.get(index).getParmID());
|
||||
toBeLoaded.remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ParmID pid : removeList) {
|
||||
if (!removeParms.contains(pid)) {
|
||||
removeParms.add(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for <code>setParms</code>. Takes the toBeLoaded,
|
||||
* addedParms, removeParms, and modParms lists, calculates dependencies, and
|
||||
* then returns the updated lists through the calling arguments.
|
||||
*
|
||||
* @param toBeLoaded
|
||||
* @param addParms
|
||||
* @param removeParms
|
||||
* @param modParms
|
||||
*/
|
||||
private void setParmsDependencies(List<ParmIDVisDep> toBeLoaded,
|
||||
Collection<ParmIDVis> addParms, Collection<ParmID> removeParms,
|
||||
Collection<Parm> modParms) {
|
||||
|
@ -777,8 +820,13 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
// non-displayed. If any are missing from the "tobeloaded", then
|
||||
// add them as undisplayed.
|
||||
for (int i = 0; i < toBeLoaded.size(); i++) {
|
||||
// Here's a derivation from AWIPS1...
|
||||
// We've hard-coded the third parameter in the dependentParms() call
|
||||
// to true so that the ISC parms that correspond to the visible
|
||||
// mutable parms are always loaded in the ParmManager. This was
|
||||
// found to significantly improve performance when loading ISC data.
|
||||
List<ParmID> depParms = dependentParms(toBeLoaded.get(i)
|
||||
.getParmID(), iscMode());
|
||||
.getParmID(), true);
|
||||
|
||||
for (ParmID depParm : depParms) {
|
||||
// if not present, then add it to "tobeloaded" list
|
||||
|
@ -918,6 +966,16 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
toBeLoaded = setParmsMakeParmIDVisDep(addParms, modParms,
|
||||
removeParms);
|
||||
|
||||
// Here's a derivation from AWIPS1...
|
||||
// We've modified setParmsDependencies to always ensure that the ISC
|
||||
// parms that correspond to parms from the mutable database are
|
||||
// always loaded (but not necessary visible) in the ParmManager.
|
||||
// However, this change made it impossible to unload parms if they
|
||||
// were a dependency to an invisible VCParm. Hence, this new
|
||||
// function was added which removes the mutable parm and the ISC
|
||||
// parm(s) if none of them should be visible.
|
||||
setParmsRemoveISCDeps(toBeLoaded, removeParms);
|
||||
|
||||
// statusHandler.debug("PASS " + (i + 1)
|
||||
// + " toBeLoaded before dependencies="
|
||||
// + toBeLoaded.toString());
|
||||
|
@ -1148,12 +1206,6 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
}
|
||||
setParms(addParms, deletions);
|
||||
|
||||
if (iscInit != null) {
|
||||
iscInit.cancel();
|
||||
}
|
||||
iscInit = new ISCParmInitJob(dataManager, getDisplayedParms());
|
||||
iscInit.schedule();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1223,7 @@ public abstract class AbstractParmManager implements IParmManager {
|
|||
Collection<Parm> modParms, Collection<ParmID> removeParms) {
|
||||
// only try to unload old undisplayed, if there are already parms
|
||||
// being removed.
|
||||
if (removeParms.size() == 0) {
|
||||
if (removeParms.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,11 @@ import com.raytheon.viz.gfe.Activator;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 11, 2008 chammack Initial creation
|
||||
* Sep 3, 2008 1448 chammack Implement refactored interface
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 11, 2008 chammack Initial creation
|
||||
* Sep 03, 2008 1448 chammack Implement refactored interface
|
||||
* Mar 01, 2012 #346 dgilling Use identity-based ListenerLists.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -68,7 +69,7 @@ public class NotificationRouter implements INotificationObserver {
|
|||
*/
|
||||
public NotificationRouter(String siteID) {
|
||||
this.siteID = siteID;
|
||||
this.observers = new ListenerList();
|
||||
this.observers = new ListenerList(ListenerList.IDENTITY);
|
||||
this.observers
|
||||
.add(new AbstractGFENotificationObserver<UserMessageNotification>(
|
||||
UserMessageNotification.class) {
|
||||
|
@ -178,6 +179,7 @@ public class NotificationRouter implements INotificationObserver {
|
|||
/**
|
||||
* Notification that a message has arrived
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
// If DataManager is not initialized yet, do not start listening
|
||||
|
|
|
@ -51,9 +51,9 @@ import com.raytheon.viz.gfe.core.DataManager;
|
|||
import com.raytheon.viz.gfe.core.parm.DbParm;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
|
||||
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
||||
import com.raytheon.viz.gfe.core.parm.VCParm;
|
||||
import com.raytheon.viz.gfe.core.parm.VParm;
|
||||
import com.raytheon.viz.gfe.core.parm.vcparm.VCModule;
|
||||
import com.raytheon.viz.gfe.types.MutableInteger;
|
||||
|
||||
/**
|
||||
|
@ -69,6 +69,8 @@ import com.raytheon.viz.gfe.types.MutableInteger;
|
|||
* 05/19/08 #875 bphillip Implemented save forecast for vectors
|
||||
* 06/17/08 #940 bphillip Implemented GFE Locking
|
||||
* 08/19/09 2547 rjpeter Implement Test/Prac database display.
|
||||
* 02/23/12 #346 dgilling Call Parm's dispose method when removing
|
||||
* a Parm.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -529,6 +531,7 @@ public class ParmManager extends AbstractParmManager {
|
|||
return mutableDb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseID getOrigMutableDatabase() {
|
||||
return origMutableDb;
|
||||
}
|
||||
|
@ -766,6 +769,11 @@ public class ParmManager extends AbstractParmManager {
|
|||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
// dispose the old parms
|
||||
for (Parm p : removeParms) {
|
||||
p.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateParmIdCache(final Collection<DatabaseID> removedDbs,
|
||||
|
@ -1197,6 +1205,7 @@ public class ParmManager extends AbstractParmManager {
|
|||
return new ArrayList<DatabaseID>(iscDbs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParmID getISCParmID(ParmID pid) {
|
||||
List<DatabaseID> iscDbs = getIscDatabases();
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
|
|||
* 06/17/08 #940 bphillip Implemented GFE Locking
|
||||
* 01/29/08 #1271 njensen Rewrote populateGridFromData()
|
||||
* to use IFPClient
|
||||
* 02/23/12 #346 dgilling Implement a dispose method.
|
||||
* 03/01/12 #346 dgilling Re-order dispose method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -114,6 +116,17 @@ public class DbParm extends Parm {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.core.parm.Parm#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
looseLocks();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// -- private
|
||||
// ----------------------------------------------------------------
|
||||
// DbParm::getGridsFromDb()
|
||||
|
|
|
@ -171,6 +171,11 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 12Sep2008 #1332 wdougherty Added deleteLockedTR() for editing hazards.
|
||||
* 04/16/2009 #2262 rjpeter Updated pencilStretch to return Grid2DBit.
|
||||
* 06/08/2009 #2159 rjpeter Fixed undo.
|
||||
* 02/23/2012 #346 dgilling Implement a dispose method to mimic
|
||||
* AWIPS1 use of C++ destructor.
|
||||
* 03/02/2012 #346 dgilling Create a disposed flag to help ensure
|
||||
* no interaction with Parms after dispose
|
||||
* is called.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -213,6 +218,8 @@ public abstract class Parm implements Comparable<Parm> {
|
|||
|
||||
protected String officeType;
|
||||
|
||||
protected boolean disposed;
|
||||
|
||||
/**
|
||||
* The create from scratch mode
|
||||
*/
|
||||
|
@ -347,6 +354,42 @@ public abstract class Parm implements Comparable<Parm> {
|
|||
this.officeType = dataManager.getOfficeType();
|
||||
}
|
||||
|
||||
this.disposed = false;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
synchronized (this) {
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
if (isModified()) {
|
||||
statusHandler.warn("Destroying parm " + getParmID().toString()
|
||||
+ " with modified data.");
|
||||
}
|
||||
|
||||
if (dataManager.getParmOp() != null) {
|
||||
dataManager.getParmOp().clearUndoParmList(this);
|
||||
}
|
||||
|
||||
// cleanup interpolator stuff
|
||||
finishInterpolation(true);
|
||||
|
||||
// Once this is done we had better not talk to any of the parm clients
|
||||
// again...
|
||||
parmListeners.clearParmListeners();
|
||||
|
||||
// Remove the undo grids
|
||||
purgeUndoGrids();
|
||||
|
||||
// remove all grids
|
||||
grids.acquireWriteLock();
|
||||
try {
|
||||
grids.clear();
|
||||
} finally {
|
||||
grids.releaseWriteLock();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,11 +50,13 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 13, 2008 chammack Initial creation
|
||||
* Sep 01, 2009 #2788 randerso Changed listener lists to sets to prevent
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 13, 2008 chammack Initial creation
|
||||
* Sep 01, 2009 #2788 randerso Changed listener lists to sets to prevent
|
||||
* multiple registration
|
||||
* Feb 23, 2012 #346 dgilling Implement clearParmListeners.
|
||||
* Mar 01, 2012 #346 dgilling Use identity-based ListenerLists.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,19 +89,39 @@ public class ParmListeners {
|
|||
private final JobPool notificationPool;
|
||||
|
||||
protected ParmListeners(JobPool pool) {
|
||||
this.gridChangedListeners = new ListenerList();
|
||||
this.parmInventoryChangedListeners = new ListenerList();
|
||||
this.parmIDChangedListeners = new ListenerList();
|
||||
this.selectionTimeRangeChangedListeners = new ListenerList();
|
||||
this.parameterSelectionChangedListeners = new ListenerList();
|
||||
this.combineModeChangedListeners = new ListenerList();
|
||||
this.vectorModeChangedListeners = new ListenerList();
|
||||
this.pickupValueChangedListeners = new ListenerList();
|
||||
this.colorTableModifiedListeners = new ListenerList();
|
||||
this.lockTableChangedListeners = new ListenerList();
|
||||
this.gridChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.parmInventoryChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.parmIDChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.selectionTimeRangeChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.parameterSelectionChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.combineModeChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.vectorModeChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.pickupValueChangedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.colorTableModifiedListeners = new ListenerList(
|
||||
ListenerList.IDENTITY);
|
||||
this.lockTableChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
this.notificationPool = pool;
|
||||
}
|
||||
|
||||
protected void clearParmListeners() {
|
||||
this.gridChangedListeners.clear();
|
||||
this.parmInventoryChangedListeners.clear();
|
||||
this.parmIDChangedListeners.clear();
|
||||
this.selectionTimeRangeChangedListeners.clear();
|
||||
this.parameterSelectionChangedListeners.clear();
|
||||
this.combineModeChangedListeners.clear();
|
||||
this.vectorModeChangedListeners.clear();
|
||||
this.pickupValueChangedListeners.clear();
|
||||
this.colorTableModifiedListeners.clear();
|
||||
this.lockTableChangedListeners.clear();
|
||||
}
|
||||
|
||||
public void fireGridChangedListener(final ParmID parmID,
|
||||
final TimeRange validTime) {
|
||||
for (Object listener : this.gridChangedListeners.getListeners()) {
|
||||
|
|
|
@ -77,7 +77,9 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 04/04/2008 1066 Dan Fitch Initial Creation
|
||||
* 11/11/2008 1666 njensen Added procedure cmds
|
||||
* 06/24/09 1876 njensen Publish updates inventory
|
||||
* 06/24/2009 1876 njensen Publish updates inventory
|
||||
* 02/23/2012 1876 dgilling Implement missing clearUndoParmList
|
||||
* function.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -109,6 +111,16 @@ public class ParmOp {
|
|||
this.dataManager = dataManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a parm from the list that can be undone.
|
||||
*
|
||||
* @param p
|
||||
* <code>Parm</code> to remove from the undo list.
|
||||
*/
|
||||
public void clearUndoParmList(Parm p) {
|
||||
undoParmList.remove(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the undo parm list. This is normally commanded by the edit tools
|
||||
* prior to an edit operation.
|
||||
|
|
|
@ -23,9 +23,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
||||
|
@ -38,6 +36,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.util.RWLArrayList;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.griddata.AbstractGridData;
|
||||
import com.raytheon.viz.gfe.core.griddata.IGridData;
|
||||
|
@ -59,6 +58,15 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule.VCInventory;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 17, 2011 dgilling Initial creation
|
||||
* Feb 22, 2012 #346 dgilling Convert registeredParms to
|
||||
* RWLArrayList to improve thread
|
||||
* safety and fix disappearing ISC
|
||||
* data. Also, remove overridden
|
||||
* finalize function.
|
||||
* Feb 23, 2012 #346 dgilling Implement a dispose method.
|
||||
* Mar 02, 2012 #346 dgilling Use Parm's new disposed flag to
|
||||
* prevent leaks through
|
||||
* ListenerLists.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -74,7 +82,7 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
|
||||
private VCModule mod;
|
||||
|
||||
private Set<Parm> registeredParms = new HashSet<Parm>();
|
||||
private RWLArrayList<Parm> registeredParms = new RWLArrayList<Parm>();
|
||||
|
||||
private List<VCInventory> vcInventory;
|
||||
|
||||
|
@ -111,18 +119,9 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
dataMgr.getParmManager().addParmListChangedListener(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#finalize()
|
||||
*/
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
// TODO: find a better way to get this called
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
|
||||
this.dataManager.getParmManager().removeParmListChangedListener(this);
|
||||
|
||||
|
@ -142,6 +141,12 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
*/
|
||||
@Override
|
||||
public void gridDataChanged(final ParmID parmId, final TimeRange validTime) {
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// statusHandler.handle(Priority.DEBUG, "gridDataChanged for: " + parmId
|
||||
// + " " + validTime);
|
||||
|
||||
|
@ -171,7 +176,6 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -186,11 +190,22 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
@Override
|
||||
public void parmListChanged(final Parm[] parms, Parm[] deletions,
|
||||
Parm[] additions) {
|
||||
// statusHandler.handle(Priority.DEBUG,
|
||||
// "ParmListChangedMsg received: ");
|
||||
|
||||
registerParmClients(parms, true);
|
||||
// forcing access to the disposed variable and subsequent
|
||||
// registration/unregistation of listeners through this synchronized
|
||||
// block seems to prevent VCParm objects being leaked through outdated
|
||||
// listener list copies
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// statusHandler.handle(Priority.DEBUG,
|
||||
// "ParmListChangedMsg received: ");
|
||||
// System.out.println("ParmListChangedMsg received: "
|
||||
// + getParmID().toString());
|
||||
registerParmClients(parms, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -210,6 +225,13 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
// approach.
|
||||
// statusHandler.debug("ParmInventoryChanged notification for: "
|
||||
// + getParmID().toString());
|
||||
// System.out.println("ParmInventoryChanged notification for: "
|
||||
// + getParmID().toString());
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recalcInventory(true);
|
||||
}
|
||||
|
@ -439,7 +461,7 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
}
|
||||
|
||||
// get list of currently registered parms
|
||||
List<Parm> currRegistered = new ArrayList<Parm>(registeredParms());
|
||||
List<Parm> currRegistered = registeredParms();
|
||||
|
||||
// get list of parms to unregister
|
||||
boolean changed = false;
|
||||
|
@ -469,17 +491,37 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
private void registerPC(Parm parm) {
|
||||
parm.parmListeners.addGridChangedListener(this);
|
||||
parm.parmListeners.addParmInventoryChangedListener(this);
|
||||
this.registeredParms.add(parm);
|
||||
|
||||
registeredParms.acquireWriteLock();
|
||||
try {
|
||||
this.registeredParms.add(parm);
|
||||
} finally {
|
||||
registeredParms.releaseWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterPC(Parm parm) {
|
||||
parm.parmListeners.removeGridChangedListener(this);
|
||||
parm.parmListeners.removeParmInventoryChangedListener(this);
|
||||
this.registeredParms.remove(parm);
|
||||
|
||||
registeredParms.acquireWriteLock();
|
||||
try {
|
||||
this.registeredParms.remove(parm);
|
||||
} finally {
|
||||
registeredParms.releaseWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
private Set<Parm> registeredParms() {
|
||||
return this.registeredParms;
|
||||
}
|
||||
private List<Parm> registeredParms() {
|
||||
List<Parm> retVal = new ArrayList<Parm>();
|
||||
|
||||
registeredParms.acquireReadLock();
|
||||
try {
|
||||
retVal.addAll(registeredParms);
|
||||
} finally {
|
||||
registeredParms.releaseReadLock();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
|
@ -32,6 +35,7 @@ import org.eclipse.swt.widgets.Canvas;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
|
||||
import com.raytheon.viz.gfe.core.msgs.IColorTableModifiedListener;
|
||||
import com.raytheon.viz.gfe.core.msgs.IPickupValueChangedListener;
|
||||
|
@ -49,6 +53,9 @@ import com.raytheon.viz.gfe.visual.SetValueScalarVisual;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 18, 2009 #1318 randerso Initial creation
|
||||
* Feb 20, 2012 #346 dgilling Create PickupChangedJob to fix
|
||||
* Invalid Thread Access exceptions
|
||||
* in pickupValueChanged.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,6 +66,40 @@ import com.raytheon.viz.gfe.visual.SetValueScalarVisual;
|
|||
public class ScalarSetValue extends AbstractSetValue implements
|
||||
IPickupValueChangedListener, IColorTableModifiedListener {
|
||||
|
||||
private class PickupChangedJob extends UIJob {
|
||||
|
||||
private WxValue pickupValue;
|
||||
|
||||
public PickupChangedJob() {
|
||||
super("PickupValueChanged");
|
||||
setSystem(true);
|
||||
}
|
||||
|
||||
public void setPickupValue(WxValue newValue) {
|
||||
this.pickupValue = newValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime
|
||||
* .IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
if ((!monitor.isCanceled())
|
||||
&& (!ScalarSetValue.this.entryField.isDisposed())
|
||||
&& (!ScalarSetValue.this.mainDA.isDisposed())) {
|
||||
ScalarSetValue.this.entryField.setText(pickupValue.toString());
|
||||
ScalarSetValue.this.mainDA.redraw();
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
private Canvas mainDA;
|
||||
|
||||
private SetValueScalarVisual mainVisual;
|
||||
|
@ -69,6 +110,8 @@ public class ScalarSetValue extends AbstractSetValue implements
|
|||
|
||||
private Text entryField;
|
||||
|
||||
private PickupChangedJob pickupJob;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -99,6 +142,8 @@ public class ScalarSetValue extends AbstractSetValue implements
|
|||
|
||||
});
|
||||
|
||||
pickupJob = new PickupChangedJob();
|
||||
|
||||
setParm(parm);
|
||||
}
|
||||
|
||||
|
@ -115,6 +160,7 @@ public class ScalarSetValue extends AbstractSetValue implements
|
|||
public void dispose() {
|
||||
parm.getListeners().removePickupValueChangedListener(this);
|
||||
parm.getListeners().removeColorTableModifiedListener(this);
|
||||
pickupJob.cancel();
|
||||
mainVisual.dispose();
|
||||
|
||||
super.dispose();
|
||||
|
@ -214,8 +260,8 @@ public class ScalarSetValue extends AbstractSetValue implements
|
|||
*/
|
||||
@Override
|
||||
public void pickupValueChanged(Parm parm, WxValue pickUpValue) {
|
||||
entryField.setText(pickUpValue.toString());
|
||||
mainDA.redraw();
|
||||
pickupJob.setPickupValue(pickUpValue);
|
||||
pickupJob.schedule();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
|
@ -35,6 +38,7 @@ import org.eclipse.swt.widgets.Canvas;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.core.msgs.IPickupValueChangedListener;
|
||||
|
@ -54,6 +58,9 @@ import com.raytheon.viz.gfe.visual.SetValueVectorVisual;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 22, 2009 #1318 randerso Initial creation
|
||||
* Feb 20, 2012 #346 dgilling Create PickupChangedJob to fix
|
||||
* Invalid Thread Access exceptions
|
||||
* in pickupValueChanged.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,6 +71,48 @@ import com.raytheon.viz.gfe.visual.SetValueVectorVisual;
|
|||
public class VectorSetValue extends AbstractSetValue implements
|
||||
IVectorModeChangedListener, IPickupValueChangedListener {
|
||||
|
||||
private class PickupChangedJob extends UIJob {
|
||||
|
||||
private WxValue pickupValue;
|
||||
|
||||
private boolean redrawMainDA;
|
||||
|
||||
public PickupChangedJob() {
|
||||
super("PickupValueChanged");
|
||||
setSystem(true);
|
||||
}
|
||||
|
||||
public void setPickupValue(WxValue newValue, boolean redraw) {
|
||||
this.pickupValue = newValue;
|
||||
this.redrawMainDA = redraw;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime
|
||||
* .IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
if ((!monitor.isCanceled())
|
||||
&& (!VectorSetValue.this.magField.isDisposed())
|
||||
&& (!VectorSetValue.this.dirField.isDisposed())
|
||||
&& (!VectorSetValue.this.mainDA.isDisposed())) {
|
||||
VectorWxValue value = (VectorWxValue) pickupValue;
|
||||
VectorSetValue.this.magField.setText(value.magToString());
|
||||
VectorSetValue.this.dirField.setText(value.dirToString());
|
||||
if (redrawMainDA) {
|
||||
VectorSetValue.this.mainDA.redraw();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
private Canvas mainDA;
|
||||
|
||||
private SetValueVectorVisual mainVisual;
|
||||
|
@ -74,6 +123,8 @@ public class VectorSetValue extends AbstractSetValue implements
|
|||
|
||||
private Button[] modeButton;
|
||||
|
||||
private PickupChangedJob pickupJob;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -104,8 +155,9 @@ public class VectorSetValue extends AbstractSetValue implements
|
|||
|
||||
});
|
||||
|
||||
setParm(parm);
|
||||
pickupJob = new PickupChangedJob();
|
||||
|
||||
setParm(parm);
|
||||
}
|
||||
|
||||
protected void paint(PaintEvent e) {
|
||||
|
@ -318,6 +370,7 @@ public class VectorSetValue extends AbstractSetValue implements
|
|||
public void dispose() {
|
||||
parm.getListeners().removeVectorModeChangedListener(this);
|
||||
parm.getListeners().removePickupValueChangedListener(this);
|
||||
pickupJob.cancel();
|
||||
mainVisual.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
@ -360,16 +413,13 @@ public class VectorSetValue extends AbstractSetValue implements
|
|||
}
|
||||
|
||||
private void pickUpValueChanged(WxValue pickUpValue) {
|
||||
VectorWxValue value = (VectorWxValue) pickUpValue;
|
||||
dirField.setText(value.dirToString());
|
||||
magField.setText(value.magToString());
|
||||
pickupJob.setPickupValue(pickUpValue, false);
|
||||
pickupJob.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pickupValueChanged(Parm parm, WxValue pickupValue) {
|
||||
VectorWxValue value = (VectorWxValue) pickupValue;
|
||||
magField.setText(value.magToString());
|
||||
dirField.setText(value.dirToString());
|
||||
mainDA.redraw();
|
||||
pickupJob.setPickupValue(pickupValue, true);
|
||||
pickupJob.schedule();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.raytheon.viz.gfe.core.msgs.ISmartToolInventoryChanged;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 19, 2010 njensen Initial creation
|
||||
* Mar 01, 2012 #346 dgilling Use identity-based ListenerLists.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +59,7 @@ public class SmartToolUIController extends SmartToolController {
|
|||
throws JepException {
|
||||
super(filePath, anIncludePath, classLoader, dataManager);
|
||||
|
||||
invChangedListeners = new ListenerList();
|
||||
invChangedListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,8 @@ import com.raytheon.viz.gfe.tasks.AbstractGfeTask.TaskStatus;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 7, 2011 randerso Initial creation
|
||||
* Apr 07, 2011 randerso Initial creation
|
||||
* Mar 03, 2012 #346 dgilling Use identity-based ListenerLists.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,7 +71,7 @@ public class TaskScheduler extends Job {
|
|||
|
||||
protected TaskScheduler() {
|
||||
super("Task Manager Job");
|
||||
listeners = new ListenerList();
|
||||
listeners = new ListenerList(ListenerList.IDENTITY);
|
||||
|
||||
PythonPreferenceStore prefs = Activator.getDefault()
|
||||
.getPreferenceStore();
|
||||
|
|
|
@ -124,6 +124,7 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
|
|||
units = UnitFormat.getUCUMInstance().format(dispUnit);
|
||||
}
|
||||
if (dataValue == 0) {
|
||||
dataMap.put("numericValue", null);
|
||||
dataValueString = "NO DATA";
|
||||
} else if (th0 instanceof Float) {
|
||||
double f0 = (Float) th0;
|
||||
|
|
|
@ -451,6 +451,22 @@
|
|||
<constructor-arg ref="iscSendSrvCfg" />
|
||||
</bean>
|
||||
<!-- End ISC Send Beans -->
|
||||
|
||||
<!-- ISC Receive Beans -->
|
||||
|
||||
<bean id="jms-iscrec" class="org.apache.camel.component.jms.JmsComponent">
|
||||
<constructor-arg ref="jmsIscReceiveConfig" />
|
||||
<property name="taskExecutor" ref="iscReceiveThreadPool" />
|
||||
</bean>
|
||||
<bean id="jmsIscReceiveConfig" class="org.apache.camel.component.jms.JmsConfiguration"
|
||||
factory-bean="jmsConfig" factory-method="copy" />
|
||||
<bean id="iscReceiveThreadPool"
|
||||
class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
|
||||
<property name="corePoolSize" value="2" />
|
||||
<property name="maxPoolSize" value="2" />
|
||||
</bean>
|
||||
<bean id="IscReceiveSrv" class="com.raytheon.edex.plugin.gfe.isc.IscReceiveSrv" />
|
||||
<!-- End ISC Receive Beans -->
|
||||
|
||||
<bean id="logPurger" class="com.raytheon.edex.plugin.gfe.log.LogPurger" />
|
||||
|
||||
|
@ -503,6 +519,21 @@
|
|||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- ISC Data Receive route -->
|
||||
<route id="iscReceiveRoute">
|
||||
<from uri="jms-iscrec:queue:gfeIscDataReceive?concurrentConsumers=2&destinationResolver=#qpidDurableResolver" />
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="serializationUtil" method="transformFromThrift" />
|
||||
<bean ref="IscReceiveSrv" method="processRequest"/>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:iscDataRec?level=ERROR&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<!-- ISC Send Routes -->
|
||||
|
|
|
@ -191,7 +191,6 @@ public class GfeScript extends Thread {
|
|||
|
||||
public String waitFor() {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
while (isRunning()) {
|
||||
|
||||
Thread.sleep(200);
|
||||
|
|
|
@ -72,6 +72,7 @@ public class GfeScriptExecutor {
|
|||
private static Map<String, GfeScript> scriptMap = new ConcurrentHashMap<String, GfeScript>();
|
||||
|
||||
private static final FilenameFilter docFileFilter = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".doc");
|
||||
}
|
||||
|
@ -111,22 +112,27 @@ public class GfeScriptExecutor {
|
|||
return "Error getting database configuration\n" + e.getMessage();
|
||||
}
|
||||
|
||||
GfeScript theScript = null;
|
||||
String key = null;
|
||||
for (String site : sites.keySet()) {
|
||||
key = scriptName + site;
|
||||
GfeScript theScript = null;
|
||||
String key = scriptName + site;
|
||||
// synchronize on the map here so multiple threads don't try
|
||||
// creating the same GfeScript object
|
||||
synchronized (scriptMap) {
|
||||
if (scriptMap.containsKey(key)) {
|
||||
scriptMap.get(key).waitFor();
|
||||
} else {
|
||||
GfeScript newScript = new GfeScript(scriptName, site);
|
||||
newScript.start();
|
||||
scriptMap.put(key, newScript);
|
||||
theScript = scriptMap.get(key);
|
||||
if (theScript == null) {
|
||||
theScript = new GfeScript(scriptName, site);
|
||||
theScript.start();
|
||||
scriptMap.put(key, theScript);
|
||||
}
|
||||
}
|
||||
theScript = scriptMap.get(key);
|
||||
theScript.execute(sites.get(site));
|
||||
String scriptRetVal = theScript.waitFor();
|
||||
|
||||
String scriptRetVal = null;
|
||||
// synchronize on the GfeScript object here so multiple threads
|
||||
// can't try to execute the same instance at once
|
||||
synchronized (theScript) {
|
||||
theScript.execute(sites.get(site));
|
||||
scriptRetVal = theScript.waitFor();
|
||||
}
|
||||
if (!scriptRetVal.equals(SUCCESS)) {
|
||||
if (retVal.equals(SUCCESS)) {
|
||||
retVal = scriptRetVal;
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.gfe.isc;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* ISC data receive service. Takes incoming request and executes iscDataRec
|
||||
* script using provided parameters.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 5, 2012 #361 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class IscReceiveSrv {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(IscReceiveSrv.class);
|
||||
|
||||
public static void processRequest(IscDataRecRequest request) {
|
||||
GfeScriptExecutor scriptRunner = new GfeScriptExecutor();
|
||||
String retVal = scriptRunner.execute("iscDataRec "
|
||||
+ request.getArgString());
|
||||
if (!retVal.equals(GfeScriptExecutor.SUCCESS)) {
|
||||
statusHandler.error("Error encountered executing iscDataRec: "
|
||||
+ retVal);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,13 +19,15 @@
|
|||
**/
|
||||
package com.raytheon.edex.plugin.gfe.server.handler;
|
||||
|
||||
import com.raytheon.edex.plugin.gfe.isc.GfeScriptExecutor;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Thrift request handler for <code>IscDataRecRequest</code>. Takes request and
|
||||
* places it on a queue to be executed by <code>IscReceiveSrv</code>.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -34,6 +36,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 26, 2010 dgilling Initial creation
|
||||
* Mar 05, 2012 #361 dgilling Make call to iscDataRec
|
||||
* asynchronous.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,15 +59,9 @@ public class IscDataRecRequestHandler implements
|
|||
public ServerResponse<String> handleRequest(IscDataRecRequest request)
|
||||
throws Exception {
|
||||
ServerResponse<String> sr = new ServerResponse<String>();
|
||||
GfeScriptExecutor scriptRunner = new GfeScriptExecutor();
|
||||
|
||||
String retVal = scriptRunner.execute("iscDataRec "
|
||||
+ request.getArgString());
|
||||
|
||||
if (!retVal.equals(GfeScriptExecutor.SUCCESS)) {
|
||||
sr.addMessage(retVal);
|
||||
}
|
||||
|
||||
byte[] message = SerializationUtil.transformToThrift(request);
|
||||
EDEXUtil.getMessageProducer().sendAsync("iscReceiveRoute", message);
|
||||
return sr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#Thu Mar 26 10:17:50 CDT 2009
|
||||
#Mon Feb 20 17:09:40 CST 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
|
|
|
@ -18,13 +18,11 @@
|
|||
<constructor-arg value="dhr" />
|
||||
<constructor-arg value="jms-dist:queue:Ingest.dhr?destinationResolver=#qpidDurableResolver" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="clusteredDHRroutes"
|
||||
autoStartup="false"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
|
||||
<camelContext id="nonClusteredDHRroutes" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<!-- Begin dhr Routes -->
|
||||
<route id="dhrIngestRoute">
|
||||
<!-- Begin non-clustered dhr Routes -->
|
||||
<route id="dhrIngestFilter">
|
||||
<from uri="jms-generic:queue:Ingest.dhr?destinationResolver=#qpidDurableResolver" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>dhr</constant>
|
||||
|
@ -34,6 +32,26 @@
|
|||
<bean ref="setIngestHeaderFields"/>
|
||||
<bean ref="stringToFile" />
|
||||
<bean ref="radarDecompressor" method="decompressToFile" />
|
||||
<bean ref="dhrDecodeSrv" method="filter" />
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:dhr?level=INFO&showBody=false&showCaughtException=true&showStackTrace=true"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<camelContext id="clusteredDHRroutes"
|
||||
autoStartup="false"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<!-- Begin dhr Routes -->
|
||||
<route id="dhrIngestRoute">
|
||||
<from uri="jms-generic:queue:dhrProcess?destinationResolver=#qpidDurableResolver" />
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="serializationUtil" method="transformFromThrift" />
|
||||
<bean ref="dhrDecodeSrv" method="process" />
|
||||
<!-- <bean ref="processUtil" method="log"/> -->
|
||||
</pipeline>
|
||||
|
@ -44,8 +62,8 @@
|
|||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
<bean factory-bean="clusteredCamelContextMgr"
|
||||
factory-method="register">
|
||||
|
||||
<bean factory-bean="clusteredCamelContextMgr" factory-method="register">
|
||||
<constructor-arg ref="clusteredDHRroutes" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.ohd.pproc;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* A class that describes a DHR radar record that needs to be ingested.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 09, 2012 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class HPEDhrMessage {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private byte[] data;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String radarId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String dtype;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String dt;
|
||||
|
||||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* For use by Thrift serialization/deserialization only. Do not use.
|
||||
*/
|
||||
public HPEDhrMessage() {
|
||||
|
||||
}
|
||||
|
||||
public HPEDhrMessage(byte[] data, String radid, String dtype, String dt) {
|
||||
this.data = data;
|
||||
this.radarId = radid;
|
||||
this.dtype = dtype;
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public void setData(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getRadarId() {
|
||||
return radarId;
|
||||
}
|
||||
|
||||
public void setRadarId(String radarId) {
|
||||
this.radarId = radarId;
|
||||
}
|
||||
|
||||
public String getDtype() {
|
||||
return dtype;
|
||||
}
|
||||
|
||||
public void setDtype(String dtype) {
|
||||
this.dtype = dtype;
|
||||
}
|
||||
|
||||
public String getDt() {
|
||||
return dt;
|
||||
}
|
||||
|
||||
public void setDt(String dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
}
|
|
@ -30,11 +30,14 @@ import java.io.IOException;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
|
@ -48,6 +51,8 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 20, 2010 4200 snaples Initial creation
|
||||
* Mar 09, 2012 417 dgilling Refactor to use two-stage queue
|
||||
* process.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -55,62 +60,225 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
*/
|
||||
public class HPEDhrSrv {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
private CoreDao dao;
|
||||
|
||||
private File outFile;
|
||||
private static final transient IUFStatusHandler logger = UFStatus
|
||||
.getHandler(HPEDhrSrv.class);
|
||||
|
||||
private static final Pattern WMO_PATTERN = Pattern
|
||||
.compile("([A-Z]{4}[0-9]{2} [A-Z]{4} [0-9]{6})\\x0D\\x0D\\x0A(\\w{6})\\x0D\\x0D\\x0A");
|
||||
|
||||
/** WMO header regex */
|
||||
// private static final Pattern wmoPat = Pattern
|
||||
// .compile("(\\p{Alpha}{4}\\d{2}) (\\p{Alnum}{4}) (\\d{6})");
|
||||
|
||||
private static final Pattern ldmPat = Pattern
|
||||
private static final Pattern LDM_PATTERN = Pattern
|
||||
.compile("(\\p{Alpha}{3})(\\p{Alpha}{3})");
|
||||
|
||||
private static final Pattern radPat = Pattern
|
||||
private static final Pattern RAD_PATTERN = Pattern
|
||||
.compile("(\\p{Alpha}{4}).(\\d{2,3}).(\\d{8}_\\d{4})");
|
||||
|
||||
private final String DHR = "DHR";
|
||||
private static final String DHRTYPE = "32";
|
||||
|
||||
private final String dhrtype = "32";
|
||||
private static final String DSPTYPE1 = "138";
|
||||
|
||||
private final String dsptype1 = "138";
|
||||
private static final String DSPTYPE2 = "80";
|
||||
|
||||
private final String dsptype2 = "80";
|
||||
private static final String DHR = "DHR";
|
||||
|
||||
private final String DSP = "DSP";
|
||||
private static final String DSP = "DSP";
|
||||
|
||||
private final String STP = "STP";
|
||||
private static final String STP = "STP";
|
||||
|
||||
public Object process(File hpeFile) throws EdexException {
|
||||
// logger.info("Starting HPE Check message.");
|
||||
checkMessage(hpeFile);
|
||||
private static final int RADID_IDX = 0;
|
||||
|
||||
return null;
|
||||
private static final int DTYPE_IDX = 1;
|
||||
|
||||
private static final int DT_IDX = 2;
|
||||
|
||||
private static final String JMS_QUEUE_URI = "jms-generic:queue:dhrProcess";
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
/**
|
||||
* Route endpoint for "dhrIngestRoute". Takes a message, writes the file to
|
||||
* disk, and then runs the DHR data processing scripts so the file is
|
||||
* ingested.
|
||||
*
|
||||
* @param message
|
||||
* A <code>HPEDhrMessage</code> describing the DHR radar file to
|
||||
* be ingested.
|
||||
*/
|
||||
public void process(HPEDhrMessage message) {
|
||||
// logger.info("Starting HPE process message.");
|
||||
try {
|
||||
writeFile(message);
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.handle(Priority.PROBLEM, "HPE cannot create output file.", e);
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
logger.handle(Priority.PROBLEM,
|
||||
"HPE Error writing updated contents of HPE file", e);
|
||||
return;
|
||||
}
|
||||
runGatherScripts();
|
||||
}
|
||||
|
||||
/**
|
||||
* DPA radar files have been known to contain extra bytes at the beginning
|
||||
* of the file. These bytes will cause the DHR decoder to fail.
|
||||
* <p>
|
||||
* This method removes the leading bytes to ensure proper decoding of DHR
|
||||
* files.
|
||||
*
|
||||
* @param dhrFile
|
||||
* The radar server message
|
||||
* @throws EdexException
|
||||
* If IOExceptions occur
|
||||
* @param message
|
||||
* A <code>HPEDhrMessage</code> describing the DHR radar file to
|
||||
* be ingested.
|
||||
* @throws FileNotFoundException
|
||||
* If the output file cannot be created or opened for any
|
||||
* reason.
|
||||
* @throws IOException
|
||||
* If an I/O error occurs while writing the file.
|
||||
*/
|
||||
private void checkMessage(File hpeFile) throws EdexException {
|
||||
private void writeFile(HPEDhrMessage message) throws FileNotFoundException,
|
||||
IOException {
|
||||
String dtype = message.getDtype();
|
||||
String outname = dtype + message.getRadarId() + "." + message.getDt();
|
||||
String outPath;
|
||||
if (dtype.equals(DHR)) {
|
||||
outPath = appsDefaults.getToken("dhr_prod_dir");
|
||||
} else {
|
||||
outPath = appsDefaults.getToken("dsp_prod_dir");
|
||||
}
|
||||
File oP = new File(outPath);
|
||||
if (!oP.exists()) {
|
||||
oP.mkdirs();
|
||||
}
|
||||
|
||||
boolean proc = false;
|
||||
// logger.info("Starting HPE CheckFile. ");
|
||||
proc = checkFile(hpeFile);
|
||||
if (proc == false) {
|
||||
byte[] fileContents = message.getData();
|
||||
int offset = findStartRadarData(new String(fileContents, 0, 80));
|
||||
String outFile = FileUtil.join(outPath, outname);
|
||||
BufferedOutputStream outStream = null;
|
||||
|
||||
try {
|
||||
outStream = new BufferedOutputStream(new FileOutputStream(outFile));
|
||||
// logger.info("HPE Writing contents of file to " +
|
||||
// outFile);
|
||||
outStream.write(fileContents, offset, fileContents.length - offset);
|
||||
} finally {
|
||||
if (outStream != null) {
|
||||
outStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Route endpoint for "dhrIngestFilter". Reads the given file to memory and
|
||||
* determines whether or not this file is a DHR radar file. If it is, a
|
||||
* message is sent to a JMS queue so it is later ingested.
|
||||
*
|
||||
* @param hpeFile
|
||||
* The radar file to check.
|
||||
*/
|
||||
public void filter(File hpeFile) {
|
||||
// logger.info("Starting HPE Check message.");
|
||||
byte[] fileContents = new byte[0];
|
||||
try {
|
||||
fileContents = readHpeFile(hpeFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.handle(Priority.PROBLEM,
|
||||
"HPE Cannot find file: " + hpeFile.toString(), e);
|
||||
} catch (IOException e) {
|
||||
logger.handle(Priority.PROBLEM, "HPE Error reading file: "
|
||||
+ hpeFile.toString(), e);
|
||||
}
|
||||
|
||||
if (fileContents.length < 80) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check header
|
||||
String fileStartStr = new String(fileContents, 0, 80);
|
||||
// array will hold radar id, dtype, and dt information. using array so
|
||||
// its contents can be modified by the checkFile() method.
|
||||
String[] fileMetadata = new String[3];
|
||||
boolean validFile = checkFile(hpeFile.getName(), fileStartStr,
|
||||
fileMetadata);
|
||||
|
||||
// write file to queue
|
||||
if (validFile) {
|
||||
try {
|
||||
sendFileToQueue(fileContents, fileMetadata[RADID_IDX],
|
||||
fileMetadata[DTYPE_IDX], fileMetadata[DT_IDX]);
|
||||
} catch (SerializationException e) {
|
||||
logger.handle(Priority.PROBLEM,
|
||||
"HPE can't serialize HPEDhrMessage for file: "
|
||||
+ hpeFile.toString(), e);
|
||||
} catch (EdexException e) {
|
||||
logger.handle(Priority.PROBLEM,
|
||||
"HPE can't send message to QPID queue for file: "
|
||||
+ hpeFile.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// logger.info("Finished HPE CheckFile. ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the given radar file to memory for later processing by the
|
||||
* <code>filter</code> function.
|
||||
*
|
||||
* @param hpeFile
|
||||
* The file to read.
|
||||
* @return The contents of the file.
|
||||
* @throws FileNotFoundException
|
||||
* If the specified file does not exist or cannot be opened.
|
||||
* @throws IOException
|
||||
* If an I/O error occurs while reading the file.
|
||||
*/
|
||||
private byte[] readHpeFile(File hpeFile) throws FileNotFoundException,
|
||||
IOException {
|
||||
BufferedInputStream inStream = null;
|
||||
byte[] fileContents = null;
|
||||
|
||||
try {
|
||||
inStream = new BufferedInputStream(new FileInputStream(hpeFile));
|
||||
fileContents = new byte[(int) hpeFile.length()];
|
||||
inStream.read(fileContents);
|
||||
} finally {
|
||||
if (inStream != null) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
return fileContents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the given parameters and constructs a <code>HPEDhrMessage</code> to
|
||||
* be placed onto the queue used by <code>HPEDhrSrv</code> for actual data
|
||||
* processing.
|
||||
*
|
||||
* @param data
|
||||
* The contents of the radar file.
|
||||
* @param radid
|
||||
* The radar id for the given file.
|
||||
* @param dtype
|
||||
* The file's dtype.
|
||||
* @param dt
|
||||
* The file's dt.
|
||||
* @throws SerializationException
|
||||
* If the constructed <code>HPEDhrMessage</code> cannot be
|
||||
* serialized by Thrift.
|
||||
* @throws EdexException
|
||||
* If the message cannot be placed onto the QPID queue for DHR
|
||||
* data processing.
|
||||
*/
|
||||
private void sendFileToQueue(byte[] data, String radid, String dtype,
|
||||
String dt) throws SerializationException, EdexException {
|
||||
HPEDhrMessage message = new HPEDhrMessage(data, radid, dtype, dt);
|
||||
byte[] messageData = SerializationUtil.transformToThrift(message);
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(JMS_QUEUE_URI, messageData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the DSPgather and DHRgather data processing scripts.
|
||||
*/
|
||||
private void runGatherScripts() {
|
||||
// logger.info("Starting HPE DSP gather.");
|
||||
int exitValue = MainMethod.runProgram("ksh",
|
||||
appsDefaults.getToken("pproc_bin") + "/DSPgather");
|
||||
|
@ -135,86 +303,55 @@ public class HPEDhrSrv {
|
|||
}
|
||||
|
||||
/**
|
||||
* DPA radar files have been known to contain extra bytes at the beginning
|
||||
* of the file. These bytes will cause the DHR decoder to fail.
|
||||
* <p>
|
||||
* This method removes the leading bytes to ensure proper decoding of DHR
|
||||
* files
|
||||
* Given a radar file name and file header, this function determines whether
|
||||
* or not this file is a DHR radar file.
|
||||
*
|
||||
* @param fileName
|
||||
* The name of the DHR radar file
|
||||
* @throws EdexException
|
||||
* If IOExceptions occur
|
||||
* The name of the radar file
|
||||
* @param fileHeader
|
||||
* The first 80 bytes from the radar file.
|
||||
* @param metadata
|
||||
* A length 3 <code>String</code> array that will be used to pass
|
||||
* the radar id, dtype, and dt back to the caller.
|
||||
* @return If the specified file is a DHR radar file.
|
||||
*/
|
||||
private boolean checkFile(File hpeFile) throws EdexException {
|
||||
/*
|
||||
* Read the contents of the file into memory.
|
||||
*/
|
||||
BufferedInputStream inStream = null;
|
||||
try {
|
||||
inStream = new BufferedInputStream(new FileInputStream(hpeFile));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new EdexException("HPE Cannot find file: " + hpeFile, e);
|
||||
}
|
||||
byte[] fileContents = new byte[(int) hpeFile.length()];
|
||||
try {
|
||||
inStream.read(fileContents);
|
||||
} catch (IOException e) {
|
||||
throw new EdexException("HPE Error reading file: " + hpeFile, e);
|
||||
} finally {
|
||||
try {
|
||||
inStream.close();
|
||||
} catch (IOException e1) {
|
||||
throw new EdexException("HPE Error closing stream to file: "
|
||||
+ hpeFile, e1);
|
||||
}
|
||||
}
|
||||
String outPath = "";
|
||||
String fname = hpeFile.getName();
|
||||
String radid = "";
|
||||
String dtype = "";
|
||||
String dt = "";
|
||||
String outname = "";
|
||||
|
||||
Matcher r = radPat.matcher(fname);
|
||||
/*
|
||||
* Copy off the first few bytes to see if leading bytes are present
|
||||
* before the WMO header
|
||||
*/
|
||||
if (fileContents.length < 80) {
|
||||
return false;
|
||||
}
|
||||
String fileStartStr = new String(fileContents, 0, 80);
|
||||
|
||||
private boolean checkFile(String fileName, String fileHeader,
|
||||
String[] metadata) {
|
||||
/*
|
||||
* Find the WMO header
|
||||
*/
|
||||
Matcher wmomat = WMO_PATTERN.matcher(fileStartStr);
|
||||
Matcher dhrmat = ldmPat.matcher(fileStartStr);
|
||||
Matcher r = RAD_PATTERN.matcher(fileName);
|
||||
Matcher wmomat = WMO_PATTERN.matcher(fileHeader);
|
||||
|
||||
if (r.find()) {
|
||||
// logger.info("HPE DHRSrv found Radar file.");
|
||||
radid = r.group(1).substring(1).toUpperCase().trim();
|
||||
// getting the radid
|
||||
metadata[RADID_IDX] = r.group(1).substring(1).toUpperCase().trim();
|
||||
String ftype = r.group(2);
|
||||
dt = r.group(3);
|
||||
if (ftype.equals(dhrtype)) {
|
||||
dtype = DHR;
|
||||
// getting the dt
|
||||
metadata[DT_IDX] = r.group(3);
|
||||
// getting the dtype
|
||||
if (ftype.equals(DHRTYPE)) {
|
||||
metadata[DTYPE_IDX] = DHR;
|
||||
// logger.info("HPE DHRSrv found Radar file type DHR.");
|
||||
} else if (ftype.equals(dsptype1) || ftype.equals(dsptype2)) {
|
||||
dtype = DSP;
|
||||
} else if (ftype.equals(DSPTYPE1) || ftype.equals(DSPTYPE2)) {
|
||||
metadata[DTYPE_IDX] = DSP;
|
||||
// logger.info("HPE DHRSrv found Radar file type DSP.");
|
||||
} else {
|
||||
// logger.info("HPE DHRSrv found Radar type unknown.");
|
||||
return false;
|
||||
}
|
||||
} else if (wmomat.find()) {
|
||||
Matcher dhrmat = LDM_PATTERN.matcher(fileHeader);
|
||||
if (dhrmat.find()) {
|
||||
// logger.info("HPE DHRSrv found LDM file.");
|
||||
dt = wmomat.group(1).substring(wmomat.group(1).length() - 6);
|
||||
radid = dhrmat.group(2).toUpperCase().trim();
|
||||
dtype = dhrmat.group(1).toUpperCase().trim();
|
||||
if (!dtype.equals(DSP) || !dtype.equals(STP)
|
||||
|| !dtype.equals(DHR)) {
|
||||
// logger.info("HPEDHRSrv found LDM file.");
|
||||
metadata[DT_IDX] = wmomat.group(1).substring(
|
||||
wmomat.group(1).length() - 6);
|
||||
metadata[RADID_IDX] = dhrmat.group(2).toUpperCase().trim();
|
||||
metadata[DTYPE_IDX] = dhrmat.group(1).toUpperCase().trim();
|
||||
if ((!metadata[DTYPE_IDX].equals(DSP))
|
||||
&& (!metadata[DTYPE_IDX].equals(STP))
|
||||
&& (!metadata[DTYPE_IDX].equals(DHR))) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -223,80 +360,42 @@ public class HPEDhrSrv {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// logger.info("HPE DHRSrv querying db for radid=" + radid
|
||||
// + " and use_radar=T.");
|
||||
String query = String.format(
|
||||
"select * from radarloc where radid='%s' and use_radar='T' ",
|
||||
radid);
|
||||
dao = new CoreDao(DaoConfig.forDatabase("ihfs"));
|
||||
metadata[RADID_IDX]);
|
||||
CoreDao dao = new CoreDao(DaoConfig.forDatabase("ihfs"));
|
||||
Object[] rs = dao.executeSQLQuery(query);
|
||||
|
||||
// logger.info("HPE DHRSrv querying db done.");
|
||||
if (rs.length > 0) {
|
||||
|
||||
outname = dtype + radid + "." + dt;
|
||||
if (dtype.equals(DHR)) {
|
||||
outPath = appsDefaults.getToken("dhr_prod_dir");
|
||||
} else {
|
||||
outPath = appsDefaults.getToken("dsp_prod_dir");
|
||||
}
|
||||
File oP = new File(outPath);
|
||||
if (!oP.exists()) {
|
||||
oP.mkdir();
|
||||
}
|
||||
|
||||
int offset = 0;
|
||||
offset = findStartRadarData(fileStartStr);
|
||||
outFile = new File(FileUtil.join(outPath, outname));
|
||||
BufferedOutputStream outStream = null;
|
||||
|
||||
try {
|
||||
outStream = new BufferedOutputStream(new FileOutputStream(
|
||||
outFile));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new EdexException("HPE Cannot find file: " + outFile, e);
|
||||
}
|
||||
|
||||
try {
|
||||
outStream.write(fileContents, offset, fileContents.length
|
||||
- offset);
|
||||
// logger.info("HPE Re-writing contents of file: " + hpeFile
|
||||
// + " to " + outFile);
|
||||
} catch (IOException e) {
|
||||
throw new EdexException(
|
||||
"HPE Error writing updated contents of HPE file: "
|
||||
+ outFile, e);
|
||||
} finally {
|
||||
try {
|
||||
outStream.close();
|
||||
} catch (IOException e1) {
|
||||
throw new EdexException("HPE Unable to close file: "
|
||||
+ outFile, e1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return (rs.length > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the header data from a radar file, this function determines the
|
||||
* ending offset of the WMO header.
|
||||
*
|
||||
* @param headerInfo
|
||||
* The header data from a radar file.
|
||||
* @return Returns the offset after the last character in the WMO header.
|
||||
*/
|
||||
private int findStartRadarData(String headerInfo) {
|
||||
int startOfRadarData = 0;
|
||||
Matcher matcher = WMO_PATTERN.matcher(headerInfo);
|
||||
boolean foundHeader = matcher.find();
|
||||
if (foundHeader) {
|
||||
startOfRadarData = matcher.end();
|
||||
if (matcher.find()) {
|
||||
return matcher.end();
|
||||
}
|
||||
|
||||
return startOfRadarData;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final void main(String[] args) {
|
||||
|
||||
String input = "SDUS53_ABR_DSP_201538_185076111.rad";
|
||||
String input2 = "koax.32.20111020_1553";
|
||||
Matcher m = ldmPat.matcher(input);
|
||||
Matcher p = radPat.matcher(input2);
|
||||
Matcher m = LDM_PATTERN.matcher(input);
|
||||
Matcher p = RAD_PATTERN.matcher(input2);
|
||||
|
||||
if (m.find()) {
|
||||
System.out.println(m.group(0));
|
||||
|
|
|
@ -58,6 +58,21 @@ if [ ${RC} -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Create additional directories that are required; the baselined empty
|
||||
# directories were lost when we started using git.
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/exportgrids/tmp
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/exportgrids2
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/products/ISC
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the profile.d scripts.
|
||||
PROFILE_D_DIR="Installer.rpm/common/environment/awips2-gfesuite/profile.d"
|
||||
cp ${WORKSPACE_DIR}/${PROFILE_D_DIR}/* ${RPM_BUILD_ROOT}/etc/profile.d
|
||||
|
@ -75,3 +90,9 @@ cp ${WORKSPACE_DIR}/${PROFILE_D_DIR}/* ${RPM_BUILD_ROOT}/etc/profile.d
|
|||
%defattr(644,awips,fxalpha,755)
|
||||
%dir /awips2/GFESuite/bin/src
|
||||
/awips2/GFESuite/bin/src/*
|
||||
%dir /awips2/GFESuite/exportgrids
|
||||
/awips2/GFESuite/exportgrids/*
|
||||
%dir /awips2/GFESuite/exportgrids2
|
||||
%defattr(644,awips,fxalpha,775)
|
||||
%dir /awips2/GFESuite/products
|
||||
/awips2/GFESuite/products/*
|
|
@ -58,6 +58,21 @@ if [ ${RC} -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Create additional directories that are required; the baselined empty
|
||||
# directories were lost when we started using git.
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/exportgrids/tmp
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/exportgrids2
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p ${RPM_BUILD_ROOT}/awips2/GFESuite/products/ISC
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy the profile.d scripts.
|
||||
PROFILE_D_DIR="Installer.rpm/common/environment/awips2-gfesuite/profile.d"
|
||||
cp ${WORKSPACE_DIR}/${PROFILE_D_DIR}/* ${RPM_BUILD_ROOT}/etc/profile.d
|
||||
|
@ -75,7 +90,13 @@ cp ${WORKSPACE_DIR}/${PROFILE_D_DIR}/* ${RPM_BUILD_ROOT}/etc/profile.d
|
|||
%defattr(644,awips,fxalpha,755)
|
||||
%dir /awips2/GFESuite/bin/src
|
||||
/awips2/GFESuite/bin/src/*
|
||||
%dir /awips2/GFESuite/exportgrids
|
||||
/awips2/GFESuite/exportgrids/*
|
||||
%dir /awips2/GFESuite/exportgrids2
|
||||
%defattr(755,awips,fxalpha,777)
|
||||
%dir /awips2/GFESuite/ServiceBackup/scripts
|
||||
/awips2/GFESuite/ServiceBackup/scripts/*
|
||||
%config(noreplace) /awips2/GFESuite/ServiceBackup/configuration/svcbu.properties
|
||||
%config(noreplace) /awips2/GFESuite/ServiceBackup/configuration/svcbu.properties
|
||||
%defattr(644,awips,fxalpha,775)
|
||||
%dir /awips2/GFESuite/products
|
||||
/awips2/GFESuite/products/*
|
|
@ -4,8 +4,8 @@ set -x
|
|||
# We Need To Setup Our Environment.
|
||||
source env.sh
|
||||
|
||||
echo "The AWIPSII Version is $AWIPSII_VERSION WTF WTF WTF WTF"
|
||||
echo "The AWIPSII Release is $AWIPSII_RELEASE WTF WTF WTF WTF"
|
||||
echo "The AWIPSII Version is $AWIPSII_VERSION "
|
||||
echo "The AWIPSII Release is $AWIPSII_RELEASE "
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ do
|
|||
qpid-config add queue ${queue}Generate --durable --file-count 16 --file-size 24
|
||||
done
|
||||
|
||||
#define 24 Meg persistence queues
|
||||
QUEUES=('activeTablePending' 'gfeSvcBackupOp' 'gfeIscQueue' 'edex.tpcWatch' 'edex.spcWatch')
|
||||
#define 24 Meg persistence queues for GFE
|
||||
QUEUES=('activeTablePending' 'gfeSvcBackupOp' 'gfeIscDataReceive' 'edex.tpcWatch' 'edex.spcWatch')
|
||||
for queue in ${QUEUES[*]};
|
||||
do
|
||||
echo "Creating queue $queue"
|
||||
|
@ -36,11 +36,19 @@ do
|
|||
done
|
||||
|
||||
#define 24 Meg persistence queues for ingest
|
||||
QUEUES=('vaa' 'textlightning' 'tcs' 'tcg' 'taf' 'svrwx' 'sfcobs' 'redbook' 'recco' 'q2' 'profiler' 'poessounding' 'pirep' 'lsr' 'loctables' 'ldadprofiler' 'ldadmesonet' 'ldadhydro' 'goessounding' 'dhr' 'cwa' 'ccfp' 'bufrua' 'bufrssmi' 'bufrsigwx' 'bufrquikscat' 'bufrncwf' 'bufrmthdw' 'bufrmos' 'bufrhdw' 'bufrascat' 'binlightning' 'airmet' 'airep' 'acars' 'Warning' 'ShefStaged' 'Satellite')
|
||||
QUEUES=('vaa' 'textlightning' 'tcs' 'tcg' 'taf' 'svrwx' 'sfcobs' 'redbook' 'recco' 'q2' 'profiler' 'poessounding' 'pirep' 'lsr' 'loctables' 'ldadprofiler' 'ldadmesonet' 'ldadhydro' 'goessounding' 'cwa' 'ccfp' 'bufrua' 'bufrssmi' 'bufrsigwx' 'bufrquikscat' 'bufrncwf' 'bufrmthdw' 'bufrmos' 'bufrhdw' 'bufrascat' 'binlightning' 'airmet' 'airep' 'acars' 'Warning' 'ShefStaged' 'Satellite')
|
||||
for queue in ${QUEUES[*]};
|
||||
do
|
||||
echo "Creating queue Ingest.$queue"
|
||||
qpid-config add queue Ingest.$queue --durable --file-count 16 --file-size 24
|
||||
done
|
||||
|
||||
#define 24 Meg persistence queues for HPE ingest
|
||||
QUEUES=('Ingest.dhr' 'dhrProcess')
|
||||
for queue in ${QUEUES[*]};
|
||||
do
|
||||
echo "Creating queue $queue"
|
||||
qpid-config add queue $queue --durable --file-count 16 --file-size 24
|
||||
done
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
|
||||
Name: %{name}
|
||||
Version: %{qpid_release}.%{qpid_svnrev}
|
||||
Release: 32%{?dist}
|
||||
Release: 33%{?dist}
|
||||
Summary: Libraries for Qpid C++ client applications
|
||||
Group: AWIPSII
|
||||
License: ASL 2.0
|
||||
|
|
Loading…
Add table
Reference in a new issue