Merge branch 'omaha_13.3.1' into development
Former-commit-id:d5b80f9225
[formerly dd9a3152106c5e4eac6fb2de10f27528e5177810] Former-commit-id:aa0e9acefd
This commit is contained in:
commit
b9563da8a8
93 changed files with 4692 additions and 969 deletions
|
@ -19,6 +19,9 @@ if [ ${RC} -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Run monitorThreads?
|
||||
runMonitorThreads=false
|
||||
|
||||
# copy the viz shutdown utility if necessary.
|
||||
copyVizShutdownUtilIfNecessary
|
||||
|
||||
|
@ -128,11 +131,9 @@ for flag in $@; do
|
|||
fi
|
||||
done
|
||||
|
||||
if [ ${redirect} == "TRUE" ]; then
|
||||
# can we write to log directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
touch ${LOGFILE}
|
||||
fi
|
||||
# can we write to log directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
touch ${LOGFILE}
|
||||
fi
|
||||
|
||||
# Special instructions for the 64-bit jvm.
|
||||
|
@ -142,9 +143,15 @@ if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
|
|||
fi
|
||||
|
||||
lookupINI $@
|
||||
if ( [ ${redirect} == "TRUE" ] || [ -w ${LOGFILE} ] ); then
|
||||
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ > ${LOGFILE} 2>&1
|
||||
else
|
||||
${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@
|
||||
|
||||
if [[ "${runMonitorThreads}" == "true" ]] ; then
|
||||
# nohup to allow tar process to continue after user has logged out
|
||||
nohup ${dir}/monitorThreads.sh $pid >> /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if ( [ ${redirect} == "TRUE" ] ); then
|
||||
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ > ${LOGFILE} 2>&1
|
||||
else
|
||||
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ 2>&1 | tee ${LOGFILE}
|
||||
fi
|
||||
|
||||
|
|
84
cave/build/static/linux/cave/monitorThreads.sh
Normal file
84
cave/build/static/linux/cave/monitorThreads.sh
Normal file
|
@ -0,0 +1,84 @@
|
|||
#!/bin/sh
|
||||
# runs a jstack every X seconds until killed
|
||||
|
||||
basePath="/data/fxa/cave"
|
||||
hostName=`hostname -s`
|
||||
hostPath="${basePath}/${hostName}"
|
||||
|
||||
pid="$1"
|
||||
sleepTime="$2"
|
||||
|
||||
sleep 10 # put in to allow exec of cave jvm
|
||||
|
||||
# days worth of jstacks to keep
|
||||
purge_retention="7"
|
||||
|
||||
function purgeJstacks()
|
||||
{
|
||||
find $basePath -type f -name "*pid*jstacks.tgz" -mtime +${purge_retention} -exec rm -f {} \; >> /dev/null 2>&1
|
||||
}
|
||||
|
||||
for i in $( ps -p ${pid} -f | grep -v UID ) ; do
|
||||
if [[ ! "${perspective}" ]] ; then
|
||||
if [[ "$j" == "-perspective" || "$j" == "-component" ]] ; then
|
||||
perspective=$i
|
||||
fi
|
||||
j=$i
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ! "${perspective}" ]] ; then perspective="cave" ; fi
|
||||
|
||||
if [ "$pid" == "" ]; then
|
||||
echo "Usage: continualJstack.sh <PID> <SLEEP_INTERVAL>"
|
||||
echo " SLEEP_INTERVAL defaults to 2 if not specified"
|
||||
else
|
||||
# purge old jstacks
|
||||
purgeJstacks &
|
||||
|
||||
if [ "$sleepTime" == "" ]; then
|
||||
sleepTime=2
|
||||
fi
|
||||
|
||||
if [[ ! -d ${hostPath} ]] ; then mkdir -p ${hostPath} ; fi
|
||||
cd ${hostPath}
|
||||
t1=$( date +"%Y%m%d_%H%M" )
|
||||
pidPath="${t1}_pid${pid}_${perspective}_jstacks"
|
||||
mkdir -p ${pidPath}
|
||||
cd ${pidPath}
|
||||
|
||||
prevDatePortion=""
|
||||
|
||||
while ps -p ${pid} > /dev/null ; do
|
||||
t1=$( date +"%Y%m%d_%H%M" )
|
||||
|
||||
# strip off the last minute, allowing for tars to be created in 10 minute segments
|
||||
newDatePortion="${t1%?}"
|
||||
|
||||
if [[ $newDatePortion != $prevDatePortion ]]; then
|
||||
# verify this isn't the first one
|
||||
if [[ "$prevDatePortion" != "" ]]; then
|
||||
tar -czf jstack_${prevDatePortion}X_${pid}.log.tgz --remove-files jstack_${prevDatePortion}*${pid}.log &
|
||||
fi
|
||||
|
||||
prevDatePortion="$newDatePortion"
|
||||
fi
|
||||
|
||||
log="jstack_${t1}_${pid}.log"
|
||||
jstack -l $pid >> $log
|
||||
echo "" >> $log
|
||||
echo "" >> $log
|
||||
|
||||
sleep $sleepTime
|
||||
done
|
||||
|
||||
tar -czf jstack_${newDatePortion}X_${pid}.log.tgz --remove-files jstack_${newDatePortion}*${pid}.log
|
||||
# ensure any background threads have finished taring also
|
||||
wait
|
||||
cd ..
|
||||
tar -czf ${pidPath}.tgz --remove-files ${pidPath}/
|
||||
chmod g+w ${pidPath}.tgz
|
||||
rm -rf ${pidPath}
|
||||
echo -e "$pid not detected ... exiting"
|
||||
fi
|
||||
|
|
@ -761,7 +761,9 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
usersTreeViewer.refresh(element);
|
||||
if (usersTreeViewer.getControl().isDisposed() == false) {
|
||||
usersTreeViewer.refresh(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ import org.eclipse.swt.widgets.Menu;
|
|||
import org.eclipse.ui.IViewSite;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -213,10 +212,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
|
|||
});
|
||||
Menu menu = menuManager.createContextMenu(usersTable.getControl());
|
||||
usersTable.getControl().setMenu(menu);
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
.getActivePart().getSite()
|
||||
.registerContextMenu(menuManager, usersTable);
|
||||
usersTable.getTable().setMenu(menu);
|
||||
getSite().registerContextMenu(menuManager, usersTable);
|
||||
}
|
||||
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
|
|
|
@ -5,10 +5,11 @@ Bundle-SymbolicName: com.raytheon.uf.viz.cwat;singleton:=true
|
|||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.cwat.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.viz.core,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.time;bundle-version="1.11.1",
|
||||
com.raytheon.edex.common;bundle-version="1.11.1",
|
||||
org.geotools;bundle-version="2.5.2",
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
|||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.HDF5Util;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
|
@ -52,6 +51,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 15Mar2009 2037 dhladky Initial Creation.
|
||||
* Feb 28, 2013 1731 bsteffen Remove unneccessary query in
|
||||
* getDataStore.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -114,21 +115,7 @@ public class CWATResourceData extends AbstractRequestableResourceData {
|
|||
* @return
|
||||
*/
|
||||
private IDataStore getDataStore(CWATRecord record) {
|
||||
IDataStore dataStore = null;
|
||||
try {
|
||||
Map<String, Object> vals = new HashMap<String, Object>();
|
||||
vals.put("dataURI", record.getDataURI());
|
||||
vals.put("pluginName", record.getPluginName());
|
||||
|
||||
record = (CWATRecord) Loader.loadData(vals);
|
||||
|
||||
File loc = HDF5Util.findHDF5Location(record);
|
||||
dataStore = DataStoreFactory.getDataStore(loc);
|
||||
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return dataStore;
|
||||
File loc = HDF5Util.findHDF5Location(record);
|
||||
return DataStoreFactory.getDataStore(loc);
|
||||
}
|
||||
}
|
|
@ -20,8 +20,10 @@
|
|||
package com.raytheon.uf.viz.d2d.ui.dialogs;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -64,8 +66,6 @@ import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
import com.raytheon.uf.viz.d2d.ui.Activator;
|
||||
import com.raytheon.uf.viz.d2d.ui.map.actions.NewMapEditor;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
@ -78,7 +78,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* Jan. 29, 2013 15567 snaples Remove Orthographic projection from list temporarily
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -106,7 +106,7 @@ public class CreateProjectionDialog extends CaveJFACEDialog {
|
|||
}
|
||||
}
|
||||
|
||||
private Map<Parameter<?>, ParamUI> paramMap = new HashMap<Parameter<?>, ParamUI>();
|
||||
private final Map<Parameter<?>, ParamUI> paramMap = new HashMap<Parameter<?>, ParamUI>();
|
||||
|
||||
// private Composite paramComp;
|
||||
private Group paramGroup;
|
||||
|
@ -186,15 +186,32 @@ public class CreateProjectionDialog extends CaveJFACEDialog {
|
|||
|
||||
factory = new DefaultMathTransformFactory();
|
||||
Set<?> methods = factory.getAvailableMethods(Projection.class);
|
||||
//Removed for DR 15567
|
||||
// String[] projections = new String[methods.size()];
|
||||
|
||||
String[] projections = new String[methods.size()];
|
||||
int i = 0;
|
||||
//int i = 0;
|
||||
List<Object> prjj = new ArrayList<Object>();
|
||||
for (Object obj : methods) {
|
||||
if (obj instanceof MapProjection.AbstractProvider) {
|
||||
MapProjection.AbstractProvider prj = (MapProjection.AbstractProvider) obj;
|
||||
projections[i++] = prj.getName().getCode();
|
||||
// DR15567 Remove "Orthographic" projection temporarily
|
||||
String orthProj = prj.getName().getCode();
|
||||
if (orthProj == "Orthographic"){
|
||||
continue;
|
||||
} else {
|
||||
prjj.add(prj.getName().getCode());
|
||||
}
|
||||
//Put this back in when ready to revert the code
|
||||
//projections[i++] = prj.getName().getCode();
|
||||
}
|
||||
}
|
||||
// DR15567
|
||||
String[] projections = new String[prjj.size()];
|
||||
int j = 0;
|
||||
for (Object obj : prjj){
|
||||
projections[j++] = obj.toString();
|
||||
}
|
||||
// End of mods
|
||||
Arrays.sort(projections);
|
||||
|
||||
new Label(projComp, SWT.NONE).setText("Projection:");
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ffmp;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* A data container that holds the site's FFMPSourceData for each source.
|
||||
|
@ -33,6 +33,7 @@ import java.util.Set;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 18, 2013 njensen Initial creation
|
||||
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -42,7 +43,7 @@ import java.util.Set;
|
|||
|
||||
public class FFMPSiteData {
|
||||
|
||||
private Map<String, FFMPSourceData> sourceMap = new HashMap<String, FFMPSourceData>();
|
||||
private ConcurrentMap<String, FFMPSourceData> sourceMap = new ConcurrentHashMap<String, FFMPSourceData>();
|
||||
|
||||
/**
|
||||
* Gets the data of the specified source
|
||||
|
@ -51,14 +52,17 @@ public class FFMPSiteData {
|
|||
* @return
|
||||
*/
|
||||
public FFMPSourceData getSourceData(String source) {
|
||||
FFMPSourceData sourceData = null;
|
||||
synchronized (sourceMap) {
|
||||
sourceData = sourceMap.get(source);
|
||||
if (sourceData == null) {
|
||||
sourceData = new FFMPSourceData();
|
||||
sourceMap.put(source, sourceData);
|
||||
|
||||
FFMPSourceData sourceData = sourceMap.get(source);
|
||||
|
||||
if (sourceData == null) {
|
||||
sourceData = new FFMPSourceData();
|
||||
FFMPSourceData previous = sourceMap.putIfAbsent(source, sourceData);
|
||||
if (previous != null) {
|
||||
return previous;
|
||||
}
|
||||
}
|
||||
|
||||
return sourceData;
|
||||
}
|
||||
|
||||
|
@ -69,7 +73,6 @@ public class FFMPSiteData {
|
|||
for (FFMPSourceData source : sourceMap.values()) {
|
||||
source.clear();
|
||||
}
|
||||
sourceMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
package com.raytheon.uf.viz.monitor.ffmp;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* FFMP data container that holds the FFMPSiteData for each site.
|
||||
|
@ -33,6 +33,7 @@ import java.util.Map;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 19, 2013 njensen Initial creation
|
||||
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -42,17 +43,20 @@ import java.util.Map;
|
|||
|
||||
public class FFMPSiteDataContainer {
|
||||
|
||||
private Map<String, FFMPSiteData> siteDataMap = new HashMap<String, FFMPSiteData>();
|
||||
private ConcurrentMap<String, FFMPSiteData> siteDataMap = new ConcurrentHashMap<String, FFMPSiteData>();
|
||||
|
||||
public FFMPSiteData get(String siteKey) {
|
||||
FFMPSiteData data = null;
|
||||
synchronized (siteDataMap) {
|
||||
data = siteDataMap.get(siteKey);
|
||||
if (data == null) {
|
||||
data = new FFMPSiteData();
|
||||
siteDataMap.put(siteKey, data);
|
||||
|
||||
FFMPSiteData data = siteDataMap.get(siteKey);
|
||||
|
||||
if (data == null) {
|
||||
data = new FFMPSiteData();
|
||||
FFMPSiteData previous = siteDataMap.putIfAbsent(siteKey, data);
|
||||
if (previous != null) {
|
||||
return previous;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -61,17 +65,13 @@ public class FFMPSiteDataContainer {
|
|||
for (FFMPSiteData data : vals) {
|
||||
data.clear();
|
||||
}
|
||||
synchronized (siteDataMap) {
|
||||
siteDataMap.clear();
|
||||
}
|
||||
|
||||
siteDataMap.clear();
|
||||
}
|
||||
|
||||
public FFMPSiteData removeSite(String siteKey) {
|
||||
FFMPSiteData data = null;
|
||||
synchronized (siteDataMap) {
|
||||
data = siteDataMap.remove(siteKey);
|
||||
}
|
||||
return data;
|
||||
|
||||
return siteDataMap.remove(siteKey);
|
||||
}
|
||||
|
||||
public boolean containsSite(String siteKey) {
|
||||
|
|
|
@ -21,10 +21,10 @@ package com.raytheon.uf.viz.monitor.ffmp;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentNavigableMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
|
@ -41,6 +41,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 18, 2013 njensen Initial creation
|
||||
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +59,7 @@ public class FFMPSourceData {
|
|||
private ConcurrentNavigableMap<Date, List<String>> availableUris = new ConcurrentSkipListMap<Date, List<String>>();
|
||||
|
||||
/** map of huc to list of loaded URIs **/
|
||||
private Map<String, List<String>> loadedUris = new HashMap<String, List<String>>();
|
||||
private ConcurrentMap<String, List<String>> loadedUris = new ConcurrentHashMap<String, List<String>>();
|
||||
|
||||
/**
|
||||
* Clears the data
|
||||
|
@ -67,9 +68,7 @@ public class FFMPSourceData {
|
|||
ffmpData = null;
|
||||
previousUriQueryDate = null;
|
||||
availableUris.clear();
|
||||
synchronized (loadedUris) {
|
||||
loadedUris.clear();
|
||||
}
|
||||
loadedUris.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,14 +116,17 @@ public class FFMPSourceData {
|
|||
* @return
|
||||
*/
|
||||
public List<String> getLoadedUris(String huc) {
|
||||
List<String> loaded = null;
|
||||
synchronized (loadedUris) {
|
||||
loaded = loadedUris.get(huc);
|
||||
if (loaded == null) {
|
||||
loaded = new ArrayList<String>();
|
||||
loadedUris.put(huc, loaded);
|
||||
|
||||
List<String> loaded = loadedUris.get(huc);
|
||||
|
||||
if (loaded == null) {
|
||||
loaded = new ArrayList<String>();
|
||||
List<String> previous = loadedUris.putIfAbsent(huc, loaded);
|
||||
if (previous != null) {
|
||||
return previous;
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
@ -135,14 +137,18 @@ public class FFMPSourceData {
|
|||
* @param uri
|
||||
*/
|
||||
public void addLoadedUri(String huc, String uri) {
|
||||
synchronized (loadedUris) {
|
||||
List<String> uriList = loadedUris.get(huc);
|
||||
if (uriList == null) {
|
||||
uriList = new ArrayList<String>();
|
||||
loadedUris.put(huc, uriList);
|
||||
|
||||
List<String> uriList = loadedUris.get(huc);
|
||||
|
||||
if (uriList == null) {
|
||||
uriList = new ArrayList<String>();
|
||||
List<String> previous = loadedUris.putIfAbsent(huc, uriList);
|
||||
if (previous != null) {
|
||||
uriList = previous;
|
||||
}
|
||||
uriList.add(uri);
|
||||
}
|
||||
|
||||
uriList.add(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +157,7 @@ public class FFMPSourceData {
|
|||
* @return
|
||||
*/
|
||||
public boolean hasLoadedAnyUris() {
|
||||
return (loadedUris.size() > 0);
|
||||
return !loadedUris.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,6 +65,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||
|
@ -113,6 +114,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Changes for non-blocking LoadSaveConfigDlg.
|
||||
* Jan 23, 2013 14907 gzhang GUID not in Thresholds menu even ColorCell true
|
||||
* Feb 10, 2013 1584 mpduff Add performance logging.
|
||||
* Feb 28, 2013 1729 dhladky Adjusted the way in which the dialog load thread rejoins the main GUI thread.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -264,6 +266,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
private String previousHuc;
|
||||
|
||||
private FFMPLoaderStatus loadStatus;
|
||||
|
||||
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
|
||||
FFMPResource resource) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
|
||||
|
@ -1739,11 +1743,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
ffmpTable
|
||||
.setCenteredAggregationKey(resource.centeredAggregationKey);
|
||||
ffmpTable.setTableData(mainTableData);
|
||||
|
||||
resetCursor();
|
||||
shell.pack();
|
||||
shell.redraw();
|
||||
|
||||
if (loadEvent != null) {
|
||||
StatsCollector.stop(initialLoadKey);
|
||||
loadEvent = null;
|
||||
|
@ -2085,14 +2087,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
public void updateLoadingLabel(FFMPLoaderStatus status) {
|
||||
this.loadStatus = status;
|
||||
|
||||
if (dataLoadComp == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GridData gd = (GridData) dataLoadComp.getLayoutData();
|
||||
|
||||
// System.out.println("Status message...");
|
||||
|
||||
if (gd.exclude == true) {
|
||||
((GridData) dataLoadComp.getLayoutData()).exclude = false;
|
||||
dataLoadComp.setVisible(true);
|
||||
|
@ -2120,8 +2122,6 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
dataLoadComp.setVisible(false);
|
||||
shell.pack();
|
||||
}
|
||||
|
||||
resource.manageLoaders(status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2191,7 +2191,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
if (!this.isDisposed()) {
|
||||
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processUpdate(fupdateData);
|
||||
|
@ -2227,6 +2227,11 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
updateGapValueLabel(fupdateData.getGapValueLabel());
|
||||
|
||||
resetCursor();
|
||||
|
||||
// start tertiary loader if not run yet
|
||||
if (loadStatus != null) {
|
||||
resource.manageLoaders(loadStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,6 +69,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
|
|||
* Feb 1, 2013 DR 1569 dhladky Switched to using pypies records instead of files
|
||||
* Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord
|
||||
* feb 20, 2013 1635 dhladky Fixed multi guidance displays
|
||||
* Feb 28, 2013 1729 dhladky General enhancements for speed.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -180,7 +181,9 @@ public class FFMPDataGenerator {
|
|||
tData = new FFMPTableData();
|
||||
|
||||
try {
|
||||
|
||||
FIELDS field = getBaseField();
|
||||
|
||||
if (field != null) {
|
||||
if (baseRec != null) {
|
||||
FFMPBasinData fbd = null;
|
||||
|
@ -190,7 +193,7 @@ public class FFMPDataGenerator {
|
|||
fbd = baseRec.getBasinData(huc);
|
||||
}
|
||||
|
||||
if (fbd.getBasins().size() > 0) {
|
||||
if (!fbd.getBasins().isEmpty()) {
|
||||
if ((centeredAggregationKey == null) || huc.equals(ALL)) {
|
||||
// System.out.println(fbd.getBasins().keySet().size()
|
||||
// + " rows in the table");
|
||||
|
@ -200,18 +203,19 @@ public class FFMPDataGenerator {
|
|||
|
||||
FFMPBasinMetaData fmdb = ft.getBasin(
|
||||
siteKey, key);
|
||||
String cwa = domain.getCwa();
|
||||
|
||||
if (fmdb == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((domain.getCwa().equals(fmdb
|
||||
if ((cwa.equals(fmdb
|
||||
.getCwa()))
|
||||
|| (domain.isPrimary() && fmdb
|
||||
.isPrimaryCwa())) {
|
||||
|
||||
setFFMPRow(fbd.get(key), tData,
|
||||
false, domain.getCwa());
|
||||
false, cwa);
|
||||
|
||||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
|
@ -243,7 +247,7 @@ public class FFMPDataGenerator {
|
|||
isVGB = true;
|
||||
}
|
||||
|
||||
if (pfafs.size() > 0) {
|
||||
if (!pfafs.isEmpty()) {
|
||||
|
||||
FFMPBasinMetaData fmdb = ft
|
||||
.getBasinInDomains(siteKey,
|
||||
|
@ -295,13 +299,12 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
tData.sortData();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to load FFMP table data!", e);
|
||||
}
|
||||
|
||||
return tData;
|
||||
|
@ -344,10 +347,12 @@ public class FFMPDataGenerator {
|
|||
|
||||
rowField = FIELDS.VIRTUAL;
|
||||
|
||||
displayName = ((FFMPVirtualGageBasin) cBasin).getLid();
|
||||
|
||||
String lid = ((FFMPVirtualGageBasin) cBasin).getLid();
|
||||
|
||||
if (displayName != null) {
|
||||
if (lid != null) {
|
||||
|
||||
StringBuilder sb = new StringBuilder(lid);
|
||||
// in this special case it is actually the LID
|
||||
trd.setPfaf(((FFMPVirtualGageBasin) cBasin).getLid());
|
||||
FFMPVirtualGageBasinMetaData fvgmbd = ft
|
||||
|
@ -358,21 +363,22 @@ public class FFMPDataGenerator {
|
|||
Long parentBasinPfaf = fvgmbd.getParentPfaf();
|
||||
|
||||
if (fvgmbd != null) {
|
||||
|
||||
mouseOverText = metabasin.getBasinId() + "\n"
|
||||
+ fvgmbd.getLid() + "-" + fvgmbd.getName();
|
||||
|
||||
if (!huc.equals(ALL)) {
|
||||
displayName += "-" + fvgmbd.getName();
|
||||
sb.append("-").append(fvgmbd.getName());
|
||||
}
|
||||
}
|
||||
|
||||
trd.setTableCellData(0, new FFMPTableCellData(rowField,
|
||||
displayName, mouseOverText));
|
||||
sb.toString(), mouseOverText));
|
||||
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
|
||||
if (cBasin.getValues().size() > 0) {
|
||||
if (!cBasin.getValues().isEmpty()) {
|
||||
rate = ((FFMPVirtualGageBasin) cBasin)
|
||||
.getValue(paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
|
@ -381,7 +387,7 @@ public class FFMPDataGenerator {
|
|||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, Float.NaN));
|
||||
}
|
||||
if (cBasin.getValues().size() > 0) {
|
||||
if (!cBasin.getValues().isEmpty()) {
|
||||
|
||||
if (sliderTime > 0.00) {
|
||||
qpe = cBasin.getAccumValue(monitor.getQpeWindow()
|
||||
|
@ -460,7 +466,7 @@ public class FFMPDataGenerator {
|
|||
forced = forceUtil.isForced();
|
||||
}
|
||||
|
||||
if (((forcedPfafs.size() > 1)) && forced) {
|
||||
if ((!forcedPfafs.isEmpty()) && forced) {
|
||||
// Recalculate the guidance using the forced
|
||||
// value(s)
|
||||
guidance = guidRecords
|
||||
|
@ -473,7 +479,7 @@ public class FFMPDataGenerator {
|
|||
guidance,
|
||||
forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
} else if (forcedPfafs.size() > 1) {
|
||||
} else if (!forcedPfafs.isEmpty()) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData(ALL)
|
||||
|
@ -485,7 +491,7 @@ public class FFMPDataGenerator {
|
|||
forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
forced = true;
|
||||
} else if (pfafList.size() > 1) {
|
||||
} else if (!pfafList.isEmpty()) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData(ALL)
|
||||
|
@ -543,10 +549,12 @@ public class FFMPDataGenerator {
|
|||
displayName = getDisplayName(cBasin);
|
||||
|
||||
if (displayName != null) {
|
||||
trd.setPfaf(cBasin.getPfaf().toString());
|
||||
String cbasinPfaf = cBasin.getPfaf().toString();
|
||||
StringBuilder sb = new StringBuilder(cbasinPfaf);
|
||||
sb.append(cbasinPfaf).append("\n").append(displayName);
|
||||
trd.setPfaf(cbasinPfaf);
|
||||
trd.setTableCellData(0, new FFMPTableCellData(rowField,
|
||||
displayName, cBasin.getPfaf().toString() + "\n"
|
||||
+ displayName));
|
||||
displayName, sb.toString()));
|
||||
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
|
@ -635,7 +643,7 @@ public class FFMPDataGenerator {
|
|||
forced = forceUtil.isForced();
|
||||
}
|
||||
|
||||
if (((forcedPfafs.size() > 1)) && forced) {
|
||||
if ((!forcedPfafs.isEmpty()) && forced) {
|
||||
// Recalculate the guidance using the forced
|
||||
// value(s)
|
||||
guidance = guidRecords
|
||||
|
@ -648,7 +656,7 @@ public class FFMPDataGenerator {
|
|||
guidance,
|
||||
forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
} else if (forcedPfafs.size() > 1) {
|
||||
} else if (!forcedPfafs.isEmpty()) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData(ALL)
|
||||
|
@ -660,7 +668,7 @@ public class FFMPDataGenerator {
|
|||
forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
forced = true;
|
||||
} else if (pfafList.size() > 1) {
|
||||
} else if (!pfafList.isEmpty()) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData(ALL)
|
||||
|
@ -671,7 +679,7 @@ public class FFMPDataGenerator {
|
|||
Float.NaN,
|
||||
forcedPfafs,
|
||||
resource.getGuidSourceExpiration(guidType));
|
||||
if (forcedPfafs.size() > 0) {
|
||||
if (!forcedPfafs.isEmpty()) {
|
||||
forced = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -803,7 +811,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
|
||||
siteKey, huc);
|
||||
if (pfafs.size() > 0) {
|
||||
if (!pfafs.isEmpty()) {
|
||||
if (huc.equals("COUNTY")) {
|
||||
name = ft.getCountyStateName(siteKey, basin.getPfaf());
|
||||
} else {
|
||||
|
@ -846,7 +854,7 @@ public class FFMPDataGenerator {
|
|||
Float qpf = Float.NaN;
|
||||
|
||||
if (cBasin instanceof FFMPVirtualGageBasin) {
|
||||
if (pfafs.size() == 0) {
|
||||
if (!pfafs.isEmpty()) {
|
||||
if (virtualBasin != null) {
|
||||
trd.setTableCellData(
|
||||
1,
|
||||
|
@ -911,7 +919,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null)
|
||||
&& (forcedPfafs.size() > 0)) {
|
||||
&& (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
@ -944,7 +952,7 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
|
||||
} else {
|
||||
if (pfafs.size() > 0) {
|
||||
if (!pfafs.isEmpty()) {
|
||||
if (rateBasin != null) {
|
||||
rate = rateBasin.getMaxValue(pfafs, paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
|
@ -988,7 +996,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
List<Long> pfafList = new ArrayList<Long>();
|
||||
if ((guidBasin != null)
|
||||
&& (guidBasin.getBasins().size() > 0)) {
|
||||
&& (!guidBasin.getBasins().isEmpty())) {
|
||||
if (cBasin.getAggregated()) {
|
||||
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
|
||||
siteKey, huc);
|
||||
|
@ -1008,7 +1016,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null)
|
||||
&& (forcedPfafs.size() > 0)) {
|
||||
&& (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
@ -1050,8 +1058,8 @@ public class FFMPDataGenerator {
|
|||
resource.getGuidSourceExpiration(guidType));
|
||||
}
|
||||
|
||||
if ((qpes.size() > 0)
|
||||
&& ((guids != null) && (guids.size() > 0))) {
|
||||
if ((!qpes.isEmpty())
|
||||
&& ((guids != null) && (!guids.isEmpty()))) {
|
||||
|
||||
trd.setTableCellData(
|
||||
i + 5,
|
||||
|
@ -1144,7 +1152,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
if (!forced) {
|
||||
if ((forcedPfafs != null)
|
||||
&& (forcedPfafs.size() > 0)) {
|
||||
&& (!forcedPfafs.isEmpty())) {
|
||||
forced = true;
|
||||
}
|
||||
}
|
||||
|
@ -1250,14 +1258,14 @@ public class FFMPDataGenerator {
|
|||
try {
|
||||
if (rateRecord != null) {
|
||||
rateBasin = rateRecord.getBasinData(localHuc);
|
||||
if (rateBasin.getBasins().size() > 0) {
|
||||
if (!rateBasin.getBasins().isEmpty()) {
|
||||
field = FIELDS.RATE;
|
||||
baseRec = rateRecord;
|
||||
}
|
||||
}
|
||||
if (qpeRecord != null) {
|
||||
qpeBasin = qpeRecord.getBasinData(localHuc);
|
||||
if (qpeBasin.getBasins().size() > 0) {
|
||||
if (!qpeBasin.getBasins().isEmpty()) {
|
||||
field = FIELDS.QPE;
|
||||
if (baseRec == null) {
|
||||
baseRec = qpeRecord;
|
||||
|
@ -1285,7 +1293,7 @@ public class FFMPDataGenerator {
|
|||
// Get interpolators
|
||||
HashMap<String, FFMPGuidanceInterpolation> interpolators = resource
|
||||
.getGuidanceInterpolators();
|
||||
if ((forceUtils == null) || (forceUtils.size() == 0)) {
|
||||
if ((forceUtils == null) || (forceUtils.isEmpty())) {
|
||||
forceUtils = new HashMap<String, FFFGForceUtil>();
|
||||
|
||||
for (String guidType : interpolators.keySet()) {
|
||||
|
|
|
@ -45,7 +45,6 @@ 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.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoadListener;
|
||||
|
@ -64,6 +63,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
|
|||
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
|
||||
* 01/27/13 1478 D. Hladky revamped the cache file format to help NAS overloading
|
||||
* 02/01/13 1569 D. Hladky Changed to reading aggregate records from pypies
|
||||
* Feb 28, 2013 1729 dhladky Changed the way status messages are sent to the FFMP Dialog.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -385,6 +385,9 @@ public class FFMPDataLoader extends Thread {
|
|||
statusHandler.handle(Priority.PROBLEM,"General Problem in Loading FFMP Data", e);
|
||||
} finally {
|
||||
isDone = true;
|
||||
synchronized(this) {
|
||||
this.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
String message = null;
|
||||
|
@ -396,7 +399,6 @@ public class FFMPDataLoader extends Thread {
|
|||
|
||||
long endTime = (System.currentTimeMillis()) - time;
|
||||
System.out.println(loadType.loaderType + " Loader took: " + endTime / 1000 + " seconds");
|
||||
|
||||
fireLoaderEvent(loadType, message, isDone);
|
||||
}
|
||||
|
||||
|
@ -408,28 +410,23 @@ public class FFMPDataLoader extends Thread {
|
|||
public void fireLoaderEvent(LOADER_TYPE ltype, String lmessage,
|
||||
boolean lstatus) {
|
||||
|
||||
final FFMPLoaderStatus sstatus = new FFMPLoaderStatus(ltype, lmessage,
|
||||
FFMPLoaderStatus sstatus = new FFMPLoaderStatus(ltype, lmessage,
|
||||
lstatus);
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
public void run() {
|
||||
FFMPLoaderEvent fle = new FFMPLoaderEvent(sstatus);
|
||||
Iterator<FFMPLoadListener> iter = loadListeners.iterator();
|
||||
FFMPLoaderEvent fle = new FFMPLoaderEvent(sstatus);
|
||||
Iterator<FFMPLoadListener> iter = loadListeners.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
FFMPLoadListener listener = iter.next();
|
||||
listener.loadStatus(fle);
|
||||
}
|
||||
|
||||
while (iter.hasNext()) {
|
||||
FFMPLoadListener listener = iter.next();
|
||||
listener.loadStatus(fle);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private FFMPMonitor getMonitor() {
|
||||
if (FFMPMonitor.isRunning()) {
|
||||
// System.out.println("Monitor is running...");
|
||||
return FFMPMonitor.getInstance();
|
||||
} else {
|
||||
// System.out.println("Monitor is dead...");
|
||||
isDone = true;
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* 10 Feb 2013 1584 mpduff Add performance logging.
|
||||
* Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord
|
||||
* Feb 20, 2013 1635 dhladky Fixed multiple guidance display
|
||||
* Feb 28, 2013 1729 dhladky Changed the way the loaders are managed via the status updates.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -476,9 +477,12 @@ public class FFMPResource extends
|
|||
} else {
|
||||
while (!loader.isDone) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
synchronized (loader) {
|
||||
loader.wait(1000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Data Loader thread interrupted, dying!", e);
|
||||
}
|
||||
}
|
||||
startLoader(previousMostRecentTime, ffmpRec
|
||||
|
@ -488,9 +492,12 @@ public class FFMPResource extends
|
|||
|
||||
while (!loader.isDone) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
synchronized (loader) {
|
||||
loader.wait();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Data Loader thread interrupted, dying!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4182,8 +4189,16 @@ public class FFMPResource extends
|
|||
if (basinTableDlg != null) {
|
||||
// call to update the basin table dialog
|
||||
if (event.getSource() instanceof FFMPLoaderStatus) {
|
||||
FFMPLoaderStatus status = (FFMPLoaderStatus) event.getSource();
|
||||
basinTableDlg.updateLoadingLabel(status);
|
||||
final FFMPLoaderStatus status = (FFMPLoaderStatus) event
|
||||
.getSource();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
public void run() {
|
||||
if (basinTableDlg != null
|
||||
&& !basinTableDlg.isDisposed()) {
|
||||
basinTableDlg.updateLoadingLabel(status);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4366,14 +4381,13 @@ public class FFMPResource extends
|
|||
- (6 * TimeUtil.MILLIS_PER_HOUR));
|
||||
FFMPMonitor.getInstance().startLoad(this, startDate,
|
||||
LOADER_TYPE.TERTIARY);
|
||||
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Secondary Data Load failure", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We don't really care about status of tertiary and general loaders
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
|||
* 29 June, 2009 2521 dhladky Initial creation
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* Feb 10, 2013 1584 mpduff Add performance logging.
|
||||
* Feb 28, 2013 1729 dhladky Got rid of thread sleeps
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -204,11 +205,15 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
"Failed to read template in allotted time");
|
||||
break;
|
||||
}
|
||||
Thread.sleep(50);
|
||||
if (floader != null) {
|
||||
synchronized (floader) {
|
||||
floader.wait(1000);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Data Loader thread interrupted, dying!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,10 +269,13 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
"Didn't load initial data in allotted time, releasing table");
|
||||
break;
|
||||
}
|
||||
Thread.sleep(30);
|
||||
synchronized (loader) {
|
||||
loader.wait(1000);
|
||||
}
|
||||
i++;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Data Loader thread interrupted, dying!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
|
|||
* Oct 13, 2011 dhladky Initial creation.
|
||||
* Jul 31, 2012 14517 mpduff Fix for Rapid slider changes
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* Feb 28, 2013 1729 dhladky Removed un-necessary logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -150,6 +151,9 @@ public class FFMPTableDataLoader extends Thread {
|
|||
FFMPDataGenerator dg = new FFMPDataGenerator(
|
||||
ffmp, resource);
|
||||
tData = dg.generateFFMPData();
|
||||
|
||||
|
||||
|
||||
drawable.setTableData(iHuc, tData);
|
||||
drawable.setDrawTime(origDrawTime);
|
||||
}
|
||||
|
@ -163,7 +167,6 @@ public class FFMPTableDataLoader extends Thread {
|
|||
// multiple table cells
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"No Data available...");
|
||||
System.err.println("NO Data Available...");
|
||||
}
|
||||
|
||||
if (tData != null) {
|
||||
|
@ -210,7 +213,6 @@ public class FFMPTableDataLoader extends Thread {
|
|||
tableDataUpdate.setSourceUpdate(sourceUpdate);
|
||||
|
||||
isDone = true;
|
||||
|
||||
callback.tableDataUpdateComplete(tableDataUpdate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,13 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Scan Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.uf.viz.monitor.scan;singleton:=true
|
||||
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core, com.raytheon.viz.ui, com.raytheon.edex.common, com.raytheon.uf.common.serialization
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.monitor.scan.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.monitor;bundle-version="1.0.0",
|
||||
com.raytheon.viz.core;bundle-version="1.10.13",
|
||||
com.raytheon.viz.alerts;bundle-version="1.10.13",
|
||||
|
|
|
@ -80,6 +80,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Oct 13, 2009 dhladky Initial creation
|
||||
*
|
||||
* Jul 24 2012 12996 Xiaochuan Compare with MidVal()
|
||||
* Feb 28, 2013 1731 bsteffen Allow ScanResource to work better with
|
||||
* D2DTimeMatcher.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1105,7 +1107,8 @@ public class ScanResource extends
|
|||
public void addRecord(ScanRecord newrecord) {
|
||||
try {
|
||||
if (!getScan().getTimeOrderedKeys(getScan(), newrecord.getType(),
|
||||
resourceData.icao).contains(newrecord.getDataTime())) {
|
||||
resourceData.icao).contains(
|
||||
newrecord.getDataTime().getRefTime())) {
|
||||
|
||||
newrecord = resourceData.populateRecord(newrecord);
|
||||
|
||||
|
@ -1164,4 +1167,16 @@ public class ScanResource extends
|
|||
return oldDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataTime[] getDataTimes() {
|
||||
ScanMonitor scan = getScan();
|
||||
List<Date> dates = scan.getTimeOrderedKeys(scan,
|
||||
resourceData.tableType, resourceData.icao);
|
||||
DataTime[] dataTimes = new DataTime[dates.size()];
|
||||
for (int i = 0; i < dataTimes.length; i += 1) {
|
||||
dataTimes[i] = new DataTime(dates.get(i));
|
||||
}
|
||||
return dataTimes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,10 +22,15 @@ package com.raytheon.uf.viz.monitor.scan.resource;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -34,13 +39,20 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.scan.ScanRecord;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.HDF5Util;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
@ -55,6 +67,7 @@ import com.raytheon.uf.viz.monitor.scan.ScanMonitor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 13, 2009 dhladky Initial creation
|
||||
* Feb 28, 2013 1731 bsteffen Optimize construction of scan resource.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,41 +107,41 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
try {
|
||||
long t0 = System.currentTimeMillis();
|
||||
// Forces ScanMonitor to grab data back for one extra hour 1/2 past
|
||||
// the
|
||||
// first time.
|
||||
long first = ((ScanRecord) objects[0]).getDataTime().getRefTime()
|
||||
.getTime()
|
||||
- (3600 * 1500);
|
||||
Date firstDate = new Date(first);
|
||||
// the first time.
|
||||
Calendar firstCal = ((ScanRecord) objects[0]).getDataTime()
|
||||
.getRefTimeAsCalendar();
|
||||
firstCal.add(Calendar.MINUTE, -90);
|
||||
Date firstDate = firstCal.getTime();
|
||||
int count = 0;
|
||||
List<String> urisToLoad = new ArrayList<String>(uris.size());
|
||||
for (String uri : uris) {
|
||||
ScanRecord record = getScanRecord(uri);
|
||||
if (record != null) {
|
||||
if (record.getDataTime().getRefTime().after(firstDate)) {
|
||||
record = populateRecord(record);
|
||||
if ((record.getTableData() != null)
|
||||
&& (record.getDataTime() != null)
|
||||
&& (record.getTableData().getVolScanTime() != null)) {
|
||||
ScanRecord record = new ScanRecord(uri);
|
||||
if (record.getDataTime().getRefTime().after(firstDate)) {
|
||||
urisToLoad.add(uri);
|
||||
}
|
||||
}
|
||||
ScanRecord[] records = getScanRecords(urisToLoad);
|
||||
populateRecords(records);
|
||||
for (ScanRecord record : records) {
|
||||
if ((record.getTableData() != null)
|
||||
&& (record.getDataTime() != null)
|
||||
&& (record.getTableData().getVolScanTime() != null)) {
|
||||
|
||||
getScan().setTableData(icao, record.getTableData(),
|
||||
/*
|
||||
* TODO: This should be the volume scan time, but
|
||||
* {Radar,Scan}Record.getVolScanTime is actually the
|
||||
* radar product generation time.
|
||||
*/
|
||||
record.getDataTime().getRefTime(),
|
||||
record.getTilt(),
|
||||
record.getDataTime().getRefTime(),
|
||||
tableType);
|
||||
count++;
|
||||
getScan().setTableData(icao, record.getTableData(),
|
||||
/*
|
||||
* TODO: This should be the volume scan time, but
|
||||
* {Radar,Scan}Record.getVolScanTime is actually the radar
|
||||
* product generation time.
|
||||
*/
|
||||
record.getDataTime().getRefTime(), record.getTilt(),
|
||||
record.getDataTime().getRefTime(), tableType);
|
||||
count++;
|
||||
|
||||
if (record.getType().equals(ScanTables.DMD.name())) {
|
||||
if (dataObjectMap == null) {
|
||||
dataObjectMap = new HashMap<DataTime, ScanRecord>();
|
||||
}
|
||||
dataObjectMap.put(record.getDataTime(), record);
|
||||
}
|
||||
if (record.getType().equals(ScanTables.DMD.name())) {
|
||||
if (dataObjectMap == null) {
|
||||
dataObjectMap = new HashMap<DataTime, ScanRecord>();
|
||||
}
|
||||
dataObjectMap.put(record.getDataTime(), record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +166,7 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
}
|
||||
|
||||
System.out
|
||||
.println("Loaded " + count + " out of " + objects.length
|
||||
.println("Loaded " + count + " out of " + uris.size()
|
||||
+ " objects in "
|
||||
+ (System.currentTimeMillis() - t0) + "ms");
|
||||
// need to update the dialog here after the
|
||||
|
@ -187,34 +200,47 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
* @param record
|
||||
*/
|
||||
public ScanRecord populateRecord(ScanRecord record) throws VizException {
|
||||
IDataStore dataStore = getDataStore(record);
|
||||
record.retrieveMapFromDataStore(dataStore);
|
||||
populateRecords(new ScanRecord[] { record });
|
||||
return record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data store
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
private IDataStore getDataStore(ScanRecord record) {
|
||||
IDataStore dataStore = null;
|
||||
try {
|
||||
Map<String, Object> vals = new HashMap<String, Object>();
|
||||
vals.put("dataURI", record.getDataURI());
|
||||
vals.put("pluginName", record.getPluginName());
|
||||
|
||||
record = (ScanRecord) Loader.loadData(vals);
|
||||
|
||||
public void populateRecords(ScanRecord[] records) throws VizException {
|
||||
Map<File, Set<ScanRecord>> fileMap = new HashMap<File, Set<ScanRecord>>();
|
||||
for (ScanRecord record : records) {
|
||||
record.setPluginName("scan");
|
||||
File loc = HDF5Util.findHDF5Location(record);
|
||||
dataStore = DataStoreFactory.getDataStore(loc);
|
||||
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
Set<ScanRecord> recordSet = fileMap.get(loc);
|
||||
if (recordSet == null) {
|
||||
recordSet = new HashSet<ScanRecord>();
|
||||
fileMap.put(loc, recordSet);
|
||||
}
|
||||
recordSet.add(record);
|
||||
}
|
||||
for (Entry<File, Set<ScanRecord>> fileEntry : fileMap.entrySet()) {
|
||||
IDataStore dataStore = DataStoreFactory.getDataStore(fileEntry
|
||||
.getKey());
|
||||
|
||||
return dataStore;
|
||||
String[] datasetGroupPath = new String[fileEntry.getValue().size()];
|
||||
ScanRecord[] scanRecords = new ScanRecord[datasetGroupPath.length];
|
||||
int i = 0;
|
||||
for (ScanRecord record : fileEntry.getValue()) {
|
||||
datasetGroupPath[i] = record.getDataURI()
|
||||
+ DataStoreFactory.DEF_SEPARATOR + record.getType();
|
||||
scanRecords[i] = record;
|
||||
i += 1;
|
||||
}
|
||||
try {
|
||||
IDataRecord[] dataRecords = dataStore.retrieveDatasets(
|
||||
datasetGroupPath,
|
||||
Request.ALL);
|
||||
for (i = 0; i < dataRecords.length; i += 1) {
|
||||
ByteDataRecord byteData = (ByteDataRecord) dataRecords[i];
|
||||
scanRecords[i].setTableData(byteData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new VizException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create the monitor instance
|
||||
|
@ -261,22 +287,16 @@ public class ScanResourceData extends AbstractRequestableResourceData {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available record
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
private ScanRecord getScanRecord(String uri) {
|
||||
Map<String, Object> vals = new HashMap<String, Object>();
|
||||
vals.put("pluginName", "scan");
|
||||
vals.put("dataURI", uri);
|
||||
try {
|
||||
return (ScanRecord) Loader.loadData(vals);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
private ScanRecord[] getScanRecords(Collection<String> uris)
|
||||
throws VizException {
|
||||
DbQueryRequest request = new DbQueryRequest();
|
||||
request.setEntityClass(ScanRecord.class);
|
||||
RequestConstraint rc = new RequestConstraint(null, ConstraintType.IN);
|
||||
rc.setConstraintValueList(uris);
|
||||
request.addConstraint("dataURI", rc);
|
||||
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||
.sendRequest(request);
|
||||
return response.getEntityObjects(ScanRecord.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
|||
* Dec. 3, 2009 3424 zhao Initial creation.
|
||||
* Jan 25, 2010 4281 wkwock/Zhao Added history-table-row-data related modules
|
||||
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
|
||||
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -752,13 +753,26 @@ public final class TableUtil {
|
|||
|
||||
String presentWx = report.getPresentWx();
|
||||
|
||||
CellType windSpeed = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), report.getWindSpeed());
|
||||
CellType windSpeed = CellType.NotAvailable;
|
||||
if ( report.getWindSpeed() != ObConst.MISSING ) {
|
||||
windSpeed = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), report.getWindSpeed());
|
||||
}
|
||||
|
||||
CellType peakWind = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), report.getMaxWindSpeed());
|
||||
CellType peakWind = CellType.NotAvailable;
|
||||
if ( report.getMaxWindSpeed() != ObConst.MISSING ) {
|
||||
peakWind = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), report.getMaxWindSpeed());
|
||||
}
|
||||
|
||||
CellType windGust = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), report.getWindGust());
|
||||
CellType windGust = CellType.NotAvailable;
|
||||
if ( report.getWindGust() != ObConst.MISSING ) {
|
||||
windGust = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), report.getWindGust());
|
||||
}
|
||||
|
||||
CellType visibility = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), report.getVisibility());
|
||||
CellType visibility = CellType.NotAvailable;
|
||||
if ( report.getVisibility() != ObConst.MISSING ) {
|
||||
// vis in units of "miles/16" is used to compare with Red/Yellow threshold values
|
||||
visibility = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), report.getVisibility()*16.0f);
|
||||
}
|
||||
|
||||
if ( presentWx.contains("SN") || presentWx.contains("BLSN") ) {
|
||||
// snow or blowing snow observed
|
||||
|
|
|
@ -10,6 +10,7 @@ bin.includes = META-INF/,\
|
|||
localization/,\
|
||||
images/,\
|
||||
help/,\
|
||||
OSGI-INF/component.xml
|
||||
OSGI-INF/component.xml,\
|
||||
res/
|
||||
source.. = src/,\
|
||||
tests/
|
||||
|
|
|
@ -29,7 +29,7 @@ package com.raytheon.viz.gfe.core;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 28, 2013 randerso Initial creation
|
||||
* Jan 28, 2013 #1597 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -39,9 +39,9 @@ package com.raytheon.viz.gfe.core;
|
|||
|
||||
public class GfeClientConfig {
|
||||
|
||||
private int maxSaveThreads;
|
||||
private int maxSaveThreads = 3;
|
||||
|
||||
private long gridSaveThreshold;
|
||||
private long gridSaveThreshold = 32 * 1024 * 1024; // 32 MB
|
||||
|
||||
private static final GfeClientConfig instance = new GfeClientConfig();
|
||||
|
||||
|
|
|
@ -688,8 +688,8 @@ public class ReferenceSetManager implements IReferenceSetManager,
|
|||
public void setActiveRefSet(final ReferenceData refData) {
|
||||
refData.getGrid(); // force it to a grid
|
||||
|
||||
statusHandler.handle(Priority.VERBOSE, "PrevActiveSet = "
|
||||
+ activeRefSet.getId());
|
||||
// statusHandler.handle(Priority.VERBOSE, "PrevActiveSet = "
|
||||
// + activeRefSet.getId());
|
||||
// turn on wait cursor
|
||||
setCursor(0);
|
||||
|
||||
|
@ -714,8 +714,8 @@ public class ReferenceSetManager implements IReferenceSetManager,
|
|||
|
||||
// turn off wait cursor
|
||||
setCursor(1);
|
||||
statusHandler.handle(Priority.VERBOSE,
|
||||
"NewActiveSet = " + activeRefSet.getId());
|
||||
// statusHandler.handle(Priority.VERBOSE,
|
||||
// "NewActiveSet = " + activeRefSet.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -68,7 +68,9 @@ import com.raytheon.uf.common.dataplugin.gfe.weather.WeatherKey;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.weather.WeatherSubKey;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.message.WsId;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
|
@ -187,6 +189,9 @@ public abstract class Parm implements Comparable<Parm> {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(Parm.class);
|
||||
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler("GFE:");
|
||||
|
||||
protected RWLArrayList<IGridData> grids;
|
||||
|
||||
protected ParmState parmState;
|
||||
|
@ -4323,6 +4328,8 @@ public abstract class Parm implements Comparable<Parm> {
|
|||
if (!quietMode) {
|
||||
statusHandler.handle(Priority.EVENTA, "Interpolation for "
|
||||
+ getParmID().getShortParmId() + " finished.");
|
||||
perfLog.log("Interpolation for " + getParmID().getShortParmId()
|
||||
+ " finished.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,9 @@ import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.server.request.CommitGridRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.request.LockRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.request.SendISCRequest;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
|
@ -93,6 +95,9 @@ public class ParmOp {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ParmOp.class);
|
||||
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler("GFE:");
|
||||
|
||||
private static final int MAX_CONCURRENT_JOBS = 5;
|
||||
|
||||
private IGridData copiedGrid;
|
||||
|
@ -388,7 +393,7 @@ public class ParmOp {
|
|||
*/
|
||||
public void interpolateSelected(InterpMode interpMode,
|
||||
InterpState interpState, int interval, int duration) {
|
||||
statusHandler.debug("Interpolation started");
|
||||
perfLog.log("Interpolation started");
|
||||
Parm[] allParms = this.dataManager.getParmManager().getAllParms();
|
||||
for (Parm parm : allParms) {
|
||||
if (parm.getParmState().isSelected() && parm.isMutable()) {
|
||||
|
|
|
@ -869,12 +869,15 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
public void jobFinished(final ReferenceData result) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
activeDisplay.setText(s);
|
||||
refSetMgr
|
||||
.incomingRefSet(result, RefSetMode.USE_CURRENT);
|
||||
addToHistory(s);
|
||||
queryField.setText("");
|
||||
if (result != null) {
|
||||
activeDisplay.setText(s);
|
||||
refSetMgr.incomingRefSet(result,
|
||||
RefSetMode.USE_CURRENT);
|
||||
addToHistory(s);
|
||||
queryField.setText("");
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -77,7 +77,8 @@ public class QueryScriptExecutor implements
|
|||
try {
|
||||
retVal = (ReferenceData) script.execute(methodName, args);
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.ERROR, "Unable to execute script", e);
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error evaluating edit area query: " + e.getMessage(), e);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,9 @@ import com.raytheon.viz.grid.util.RadarAdapter;
|
|||
* Mar 25, 2009 brockwoo Initial creation
|
||||
* Nov 20, 2009 #3387 jelkins Use derived script's variableId instead of filename
|
||||
* Nov 21, 2009 #3576 rjpeter Refactored use of DerivParamDesc.
|
||||
* Feb 26, 2013 1659 bsteffen Add time agnostic caching to grid derived
|
||||
* parameters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
|
@ -324,12 +327,32 @@ public class GridInventory extends AbstractInventory implements
|
|||
newQuery.remove(GridInventory.LEVEL_ONE_QUERY);
|
||||
newQuery.remove(GridInventory.LEVEL_TWO_QUERY);
|
||||
newQuery.remove(GridInventory.MASTER_LEVEL_QUERY);
|
||||
// Hopefully this results in querying all times for this model.
|
||||
DataTime[] times = CatalogQuery.performTimeQuery(newQuery, false,
|
||||
null);
|
||||
|
||||
String modelName = null;
|
||||
Collection<DataTime> times = null;
|
||||
if (newQuery.size() == 2 && newQuery.containsKey(PLUGIN_NAME_QUERY)
|
||||
&& newQuery.containsKey(MODEL_NAME_QUERY)) {
|
||||
// Only use the cache if the only constraint left are pluginName
|
||||
// and datasetId and datasetId is an Equals constraint. This is
|
||||
// almost always the case.
|
||||
RequestConstraint modelRc = newQuery.get(MODEL_NAME_QUERY);
|
||||
if (modelRc.getConstraintType() == ConstraintType.EQUALS) {
|
||||
modelName = modelRc.getConstraintValue();
|
||||
times = GridTimeCache.getInstance()
|
||||
.getModelTimes(modelName);
|
||||
}
|
||||
}
|
||||
if (times == null) {
|
||||
// This should query all times for this model.
|
||||
DataTime[] timesArray = CatalogQuery.performTimeQuery(newQuery,
|
||||
false, null);
|
||||
times = Arrays.asList(timesArray);
|
||||
if (modelName != null) {
|
||||
GridTimeCache.getInstance().setModelTimes(modelName,
|
||||
new HashSet<DataTime>(times));
|
||||
}
|
||||
}
|
||||
if (times != null) {
|
||||
rval = new ArrayList<DataTime>(Arrays.asList(times));
|
||||
rval = new ArrayList<DataTime>(times);
|
||||
}
|
||||
}
|
||||
if (processRadar) {
|
||||
|
|
|
@ -19,19 +19,22 @@
|
|||
**/
|
||||
package com.raytheon.viz.grid.inv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.derivparam.inv.TimeAndSpace;
|
||||
|
||||
/**
|
||||
* Cache times for GridRequestableNode's to avoid multiple trips to edex for the
|
||||
* same data. The hit rate tends to be low when requesting individual products
|
||||
* but can get very high when requesting complex derived parameters or model
|
||||
* families since often many of the derived parameters can have dependencies on
|
||||
* the same base parameters.
|
||||
* Cache times for grid data to avoid multiple trips to edex for the same data.
|
||||
* This caches times for GridRequestableNodes and also times for a whole model.
|
||||
* The hit rate tends to be low when requesting individual products but can get
|
||||
* very high when requesting complex derived parameters or model families since
|
||||
* often many of the derived parameters can have dependencies on the same base
|
||||
* parameters.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -39,6 +42,8 @@ import com.raytheon.uf.viz.derivparam.inv.TimeAndSpace;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 10, 2010 bsteffen Initial creation
|
||||
* Feb 26, 2013 1659 bsteffen Add time agnostic caching to grid derived
|
||||
* parameters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,16 +53,13 @@ import com.raytheon.uf.viz.derivparam.inv.TimeAndSpace;
|
|||
|
||||
public class GridTimeCache {
|
||||
|
||||
protected static final int CACHE_SIZE = 500;
|
||||
protected static final int CACHE_SIZE = 1000;
|
||||
|
||||
protected static final int CACHE_TIME = 300000;
|
||||
|
||||
private static GridTimeCache instance;
|
||||
private final static GridTimeCache instance = new GridTimeCache();
|
||||
|
||||
public static GridTimeCache getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new GridTimeCache();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -65,20 +67,23 @@ public class GridTimeCache {
|
|||
|
||||
}
|
||||
|
||||
private class CacheEntry {
|
||||
private class CacheEntry<T> {
|
||||
|
||||
public CacheEntry(Set<TimeAndSpace> times) {
|
||||
public CacheEntry(Set<T> times) {
|
||||
this.insertTime = System.currentTimeMillis();
|
||||
this.times = times;
|
||||
}
|
||||
|
||||
public long insertTime;
|
||||
public final long insertTime;
|
||||
|
||||
public Set<TimeAndSpace> times;
|
||||
public final Set<T> times;
|
||||
|
||||
}
|
||||
|
||||
private Map<GridMapKey, CacheEntry> cache = new LinkedHashMap<GridMapKey, CacheEntry>(
|
||||
/**
|
||||
* This map handles caching for GridRequestableNodes
|
||||
*/
|
||||
private final Map<GridMapKey, CacheEntry<TimeAndSpace>> cache = new LinkedHashMap<GridMapKey, CacheEntry<TimeAndSpace>>(
|
||||
135, .75f, true) {
|
||||
|
||||
private static final long serialVersionUID = 2022670836957170184L;
|
||||
|
@ -96,7 +101,8 @@ public class GridTimeCache {
|
|||
* @see java.util.LinkedHashMap#removeEldestEntry(java.util.Map.Entry)
|
||||
*/
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Entry<GridMapKey, CacheEntry> eldest) {
|
||||
protected boolean removeEldestEntry(
|
||||
Entry<GridMapKey, CacheEntry<TimeAndSpace>> eldest) {
|
||||
if (this.size() > CACHE_SIZE) {
|
||||
// It is normal for stale entries to stay in the map until this
|
||||
// purges them, but we want some logging for non stale entries.
|
||||
|
@ -120,31 +126,69 @@ public class GridTimeCache {
|
|||
}
|
||||
};
|
||||
|
||||
public synchronized void setTimes(GridRequestableNode gNode,
|
||||
Set<TimeAndSpace> times) {
|
||||
cache.put(new GridMapKey(gNode.getRequestConstraintMap()),
|
||||
new CacheEntry(times));
|
||||
/**
|
||||
* This is the cache for all times for a model.
|
||||
*/
|
||||
private final Map<String, CacheEntry<DataTime>> modelCache = new HashMap<String, CacheEntry<DataTime>>();
|
||||
|
||||
public void setTimes(GridRequestableNode gNode, Set<TimeAndSpace> times) {
|
||||
synchronized (cache) {
|
||||
cache.put(new GridMapKey(gNode.getRequestConstraintMap()),
|
||||
new CacheEntry<TimeAndSpace>(times));
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Set<TimeAndSpace> getTimes(GridRequestableNode gNode) {
|
||||
GridMapKey key = new GridMapKey(gNode.getRequestConstraintMap());
|
||||
CacheEntry entry = cache.get(key);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
public Set<TimeAndSpace> getTimes(GridRequestableNode gNode) {
|
||||
synchronized (cache) {
|
||||
GridMapKey key = new GridMapKey(gNode.getRequestConstraintMap());
|
||||
CacheEntry<TimeAndSpace> entry = cache.get(key);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
if (entry.insertTime + CACHE_TIME < System.currentTimeMillis()) {
|
||||
cache.remove(key);
|
||||
return null;
|
||||
}
|
||||
return entry.times;
|
||||
}
|
||||
if (entry.insertTime + CACHE_TIME < System.currentTimeMillis()) {
|
||||
cache.remove(key);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setModelTimes(String modelName, Set<DataTime> times) {
|
||||
synchronized (modelCache) {
|
||||
modelCache.put(modelName, new CacheEntry<DataTime>(times));
|
||||
}
|
||||
}
|
||||
|
||||
public Set<DataTime> getModelTimes(String modelName) {
|
||||
synchronized (modelCache) {
|
||||
CacheEntry<DataTime> entry = modelCache.get(modelName);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
if (entry.insertTime + CACHE_TIME < System.currentTimeMillis()) {
|
||||
modelCache.remove(modelName);
|
||||
return null;
|
||||
}
|
||||
return entry.times;
|
||||
}
|
||||
return entry.times;
|
||||
}
|
||||
|
||||
public synchronized void clearTimes(GridMapKey key) {
|
||||
cache.remove(key);
|
||||
synchronized (cache) {
|
||||
cache.remove(key);
|
||||
}
|
||||
synchronized (modelCache) {
|
||||
modelCache.remove(key.modelName);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void flush() {
|
||||
cache.clear();
|
||||
synchronized (cache) {
|
||||
cache.clear();
|
||||
}
|
||||
synchronized (modelCache) {
|
||||
modelCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
|
|||
* June 01 2011 9499 djingtao add dur in getGraphData()
|
||||
* July 25 2011 10082 djingtao modify edit()
|
||||
* May 30 2012 14967 wkwock overload insertRejectedData method
|
||||
* Feb 22 2013 14676 lbousaidi check when producttime is null
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -1101,7 +1102,7 @@ public class TimeSeriesDataManager extends HydroDataManager {
|
|||
sql.addString(
|
||||
"producttime",
|
||||
dateFormat.format(Calendar.getInstance(
|
||||
TimeZone.getTimeZone("GMT")).getTime()));
|
||||
TimeZone.getTimeZone("GMT")).getTime()));
|
||||
} else {
|
||||
sql.addString("producttime",
|
||||
dateFormat.format(data.getProductTime()));
|
||||
|
@ -1156,6 +1157,11 @@ public class TimeSeriesDataManager extends HydroDataManager {
|
|||
sql.setSqlType(SqlBuilder.UPDATE);
|
||||
sql.addDouble("value", data.getValue());
|
||||
sql.addString("postingTime", HydroConstants.DATE_FORMAT.format(now));
|
||||
if (data.getProductTime() == null) {
|
||||
sql.addString("producttime",
|
||||
HydroConstants.DATE_FORMAT.format(Calendar.getInstance(
|
||||
TimeZone.getTimeZone("GMT")).getTime()));
|
||||
}
|
||||
|
||||
StringBuilder where = new StringBuilder();
|
||||
where.append(" where lid = '" + data.getLid().toUpperCase() + "' ");
|
||||
|
@ -1177,6 +1183,11 @@ public class TimeSeriesDataManager extends HydroDataManager {
|
|||
|
||||
if (data.getValue() == HydroConstants.MISSING_VALUE) {
|
||||
DataRecord dr = new DataRecord();
|
||||
Date productTime=data.getProductTime();
|
||||
if (productTime==null) {
|
||||
productTime= now;
|
||||
}
|
||||
|
||||
dr.setDur(data.getDur());
|
||||
dr.setExt(data.getExtremum().toUpperCase());
|
||||
dr.setLid(data.getLid());
|
||||
|
@ -1188,7 +1199,7 @@ public class TimeSeriesDataManager extends HydroDataManager {
|
|||
dr.setShefQualCode("M");
|
||||
dr.setTs(data.getTs().toUpperCase());
|
||||
dr.setValue(data.getPreviousValue());
|
||||
dr.setProductTime(data.getProductTime());
|
||||
dr.setProductTime(productTime);
|
||||
dr.setProductId(data.getProductID());
|
||||
if (data.getValidTime() != null) {
|
||||
dr.setValidTime(data.getValidTime());
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
<launcherArgs>
|
||||
<programArgs>-data @user.home/caveData -user @user.home/caveData -clean</programArgs>
|
||||
<programArgsLin>-consoleLog</programArgsLin>
|
||||
<vmArgs>-Xincgc -Xmx1280M -Dosgi.instance.area.readOnly=true
|
||||
<vmArgs>-Xincgc -Dosgi.instance.area.readOnly=true
|
||||
-Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler
|
||||
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:OnOutOfMemoryError="capture -t no -p $pid &" -Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
|
||||
<vmArgsLin>-Xmx1280M</vmArgsLin>
|
||||
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx768M</vmArgsWin>
|
||||
</launcherArgs>
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ public class TemplateRunner {
|
|||
if (timeZones.size() > 1 && cityTimezone != null) {
|
||||
String timezone;
|
||||
while (iterator.hasNext()) {
|
||||
timezone = iterator.next().toUpperCase();
|
||||
timezone = iterator.next();
|
||||
if (timezone.equals(cityTimezone) && context.get("localtimezone") == null) {
|
||||
context.put("localtimezone", timezone);
|
||||
} else if (context.get("secondtimezone") == null) {
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- Create inbox/outbox directories used for ISC/VTEC sharing -->
|
||||
<mkdir dir="${gfesuite.directory}/products/ISC" />
|
||||
<mkdir dir="${gfesuite.directory}/products/ATBL" />
|
||||
|
||||
<!-- Adjust GFESuite permissions -->
|
||||
<chmod perm="ugo+rx">
|
||||
<fileset dir="${gfesuite.directory}/bin">
|
||||
|
|
|
@ -149,4 +149,4 @@ if [ $DEBUG_FLAG == "on" ]; then
|
|||
echo "To Debug ... Connect to Port: ${EDEX_DEBUG_PORT}."
|
||||
fi
|
||||
|
||||
java -jar ${EDEX_HOME}/bin/yajsw/wrapper.jar -c ${EDEX_HOME}/bin/yajsw/conf/${CONF_FILE} ${WRAPPER_ARGS}
|
||||
java -jar ${EDEX_HOME}/bin/yajsw/wrapper.jar -c ${EDEX_HOME}/conf/${CONF_FILE} ${WRAPPER_ARGS}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -24,7 +24,14 @@
|
|||
wrapper.debug=false
|
||||
set.default.EDEX_HOME=../..
|
||||
wrapper.working.dir=/awips2/edex/bin
|
||||
# required due to java bug:
|
||||
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4388188
|
||||
# not sure if the yajsw developers have any intention of
|
||||
# implementing the work-around (solution?) stated in the
|
||||
# ticket.
|
||||
wrapper.fork_hack=true
|
||||
# at a minimum: prevents the printing of the "Invalid parameter" messages
|
||||
wrapper.console.pipestreams=true
|
||||
|
||||
# Java Application
|
||||
wrapper.java.command=/awips2/java/bin/java
|
||||
|
@ -61,6 +68,19 @@ wrapper.java.library.path.4=${EDEX_HOME}/lib/native/linux64/
|
|||
wrapper.java.additional.1=-Dedex.run.mode=${EDEX_RUN_MODE}
|
||||
wrapper.java.additional.2=-Dedex.home=${EDEX_HOME}
|
||||
|
||||
# Use wrapper.jvm.parameter.order.# to specify the order
|
||||
# that the jvm parameters should be included in the command.
|
||||
# There cannot be duplicate numbered parameters otherwise
|
||||
# one will always take precedence over the other. Use
|
||||
# wrapper.jvm.parameter.order.LAST to specify a parameter
|
||||
# that should always be the last jvm parameter without
|
||||
# needing to specify the order of every individual jvm parameter.
|
||||
wrapper.jvm.parameter.order.1=-Dedex.run.mode
|
||||
# since it is used to determine whether a particular
|
||||
# instance of EDEX is running or not.
|
||||
wrapper.jvm.parameter.order.2=-Daw.site.identifier
|
||||
wrapper.jvm.parameter.order.LAST=-classpath
|
||||
|
||||
# sets the Maximum Permanent Generation memory size
|
||||
wrapper.java.additional.3=-XX:MaxPermSize=${MAX_PERM_SIZE}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
MSO \ M
|
||||
BOI \ M
|
||||
VEF \ P
|
||||
PSR \ M
|
||||
PSR \ m
|
||||
BIS \ C
|
||||
ABR \ C
|
||||
UNR \ M
|
||||
|
|
|
@ -405,16 +405,16 @@ def parseSat(satdirs):
|
|||
def otherParse(serverhost, mhsid, port,
|
||||
initmodules, accumElem,
|
||||
initskips, d2ddbver, logfilepurge, prddir, home,
|
||||
extraWEPrec, autoConfigureNotifyTextProd,
|
||||
extraWEPrec, vtecRequestTime, autoConfigureNotifyTextProd,
|
||||
iscRoutingTableAddress, requestedISCsites, requestISC, sendiscOnSave,
|
||||
sendiscOnPublish, requestedISCparms, transmitScript):
|
||||
if type(serverhost) != str:
|
||||
raise TypeError, "GFESUITE_HOST not an str: " + `serverhost`
|
||||
if type(mhsid) != str:
|
||||
raise TypeError, "GFESUITE_MHSID not an str: " + `mhsid`
|
||||
# if type(vtecRequestTime) != int:
|
||||
# raise TypeError, "VTECPartners: VTEC_REMOTE_TABLE_FETCH_TIME " + \
|
||||
# "not an int: " + `vtecRequestTime`
|
||||
if type(vtecRequestTime) != int:
|
||||
raise TypeError, "VTECPartners: VTEC_REMOTE_TABLE_FETCH_TIME " + \
|
||||
"not an int: " + `vtecRequestTime`
|
||||
if type(port) != int:
|
||||
raise TypeError, "GFESUITE_PORT not an int: " + `port`
|
||||
initmodules = dictCheck(initmodules, list, str, "INITMODULES")
|
||||
|
@ -490,7 +490,7 @@ def otherParse(serverhost, mhsid, port,
|
|||
return serverhost, mhsid, \
|
||||
port, initmodules, accumElem, \
|
||||
initskips, d2ddbver, logfilepurge, prddir, home,\
|
||||
extraWEPrecision, \
|
||||
extraWEPrecision, vtecRequestTime, \
|
||||
autoConfigureNotifyTextProd, \
|
||||
iscRoutingTableAddress, reqISCsites, requestISC, sendiscOnSave, \
|
||||
sendiscOnPublish, reqISCparms, transmitScript
|
||||
|
|
|
@ -1885,7 +1885,7 @@ IFPConfigServer.allowTopoBelowZero = 1
|
|||
def doIt():
|
||||
# Import the local site configuration file (if it exists)
|
||||
import doConfig
|
||||
# import VTECPartners
|
||||
import VTECPartners
|
||||
(models, projections, vis, wx, desDef, allSites, domain, siteId, timeZone,officeTypes) = \
|
||||
doConfig.parse(GFESUITE_SITEID, DATABASES, types, visibilities, SITES,
|
||||
allProjections)
|
||||
|
@ -1910,6 +1910,7 @@ def doIt():
|
|||
logFilePurgeAfter, \
|
||||
prdDir, baseDir, \
|
||||
extraWEPrecision, \
|
||||
tableFetchTime, \
|
||||
autoConfigureNotifyTextProd, \
|
||||
iscRoutingTableAddress, \
|
||||
requestedISCsites, requestISC, \
|
||||
|
@ -1922,7 +1923,8 @@ def doIt():
|
|||
D2DAccumulativeElements,
|
||||
INITSKIPS, D2DDBVERSIONS, LOG_FILE_PURGE_AFTER,
|
||||
GFESUITE_PRDDIR, GFESUITE_HOME,
|
||||
ExtraWEPrecision, AUTO_CONFIGURE_NOTIFYTEXTPROD, ISC_ROUTING_TABLE_ADDRESS,
|
||||
ExtraWEPrecision, VTECPartners.VTEC_REMOTE_TABLE_FETCH_TIME,
|
||||
AUTO_CONFIGURE_NOTIFYTEXTPROD, ISC_ROUTING_TABLE_ADDRESS,
|
||||
REQUESTED_ISC_SITES, REQUEST_ISC, SEND_ISC_ON_SAVE, SEND_ISC_ON_PUBLISH,
|
||||
REQUESTED_ISC_PARMS, TRANSMIT_SCRIPT)
|
||||
IFPConfigServer.serverHost = serverHost
|
||||
|
@ -1936,6 +1938,7 @@ def doIt():
|
|||
IFPConfigServer.prdDir = prdDir
|
||||
IFPConfigServer.baseDir = baseDir
|
||||
IFPConfigServer.extraWEPrecision = extraWEPrecision
|
||||
IFPConfigServer.tableFetchTime = tableFetchTime
|
||||
IFPConfigServer.autoConfigureNotifyTextProd = autoConfigureNotifyTextProd
|
||||
IFPConfigServer.iscRoutingTableAddress = iscRoutingTableAddress
|
||||
IFPConfigServer.requestedISCsites = requestedISCsites
|
||||
|
|
Binary file not shown.
|
@ -2,6 +2,6 @@
|
|||
<?eclipse-pydev version="1.0"?>
|
||||
|
||||
<pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
</pydev_project>
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
# further licensing information.
|
||||
##
|
||||
|
||||
import LogStream, siteConfig, tempfile, os, sys, JUtil, subprocess
|
||||
import cPickle
|
||||
|
||||
import LogStream, siteConfig, tempfile, os, sys, JUtil, subprocess, traceback
|
||||
import time, copy, string, iscUtil
|
||||
|
||||
from com.raytheon.edex.plugin.gfe.isc import IRTManager
|
||||
|
@ -34,6 +36,9 @@ from com.raytheon.edex.plugin.gfe.isc import IRTManager
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 07/14/09 1995 bphillip Initial Creation.
|
||||
# 01/25/13 1447 dgilling Implement routines needed by
|
||||
# iscDataRec for VTEC table
|
||||
# sharing.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
@ -55,7 +60,121 @@ def logVerbose(*msg):
|
|||
|
||||
def logDebug(*msg):
|
||||
logVerbose(iscUtil.tupleToString(*msg))
|
||||
|
||||
# called by iscDataRec when another site has requested the active table
|
||||
# returns the active table, filtered, pickled.
|
||||
def getVTECActiveTable(siteAndFilterInfo, xmlPacket):
|
||||
import VTECPartners
|
||||
if VTECPartners.VTEC_RESPOND_TO_TABLE_REQUESTS:
|
||||
return #respond is disabled
|
||||
|
||||
#decode the data (pickled)
|
||||
info = cPickle.loads(siteAndFilterInfo)
|
||||
(mhsSite, reqsite, filterSites, countDict, issueTime) = info
|
||||
|
||||
#get the active table, and write it to a temporary file
|
||||
from com.raytheon.uf.common.site import SiteMap
|
||||
from com.raytheon.uf.edex.activetable import ActiveTable
|
||||
from com.raytheon.uf.common.activetable import ActiveTableMode
|
||||
site4Id = SiteMap.getInstance().getSite4LetterId(siteConfig.GFESUITE_SITEID)
|
||||
javaTable = ActiveTable.getActiveTable(site4Id, ActiveTableMode.OPERATIONAL)
|
||||
dictTable = ActiveTable.convertToDict(javaTable, siteConfig.GFESUITE_SITEID)
|
||||
|
||||
# we must convert this to a python hash using the A1 field naming conventions
|
||||
# for cross-version compatibility
|
||||
table = []
|
||||
for i in xrange(dictTable.size()):
|
||||
convRecord = JUtil.javaObjToPyVal(dictTable.get(i))
|
||||
convRecord['oid'] = convRecord['officeid']
|
||||
convRecord['vstr'] = convRecord['vtecstr']
|
||||
convRecord['end'] = convRecord['endTime']
|
||||
convRecord['start'] = convRecord['startTime']
|
||||
convRecord['key'] = convRecord['phensig']
|
||||
# remove new fields so we don't pickle two copies
|
||||
del convRecord['officeid']
|
||||
del convRecord['vtecstr']
|
||||
del convRecord['endTime']
|
||||
del convRecord['phensig']
|
||||
del convRecord['startTime']
|
||||
if convRecord.has_key('segText'):
|
||||
convRecord['text'] = convRecord['segText']
|
||||
del convRecord['segText']
|
||||
table.append(convRecord)
|
||||
|
||||
# additionally, we'll need to pickle our output to match the A1 file
|
||||
# format
|
||||
pickledTable = cPickle.dumps(table)
|
||||
outDir = os.path.join(siteConfig.GFESUITE_PRDDIR, "ATBL")
|
||||
with tempfile.NamedTemporaryFile(suffix='.ato', dir=outDir, delete=False) as fp:
|
||||
fname = fp.name
|
||||
fp.write(pickledTable)
|
||||
|
||||
#write the xmlpacket to a temporary file, if one was passed
|
||||
if xmlPacket is not None:
|
||||
with tempfile.NamedTemporaryFile(suffix='.xml', delete=False) as fp:
|
||||
fnameXML = fp.name
|
||||
fp.write(xmlPacket)
|
||||
|
||||
#call sendAT to send the table to the requestor
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
cmd = os.path.join(siteConfig.GFESUITE_HOME, "bin", "sendAT")
|
||||
args = [cmd, '-s', reqsite, '-a', mhsSite, '-H', ServerHost,
|
||||
'-P', ServerPort, '-L', ServerProtocol, '-M', ServerMHS,
|
||||
'-S', ServerSite, '-x', XmtScript]
|
||||
if filterSites is not None:
|
||||
for fs in filterSites:
|
||||
args.append('-f')
|
||||
args.append(fs)
|
||||
if countDict is not None:
|
||||
args.append('-c')
|
||||
args.append(`countDict`)
|
||||
if issueTime is not None:
|
||||
args.append('-t')
|
||||
args.append(`issueTime`)
|
||||
args.append('-v')
|
||||
args.append(fname)
|
||||
if xmlPacket is not None:
|
||||
args.append('-X')
|
||||
args.append(fnameXML)
|
||||
try:
|
||||
os.execvp(cmd, args)
|
||||
except:
|
||||
logProblem("Error executing sendAT: ", traceback.format_exc())
|
||||
finally:
|
||||
os._exit(0)
|
||||
|
||||
#when we receive a requested active table from another site, this function
|
||||
#is called from iscDataRec
|
||||
def putVTECActiveTable(strTable, xmlPacket):
|
||||
#write the xmlpacket to a temporary file, if one was passed
|
||||
if xmlPacket is not None:
|
||||
with tempfile.NamedTemporaryFile(suffix='.xml', delete=False) as fp:
|
||||
fnameXML = fp.name
|
||||
fp.write(xmlPacket)
|
||||
|
||||
inDir = os.path.join(siteConfig.GFESUITE_PRDDIR, "ATBL")
|
||||
with tempfile.NamedTemporaryFile(suffix='.ati', dir=inDir, delete=False) as fp:
|
||||
fname = fp.name
|
||||
fp.write(strTable)
|
||||
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
cmd = os.path.join(siteConfig.GFESUITE_HOME, "bin", "ingestAT")
|
||||
args = []
|
||||
args.append(cmd)
|
||||
args.append("-f")
|
||||
args.append(fname)
|
||||
if xmlPacket is not None:
|
||||
args.append('-X')
|
||||
args.append(fnameXML)
|
||||
try:
|
||||
os.execvp(cmd, args)
|
||||
except:
|
||||
logProblem("Error executing ingestAT: ", traceback.format_exc())
|
||||
finally:
|
||||
os._exit(0)
|
||||
|
||||
def initIRT(ancfURL, bncfURL, mhsid, serverHost, serverPort, serverProtocol,
|
||||
site, parmsWanted, gridDims, gridProj, gridBoundBox, iscWfosWanted):
|
||||
global IRTthread
|
||||
|
|
|
@ -57,7 +57,8 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 30, 2010 mnash Initial creation
|
||||
* Jun 30, 2010 mnash Initial creation
|
||||
* Feb 25, 2013 DR14418 zwang Change radar menu to dual pol style
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -110,6 +111,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
.get(i).toLowerCase());
|
||||
if (terminal) {
|
||||
includeMenuItem.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseTerminalLocalRadarMenu.xml");
|
||||
List<Double> elevations = map.get(radars.get(i));
|
||||
vars = new VariableSubstitution[(elevations.size() + 1)
|
||||
|
@ -137,6 +139,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
includeMenuItem.substitutions = vars;
|
||||
} else {
|
||||
includeMenuItem.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
vars = new VariableSubstitution[1];
|
||||
vars[0] = new VariableSubstitution();
|
||||
|
@ -176,6 +179,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
if (terminal) {
|
||||
List<Double> elevations = map.get(radars.get(i));
|
||||
includeMenuContribution.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ File.separator + "baseTerminalLocalRadarMenu.xml");
|
||||
vars = new VariableSubstitution[(elevations.size() + 1)
|
||||
+ NUM_POSSIBLE_RADARS + 1];
|
||||
|
@ -203,6 +207,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
terminal = true;
|
||||
} else {
|
||||
includeMenuContribution.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
vars = new VariableSubstitution[1];
|
||||
vars[0] = new VariableSubstitution();
|
||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
* 26 Nov 2012 #15554 lbousaidi used obstime instead of system time in isNear12Z
|
||||
* routine.
|
||||
* 4 Dec 2012 #15569 lbousaidi fixed daily pp value when token is set to USE_REVCODE
|
||||
* 02 Feb 2012 #15845 lbousaidi added check for data that comes in as -999
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -309,6 +310,13 @@ public class GagePP {
|
|||
+ MISSING_PRECIP);
|
||||
value = MISSING_PRECIP;
|
||||
}
|
||||
/* This was added for KRF site that was getting missing values -999
|
||||
*
|
||||
*/
|
||||
|
||||
if (value ==-99900.0) {
|
||||
value = MISSING_PRECIP;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make certain that the value is properly rounded. This will
|
||||
|
|
|
@ -14,6 +14,8 @@ Import-Package: com.raytheon.uf.common.dataplugin.annotations,
|
|||
javax.persistence,
|
||||
org.hibernate.annotations,
|
||||
org.springframework.beans.factory.annotation
|
||||
Export-Package: com.raytheon.uf.common.activetable
|
||||
Export-Package: com.raytheon.uf.common.activetable,
|
||||
com.raytheon.uf.common.activetable.request,
|
||||
com.raytheon.uf.common.activetable.response
|
||||
Require-Bundle: com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.message;bundle-version="1.12.1174"
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 24, 2009 njensen Initial creation
|
||||
* Feb 26, 2013 1447 dgilling Implement equals().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -217,6 +218,258 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
@Override
|
||||
public abstract Object clone();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ActiveTableRecord other = (ActiveTableRecord) obj;
|
||||
if (act == null) {
|
||||
if (other.act != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!act.equals(other.act)) {
|
||||
return false;
|
||||
}
|
||||
if (countyheader == null) {
|
||||
if (other.countyheader != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!countyheader.equals(other.countyheader)) {
|
||||
return false;
|
||||
}
|
||||
if (endTime == null) {
|
||||
if (other.endTime != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!endTime.equals(other.endTime)) {
|
||||
return false;
|
||||
}
|
||||
if (etn == null) {
|
||||
if (other.etn != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!etn.equals(other.etn)) {
|
||||
return false;
|
||||
}
|
||||
if (floodBegin == null) {
|
||||
if (other.floodBegin != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!floodBegin.equals(other.floodBegin)) {
|
||||
return false;
|
||||
}
|
||||
if (floodCrest == null) {
|
||||
if (other.floodCrest != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!floodCrest.equals(other.floodCrest)) {
|
||||
return false;
|
||||
}
|
||||
if (floodEnd == null) {
|
||||
if (other.floodEnd != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!floodEnd.equals(other.floodEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (floodRecordStatus == null) {
|
||||
if (other.floodRecordStatus != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!floodRecordStatus.equals(other.floodRecordStatus)) {
|
||||
return false;
|
||||
}
|
||||
if (floodSeverity == null) {
|
||||
if (other.floodSeverity != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!floodSeverity.equals(other.floodSeverity)) {
|
||||
return false;
|
||||
}
|
||||
if (forecaster == null) {
|
||||
if (other.forecaster != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!forecaster.equals(other.forecaster)) {
|
||||
return false;
|
||||
}
|
||||
if (geometry == null) {
|
||||
if (other.geometry != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!geometry.equalsExact(other.geometry)) {
|
||||
return false;
|
||||
}
|
||||
if (immediateCause == null) {
|
||||
if (other.immediateCause != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!immediateCause.equals(other.immediateCause)) {
|
||||
return false;
|
||||
}
|
||||
if (issueTime == null) {
|
||||
if (other.issueTime != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!issueTime.equals(other.issueTime)) {
|
||||
return false;
|
||||
}
|
||||
if (loc == null) {
|
||||
if (other.loc != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!loc.equals(other.loc)) {
|
||||
return false;
|
||||
}
|
||||
if (locationID == null) {
|
||||
if (other.locationID != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!locationID.equals(other.locationID)) {
|
||||
return false;
|
||||
}
|
||||
if (motdir == null) {
|
||||
if (other.motdir != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!motdir.equals(other.motdir)) {
|
||||
return false;
|
||||
}
|
||||
if (motspd == null) {
|
||||
if (other.motspd != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!motspd.equals(other.motspd)) {
|
||||
return false;
|
||||
}
|
||||
if (officeid == null) {
|
||||
if (other.officeid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!officeid.equals(other.officeid)) {
|
||||
return false;
|
||||
}
|
||||
if (overviewText == null) {
|
||||
if (other.overviewText != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!overviewText.equals(other.overviewText)) {
|
||||
return false;
|
||||
}
|
||||
if (phen == null) {
|
||||
if (other.phen != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!phen.equals(other.phen)) {
|
||||
return false;
|
||||
}
|
||||
if (phensig == null) {
|
||||
if (other.phensig != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!phensig.equals(other.phensig)) {
|
||||
return false;
|
||||
}
|
||||
if (pil == null) {
|
||||
if (other.pil != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!pil.equals(other.pil)) {
|
||||
return false;
|
||||
}
|
||||
if (productClass == null) {
|
||||
if (other.productClass != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!productClass.equals(other.productClass)) {
|
||||
return false;
|
||||
}
|
||||
if (purgeTime == null) {
|
||||
if (other.purgeTime != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!purgeTime.equals(other.purgeTime)) {
|
||||
return false;
|
||||
}
|
||||
if (rawmessage == null) {
|
||||
if (other.rawmessage != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!rawmessage.equals(other.rawmessage)) {
|
||||
return false;
|
||||
}
|
||||
if (region == null) {
|
||||
if (other.region != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!region.equals(other.region)) {
|
||||
return false;
|
||||
}
|
||||
if (seg != other.seg) {
|
||||
return false;
|
||||
}
|
||||
if (segText == null) {
|
||||
if (other.segText != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!segText.equals(other.segText)) {
|
||||
return false;
|
||||
}
|
||||
if (sig == null) {
|
||||
if (other.sig != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!sig.equals(other.sig)) {
|
||||
return false;
|
||||
}
|
||||
if (startTime == null) {
|
||||
if (other.startTime != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!startTime.equals(other.startTime)) {
|
||||
return false;
|
||||
}
|
||||
if (ufn != other.ufn) {
|
||||
return false;
|
||||
}
|
||||
if (ugcZone == null) {
|
||||
if (other.ugcZone != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!ugcZone.equals(other.ugcZone)) {
|
||||
return false;
|
||||
}
|
||||
if (vtecstr == null) {
|
||||
if (other.vtecstr != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!vtecstr.equals(other.vtecstr)) {
|
||||
return false;
|
||||
}
|
||||
if (wmoid == null) {
|
||||
if (other.wmoid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!wmoid.equals(other.wmoid)) {
|
||||
return false;
|
||||
}
|
||||
if (xxxid == null) {
|
||||
if (other.xxxid != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!xxxid.equals(other.xxxid)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the wmoid
|
||||
*/
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.activetable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 13, 2010 wldougher Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author wldougher
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class UpdateActiveTableRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Map<String, Object>[] activeTable;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String xmlSource;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private ActiveTableMode mode = ActiveTableMode.PRACTICE;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private float timeOffset = 0.0f;
|
||||
|
||||
/**
|
||||
* @return the activeTable
|
||||
*/
|
||||
public Map<String, Object>[] getActiveTable() {
|
||||
return activeTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activeTable
|
||||
* the activeTable to set
|
||||
*/
|
||||
public void setActiveTable(Map<String, Object>[] activeTable) {
|
||||
this.activeTable = activeTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xmlSource
|
||||
*/
|
||||
public void setXmlSource(String xmlSource) {
|
||||
this.xmlSource = xmlSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getXmlSource() {
|
||||
return xmlSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mode
|
||||
* the mode to set
|
||||
*/
|
||||
public void setMode(ActiveTableMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mode
|
||||
*/
|
||||
public ActiveTableMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeOffset
|
||||
* the timeOffset to set
|
||||
*/
|
||||
public void setTimeOffset(float timeOffset) {
|
||||
this.timeOffset = timeOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the timeOffset
|
||||
*/
|
||||
public float getTimeOffset() {
|
||||
return timeOffset;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.raytheon.uf.common.activetable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
@DynamicSerialize
|
||||
public class UpdateActiveTableResponse implements ISerializableObject {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<String> sourceInfo;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* @param sourceInfo
|
||||
*/
|
||||
public void setSourceInfo(List<String> sourceInfo) {
|
||||
this.sourceInfo = sourceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public List<String> getSourceInfo() {
|
||||
return sourceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* the message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* 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.common.activetable.request;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* Request to merge in a provided collection of new active table entries to the
|
||||
* specified active table using the legacy MergeVTEC logic. Used by CLI
|
||||
* utilities ingestAT/MergeVTEC for active table sharing.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 13, 2010 wldougher Initial creation
|
||||
* Feb 13, 2013 1447 dgilling Added additional fields to
|
||||
* better support VTEC table sharing.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author wldougher
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class MergeActiveTableRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Map<String, Object>[] incomingRecords;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String site;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private ActiveTableMode tableName;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private float timeOffset;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String xmlSource;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private boolean fromIngestAT;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private boolean makeBackups;
|
||||
|
||||
/**
|
||||
* No argument constructor. Not intended to be used by anyone, except
|
||||
* DynamicSerialize.
|
||||
*/
|
||||
public MergeActiveTableRequest() {
|
||||
this(null, ActiveTableMode.PRACTICE, null, 0.0f, null, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a MergeActiveTableRequest.
|
||||
*
|
||||
* @param incomingRecords
|
||||
* Array containing active table entries in the python-style dict
|
||||
* or Map format.
|
||||
* @param tableName
|
||||
* Table the new records will be merged into.
|
||||
* @param site
|
||||
* 3-char site id to perform the merge operation as.
|
||||
* @param timeOffset
|
||||
* For DRT; the number of seconds away from current time to use
|
||||
* as the base time for the merge.
|
||||
* @param xmlSource
|
||||
* MHS XML data that contains who sent these active table
|
||||
* records.
|
||||
* @param fromIngestAT
|
||||
* Whether to run ingestAT or MergeVTEC to perform the merge.
|
||||
* @param makeBackups
|
||||
* Whether to save a backup copy of the active table prior to the
|
||||
* merge operation.
|
||||
*/
|
||||
public MergeActiveTableRequest(Map<String, Object>[] incomingRecords,
|
||||
ActiveTableMode tableName, String site, float timeOffset,
|
||||
String xmlSource, boolean fromIngestAT, boolean makeBackups) {
|
||||
this.incomingRecords = incomingRecords;
|
||||
this.tableName = tableName;
|
||||
this.site = site;
|
||||
this.timeOffset = timeOffset;
|
||||
this.xmlSource = xmlSource;
|
||||
this.fromIngestAT = fromIngestAT;
|
||||
this.makeBackups = makeBackups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("MergeActiveTableRequest [incomingRecords=");
|
||||
builder.append(incomingRecords);
|
||||
builder.append(", tableName=");
|
||||
builder.append(tableName);
|
||||
builder.append(", site=");
|
||||
builder.append(site);
|
||||
builder.append(", timeOffset=");
|
||||
builder.append(timeOffset);
|
||||
builder.append(", xmlSource=");
|
||||
builder.append(xmlSource);
|
||||
builder.append(", fromIngestAT=");
|
||||
builder.append(fromIngestAT);
|
||||
builder.append(", makeBackups=");
|
||||
builder.append(makeBackups);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public Map<String, Object>[] getIncomingRecords() {
|
||||
return incomingRecords;
|
||||
}
|
||||
|
||||
public void setIncomingRecords(Map<String, Object>[] incomingRecords) {
|
||||
this.incomingRecords = incomingRecords;
|
||||
}
|
||||
|
||||
public ActiveTableMode getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(ActiveTableMode tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public float getTimeOffset() {
|
||||
return timeOffset;
|
||||
}
|
||||
|
||||
public void setTimeOffset(float timeOffset) {
|
||||
this.timeOffset = timeOffset;
|
||||
}
|
||||
|
||||
public String getXmlSource() {
|
||||
return xmlSource;
|
||||
}
|
||||
|
||||
public void setXmlSource(String xmlSource) {
|
||||
this.xmlSource = xmlSource;
|
||||
}
|
||||
|
||||
public void setFromIngestAT(boolean fromIngestAT) {
|
||||
this.fromIngestAT = fromIngestAT;
|
||||
}
|
||||
|
||||
public boolean isFromIngestAT() {
|
||||
return fromIngestAT;
|
||||
}
|
||||
|
||||
public void setMakeBackups(boolean makeBackups) {
|
||||
this.makeBackups = makeBackups;
|
||||
}
|
||||
|
||||
public boolean isMakeBackups() {
|
||||
return makeBackups;
|
||||
}
|
||||
|
||||
public void setSite(String site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
/**
|
||||
* 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.common.activetable.request;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* Request to run the requestAT utility, which will send messages over the MHS
|
||||
* to neighboring sites for their active table entries that are relevant to this
|
||||
* site.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 6, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class RetrieveRemoteActiveTableRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String serverHost;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int serverPort;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String serverProtocol;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String mhsId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String siteId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String ancfAddress;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String bncfAddress;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String transmitScript;
|
||||
|
||||
/**
|
||||
* No argument constructor. Not intended to be used by anyone, except
|
||||
* DynamicSerialize.
|
||||
*/
|
||||
public RetrieveRemoteActiveTableRequest() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a RetrieveRemoteActiveTableRequest.
|
||||
*
|
||||
* @param serverHost
|
||||
* Host name of system running requestAT.
|
||||
* @param serverPort
|
||||
* Port upon which system runs.
|
||||
* @param serverProtocol
|
||||
* MHS protocol string for server.
|
||||
* @param mhsId
|
||||
* MHS ID of this system.
|
||||
* @param siteId
|
||||
* Site ID of this system.
|
||||
* @param ancfAddress
|
||||
* Configured ANCF URL.
|
||||
* @param bncfAddress
|
||||
* Configured BNCF URL.
|
||||
* @param transmitScript
|
||||
* Command to run to transmit requestAT output over MHS.
|
||||
*/
|
||||
public RetrieveRemoteActiveTableRequest(String serverHost, int serverPort,
|
||||
String serverProtocol, String mhsId, String siteId,
|
||||
String ancfAddress, String bncfAddress, String transmitScript) {
|
||||
this.serverHost = serverHost;
|
||||
this.serverPort = serverPort;
|
||||
this.serverProtocol = serverProtocol;
|
||||
this.mhsId = mhsId;
|
||||
this.siteId = siteId;
|
||||
this.ancfAddress = ancfAddress;
|
||||
this.bncfAddress = bncfAddress;
|
||||
this.transmitScript = transmitScript;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("RetrieveRemoteActiveTableRequest [serverHost=");
|
||||
builder.append(serverHost);
|
||||
builder.append(", serverPort=");
|
||||
builder.append(serverPort);
|
||||
builder.append(", serverProtocol=");
|
||||
builder.append(serverProtocol);
|
||||
builder.append(", mhsId=");
|
||||
builder.append(mhsId);
|
||||
builder.append(", siteId=");
|
||||
builder.append(siteId);
|
||||
builder.append(", ancfAddress=");
|
||||
builder.append(ancfAddress);
|
||||
builder.append(", bncfAddress=");
|
||||
builder.append(bncfAddress);
|
||||
builder.append(", transmitScript=");
|
||||
builder.append(transmitScript);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String getServerHost() {
|
||||
return serverHost;
|
||||
}
|
||||
|
||||
public void setServerHost(String serverHost) {
|
||||
this.serverHost = serverHost;
|
||||
}
|
||||
|
||||
public int getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
public void setServerPort(int serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public String getServerProtocol() {
|
||||
return serverProtocol;
|
||||
}
|
||||
|
||||
public void setServerProtocol(String serverProtocol) {
|
||||
this.serverProtocol = serverProtocol;
|
||||
}
|
||||
|
||||
public String getMhsId() {
|
||||
return mhsId;
|
||||
}
|
||||
|
||||
public void setMhsId(String mhsId) {
|
||||
this.mhsId = mhsId;
|
||||
}
|
||||
|
||||
public String getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getAncfAddress() {
|
||||
return ancfAddress;
|
||||
}
|
||||
|
||||
public void setAncfAddress(String ancfAddress) {
|
||||
this.ancfAddress = ancfAddress;
|
||||
}
|
||||
|
||||
public String getBncfAddress() {
|
||||
return bncfAddress;
|
||||
}
|
||||
|
||||
public void setBncfAddress(String bncfAddress) {
|
||||
this.bncfAddress = bncfAddress;
|
||||
}
|
||||
|
||||
public String getTransmitScript() {
|
||||
return transmitScript;
|
||||
}
|
||||
|
||||
public void setTransmitScript(String transmitScript) {
|
||||
this.transmitScript = transmitScript;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,286 @@
|
|||
/**
|
||||
* 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.common.activetable.request;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* Request to run the utility sendAT, which will send active table entries
|
||||
* relevant to the specified sites via MHS.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 6, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class SendActiveTableRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String serverHost;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Integer serverPort;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String serverProtocol;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String serverSite;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String mhsId;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<String> sites;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<String> filterSites;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private List<String> mhsSites;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Float issueTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Map<String, Integer> countDict;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String fileName;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String xmlIncoming;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String transmitScript;
|
||||
|
||||
/**
|
||||
* No argument constructor. Not intended to be used by anyone, except
|
||||
* DynamicSerialize.
|
||||
*/
|
||||
public SendActiveTableRequest() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a SendActiveTableRequest.
|
||||
*
|
||||
* @param serverHost
|
||||
* Host name of system running sendAT.
|
||||
* @param serverPort
|
||||
* Port upon which system runs.
|
||||
* @param serverProtocol
|
||||
* MHS protocol string for server.
|
||||
* @param serverSite
|
||||
* Site ID of this system.
|
||||
* @param mhsId
|
||||
* MHS ID of this system.
|
||||
* @param sites
|
||||
* Sites to collect active table entries for.
|
||||
* @param filterSites
|
||||
* Sites to filter out of active table entries.
|
||||
* @param mhsSites
|
||||
* optional field for legacy systems. MHS IDs of server to send
|
||||
* results to.
|
||||
* @param issueTime
|
||||
* Time request was made. Epoch time in seconds.
|
||||
* @param countDict
|
||||
* Counts of records requesting server has for each site in
|
||||
* <code>sites</code>.
|
||||
* @param fileName
|
||||
* File name containing records to send out.
|
||||
* @param xmlIncoming
|
||||
* MHS XML data about the request.
|
||||
* @param transmitScript
|
||||
* Command to run to send results via MHS.
|
||||
*/
|
||||
public SendActiveTableRequest(String serverHost, int serverPort,
|
||||
String serverProtocol, String serverSite, String mhsId,
|
||||
List<String> sites, List<String> filterSites,
|
||||
List<String> mhsSites, float issueTime,
|
||||
Map<String, Integer> countDict, String fileName,
|
||||
String xmlIncoming, String transmitScript) {
|
||||
this.serverHost = serverHost;
|
||||
this.serverPort = serverPort;
|
||||
this.serverProtocol = serverProtocol;
|
||||
this.serverSite = serverSite;
|
||||
this.mhsId = mhsId;
|
||||
this.sites = sites;
|
||||
this.filterSites = filterSites;
|
||||
this.mhsSites = mhsSites;
|
||||
this.issueTime = issueTime;
|
||||
this.countDict = countDict;
|
||||
this.fileName = fileName;
|
||||
this.xmlIncoming = xmlIncoming;
|
||||
this.transmitScript = transmitScript;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("SendActiveTableRequest [serverHost=");
|
||||
builder.append(serverHost);
|
||||
builder.append(", serverPort=");
|
||||
builder.append(serverPort);
|
||||
builder.append(", serverProtocol=");
|
||||
builder.append(serverProtocol);
|
||||
builder.append(", serverSite=");
|
||||
builder.append(serverSite);
|
||||
builder.append(", mhsId=");
|
||||
builder.append(mhsId);
|
||||
builder.append(", sites=");
|
||||
builder.append(sites);
|
||||
builder.append(", filterSites=");
|
||||
builder.append(filterSites);
|
||||
builder.append(", mhsSites=");
|
||||
builder.append(mhsSites);
|
||||
builder.append(", issueTime=");
|
||||
builder.append(issueTime);
|
||||
builder.append(", countDict=");
|
||||
builder.append(countDict);
|
||||
builder.append(", fileName=");
|
||||
builder.append(fileName);
|
||||
builder.append(", xmlIncoming=");
|
||||
builder.append(xmlIncoming);
|
||||
builder.append(", transmitScript=");
|
||||
builder.append(transmitScript);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String getServerHost() {
|
||||
return serverHost;
|
||||
}
|
||||
|
||||
public void setServerHost(String serverHost) {
|
||||
this.serverHost = serverHost;
|
||||
}
|
||||
|
||||
public Integer getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
public void setServerPort(Integer serverPort) {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
public String getServerProtocol() {
|
||||
return serverProtocol;
|
||||
}
|
||||
|
||||
public void setServerProtocol(String serverProtocol) {
|
||||
this.serverProtocol = serverProtocol;
|
||||
}
|
||||
|
||||
public String getServerSite() {
|
||||
return serverSite;
|
||||
}
|
||||
|
||||
public void setServerSite(String serverSite) {
|
||||
this.serverSite = serverSite;
|
||||
}
|
||||
|
||||
public String getMhsId() {
|
||||
return mhsId;
|
||||
}
|
||||
|
||||
public void setMhsId(String mhsId) {
|
||||
this.mhsId = mhsId;
|
||||
}
|
||||
|
||||
public List<String> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public void setSites(List<String> sites) {
|
||||
this.sites = sites;
|
||||
}
|
||||
|
||||
public List<String> getFilterSites() {
|
||||
return filterSites;
|
||||
}
|
||||
|
||||
public void setFilterSites(List<String> filterSites) {
|
||||
this.filterSites = filterSites;
|
||||
}
|
||||
|
||||
public List<String> getMhsSites() {
|
||||
return mhsSites;
|
||||
}
|
||||
|
||||
public void setMhsSites(List<String> mhsSites) {
|
||||
this.mhsSites = mhsSites;
|
||||
}
|
||||
|
||||
public Float getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(Float issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getCountDict() {
|
||||
return countDict;
|
||||
}
|
||||
|
||||
public void setCountDict(Map<String, Integer> countDict) {
|
||||
this.countDict = countDict;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getXmlIncoming() {
|
||||
return xmlIncoming;
|
||||
}
|
||||
|
||||
public void setXmlIncoming(String xmlIncoming) {
|
||||
this.xmlIncoming = xmlIncoming;
|
||||
}
|
||||
|
||||
public String getTransmitScript() {
|
||||
return transmitScript;
|
||||
}
|
||||
|
||||
public void setTransmitScript(String transmitScript) {
|
||||
this.transmitScript = transmitScript;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* 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.common.activetable.response;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Response for the following active table sharing request types:
|
||||
* <ul>
|
||||
* <li>MergeActiveTableRequest
|
||||
* <li>RetrieveRemoteActiveTableRequest
|
||||
* <li>SendActiveTableRequest
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 27, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class ActiveTableSharingResponse implements ISerializableObject {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private boolean taskSuccess;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String errorMessage;
|
||||
|
||||
/**
|
||||
* Build an ActiveTableSharingResponse.
|
||||
*
|
||||
* @param taskSuccess
|
||||
* Whether the task tied to the request succeeded.
|
||||
* @param errorMessage
|
||||
* Any status/error messages that could be returned relevant to
|
||||
* the task.
|
||||
*/
|
||||
public ActiveTableSharingResponse(boolean taskSuccess, String errorMessage) {
|
||||
this.taskSuccess = taskSuccess;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public boolean isTaskSuccess() {
|
||||
return taskSuccess;
|
||||
}
|
||||
|
||||
public void setTaskSuccess(boolean taskSuccess) {
|
||||
this.taskSuccess = taskSuccess;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
}
|
|
@ -68,6 +68,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 06/03/09 2521 D. Hladky Initial release
|
||||
* 01/27/13 1478 D. Hladky OUN memory help
|
||||
* Feb 28, 2013 1729 dhladky Supressed un-necessary debug loggers
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -580,9 +581,13 @@ public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
|
|||
uri + "/" + domain.getCwa(), ALL,
|
||||
Request.ALL);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"FFMPRecord: no data for: " + uri + "/"
|
||||
+ domain.getCwa());
|
||||
// This is a routine error. Sometimes you can not have data for a configured source
|
||||
// This suppresses spurrious messages that would inflate the loags needlessly.
|
||||
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
"FFMPRecord: no data for: " + uri + "/"
|
||||
+ domain.getCwa());
|
||||
}
|
||||
}
|
||||
|
||||
if (rec != null) {
|
||||
|
|
|
@ -19,16 +19,13 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.dataplugin.gfe.python;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.python.PyUtil;
|
||||
import com.raytheon.uf.common.python.PythonIncludePathUtil;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
|
||||
/**
|
||||
|
@ -40,15 +37,14 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 9, 2008 njensen Initial creation
|
||||
* Sep 18, 2012 #1091 randerso added base directory to getGfeConfigIncludePath
|
||||
* Feb 27, 2013 #1447 dgilling Re-factor based on PythonPathIncludeUtil.
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GfePyIncludeUtil {
|
||||
|
||||
public static final String PYTHON = "python";
|
||||
public class GfePyIncludeUtil extends PythonIncludePathUtil {
|
||||
|
||||
public static final String GFE = "gfe";
|
||||
|
||||
|
@ -99,33 +95,6 @@ public class GfePyIncludeUtil {
|
|||
public static final String VCMOD_UTILS = FileUtil
|
||||
.join(VCMODULES, "utility");
|
||||
|
||||
private static final IPathManager PATH_MANAGER = PathManagerFactory
|
||||
.getPathManager();
|
||||
|
||||
private static Map<LocalizationContext, Map<String, String>> pathMap = new HashMap<LocalizationContext, Map<String, String>>();
|
||||
|
||||
private static String getPath(LocalizationContext ctx, String locPath) {
|
||||
Map<String, String> ctxMap = pathMap.get(ctx);
|
||||
if (ctxMap == null) {
|
||||
ctxMap = new HashMap<String, String>();
|
||||
pathMap.put(ctx, ctxMap);
|
||||
}
|
||||
String fsPath = ctxMap.get(locPath);
|
||||
if (fsPath == null) {
|
||||
LocalizationFile file = PATH_MANAGER.getLocalizationFile(ctx,
|
||||
locPath);
|
||||
fsPath = file.getFile().getAbsolutePath();
|
||||
ctxMap.put(locPath, fsPath);
|
||||
}
|
||||
return fsPath;
|
||||
}
|
||||
|
||||
// LocalizationFile getters
|
||||
|
||||
public static LocalizationFile getCommonPythonLF(LocalizationContext ctx) {
|
||||
return PATH_MANAGER.getLocalizationFile(ctx, PYTHON);
|
||||
}
|
||||
|
||||
public static LocalizationFile getCommonGfeLF(LocalizationContext ctx) {
|
||||
return PATH_MANAGER.getLocalizationFile(ctx, COMMON_GFE);
|
||||
}
|
||||
|
@ -189,11 +158,6 @@ public class GfePyIncludeUtil {
|
|||
|
||||
// Include Path getters
|
||||
|
||||
public static String getCommonPythonIncludePath() {
|
||||
return getPath(PATH_MANAGER.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.BASE), PYTHON);
|
||||
}
|
||||
|
||||
public static String getCommonGfeIncludePath() {
|
||||
String pythonDir = getCommonPythonIncludePath();
|
||||
String gfeDir = getPath(PATH_MANAGER.getContext(
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
|||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -64,6 +65,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/17/10 2521 D. Hladky Initial release
|
||||
* 02/01/13 1649 D. Hladky better logging,
|
||||
* Feb 28, 2013 1731 bsteffen Optimize construction of scan resource.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -129,6 +131,14 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
|
|||
/* cell data only */
|
||||
public ModelData md = null;
|
||||
|
||||
public ScanRecord() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ScanRecord(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -258,6 +268,21 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
|
|||
this.stationGeometry = stationGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the TableData from the serialized form that is stored in hdf5.
|
||||
*
|
||||
* @param byteData
|
||||
* @throws SerializationException
|
||||
*/
|
||||
public void setTableData(ByteDataRecord byteData)
|
||||
throws SerializationException {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(
|
||||
byteData.getByteData());
|
||||
Object o = DynamicSerializationManager.getManager(
|
||||
SerializationType.Thrift).deserialize(bais);
|
||||
setTableData((ScanTableData<?>) o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Hash out of the datastore by HUC
|
||||
*
|
||||
|
@ -268,11 +293,7 @@ public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
|
|||
try {
|
||||
ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
|
||||
getDataURI(), getType(), Request.ALL);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(
|
||||
byteData.getByteData());
|
||||
Object o = DynamicSerializationManager.getManager(
|
||||
SerializationType.Thrift).deserialize(bais);
|
||||
setTableData((ScanTableData<?>) o);
|
||||
setTableData(byteData);
|
||||
} catch (Throwable e) {
|
||||
statusHandler.handle(Priority.ERROR, "Couldn't load Table data!" + getDataURI());
|
||||
}
|
||||
|
|
|
@ -176,10 +176,11 @@ public interface IDataStore extends ISerializableObject {
|
|||
Request request) throws StorageException, FileNotFoundException;
|
||||
|
||||
/**
|
||||
* Retrieve a set of datasets at given the Request parameters
|
||||
* Retrieve multiple datasets from a single file
|
||||
*
|
||||
*
|
||||
* @param datasetGroupPath
|
||||
* the full path to a dataset.
|
||||
* @param request
|
||||
* the request type to perform
|
||||
* @return a set of datarecords
|
||||
|
@ -190,7 +191,8 @@ public interface IDataStore extends ISerializableObject {
|
|||
Request request) throws StorageException, FileNotFoundException;
|
||||
|
||||
/**
|
||||
* Retrieve multiple groups from a single file
|
||||
* Retrieve multiple groups from a single file, retrieves all datasets from
|
||||
* each group.
|
||||
*
|
||||
* NOTE: The request is applied to every group
|
||||
*
|
||||
|
|
|
@ -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.common.python;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
|
||||
/**
|
||||
* Utility for getting python directories to include.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 27, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PythonIncludePathUtil {
|
||||
|
||||
protected static final IPathManager PATH_MANAGER = PathManagerFactory
|
||||
.getPathManager();
|
||||
|
||||
private static Map<LocalizationContext, Map<String, String>> pathMap = new HashMap<LocalizationContext, Map<String, String>>();
|
||||
|
||||
public static final String PYTHON = "python";
|
||||
|
||||
protected static String getPath(LocalizationContext ctx, String locPath) {
|
||||
Map<String, String> ctxMap = pathMap.get(ctx);
|
||||
if (ctxMap == null) {
|
||||
ctxMap = new HashMap<String, String>();
|
||||
pathMap.put(ctx, ctxMap);
|
||||
}
|
||||
String fsPath = ctxMap.get(locPath);
|
||||
if (fsPath == null) {
|
||||
LocalizationFile file = PATH_MANAGER.getLocalizationFile(ctx,
|
||||
locPath);
|
||||
fsPath = file.getFile().getAbsolutePath();
|
||||
ctxMap.put(locPath, fsPath);
|
||||
}
|
||||
return fsPath;
|
||||
}
|
||||
|
||||
public static LocalizationFile getCommonPythonLF(LocalizationContext ctx) {
|
||||
return PATH_MANAGER.getLocalizationFile(ctx, PYTHON);
|
||||
}
|
||||
|
||||
public static String getCommonPythonIncludePath() {
|
||||
return getPath(PATH_MANAGER.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.BASE), PYTHON);
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
<?eclipse-pydev version="1.0"?>
|
||||
|
||||
<pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
</pydev_project>
|
||||
|
|
|
@ -46,16 +46,28 @@
|
|||
<constructor-arg value="com.raytheon.uf.common.activetable.PracticeProductOfftimeRequest"/>
|
||||
<constructor-arg ref="practiceProductOfftimeHandler"/>
|
||||
</bean>
|
||||
|
||||
<bean id="updateActiveTableHandler" class="com.raytheon.uf.edex.activetable.UpdateActiveTableHandler" />
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.activetable.UpdateActiveTableRequest"/>
|
||||
<constructor-arg ref="updateActiveTableHandler"/>
|
||||
</bean>
|
||||
|
||||
<bean id="getNextEtnHandler" class="com.raytheon.uf.edex.activetable.GetNextEtnHandler" />
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetNextEtnRequest"/>
|
||||
<constructor-arg ref="getNextEtnHandler"/>
|
||||
</bean>
|
||||
|
||||
<bean id="requestATHandler" class="com.raytheon.uf.edex.activetable.handler.RetrieveRemoteActiveTableHandler"/>
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.RetrieveRemoteActiveTableRequest"/>
|
||||
<constructor-arg ref="requestATHandler"/>
|
||||
</bean>
|
||||
|
||||
<bean id="sendATHandler" class="com.raytheon.uf.edex.activetable.handler.SendActiveTableHandler"/>
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.SendActiveTableRequest"/>
|
||||
<constructor-arg ref="sendATHandler"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ingestATHandler" class="com.raytheon.uf.edex.activetable.handler.MergeActiveTableHandler"/>
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.MergeActiveTableRequest"/>
|
||||
<constructor-arg ref="ingestATHandler"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.common.site.SiteMap;
|
|||
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.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
||||
|
@ -75,7 +76,9 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 17, 2009 njensen Initial creation
|
||||
* Dec 21, 2009 4055 njensen Queued thread for updates
|
||||
* Dec 21, 2009 4055 njensen Queued thread for updates
|
||||
* Feb 26, 2013 1447 dgilling Add routine to use MergeVTEC as basis
|
||||
* for merge logic.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -290,7 +293,7 @@ public class ActiveTable {
|
|||
updateTable(siteId, result, mode);
|
||||
|
||||
if (result.changeList.size() > 0) {
|
||||
sendNotification(mode, result.changeList);
|
||||
sendNotification(mode, result.changeList, "VTECDecoder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,12 +342,13 @@ public class ActiveTable {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void sendNotification(ActiveTableMode mode, List<VTECChange> changes) {
|
||||
private static void sendNotification(ActiveTableMode mode,
|
||||
List<VTECChange> changes, String source) {
|
||||
Date modTime = new Date();
|
||||
// VTECTableChangeNotifier.send(mode, modTime, "VTECDecoder", changes);
|
||||
try {
|
||||
VTECTableChangeNotification notification = new VTECTableChangeNotification(
|
||||
mode, modTime, "VTECDecoder",
|
||||
mode, modTime, source,
|
||||
changes.toArray(new VTECChange[changes.size()]));
|
||||
// System.out.println("Sending VTECTableChangeNotification:"
|
||||
// + notification);
|
||||
|
@ -427,7 +431,7 @@ public class ActiveTable {
|
|||
* @param changes
|
||||
* the updated table followed by the purged records
|
||||
*/
|
||||
private void updateTable(String siteId, MergeResult changes,
|
||||
private static void updateTable(String siteId, MergeResult changes,
|
||||
ActiveTableMode mode) {
|
||||
synchronized (ActiveTable.class) {
|
||||
List<ActiveTableRecord> updated = changes.updatedList;
|
||||
|
@ -468,6 +472,99 @@ public class ActiveTable {
|
|||
return exc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges the specified new active table records into the active table using
|
||||
* the legacy MergeVTEC logic (which is different than the legacy logic in
|
||||
* ActiveTable.py used elsewhere).
|
||||
*
|
||||
* @param siteId
|
||||
* Site ID to perform the merge as.
|
||||
* @param tableName
|
||||
* Table to merge the records into.
|
||||
* @param newRecords
|
||||
* The incoming new records to merge.
|
||||
* @param timeOffset
|
||||
* For DRT; number of seconds from current time to use as base
|
||||
* time for the merge.
|
||||
* @param makeBackup
|
||||
* Whether or not to make a backup of the active table prior to
|
||||
* the merge.
|
||||
* @param runIngestAT
|
||||
* Whether this merge will be performed as ingestAT or MergeVTEC
|
||||
* (has minor logging effects).
|
||||
* @param xmlSource
|
||||
* Only required when <code>runIngestAT</code> is true; XML data
|
||||
* from MHS about source of new records.
|
||||
* @throws JepException
|
||||
* If an unhandled exception is encountered in the python code
|
||||
* executed.
|
||||
*/
|
||||
public static void mergeRemoteTable(String siteId,
|
||||
ActiveTableMode tableName, List<ActiveTableRecord> newRecords,
|
||||
float timeOffset, boolean makeBackup, boolean runIngestAT,
|
||||
String xmlSource) throws JepException {
|
||||
MergeResult result = null;
|
||||
PythonScript script = null;
|
||||
try {
|
||||
String scriptName = runIngestAT ? "ingestAT.py" : "MergeVTEC.py";
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationContext commonCx = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
|
||||
String scriptPath = pathMgr.getFile(commonCx,
|
||||
FileUtil.join(ActiveTablePyIncludeUtil.VTEC, scriptName))
|
||||
.getPath();
|
||||
String pythonIncludePath = PyUtil.buildJepIncludePath(
|
||||
ActiveTablePyIncludeUtil.getCommonPythonIncludePath(),
|
||||
ActiveTablePyIncludeUtil.getVtecIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getGfeConfigIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getIscScriptsIncludePath());
|
||||
|
||||
try {
|
||||
script = new PythonScript(scriptPath, pythonIncludePath,
|
||||
ActiveTable.class.getClassLoader());
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error initializing ingestAT or MergeVTEC python", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
try {
|
||||
String site4Char = SiteMap.getInstance().getSite4LetterId(
|
||||
siteId);
|
||||
List<ActiveTableRecord> activeTable = getActiveTable(site4Char,
|
||||
tableName);
|
||||
HashMap<String, Object> args = new HashMap<String, Object>();
|
||||
args.put("activeTable", activeTable);
|
||||
args.put("activeTableMode", tableName.toString());
|
||||
args.put("newRecords", newRecords);
|
||||
args.put("drt", timeOffset);
|
||||
args.put("makeBackups", makeBackup);
|
||||
if (runIngestAT) {
|
||||
args.put("xmlIncoming", xmlSource);
|
||||
}
|
||||
|
||||
String methodName = runIngestAT ? "runFromJava" : "merge";
|
||||
result = (MergeResult) script.execute(methodName, args);
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error merging active table", e);
|
||||
throw e;
|
||||
}
|
||||
} finally {
|
||||
if (script != null) {
|
||||
script.dispose();
|
||||
script = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
updateTable(siteId, result, tableName);
|
||||
if (!result.changeList.isEmpty()) {
|
||||
sendNotification(tableName, result.changeList, "MergeVTEC");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
python.dispose();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* 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.activetable;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.python.PyUtil;
|
||||
import com.raytheon.uf.common.python.PythonIncludePathUtil;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
|
||||
/**
|
||||
* Utility for getting python directories to include.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 27, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ActiveTablePyIncludeUtil extends PythonIncludePathUtil {
|
||||
|
||||
public static final String GFE = "gfe";
|
||||
|
||||
public static final String GFE_CONFIG = FileUtil.join("config", GFE);
|
||||
|
||||
public static final String ISC = FileUtil.join(GFE, "isc");
|
||||
|
||||
public static final String VTEC = "vtec";
|
||||
|
||||
public static String getGfeConfigIncludePath(String siteId) {
|
||||
String baseConfigDir = getPath(PATH_MANAGER.getContext(
|
||||
LocalizationType.EDEX_STATIC, LocalizationLevel.BASE),
|
||||
GFE_CONFIG);
|
||||
String siteConfigDir = getPath(PATH_MANAGER.getContextForSite(
|
||||
LocalizationType.EDEX_STATIC, siteId), GFE_CONFIG);
|
||||
return PyUtil.buildJepIncludePath(siteConfigDir, baseConfigDir);
|
||||
}
|
||||
|
||||
public static String getIscScriptsIncludePath() {
|
||||
return getPath(PATH_MANAGER.getContext(LocalizationType.EDEX_STATIC,
|
||||
LocalizationLevel.BASE), ISC);
|
||||
}
|
||||
|
||||
public static String getVtecIncludePath(String siteId) {
|
||||
String baseDir = getPath(PATH_MANAGER.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE), VTEC);
|
||||
String siteDir = getPath(PATH_MANAGER.getContextForSite(
|
||||
LocalizationType.COMMON_STATIC, siteId), VTEC);
|
||||
return PyUtil.buildJepIncludePath(siteDir, baseDir);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,34 +17,36 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.activetable;
|
||||
package com.raytheon.uf.edex.activetable.handler;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jep.JepException;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.activetable.ActiveTableRecord;
|
||||
import com.raytheon.uf.common.activetable.OperationalActiveTableRecord;
|
||||
import com.raytheon.uf.common.activetable.PracticeActiveTableRecord;
|
||||
import com.raytheon.uf.common.activetable.UpdateActiveTableRequest;
|
||||
import com.raytheon.uf.common.activetable.UpdateActiveTableResponse;
|
||||
import com.raytheon.uf.common.activetable.request.MergeActiveTableRequest;
|
||||
import com.raytheon.uf.common.activetable.response.ActiveTableSharingResponse;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
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.edex.activetable.ActiveTable;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.io.ParseException;
|
||||
import com.vividsolutions.jts.io.WKTReader;
|
||||
|
||||
/**
|
||||
* Handler for UpdateActiveTableRequests. This is the server-side portion of the
|
||||
* ingestAT application.
|
||||
* Handler for
|
||||
* <code>MergeActiveTableRequest<code>s. This is the server-side portion of the
|
||||
* ingestAT/MergeVTEC applications.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -54,6 +56,8 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* Sep 13, 2010 wldougher Initial creation
|
||||
* Aug 20, 2012 #1084 dgilling Properly zero pad incoming
|
||||
* ETN values.
|
||||
* Feb 26, 2013 #1447 dgilling Rewrite based on MergeActiveTableRequest
|
||||
* and use MergeVTEC.py to perform merge.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,10 +65,10 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class UpdateActiveTableHandler implements
|
||||
IRequestHandler<UpdateActiveTableRequest> {
|
||||
public class MergeActiveTableHandler implements
|
||||
IRequestHandler<MergeActiveTableRequest> {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(UpdateActiveTableHandler.class);
|
||||
.getHandler(MergeActiveTableHandler.class);
|
||||
|
||||
/**
|
||||
* Handle a request to update the active table with a list of records. The
|
||||
|
@ -74,100 +78,39 @@ public class UpdateActiveTableHandler implements
|
|||
* @see com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest(com.raytheon.uf.common.serialization.comm.IServerRequest)
|
||||
*/
|
||||
@Override
|
||||
public Object handleRequest(UpdateActiveTableRequest request)
|
||||
throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Float timeOffset = request.getTimeOffset();
|
||||
|
||||
Map<String, Object>[] activeTableMap = request.getActiveTable();
|
||||
ActiveTableMode mode = request.getMode();
|
||||
public ActiveTableSharingResponse handleRequest(
|
||||
MergeActiveTableRequest request) throws Exception {
|
||||
Map<String, Object>[] activeTableMap = request.getIncomingRecords();
|
||||
ActiveTableMode mode = request.getTableName();
|
||||
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"Received UpdateActiveTable request containing "
|
||||
+ activeTableMap.length + " maps.");
|
||||
|
||||
List<ActiveTableRecord> records = null;
|
||||
List<ActiveTableRecord> records;
|
||||
try {
|
||||
records = mapToRecords(activeTableMap, mode);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"The mapToRecords() call failed.", e);
|
||||
sb.append(e.getLocalizedMessage());
|
||||
for (StackTraceElement ste : e.getStackTrace()) {
|
||||
sb.append(ste.toString() + "\n");
|
||||
}
|
||||
// already logged this below, just returning failed status
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Error executing converting incoming records: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
if (sb.length() == 0) {
|
||||
|
||||
// Records may have entries for more than one site ID (officeid).
|
||||
// However, the merge() method of ActiveTable assumes it will only
|
||||
// get records for a single site. So some sorting and slicing of the
|
||||
// list has to be done.
|
||||
class OidComparator implements Comparator<ActiveTableRecord> {
|
||||
/**
|
||||
* Comparator for sorting ActiveTableRecords by office id.
|
||||
*
|
||||
* @see java.util.Comparator#compare(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(ActiveTableRecord o1, ActiveTableRecord o2) {
|
||||
return o1.getOfficeid().compareTo(o2.getOfficeid());
|
||||
}
|
||||
}
|
||||
OidComparator comparator = new OidComparator();
|
||||
Collections.sort(records, comparator);
|
||||
|
||||
// Create an active table instance to perform the merge
|
||||
ActiveTable table = new ActiveTable();
|
||||
// A sublist of records, all for the same site
|
||||
List<ActiveTableRecord> siteRecords = null;
|
||||
// A dummy record for use with binarySearch
|
||||
ActiveTableRecord key = new PracticeActiveTableRecord();
|
||||
// The index of the first record with a different site ID
|
||||
int nextIdx = -1;
|
||||
|
||||
while (records.size() > 0) {
|
||||
// Get a sublist with identical site IDs
|
||||
key.setOfficeid(records.get(0).getOfficeid() + " ");
|
||||
nextIdx = Collections.binarySearch(records, key, comparator);
|
||||
if (nextIdx < 0) {
|
||||
nextIdx = -(nextIdx + 1);
|
||||
}
|
||||
siteRecords = records.subList(0, nextIdx);
|
||||
// Merge all the records for the site
|
||||
Exception exc = table.merge(siteRecords, timeOffset);
|
||||
if (exc != null) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"table.merge() returned an error.", exc);
|
||||
sb.append(exc.getLocalizedMessage());
|
||||
for (StackTraceElement ste : exc.getStackTrace()) {
|
||||
sb.append(ste.toString() + "\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Remove the processed records
|
||||
records = records.subList(nextIdx, records.size());
|
||||
}
|
||||
|
||||
String xmlSource = request.isFromIngestAT() ? request.getXmlSource()
|
||||
: null;
|
||||
try {
|
||||
ActiveTable.mergeRemoteTable(request.getSite(),
|
||||
request.getTableName(), records, request.getTimeOffset(),
|
||||
request.isMakeBackups(), request.isFromIngestAT(),
|
||||
xmlSource);
|
||||
} catch (JepException e) {
|
||||
// already logged this in ActiveTable, just returning failed status
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Error performing merge: " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
String xmlSource = request.getXmlSource();
|
||||
List<String> sourceInfo = null;
|
||||
if (xmlSource != null && !("".equals(xmlSource.trim()))) {
|
||||
ServerInfoExtractor infoExtractor = new ServerInfoExtractor();
|
||||
sourceInfo = infoExtractor.extract(xmlSource);
|
||||
}
|
||||
|
||||
// Tell the user we finished processing.
|
||||
// The merge() method handles its own error reporting, we get no status
|
||||
UpdateActiveTableResponse response = new UpdateActiveTableResponse();
|
||||
response.setSourceInfo(sourceInfo);
|
||||
if (sb.length() > 0) {
|
||||
response.setMessage(sb.toString());
|
||||
}
|
||||
return response;
|
||||
return new ActiveTableSharingResponse(true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,9 +121,11 @@ public class UpdateActiveTableHandler implements
|
|||
* @param activeTableMap
|
||||
* @param mode
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
protected List<ActiveTableRecord> mapToRecords(
|
||||
Map<String, Object>[] activeTableMap, ActiveTableMode mode) {
|
||||
Map<String, Object>[] activeTableMap, ActiveTableMode mode)
|
||||
throws Exception {
|
||||
List<ActiveTableRecord> records = new ArrayList<ActiveTableRecord>(
|
||||
activeTableMap.length);
|
||||
if (activeTableMap != null) {
|
||||
|
@ -214,16 +159,20 @@ public class UpdateActiveTableHandler implements
|
|||
atr.setAct(template.get("act").toString());
|
||||
atr.setSeg((Integer) template.get("seg"));
|
||||
Calendar start = GregorianCalendar.getInstance();
|
||||
start.setTimeInMillis(((Integer) template.get("startTime")) * 1000L);
|
||||
start.setTimeInMillis(((Number) template.get("startTime"))
|
||||
.longValue() * 1000L);
|
||||
atr.setStartTime(start);
|
||||
Calendar end = GregorianCalendar.getInstance();
|
||||
end.setTimeInMillis(((Integer) template.get("endTime")) * 1000L);
|
||||
end.setTimeInMillis(((Number) template.get("endTime"))
|
||||
.longValue() * 1000L);
|
||||
atr.setEndTime(end);
|
||||
Calendar purge = GregorianCalendar.getInstance();
|
||||
purge.setTimeInMillis(((Integer) template.get("purgeTime")) * 1000L);
|
||||
purge.setTimeInMillis(((Number) template.get("purgeTime"))
|
||||
.longValue() * 1000L);
|
||||
atr.setPurgeTime(purge);
|
||||
Calendar issue = GregorianCalendar.getInstance();
|
||||
issue.setTimeInMillis(((Integer) template.get("issueTime")) * 1000L);
|
||||
issue.setTimeInMillis(((Number) template.get("issueTime"))
|
||||
.longValue() * 1000L);
|
||||
atr.setIssueTime(issue);
|
||||
atr.setUfn((Boolean) template.get("ufn"));
|
||||
atr.setOfficeid(template.get("officeid").toString());
|
||||
|
@ -273,7 +222,7 @@ public class UpdateActiveTableHandler implements
|
|||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/**
|
||||
* 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.activetable.handler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jep.JepException;
|
||||
|
||||
import com.raytheon.uf.common.activetable.request.RetrieveRemoteActiveTableRequest;
|
||||
import com.raytheon.uf.common.activetable.response.ActiveTableSharingResponse;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.python.PyUtil;
|
||||
import com.raytheon.uf.common.python.PythonScript;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
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.activetable.ActiveTablePyIncludeUtil;
|
||||
|
||||
/**
|
||||
* Handler for <code>RetrieveRemoteActiveTableRequest</code>. Runs the requestAT
|
||||
* application using the parameters from the request as arguments to the
|
||||
* PythonScript.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 6, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class RetrieveRemoteActiveTableHandler implements
|
||||
IRequestHandler<RetrieveRemoteActiveTableRequest> {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RetrieveRemoteActiveTableHandler.class);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
|
||||
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
|
||||
*/
|
||||
@Override
|
||||
public ActiveTableSharingResponse handleRequest(
|
||||
RetrieveRemoteActiveTableRequest request) throws Exception {
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationContext commonBaseCx = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
|
||||
String scriptPath = pathMgr.getFile(commonBaseCx,
|
||||
FileUtil.join(ActiveTablePyIncludeUtil.VTEC, "requestAT.py"))
|
||||
.getPath();
|
||||
final String siteId = request.getSiteId();
|
||||
String pythonIncludePath = PyUtil.buildJepIncludePath(
|
||||
ActiveTablePyIncludeUtil.getCommonPythonIncludePath(),
|
||||
ActiveTablePyIncludeUtil.getVtecIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getGfeConfigIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getIscScriptsIncludePath());
|
||||
|
||||
PythonScript script = null;
|
||||
try {
|
||||
script = new PythonScript(scriptPath, pythonIncludePath,
|
||||
RetrieveRemoteActiveTableHandler.class.getClassLoader());
|
||||
|
||||
try {
|
||||
Map<String, Object> argMap = new HashMap<String, Object>();
|
||||
argMap.put("serverHost", request.getServerHost());
|
||||
argMap.put("serverPort", request.getServerPort());
|
||||
argMap.put("serverProtocol", request.getServerProtocol());
|
||||
argMap.put("mhsid", request.getMhsId());
|
||||
argMap.put("siteID", siteId);
|
||||
argMap.put("ancf", request.getAncfAddress());
|
||||
argMap.put("bncf", request.getBncfAddress());
|
||||
argMap.put("xmtScript", request.getTransmitScript());
|
||||
script.execute("runFromJava", argMap);
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error executing requestAT.", e);
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Error executing requestAT: " + e.getLocalizedMessage());
|
||||
}
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to instantiate requestAT python script object.", e);
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Unable to instantiate requestAT python script object: "
|
||||
+ e.getLocalizedMessage());
|
||||
} finally {
|
||||
if (script != null) {
|
||||
script.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return new ActiveTableSharingResponse(true, null);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
* 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.activetable.handler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jep.JepException;
|
||||
|
||||
import com.raytheon.uf.common.activetable.request.SendActiveTableRequest;
|
||||
import com.raytheon.uf.common.activetable.response.ActiveTableSharingResponse;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.python.PyUtil;
|
||||
import com.raytheon.uf.common.python.PythonScript;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
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.activetable.ActiveTablePyIncludeUtil;
|
||||
|
||||
/**
|
||||
* Handler for <code>SendActiveTableRequest</code>. Runs the sendAT application
|
||||
* using the parameters from the request as arguments to the PythonScript.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 6, 2013 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SendActiveTableHandler implements
|
||||
IRequestHandler<SendActiveTableRequest> {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SendActiveTableHandler.class);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
|
||||
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
|
||||
*/
|
||||
@Override
|
||||
public ActiveTableSharingResponse handleRequest(
|
||||
SendActiveTableRequest request) throws Exception {
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationContext commonBaseCx = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
|
||||
String scriptPath = pathMgr.getFile(commonBaseCx,
|
||||
FileUtil.join(ActiveTablePyIncludeUtil.VTEC, "sendAT.py"))
|
||||
.getPath();
|
||||
final String siteId = request.getServerSite();
|
||||
String pythonIncludePath = PyUtil.buildJepIncludePath(
|
||||
ActiveTablePyIncludeUtil.getCommonPythonIncludePath(),
|
||||
ActiveTablePyIncludeUtil.getVtecIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getGfeConfigIncludePath(siteId),
|
||||
ActiveTablePyIncludeUtil.getIscScriptsIncludePath());
|
||||
|
||||
PythonScript script = null;
|
||||
try {
|
||||
script = new PythonScript(scriptPath, pythonIncludePath,
|
||||
RetrieveRemoteActiveTableHandler.class.getClassLoader());
|
||||
|
||||
try {
|
||||
Map<String, Object> argMap = new HashMap<String, Object>();
|
||||
argMap.put("myServerHost", request.getServerHost());
|
||||
argMap.put("myServerPort", request.getServerPort());
|
||||
argMap.put("myServerProtocol", request.getServerProtocol());
|
||||
argMap.put("myServerMHSID", request.getMhsId());
|
||||
argMap.put("myServerSite", siteId);
|
||||
argMap.put("sites", request.getSites());
|
||||
argMap.put("filterSites", request.getFilterSites());
|
||||
argMap.put("mhsSites", request.getMhsSites());
|
||||
argMap.put("issueTime", request.getIssueTime());
|
||||
argMap.put("countDict", request.getCountDict());
|
||||
argMap.put("fname", request.getFileName());
|
||||
argMap.put("xmlIncoming", request.getXmlIncoming());
|
||||
argMap.put("xmtScript", request.getTransmitScript());
|
||||
script.execute("runFromJava", argMap);
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error executing sendAT.", e);
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Error executing sendAT: " + e.getLocalizedMessage());
|
||||
}
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to instantiate sendAT python script object.", e);
|
||||
return new ActiveTableSharingResponse(false,
|
||||
"Unable to instantiate sendAT python script object: "
|
||||
+ e.getLocalizedMessage());
|
||||
} finally {
|
||||
if (script != null) {
|
||||
script.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return new ActiveTableSharingResponse(true, null);
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 12/20/09 njensen Initial Creation.
|
||||
# 02/26/13 1447 dgilling Implement __eq__() and
|
||||
# __ne__().
|
||||
#
|
||||
#
|
||||
#
|
||||
|
@ -35,7 +37,7 @@
|
|||
import ActiveTableVtec
|
||||
from java.util import Calendar
|
||||
|
||||
class ActiveTableRecord:
|
||||
class ActiveTableRecord(object):
|
||||
|
||||
def __init__(self, javaRecord, state="Decoded"):
|
||||
self.atr = javaRecord
|
||||
|
@ -150,7 +152,12 @@ class ActiveTableRecord:
|
|||
|
||||
def __deepcopy__(self, memo):
|
||||
return ActiveTableRecord(self.atr.clone(), self.state)
|
||||
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.javaRecord().equals(other.javeRecord())
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def javaRecord(self):
|
||||
return self.atr
|
||||
|
|
|
@ -0,0 +1,430 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# MergeVTEC - merges two "active" tables together.
|
||||
# Originally written by Mark Mathewson FSL
|
||||
|
||||
#
|
||||
# Port of MergeVTEC code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 01/25/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import copy
|
||||
import cPickle
|
||||
import gzip
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
import ActiveTableRecord
|
||||
import siteConfig
|
||||
import VTECPartners
|
||||
import VTECTableSqueeze
|
||||
import VTECTableUtil
|
||||
|
||||
from java.util import ArrayList
|
||||
from com.raytheon.uf.common.activetable import MergeResult
|
||||
from com.raytheon.uf.common.activetable import VTECChange
|
||||
from com.raytheon.uf.common.localization import PathManagerFactory
|
||||
from com.raytheon.uf.common.localization import LocalizationContext_LocalizationType as LocalizationType
|
||||
from com.raytheon.uf.common.site import SiteMap
|
||||
|
||||
|
||||
class MergeVTEC(VTECTableUtil.VTECTableUtil):
|
||||
|
||||
def __init__(self, activeTable, activeTableMode, newRecords, offsetSecs=0.0,
|
||||
makeBackups=True, logger=None):
|
||||
# activeTable - current activeTable records
|
||||
# activeTableMode - which table is being modified--OPERATIONAL or PRACTICE
|
||||
# newRecords - records to merge in to activeTable
|
||||
# inputIsGZIP (0,1) - remote input file is gzipped
|
||||
# offsetSecs - Number of seconds +/- current time
|
||||
# makeBackups (False, True) - make backups of previous table
|
||||
# logger - python logging object to send all logs to
|
||||
if logger is not None:
|
||||
self._log = logger
|
||||
else:
|
||||
self._log = self.__initLogging()
|
||||
|
||||
# create a dummy name to simplify the file access code in VTECTableUtil
|
||||
pathMgr = PathManagerFactory.getPathManager()
|
||||
commonSiteCx = pathMgr.getContextForSite(
|
||||
LocalizationType.COMMON_STATIC, siteConfig.GFESUITE_SITEID)
|
||||
filePath = pathMgr.getFile(commonSiteCx,"vtec").getPath()
|
||||
self._activeTableFilename = os.path.join(filePath, activeTableMode + ".tbl")
|
||||
|
||||
# to ensure time calls are based on Zulu
|
||||
os.environ['TZ'] = "GMT0"
|
||||
self._time = time.time() + offsetSecs #present time
|
||||
|
||||
self._makeBackups = makeBackups
|
||||
|
||||
VTECTableUtil.VTECTableUtil.__init__(self, self._activeTableFilename)
|
||||
|
||||
# get the SPC site id from the configuration file
|
||||
self._spcSite = getattr(VTECPartners, "VTEC_SPC_SITE", "KWNS")
|
||||
self._tpcSite = getattr(VTECPartners, "VTEC_TPC_SITE", "KNHC")
|
||||
|
||||
# get our site
|
||||
siteid = siteConfig.GFESUITE_SITEID
|
||||
self._ourSite = self._get4ID(siteid)
|
||||
|
||||
self._siteFilter = self._getFilterSites()
|
||||
|
||||
self._log.info("MergeVTEC Starting")
|
||||
self._log.info("localFN= " + self._activeTableFilename + " sites= "
|
||||
+ repr(self._siteFilter))
|
||||
|
||||
#read table to merge
|
||||
otherTable = newRecords
|
||||
self._log.info("Remote Table size: %d", len(otherTable))
|
||||
|
||||
#read active table
|
||||
self._log.info("Active Table size: %d", len(activeTable))
|
||||
|
||||
#save a copy for later backup purposes
|
||||
oldActiveTable = copy.deepcopy(activeTable)
|
||||
|
||||
#delete "obsolete" records from our table and the other table
|
||||
vts = VTECTableSqueeze.VTECTableSqueeze(self._time)
|
||||
activeTable, tossRecords = vts.squeeze(activeTable)
|
||||
self._log.info("Active Table squeezed size: %d", len(activeTable))
|
||||
self._log.info("Other Table size: %d", len(otherTable))
|
||||
otherTable, tossRecordsOther = vts.squeeze(otherTable)
|
||||
self._log.info("Other Table squeezed size: %d", len(otherTable))
|
||||
|
||||
#merge the tables
|
||||
updatedTable, toDelete, changes = self._mergeTable(activeTable, otherTable)
|
||||
self._log.info("Updated Active Table size: %d", len(updatedTable))
|
||||
updatedTable, tossRecordsMerged = vts.squeeze(updatedTable)
|
||||
self._log.info("Updated Active Table squeeze size: %d",
|
||||
len(updatedTable))
|
||||
del vts
|
||||
|
||||
self._updatedTable = []
|
||||
self._purgedTable = []
|
||||
self._changes = []
|
||||
|
||||
#notify the ifpServer of changes, save a backup copy
|
||||
if tossRecords or tossRecordsMerged or changes:
|
||||
self._log.debug("#tossRecords: %d", len(tossRecords))
|
||||
self._log.debug("#tossRecordsMerged: %d", len(tossRecordsMerged))
|
||||
self._log.debug("#changes: %d", len(changes))
|
||||
|
||||
# save lists for later retrieval
|
||||
self._updatedTable = updatedTable
|
||||
self._purgedTable.extend(tossRecords)
|
||||
self._purgedTable.extend(toDelete)
|
||||
self._purgedTable.extend([rec for rec in tossRecordsMerged if rec in oldActiveTable])
|
||||
self._changes = changes
|
||||
|
||||
#save backup copy
|
||||
if self._makeBackups:
|
||||
oldActiveTable = self._convertTableToPurePython(oldActiveTable, siteid)
|
||||
self.saveOldActiveTable(oldActiveTable)
|
||||
pTime = getattr(VTECPartners, "VTEC_BACKUP_TABLE_PURGE_TIME",
|
||||
168)
|
||||
self.purgeOldSavedTables(pTime)
|
||||
|
||||
self._log.info("MergeVTEC Finished")
|
||||
|
||||
# merges the active and other table together and returns the merged
|
||||
# table along with the list of changes that occurred.
|
||||
def _mergeTable(self, activeTable, otherTable):
|
||||
changes = []
|
||||
purges = []
|
||||
compare = ['id', 'phen', 'sig', 'officeid', 'etn', 'pil']
|
||||
compare1 = ['phen', 'sig', 'officeid']
|
||||
compare2 = ['officeid', 'pil', 'phen', 'sig', 'etn']
|
||||
missingEntriesPast = []
|
||||
missingEntriesAct = []
|
||||
newReplaceEntriesPast = []
|
||||
oldReplaceEntriesPast = []
|
||||
newReplaceEntriesAct = []
|
||||
oldReplaceEntriesAct = []
|
||||
ignoredNewReplaceAct = []
|
||||
ignoredOldReplaceAct = []
|
||||
|
||||
currentYear = time.gmtime(self._time)[0]
|
||||
terminations = ('CAN', 'EXP', 'UPG')
|
||||
|
||||
# we process each entry in the other (received) table
|
||||
for othRec in otherTable:
|
||||
# filter out all other sites we aren't interested in
|
||||
if self._siteFilter is not None and \
|
||||
othRec['officeid'] not in self._siteFilter:
|
||||
continue
|
||||
|
||||
# filter out ROU and COR codes
|
||||
if othRec['act'] in ["ROU","COR"]:
|
||||
continue
|
||||
|
||||
othRecYear = time.gmtime(othRec['issueTime'])[0]
|
||||
|
||||
# check our active table for this event. if there is only one record
|
||||
# and it is a canceled event, then we keep it that way.
|
||||
|
||||
matches = []
|
||||
for rec in activeTable:
|
||||
if self.hazardCompare(rec, othRec, compare2):
|
||||
atRecYear = time.gmtime(rec['issueTime'])[0]
|
||||
if othRecYear == atRecYear:
|
||||
matches.append(rec)
|
||||
|
||||
if len(matches) == 1 and matches[0]['act'] in terminations:
|
||||
# done with this remote record
|
||||
continue
|
||||
|
||||
# if the remote table has a single canceled record,
|
||||
# copy the record if needed and remove the rest for the event
|
||||
|
||||
canceled = othRec['act'] in terminations
|
||||
if canceled:
|
||||
# determine if the remote table has a single record
|
||||
for othRec2 in otherTable:
|
||||
if self.hazardCompare(othRec2, othRec, compare2):
|
||||
recYear = time.gmtime(othRec2['issueTime'])[0]
|
||||
if recYear == othRecYear and othRec2['id'] != othRec['id']:
|
||||
canceled = False
|
||||
break
|
||||
|
||||
if canceled:
|
||||
# find all the record in our active table for this event
|
||||
matches = []
|
||||
for i, rec in enumerate(activeTable):
|
||||
if self.hazardCompare(rec, othRec, compare2):
|
||||
atRecYear = time.gmtime(rec['issueTime'])[0]
|
||||
if othRecYear == atRecYear:
|
||||
matches.append(i)
|
||||
|
||||
changed = False
|
||||
|
||||
found = False
|
||||
matches.reverse()
|
||||
for i in matches:
|
||||
rec = activeTable[i]
|
||||
if rec['id'] == othRec['id']:
|
||||
found = True
|
||||
# replace record if not the same
|
||||
if rec != othRec:
|
||||
newReplaceEntriesAct.append(othRec)
|
||||
oldReplaceEntriesAct.append(rec)
|
||||
activeTable[i] = othRec
|
||||
changed = True
|
||||
else:
|
||||
# remove other records for this event
|
||||
oldReplaceEntriesAct.append(rec)
|
||||
del activeTable[i]
|
||||
changed = True
|
||||
|
||||
if not found:
|
||||
# add the remote record
|
||||
if len(matches) > 0:
|
||||
newRplaceEntriesAct.append(othRec)
|
||||
else:
|
||||
missingEntriesAct.append(othRec)
|
||||
activeTable.append(othRec)
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
|
||||
if chgRec not in changes:
|
||||
changes.append(chgRec)
|
||||
|
||||
# done with this remote record
|
||||
continue
|
||||
|
||||
|
||||
# currently active events
|
||||
if othRec['endTime'] >= self._time:
|
||||
|
||||
# find a match in otherTable that is in our active table
|
||||
# and replace it if newer, but only if it is from the same
|
||||
# issuance year.
|
||||
found = 0
|
||||
for i in xrange(len(activeTable)):
|
||||
if self.hazardCompare(activeTable[i], othRec, compare):
|
||||
found = 1
|
||||
atRecYear = time.gmtime(activeTable[i]['issueTime'])[0]
|
||||
if othRec['issueTime'] > activeTable[i]['issueTime']:
|
||||
if othRecYear == atRecYear:
|
||||
newReplaceEntriesAct.append(othRec)
|
||||
oldReplaceEntriesAct.append(activeTable[i])
|
||||
activeTable[i] = othRec #replace the record
|
||||
chgRec = (activeTable[i]['officeid'],
|
||||
activeTable[i]['pil'], activeTable[i]['phensig'])
|
||||
if chgRec not in changes:
|
||||
changes.append(chgRec)
|
||||
else:
|
||||
ignoredNewReplaceAct.append(othRec)
|
||||
ignoredOldReplaceAct.append(activeTable[i])
|
||||
break
|
||||
|
||||
# if a match wasn't found, then we may need to add the record
|
||||
# into our active table
|
||||
if found == 0:
|
||||
activeTable.append(othRec) #add the record
|
||||
missingEntriesAct.append(othRec)
|
||||
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
|
||||
if chgRec not in changes:
|
||||
changes.append(chgRec)
|
||||
|
||||
# past events
|
||||
else:
|
||||
|
||||
othRecYear = time.gmtime(othRec['issueTime'])[0]
|
||||
if currentYear != othRecYear:
|
||||
continue #only care about this years
|
||||
|
||||
# find the highest ETN for the current year per phen/sig
|
||||
# in active table and compare to the other table. If found
|
||||
# higher 'remote' record, replace the record.
|
||||
maxETN = None
|
||||
maxETNIndex = None
|
||||
for i in xrange(len(activeTable)):
|
||||
a = activeTable[i]
|
||||
if self.hazardCompare(a, othRec, compare1) and \
|
||||
time.gmtime(a['issueTime'])[0] == currentYear:
|
||||
if maxETN is None or a['etn'] > maxETN:
|
||||
maxETN = a['etn'] #save maxETN
|
||||
maxETNIndex = i #save the index
|
||||
|
||||
if maxETN is not None and othRec['etn'] > maxETN:
|
||||
newReplaceEntriesPast.append(othRec)
|
||||
oldReplaceEntriesPast.append(activeTable[maxETNIndex])
|
||||
activeTable[maxETNIndex] = othRec #replace record
|
||||
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
|
||||
if chgRec not in changes:
|
||||
changes.append(chgRec)
|
||||
|
||||
#if phen/sig not found, then add it
|
||||
if maxETN is None:
|
||||
activeTable.append(othRec) #add the record
|
||||
missingEntriesPast.append(othRec)
|
||||
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
|
||||
if chgRec not in changes:
|
||||
changes.append(chgRec)
|
||||
|
||||
# log the changes
|
||||
if len(missingEntriesAct):
|
||||
self._log.debug("Active Missing entries added: %s",
|
||||
self.printActiveTable(missingEntriesAct, 1))
|
||||
if len(newReplaceEntriesAct):
|
||||
self._log.debug("Active Replacement entries (new): %s",
|
||||
self.printActiveTable(newReplaceEntriesAct, 1))
|
||||
if len(oldReplaceEntriesAct):
|
||||
self._log.debug("Active Entries Replaced (old): %s",
|
||||
self.printActiveTable(oldReplaceEntriesAct, 1))
|
||||
if len(missingEntriesPast):
|
||||
self._log.debug("Past Missing entries added %s",
|
||||
self.printActiveTable(missingEntriesPast, 1))
|
||||
if len(newReplaceEntriesPast):
|
||||
self._log.debug("Past Replacement entries (new): %s",
|
||||
self.printActiveTable(newReplaceEntriesPast, 1))
|
||||
if len(oldReplaceEntriesPast):
|
||||
self._log.debug("Past Entries Replaced (old): %s",
|
||||
self.printActiveTable(oldReplaceEntriesPast, 1))
|
||||
if len(ignoredNewReplaceAct):
|
||||
self._log.debug("Ignored Different Year Issuance (new): %s",
|
||||
self.printActiveTable(ignoredNewReplaceAct, 1))
|
||||
self._log.debug("Ignored Different Year Issuance (old): %s",
|
||||
self.printActiveTable(ignoredOldReplaceAct, 1))
|
||||
self._log.debug("Table Changes: %s", changes)
|
||||
|
||||
purges.extend(oldReplaceEntriesAct)
|
||||
purges.extend(oldReplaceEntriesPast)
|
||||
return activeTable, purges, changes
|
||||
|
||||
def getMergeResults(self):
|
||||
if not self._updatedTable and not self._purgedTable and not self._changes:
|
||||
return None
|
||||
|
||||
updatedList = ArrayList()
|
||||
for rec in self._updatedTable:
|
||||
updatedList.add(rec.javaRecord())
|
||||
|
||||
purgedList = ArrayList()
|
||||
for rec in self._purgedTable:
|
||||
purgedList.add(rec.javaRecord())
|
||||
|
||||
changeList = ArrayList()
|
||||
for c in self._changes:
|
||||
changeList.add(VTECChange(c[0],c[1],c[2]))
|
||||
|
||||
result = MergeResult(updatedList, purgedList, changeList)
|
||||
return result
|
||||
|
||||
def _getFilterSites(self):
|
||||
#gets the list of filter sites, which is the list specified, plus
|
||||
#SPC plus our own site. Returns None for no-filtering.
|
||||
sites = getattr(VTECPartners, "VTEC_MERGE_SITES", [])
|
||||
if sites is None:
|
||||
return None
|
||||
sites.append(self._spcSite)
|
||||
sites.append(self._tpcSite)
|
||||
sites.append(self._ourSite)
|
||||
self._log.debug("Filter Sites: %s", sites)
|
||||
return sites
|
||||
|
||||
#convert 3 letter to 4 letter site ids
|
||||
def _get4ID(self, id):
|
||||
return SiteMap.getInstance().getSite4LetterId(id)
|
||||
|
||||
def __initLogging(self):
|
||||
logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
|
||||
time.strftime("%Y%m%d", time.gmtime()), 'MergeVTEC.log')
|
||||
try:
|
||||
os.makedirs(os.path.dirname(logPath))
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
|
||||
sys.exit(-1)
|
||||
|
||||
logging.basicConfig(filename=logPath,
|
||||
format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
return logging.getLogger("MergeVTEC")
|
||||
|
||||
def merge(activeTable, activeTableMode, newRecords, drt=0.0, makeBackups=True,
|
||||
logger=None):
|
||||
pyActive = []
|
||||
for i in range(activeTable.size()):
|
||||
pyActive.append(ActiveTableRecord.ActiveTableRecord(activeTable.get(i)))
|
||||
|
||||
pyNew = []
|
||||
for i in range(newRecords.size()):
|
||||
pyNew.append(ActiveTableRecord.ActiveTableRecord(newRecords.get(i)))
|
||||
|
||||
decoder = MergeVTEC(pyActive, activeTableMode, pyNew, drt, makeBackups, logger)
|
||||
mergeResults = decoder.getMergeResults()
|
||||
decoder = None
|
||||
|
||||
return mergeResults
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
|
||||
#VTEC_Partners.py - configuration file to control filtering and merging
|
||||
#of VTEC active table.
|
||||
|
||||
|
@ -46,7 +47,7 @@ VTEC_DECODER_SITES = []
|
|||
# The following list is a set of product categories (e.g., ZFP, WOU) that
|
||||
# when decoded, the text for each segment is captured. The text is not
|
||||
# normally needed to be captured except for warning-style products.
|
||||
VTEC_CAPTURE_TEXT_CATEGORIES = []#['WSW', 'NPW', 'RFW', 'FFA', 'CFW', 'MWS', 'HLS', 'MWW']
|
||||
VTEC_CAPTURE_TEXT_CATEGORIES = ['WSW', 'NPW', 'RFW', 'FFA', 'CFW', 'MWS', 'HLS', 'MWW']
|
||||
|
||||
# Remapping of product pils. This is required for certain VTEC events
|
||||
# if a hazard is created in one pil and then updated or cancelled in another
|
||||
|
|
|
@ -213,7 +213,8 @@ class VTECTableSqueeze:
|
|||
for ps in phensig:
|
||||
issueYears = d[o][ps].keys()
|
||||
for iy in issueYears:
|
||||
etns = d[o][ps][iy].keys()
|
||||
dd = d[o][ps][iy]
|
||||
etns = dd.keys()
|
||||
|
||||
#get two maxetn for tropicalPhen (one for site created and the other
|
||||
#for NHC created. The etn will be more than 100 for NHC hazards),
|
||||
|
@ -227,50 +228,75 @@ class VTECTableSqueeze:
|
|||
else:
|
||||
maxetn2 = maxetn1
|
||||
|
||||
ids1 = d[o][ps][iy][maxetn1]
|
||||
ids1 = dd[maxetn1]
|
||||
minid1 = min(ids1)
|
||||
|
||||
ids2 = ids1
|
||||
minid2 = minid1
|
||||
|
||||
if maxetn2 > 0 and maxetn2 != maxetn1:
|
||||
ids2 = d[o][ps][iy][maxetn2]
|
||||
ids2 = dd[maxetn2]
|
||||
minid2 = min(ids2)
|
||||
|
||||
#determine what to keep and what to toss
|
||||
for etn in d[o][ps][iy].keys():
|
||||
for id in d[o][ps][iy][etn].keys():
|
||||
for rec in d[o][ps][iy][etn][id]:
|
||||
for etn in etns:
|
||||
all_hourOld = True
|
||||
all_cancelled = True
|
||||
all_twoWeeksOld = True
|
||||
ufn = None
|
||||
|
||||
ufn = rec.get('ufn',0)
|
||||
for id in dd[etn].keys():
|
||||
for rec in dd[etn][id]:
|
||||
if ufn is None:
|
||||
ufn = rec.get('ufn', False)
|
||||
hourOld = self.__ctime > rec['endTime'] + (1*3600)
|
||||
twoWeeksOld = self.__ctime > rec['issueTime'] + (14*86400)
|
||||
cancelled = rec['act'] in ['CAN','UPG','EXP']
|
||||
# keep records that are:
|
||||
# 1. are UFN, not cancelled, and not older then two weeks.
|
||||
# 2. not UFN, and not ended in the last hour
|
||||
# 3. cancelled, from this year, are minid, and are maxetn
|
||||
if ufn and not cancelled and not twoWeeksOld: # 1
|
||||
all_hourOld &= hourOld
|
||||
all_cancelled &= cancelled
|
||||
all_twoWeeksOld &= twoWeeksOld
|
||||
|
||||
# keep records if the event:
|
||||
# 1. is UFN, not cancelled, and not older then two weeks.
|
||||
# 2. not UFN, and not ended in the last hour
|
||||
# 3. cancelled, from this year, keep only records that are minid, and maxetn
|
||||
|
||||
if ufn and not all_cancelled and not all_twoWeeksOld: # 1
|
||||
for id in dd[etn].keys():
|
||||
for rec in dd[etn][id]:
|
||||
saveRec.append(rec)
|
||||
elif not ufn and not hourOld: # 2
|
||||
|
||||
elif not ufn and not all_hourOld: # 2
|
||||
for id in dd[etn].keys():
|
||||
for rec in dd[etn][id]:
|
||||
saveRec.append(rec)
|
||||
elif iy == self.__thisYear and \
|
||||
rec['id'] == minid1 and \
|
||||
rec['etn'] == maxetn1:
|
||||
if rec['officeid'] in ['KNHC'] and twoWeeksOld:
|
||||
LogStream.logDebug("******** WILL PURGE *******", rec['vtecstr'])
|
||||
else:
|
||||
saveRec.append(rec)
|
||||
elif iy == self.__thisYear and \
|
||||
maxetn1 != maxetn2 and \
|
||||
rec['phen'] in tropicalPhen and \
|
||||
rec['id'] == minid2 and \
|
||||
rec['etn'] == maxetn2: # 3
|
||||
saveRec.append(rec)
|
||||
# otherwise, remove them
|
||||
|
||||
elif iy == self.__thisYear and etn == maxetn1: # 3
|
||||
for id in dd[etn].keys():
|
||||
if (id == minid1):
|
||||
for rec in dd[etn][id]:
|
||||
saveRec.append(rec)
|
||||
else:
|
||||
for rec in dd[etn][id]:
|
||||
LogStream.logDebug("******** WILL PURGE *******", rec['vtecstr'])
|
||||
purgeRec.append(rec)
|
||||
|
||||
elif (iy == self.__thisYear) and (etn == maxetn2): # 3
|
||||
for id in dd[etn].keys():
|
||||
if (id == minid2):
|
||||
for rec in dd[etn][id]:
|
||||
saveRec.append(rec)
|
||||
else:
|
||||
for rec in dd[etn][id]:
|
||||
LogStream.logDebug("******** WILL PURGE *******", rec['vtecstr'])
|
||||
purgeRec.append(rec)
|
||||
|
||||
else:
|
||||
for id in dd[etn].keys():
|
||||
for rec in dd[etn][id]:
|
||||
LogStream.logDebug("******** WILL PURGE *******", rec['vtecstr'])
|
||||
purgeRec.append(rec)
|
||||
|
||||
return saveRec, purgeRec
|
||||
|
||||
#prints the dictionary organized by oid, phensig, issueYear, etn, id
|
||||
|
|
|
@ -19,10 +19,22 @@
|
|||
##
|
||||
# Utility classes for the VTEC active table
|
||||
|
||||
import time, copy, types
|
||||
import copy
|
||||
import cPickle
|
||||
import errno
|
||||
import glob
|
||||
import gzip
|
||||
import os
|
||||
import stat
|
||||
import time
|
||||
import types
|
||||
|
||||
import LogStream
|
||||
import JUtil
|
||||
|
||||
from java.util import ArrayList
|
||||
from com.raytheon.uf.edex.activetable import ActiveTable
|
||||
|
||||
|
||||
class VTECTableUtil:
|
||||
|
||||
|
@ -290,4 +302,85 @@ class VTECTableUtil:
|
|||
return "K" + id
|
||||
|
||||
|
||||
#------------------------------------------------------------------
|
||||
# Table lock/unlock read/write utility
|
||||
#------------------------------------------------------------------
|
||||
|
||||
def saveOldActiveTable(self, oldActiveTable):
|
||||
#saves off the specified table and time stamps it
|
||||
|
||||
if self._activeTableFilename is None:
|
||||
raise Exception, "saveOldActiveTable without filename"
|
||||
|
||||
#determine filename
|
||||
directory = os.path.join(os.path.dirname(self._activeTableFilename), "backup")
|
||||
try:
|
||||
os.makedirs(directory)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
LogStream.logProblem("Could not create active table backup directory:",
|
||||
directory, LogStream.exc())
|
||||
raise e
|
||||
|
||||
gmtime = time.gmtime(time.time())
|
||||
format = "%Y%m%d_%H%M%S"
|
||||
baseN = os.path.basename(self._activeTableFilename)
|
||||
fn = time.strftime(format, gmtime) + "_" + baseN
|
||||
filename = os.path.join(directory, fn + ".gz")
|
||||
|
||||
t = time.time()
|
||||
try:
|
||||
os.chmod(filename, 0666)
|
||||
os.remove(filename)
|
||||
except:
|
||||
pass
|
||||
|
||||
#output file
|
||||
#gzip it to save space
|
||||
with gzip.GzipFile(filename, 'wb', 9) as fd:
|
||||
buf = cPickle.dumps(oldActiveTable)
|
||||
fd.write(buf)
|
||||
os.chmod(filename, 0664)
|
||||
|
||||
t1 = time.time()
|
||||
tstr = "%.3f" % (t1-t)
|
||||
LogStream.logVerbose("Saved Previous Active Table: ", fn, "t=",
|
||||
tstr, "sec.")
|
||||
|
||||
def purgeOldSavedTables(self, purgeTime):
|
||||
#purges old saved tables
|
||||
|
||||
if self._activeTableFilename is None:
|
||||
raise Exception, "purgeOldSavedTables without filename"
|
||||
|
||||
#calculate purge time
|
||||
purgeTime = time.time() - (purgeTime * 3600)
|
||||
|
||||
#directory and files
|
||||
directory = os.path.join(os.path.dirname(self._activeTableFilename), "backup")
|
||||
baseN = os.path.basename(self._activeTableFilename)
|
||||
idx = baseN.find(".")
|
||||
if idx != -1:
|
||||
baseN = baseN[0:idx]
|
||||
files = glob.glob(directory + "/*" + baseN + "*.gz")
|
||||
|
||||
#delete files older than purgeTime
|
||||
for f in files:
|
||||
try:
|
||||
modTime = os.stat(f)[stat.ST_MTIME]
|
||||
if modTime < purgeTime:
|
||||
os.remove(f)
|
||||
LogStream.logDebug("Removing old file: ", f)
|
||||
except:
|
||||
LogStream.logProblem("Problem Removing old backup file: ", f,
|
||||
LogStream.exc())
|
||||
|
||||
def _convertTableToPurePython(self, table, siteId):
|
||||
javaRecList = ArrayList()
|
||||
for rec in table:
|
||||
javaRecList.add(rec.javaRecord())
|
||||
|
||||
javaDictFormat = ActiveTable.convertToDict(javaRecList, siteId)
|
||||
|
||||
return JUtil.javaObjToPyVal(javaDictFormat)
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
#
|
||||
# Port of ingestAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 02/13/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import IrtAccess
|
||||
import MergeVTEC
|
||||
import siteConfig
|
||||
|
||||
|
||||
log = None
|
||||
|
||||
def init_logging():
|
||||
logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
|
||||
time.strftime("%Y%m%d", time.gmtime()), 'ingestAT.log')
|
||||
try:
|
||||
os.makedirs(os.path.dirname(logPath))
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
|
||||
sys.exit(-1)
|
||||
|
||||
logging.basicConfig(filename=logPath,
|
||||
format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
global log
|
||||
log = logging.getLogger("ingestAT")
|
||||
|
||||
|
||||
def execute_ingest_at(incomingRecords, activeTable, atName, ztime, makeBackups, xmlIncoming):
|
||||
# log the source of this data
|
||||
if xmlIncoming is not None:
|
||||
irt = IrtAccess.IrtAccess("")
|
||||
xmlTree = ET.ElementTree(ET.XML(xmlIncoming))
|
||||
sourceE = xmlTree.find('source')
|
||||
for addressE in sourceE.getchildren():
|
||||
sourceServer = irt.decodeXMLAddress(addressE)
|
||||
if sourceServer is None:
|
||||
continue
|
||||
log.info("Source Server: " + irt.printServerInfo(sourceServer))
|
||||
|
||||
results = None
|
||||
try:
|
||||
results = MergeVTEC.merge(activeTable, atName, incomingRecords, ztime, makeBackups,
|
||||
logging.getLogger('MergeVTEC'))
|
||||
except:
|
||||
log.exception("MergeVTEC fail:")
|
||||
return results
|
||||
|
||||
def runFromJava(activeTable, activeTableMode, newRecords, drt, makeBackups,
|
||||
xmlIncoming):
|
||||
init_logging()
|
||||
|
||||
log.info('************* ingestAT ************************')
|
||||
startT = time.time()
|
||||
|
||||
results = execute_ingest_at(newRecords, activeTable, activeTableMode, drt,
|
||||
makeBackups, xmlIncoming)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Finish
|
||||
#--------------------------------------------------------------------
|
||||
endT = time.time()
|
||||
log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
|
||||
|
||||
return results
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
#
|
||||
# Port of requestAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 02/06/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
import cPickle
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import IrtAccess
|
||||
import siteConfig
|
||||
import VTECPartners
|
||||
|
||||
from com.raytheon.uf.common.activetable import ActiveTableMode
|
||||
from com.raytheon.uf.edex.activetable import ActiveTable
|
||||
|
||||
|
||||
|
||||
log = None
|
||||
|
||||
def init_logging():
|
||||
logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
|
||||
time.strftime("%Y%m%d", time.gmtime()), 'requestAT.log')
|
||||
try:
|
||||
os.makedirs(os.path.dirname(logPath))
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
|
||||
sys.exit(-1)
|
||||
|
||||
logging.basicConfig(filename=logPath,
|
||||
format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
global log
|
||||
log = logging.getLogger("requestAT")
|
||||
|
||||
def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, ancf,
|
||||
bncf, xmtScript):
|
||||
#--------------------------------------------------------------------
|
||||
# Create a message - pickled
|
||||
# (MHSsiteID, mySiteID, listOfVTECMergeSites, countDict, issueTime)
|
||||
# Note that VTEC_MERGE_SITES does not contain our site or SPC, TPC.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# determine my 4 letter siteid
|
||||
if siteID in ['SJU']:
|
||||
mysite4 = "TJSJ"
|
||||
elif siteID in ['AFG','AJK','HFO','GUM']:
|
||||
mysite4 = "P" + siteID
|
||||
elif siteID in ['AER','ALU']:
|
||||
mysite4 = "PAFC"
|
||||
else:
|
||||
mysite4 = "K" + siteID
|
||||
otherSites = [mysite4, VTECPartners.VTEC_SPC_SITE,
|
||||
VTECPartners.VTEC_TPC_SITE]
|
||||
|
||||
# determine the MHS WMO id for this message
|
||||
wmoid = "TTAA00 " + mysite4
|
||||
wmoid += " " + time.strftime("%d%H%M", time.gmtime(time.time()))
|
||||
|
||||
# connect to ifpServer and retrieve active table
|
||||
actTab = ActiveTable.getActiveTable(mysite4, ActiveTableMode.OPERATIONAL)
|
||||
|
||||
# analyze active table to get counts
|
||||
countDict = {}
|
||||
issueTime = 0
|
||||
for i in xrange(actTab.size()):
|
||||
rec = actTab.get(i)
|
||||
# only care about our own sites that we merge
|
||||
if rec.getOfficeid() not in VTECPartners.VTEC_MERGE_SITES and \
|
||||
rec.getOfficeid() not in otherSites:
|
||||
continue
|
||||
|
||||
recIssueTime = rec.getIssueTime().getTimeInMillis() / 1000
|
||||
#track latest
|
||||
issueTime = max(recIssueTime, issueTime)
|
||||
|
||||
cnt = countDict.get(rec.getOfficeid(), 0) #get old count
|
||||
countDict[rec.getOfficeid()] = cnt + 1
|
||||
|
||||
data = (mhsid, siteID, VTECPartners.VTEC_MERGE_SITES, countDict, issueTime)
|
||||
log.info("Data: " + repr(data))
|
||||
|
||||
tempdir = os.path.join(siteConfig.GFESUITE_HOME, "products", "ATBL")
|
||||
with tempfile.NamedTemporaryFile(suffix='.reqat', dir=tempdir, delete=False) as fp:
|
||||
fname = fp.name
|
||||
buf = cPickle.dumps(data)
|
||||
fp.write(buf)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Assemble XML source/destination document
|
||||
#--------------------------------------------------------------------
|
||||
msgSendDest = [] #list of mhs sites to send request
|
||||
|
||||
irt = IrtAccess.IrtAccess(ancf, bncf)
|
||||
iscE = ET.Element('isc')
|
||||
# this is the requestor of the data
|
||||
sourceServer = {'mhsid': mhsid, 'host': serverHost, 'port': serverPort,
|
||||
'protocol': serverProtocol, 'site': siteID}
|
||||
irt.addSourceXML(iscE, sourceServer)
|
||||
log.info("Requesting Server: " + irt.printServerInfo(sourceServer))
|
||||
|
||||
# who is running the domains requested?
|
||||
sites = VTECPartners.VTEC_TABLE_REQUEST_SITES
|
||||
if not sites:
|
||||
log.error('No sites defined for VTEC_TABLE_REQUEST_SITES')
|
||||
sys.exit(1)
|
||||
|
||||
status, xml = irt.getServers(sites)
|
||||
if not status:
|
||||
log.error('Failure to getServers from IRT')
|
||||
sys.exit(1)
|
||||
|
||||
# decode the XML
|
||||
try:
|
||||
serverTree = ET.ElementTree(ET.XML(xml))
|
||||
serversE = serverTree.getroot()
|
||||
except:
|
||||
log.exception("Malformed XML on getServers()")
|
||||
sys.exit(1)
|
||||
|
||||
if serversE.tag != "servers":
|
||||
log.error("Servers packet missing from web server")
|
||||
sys.exit(1)
|
||||
|
||||
# process each requested domain returned to us
|
||||
chosenServers = []
|
||||
matchingServers = []
|
||||
for domainE in serversE:
|
||||
if domainE.tag != "domain":
|
||||
continue
|
||||
servers = [] #list of servers for this domain
|
||||
|
||||
# decode each server in the domain
|
||||
for addressE in domainE.getchildren():
|
||||
info = irt.decodeXMLAddress(addressE)
|
||||
if info is None:
|
||||
continue #not address tag
|
||||
servers.append(info)
|
||||
matchingServers.append(info)
|
||||
|
||||
# server search list in priority. The px3 entries are used for
|
||||
# dual domain for AFC.
|
||||
hp = [('dx4','98000000'),('px3', '98000000'), ('dx4','98000001'),
|
||||
('px3', '98000001')]
|
||||
|
||||
# choose one server from this domain, find first dx4, 98000000
|
||||
# try to use one with the same mhsidDest as the site, which
|
||||
# would be the primary operational GFE. Note that the px3 entries
|
||||
# are for AFC.
|
||||
found = False
|
||||
for matchServer, matchPort in hp:
|
||||
for server in servers:
|
||||
if server['host'][0:3] == matchServer and \
|
||||
server['port'] == matchPort and server['mhsid'] == siteID:
|
||||
chosenServers.append(server)
|
||||
if server['mhsid'] not in msgSendDest:
|
||||
msgSendDest.append(server['mhsid'])
|
||||
found = True
|
||||
break
|
||||
|
||||
# find first dx4, 98000000, but perhaps a different mhsid
|
||||
# this is probably not the primary operational GFE
|
||||
if not found:
|
||||
for matchServer, matchPort in hp:
|
||||
for server in servers:
|
||||
if server['host'][0:3] == matchServer and \
|
||||
server['port'] == matchPort:
|
||||
chosenServers.append(server)
|
||||
if server['mhsid'] not in msgSendDest:
|
||||
msgSendDest.append(server['mhsid'])
|
||||
found = True
|
||||
break
|
||||
|
||||
# if didn't find standard one, then take the first one, but don't
|
||||
# take ourselves unless we are the only one.
|
||||
if not found and servers:
|
||||
for server in servers:
|
||||
if server['mhsid'] != mhsid and server['host'] != serverHost \
|
||||
and server['port'] != serverPort and \
|
||||
server['mhsid'] != siteID:
|
||||
chosenServers.append(server)
|
||||
if server['mhsid'] not in msgSendDest:
|
||||
msgSendDest.append(server['mhsid'])
|
||||
found = True
|
||||
if not found:
|
||||
chosenServers.append(servers[0])
|
||||
if servers[0]['mhsid'] not in msgSendDest:
|
||||
msgSendDest.append(servers[0]['mhsid'])
|
||||
|
||||
# Display the set of matching servers
|
||||
s = "Matching Servers:"
|
||||
for x in matchingServers:
|
||||
s += "\n" + irt.printServerInfo(x)
|
||||
log.info(s)
|
||||
|
||||
# Display the chosen set of servers
|
||||
s = "Chosen Servers:"
|
||||
for x in chosenServers:
|
||||
s += "\n" + irt.printServerInfo(x)
|
||||
log.info(s)
|
||||
|
||||
irt.addDestinationXML(iscE, chosenServers)
|
||||
|
||||
# create the XML file
|
||||
with tempfile.NamedTemporaryFile(suffix='.xml', dir=tempdir, delete=False) as fd:
|
||||
fnameXML = fd.name
|
||||
fd.write(ET.tostring(iscE))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Now send the message
|
||||
#--------------------------------------------------------------------
|
||||
irt.transmitFiles("GET_ACTIVE_TABLE2", msgSendDest, mhsid,
|
||||
[fname, fnameXML], xmtScript)
|
||||
|
||||
|
||||
def runFromJava(serverHost, serverPort, serverProtocol, mhsid, siteID, ancf,
|
||||
bncf, xmtScript):
|
||||
init_logging()
|
||||
|
||||
log.info('*********** requestAT ******************')
|
||||
startT = time.time()
|
||||
|
||||
try:
|
||||
execute_request_at(serverHost, serverPort, serverProtocol, mhsid,
|
||||
siteID, ancf, bncf, xmtScript)
|
||||
except:
|
||||
log.exception('Error requesting active table')
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Finish
|
||||
#--------------------------------------------------------------------
|
||||
endT = time.time()
|
||||
log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
|
||||
|
|
@ -0,0 +1,300 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
#
|
||||
# Port of sendAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 02/08/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import cPickle
|
||||
import errno
|
||||
import gzip
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import tempfile
|
||||
import stat
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import IrtAccess
|
||||
import JUtil
|
||||
import siteConfig
|
||||
import VTECPartners
|
||||
import VTECTableSqueeze
|
||||
|
||||
# Configuration Item for Test Purposes
|
||||
FORCE_SEND = False #Set to True to always send even if no updates required.
|
||||
|
||||
log = None
|
||||
|
||||
def init_logging():
|
||||
logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
|
||||
time.strftime("%Y%m%d", time.gmtime()), 'sendAT.log')
|
||||
try:
|
||||
os.makedirs(os.path.dirname(logPath))
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
|
||||
sys.exit(-1)
|
||||
|
||||
logging.basicConfig(filename=logPath,
|
||||
format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
global log
|
||||
log = logging.getLogger("sendAT")
|
||||
|
||||
def execute_send_at(myServerHost, myServerPort, myServerProtocol,
|
||||
myServerMHSID, myServerSite, sites, filterSites, mhsSites,
|
||||
issueTime, countDict, fname, xmlIncoming, xmtScript):
|
||||
log.info('reqSite= ' + repr(sites))
|
||||
log.info('filterSites= ' + repr(filterSites))
|
||||
log.info('mhsSite= ' + repr(mhsSites))
|
||||
log.info('reqCountDict= ' + repr(countDict))
|
||||
if issueTime is None:
|
||||
log.info('reqIssueTime= None')
|
||||
else:
|
||||
log.info('reqIssueTime= ' + str(issueTime) + ' ' +
|
||||
time.asctime(time.gmtime(issueTime)))
|
||||
|
||||
irt = IrtAccess.IrtAccess("")
|
||||
myServer = {'mhsid': myServerMHSID, 'host': myServerHost, 'port': myServerPort,
|
||||
'protocol': myServerProtocol, 'site': myServerSite}
|
||||
log.info('MyServer: ' + irt.printServerInfo(myServer))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Prepare the file for sending
|
||||
#--------------------------------------------------------------------
|
||||
with open(fname, 'rb') as fd:
|
||||
buf = fd.read()
|
||||
os.remove(fname)
|
||||
table = cPickle.loads(buf) #unpickle it
|
||||
log.info("Local Table Length= " + str(len(table)))
|
||||
|
||||
filtTable = []
|
||||
# filter by sites listing
|
||||
if filterSites:
|
||||
for t in table:
|
||||
if t['oid'] in filterSites or t['oid'][1:4] in sites or \
|
||||
t['oid'] == VTECPartners.VTEC_SPC_SITE or \
|
||||
t['oid'] == VTECPartners.VTEC_TPC_SITE:
|
||||
filtTable.append(t)
|
||||
else:
|
||||
filtTable = table #no filtering
|
||||
log.info("Site Filtered Table Length= " + str(len(filtTable)))
|
||||
|
||||
# eliminate obsolete records
|
||||
ctime = time.time() #now time
|
||||
vts = VTECTableSqueeze.VTECTableSqueeze(ctime)
|
||||
filtTable = rename_fields_for_A2(filtTable)
|
||||
actTable, tossRecords = vts.squeeze(filtTable)
|
||||
actTable = rename_fields_for_A1(actTable)
|
||||
log.info("Squeezed Table Length= " + str(len(actTable)))
|
||||
|
||||
# check issuance time - any times newer in remote table (this table) than
|
||||
# the local table (requesting site)?
|
||||
if issueTime is not None:
|
||||
newerRec = False
|
||||
newestRec = 0.0
|
||||
for t in actTable:
|
||||
if newestRec < t['issueTime']:
|
||||
newestRec = t['issueTime']
|
||||
if issueTime < newestRec:
|
||||
newerRec = True
|
||||
|
||||
log.info("NewestFound= " + str(newestRec) + ' ' +
|
||||
time.asctime(time.gmtime(newestRec)))
|
||||
log.info("IssueTime check. Newer record found= " + str(newerRec))
|
||||
else:
|
||||
newerRec = True #just assume there are newer records
|
||||
|
||||
# check "counts" for number of records. Any more records means that
|
||||
# we may be missing some records.
|
||||
if countDict:
|
||||
missingRec = False
|
||||
localCountDict = {}
|
||||
for t in actTable:
|
||||
if localCountDict.has_key(t['oid']):
|
||||
localCountDict[t['oid']] = localCountDict[t['oid']] + 1
|
||||
else:
|
||||
localCountDict[t['oid']] = 1
|
||||
for site in localCountDict:
|
||||
reqCount = countDict.get(site, 0) #number in requesting site
|
||||
if reqCount != localCountDict[site]: #records different in request site
|
||||
missingRec = True
|
||||
break
|
||||
log.info("MissingRec check. Missing record found= " + str(missingRec))
|
||||
log.info("lclCountBySite= " + repr(localCountDict))
|
||||
log.info("reqCountBySite= " + repr(countDict))
|
||||
else:
|
||||
missingRec = True #just assume there are
|
||||
|
||||
#should we send?
|
||||
if missingRec or newerRec or FORCE_SEND:
|
||||
sendIt = True
|
||||
else:
|
||||
sendIt = False
|
||||
|
||||
if sendIt:
|
||||
actTablePickled = cPickle.dumps(actTable) #repickle it
|
||||
rawSize = len(actTablePickled)
|
||||
|
||||
#output it as gzipped
|
||||
fname = fname + ".gz"
|
||||
with gzip.open(fname, 'wb', 6) as fd:
|
||||
fd.write(actTablePickled)
|
||||
|
||||
gzipSize = os.stat(fname)[stat.ST_SIZE]
|
||||
log.info('#dataSize: ' + str(rawSize) + ', #gzipSize: ' + str(gzipSize))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create the destination XML file
|
||||
#--------------------------------------------------------------------
|
||||
iscOut = Element('isc')
|
||||
irt.addSourceXML(iscOut, myServer)
|
||||
|
||||
destServers = []
|
||||
|
||||
if xmlIncoming is not None:
|
||||
with open(xmlIncoming,'rb') as fd:
|
||||
xml = fd.read()
|
||||
os.remove(xmlIncoming)
|
||||
reqTree = ET.ElementTree(ET.XML(xml))
|
||||
sourceE = reqTree.find('source')
|
||||
for addressE in sourceE.getchildren():
|
||||
destServer = irt.decodeXMLAddress(addressE)
|
||||
if destServer is None:
|
||||
continue
|
||||
destServers.append(destServer)
|
||||
break
|
||||
|
||||
# no XML received on request, this is probably from an older site.
|
||||
# create a dummy response XML file. Try all combinations. Only
|
||||
# the mhsid is important for older sites.
|
||||
else:
|
||||
servers = []
|
||||
for mhss in mhsSites:
|
||||
for port in xrange(98000000, 98000002):
|
||||
for site in sites:
|
||||
for host in ['dx4f','px3']:
|
||||
destServer = {'mhsid': mhss, 'host': host,
|
||||
'port': port, 'protocol': "20070723",
|
||||
'site': site}
|
||||
destServers.append(destServer)
|
||||
|
||||
irt.addDestinationXML(iscOut, destServers) #add the dest server xml
|
||||
|
||||
# print out destinations
|
||||
s = "Destinations:"
|
||||
for destServer in destServers:
|
||||
s += "\n" + irt.printServerInfo(destServer)
|
||||
log.info(s)
|
||||
|
||||
# create XML file
|
||||
tempdir = os.path.join(siteConfig.GFESUITE_HOME, "products", "ATBL")
|
||||
with tempfile.NamedTemporaryFile(suffix='.xml', dir=tempdir, delete=False) as fd:
|
||||
fnameXML = fd.name
|
||||
fd.write(ET.tostring(iscOut))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Send it
|
||||
#--------------------------------------------------------------------
|
||||
irt.transmitFiles("PUT_ACTIVE_TABLE2", mhsSites, myServerSite,
|
||||
[fname, fnameXML], xmtScript)
|
||||
|
||||
else:
|
||||
log.info("Send has been skipped")
|
||||
|
||||
def rename_fields_for_A1(table):
|
||||
newTable = []
|
||||
for record in table:
|
||||
record['oid'] = record['officeid']
|
||||
del record['officeid']
|
||||
record['vstr'] = record['vtecstr']
|
||||
del record['vtecstr']
|
||||
record['end'] = record['endTime']
|
||||
del record['endTime']
|
||||
record['start'] = record['startTime']
|
||||
del record['startTime']
|
||||
record['key'] = record['phensig']
|
||||
del record['phensig']
|
||||
if record.has_key('segText'):
|
||||
record['text'] = record['segText']
|
||||
del record['segText']
|
||||
newTable.append(record)
|
||||
|
||||
return newTable
|
||||
|
||||
def rename_fields_for_A2(table):
|
||||
newTable = []
|
||||
for record in table:
|
||||
record['officeid'] = record['oid']
|
||||
del record['oid']
|
||||
record['vtecstr'] = record['vstr']
|
||||
del record['vstr']
|
||||
record['endTime'] = record['end']
|
||||
del record['end']
|
||||
record['startTime'] = record['start']
|
||||
del record['start']
|
||||
record['phensig'] = record['key']
|
||||
del record['key']
|
||||
if record.has_key('text'):
|
||||
record['segText'] = record['text']
|
||||
del record['text']
|
||||
newTable.append(record)
|
||||
|
||||
return newTable
|
||||
|
||||
def runFromJava(myServerHost, myServerPort, myServerProtocol, myServerMHSID,
|
||||
myServerSite, sites, filterSites, mhsSites, issueTime,
|
||||
countDict, fname, xmlIncoming, xmtScript):
|
||||
init_logging()
|
||||
|
||||
log.info('*********** sendAT ****************')
|
||||
startT = time.time()
|
||||
|
||||
try:
|
||||
sites = JUtil.javaObjToPyVal(sites)
|
||||
filterSites = JUtil.javaObjToPyVal(filterSites)
|
||||
mhsSites = JUtil.javaObjToPyVal(mhsSites)
|
||||
countDict = JUtil.javaObjToPyVal(countDict)
|
||||
|
||||
execute_send_at(myServerHost, myServerPort, myServerProtocol,
|
||||
myServerMHSID, myServerSite, sites, filterSites,
|
||||
mhsSites, issueTime, countDict, fname, xmlIncoming,
|
||||
xmtScript)
|
||||
except:
|
||||
log.exception('Error in sendAT:')
|
||||
sys.exit(1)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Finish
|
||||
#--------------------------------------------------------------------
|
||||
endT = time.time()
|
||||
log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
|
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/MergeVTEC
Normal file
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/MergeVTEC
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/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.
|
||||
##
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
path_to_script=`readlink -f $0`
|
||||
RUN_FROM_DIR=`dirname $path_to_script`
|
||||
|
||||
GFESUITE_DIR=`dirname $RUN_FROM_DIR`
|
||||
|
||||
# get the base environment
|
||||
source ${RUN_FROM_DIR}/setup.env
|
||||
|
||||
# setup the environment needed to run the the Python
|
||||
export LD_LIBRARY_PATH=${GFESUITE_DIR}/src/lib:${PYTHON_INSTALL}/lib
|
||||
export PYTHONPATH=${RUN_FROM_DIR}/src:${RUN_FROM_DIR}/activeTable:$PYTHONPATH
|
||||
|
||||
# execute the Python module
|
||||
_PYTHON="${PYTHON_INSTALL}/bin/python"
|
||||
_MODULE="${RUN_FROM_DIR}/src/activeTable/MergeVTEC.py"
|
||||
|
||||
# quoting of '$@' is used to prevent command line interpretation
|
||||
$_PYTHON $_MODULE -h ${DEFAULT_HOST} -p ${DEFAULT_PORT} -a OPERATIONAL "$@"
|
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/requestAT
Normal file
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/requestAT
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/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.
|
||||
##
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
path_to_script=`readlink -f $0`
|
||||
RUN_FROM_DIR=`dirname $path_to_script`
|
||||
|
||||
GFESUITE_DIR=`dirname $RUN_FROM_DIR`
|
||||
|
||||
# get the base environment
|
||||
source ${RUN_FROM_DIR}/setup.env
|
||||
|
||||
# setup the environment needed to run the the Python
|
||||
export LD_LIBRARY_PATH=${GFESUITE_DIR}/src/lib:${PYTHON_INSTALL}/lib
|
||||
export PYTHONPATH=${RUN_FROM_DIR}/src:${RUN_FROM_DIR}/activeTable:$PYTHONPATH
|
||||
|
||||
# execute the Python module
|
||||
_PYTHON="${PYTHON_INSTALL}/bin/python"
|
||||
_MODULE="${RUN_FROM_DIR}/src/activeTable/requestAT.py"
|
||||
|
||||
# quoting of '$@' is used to prevent command line interpretation
|
||||
$_PYTHON $_MODULE "$@"
|
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/sendAT
Normal file
40
edexOsgi/com.raytheon.uf.tools.gfesuite/cli/sendAT
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/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.
|
||||
##
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
path_to_script=`readlink -f $0`
|
||||
RUN_FROM_DIR=`dirname $path_to_script`
|
||||
|
||||
GFESUITE_DIR=`dirname $RUN_FROM_DIR`
|
||||
|
||||
# get the base environment
|
||||
source ${RUN_FROM_DIR}/setup.env
|
||||
|
||||
# setup the environment needed to run the the Python
|
||||
export LD_LIBRARY_PATH=${GFESUITE_DIR}/src/lib:${PYTHON_INSTALL}/lib
|
||||
export PYTHONPATH=${RUN_FROM_DIR}/src:${RUN_FROM_DIR}/activeTable:$PYTHONPATH
|
||||
|
||||
# execute the Python module
|
||||
_PYTHON="${PYTHON_INSTALL}/bin/python"
|
||||
_MODULE="${RUN_FROM_DIR}/src/activeTable/sendAT.py"
|
||||
|
||||
# quoting of '$@' is used to prevent command line interpretation
|
||||
$_PYTHON $_MODULE "$@"
|
|
@ -17,207 +17,224 @@
|
|||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
import gzip
|
||||
|
||||
#
|
||||
# MergeVTEC - merges two "active" tables together.
|
||||
# Ported from AWIPS1 code, originally written by Mark Mathewson FSL
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# ??/??/?? wldougher Initial Creation.
|
||||
# 02/22/13 1447 dgilling Re-ported to better match
|
||||
# requestAT/sendAT.
|
||||
#
|
||||
#
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
import cPickle
|
||||
import os
|
||||
import stat
|
||||
import time
|
||||
import gzip
|
||||
import logging
|
||||
import getAT
|
||||
#import JUtil
|
||||
import dynamicserialize.dstypes.com.raytheon.uf.common.activetable.UpdateActiveTableRequest as UpdateActiveTableRequest
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.request import MergeActiveTableRequest
|
||||
|
||||
from ufpy import ThriftClient
|
||||
from ufpy import TimeUtil
|
||||
from getVtecAttribute import getVtecAttribute
|
||||
from getFourCharSites import getFourCharSites
|
||||
from ufpy import UsageArgumentParser
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
log = logging.getLogger("MergeVTEC")
|
||||
def merge(removeRemote, remoteATName, atName, inputIsGZIP=False, drt=None,
|
||||
makeBackups=True, xmlIncoming=None, ourSites=None, host='localhost', port=9581):
|
||||
|
||||
oldTable = None
|
||||
siteFilter = _getFilterSites(ourSites, host, port)
|
||||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.DEBUG)
|
||||
log = logging.getLogger('MergeVTEC')
|
||||
|
||||
|
||||
class CaseInsensitiveStringSet(collections.Set):
|
||||
def __init__(self, iterable):
|
||||
self.__internalSet = frozenset(iterable)
|
||||
|
||||
def __contains__(self, x):
|
||||
return x.upper() in (item.upper() for item in self.__internalSet)
|
||||
|
||||
if drt is None:
|
||||
drtOffset = 0.0;
|
||||
else:
|
||||
drtOffset = TimeUtil.determineDrtOffset(drt)[0]
|
||||
|
||||
atName = atName.upper()
|
||||
if "PRACTICE" != atName:
|
||||
atName = "OPERATIONAL"
|
||||
|
||||
try:
|
||||
oldTable = getAT.getActiveTable(atName, siteFilter, host=host, port=port)
|
||||
except:
|
||||
log.error('Error getting old table for backup :', exc_info=True)
|
||||
def __len__(self):
|
||||
return len(self.__internalSet)
|
||||
|
||||
log.info("Active Table size: %d", len(oldTable))
|
||||
|
||||
if inputIsGZIP:
|
||||
fd = gzip.open(remoteATName)
|
||||
else:
|
||||
fd = open(remoteATName)
|
||||
def __iter__(self):
|
||||
return iter(self.__internalSet)
|
||||
|
||||
try:
|
||||
newTable = cPickle.load(fd)
|
||||
finally:
|
||||
class StoreDrtTimeAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
drtInfoTuple = TimeUtil.determineDrtOffset(values)
|
||||
setattr(namespace, self.dest, drtInfoTuple[0])
|
||||
|
||||
class MergeVTEC(object):
|
||||
def __init__(self, serverHost, serverPort, site, removeRemote,
|
||||
remoteATName, atName, inputIsGZIP, drt=0, makeBackups=True,
|
||||
xmlIncoming=None, fromIngestAT=False):
|
||||
# serverHost - host name to send merge request to
|
||||
# serverPort - port EDEX is running on
|
||||
# site - site to perform merge operation as
|
||||
# removeRemote (False, True) to remove remote table file upon completion
|
||||
# remoteATName - name of remote active table file
|
||||
# atName (OPERATIONAL, PRACTICE) - name of active table name
|
||||
# inputIsGZIP (False, True) - remote input file is gzipped
|
||||
# drt mode - None, or number of seconds +/- current time
|
||||
# makeBackups (False, True) - make backups of table changes
|
||||
# xmlIncoming - None, or XML data from MHS, only used in ingestAT mode
|
||||
# fromIngestAT (False, True) - run in ingestAT mode, only affects logging
|
||||
self._thriftClient = ThriftClient.ThriftClient(serverHost, serverPort, '/services')
|
||||
self._site = site
|
||||
self._deleteAfterProcessing = removeRemote
|
||||
self._remoteTableFilename = remoteATName
|
||||
self._activeTableFilename = atName
|
||||
drt = 0 if drt is None else drt
|
||||
self._drtInfo = float(drt)
|
||||
self._makeBackups = makeBackups
|
||||
self._xmlIncoming = xmlIncoming
|
||||
self._fromIngestAT = fromIngestAT
|
||||
|
||||
log.info("MergeVTEC Starting")
|
||||
log.info("remoteFN= " + self._remoteTableFilename +
|
||||
" localFN= " + self._activeTableFilename +
|
||||
" siteID= " + self._site)
|
||||
|
||||
# read table to merge
|
||||
otherTable = self._readActiveTable(self._remoteTableFilename,
|
||||
inputIsGZIP)
|
||||
log.info("Remote Table size: %d", len(otherTable))
|
||||
|
||||
self._mergeTable(otherTable)
|
||||
|
||||
# delete remote file, if desired
|
||||
if self._deleteAfterProcessing:
|
||||
os.remove(self._remoteTableFilename)
|
||||
|
||||
log.info("MergeVTEC Finished")
|
||||
|
||||
def _mergeTable(self, otherTable):
|
||||
# Send the new active table to the server.
|
||||
# The real merge is done server-side.
|
||||
request = MergeActiveTableRequest(otherTable, self._activeTableFilename,
|
||||
self._site, self._drtInfo, self._xmlIncoming,
|
||||
self._fromIngestAT, self._makeBackups)
|
||||
response = self._thriftClient.sendRequest(request)
|
||||
if not response.getTaskSuccess():
|
||||
raise RuntimeError("Error performing merge: " + response.getErrorMessage())
|
||||
|
||||
def _readActiveTable(self, filename, inputIsGZIP=False):
|
||||
# reads the active table and returns the list of records
|
||||
|
||||
records = []
|
||||
|
||||
# get the file and unpickle it
|
||||
if not inputIsGZIP:
|
||||
fd = open(filename, 'rb')
|
||||
else:
|
||||
fd = gzip.open(filename, 'rb')
|
||||
|
||||
buf = fd.read()
|
||||
fd.close()
|
||||
|
||||
log.info("Other Table size: %d", len(newTable))
|
||||
|
||||
if len(newTable) > 0 and newTable[0].has_key('oid'):
|
||||
convertToNewFormat(newTable)
|
||||
log.debug("read active table, size: %d", len(buf))
|
||||
records = cPickle.loads(buf)
|
||||
log.debug("cPickle.loads, #records: %d", len(records))
|
||||
|
||||
# Filter out any extra sites in the new table.
|
||||
if siteFilter is not None:
|
||||
newTable = [x for x in newTable if x['officeid'] in siteFilter]
|
||||
if records and records[0].has_key('oid'):
|
||||
self._convertToNewFormat(records)
|
||||
|
||||
log.info("Other Table filtered size: %d", len(newTable))
|
||||
|
||||
# Send the new active table to the server.
|
||||
# The real merge is done server-side.
|
||||
request = UpdateActiveTableRequest()
|
||||
request.setActiveTable(newTable)
|
||||
request.setMode(atName)
|
||||
request.setXmlSource(xmlIncoming)
|
||||
request.setTimeOffset(drtOffset)
|
||||
response = None
|
||||
return records
|
||||
|
||||
thriftClient = ThriftClient.ThriftClient(host, port, "/services")
|
||||
try:
|
||||
response = thriftClient.sendRequest(request)
|
||||
log.info('Other table merged.')
|
||||
except:
|
||||
log.error("Error sending other table to server:", exc_info=True)
|
||||
|
||||
if response is None:
|
||||
log.error("No response was received from the server.")
|
||||
return
|
||||
|
||||
errMsg = response.getMessage()
|
||||
if errMsg is not None and "" != errMsg:
|
||||
log.error("Error on server: %s", errMsg)
|
||||
return
|
||||
|
||||
sourceInfo = response.getSourceInfo()
|
||||
if sourceInfo is not None:
|
||||
if type(sourceInfo) != list:
|
||||
log.info("Converting sourceInfo from " + str(type(sourceInfo)))
|
||||
# sourceInfo = JUtil.javaStringListToPylist(sourceInfo)
|
||||
for source in sourceInfo:
|
||||
log.info("Source Server: %s", str(source))
|
||||
else:
|
||||
log.info("sourceInfo is None")
|
||||
|
||||
if makeBackups and oldTable:
|
||||
convertToOldFormat(oldTable)
|
||||
dirname = os.path.dirname(os.path.abspath(remoteATName))
|
||||
format = "%Y%m%d_%H%M%S"
|
||||
gmtime = time.gmtime(time.time() + drtOffset)
|
||||
bname = time.strftime(format, gmtime) + 'activeTable.gz'
|
||||
bdirName = os.path.join(dirname, "backup")
|
||||
|
||||
if not os.path.exists(bdirName):
|
||||
# create the dir and give everyone R/W access
|
||||
os.mkdir(bdirName, stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH |
|
||||
stat.S_IWOTH)
|
||||
|
||||
fname = os.path.join(bdirName, bname)
|
||||
saveFile = gzip.open(fname, "wb")
|
||||
save_start = time.time()
|
||||
try:
|
||||
cPickle.dump(oldTable, saveFile)
|
||||
finally:
|
||||
saveFile.close()
|
||||
def _convertToNewFormat(self, table):
|
||||
'''Convert an AWIPS I table to AWIPS 2 internally'''
|
||||
|
||||
maxFutureTime = long(float(2**31-1))
|
||||
for entry in table:
|
||||
entry['officeid'] = entry['oid']
|
||||
entry['vtecstr'] = entry['vstr']
|
||||
entry['endTime'] = int(entry['end'])
|
||||
entry['startTime'] = int(entry['start'])
|
||||
entry['purgeTime'] = int(entry['purgeTime'])
|
||||
entry['issueTime'] = int(entry['issueTime'])
|
||||
entry['phensig'] = entry['key']
|
||||
entry['state'] = 'Decoded'
|
||||
if entry['endTime'] >= maxFutureTime:
|
||||
entry['ufn'] = True
|
||||
else:
|
||||
entry['ufn'] = False
|
||||
entry['productClass'] = entry['vtecstr'][1]
|
||||
if not entry.has_key('rawMessage'):
|
||||
entry['rawMessage'] = ''
|
||||
|
||||
# Give the user and user's group all access, others read access
|
||||
os.chmod(fname, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH)
|
||||
tdiff = time.time() - save_start
|
||||
log.info('Saved Previous Active Table: %s t=%.3f sec. ', fname, tdiff)
|
||||
elif makeBackups:
|
||||
log.info('No old active table to back up.')
|
||||
|
||||
if removeRemote:
|
||||
os.remove(remoteATName)
|
||||
log.info('Input file ' + remoteATName + ' deleted.')
|
||||
# Note: this is not always correct
|
||||
entry['xxxid'] = entry['officeid'][1:]
|
||||
|
||||
if entry.has_key('text'):
|
||||
entry['segText'] = entry['text']
|
||||
# adapted from WarningDecoder...
|
||||
lines = entry['segText'].split('\n')
|
||||
for count in xrange(len(lines)-1):
|
||||
dtg_search = re.search(r' ([0123][0-9][012][0-9][0-5][0-9])',
|
||||
lines[count])
|
||||
if dtg_search:
|
||||
pil_search = re.search(r'^([A-Z]{3})(\w{3}|\w{2}|\w{1})',
|
||||
lines[count+1])
|
||||
if pil_search:
|
||||
entry['xxxid'] = pil_search.group(2)
|
||||
break
|
||||
|
||||
def _getFilterSites(ourSites, host, port):
|
||||
if ourSites is None:
|
||||
ourSite = os.getenv('GFESUITE_SITEID')
|
||||
if ourSite is None:
|
||||
raise Exception("Specify at least one site or set GFESUITE_SITEID.")
|
||||
else:
|
||||
ourSite = ourSites[0]
|
||||
sites = getVtecAttribute('VTEC_MERGE_SITES', [], ourSite, host, port)
|
||||
if sites is not None:
|
||||
spcSite = getVtecAttribute("VTEC_SPC_SITE", "KWNS", ourSite, host, port)
|
||||
tpcSite = getVtecAttribute("VTEC_TPC_SITE", "KNHC", ourSite, host, port)
|
||||
sites.extend([spcSite, tpcSite])
|
||||
if ourSites is None:
|
||||
sites.append(ourSite)
|
||||
else:
|
||||
sites.extend(ourSites)
|
||||
|
||||
sites = getFourCharSites(sites, host, port)
|
||||
def process_command_line():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(prog='MergeVTEC', conflict_handler="resolve")
|
||||
parser.add_argument("-h", action="store", dest="serverHost",
|
||||
required=True, metavar="serverHost",
|
||||
help="host name of the EDEX server")
|
||||
parser.add_argument("-p", action="store", type=int, dest="serverPort",
|
||||
required=True, metavar="serverPort",
|
||||
help="port number for the EDEX server")
|
||||
parser.add_argument("-d", action="store_true",
|
||||
dest="removeRemote",
|
||||
help="delete remote active table when done")
|
||||
parser.add_argument("-a", action="store", dest="atName",
|
||||
choices=CaseInsensitiveStringSet(['OPERATIONAL', 'PRACTICE']),
|
||||
required=True, metavar="atName", default="OPERATIONAL",
|
||||
help="name of the active table (OPERATIONAL or PRACTICE)")
|
||||
parser.add_argument("-r", action="store", dest="remoteATName",
|
||||
required=True, metavar="rmtATName",
|
||||
help="location of the active table (remote)")
|
||||
parser.add_argument("-z", action=StoreDrtTimeAction, dest="drt",
|
||||
metavar="drtMode", help="Run in DRT mode")
|
||||
parser.add_argument("-n", action="store_false", dest="makeBackups",
|
||||
help="Don't make backups of vtec table")
|
||||
parser.add_argument("-g", action="store_true",
|
||||
dest="inputIsGZIP",
|
||||
help="Remote active table is compressed")
|
||||
parser.add_argument("-s", action="store", dest="site", metavar="siteID",
|
||||
required=True,
|
||||
help="site to merge AT records into")
|
||||
return vars(parser.parse_args())
|
||||
|
||||
log.debug("Filter Sites: %s", str(sites))
|
||||
return sites
|
||||
def merge(serverHost, serverPort, site, removeRemote, remoteATName,
|
||||
atName, inputIsGZIP=False, drt=0, makeBackups=True, xmlIncoming=None,
|
||||
fromIngestAT=False):
|
||||
decoder = MergeVTEC(serverHost, serverPort, site, removeRemote,
|
||||
remoteATName, atName, inputIsGZIP, drt, makeBackups, xmlIncoming,
|
||||
fromIngestAT)
|
||||
decoder = None
|
||||
return
|
||||
|
||||
def convertToNewFormat(newTable):
|
||||
'''Convert an AWIPS I table to AWIPS 2 internally'''
|
||||
import re
|
||||
maxFutureTime = long(float(2**31-1))
|
||||
for dct in newTable:
|
||||
dct['officeid'] = dct['oid']
|
||||
dct['vtecstr'] = dct['vstr']
|
||||
dct['endTime'] = int(dct['end'])
|
||||
dct['startTime'] = int(dct['start'])
|
||||
dct['purgeTime'] = int(dct['purgeTime'])
|
||||
dct['issueTime'] = int(dct['issueTime'])
|
||||
dct['phensig'] = dct['key']
|
||||
dct['state'] = 'Decoded'
|
||||
if dct['endTime'] >= maxFutureTime:
|
||||
dct['ufn'] = True
|
||||
else:
|
||||
dct['ufn'] = False
|
||||
dct['productClass'] = dct['vtecstr'][1]
|
||||
if not dct.has_key('rawMessage'):
|
||||
dct['rawMessage'] = ''
|
||||
|
||||
# Note: this is not always correct
|
||||
dct['xxxid'] = dct['officeid'][1:]
|
||||
def main():
|
||||
args = process_command_line()
|
||||
try:
|
||||
merge(**args)
|
||||
sys.exit(0)
|
||||
except:
|
||||
log.exception("Caught Exception: ")
|
||||
sys.exit(1)
|
||||
|
||||
if dct.has_key('text'):
|
||||
dct['segText'] = dct['text']
|
||||
# adapted from WarningDecoder...
|
||||
lines = dct['segText'].split('\n')
|
||||
for count in xrange(len(lines)-1):
|
||||
dtg_search = re.search(r' ([0123][0-9][012][0-9][0-5][0-9])',
|
||||
lines[count])
|
||||
if dtg_search:
|
||||
pil_search = re.search(r'^([A-Z]{3})(\w{3}|\w{2}|\w{1})',
|
||||
lines[count+1])
|
||||
if pil_search:
|
||||
dct['xxxid'] = pil_search.group(2)
|
||||
break
|
||||
|
||||
def convertToOldFormat(backupTable):
|
||||
'Convert an AWIPS 2 table to a table usable by AWIPS 1, in-place.'
|
||||
for dct in backupTable:
|
||||
dct['oid'] = dct['officeid']
|
||||
dct['vstr'] = dct['vtecstr']
|
||||
dct['end'] = dct['endTime']
|
||||
dct['start'] = dct['startTime']
|
||||
dct['key'] = dct['phensig']
|
||||
# remove new fields so we don't pickle two copies
|
||||
del dct['officeid']
|
||||
del dct['vtecstr']
|
||||
del dct['endTime']
|
||||
del dct['phensig']
|
||||
del dct['startTime']
|
||||
|
||||
if dct.has_key('segText'):
|
||||
dct['text'] = dct['segText']
|
||||
del dct['segText']
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -17,81 +17,113 @@
|
|||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
import tempfile, os, stat, getopt, sys
|
||||
import logging, time, traceback, string, MergeVTEC
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger("ingestAT")
|
||||
log.info('************* ingestAT ************************')
|
||||
#
|
||||
# Port of ingestAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# ??/??/?? wldougher Initial Creation.
|
||||
# 02/13/13 1447 dgilling Re-ported to better match
|
||||
# requestAT/sendAT.
|
||||
#
|
||||
#
|
||||
|
||||
startT = time.time()
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
import MergeVTEC
|
||||
from ufpy import TimeUtil
|
||||
from ufpy import UsageArgumentParser
|
||||
|
||||
|
||||
|
||||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
log = logging.getLogger('ingestAT')
|
||||
|
||||
|
||||
|
||||
class CaseInsensitiveStringSet(collections.Set):
|
||||
def __init__(self, iterable):
|
||||
self.__internalSet = frozenset(iterable)
|
||||
|
||||
def __contains__(self, x):
|
||||
return x.upper() in (item.upper() for item in self.__internalSet)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.__internalSet)
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.__internalSet)
|
||||
|
||||
class StoreDrtTimeAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
drtInfoTuple = TimeUtil.determineDrtOffset(values)
|
||||
setattr(namespace, self.dest, drtInfoTuple[0])
|
||||
|
||||
class ReadDeleteFileAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
with open(values, 'rb') as fd:
|
||||
fileData = fd.read()
|
||||
setattr(namespace, self.dest, fileData)
|
||||
os.remove(values)
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# decode command line ingestAT -f remoteActiveTable [-z drtMode]
|
||||
# -a activeTableName [-n] -X xmlInfo
|
||||
# -s site
|
||||
# -a activeTableName [-n] -X xmlInfo
|
||||
# -s site
|
||||
#--------------------------------------------------------------------
|
||||
log.info('Cmd: %s', str(sys.argv[1:]))
|
||||
fname = None
|
||||
ztime = None
|
||||
atName = 'OPERATIONAL'
|
||||
xmlIncoming = None
|
||||
makeBackups = 1
|
||||
ourSites = None
|
||||
host = 'localhost'
|
||||
port = 9581
|
||||
def process_command_line():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(prog='ingestAT', conflict_handler="resolve")
|
||||
parser.add_argument("-h", action="store", dest="serverHost",
|
||||
required=True, metavar="serverHost")
|
||||
parser.add_argument("-p", action="store", type=int, dest="serverPort",
|
||||
required=True, metavar="serverPort")
|
||||
parser.add_argument("-f", action="store", dest="fname",
|
||||
required=True, metavar="remoteActiveTable")
|
||||
parser.add_argument("-z", action=StoreDrtTimeAction, dest="ztime",
|
||||
metavar="drtMode")
|
||||
parser.add_argument("-a", action="store", dest="atName",
|
||||
choices=CaseInsensitiveStringSet(['OPERATIONAL', 'PRACTICE']),
|
||||
default='OPERATIONAL')
|
||||
parser.add_argument("-n", action="store_false", dest="makeBackups")
|
||||
parser.add_argument("-X", action=ReadDeleteFileAction, dest="xmlIncoming",
|
||||
metavar="xmlInfo")
|
||||
parser.add_argument("-s", action="store", dest="site", metavar="siteID",
|
||||
required=True)
|
||||
return parser.parse_args()
|
||||
|
||||
try:
|
||||
optlist, args = getopt.getopt(sys.argv[1:], 'f:z:a:nX:s:h:p:')
|
||||
for opt in optlist:
|
||||
if opt[0] == "-f":
|
||||
fname = opt[1]
|
||||
elif opt[0] == "-z":
|
||||
ztime = opt[1]
|
||||
elif opt[0] == "-a":
|
||||
atName = opt[1]
|
||||
elif opt[0] == "-n":
|
||||
makeBackups = 0
|
||||
elif opt[0] == "-X":
|
||||
fd = open(opt[1], 'rb') #open the xml source file
|
||||
xmlIncoming = fd.read()
|
||||
fd.close()
|
||||
os.remove(opt[1]) #delete the incoming xml file
|
||||
elif opt[0] == "-s":
|
||||
if ourSites is None:
|
||||
ourSites = []
|
||||
ourSites.append(opt[1])
|
||||
elif opt[0] == "-h":
|
||||
host = opt[1]
|
||||
elif opt[0] == "-p":
|
||||
port = int(opt[1])
|
||||
except:
|
||||
t, v, tb = sys.exc_info()
|
||||
tstr = string.join(traceback.format_exception(t, v, tb))
|
||||
log.error('Error parsing command line args: %s %s', str(sys.argv), tstr)
|
||||
sys.exit(1)
|
||||
def main():
|
||||
options = process_command_line()
|
||||
log.debug("Command-line options: " + repr(options))
|
||||
|
||||
try:
|
||||
inputIsGZIP = True
|
||||
removeRemoteFile = False
|
||||
fromIngestAT = True
|
||||
MergeVTEC.merge(options.serverHost, options.serverPort, options.site,
|
||||
removeRemoteFile, options.fname, options.atName, inputIsGZIP,
|
||||
options.ztime, options.makeBackups, options.xmlIncoming,
|
||||
fromIngestAT)
|
||||
except:
|
||||
log.exception("MergeVTEC fail: ")
|
||||
|
||||
try:
|
||||
os.remove(options.fname)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
try:
|
||||
inputIsGZIP = 1
|
||||
removeRemoteFile = False
|
||||
MergeVTEC.merge(removeRemoteFile, fname, atName, inputIsGZIP, drt=ztime,
|
||||
makeBackups=makeBackups, xmlIncoming=xmlIncoming, ourSites=ourSites,
|
||||
host=host, port=port)
|
||||
removeRemoteFile = True
|
||||
except:
|
||||
t, v, tb = sys.exc_info()
|
||||
tstr = string.join(traceback.format_exception(t, v, tb))
|
||||
log.error("MergeVTEC fail: " + tstr)
|
||||
|
||||
try:
|
||||
if removeRemoteFile:
|
||||
os.remove(fname)
|
||||
except OSError:
|
||||
pass
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Finish
|
||||
#--------------------------------------------------------------------
|
||||
endT = time.time()
|
||||
log.info('Final: wctime: %-0.2f, cputime: %-0.2f',(endT - startT), time.clock())
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
#
|
||||
# Port of requestAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 01/28/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.request import RetrieveRemoteActiveTableRequest
|
||||
|
||||
from ufpy import ThriftClient
|
||||
from ufpy import UsageArgumentParser
|
||||
|
||||
|
||||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
log = logging.getLogger('requestAT')
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# command line: requestAT -H ourHost -P ourPort -L ourProto -M mhsid -s siteID
|
||||
# -t irtServiceAddr -x xmtScript
|
||||
#--------------------------------------------------------------------
|
||||
def process_command_line():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(prog='requestAT', conflict_handler="resolve")
|
||||
parser.add_argument("-H", action="store", dest="serverHost",
|
||||
required=True, metavar="ourHost")
|
||||
parser.add_argument("-P", action="store", type=int, dest="serverPort",
|
||||
required=True, metavar="ourPort")
|
||||
parser.add_argument("-L", action="store", dest="serverProtocol",
|
||||
required=True, metavar="ourProto")
|
||||
parser.add_argument("-M", action="store", dest="mhsid",
|
||||
required=True, metavar="mhsid")
|
||||
parser.add_argument("-S", action="store", dest="siteID",
|
||||
required=True, metavar="siteID")
|
||||
parser.add_argument("-a", action="store", dest="ancf")
|
||||
parser.add_argument("-b", action="store", dest="bncf")
|
||||
parser.add_argument("-x", action="store", dest="xmtScript",
|
||||
metavar="xmtScript")
|
||||
return parser.parse_args()
|
||||
|
||||
def build_request(args):
|
||||
req = RetrieveRemoteActiveTableRequest(args.serverHost, args.serverPort,
|
||||
args.serverProtocol, args.mhsid,
|
||||
args.siteID, args.ancf, args.bncf,
|
||||
args.xmtScript)
|
||||
return req
|
||||
|
||||
def main():
|
||||
options = process_command_line()
|
||||
log.debug("Command-line options: " + repr(options))
|
||||
|
||||
req = build_request(options)
|
||||
log.debug("Request: " + repr(req))
|
||||
|
||||
thriftClient = ThriftClient.ThriftClient(host=options.serverHost)
|
||||
try:
|
||||
response = thriftClient.sendRequest(req)
|
||||
except:
|
||||
log.exception("Error posting request.")
|
||||
sys.exit(1)
|
||||
|
||||
if not response.getTaskSuccess():
|
||||
log.error("Error executing requestAT: " + response.getErrorMessage())
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,122 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# sendAT - sends active table to remote site
|
||||
# sendAT -s reqSite -a mhsSite -f filterSite -f filterSite -f filterSite...
|
||||
# [-c countDict] [-t timeStamp] -v vtecData [-X serverXMLInfo]
|
||||
# -H serverhost -P serverPort -L serverProtocol -M serverMHS -S serverSite
|
||||
# -x xmtScript
|
||||
|
||||
#
|
||||
# Port of sendAT code from AWIPS1
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 01/28/13 1447 dgilling Initial Creation.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.request import SendActiveTableRequest
|
||||
from ufpy import ThriftClient
|
||||
from ufpy import UsageArgumentParser
|
||||
|
||||
|
||||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=logging.INFO)
|
||||
log = logging.getLogger('sendtAT')
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# decode command line, -s siteToSend -f filterSite -a mhsSite
|
||||
# -c countDict (siteid:records) -t issueTime
|
||||
# -v vtecData [-X serverXMLInfo] -x transmitScript
|
||||
#--------------------------------------------------------------------
|
||||
def process_command_line():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(prog='sendAT', conflict_handler="resolve")
|
||||
parser.add_argument("-s", action="append", dest="sites",
|
||||
metavar="siteToSend")
|
||||
parser.add_argument("-f", action="append", dest="filterSites",
|
||||
metavar="filterSite")
|
||||
parser.add_argument("-a", action="append", dest="mhsSites",
|
||||
metavar="mhsSite")
|
||||
parser.add_argument("-t", action="store", type=float, dest="issueTime",
|
||||
metavar="issueTime")
|
||||
parser.add_argument("-c", action="store", dest="countDict",
|
||||
metavar="countDict")
|
||||
parser.add_argument("-v", action="store", dest="fname",
|
||||
metavar="vtecData")
|
||||
parser.add_argument("-X", action="store", dest="xmlIncoming",
|
||||
metavar="serverXMLInfo")
|
||||
parser.add_argument("-H", action="store", dest="myServerHost",
|
||||
metavar="ourHost")
|
||||
parser.add_argument("-P", action="store", type=int, dest="myServerPort",
|
||||
metavar="ourPort")
|
||||
parser.add_argument("-L", action="store", dest="myServerProtocol",
|
||||
metavar="ourProto")
|
||||
parser.add_argument("-M", action="store", dest="myServerMHSID",
|
||||
metavar="ourMHSID")
|
||||
parser.add_argument("-S", action="store", dest="myServerSite",
|
||||
metavar="ourSiteID")
|
||||
parser.add_argument("-x", action="store", dest="xmtScript",
|
||||
metavar="transmitScript")
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.countDict is not None:
|
||||
exec "countDict = " + args.countDict
|
||||
setattr(args, "countDict", countDict)
|
||||
return args
|
||||
|
||||
def build_request(args):
|
||||
req = SendActiveTableRequest(args.myServerHost, args.myServerPort,
|
||||
args.myServerProtocol, args.myServerSite,
|
||||
args.myServerMHSID, args.sites,
|
||||
args.filterSites, args.mhsSites,
|
||||
args.issueTime, args.countDict, args.fname,
|
||||
args.xmlIncoming, args.xmtScript)
|
||||
return req
|
||||
|
||||
def main():
|
||||
options = process_command_line()
|
||||
log.debug("Command-line options: " + repr(options))
|
||||
|
||||
req = build_request(options)
|
||||
log.debug("Request: " + repr(req))
|
||||
|
||||
thriftClient = ThriftClient.ThriftClient(host=options.myServerHost)
|
||||
try:
|
||||
response = thriftClient.sendRequest(req)
|
||||
except:
|
||||
log.exception("Error posting request.")
|
||||
sys.exit(1)
|
||||
|
||||
if not response.getTaskSuccess():
|
||||
log.error("Error executing sendAT: " + response.getErrorMessage())
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
<!-- GFESuite/* will now be common between server and client. -->
|
||||
<copy todir="${gfe.suite.bin}" overwrite="true">
|
||||
<fileset dir="${basedir}/../com.raytheon.viz.gfe/GFESuite" />
|
||||
<fileset dir="${basedir}/../../cave/com.raytheon.viz.gfe/GFESuite" />
|
||||
<filterset refid="installer.filter.set"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
|
|
@ -33,10 +33,11 @@ __all__ = [
|
|||
'OperationalActiveTableRecord',
|
||||
'PracticeActiveTableRecord',
|
||||
'PracticeProductOfftimeRequest',
|
||||
'UpdateActiveTableRequest',
|
||||
'UpdateActiveTableResponse',
|
||||
'SendPracticeProductRequest',
|
||||
'VTECChange',
|
||||
'VTECTableChangeNotification'
|
||||
'VTECTableChangeNotification',
|
||||
'request',
|
||||
'response'
|
||||
]
|
||||
|
||||
from ActiveTableMode import ActiveTableMode
|
||||
|
@ -52,8 +53,6 @@ from OperationalActiveTableRecord import OperationalActiveTableRecord
|
|||
from PracticeActiveTableRecord import PracticeActiveTableRecord
|
||||
from PracticeProductOfftimeRequest import PracticeProductOfftimeRequest
|
||||
from SendPracticeProductRequest import SendPracticeProductRequest
|
||||
from UpdateActiveTableRequest import UpdateActiveTableRequest
|
||||
from UpdateActiveTableResponse import UpdateActiveTableResponse
|
||||
from VTECChange import VTECChange
|
||||
from VTECTableChangeNotification import VTECTableChangeNotification
|
||||
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
class MergeActiveTableRequest(object):
|
||||
|
||||
def __init__(self, incomingRecords=[], tableName='PRACTICE', site=None,
|
||||
timeOffset=0.0, xmlSource=None, fromIngestAT=False,
|
||||
makeBackups=True):
|
||||
self.incomingRecords = incomingRecords
|
||||
self.site = site
|
||||
self.tableName = tableName.upper() if tableName.upper() in ['OPERATIONAL', 'PRACTICE'] else 'PRACTICE'
|
||||
self.timeOffset = float(timeOffset)
|
||||
self.xmlSource = xmlSource
|
||||
self.fromIngestAT = bool(fromIngestAT)
|
||||
self.makeBackups = bool(makeBackups)
|
||||
|
||||
def __repr__(self):
|
||||
retVal = "MergeActiveTableRequest("
|
||||
retVal += repr(self.incomingRecords) + ", "
|
||||
retVal += repr(self.tableName) + ", "
|
||||
retVal += repr(self.site) + ", "
|
||||
retVal += repr(self.timeOffset) + ", "
|
||||
retVal += repr(self.xmlSource) + ", "
|
||||
retVal += repr(self.fromIngestAT) + ", "
|
||||
retVal += repr(self.makeBackups) + ")"
|
||||
return retVal
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def getIncomingRecords(self):
|
||||
return self.incomingRecords
|
||||
|
||||
def setIncomingRecords(self, incomingRecords):
|
||||
self.incomingRecords = incomingRecords
|
||||
|
||||
def getTableName(self):
|
||||
return self.tableName
|
||||
|
||||
def setTableName(self, tableName):
|
||||
value = tableName.upper()
|
||||
if value not in ['OPERATIONAL', 'PRACTICE']:
|
||||
raise ValueError("Invalid value " + tableName + " specified for ActiveTableMode.")
|
||||
self.tableName = value
|
||||
|
||||
def getSite(self):
|
||||
return self.site
|
||||
|
||||
def setSite(self, site):
|
||||
self.site = site
|
||||
|
||||
def getTimeOffset(self):
|
||||
return self.timeOffset
|
||||
|
||||
def setTimeOffset(self, timeOffset):
|
||||
self.timeOffset = float(timeOffset)
|
||||
|
||||
def getXmlSource(self):
|
||||
return self.xmlSource
|
||||
|
||||
def setXmlSource(self, xmlSource):
|
||||
self.xmlSource = xmlSource
|
||||
|
||||
def getFromIngestAT(self):
|
||||
return self.fromIngestAT
|
||||
|
||||
def setFromIngestAT(self, fromIngestAT):
|
||||
self.fromIngestAT = bool(fromIngestAT)
|
||||
|
||||
def getMakeBackups(self):
|
||||
return self.makeBackups
|
||||
|
||||
def setMakeBackups(self, makeBackups):
|
||||
self.makeBackups = bool(makeBackups)
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
class RetrieveRemoteActiveTableRequest(object):
|
||||
|
||||
def __init__(self, serverHost=None, serverPort=0, serverProtocol=None,
|
||||
mhsId=None, siteId=None, ancfAddress=None, bncfAddress=None,
|
||||
transmitScript=None):
|
||||
self.serverHost = serverHost
|
||||
self.serverPort = int(serverPort)
|
||||
self.serverProtocol = serverProtocol
|
||||
self.mhsId = mhsId
|
||||
self.siteId = siteId
|
||||
self.ancfAddress = ancfAddress
|
||||
self.bncfAddress = bncfAddress
|
||||
self.transmitScript = transmitScript
|
||||
|
||||
def __repr__(self):
|
||||
retVal = "RetrieveRemoteActiveTableRequest("
|
||||
retVal += repr(self.serverHost) + ", "
|
||||
retVal += repr(self.serverPort) + ", "
|
||||
retVal += repr(self.serverProtocol) + ", "
|
||||
retVal += repr(self.mhsId) + ", "
|
||||
retVal += repr(self.siteId) + ", "
|
||||
retVal += repr(self.ancfAddress) + ", "
|
||||
retVal += repr(self.bncfAddress) + ", "
|
||||
retVal += repr(self.transmitScript) + ")"
|
||||
return retVal
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def getServerHost(self):
|
||||
return self.serverHost
|
||||
|
||||
def setServerHost(self, serverHost):
|
||||
self.serverHost = serverHost
|
||||
|
||||
def getServerPort(self):
|
||||
return self.serverPort
|
||||
|
||||
def setServerPort(self, serverPort):
|
||||
self.serverPort = int(serverPort)
|
||||
|
||||
def getServerProtocol(self):
|
||||
return self.serverProtocol
|
||||
|
||||
def setServerProtocol(self, serverProtocol):
|
||||
self.serverProtocol = serverProtocol
|
||||
|
||||
def getMhsId(self):
|
||||
return self.mhsId
|
||||
|
||||
def setMhsId(self, mhsId):
|
||||
self.mhsId = mhsId
|
||||
|
||||
def getSiteId(self):
|
||||
return self.siteId
|
||||
|
||||
def setSiteId(self, siteId):
|
||||
self.siteId = siteId
|
||||
|
||||
def getAncfAddress(self):
|
||||
return self.ancfAddress
|
||||
|
||||
def setAncfAddress(self, ancfAddress):
|
||||
self.ancfAddress = ancfAddress
|
||||
|
||||
def getBncfAddress(self):
|
||||
return self.bncfAddress
|
||||
|
||||
def setBncfAddress(self, bncfAddress):
|
||||
self.bncfAddress = bncfAddress
|
||||
|
||||
def getTransmitScript(self):
|
||||
return self.transmitScript
|
||||
|
||||
def setTransmitScript(self, transmitScript):
|
||||
self.transmitScript = transmitScript
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
class SendActiveTableRequest(object):
|
||||
|
||||
def __init__(self, serverHost=None, serverPort=None, serverProtocol=None,
|
||||
serverSite=None, mhsId=None, sites=None, filterSites=None,
|
||||
mhsSites=None, issueTime=None, countDict=None, fileName=None,
|
||||
xmlIncoming=None, transmitScript=None):
|
||||
self.serverHost = serverHost
|
||||
self.serverPort = None if serverPort is None else int(serverPort)
|
||||
self.serverProtocol = serverProtocol
|
||||
self.serverSite = serverSite
|
||||
self.mhsId = mhsId
|
||||
self.sites = sites if sites is not None else []
|
||||
self.filterSites = filterSites if filterSites is not None else []
|
||||
self.mhsSites = mhsSites if mhsSites is not None else []
|
||||
self.issueTime = None if issueTime is None else float(issueTime)
|
||||
self.countDict = countDict if countDict is not None else {}
|
||||
self.fileName = fileName
|
||||
self.xmlIncoming = xmlIncoming
|
||||
self.transmitScript = transmitScript
|
||||
|
||||
def __repr__(self):
|
||||
retVal = "SendActiveTableRequest("
|
||||
retVal += repr(self.serverHost) + ", "
|
||||
retVal += repr(self.serverPort) + ", "
|
||||
retVal += repr(self.serverProtocol) + ", "
|
||||
retVal += repr(self.serverSite) + ", "
|
||||
retVal += repr(self.mhsId) + ", "
|
||||
retVal += repr(self.sites) + ", "
|
||||
retVal += repr(self.filterSites) + ", "
|
||||
retVal += repr(self.mhsSites) + ", "
|
||||
retVal += repr(self.issueTime) + ", "
|
||||
retVal += repr(self.countDict) + ", "
|
||||
retVal += repr(self.fileName) + ", "
|
||||
retVal += repr(self.xmlIncoming) + ", "
|
||||
retVal += repr(self.transmitScript) + ")"
|
||||
return retVal
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def getServerHost(self):
|
||||
return self.serverHost
|
||||
|
||||
def setServerHost(self, serverHost):
|
||||
self.serverHost = serverHost
|
||||
|
||||
def getServerPort(self):
|
||||
return self.serverPort
|
||||
|
||||
def setServerPort(self, serverPort):
|
||||
self.serverPort = serverPort
|
||||
|
||||
def getServerProtocol(self):
|
||||
return self.serverProtocol
|
||||
|
||||
def setServerProtocol(self, serverProtocol):
|
||||
self.serverProtocol = serverProtocol
|
||||
|
||||
def getServerSite(self):
|
||||
return self.serverSite
|
||||
|
||||
def setServerSite(self, serverSite):
|
||||
self.serverSite = serverSite
|
||||
|
||||
def getMhsId(self):
|
||||
return self.mhsId
|
||||
|
||||
def setMhsId(self, mhsId):
|
||||
self.mhsId = mhsId
|
||||
|
||||
def getSites(self):
|
||||
return self.sites
|
||||
|
||||
def setSites(self, sites):
|
||||
self.sites = sites
|
||||
|
||||
def getFilterSites(self):
|
||||
return self.filterSites
|
||||
|
||||
def setFilterSites(self, filterSites):
|
||||
self.filterSites = filterSites
|
||||
|
||||
def getMhsSites(self):
|
||||
return self.mhsSites
|
||||
|
||||
def setMhsSites(self, mhsSites):
|
||||
self.mhsSites = mhsSites
|
||||
|
||||
def getIssueTime(self):
|
||||
return self.issueTime
|
||||
|
||||
def setIssueTime(self, issueTime):
|
||||
self.issueTime = issueTime
|
||||
|
||||
def getCountDict(self):
|
||||
return self.countDict
|
||||
|
||||
def setCountDict(self, countDict):
|
||||
self.countDict = countDict
|
||||
|
||||
def getFileName(self):
|
||||
return self.fileName
|
||||
|
||||
def setFileName(self, fileName):
|
||||
self.fileName = fileName
|
||||
|
||||
def getXmlIncoming(self):
|
||||
return self.xmlIncoming
|
||||
|
||||
def setXmlIncoming(self, xmlIncoming):
|
||||
self.xmlIncoming = xmlIncoming
|
||||
|
||||
def getTransmitScript(self):
|
||||
return self.transmitScript
|
||||
|
||||
def setTransmitScript(self, transmitScript):
|
||||
self.transmitScript = transmitScript
|
||||
|
|
@ -18,19 +18,15 @@
|
|||
# further licensing information.
|
||||
##
|
||||
|
||||
class UpdateActiveTableResponse(object):
|
||||
def __init__(self):
|
||||
self.sourceInfo = None
|
||||
self.message = None
|
||||
|
||||
def getSourceInfo(self):
|
||||
return self.sourceInfo
|
||||
|
||||
def getMessage(self):
|
||||
return self.message
|
||||
|
||||
def setSourceInfo(self, sourceInfo):
|
||||
self.sourceInfo = sourceInfo
|
||||
|
||||
def setMessage(self, message):
|
||||
self.message = message
|
||||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'MergeActiveTableRequest',
|
||||
'RetrieveRemoteActiveTableRequest',
|
||||
'SendActiveTableRequest'
|
||||
]
|
||||
|
||||
from MergeActiveTableRequest import MergeActiveTableRequest
|
||||
from RetrieveRemoteActiveTableRequest import RetrieveRemoteActiveTableRequest
|
||||
from SendActiveTableRequest import SendActiveTableRequest
|
||||
|
|
@ -20,35 +20,21 @@
|
|||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
class UpdateActiveTableRequest(object):
|
||||
class ActiveTableSharingResponse(object):
|
||||
|
||||
def __init__(self):
|
||||
self.activeTable = None
|
||||
self.xmlSource = None
|
||||
self.mode = None
|
||||
self.timeOffset = None
|
||||
self.taskSuccess = None
|
||||
self.errorMessage = None
|
||||
|
||||
def getActiveTable(self):
|
||||
return self.activeTable
|
||||
def getTaskSuccess(self):
|
||||
return self.taskSuccess
|
||||
|
||||
def setActiveTable(self, activeTable):
|
||||
self.activeTable = activeTable
|
||||
def setTaskSuccess(self, taskSuccess):
|
||||
self.taskSuccess = bool(taskSuccess)
|
||||
|
||||
def getXmlSource(self):
|
||||
return self.xmlSource
|
||||
def getErrorMessage(self):
|
||||
return self.errorMessage
|
||||
|
||||
def setXmlSource(self, xmlSource):
|
||||
self.xmlSource = xmlSource
|
||||
|
||||
def getMode(self):
|
||||
return self.mode
|
||||
|
||||
def setMode(self, mode):
|
||||
self.mode = mode
|
||||
|
||||
def getTimeOffset(self):
|
||||
return self.timeOffset
|
||||
|
||||
def setTimeOffset(self, timeOffset):
|
||||
self.timeOffset = timeOffset
|
||||
def setErrorMessage(self, errorMessage):
|
||||
self.errorMessage = errorMessage
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'ActiveTableSharingResponse'
|
||||
]
|
||||
|
||||
from ActiveTableSharingResponse import ActiveTableSharingResponse
|
||||
|
|
@ -130,12 +130,12 @@ EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1"
|
|||
# The LDM will NOT start if the entry is commented-out.
|
||||
ALLOW ANY ^((localhost|loopback)|(127\.0\.0\.1\.?$)) .*
|
||||
ALLOW NEXRAD3 ^.* SDUS...PGUM|SDUS...PHFO|NXUS6..PGUM|NXUS6..PHFO|SDUS4..KWBC
|
||||
ALLOW NGRID ^.* .* [LM].[GHRT]....KWBC|[LM].C....KWBE|[LM].V....KWBL|[LM].D....KWBG|E.[BH]....KWBJ|[LM].[BEFS]....KWB.|Y.W....KWBG|[YZ].Q....KWBG|[YZ].[JKLNOPT]|[YZ].[BS]....KWBE|[LM].R.*KWBE|[LMYZ].D.*|E.P....KWBJ
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*
|
||||
ALLOW NGRID ^.* .* [LMYZ].[GHIJQRT]....KWBC|[LMYZ].[IJL]....KWBH|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[LM].[VR]....KWBL|[LM].D....KWBG|E.[BEFHI]....KWBJ|O.[MN]....KWBJ|[LM].[ABCE]....KWBS|Y.W....KWBG|[LM].[ABCDIJKMNP]....KWBR|O.N....KWBM|[LM].[EF]....KWBD|L......KWBQ|L.U....KMDL|[YZ]......KKCI|[LM].U....KWNO
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*|TIG[ABENPQ].*|TIC[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*|[YZ]......K(WBD|WNO|WBG|KCI|ALR|FWR|KRF|MSR|ORN|PTR|RHA|RSA|STR|TAR|TIR|TUA|WNH)|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[YZ].[HIJQ]....KWBC|[YZ].[IJL]....KWBH|O.[MN]....KWBJ
|
||||
ALLOW EXP ^.* .*
|
||||
ALLOW IDS|DDPLUS ^.* .* SXUS2[03-9].KWOH|SXUS[3-9].KWOH|SXUS8[0-3].KWOH|SRUS[2-8].KWOH
|
||||
ALLOW NOTHER ^.* .*
|
||||
ALLOW NOTHER ^.* .* TIPB.*
|
||||
#
|
||||
# Give permission to the Unidata Program Center
|
||||
ALLOW ANY ^[a-z].*\.unidata\.ucar\.edu\.?$ .*
|
||||
|
|
|
@ -130,12 +130,12 @@ EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1"
|
|||
# The LDM will NOT start if the entry is commented-out.
|
||||
ALLOW ANY ^((localhost|loopback)|(127\.0\.0\.1\.?$)) .*
|
||||
ALLOW NEXRAD3 ^.* SDUS...PGUM|SDUS...PHFO|NXUS6..PGUM|NXUS6..PHFO|SDUS4..KWBC
|
||||
ALLOW NGRID ^.* .* [LM].[GHRT]....KWBC|[LM].C....KWBE|[LM].V....KWBL|[LM].D....KWBG|E.[BH]....KWBJ|[LM].[BEFS]....KWB.|Y.W....KWBG|[YZ].Q....KWBG|[YZ].[JKLNOPT]|[YZ].[BS]....KWBE|[LM].R.*KWBE|[LMYZ].D.*|E.P....KWBJ
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*
|
||||
ALLOW NGRID ^.* .* [LMYZ].[GHIJQRT]....KWBC|[LMYZ].[IJL]....KWBH|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[LM].[VR]....KWBL|[LM].D....KWBG|E.[BEFHI]....KWBJ|O.[MN]....KWBJ|[LM].[ABCE]....KWBS|Y.W....KWBG|[LM].[ABCDIJKMNP]....KWBR|O.N....KWBM|[LM].[EF]....KWBD|L......KWBQ|L.U....KMDL|[YZ]......KKCI|[LM].U....KWNO
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*|TIG[ABENPQ].*|TIC[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*|[YZ]......K(WBD|WNO|WBG|KCI|ALR|FWR|KRF|MSR|ORN|PTR|RHA|RSA|STR|TAR|TIR|TUA|WNH)|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[YZ].[HIJQ]....KWBC|[YZ].[IJL]....KWBH|O.[MN]....KWBJ
|
||||
ALLOW EXP ^.* .*
|
||||
ALLOW IDS|DDPLUS ^.* .* SXUS2[03-9].KWOH|SXUS[3-9].KWOH|SXUS8[0-3].KWOH|SRUS[2-8].KWOH
|
||||
ALLOW NOTHER ^.* .*
|
||||
ALLOW NOTHER ^.* .* TIPB.*
|
||||
#
|
||||
# Give permission to the Unidata Program Center
|
||||
ALLOW ANY ^[a-z].*\.unidata\.ucar\.edu\.?$ .*
|
||||
|
|
|
@ -130,12 +130,12 @@ EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1"
|
|||
# The LDM will NOT start if the entry is commented-out.
|
||||
ALLOW ANY ^((localhost|loopback)|(127\.0\.0\.1\.?$)) .*
|
||||
ALLOW NEXRAD3 ^.* SDUS...PGUM|SDUS...PHFO|NXUS6..PGUM|NXUS6..PHFO|SDUS4..KWBC
|
||||
ALLOW NGRID ^.* .* [LM].[GHRT]....KWBC|[LM].C....KWBE|[LM].V....KWBL|[LM].D....KWBG|E.[BH]....KWBJ|[LM].[BEFS]....KWB.|Y.W....KWBG|[YZ].Q....KWBG|[YZ].[JKLNOPT]|[YZ].[BS]....KWBE|[LM].R.*KWBE|[LMYZ].D.*|E.P....KWBJ
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*
|
||||
ALLOW NGRID ^.* .* [LMYZ].[GHIJQRT]....KWBC|[LMYZ].[IJL]....KWBH|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[LM].[VR]....KWBL|[LM].D....KWBG|E.[BEFHI]....KWBJ|O.[MN]....KWBJ|[LM].[ABCE]....KWBS|Y.W....KWBG|[LM].[ABCDIJKMNP]....KWBR|O.N....KWBM|[LM].[EF]....KWBD|L......KWBQ|L.U....KMDL|[YZ]......KKCI|[LM].U....KWNO
|
||||
ALLOW NIMAGE ^.* .* TIT[EQ].*|TIG[ABENPQ].*|TIC[EQ].*
|
||||
ALLOW HDS ^.* .* [IJ]UTX0[0-689].*|JUSX4[0-689].*|[YZ]......K(WBD|WNO|WBG|KCI|ALR|FWR|KRF|MSR|ORN|PTR|RHA|RSA|STR|TAR|TIR|TUA|WNH)|[LMYZ].[ABCJKMNRQSUVYZ]....KWBE|[YZ].[HIJQ]....KWBC|[YZ].[IJL]....KWBH|O.[MN]....KWBJ
|
||||
ALLOW EXP ^.* .*
|
||||
ALLOW IDS|DDPLUS ^.* .* SXUS2[03-9].KWOH|SXUS[3-9].KWOH|SXUS8[0-3].KWOH|SRUS[2-8].KWOH
|
||||
ALLOW NOTHER ^.* .*
|
||||
ALLOW NOTHER ^.* .* TIPB.*
|
||||
#
|
||||
# Give permission to the Unidata Program Center
|
||||
ALLOW ANY ^[a-z].*\.unidata\.ucar\.edu\.?$ .*
|
||||
|
|
|
@ -300,7 +300,7 @@ NGRID ^(E.[ABCDEFGHI].{1,3}) (KWBJ) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)
|
|||
# AWIPS1 OCONUS: GRID ^[LM].[ABCDE].*KWBS* /Grid/SBN/rawGrib2
|
||||
# LMDA98 KWBS 160000 !grib2/ncep/WRF_EM/#130/201012160000F000/WXTZ/0 - NONE
|
||||
|
||||
ANY ^([LM].[ABCDE].{1,3}) (KWBS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*)
|
||||
ANY ^([LM].[ABCDEF].{1,3}) (KWBS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*)
|
||||
FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H
|
||||
|
||||
# AWIPS1: GRID ^LGXT[0-2][0-9].*KNHC /Grid/SBN/rawGrib2
|
||||
|
|
|
@ -86,6 +86,7 @@ fi
|
|||
|
||||
if [ "${1}" = "-python-qpid" ]; then
|
||||
buildRPM "awips2"
|
||||
buildRPM "awips2-python-qpid"
|
||||
buildRPM "awips2-python"
|
||||
buildRPM "awips2-python-cherrypy"
|
||||
buildRPM "awips2-python-dynamicserialize"
|
||||
|
@ -97,7 +98,6 @@ if [ "${1}" = "-python-qpid" ]; then
|
|||
buildRPM "awips2-python-pil"
|
||||
buildRPM "awips2-python-pmw"
|
||||
buildRPM "awips2-python-pupynere"
|
||||
buildRPM "awips2-python-qpid"
|
||||
buildRPM "awips2-python-scientific"
|
||||
buildRPM "awips2-python-scipy"
|
||||
buildRPM "awips2-python-tables"
|
||||
|
@ -343,6 +343,7 @@ fi
|
|||
|
||||
if [ "${1}" = "-edex" ]; then
|
||||
buildRPM "awips2"
|
||||
buildRPM "awips2-cli"
|
||||
buildRPM "awips2-gfesuite-client"
|
||||
buildRPM "awips2-gfesuite-server"
|
||||
buildRPM "Installer.ncep-database"
|
||||
|
|
Loading…
Add table
Reference in a new issue