Merge branch 'ss_builds' (12.9.1-11) into development

Conflicts:
	rpms/build/i386/build.sh

Former-commit-id: f52c8b374d [formerly 3a9d4961e2] [formerly f52c8b374d [formerly 3a9d4961e2] [formerly 34cbde4124 [formerly 73ab8bdcc39291fbe36b5bcffe53d9106cc00238]]]
Former-commit-id: 34cbde4124
Former-commit-id: ffe253196a [formerly 3230e0b246]
Former-commit-id: 5b4ee818b7
This commit is contained in:
Steve Harris 2012-08-30 14:40:34 -05:00
commit b63855f152
54 changed files with 4190 additions and 23447 deletions

View file

@ -73,7 +73,8 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 10, 2009 chammack Initial creation
* 2012-04-20 DR 14699 D. Friedman Work around race conditions
* 2012-04-20 DR 14699 D. Friedman Work around race conditions
* 2012-08-14 DR 15160 D. Friedman Reduce chance of UI blocking
*
* </pre>
*
@ -94,9 +95,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
@Override
public void disposed(AbstractVizResource<?, ?> resource) {
if ((resource == timeMatchBasis)) {
synchronized (D2DTimeMatcher.this) {
timeMatchBasis = null;
}
internalSetTimeMatchBasis(null);
}
}
@ -128,6 +127,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
private boolean needRetry;
private int nRetries;
// DR 15160 state
private transient boolean pendingTmbChange = false;
private transient boolean inTimeMatch = false;
private transient AbstractVizResource<?, ?> pendingTimeMatchBasis;
/**
* Default Constructor.
*/
@ -158,8 +162,15 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
public void redoTimeMatching(IDescriptor descriptor) throws VizException {
synchronized (this) {
if (inTimeMatch) {
needRetry = true;
return;
}
pendingTmbChange = false;
inTimeMatch = true;
needRetry = false;
}
try {
if (timeMatchBasis != null) {
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
if (tmDescriptor != null && tmDescriptor != descriptor) {
@ -205,13 +216,27 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
}
}
if (needRetry) {
if (nRetries < 200) {
++nRetries;
TimeMatchingJob.scheduleTimeMatch(descriptor);
}
} else
nRetries = 0;
} finally {
boolean scheduleRetry = false;
synchronized (this) {
inTimeMatch = false;
if (pendingTmbChange) {
pendingTmbChange = false;
changeTimeMatchBasis(pendingTimeMatchBasis);
pendingTimeMatchBasis = null;
scheduleRetry = true;
}
if (needRetry) {
if (nRetries < 200) {
++nRetries;
scheduleRetry = true;
}
} else
nRetries = 0;
}
if (scheduleRetry)
TimeMatchingJob.scheduleTimeMatch(descriptor);
}
}
@ -708,9 +733,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
IDescriptor descriptor) {
if ((resource == timeMatchBasis)
&& (descriptor instanceof AbstractDescriptor)) {
synchronized (this) {
timeMatchBasis = null;
}
internalSetTimeMatchBasis(null);
}
}
@ -1004,4 +1027,17 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
configFactory.resetMultiload();
}
// For DR 15160
protected void internalSetTimeMatchBasis(AbstractVizResource<?, ?> timeMatchBasis) {
synchronized (this) {
if (inTimeMatch) {
pendingTmbChange = true;
pendingTimeMatchBasis = timeMatchBasis;
} else {
pendingTmbChange = false;
pendingTimeMatchBasis = null;
changeTimeMatchBasis(timeMatchBasis);
}
}
}
}

View file

@ -81,6 +81,8 @@ public abstract class FFMPTable extends Composite {
/** DR14406: For columns with more words */
protected static final int EXTRA_COLUMN_WIDTH = 28;
private static final String NAME = "Name";
protected String currentPfaf = null;
@ -392,28 +394,30 @@ public abstract class FFMPTable extends Composite {
ArrayList<FFMPTableColumnXML> ffmpTableCols = ffmpCfgBasin
.getTableColumnData();
for (ThreshColNames threshColName : ThreshColNames.values()) {
if (sortedColumnName.contains(threshColName.name())) {
sortedThreshCol = threshColName;
break;
}
}
// Check if the sorted column is a column that will contain a filter.
// Check the gui config to see if colorCell is true. If false then do
// not apply filter
for (FFMPTableColumnXML xml : ffmpTableCols) {
if (xml.getColumnName().contains(sortedThreshCol.name())) {
if (ffmpConfig.isColorCell(sortedThreshCol)) {
// Only filter if colorCell is true
isAFilterCol = true;
filterNum = ffmpConfig.getFilterValue(sortedThreshCol);
reverseFilter = ffmpConfig.isReverseFilter(sortedThreshCol);
if (!sortedColumnName.equalsIgnoreCase(NAME)) {
for (ThreshColNames threshColName : ThreshColNames.values()) {
if (sortedColumnName.contains(threshColName.name())) {
sortedThreshCol = threshColName;
break;
}
}
// Check if the sorted column is a column that will contain a filter.
// Check the gui config to see if colorCell is true. If false then do
// not apply filter
for (FFMPTableColumnXML xml : ffmpTableCols) {
if (xml.getColumnName().contains(sortedThreshCol.name())) {
if (ffmpConfig.isColorCell(sortedThreshCol)) {
// Only filter if colorCell is true
isAFilterCol = true;
filterNum = ffmpConfig.getFilterValue(sortedThreshCol);
reverseFilter = ffmpConfig.isReverseFilter(sortedThreshCol);
}
break;
}
break;
}
}
table.removeAll();
if (tableData == null) {
@ -439,25 +443,26 @@ public abstract class FFMPTable extends Composite {
/*
* Check if the data value is Not A Number.
*/
float dataVal = cellData[sortColIndex].getValueAsFloat();
// DR 14250 fix: any value not a number will be omitted
if (/* sortedThreshCol.name().equalsIgnoreCase("RATIO") && */Float
.isNaN(dataVal)) {
continue;
}
if (isAFilterCol) {
if (reverseFilter) {
if (dataVal > filterNum) {
continue;
}
} else {
if (dataVal < filterNum) {
continue;
if (!sortedColumnName.equalsIgnoreCase(NAME)) {
float dataVal = cellData[sortColIndex].getValueAsFloat();
// DR 14250 fix: any value not a number will be omitted
if (Float.isNaN(dataVal)) {
continue;
}
if (isAFilterCol) {
if (reverseFilter) {
if (dataVal > filterNum) {
continue;
}
} else {
if (dataVal < filterNum) {
continue;
}
}
}
}
indexArray.add(t);
// Check to see if this is the selected row
@ -465,6 +470,7 @@ public abstract class FFMPTable extends Composite {
tableIndex = indexArray.indexOf(t);
}
}
/*
* VIRTUAL TABLE
*
@ -608,6 +614,10 @@ public abstract class FFMPTable extends Composite {
* Table column to sort.
*/
private void sortTableData(TableColumn tc) {
if (tableData == null) {
return;
}
String sortCol = (String) tc.getData();
int sortDir = getColumnAttributeData(sortCol).getSortDir();

View file

@ -227,7 +227,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private FFMPTableDataLoader dataRetrieveThread = null;
private boolean sweet = true;
private boolean groupLabelFlag = true;
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
FFMPResource resource) {
@ -1646,7 +1646,6 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
@Override
public void run() {
// Must be a full 11 digit pfaf in order to display the graph.
System.out.println(pfaf);
if ((pfaf.length() < 11) && pfaf.matches("\\d+")) {
resetCursor();
return;
@ -1693,7 +1692,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
@Override
public void tableSelection(String pfaf, String name) {
if (groupLbl.getText().length() > 0) {
sweet = false;
groupLabelFlag = false;
}
if ((groupLbl.getText().length() == 0)
@ -2011,7 +2010,6 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
// System.out.println("Status message...");
if (gd.exclude == true) {
System.out.println("Showing data load comp");
((GridData) dataLoadComp.getLayoutData()).exclude = false;
dataLoadComp.setVisible(true);
shell.pack();
@ -2127,13 +2125,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataRetrieveThread = getLoader();
dataRetrieveThread.start();
return;
} else {
}
if (fupdateData.getTableData() != null && sweet) {
if (fupdateData.getTableData() != null && groupLabelFlag) {
resetData(fupdateData.getTableData());
}
groupLabelFlag = true;
if (fupdateData.isFireGraph()) {
fireGraphDataEvent(fupdateData.getGraphPfaf(), false,
fupdateData.getGraphTime());
@ -2143,7 +2141,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
updateGapValueLabel(fupdateData.getGapValueLabel());
resetCursor();
sweet = true;
}
/**

View file

@ -73,9 +73,24 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
public class FFMPDataGenerator {
private FfmpTableConfig tableConfig;
private static final transient IUFStatusHandler statusHandler = UFStatus
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPDataGenerator.class);
private final String ALL = "ALL";
private final String NA = "NA";
private String siteKey;
private String dataKey;
private ProductXML product;
private Date paintRefTime;
private Date tableTime;
private Object centeredAggregationKey;
private String huc;
private ArrayList<DomainXML> domains;
private double sliderTime;
private boolean isWorstCase = false;
FFMPConfig ffmpCfg = FFMPConfig.getInstance();
FFMPTemplates ft = null;
@ -125,16 +140,27 @@ public class FFMPDataGenerator {
private FfmpTableConfigData ffmpTableCfgData = null;
public FFMPDataGenerator(FFMPMonitor monitor, FFMPResource resource) {
this.tableConfig = FfmpTableConfig.getInstance();
siteKey = resource.getSiteKey();
dataKey = resource.getDataKey();
product = resource.getProduct();
paintRefTime = resource.getPaintTime().getRefTime();
tableTime = resource.getTableTime();
centeredAggregationKey = resource.centeredAggregationKey;
huc = resource.getHuc();
domains = resource.getDomains();
sliderTime = resource.getTime();
isWorstCase = resource.isWorstCase();
this.tableConfig = FfmpTableConfig.getInstance();
this.resource = resource;
this.monitor = monitor;
this.ft = monitor.getTemplates(resource.getSiteKey());
this.ft = monitor.getTemplates(siteKey);
this.primarySource = resource.getResourceData().getPrimarySourceXML();
this.isRate = primarySource.isRate();
this.expirationTime = primarySource.getExpirationMinutes(resource
.getSiteKey()) * 60 * 1000;
ffmpTableCfgData = tableConfig
.getTableConfigData(resource.getSiteKey());
.getTableConfigData(siteKey);
}
public FFMPTableData generateFFMPData() throws Exception {
@ -149,24 +175,23 @@ public class FFMPDataGenerator {
if (field != null) {
if (baseRec != null) {
FFMPBasinData fbd = null;
if (resource.centeredAggregationKey != null) {
fbd = baseRec.getBasinData("ALL");
if (centeredAggregationKey != null) {
fbd = baseRec.getBasinData(ALL);
} else {
fbd = baseRec.getBasinData(resource.getHuc());
fbd = baseRec.getBasinData(huc);
}
if (fbd.getBasins().size() > 0) {
if ((resource.centeredAggregationKey == null)
|| resource.getHuc().equals("ALL")) {
if ((centeredAggregationKey == null)
|| huc.equals(ALL)) {
// System.out.println(fbd.getBasins().keySet().size()
// + " rows in the table");
for (Long key : fbd.getBasins().keySet()) {
if (resource.getHuc().equals("ALL")) {
for (DomainXML domain : resource
.getDomains()) {
if (huc.equals(ALL)) {
for (DomainXML domain : domains) {
FFMPBasinMetaData fmdb = ft.getBasin(
resource.getSiteKey(), key);
siteKey, key);
if (fmdb == null) {
continue;
@ -183,7 +208,7 @@ public class FFMPDataGenerator {
if (virtualBasin != null) {
for (Long id : ft
.getVirtualGageBasinLookupIds(
resource.getSiteKey(),
siteKey,
key)) {
setFFMPRow(
virtualBasin
@ -203,13 +228,13 @@ public class FFMPDataGenerator {
ArrayList<Long> pfafs = ft
.getAggregatePfafs(key,
resource.getSiteKey(),
resource.getHuc());
siteKey,
huc);
boolean isVGB = false;
if (ft.checkVGBsInAggregate(key,
resource.getSiteKey(),
resource.getHuc())) {
siteKey,
huc)) {
isVGB = true;
}
@ -217,8 +242,8 @@ public class FFMPDataGenerator {
FFMPBasinMetaData fmdb = ft
.getBasinInDomains(
resource.getSiteKey(),
resource.getDomains(),
siteKey,
domains,
pfafs);
if (fmdb != null) {
@ -239,11 +264,10 @@ public class FFMPDataGenerator {
.getCenteredAggregatePfafs()) {
FFMPBasinMetaData fmdb = ft.getBasin(
resource.getSiteKey(), key);
siteKey, key);
if (fmdb != null) {
for (DomainXML domain : resource
.getDomains()) {
for (DomainXML domain : domains) {
if ((domain.getCwa().equals(fmdb
.getCwa()))
@ -256,7 +280,7 @@ public class FFMPDataGenerator {
if (virtualBasin != null) {
for (Long id : ft
.getVirtualGageBasinLookupIds(
resource.getSiteKey(),
siteKey,
key)) {
setFFMPRow(
virtualBasin
@ -325,17 +349,17 @@ public class FFMPDataGenerator {
// in this special case it is actually the LID
trd.setPfaf(((FFMPVirtualGageBasin) cBasin).getLid());
FFMPVirtualGageBasinMetaData fvgmbd = ft
.getVirtualGageBasinMetaData(resource.getSiteKey(),
.getVirtualGageBasinMetaData(siteKey,
((FFMPVirtualGageBasin) cBasin).getLid());
FFMPBasinMetaData metabasin = ft.getBasin(
resource.getSiteKey(), fvgmbd.getParentPfaf());
siteKey, fvgmbd.getParentPfaf());
Long parentBasinPfaf = fvgmbd.getParentPfaf();
if (fvgmbd != null) {
mouseOverText = metabasin.getBasinId() + "\n"
+ fvgmbd.getLid() + "-" + fvgmbd.getName();
if (!resource.getHuc().equals("ALL")) {
if (!huc.equals(ALL)) {
displayName += "-" + fvgmbd.getName();
}
}
@ -343,12 +367,12 @@ public class FFMPDataGenerator {
trd.setTableCellData(0, new FFMPTableCellData(rowField,
displayName, mouseOverText));
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|| (resource.centeredAggregationKey != null)) {
if (!isWorstCase || huc.equals(ALL)
|| (centeredAggregationKey != null)) {
if (cBasin.getValues().size() > 0) {
rate = ((FFMPVirtualGageBasin) cBasin)
.getValue(resource.getPaintTime().getRefTime());
.getValue(paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData(
FIELDS.RATE, rate));
} else {
@ -357,7 +381,7 @@ public class FFMPDataGenerator {
}
if (cBasin.getValues().size() > 0) {
if (resource.getTime() > 0.00) {
if (sliderTime > 0.00) {
qpe = cBasin.getAccumValue(monitor.getQpeWindow()
.getAfterTime(), monitor.getQpeWindow()
.getBeforeTime(), expirationTime, isRate);
@ -394,7 +418,7 @@ public class FFMPDataGenerator {
boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
FFMPBasinData guidBasin = guidBasins.get(guidType);
forceUtil.setSliderTime(resource.getTime());
forceUtil.setSliderTime(sliderTime);
if ((guidBasin != null)
&& ((FFMPGuidanceBasin) guidBasin
@ -407,26 +431,26 @@ public class FFMPDataGenerator {
if (domain == null) {
pfafList = ft.getAggregatePfafs(
cBasin.getPfaf(),
resource.getSiteKey(),
resource.getHuc());
} else if (!domain.equals("NA")) {
if (!resource.getHuc().equals("ALL")) {
siteKey,
huc);
} else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) {
pfafList = ft
.getAggregatePfafsByDomain(
parentBasinPfaf,
resource.getSiteKey(),
siteKey,
domain,
resource.getHuc());
huc);
}
} else {
pfafList = ft.getAggregatePfafsByDomain(
parentBasinPfaf,
resource.getSiteKey(), domain,
resource.getHuc());
siteKey, domain,
huc);
pfafList.add(ft.getAggregatedPfaf(
cBasin.getPfaf(),
resource.getSiteKey(),
resource.getHuc()));
siteKey,
huc));
}
}
@ -434,7 +458,7 @@ public class FFMPDataGenerator {
if (fdm.isForcingConfigured()) {
FFMPBasin parentBasin = baseRec.getBasinData(
"ALL").get(parentBasinPfaf);
ALL).get(parentBasinPfaf);
forceUtil.calculateForcings(domain, ft,
parentBasin);
forcedPfafs = forceUtil.getForcedPfafList();
@ -446,7 +470,7 @@ public class FFMPDataGenerator {
// value(s)
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -457,7 +481,7 @@ public class FFMPDataGenerator {
} else if (forcedPfafs.size() > 1) {
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -469,7 +493,7 @@ public class FFMPDataGenerator {
} else if (pfafList.size() > 1) {
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -479,8 +503,7 @@ public class FFMPDataGenerator {
resource.getGuidSourceExpiration());
} else {
guidance = resource.getGuidanceValue(
ffmpGuidBasin, resource.getPaintTime()
.getRefTime(), guidType);
ffmpGuidBasin, paintRefTime, guidType);
if (guidance < 0.0f) {
guidance = Float.NaN;
@ -530,11 +553,11 @@ public class FFMPDataGenerator {
displayName, cBasin.getPfaf().toString() + "\n"
+ displayName));
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|| (resource.centeredAggregationKey != null)) {
if (!isWorstCase || huc.equals(ALL)
|| (centeredAggregationKey != null)) {
if ((rateBasin != null)
&& (rateBasin.get(cBasin.getPfaf()) != null)) {
rate = rateBasin.get(cBasin.getPfaf()).getValue(resource.getPaintTime().getRefTime());
rate = rateBasin.get(cBasin.getPfaf()).getValue(paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData(
FIELDS.RATE, rate));
// System.out.println("rate: "+rate);
@ -579,7 +602,7 @@ public class FFMPDataGenerator {
boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
FFMPBasinData guidBasin = guidBasins.get(guidType);
forceUtil.setSliderTime(resource.getTime());
forceUtil.setSliderTime(sliderTime);
if ((guidBasin != null)
&& ((FFMPGuidanceBasin) guidBasin.get(cBasin
@ -592,26 +615,26 @@ public class FFMPDataGenerator {
if (domain == null) {
pfafList = ft.getAggregatePfafs(
cBasin.getPfaf(),
resource.getSiteKey(),
resource.getHuc());
} else if (!domain.equals("NA")) {
if (!resource.getHuc().equals("ALL")) {
siteKey,
huc);
} else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) {
pfafList = ft
.getAggregatePfafsByDomain(
cBasin.getPfaf(),
resource.getSiteKey(),
siteKey,
domain,
resource.getHuc());
huc);
}
} else {
pfafList = ft.getAggregatePfafsByDomain(
cBasin.getPfaf(),
resource.getSiteKey(), domain,
resource.getHuc());
siteKey, domain,
huc);
pfafList.add(ft.getAggregatedPfaf(
cBasin.getPfaf(),
resource.getSiteKey(),
resource.getHuc()));
siteKey,
huc));
}
}
@ -628,7 +651,7 @@ public class FFMPDataGenerator {
// value(s)
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -639,7 +662,7 @@ public class FFMPDataGenerator {
} else if (forcedPfafs.size() > 1) {
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -651,7 +674,7 @@ public class FFMPDataGenerator {
} else if (pfafList.size() > 1) {
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getAverageGuidanceValue(
pfafList,
resource.getGuidanceInterpolators()
@ -739,22 +762,22 @@ public class FFMPDataGenerator {
if (cBasin.getAggregated()) {
if (domain == null) {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc());
} else if (!domain.equals("NA")) {
if (!resource.getHuc().equals("ALL")) {
siteKey, huc);
} else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
resource.getSiteKey(), domain, resource.getHuc());
siteKey, domain, huc);
}
} else {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
resource.getSiteKey(), domain, resource.getHuc());
siteKey, domain, huc);
pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc()));
siteKey, huc));
}
}
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|| (resource.centeredAggregationKey != null)) {
if (!isWorstCase || huc.equals(ALL)
|| (centeredAggregationKey != null)) {
if (((forcedPfafs.size() > 1)) || forced) {
// Calculate an average
guidance = forceUtil.getAvgForcedValue(pfafList, forcedPfafs,
@ -785,25 +808,25 @@ public class FFMPDataGenerator {
String name = null;
try {
if (resource.getHuc().equals("ALL")
|| (resource.centeredAggregationKey != null)) {
name = ft.getBasin(resource.getSiteKey(), basin.getPfaf())
if (huc.equals(ALL)
|| (centeredAggregationKey != null)) {
name = ft.getBasin(siteKey, basin.getPfaf())
.getStreamName();
}
// aggregations
else {
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
resource.getSiteKey(), resource.getHuc());
siteKey, huc);
if (pfafs.size() > 0) {
if (resource.getHuc().equals("COUNTY")) {
name = ft.getCountyStateName(resource.getSiteKey(),
if (huc.equals("COUNTY")) {
name = ft.getCountyStateName(siteKey,
basin.getPfaf());
} else {
for (int i = 0; i < pfafs.size(); i++) {
if (ft.getBasin(resource.getSiteKey(), pfafs.get(0))
if (ft.getBasin(siteKey, pfafs.get(0))
.getHucName() != null) {
name = ft.getBasin(resource.getSiteKey(),
name = ft.getBasin(siteKey,
pfafs.get(0)).getHucName();
break;
}
@ -832,7 +855,7 @@ public class FFMPDataGenerator {
}
ArrayList<Long> pfafs = ft.getAggregatePfafs(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc(), activeDomains);
siteKey, huc, activeDomains);
trd.setPfaf(cBasin.getPfaf().toString());
Float qpe = Float.NaN;
Float guidance = Float.NaN;
@ -846,13 +869,13 @@ public class FFMPDataGenerator {
1,
new FFMPTableCellData(FIELDS.RATE, virtualBasin
.get(cBasin.getPfaf()).getValue(
resource.getPaintTime().getRefTime())));
paintRefTime)));
} else {
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
Float.NaN));
}
if (virtualBasin != null) {
if (resource.getTime() > 0.00) {
if (sliderTime > 0.00) {
qpe = virtualBasin.get(cBasin.getPfaf()).getAccumValue(
monitor.getQpeWindow().getAfterTime(),
monitor.getQpeWindow().getBeforeTime(),
@ -887,7 +910,7 @@ public class FFMPDataGenerator {
int i = 0;
for (String guidType : guidBasins.keySet()) {
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(resource.getTime());
forceUtil.setSliderTime(sliderTime);
FFMPBasinData guidBasin = guidBasins.get(guidType);
@ -941,7 +964,7 @@ public class FFMPDataGenerator {
} else {
if (pfafs.size() > 0) {
if (rateBasin != null) {
rate = rateBasin.getMaxValue(pfafs, resource.getPaintTime().getRefTime());
rate = rateBasin.getMaxValue(pfafs, paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
rate));
} else {
@ -977,7 +1000,7 @@ public class FFMPDataGenerator {
int i = 0;
for (String guidType : guidBasins.keySet()) {
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(resource.getTime());
forceUtil.setSliderTime(sliderTime);
FFMPBasinData guidBasin = guidBasins.get(guidType);
@ -986,9 +1009,9 @@ public class FFMPDataGenerator {
&& (guidBasin.getBasins().size() > 0)) {
if (cBasin.getAggregated()) {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc());
siteKey, huc);
pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(),
resource.getSiteKey(), resource.getHuc()));
siteKey, huc));
}
boolean forced = false;
@ -1008,10 +1031,10 @@ public class FFMPDataGenerator {
}
}
if (resource.isWorstCase()) {
if (isWorstCase) {
guidance = guidRecords
.get(guidType)
.getBasinData("ALL")
.getBasinData(ALL)
.getMaxGuidanceValue(
pfafs,
resource.getGuidanceInterpolators()
@ -1021,7 +1044,7 @@ public class FFMPDataGenerator {
} else {
FFMPGuidanceBasin basin = (FFMPGuidanceBasin) guidRecords
.get(guidType)
.getBasinData(resource.getHuc())
.getBasinData(huc)
.get(cBasin.getPfaf());
guidance = resource.getGuidanceValue(basin, monitor
.getQpeWindow().getBeforeTime(), guidType);
@ -1081,7 +1104,7 @@ public class FFMPDataGenerator {
trd.setTableCellData(
1,
new FFMPTableCellData(FIELDS.RATE, rateBasin.get(
cBasin.getPfaf()).getValue(resource.getPaintTime().getRefTime())));
cBasin.getPfaf()).getValue(paintRefTime)));
} else {
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
Float.NaN));
@ -1118,7 +1141,7 @@ public class FFMPDataGenerator {
int i = 0;
for (String guidType : guidBasins.keySet()) {
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(resource.getTime());
forceUtil.setSliderTime(sliderTime);
FFMPBasinData guidBasin = guidBasins.get(guidType);
@ -1185,84 +1208,78 @@ public class FFMPDataGenerator {
* @throws VizException
*/
private FIELDS getBaseField() {
FIELDS field = null;
String huc = null;
System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
FIELDS field = null;
String localHuc = null;
dman = FFFGDataMgr.getInstance();
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig.getInstance()
.getTableConfigData(resource.getSiteKey());
.getTableConfigData(siteKey);
String qpfType = ffmpTableCfgData.getQpfType();
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
.getProduct(resource.getSiteKey());
.getProduct(siteKey);
String qpfSource = productRun
.getQpfSources(resource.getProduct(), qpfType).get(0)
.getQpfSources(product, qpfType).get(0)
.getSourceName();
FFMPConfig config = FFMPConfig.getInstance();
String includedCWAs = config.getFFMPConfigData().getIncludedCWAs();
cwaArr = includedCWAs.split(",");
monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, resource
.getPaintTime().getRefTime(), resource.getSiteKey()));
Date qpeTime = resource.getPaintTime().getRefTime();
monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, paintRefTime, siteKey));
Date qpeTime = paintRefTime;
if (resource.isSplit()) {
// hack off the QPF duration for the table values of QPE (Split
// Window)
double duration = FFMPSourceConfigurationManager.getInstance()
.getSource(qpfSource).getDurationHour();
qpeTime = new Date((long) (resource.getPaintTime().getRefTime()
.getTime() - (duration * 3600 * 1000)));
qpeTime = new Date((long) (qpeTime.getTime() - (duration * 3600 * 1000)));
}
monitor.setQpeWindow(new FFMPTimeWindow(resource.getTableTime(),
monitor.setQpeWindow(new FFMPTimeWindow(tableTime,
qpeTime));
// set keys
String siteKey = resource.getSiteKey();
String dataKey = resource.getDataKey();
ProductXML product = resource.getProduct();
if (resource.isWorstCase() || (resource.centeredAggregationKey != null)) {
if (isWorstCase || (centeredAggregationKey != null)) {
// make sure that "ALL" is loaded
huc = "ALL";
localHuc = ALL;
rateRecord = monitor.getRateRecord(product, siteKey, dataKey,
product.getRate(), resource.getPaintTime().getRefTime(),
huc, true);
product.getRate(), paintRefTime, localHuc, true);
qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
product.getQpe(), resource.getTableTime(), huc, true);
product.getQpe(), tableTime, localHuc, true);
qpfRecord = monitor.getQPFRecord(product, siteKey, dataKey, null,
resource.getPaintTime().getRefTime(), huc, true);
paintRefTime, localHuc, true);
guidRecords = monitor.getGuidanceRecords(product, siteKey,
resource.getTableTime(), huc, true);
tableTime, localHuc, true);
virtualRecord = monitor.getVirtualRecord(product, siteKey, dataKey,
product.getVirtual(), resource.getTableTime(), huc, true);
product.getVirtual(), tableTime, localHuc, true);
} else {
rateRecord = monitor.getRateRecord(product, siteKey, dataKey,
product.getRate(), resource.getPaintTime().getRefTime(),
resource.getHuc(), true);
product.getRate(), paintRefTime, huc, true);
qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
product.getQpe(), resource.getTableTime(),
resource.getHuc(), true);
product.getQpe(), tableTime, huc, true);
qpfRecord = monitor.getQPFRecord(product, siteKey, dataKey, null,
resource.getPaintTime().getRefTime(), resource.getHuc(), true);
paintRefTime, huc, true);
guidRecords = monitor.getGuidanceRecords(product, siteKey,
resource.getTableTime(), resource.getHuc(), true);
if (resource.getHuc().equals("ALL")) {
tableTime, huc, true);
if (huc.equals(ALL)) {
virtualRecord = monitor.getVirtualRecord(product, siteKey,
dataKey, product.getVirtual(), resource.getTableTime(),
resource.getHuc(), true);
dataKey, product.getVirtual(), tableTime,
huc, true);
}
huc = resource.getHuc();
localHuc = huc;
}
try {
if (rateRecord != null) {
rateBasin = rateRecord.getBasinData(huc);
rateBasin = rateRecord.getBasinData(localHuc);
if (rateBasin.getBasins().size() > 0) {
field = FIELDS.RATE;
baseRec = rateRecord;
}
}
if (qpeRecord != null) {
qpeBasin = qpeRecord.getBasinData(huc);
qpeBasin = qpeRecord.getBasinData(localHuc);
if (qpeBasin.getBasins().size() > 0) {
field = FIELDS.QPE;
if (baseRec == null) {
@ -1271,21 +1288,21 @@ public class FFMPDataGenerator {
}
}
if (qpfRecord != null) {
qpfBasin = qpfRecord.getBasinData(huc);
qpfBasin = qpfRecord.getBasinData(localHuc);
}
if (guidRecords != null) {
guidBasins = new HashMap<String, FFMPBasinData>();
for (String type : guidRecords.keySet()) {
if (guidRecords.get(type) != null) {
guidBasins.put(type, guidRecords.get(type)
.getBasinData(huc));
.getBasinData(localHuc));
} else {
guidBasins.put(type, null);
}
}
}
if (virtualRecord != null) {
virtualBasin = virtualRecord.getBasinData(huc);
virtualBasin = virtualRecord.getBasinData(localHuc);
}
// Get interpolators

View file

@ -40,7 +40,6 @@ import com.raytheon.uf.common.ohd.AppsDefaults;
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.time.SimulatedTime;
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;
@ -57,7 +56,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 28 Feb, 2011 7587 dhladky Initial creation
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
* </pre>
*
* @author dhladky
@ -65,8 +64,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
*/
public class FFMPDataLoader extends Thread {
//private static final transient IUFStatusHandler statusHandler = UFStatus
// .getHandler(FFMPDataLoader.class);
// private static final transient IUFStatusHandler statusHandler = UFStatus
// .getHandler(FFMPDataLoader.class);
private String sharePath = null;
@ -102,7 +101,7 @@ public class FFMPDataLoader extends Thread {
sharePath = AppsDefaults.getInstance().getToken("apps_dir")
+ File.separator + "ffmp" + File.separator;
this.product = resourceData.getProduct();
this.siteKey = resourceData.siteKey;
this.dataKey = resourceData.dataKey;
@ -151,9 +150,8 @@ public class FFMPDataLoader extends Thread {
long time = System.currentTimeMillis();
try {
resourceData.setLoader(loadType);
System.out.println("Starting Loader: "+loadType.getLoaderType());
resourceData.setLoader(loadType);
ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>();
@ -164,8 +162,8 @@ public class FFMPDataLoader extends Thread {
|| (loadType == LOADER_TYPE.GENERAL)) {
rateURI = getMonitor().getAvailableUri(siteKey, dataKey,
product.getRate(), mostRecentTime);
}
}
NavigableMap<Date, List<String>> qpeURIs = getMonitor()
.getAvailableUris(siteKey, dataKey, product.getQpe(),
timeBack);
@ -206,7 +204,7 @@ public class FFMPDataLoader extends Thread {
NavigableMap<Date, List<String>> iguidURIs = null;
Date guidTime = timeBack;
if (loadType == LOADER_TYPE.GENERAL) {
guidTime = getMonitor().getPreviousQueryTime(siteKey,
guidSource.getSourceName());
@ -220,11 +218,12 @@ public class FFMPDataLoader extends Thread {
}
}
}
// We only load all for long range data, all + layer for medium range
// We only load all for long range data, all + layer for medium
// range
if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
}
hucsToLoad.clear();
hucsToLoad.add("ALL");
}
for (String phuc : hucsToLoad) {
@ -238,9 +237,10 @@ public class FFMPDataLoader extends Thread {
} else {
// rate
if (rateURI != null) {
fireLoaderEvent(loadType, "Processing "+product.getRate() + "/" + phuc,
fireLoaderEvent(loadType,
"Processing " + product.getRate() + "/" + phuc,
isDone);
getMonitor().processUri(isProductLoad, rateURI,
siteKey, product.getRate(), timeBack, phuc);
fireLoaderEvent(loadType, product.getRate() + "/"
@ -248,8 +248,8 @@ public class FFMPDataLoader extends Thread {
}
// qpes
fireLoaderEvent(loadType, "Processing "+product.getQpe() + "/" + phuc,
isDone);
fireLoaderEvent(loadType, "Processing " + product.getQpe()
+ "/" + phuc, isDone);
FFMPBasinData qpeData = null;
if (loadType == LOADER_TYPE.INITIAL) {
@ -265,13 +265,13 @@ public class FFMPDataLoader extends Thread {
getMonitor().insertFFMPData(qpeData, siteKey,
product.getQpe(), phuc);
}
}
}
if (!qpeURIs.isEmpty() && qpeData == null) {
if (phuc.equals(config.getFFMPConfigData().getLayer()) || phuc.equals("ALL")) {
if (phuc.equals(config.getFFMPConfigData().getLayer())
|| phuc.equals("ALL")) {
getMonitor().processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc,
loadType);
siteKey, product.getQpe(), timeBack, phuc);
}
}
@ -281,7 +281,8 @@ public class FFMPDataLoader extends Thread {
int i = 0;
for (NavigableMap<Date, List<String>> qpfURIs : qpfs) {
// qpf
fireLoaderEvent(loadType, "Processing "+product.getQpf(i) + "/" + phuc,
fireLoaderEvent(loadType,
"Processing " + product.getQpf(i) + "/" + phuc,
isDone);
FFMPBasinData qpfData = null;
if (loadType == LOADER_TYPE.INITIAL) {
@ -306,7 +307,7 @@ public class FFMPDataLoader extends Thread {
getMonitor().processUris(qpfURIs,
isProductLoad, siteKey,
source.getSourceName(),
timeBack, phuc, loadType);
timeBack, phuc);
}
}
@ -314,15 +315,19 @@ public class FFMPDataLoader extends Thread {
source.getSourceName(), phuc);
}
}
//if (isUrisProcessNeeded(qpfData,qpfURIs)) {/*DR13839*/
// if (isUrisProcessNeeded(qpfData,qpfURIs))
// {/*DR13839*/
if ((qpfData == null) && !qpfURIs.isEmpty()) {
if (phuc.equals(config.getFFMPConfigData()
.getLayer()) || phuc.equals("ALL")) { //old code: keep for reference*/
//if (isHucProcessNeeded(phuc)) {/*DR13839*/
.getLayer()) || phuc.equals("ALL")) { // old
// code:
// keep
// for
// reference*/
// if (isHucProcessNeeded(phuc)) {/*DR13839*/
getMonitor().processUris(qpfURIs,
isProductLoad, siteKey,
product.getQpf(i), timeBack, phuc,
loadType);
product.getQpf(i), timeBack, phuc);
}
}
@ -335,7 +340,8 @@ public class FFMPDataLoader extends Thread {
}
// virtuals only have data for ALL
if (phuc.equals("ALL")) {
fireLoaderEvent(loadType, "Processing "+product.getVirtual() + "/" + phuc,
fireLoaderEvent(loadType,
"Processing " + product.getVirtual() + "/" + phuc,
isDone);
FFMPBasinData vgbData = null;
@ -356,8 +362,7 @@ public class FFMPDataLoader extends Thread {
if ((vgbData == null) && !virtualURIs.isEmpty()) {
getMonitor().processUris(virtualURIs, isProductLoad,
siteKey, product.getVirtual(), timeBack, phuc,
loadType);
siteKey, product.getVirtual(), timeBack, phuc);
}
fireLoaderEvent(loadType,
@ -366,20 +371,21 @@ public class FFMPDataLoader extends Thread {
// process guidance all at once
for (String type : productRun.getGuidanceTypes(product)) {
ArrayList<SourceXML> guidSources = productRun
.getGuidanceSources(product, type);
for (SourceXML guidSource : guidSources) {
NavigableMap<Date, List<String>> iguidURIs = guids
.get(guidSource.getSourceName());
fireLoaderEvent(loadType, "Processing "+guidSource.getSourceName() + "/" + phuc,
isDone);
fireLoaderEvent(loadType,
"Processing " + guidSource.getSourceName()
+ "/" + phuc, isDone);
getMonitor().processUris(iguidURIs, isProductLoad,
siteKey, guidSource.getSourceName(), timeBack,
phuc, loadType);
phuc);
fireLoaderEvent(loadType, guidSource.getSourceName()
+ "/" + phuc, isDone);
@ -390,7 +396,6 @@ public class FFMPDataLoader extends Thread {
fireLoaderEvent(loadType, phuc + " Load complete", isDone);
}
} catch (Exception e) {
isDone = true;
System.err.println("FFMP Data Loader terminated...."
+ e.getMessage());
} finally {
@ -477,72 +482,73 @@ public class FFMPDataLoader extends Thread {
+ "-" + siteKey + "-" + pdataKey + "-" + huc + ".bin");
File lockFile = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + ".lock");
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
sleep(100);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
break;
}
System.out.println("Buddy File expected path: " + file.getAbsolutePath());
FFMPBasinData basinData = null;
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
sleep(100);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (file.exists()) {
System.out.println("Last mod: " + new Date(file.lastModified()));
break;
}
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
System.out.println("Waiting for new file: " + file.getAbsolutePath());
sleep(100);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
break;
}
System.out.println("Buddy File expected path: "
+ file.getAbsolutePath());
FFMPBasinData basinData = null;
BufferedInputStream is = null;
try {
System.out.println("Loading file: " + file.getName());
is = new BufferedInputStream(
new FileInputStream(file));
DynamicSerializationManager dsm = DynamicSerializationManager
.getManager(SerializationType.Thrift);
basinData = (FFMPBasinData) dsm.deserialize(is);
} catch (SerializationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
if (file.exists()) {
return basinData;
System.out.println("Last mod: " + new Date(file.lastModified()));
}
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
System.out.println("Waiting for new file: "
+ file.getAbsolutePath());
sleep(100);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
break;
}
BufferedInputStream is = null;
try {
System.out.println("Loading file: " + file.getName());
is = new BufferedInputStream(new FileInputStream(file));
DynamicSerializationManager dsm = DynamicSerializationManager
.getManager(SerializationType.Thrift);
basinData = (FFMPBasinData) dsm.deserialize(is);
} catch (SerializationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
return basinData;
}
/**
* Finds the home datakey identifier for QPF sources
@ -568,5 +574,5 @@ public class FFMPDataLoader extends Thread {
return siteKey;
}
}

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -152,6 +152,7 @@ import com.vividsolutions.jts.geom.Point;
* 31 July 2012 14517 mpduff Fix for blanking map on update.
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
@ -217,7 +218,7 @@ public class FFMPResource extends
private IShadedShape streamShadedShape = null;
/** always the same vertexes, one for each CWA **/
private FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
private FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
/** Basin shaded shape **/
protected ConcurrentHashMap<DataTime, FFMPDrawable> drawables = new ConcurrentHashMap<DataTime, FFMPDrawable>();
@ -236,7 +237,7 @@ public class FFMPResource extends
// time used by the resource
private DataTime paintTime = null;
/** mouse handler **/
private final IInputHandler inspectAdapter = new InputAdapter() {
@ -307,7 +308,7 @@ public class FFMPResource extends
/** show ffmp color display */
private boolean showFfmpData = true;
/** qpf split window */
private boolean isSplit = false;
@ -319,7 +320,7 @@ public class FFMPResource extends
/** table slider time **/
private Date tableTime = null;
// complete reset
public boolean isQuery = true;
@ -342,7 +343,7 @@ public class FFMPResource extends
/** guidance source expiration **/
public long guidSourceExpiration = 0l;
/** QPF source expiration **/
public long qpfSourceExpiration = 0l;
@ -373,7 +374,9 @@ public class FFMPResource extends
private RGB basinBoundaryColor = null;
/** ordered list of times **/
private ArrayList<Date> timeOrderedKeys = null;
private ArrayList<Date> timeOrderedKeys = new ArrayList<Date>();
private boolean toKeysInitialized = false;
/** force utility **/
private FFFGForceUtil forceUtil = null;
@ -412,9 +415,11 @@ public class FFMPResource extends
FFFGDataMgr.getUpdatedInstance();
PluginDataObject[] pdos = (PluginDataObject[]) object;
FFMPRecord ffmpRec = (FFMPRecord) pdos[pdos.length - 1];
// an update clears everything
clear();
// only care about the most recent one
try {
if (ffmpRec.getSourceName()
.equals(getResourceData().sourceName)) {
// go back an extra time step
@ -430,41 +435,46 @@ public class FFMPResource extends
}
updateTimeOrderedkeys(ffmpRec.getDataTime().getRefTime());
if (getResourceData().tableLoad) {
setTableTime();
}
setRecord(ffmpRec);
statusHandler.handle(Priority.INFO, "Updating : Previous: "
+ previousMostRecentTime + " New: "
+ ffmpRec.getDataTime().getRefTime());
if (getResourceData().tableLoad) {
if (getResourceData().tableLoad) {
if (loader == null) {
startLoader(previousMostRecentTime, ffmpRec
.getDataTime().getRefTime(),
LOADER_TYPE.GENERAL);
} else {
while (!loader.isDone) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
startLoader(previousMostRecentTime, ffmpRec
.getDataTime().getRefTime(),
LOADER_TYPE.GENERAL);
}
if (loader == null) {
startLoader(previousMostRecentTime, ffmpRec
.getDataTime().getRefTime(),
LOADER_TYPE.GENERAL);
} else {
while (!loader.isDone) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
startLoader(previousMostRecentTime, ffmpRec
.getDataTime().getRefTime(),
LOADER_TYPE.GENERAL);
}
while (!loader.isDone) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
while (!loader.isDone) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
purge(ffmpRec.getDataTime().getRefTime());
}
purge(ffmpRec.getDataTime().getRefTime());
}
qpeRecord = null;
isNewQpe = true;
@ -484,12 +494,12 @@ public class FFMPResource extends
ve);
}
}
if (getResourceData().tableLoad) {
allowNewTableUpdate();
allowNewTableUpdate();
isFirst = true;
}
refresh();
}
@ -500,7 +510,7 @@ public class FFMPResource extends
}
issueRefresh();
}
@Override
public void hucChanged() {
@ -593,7 +603,7 @@ public class FFMPResource extends
return getColorUtil().colorByValue(value);
} else {
if (getCenteredAggregatePfafs().contains(key) && isParent()) {
// this is for a reason
// this is for a reason
} else {
if (!isMaintainLayer() && isParent()) {
return getColorUtil().colorByValue(value);
@ -649,7 +659,8 @@ public class FFMPResource extends
}
case QPF: {
value = getQpfRecord(recentTime).getBasinData("ALL")
.getAverageMaxValue(pfafs, recentTime, getQpfSourceExpiration());
.getAverageMaxValue(pfafs, recentTime,
getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -698,11 +709,13 @@ public class FFMPResource extends
break;
}
case RATE:
value = getBasin(key, field, recentTime, aggregate).getValue(recentTime);
break;
value = getBasin(key, field, recentTime, aggregate)
.getValue(recentTime);
break;
case QPF: {
value = getBasin(key, field, recentTime, aggregate)
.getAverageValue(recentTime, getQpfSourceExpiration());
.getAverageValue(recentTime,
getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -729,7 +742,8 @@ public class FFMPResource extends
switch (field) {
case QPF: {
value = getBasin(key, field, recentTime, aggregate)
.getAverageValue(recentTime, getQpfSourceExpiration());
.getAverageValue(recentTime,
getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -755,9 +769,9 @@ public class FFMPResource extends
if (forceUtil == null) {
forceUtil = new FFFGForceUtil(this, getFFGName());
}
forceUtil.setSliderTime(this.getTime());
if (pfafs != null) {
forceUtil.calculateForcings(pfafs,
monitor.getTemplates(getSiteKey()), basin);
@ -797,11 +811,11 @@ public class FFMPResource extends
}
PluginDataObject pdo = null;
try {
pdo = getRecord(sfield, paintTime.getRefTime());
pdo = getRecord(sfield, paintTime.getRefTime());
} catch (NullPointerException npe) {
return "No Data Available";
return "No Data Available";
}
if (pdo == null) {
@ -862,7 +876,6 @@ public class FFMPResource extends
e.printStackTrace();
}
}
return rateRecord;
}
@ -891,6 +904,7 @@ public class FFMPResource extends
} catch (Exception e) {
e.printStackTrace();
}
// System.out.println("FFMPResource.getQPERecord(): " + getTableTime());
return qpeRecord;
}
@ -917,11 +931,13 @@ public class FFMPResource extends
}
if (isWorstCase()) {
guidRecord = monitor.getGuidanceRecord(getProduct(),
getSiteKey(), sourceName, date, "ALL", isStandAlone);
guidRecord = monitor
.getGuidanceRecord(getProduct(), getSiteKey(),
sourceName, date, "ALL", isStandAlone);
} else {
guidRecord = monitor.getGuidanceRecord(getProduct(),
getSiteKey(), sourceName, date, getHuc(), isStandAlone);
getSiteKey(), sourceName, date, getHuc(),
isStandAlone);
}
isNewGuid = false;
@ -1073,12 +1089,12 @@ public class FFMPResource extends
}
/**
* DR 14522 fixing: enclosing font setting
* into GUI thread to avoid invalid thread
* access.
* DR 14522 fixing: enclosing font setting into GUI thread to avoid invalid
* thread access.
*/
@Override
protected void initInternal(final IGraphicsTarget target) throws VizException {
@Override
protected void initInternal(final IGraphicsTarget target)
throws VizException {
EditableManager.makeEditable(this,
getCapability(EditableCapability.class).isEditable());
IDisplayPaneContainer container = getResourceContainer();
@ -1103,40 +1119,45 @@ public class FFMPResource extends
} catch (Exception ex) {
statusHandler.handle(Priority.PROBLEM, "Error opening FFMP", ex);
}
//DR 14522: use Display.getDefault().asyncExec() for GUI thread.
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable(){
public void run(){
if (/*this.*/font == null) {
/*this.*/font = target.initializeFont("Dialog", 11, null);
}
font.setMagnification(getCapability(MagnificationCapability.class)
.getMagnification().floatValue());
if (/*this.*/xfont == null) {
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
/*this.*/xfont = target.initializeFont("Monospace", 12, styles);
}
// DR 14522: use Display.getDefault().asyncExec() for GUI thread.
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() {
xfont.setMagnification(getCapability(MagnificationCapability.class)
.getMagnification().floatValue());
fieldDescString = new DrawableString("FFMP " + df.format(getTime())
+ " hour " + FFMPRecord.getFieldLongDescription(getField()),
getCapability(ColorableCapability.class).getColor());
fieldDescString.font = font;
fieldDescString.horizontalAlignment = HorizontalAlignment.CENTER;
fieldDescString.verticallAlignment = VerticalAlignment.MIDDLE;
public void run() {
basinLocatorString = new DrawableString("X", new RGB(255, 255, 255));
basinLocatorString.font = xfont;
basinLocatorString.horizontalAlignment = HorizontalAlignment.CENTER;
basinLocatorString.verticallAlignment = VerticalAlignment.MIDDLE;
basinLocatorString.textStyle = TextStyle.BLANKED;
}
if (/* this. */font == null) {
/* this. */font = target.initializeFont("Dialog", 11, null);
}
font.setMagnification(getCapability(
MagnificationCapability.class).getMagnification()
.floatValue());
if (/* this. */xfont == null) {
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
/* this. */xfont = target.initializeFont("Monospace", 12,
styles);
}
xfont.setMagnification(getCapability(
MagnificationCapability.class).getMagnification()
.floatValue());
fieldDescString = new DrawableString("FFMP "
+ df.format(getTime()) + " hour "
+ FFMPRecord.getFieldLongDescription(getField()),
getCapability(ColorableCapability.class).getColor());
fieldDescString.font = font;
fieldDescString.horizontalAlignment = HorizontalAlignment.CENTER;
fieldDescString.verticallAlignment = VerticalAlignment.MIDDLE;
basinLocatorString = new DrawableString("X", new RGB(255, 255,
255));
basinLocatorString.font = xfont;
basinLocatorString.horizontalAlignment = HorizontalAlignment.CENTER;
basinLocatorString.verticallAlignment = VerticalAlignment.MIDDLE;
basinLocatorString.textStyle = TextStyle.BLANKED;
}
});
}
@ -1170,13 +1191,17 @@ public class FFMPResource extends
FFMPDrawable drawable = null;
if (paintTime != null) {
if (loader != null && !loader.isDone && loader.loadType == LOADER_TYPE.GENERAL) {
return;
}
if (!drawables.containsKey(paintTime)) {
drawable = new FFMPDrawable(getDomains());
drawables.put(paintTime, drawable);
} else {
// we found it!
drawable = drawables.get(paintTime);
// System.out.println("Found the drawable");
if (!paintTime.equals(drawable.getTime())) {
drawable.setDirty(true);
@ -1198,6 +1223,7 @@ public class FFMPResource extends
&& !paintTime.getRefTime().equals(getMostRecentTime())) {
setMostRecentTime(paintTime.getRefTime());
setTableTime();
// if (isLinkToFrame && loader != null && loader.loadType != LOADER_TYPE.GENERAL) {
if (isLinkToFrame) {
updateDialog();
}
@ -1487,25 +1513,25 @@ public class FFMPResource extends
@Override
public void project(CoordinateReferenceSystem mapData) throws VizException {
if (shadedShapes != null) {
shadedShapes.clear();
shadedShapes.clear();
}
if (streamShadedShape != null) {
streamShadedShape.dispose();
streamShadedShape = null;
streamShadedShape.dispose();
streamShadedShape = null;
}
if (streamOutlineShape != null) {
streamOutlineShape.dispose();
streamOutlineShape = null;
streamOutlineShape.dispose();
streamOutlineShape = null;
}
if (smallBasinOverlayShape != null) {
smallBasinOverlayShape.dispose();
smallBasinOverlayShape = null;
smallBasinOverlayShape.dispose();
smallBasinOverlayShape = null;
}
setQuery(true);
refresh();
}
@ -1581,9 +1607,9 @@ public class FFMPResource extends
if (getHuc().equals("ALL") || centeredAggregationKey != null) {
pfaf = metaBasin.getPfaf();
if (isMaintainLayer) {
pfaf = monitor.getTemplates(getSiteKey()).findAggregatedPfaf(
pfaf, getSiteKey(), getHuc());
aggregate = true;
pfaf = monitor.getTemplates(getSiteKey())
.findAggregatedPfaf(pfaf, getSiteKey(), getHuc());
aggregate = true;
}
} else {
pfaf = monitor.getTemplates(getSiteKey()).findAggregatedPfaf(
@ -1611,8 +1637,8 @@ public class FFMPResource extends
if (val.isNaN() || (val == FFMPUtils.MISSING)) {
valst = "NO DATA";
} else {
valst = df.format(getBasinValue(pfaf,
getPaintTime().getRefTime(), aggregate));
valst = df.format(getBasinValue(pfaf, getPaintTime()
.getRefTime(), aggregate));
}
if (!valst.equals("NO DATA")) {
@ -1768,7 +1794,7 @@ public class FFMPResource extends
if (getResourceData().tableLoad) {
if (isUpdateDialog) {
updateDialog();
updateDialog();
}
// stops the annoying wait cursor every time you re-center
@ -2007,7 +2033,7 @@ public class FFMPResource extends
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
entry.getValue().dispose();
}
drawables.clear();
}
}
@ -2271,7 +2297,7 @@ public class FFMPResource extends
public DataTime getPaintTime() {
return paintTime;
}
/**
* Add a value to worst case hash
*
@ -2279,9 +2305,9 @@ public class FFMPResource extends
* @param value
*/
private void addWorstCase(Long aggPfaf, Date recentTime, Float value) {
FFMPDrawable drawable = drawables.get(new DataTime(recentTime));
FFMPDrawable drawable = drawables.get(new DataTime(recentTime));
if (drawable != null && drawable.worstCaseHash != null) {
drawable.worstCaseHash.put(aggPfaf, value);
drawable.worstCaseHash.put(aggPfaf, value);
}
}
@ -2446,8 +2472,7 @@ public class FFMPResource extends
}
if ((cwaBasins.size() == 0)
|| !req.extent.equals(drawable.getExt())
|| !phuc.equals(drawable.getHuc())
|| restoreTable) {
|| !phuc.equals(drawable.getHuc()) || restoreTable) {
Envelope env = null;
try {
Envelope e = req.descriptor.pixelToWorld(req.extent,
@ -2472,7 +2497,8 @@ public class FFMPResource extends
templates, getSiteKey(), cwa, phuc);
for (Entry<Long, Envelope> entry : envMap.entrySet()) {
if (env.intersects(entry.getValue()) || env.contains(entry.getValue())) {
if (env.intersects(entry.getValue())
|| env.contains(entry.getValue())) {
// add the individual basins
cwaBasins.add(entry.getKey());
}
@ -2556,11 +2582,11 @@ public class FFMPResource extends
// the
// the basin when the color map changes.
if (globalRegen || drawable.genCwa(cwa)) {
//System.out
//.println("Regenerating the entire image: CWA: +"
//+ cwa
//+ " Table:"
//+ resourceData.tableLoad);
// System.out
// .println("Regenerating the entire image: CWA: +"
// + cwa
// + " Table:"
// + resourceData.tableLoad);
// get base aggr basins that are in screen area
Set<Long> cwaPfafs = null;
cwaPfafs = getAreaBasins(cwa, req, phuc);
@ -2585,7 +2611,11 @@ public class FFMPResource extends
.getCenterAggrKey();
// this is a fall back for VGB's
if (centeredAggr == null) {
centeredAggr = templates.findAggregatedVGB((String) centeredAggregationKey, getSiteKey(), phuc);
centeredAggr = templates
.findAggregatedVGB(
(String) centeredAggregationKey,
getSiteKey(),
phuc);
}
}
@ -2596,7 +2626,11 @@ public class FFMPResource extends
centeredAggr = (Long) drawable
.getCenterAggrKey();
if (centeredAggr == null) {
centeredAggr = templates.getAggregatedPfaf((Long)centeredAggregationKey, getSiteKey(), phuc);
centeredAggr = templates
.getAggregatedPfaf(
(Long) centeredAggregationKey,
getSiteKey(),
phuc);
}
}
}
@ -2775,7 +2809,7 @@ public class FFMPResource extends
if (restoreTable) {
restoreTable = false;
}
drawable.setTime(req.time);
if (lowestCenter != ZOOM.BASIN) {
drawable.setCenterAggrKey(centeredAggregationKey);
@ -2830,7 +2864,7 @@ public class FFMPResource extends
// check whether or not the dialog needs to be dumped
monitor.splashDisposeAndDataLoad(getResource());
if (getResourceData().tableLoad && isFirst) {
isFirst = false;
updateDialog();
@ -3059,13 +3093,13 @@ public class FFMPResource extends
centeredAggregatePfafList = null;
if (isAutoRefresh) {
if (basinTableDlg != null) {
// Gets rid of the aggregate name if it is zoomed into one
basinTableDlg.blankGroupLabel();
}
clearTables();
hucChanged();
refresh();
if (basinTableDlg != null) {
// Gets rid of the aggregate name if it is zoomed into one
basinTableDlg.blankGroupLabel();
}
clearTables();
hucChanged();
refresh();
}
updateDialog();
@ -3075,12 +3109,12 @@ public class FFMPResource extends
public void timeChanged(FFMPTimeChangeEvent fhce, FFMPRecord.FIELDS fieldArg)
throws VizException {
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
if (ffmpTime.getTime() != time || isSplit != ffmpTime.isSplit()) {
isSplit = ffmpTime.isSplit();
setTime(ffmpTime.getTime());
isSplit = ffmpTime.isSplit();
setTime(ffmpTime.getTime());
setTableTime();
if (interpolationMap != null) {
interpolationMap.clear();
@ -3200,7 +3234,7 @@ public class FFMPResource extends
centeredAggregationKey = null;
centeredAggregatePfafList = null;
restoreTable = true;
lowestCenter = FFMPRecord.ZOOM.WFO;
getDescriptor().getRenderableDisplay().getExtent().reset();
zoom(1.0f);
@ -3223,7 +3257,8 @@ public class FFMPResource extends
@Override
public FFMPGraphData getGraphData(String pfafString) throws VizException {
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()).getFfgGraphType();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey())
.getFfgGraphType();
Long basinPfaf = null;
Long dataId = null;
FFMPVirtualGageBasinMetaData fvgbmd = null;
@ -3397,7 +3432,7 @@ public class FFMPResource extends
if (fvgbmd != null) {
try {
// VGB's use a different timing sequence
// VGB's use a different timing sequenceFFMPResource
String lid = fvgbmd.getLid();
virtualBasin = monitor.getVirtualGageBasinData(dataId, lid,
@ -3557,13 +3592,18 @@ public class FFMPResource extends
* Sets the time used for accumulation drawn from the slider time
*/
private void setTableTime() {
Date recentTime = getMostRecentTime();
long time = new Double(recentTime.getTime() - (1000 * 3600) * getTime())
.longValue();
Date date = new Date();
date.setTime(time);
this.tableTime = date;
if (tableTime == null) {
tableTime = new Date();
}
synchronized (tableTime) {
Date recentTime = getMostRecentTime();
long time = new Double(recentTime.getTime() - (1000 * 3600)
* getTime()).longValue();
Date date = new Date();
date.setTime(time);
this.tableTime = date;
}
}
/**
@ -3721,9 +3761,10 @@ public class FFMPResource extends
* @param set
* @return ordered dates
*/
public ArrayList<Date> getTimeOrderedKeys() {
if (timeOrderedKeys == null) {
public synchronized ArrayList<Date> getTimeOrderedKeys() {
if (timeOrderedKeys == null || !toKeysInitialized) {
toKeysInitialized = true;
// stand alone displays use this
timeOrderedKeys = new ArrayList<Date>();
@ -3851,7 +3892,7 @@ public class FFMPResource extends
long fips = monitor.getTemplates(getSiteKey()).getCountyFipsByPfaf(
basin.getPfaf());
basin.setCountyFips(fips);
if (getResourceData().tableLoad) {
// interpolating
if (getGuidanceInterpolation(guidType).isInterpolate()) {
@ -3904,9 +3945,9 @@ public class FFMPResource extends
public boolean isLinkToFrame() {
return isLinkToFrame;
}
public boolean isSplit() {
return isSplit;
return isSplit;
}
/**
@ -4021,31 +4062,30 @@ public class FFMPResource extends
}
return qpeSourceExpiration;
}
/**
* source expiration value as a long
*
* @return
*/
public long getQpfSourceExpiration() {
if (qpfSourceExpiration == 0l) {
SourceXML source = null;
if (getProduct() != null) {
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig
.getInstance().getTableConfigData(getSiteKey());
String qpfType = ffmpTableCfgData.getQpfType();
if (qpfSourceExpiration == 0l) {
SourceXML source = null;
if (getProduct() != null) {
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig
.getInstance().getTableConfigData(getSiteKey());
String qpfType = ffmpTableCfgData.getQpfType();
source = getProduct().getQpfSourcesByType(qpfType).get(0);
} else {
source = FFMPSourceConfigurationManager.getInstance()
.getSource(getResourceData().sourceName);
}
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * 60 * 1000;
}
source = getProduct().getQpfSourcesByType(qpfType).get(0);
} else {
source = FFMPSourceConfigurationManager.getInstance()
.getSource(getResourceData().sourceName);
}
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * 60 * 1000;
}
return qpfSourceExpiration;
}
/**
* Gets the guidance source expiration
*
@ -4055,12 +4095,13 @@ public class FFMPResource extends
if (guidSourceExpiration == 0l) {
if (getProduct() != null) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getIncludedGuids();
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getIncludedGuids();
if (guidSrc.contains(",")) {
String[] parts = guidSrc.split(",");
guidSrc = parts[0];
}
SourceXML source = getProduct().getGuidanceSourcesByType(
SourceXML source = getProduct().getGuidanceSourcesByType(
guidSrc).get(0);
guidSourceExpiration = source
.getExpirationMinutes(getSiteKey()) * 60 * 1000;
@ -4123,7 +4164,8 @@ public class FFMPResource extends
String ffgName = null;
if (getResourceData().tableLoad) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getGuidSrc();
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
if (guidSrc.startsWith("xxx")) {
ffgName = "";
} else {
@ -4210,9 +4252,7 @@ public class FFMPResource extends
ArrayList<String> hucsToLoad = new ArrayList<String>();
if (isWorstCase) {
if (!hucsToLoad.contains("ALL")) {
hucsToLoad.add("ALL");
}
hucsToLoad.add("ALL");
}
// tertiary loader only loads ALL
@ -4245,62 +4285,61 @@ public class FFMPResource extends
loader.removeListener(this);
}
}
/**
* Get the purge file time
*/
public long getPurgePeriod() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE);
LocalizationFile lfFile = pm.getLocalizationFile(lc,
"purge/ffmpPurgeRules.xml");
if (lfFile.exists()) {
//TODO Need to figure out why we can't read in the purgeRules!
/*try {
PurgeRuleSet prs = (PurgeRuleSet) SerializationUtil
.jaxbUnmarshalFromXmlFile(lfFile.getFile().getAbsolutePath());
for (PurgeRule rule: prs.getRules()) {
if (rule.getId().equals("ffmp")) {
return rule.getPeriodInMillis();
}
}
} catch (SerializationException e) {
e.printStackTrace();
return 3600*24*1000;
} */
// TODO Need to figure out why we can't read in the purgeRules!
/*
* try { PurgeRuleSet prs = (PurgeRuleSet) SerializationUtil
* .jaxbUnmarshalFromXmlFile(lfFile.getFile().getAbsolutePath());
*
* for (PurgeRule rule: prs.getRules()) { if
* (rule.getId().equals("ffmp")) { return rule.getPeriodInMillis();
* } }
*
* } catch (SerializationException e) { e.printStackTrace(); return
* 3600*24*1000; }
*/
}
return 3600*24*1000;
return 3600 * 24 * 1000;
}
/**
* Kicks off additional loaders that need to be fired off
*
* @param loader
* @param isDone
*/
public void manageLoaders(FFMPLoaderStatus status) {
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
try {
Date startDate = new Date(getMostRecentTime().getTime() - (6 * 3600 * 1000));
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
try {
Date startDate = new Date(getMostRecentTime().getTime()
- (6 * 3600 * 1000));
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
}
}
// We don't really care about status of tertiary and general loaders
}
}

View file

@ -22,6 +22,8 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.NavigableMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -258,15 +260,33 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
}
} else {
/*
* This appears completely un-orthodox for anything in D2D. But
* alas FFMP always does things differently. According to Vada
* Driesbach, FFMP in stand alone mode functions similarly to
* the way it does in table mode. Meaning you have to reach back
* and find time windows for the source displayed +- the
* expirationTime. None of the sources are displayed for exact
* times like everything else in D2D. This forces us to use the
* same Data Population methods the table uses. The only
* difference here is they are done for single sources.
*/
SourceXML source = getPrimarySourceXML();
this.domains = monitor.getRunConfig().getDomains();
SourceXML source = monitor.getSourceConfig().getSource(
sourceName);
for (int i = 0; i < objects.length; i++) {
FFMPRecord rec = (FFMPRecord) objects[i];
rec.setExpiration(source.getExpirationMinutes(siteKey));
rec.setRate(source.isRate());
populateRecord(getProduct(), rec, huc);
if (source != null) {
long oldestTime = availableTimes[0].getRefTime().getTime();
long expirationTime = source.getExpirationMinutes(siteKey) * 60 * 1000;
Date standAloneTime = new Date(oldestTime - expirationTime);
NavigableMap<Date, List<String>> sourceURIs = getMonitor()
.getAvailableUris(siteKey, dataKey, sourceName,
standAloneTime);
getMonitor().processUris(sourceURIs, false, siteKey,
sourceName, standAloneTime, "ALL");
}
}
}

View file

@ -34,6 +34,8 @@ import com.raytheon.uf.common.time.TimeRange;
* ------------ ---------- ----------- --------------------------
* Jun 3, 2008 1167 mnash Initial creation
* Sep 3, 2008 1283 njensen Fixed issues
* Aug 9, 2012 #1036 dgilling Fixed NullPointerException
* in compareTo().
*
* </pre>
*
@ -141,7 +143,7 @@ public class SamplerRequest implements Comparable<SamplerRequest> {
* @return
*/
public boolean isRefID() {
if (_areaID != null && _areaID.getName().length() > 0) {
if ((_areaID != null) && (!_areaID.getName().isEmpty())) {
return true;
} else {
return false;
@ -154,59 +156,98 @@ public class SamplerRequest implements Comparable<SamplerRequest> {
* @return
*/
public boolean isRefArea() {
if (_area.getId().getName().length() > 0) {
if ((_area != null) && (!_area.getId().getName().isEmpty())) {
return true;
} else {
return false;
}
}
/**
* Outputs the class information
*
* @param o
*/
public String printOn() {
return "(" + _parmID + "," + _timeRange + "," + _areaID + "," + _area
+ ")";
@Override
public int compareTo(SamplerRequest samp) {
// 1st level - parmID
int pid = _parmID.compareTo(samp._parmID);
if (pid != 0) {
return pid;
} else {
// 2nd level, time range
int tr = _timeRange.compareTo(samp._timeRange);
if (tr != 0) {
return tr;
} else {
// 3rd level, reference id
String left = (_area != null) ? _area.getId().getName()
: _areaID.getName();
String right = (samp._area != null) ? samp._area.getId()
.getName() : samp._areaID.getName();
return left.compareTo(right);
}
}
}
@Override
public int compareTo(SamplerRequest samp) {
int pid = _parmID.compareTo(samp._parmID);
if (pid == -1) {
return -1;
} else if (pid == 1) {
return 1;
} else if (pid == 0) {
int tr = _timeRange.compareTo(samp._timeRange);
if (tr == -1) {
return -1;
} else if (tr == 1) {
return 1;
} else if (tr == 0) {
int rid = _area.getId().getName().compareTo(
samp._area.getId().getName());
if (rid == -1) {
return -1;
} else if (rid == 1) {
return 1;
} else if (rid == 0) {
return 0;
}
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return 0; // should never reach this
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
SamplerRequest other = (SamplerRequest) obj;
if (_area == null) {
if (other._area != null) {
return false;
}
} else if (!_area.equals(other._area)) {
return false;
}
if (_areaID == null) {
if (other._areaID != null) {
return false;
}
} else if (!_areaID.equals(other._areaID)) {
return false;
}
if (_parmID == null) {
if (other._parmID != null) {
return false;
}
} else if (!_parmID.equals(other._parmID)) {
return false;
}
if (_timeRange == null) {
if (other._timeRange != null) {
return false;
}
} else if (!_timeRange.equals(other._timeRange)) {
return false;
}
return true;
}
@Override
public String toString() {
String s = "SamplerRequest: " + _parmID.getParmName() + " "
+ _timeRange.toString() + " ";
if (_area != null) {
s += _area.getId().getName();
} else if (_areaID != null) {
s += _areaID.getName();
StringBuilder builder = new StringBuilder();
builder.append("SamplerRequest (");
builder.append(_parmID);
builder.append(", ");
builder.append(_timeRange);
builder.append(", ");
if (_areaID != null) {
builder.append(_areaID.getName());
} else {
builder.append("null");
}
return s;
builder.append(", ");
if (_area != null) {
builder.append(_area.getId().getName());
} else {
builder.append("null");
}
builder.append(")");
return builder.toString();
}
}

View file

@ -128,33 +128,45 @@ public final class GagePPWrite {
* new six hour precip value
*/
public static void gage_pp_write_rec(String pe, String id, String ts,
Date obsdate, GagePPOptions options, short revision[],
Date obsdate, GagePPOptions options, short revision,
short revision_6hour[], double new_hourly_value, double pp_value) {
int is_pc = 0;
int six = 0;
Date dto = obsdate;
Date dto = new Date(obsdate.getTime());
Calendar dt = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
dt.setTime(dto);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String obstime = sdf.format(dto);
GagePPOptions opts = options;
int hr = dt.get(Calendar.HOUR_OF_DAY);
int min = dt.get(Calendar.MINUTE);
//
if (hr==0) {
hr=24;
dt.add(Calendar.DAY_OF_MONTH, -1);
dto=dt.getTime();
}
String obstime = sdf.format(dto);
char sixhroffset = get_offset_code(min);
char sixhrqc = 'M';
char minoff = sixhroffset;
char qcc = sixhrqc;
hourly_rec = null;
//
String where = "WHERE lid='" + id + "' AND ts='" + ts
+ "' AND obsdate ='" + obstime + "'";
if (hr >= 0 && hr <= 6) {
six = 0;
} else if (hr >= 7 && hr <= 12) {
} else if (hr > 6 && hr <= 12) {
six = 1;
} else if (hr >= 13 && hr <= 18) {
} else if (hr > 12 && hr <= 18) {
six = 2;
} else {
six = 3;
@ -178,8 +190,8 @@ public final class GagePPWrite {
}
if (hourly_rec == null) {
minute_offset[hr - 1] = minoff;
hourly_qc[hr - 1] = qcc;
setMinOffset(minute_offset, hr, minoff);
setHourlyQC(hourly_qc, hr, qcc);
sixhr_offset[six] = sixhroffset;
sixhr_qc[six] = sixhrqc;
@ -240,25 +252,29 @@ public final class GagePPWrite {
System.out.println("Hourly Rec is null.");
}
old_offset = hourly_rec.getMinuteOffset().toCharArray();
prev_offset = old_offset[hr - 1];
int slot = getOffset(old_offset, hr);
slot=hr-1;
prev_offset = old_offset[slot];
old_qc = hourly_rec.getHourlyQc().toCharArray();
prev_qc = old_qc[hr - 1];
int qcslot = getOffset(old_qc, hr);
qcslot=hr-1;
prev_qc = old_qc[qcslot];
int use_value = 1;
if (get_hour_slot_value(hourly_rec, hr) != null) {
old_hr_value = get_hour_slot_value(hourly_rec, hr);
use_value = use_precip_value(new_hourly_value, old_hr_value,
qcc, prev_qc, minute_offset[hr - 1], prev_offset,
opts.shef_duplicate.name(), revision[hr - 1]);
qcc, prev_qc, minute_offset[slot], prev_offset,
opts.shef_duplicate.name(), revision);
}
if (use_value == 1) {
hr_value = new_hourly_value;
offset = old_offset;
offset[hr - 1] = minoff;
offset[slot] = minoff;
qc = old_qc;
qc[hr - 1] = qcc;
qc[qcslot] = qcc;
} else {
hr_value = old_hr_value;
offset = old_offset;
@ -482,12 +498,12 @@ public final class GagePPWrite {
Arrays.fill(sixhr_qc, '-');
Arrays.fill(sixhr_offset, '-');
if (hour_slot == 0) {
hour_slot = 24;
dt.add(Calendar.HOUR_OF_DAY, -1);
}
minute_offset[hour_slot - 1] = zero_offset_code;
hourly_qc[hour_slot - 1] = manual_qc_code;
// if (hour_slot == 0) {
// hour_slot = 24;
// dt.add(Calendar.HOUR_OF_DAY, -1);
// }
minute_offset[hour_slot] = zero_offset_code;
hourly_qc[hour_slot] = manual_qc_code;
set_hour_slot_value(hourly_rec, hour_slot, new_hourly_value);
return hour_slot;
}
@ -507,6 +523,46 @@ public final class GagePPWrite {
}
}
/**
*
* @param qc
* @param hour
* @param value
*/
public static final void setMinOffset(char [] minOffset, int hour, char value) {
if(hour == 0) {
hour = 23;
} else {
hour--;
}
minOffset[hour] = value;
}
// get the correct offset slot in array based on hour
public static final int getOffset(char[] minOffset, int hour){
int slot = 0;
if(hour == 0){
slot = 23;
}else {
slot = hour--;
}
return slot;
}
/**
*
* @param qc
* @param hour
* @param value
*/
public static final void setHourlyQC(char [] qc, int hour, char value) {
if(hour == 0) {
hour = 23;
} else {
hour--;
}
qc[hour] = value;
}
/**
* Returns the offset code based on minute of the hour.
*
@ -808,122 +864,98 @@ public final class GagePPWrite {
*/
switch (hour) {
case 1:
precip_value = pHourlyPP.getHour1();
break;
case 2:
precip_value = pHourlyPP.getHour2();
break;
case 3:
precip_value = pHourlyPP.getHour3();
break;
case 4:
precip_value = pHourlyPP.getHour4();
break;
case 5:
precip_value = pHourlyPP.getHour5();
break;
case 6:
precip_value = pHourlyPP.getHour6();
break;
case 7:
precip_value = pHourlyPP.getHour7();
break;
case 8:
precip_value = pHourlyPP.getHour8();
break;
case 9:
precip_value = pHourlyPP.getHour9();
break;
case 10:
precip_value = pHourlyPP.getHour10();
break;
case 11:
precip_value = pHourlyPP.getHour11();
break;
case 12:
precip_value = pHourlyPP.getHour12();
break;
case 13:
precip_value = pHourlyPP.getHour13();
break;
case 14:
precip_value = pHourlyPP.getHour14();
break;
case 15:
precip_value = pHourlyPP.getHour15();
break;
case 16:
precip_value = pHourlyPP.getHour16();
break;
case 17:
precip_value = pHourlyPP.getHour17();
break;
case 18:
precip_value = pHourlyPP.getHour18();
break;
case 19:
precip_value = pHourlyPP.getHour19();
break;
case 20:
precip_value = pHourlyPP.getHour20();
break;
case 21:
precip_value = pHourlyPP.getHour21();
break;
case 22:
precip_value = pHourlyPP.getHour22();
break;
case 23:
precip_value = pHourlyPP.getHour23();
break;
case 0:
case 24:
precip_value = pHourlyPP.getHour24();
break;
@ -1063,7 +1095,7 @@ public final class GagePPWrite {
pHourly.setHour23(precip_value);
break;
case 0:
case 24:
precip_value = new Short((short) val);
pHourly.setHour24(precip_value);
break;
@ -1098,4 +1130,4 @@ public final class GagePPWrite {
return retVal;
}
}
}

View file

@ -95,6 +95,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* ------------ ---------- ----------- --------------------------
* Feb 8, 2011 mschenke Initial creation
* Aug 8, 2012 15271 snaples Updated hourly slot
* Aug 17, 2012 15271 snaples Added check to add only PP gages
*
* </pre>
*
@ -122,6 +123,8 @@ public class MPEGageResource extends AbstractMPEInputResource {
private final RGB triangleColor = RGBColors.getRGBColor("YELLOW");
private final double MILLICVT = 25.4;
private DataMappingPreferences dmPref;
private ColorMap colorMap;
@ -175,6 +178,8 @@ public class MPEGageResource extends AbstractMPEInputResource {
gageTriangles = null;
}
}
lastDate = displayMgr.getCurrentDate();
addPoints(MPEDataManager.getInstance().readGageData(lastDate, lastDate));
issueRefresh();
}
@ -267,6 +272,7 @@ public class MPEGageResource extends AbstractMPEInputResource {
double lon_2 = in.getDouble();
lon_2 *= (lon_2 > 0) ? -1 : 1;
lat_2 *= (lat_2 < 0) ? -1 : 1;
compiler.handle(gf.createLineString(new Coordinate[] {
new Coordinate(lon_1, lat_1),
new Coordinate(lon_2, lat_2) }));
@ -422,9 +428,7 @@ public class MPEGageResource extends AbstractMPEInputResource {
// Check for pseudo gage and convert
float fltVal = gageData.getGval();
if (gageData.getId().contains("PSEUDO")) {
UnitConverter conv = SI.MILLIMETER
.getConverterTo(NonSI.INCH);
fltVal = (float) conv.convert(gageData.getGval());
fltVal = (float) (gageData.getGval() / MILLICVT);
}
// System.out.println("--- fltVal = " + fltVal);
gageColor = getColorByValue(fltVal);
@ -452,6 +456,9 @@ public class MPEGageResource extends AbstractMPEInputResource {
for (ListIterator<MPEGageData> it = gages.listIterator(); it
.hasNext();) {
MPEGageData gageData = it.next();
if (!gageData.getPe().equalsIgnoreCase("PP")) {
continue;
}
Coordinate latLon = gageData.getLatLon();
double[] pixel = descriptor.worldToPixel(new double[] {
latLon.x, latLon.y });
@ -463,8 +470,9 @@ public class MPEGageResource extends AbstractMPEInputResource {
Envelope env = new Envelope(p1, p2);
ArrayList<Object> data = new ArrayList<Object>();
data.add(latLon);
data.add("GAGE: " + gageData.getId() + " VALUE: "
+ gageData.getGval());
String newData = "GAGE: " + gageData.getId() + " VALUE: "
+ gageData.getGval();
data.add(newData);
strTree.insert(env, data);
}
}

View file

@ -115,7 +115,7 @@ public class RegenHrFlds {
double new_hourly_value;
short[] revision = new short[24];
short revision;
short[] revision_6hour = new short[4];
@ -238,15 +238,12 @@ public class RegenHrFlds {
hour_slot = GagePPWrite.gage_pp_init(datetime,
gData.id, gData.ts, new_hourly_value, obsdate,
zero_offset_code, manual_qc_code);
for (j = 0; j < NUM_HOURLY_SLOTS; ++j) {
revision[j] = 0;
}
for (j = 0; j < NUM_6HOURLY_SLOTS; ++j) {
revision_6hour[j] = 0;
}
revision[hour_slot - 1] = 1;
revision = 1;
try {
GagePPWrite.gage_pp_write_rec("PP", gData.id,
@ -282,6 +279,7 @@ public class RegenHrFlds {
Calendar cl = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cl.setTime(datetime);
int hh = cl.get(Calendar.HOUR_OF_DAY);
hh = hour_slot;
String hour = "" + hh;
if (hh < 10) {
hour = "0" + hh;
@ -357,9 +355,22 @@ public class RegenHrFlds {
private void update_rawPP(Date datetime, String id, String ts,
char manual_qc_code, int pp_1hr_dur, double pp_value) {
Date dto = new Date(datetime.getTime());
Calendar dt = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
dt.setTime(dto);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
int hr = dt.get(Calendar.HOUR_OF_DAY);
//
if (hr==0) {
hr=24;
dt.add(Calendar.DAY_OF_MONTH, -1);
}
String where = "WHERE lid='" + id + "' AND pe='PP'" + " AND dur="
+ pp_1hr_dur + " AND ts='" + ts + "' AND extremum='Z'"
+ " AND obstime='" + sdf.format(datetime) + "'";
+ " AND obstime='" + sdf.format(dt.getTime()) + "'";
List<Rawpp> rawpp_rec = MPEDataManager.getInstance().getRawPP(where);
if (rawpp_rec.isEmpty()) {
@ -373,9 +384,9 @@ public class RegenHrFlds {
+ ts
+ "','Z'"
+ ",'"
+ sdf.format(datetime)
+ sdf.format(dt.getTime())
+ "','"
+ sdf.format(datetime)
+ sdf.format(dt.getTime())
+ "','"
+ manual_qc_code
+ "',"
@ -391,11 +402,11 @@ public class RegenHrFlds {
where = "set value=" + pp_value + ",shef_Qual_Code='"
+ manual_qc_code + "',revision=1" + ",quality_Code="
+ ShefConstants.QC_MANUAL_PASSED + ",producttime='"
+ sdf.format(datetime) + "',postingtime='"
+ sdf.format(datetime) + "' WHERE lid='" + id
+ sdf.format(dt.getTime()) + "',postingtime='"
+ sdf.format(dt.getTime()) + "' WHERE lid='" + id
+ "' AND pe='PP'" + " AND dur=" + pp_1hr_dur + " AND ts='"
+ ts + "' AND extremum='Z'" + " AND obstime='"
+ sdf.format(datetime) + "'";
+ sdf.format(dt.getTime()) + "'";
MPEDataManager.getInstance().updateRawPP(where);
}
}

View file

@ -19,6 +19,13 @@
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Blended Rain Rate" id="rainfallRate">
<dataURI>/satellite/%/NESDIS/POES-NPOESS/Supernational/Rain_fall_rate</dataURI>
<substitute key="element" value="Rain fall rate"/>
<substitute key="entity" value="POES-NPOESS"/>
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)"/>
</contribute>
<contribute xsi:type="titleItem" titleText="------ GOES ------"
id="GOESLine"/>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
@ -66,13 +73,6 @@
<substitute key="colormap" value="Sat/Low Cloud Base" />
</contribute>
<contribute xsi:type="titleItem" titleText="------ DMSP SSM/I ------" id="DMSPLine"/>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Rainfall Rate" id="rainfallRate">
<dataURI>/satellite/%/NESDIS/DMSP/Supernational/Rain_fall_rate</dataURI>
<substitute key="element" value="Rain fall rate"/>
<substitute key="entity" value="DMSP"/>
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Total Precip Water" id="totalPrecipWater">
<dataURI>/satellite/%/NESDIS/DMSP/Supernational/Sounder_Based_Derived_Precipitable_Water_(PW)</dataURI>
@ -81,13 +81,6 @@
<substitute key="colormap" value="Sat/Precip Water/Precip Water - Polar)"/>
</contribute>
<contribute xsi:type="titleItem" titleText="------ POES AMSU ------" id="POESAMSULine"/>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Rainfall Rate" id="rainfallRate">
<dataURI>/satellite/%/NESDIS/POES-NPOESS/Supernational/Rain_fall_rate</dataURI>
<substitute key="element" value="Rain fall rate"/>
<substitute key="entity" value="POES-NPOESS"/>
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Total Precip Water" id="totalPrecipWater">
<dataURI>/satellite/%/NESDIS/POES-NPOESS/Supernational/Sounder_Based_Derived_Precipitable_Water_(PW)</dataURI>
@ -111,4 +104,4 @@
<substitute key="entity" value="Miscellaneous"/>
<substitute key="colormap" value="Sat/Precip Water/Percent of Normal TPW"/>
</contribute>
</menuTemplate>
</menuTemplate>

View file

@ -151,7 +151,12 @@ public class SatelliteConstants {
} else if(creatingEntity.equals(DMSP)){
rVal = "DMSP SSM/I " + rVal;
} else if(creatingEntity.equals(POES)){
rVal = "POES AMSU " + rVal;
if (productName.equals("Rain fall rate")) {
rVal = "Blended Rain Rate (mm/hr)";
}
else {
rVal = "POES AMSU " + rVal;
}
} else if(creatingEntity.equals(MISC)){
rVal = "Blended " + rVal;
}

View file

@ -158,6 +158,7 @@ import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.CommandHistory;
import com.raytheon.viz.texteditor.command.CommandType;
import com.raytheon.viz.texteditor.command.ICommand;
import com.raytheon.viz.texteditor.dialogs.WarnGenConfirmationDlg.SessionDelegate;
import com.raytheon.viz.texteditor.fax.dialogs.FaxMessageDlg;
import com.raytheon.viz.texteditor.fax.dialogs.LdadFaxSitesDlg;
import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback;
@ -281,7 +282,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 06/19/2012 14975 D.Friedman Prevent zeroed-out WMO header times.
* 18JUL2012 14457 rferrel Add mouse listener to clear site's update obs when clicked on.
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
* 20AUG2012 15340 D.Friedman Use callbacks for stop sign dialog. Prevent NOR in header.
* </pre>
*
* @author lvenable
@ -4358,43 +4360,50 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @param resend
* true if product is to be resent
*/
synchronized private void sendProduct(boolean resend) {
CAVEMode mode = CAVEMode.getMode();
synchronized private void sendProduct(final boolean resend) {
final CAVEMode mode = CAVEMode.getMode();
StdTextProduct prod = getStdTextProduct();
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
String title = QualityControl.getProductWarningType(prod.getNnnid());
StringBuilder productMessage = new StringBuilder();
final String title = QualityControl.getProductWarningType(prod.getNnnid());
final StringBuilder productMessage = new StringBuilder();
StringBuilder modeMessage = new StringBuilder();
final StringBuilder modeMessage = new StringBuilder();
modeMessage.append("The workstation is in ").append(mode)
.append(" mode.");
if (resend) {
productMessage = new StringBuilder();
productMessage.append("You are about to RESEND a " + afosId + "\n");
productMessage.append(title).append(".\n");
modeMessage.append("\nThere is no QC check for resend product.");
} else if (warnGenFlag) {
productMessage.append("You are about to SEND a " + afosId + "\n");
productMessage.append(title).append(".\n");
QualityControl qcCheck = new QualityControl();
if (qcCheck.checkWarningInfo(headerTF.getText().toUpperCase(),
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
"Problem Detected by QC", qcCheck.getErrorMessage(),
"Do you really want to Send?\n", mode);
wgcd.open();
if (!Boolean.TRUE.equals(wgcd.getReturnValue())) {
return;
}
wgcd.open(new SessionDelegate() {
@Override
public void dialogDismissed(Object dialogResult) {
if (Boolean.TRUE.equals(dialogResult))
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
}
});
return;
}
productMessage.append("You are about to SEND a " + afosId + "\n");
productMessage.append(title).append(".\n");
}
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
}
private void finishSendProduct1(final boolean resend, String title, CAVEMode mode, StringBuilder productMessage, StringBuilder modeMessage) {
Pattern p = Pattern.compile(".\\%[s].");
Matcher m = p.matcher(STORED_SENT_MSG);
boolean result = (CAVEMode.OPERATIONAL.equals(mode) || CAVEMode.TEST
final boolean result = (CAVEMode.OPERATIONAL.equals(mode) || CAVEMode.TEST
.equals(mode));
modeMessage.append(result ? m.replaceAll(" ") : m.replaceAll(" not "));
@ -4423,11 +4432,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell, title,
productMessage.toString(), modeMessage.toString(), mode);
wgcd.open();
wgcd.open(new SessionDelegate() {
@Override
public void dialogDismissed(Object dialogResult) {
if (Boolean.TRUE.equals(dialogResult))
finishSendProduct2(resend, result);
}
});
}
if (!Boolean.TRUE.equals(wgcd.getReturnValue())) {
return;
}
private void finishSendProduct2(boolean resend, boolean result) {
// DR14553 (make upper case in product)
String body = textEditor.getText().toUpperCase();
@ -4450,7 +4464,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
token);
OUPRequest req = new OUPRequest();
OfficialUserProduct oup = new OfficialUserProduct();
prod = getStdTextProduct();
StdTextProduct prod = getStdTextProduct(); // TODO: makes me nervous...
String awipsWanPil = prod.getSite() + prod.getNnnid()
+ prod.getXxxid();
String awipsID = prod.getNnnid() + prod.getXxxid();
@ -4462,7 +4476,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
oup.setNeedsWmoHeader(false);
oup.setProductText(product);
oup.setSource("TextWS");
oup.setWmoType(prod.getBbbid());
oup.setWmoType(fixNOR(prod.getBbbid()));
oup.setUserDateTimeStamp(prod.getHdrtime());
oup.setFilename(awipsID + ".wan"
+ (System.currentTimeMillis() / 1000));
@ -4872,7 +4886,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
StdTextProductServerRequest request = new StdTextProductServerRequest();
request.setBbbid(product.getBbbid());
request.setBbbid(fixNOR(product.getBbbid()));
request.setCccid(product.getCccid());
request.setCreatetime(product.getRefTime());
request.setDataCrc(product.getDataCrc());
@ -5182,7 +5196,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
public void setCurrentBbbId(String bbbId) {
TextDisplayModel.getInstance().setBbbId(token, bbbId);
TextDisplayModel.getInstance().setBbbId(token, fixNOR(bbbId));
}
public void setCurrentWsfoId(String wsfoId) {
@ -7279,4 +7293,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
job.setSystem(true);
job.schedule();
}
private static String fixNOR(String bbb) {
if ("NOR".equals(bbb))
return "";
else
return bbb;
}
}

View file

@ -23,6 +23,8 @@ package com.raytheon.viz.texteditor.dialogs;
import java.io.InputStream;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@ -48,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 27Jul2010 4773 cjeanbap Initial development
* 10Aug2010 2187 cjeanbap Removed warnGenFlag.
* 10Nov2011 11552 rferrel returnvalue no longer null
* 08/20/2012 DR 15340 D. Friedman Use callbacks for closing
*
* </pre>
*
@ -66,10 +69,17 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
private String IMAGE_TEST = "res/images/twsTest.gif";
private String IMAGE_PRACTICE = "res/images/twsPractice.gif";
public static interface SessionDelegate {
void dialogDismissed(Object result);
}
private SessionDelegate sessionDelegate;
protected WarnGenConfirmationDlg(Shell parentShell, String title,
String productMessage, String modeMessage, CAVEMode mode) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.NONE);
super(parentShell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL,
CAVE.NONE | CAVE.DO_NOT_BLOCK);
setText(title);
@ -78,6 +88,13 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
this.mode = mode;
setReturnValue(Boolean.FALSE);
}
public void open(SessionDelegate sessionDelegate) {
if (sessionDelegate != null && isOpen())
throw new RuntimeException(String.format("Dialog \"%s\" already open", getText()));
this.sessionDelegate = sessionDelegate;
super.open();
}
@Override
protected void initializeComponents(Shell shell) {
@ -86,7 +103,13 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
createImage(mainComposite);
createMessageLabel(mainComposite);
createButtonRow(mainComposite);
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (sessionDelegate != null)
sessionDelegate.dialogDismissed(getReturnValue());
}
});
}
private void createImage(Composite mainComposite) {

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.jboss.cache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,5 +1,6 @@
package com.raytheon.uf.common.dataplugin.ffmp;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
@ -99,6 +100,28 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
return Float.NaN;
}
}
/**
* purge out old entries
*
* @param date
*/
public void purgeData(Date date) {
if (guidValues != null) {
synchronized (guidValues) {
ArrayList<Date> removes = new ArrayList<Date>();
for (Date mdate : guidValues.keySet()) {
if (mdate.before(date)) {
removes.add(mdate);
}
}
for (Date rdate : removes) {
guidValues.remove(rdate);
}
}
}
}
/**
* Check for a source, only recent date
@ -155,7 +178,7 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
return val;
}
/**
* Gets a Value for a FFG source
*
@ -188,8 +211,13 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
FFMPGuidanceInterpolation interpolation, long expiration) {
Float dvalue = Float.NaN;
Float value = getValue(date, sourceName);
Float value = Float.NaN;
Date closestDate = getClosest(sourceName, date, expiration);
if (closestDate != null) {
value = getValue(closestDate, sourceName);
}
if (!value.isNaN()) {
FFFGDataMgr dman = FFFGDataMgr.getInstance();
if (dman.isExpired() == false) {
@ -220,6 +248,7 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
Date markerDate = guidValues.firstKey();
for (Date checkDate : guidValues.keySet()) {
if (guidValues.get(checkDate).containsKey(sourceName)) {
float val = guidValues.get(checkDate).get(sourceName);
if (val != FFMPUtils.MISSING) {
@ -230,7 +259,7 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
if ((time1 - time2) < expiration) {
rdate = checkDate;
}
break;
break;
}
}
}
@ -238,6 +267,65 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
return rdate;
}
/**
* Get Closest Key
*
* @param sourceName
* @param Date
* @param expiration
* @return
*/
public Date getClosest(String sourceName, Date date, long expiration) {
Date rdate = null;
if (guidValues != null && guidValues.size() > 0) {
if (guidValues.containsKey(date)) {
if (guidValues.get(date).containsKey(sourceName)) {
float val = guidValues.get(date).get(sourceName);
if (val != FFMPUtils.MISSING) {
rdate = date;
}
}
}
if (rdate == null) {
long time1 = date.getTime();
for (Date checkDate : guidValues.descendingKeySet()) {
if (guidValues.get(checkDate).containsKey(sourceName)) {
float val2 = guidValues.get(checkDate).get(sourceName);
if (val2 != FFMPUtils.MISSING) {
long time2 = checkDate.getTime();
// as long as it is +- expiration from orig date,
// golden
if (date.after(checkDate)) {
if ((time1 - time2) < expiration) {
rdate = checkDate;
break;
}
} else {
if ((time2 - time1) < expiration) {
rdate = checkDate;
break;
}
}
}
}
}
}
}
return rdate;
}
/**
* Interpolate between guidance sources

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.edex.dissemination.transmitted.TransmittedProductList;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 13, 2009 njensen Initial creation
* 08/20/2012 DR 15340 D. Friedman Fix BBB problems
*
* </pre>
*
@ -124,7 +125,8 @@ public class ModifyProduct {
sb.append(DDHHMM.format(new Date()));
}
}
if (req.getProduct().getWmoType() != null) {
if (req.getProduct().getWmoType() != null
&& req.getProduct().getWmoType().length() > 0) {
sb.append(" ");
sb.append(req.getProduct().getWmoType());
}
@ -173,6 +175,7 @@ public class ModifyProduct {
product.setProductText(sb.toString());
changed = true;
}
header.setBbb(productBBB);
}
product.setWmoType(productBBB);

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.edex.dissemination.StatusConstants;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 10, 2009 njensen Initial creation
* 08/20/2012 DR 15340 D. Friedman Fix BBB problems
*
* </pre>
*
@ -83,7 +84,7 @@ public class TransmittedProductList {
}
private static String assignBBB(String productBBB, String transmittedBBB) {
if (transmittedBBB == null)
if (transmittedBBB == null || transmittedBBB.length() == 0)
return "RRA";
String newBBB = null;
@ -91,7 +92,7 @@ public class TransmittedProductList {
if (newX[0] == 'X') {
newX[0] = 'A';
} else {
newX[0] = newX[0]++;
newX[0]++;
}
newBBB = transmittedBBB.substring(0, 2) + new String(newX);

View file

@ -32,10 +32,11 @@
# 12/09/09 DR3778 M. Huang Add acknowledgment handling
# 09/05/11 DR9602 M. Huang Fix acknowledgment handling error
# 04/13/12 DR 10388 D. Friedman Correct acknowledgment handling
# 08/17/12 DR 15304 D. Friedman Use unique output file names
#
#
import time, os, os.path, sys, subprocess, select
import time, os, os.path, sys, subprocess, select, errno
import logging, UFStatusHandler
from com.raytheon.uf.common.dissemination import OUPResponse
_Logger = logging.getLogger("HandleOUP")
@ -126,8 +127,9 @@ def process(oup, afosID, resp, ackMgr = None):
#----------
# Locally store OUP in text database and archive
#----------
awipsPathname = OUT_DIR + '/' + oup.getFilename()
if not createTargetFile(contents, awipsPathname):
awipsPathname = createTargetFile(contents,
OUT_DIR + '/' + oup.getFilename())
if not awipsPathname:
_Logger.debug('Unable to store product to text database:')
storageCompleted = DB_FAILURE
msg = 'Product ' + awipsWanPil + ' failed to be ingested and archived.\n'
@ -499,9 +501,8 @@ def isNWWSProduct(myAwipsId, myAfosId, myWmoId, siteID):
# product contents
# target product pathname (Output)
#
# Returns:
# 1 (TRUE) = target product successfully created
# 0 (FALSE) = target product creation failed
# Returns:
# The output path (which may differ from targetPathname)
#
# Implementation:
#
@ -509,13 +510,27 @@ def isNWWSProduct(myAwipsId, myAfosId, myWmoId, siteID):
def createTargetFile(fileData, targetPathname):
_Logger.debug('createTargetFile():')
_Logger.debug('target product pathname = ' + targetPathname)
pathToUse = targetPathname
i = 0
while True:
try:
fd = os.open(pathToUse, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0666)
except OSError, e:
if e.errno == errno.EEXIST:
i += 1
pathToUse = targetPathname + '.' + str(i)
continue
raise e
else:
break
if i > 0:
_Logger.info('Renamed target file to ' + pathToUse)
outFile = open(targetPathname, 'w')
outFile = os.fdopen(fd, 'w')
outFile.write(fileData)
outFile.flush()
outFile.close()
return True
return pathToUse

View file

@ -170,7 +170,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
public ArrayList<String> loadedData = new ArrayList<String>();
/** thread the productkeys **/
public HashMap<String, ArrayList<String>> productKeys = new HashMap<String, ArrayList<String>>();
public ConcurrentHashMap<String, ArrayList<String>> productKeys = new ConcurrentHashMap<String, ArrayList<String>>();
/** template config manager **/
public FFMPTemplateConfigurationManager tempConfig = null;
@ -510,7 +510,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
+ " ms, wrote " + records.size() + " ");
} else {
statusHandler.handle(Priority.INFO, config.getCWA()
statusHandler.handle(Priority.WARN, config.getCWA()
+ " no new products to produce.");
}
// dump data we don't need anymore
@ -1371,12 +1371,9 @@ public class FFMPGenerator extends CompositeProductGenerator implements
source, ffmpRec.getBasinData(huc), huc,
ffmpRec.getSiteKey());
}
// purge it up
fdc.purge(backDate);
// set the name
fdc.setFilePath("" + sharePath + ffmpRec.getWfo() + "/"
+ sourceSiteDataKey);
// cache it temporarily for FFTI use
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
@ -1396,7 +1393,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
+ (System.currentTimeMillis() - ptime)
+ " ms: source: " + sourceSiteDataKey);
} catch (Exception e) {
statusHandler.handle(Priority.INFO,
statusHandler.handle(Priority.ERROR,
"Failed Processing FFMPDataContainer" + e.getMessage());
} finally {
@ -1413,10 +1410,20 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
}
}
if (write) {
// write it out
writeLoaderBuddyFiles(fdc);
// purge it up
if (fdc != null) {
// this is defensive for if errors get thrown
if (backDate == null) {
backDate = new Date((System.currentTimeMillis())
- (3600 * 1000 * 6));
}
fdc.purge(backDate);
if (write) {
// write it out
writeLoaderBuddyFiles(fdc);
}
}
}
}
@ -1577,6 +1584,11 @@ public class FFMPGenerator extends CompositeProductGenerator implements
try {
File sharePathFile = new File(sharePath + config.getCWA());
if (!sharePathFile.exists()) {
sharePathFile.mkdirs();
}
String fileName = fdc.getFilePath();
// lock for atomic write and read
HashMap<String, String> fileNames = new HashMap<String, String>();
@ -1624,6 +1636,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements
statusHandler.handle(Priority.ERROR,
"IO Error Writing buddy file: "
+ e.getMessage());
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"General Error Writing buddy file: "
+ e.getMessage());
} finally {
if (os != null) {
os.close();
@ -1643,7 +1659,17 @@ public class FFMPGenerator extends CompositeProductGenerator implements
try {
for (String tmpName : fileNames.keySet()) {
File file = new File(tmpName);
file.renameTo(new File(fileNames.get(tmpName)));
if (file.renameTo(new File(fileNames.get(tmpName)))) {
statusHandler.handle(
Priority.DEBUG,
"Successful rename: : "
+ fileNames.get(tmpName));
} else {
statusHandler.handle(
Priority.ERROR,
"UN-Successful rename: : "
+ fileNames.get(tmpName));
}
}
if (lockfile.exists()) {
@ -1662,7 +1688,6 @@ public class FFMPGenerator extends CompositeProductGenerator implements
statusHandler.handle(Priority.ERROR,
"IO Error writing buddy files: " + e.getMessage());
}
}
}
@ -1849,13 +1874,16 @@ public class FFMPGenerator extends CompositeProductGenerator implements
.file2bytes(f.getFile(), true));
} catch (FileNotFoundException fnfe) {
statusHandler.handle(Priority.ERROR,
"Unable to locate file " + f.getName());
"Unable to locate file " + f.getName(), fnfe);
} catch (SerializationException se) {
statusHandler.handle(Priority.ERROR,
"Unable to read file " + f.getName());
"Unable to serialize file " + f.getName(), se);
} catch (IOException ioe) {
statusHandler.handle(Priority.ERROR,
"Unable to read file " + f.getName());
"IO problem reading file " + f.getName(), ioe);
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"General Exception reading file " + f.getName(), e);
}
return ffti;

View file

@ -205,7 +205,7 @@ mask=ISC_Send_Area
# Parameter list for the netcdf file
parmlist="" #send all parameters
. ${IFPS_DATA}/rsync_parms.${1}
. ${IFPS_DATA}/rsync_parms.${site}
creationAttempts=3 # How many times do you want script to create and
# quality control netcdf files if bad netcdf files
@ -272,7 +272,7 @@ find ${WRKDIR}/. -mmin +60 -exec rm {} -f \;
echo ...finished. >> $LOG_FILE
echo " " >> $LOG_FILE
if [ "$parmlist" != "" ]; then
if [ "$parmlist" != "" ] && [ "$parmlist" != " " ]; then
echo "Will trim elements to $parmlist" >> $LOG_FILE
else
echo "Will send all elements" >> $LOG_FILE

View file

@ -41,6 +41,13 @@ import jep.python.PyObject;
* @author [mrjohnson0 at sourceforge.net] Mike Johnson
* @version $Id: Jep.java 448 2007-11-27 00:30:23Z mrjohnson0 $
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
public final class Jep {
private boolean closed = false;

View file

@ -12,6 +12,13 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#
# August 2, 2012
# Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
# Modifications marked and described by 'njensen'
#
srcdir = .

View file

@ -26,6 +26,12 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#include "util.h"
#include "jep.h"
#include "pyembed.h"

View file

@ -38,6 +38,13 @@
*****************************************************************************
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifndef _Included_pyembed
#define _Included_pyembed

View file

@ -31,6 +31,13 @@
of the python distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -25,6 +25,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
// shut up the compiler
#ifdef _POSIX_C_SOURCE

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
// shut up the compiler
#ifdef _POSIX_C_SOURCE
# undef _POSIX_C_SOURCE

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
// shut up the compiler
#ifdef _POSIX_C_SOURCE

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
New file created with modifications to pyjmethod.c
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
New file created with modifications to pyjmethod.h
*/
// shut up the compiler
#ifdef _POSIX_C_SOURCE

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
// shut up the compiler
#ifdef _POSIX_C_SOURCE

View file

@ -26,6 +26,13 @@
distribution.
*/
/*
August 2, 2012
Modified by Raytheon (c) 2012 Raytheon Company. All Rights Reserved.
Modifications marked and described by 'njensen'
*/
#ifdef WIN32
# include "winconfig.h"
#endif

View file

@ -1,224 +0,0 @@
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
#
# AWIPS II Java JRockit Spec File
#
Name: awips2-java-jrockit
Summary: AWIPS II Java JRockit Distribution - 32 Bit
Version: 1.6.0_26
Release: 1
Group: AWIPSII
BuildRoot: %{_build_root}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: Bryan Kowal
AutoReq: no
provides: awips2-java-jrockit
requires: awips2-java
%description
AWIPS II Java JRockit Distribution - Contains JRockit JDK 1.6.0_26 and
the JRockit Mission Control Utility.
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "/tmp" ]
then
echo "An Actual BuildRoot Must Be Specified. Use The --buildroot Parameter."
echo "Unable To Continue ... Terminating"
exit 1
fi
rm -rf %{_build_root}
mkdir -p %{_build_root}/build-java
mkdir -p %{_build_root}/awips2/java
%build
%install
RPM_CORE_PROJECT_DIR="%{_baseline_workspace}/rpms/awips2.core"
JROCKIT_PROJECT_DIR="${RPM_CORE_PROJECT_DIR}/Installer.java-jrockit"
JROCKIT_INSTALLER="jrockit-jdk1.6.0_26-R28.1.4-4.0.1-linux-ia32.bin"
SILENT_XML="silent.xml"
pushd . > /dev/null
# JRockit Setup
cd ${JROCKIT_PROJECT_DIR}/src
chmod u+x ${JROCKIT_INSTALLER}
./${JROCKIT_INSTALLER} -mode=silent -silent_xml="${SILENT_XML}"
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
popd > /dev/null
# Copy the Java "Extensions" to build-java.
JROCKIT_SRC_DIR="${JROCKIT_PROJECT_DIR}/src"
JAI_BIN="jai-1_1_3-lib-linux-i586-jdk.bin"
JAI_PATCH="jai.patch1"
JAI_IMAGEIO_BIN="jai_imageio-1_1-lib-linux-i586-jdk.bin"
JAI_IMAGEIO_PATCH="jai_imageio.patch1"
# Prepare
touch %{_build_root}/build-java/yes.txt
echo "yes" > %{_build_root}/build-java/yes.txt
cp -v ${JROCKIT_SRC_DIR}/${JAI_BIN} \
%{_build_root}/build-java
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
cp -v ${JROCKIT_SRC_DIR}/${JAI_PATCH} \
%{_build_root}/build-java
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
cp -v ${JROCKIT_SRC_DIR}/${JAI_IMAGEIO_BIN} \
%{_build_root}/build-java
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
cp -v ${JROCKIT_SRC_DIR}/${JAI_IMAGEIO_PATCH} \
%{_build_root}/build-java
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
# JAI Setup
# ... Complete Patching.
pushd . > /dev/null
cd %{_build_root}/build-java
patch -i ${JAI_PATCH}
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
chmod u+x ${JAI_BIN}
popd > /dev/null
# ... Complete Installation.
pushd . > /dev/null
cd %{_build_root}/awips2/java/jrockit
%{_build_root}/build-java/${JAI_BIN} < %{_build_root}/build-java/yes.txt
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
popd > /dev/null
# JAI ImageIO Setup
# ... Complete Patching.
pushd . > /dev/null
cd %{_build_root}/build-java
patch -i ${JAI_IMAGEIO_PATCH}
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
chmod u+x ${JAI_IMAGEIO_BIN}
popd > /dev/null
# ... Complete Installation.
pushd . > /dev/null
cd %{_build_root}/awips2/java/jrockit
%{_build_root}/build-java/${JAI_IMAGEIO_BIN} < %{_build_root}/build-java/yes.txt
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
popd > /dev/null
# pydev certificate
PYDEV_CERTIFICATE="pydev_certificate.cer"
cp -v ${JROCKIT_SRC_DIR}/${PYDEV_CERTIFICATE} \
%{_build_root}/awips2/java/jrockit/jre/lib/security
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
touch %{_build_root}/build-java/changeit.txt
echo "changeit" > %{_build_root}/build-java/changeit.txt
chmod 666 %{_build_root}/awips2/java/jrockit/jre/lib/security/cacerts
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
%{_build_root}/awips2/java/jrockit/bin/keytool -import \
-file %{_build_root}/awips2/java/jrockit/jre/lib/security/pydev_certificate.cer \
-keystore %{_build_root}/awips2/java/jrockit/jre/lib/security/cacerts \
-noprompt < %{_build_root}/build-java/changeit.txt
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
rm -rf %{_build_root}/build-java
%pre
%post
# Create a link JRockit Mission Control.
pushd . > /dev/null
cd /awips2/java/bin
ln -sf /awips2/java/jrockit/bin/jrmc .
popd > /dev/null
%preun
# Remove the link JRockit Mission Control.
pushd . > /dev/null
cd /awips2/java/bin
if [ -L jrockit ]; then
rm -f jrockit
fi
popd > /dev/null
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(644,awips,fxalpha,755)
%dir /awips2
%dir /awips2/java
%dir /awips2/java/jrockit
%dir /awips2/java/jrockit/bin
%dir /awips2/java/jrockit/include
/awips2/java/jrockit/include/*
%dir /awips2/java/jrockit/inventory
/awips2/java/jrockit/inventory/*
%dir /awips2/java/jrockit/jre
/awips2/java/jrockit/jre/*
%dir /awips2/java/jrockit/lib
%dir /awips2/java/jrockit/missioncontrol
/awips2/java/jrockit/missioncontrol/*
%doc /awips2/java/jrockit/THIRDPARTYLICENSEREADME.txt
%doc /awips2/java/jrockit/jre/THIRDPARTYLICENSEREADME.txt
/awips2/java/jrockit/jre/.systemPrefs/.system.lock
/awips2/java/jrockit/jre/.systemPrefs/.systemRootModFile
/awips2/java/jrockit/missioncontrol/.eclipseproduct
%doc /awips2/java/jrockit/COPYRIGHT-jai.txt
%doc /awips2/java/jrockit/COPYRIGHT-jai_imageio.txt
%doc /awips2/java/jrockit/DISTRIBUTIONREADME-jai.txt
%doc /awips2/java/jrockit/DISTRIBUTIONREADME-jai_imageio.txt
%doc /awips2/java/jrockit/ENTITLEMENT-jai_imageio.txt
%doc /awips2/java/jrockit/LICENSE-jai.txt
%doc /awips2/java/jrockit/LICENSE-jai_imageio.txt
%doc /awips2/java/jrockit/THIRDPARTYLICENSEREADME-jai.txt
%doc /awips2/java/jrockit/THIRDPARTYLICENSEREADME-jai_imageio.txt
%doc /awips2/java/jrockit/UNINSTALL-jai
%doc /awips2/java/jrockit/UNINSTALL-jai_imageio
%defattr(755,awips,fxalpha,755)
/awips2/java/jrockit/bin/*
/awips2/java/jrockit/lib/*
/awips2/java/jrockit/jre/bin/*
/awips2/java/jrockit/jre/lib/*

View file

@ -1,49 +0,0 @@
*** jai-1_1_3-lib-linux-i586-jdk.bin 2011-09-08 14:03:07.000000000 -0500
--- jai-1_1_3-lib-linux-i586-jdk.bin.update 2011-09-08 14:04:43.000000000 -0500
***************
*** 1,6 ****
#!/bin/sh
PATH=/bin:/usr/bin
! more <<EOF
--- 1,6 ----
#!/bin/sh
PATH=/bin:/usr/bin
! cat <<EOF
***************
*** 81,89 ****
outname=install.sfx.$$
echo "Unpacking..."
if [ "`uname`" = "SunOS" ]; then
! /bin/tail +139 $0 > $outname
else
! tail -n +139 $0 > $outname
fi
if [ -x /usr/bin/cksum ] ; then
echo "Checksumming..."
--- 81,89 ----
outname=install.sfx.$$
echo "Unpacking..."
if [ "`uname`" = "SunOS" ]; then
! /bin/tail +137 $0 > $outname
else
! tail -n +137 $0 > $outname
fi
if [ -x /usr/bin/cksum ] ; then
echo "Checksumming..."
***************
*** 119,126 ****
else
ARCH=i386 # solaris-i586 or solaris-amd64
fi
- elif [ `expr "\`uname -m\`" : .*64.*` != '0' ]; then
- ARCH=amd64 # linux-amd64
else
ARCH=i386 # linux-i586
fi
--- 119,124 ----

View file

@ -1,45 +0,0 @@
*** jai_imageio-1_1-lib-linux-i586-jdk.bin 2011-09-08 14:29:01.000000000 -0500
--- jai_imageio-1_1-lib-linux-i586-jdk.bin.update 2011-09-08 14:30:10.000000000 -0500
***************
*** 1,6 ****
#!/bin/sh
PATH=/bin:/usr/bin
! more <<EOF
--- 1,6 ----
#!/bin/sh
PATH=/bin:/usr/bin
! cat <<EOF
***************
*** 160,166 ****
fi
outname=install.sfx.$$
echo "Unpacking..."
! tail +215 $0 > $outname
if [ -x /usr/bin/cksum ] ; then
echo "Checksumming..."
--- 160,166 ----
fi
outname=install.sfx.$$
echo "Unpacking..."
! tail -n +213 $0 > $outname
if [ -x /usr/bin/cksum ] ; then
echo "Checksumming..."
***************
*** 195,202 ****
else
ARCH=i386 # solaris-i586 or solaris-amd64
fi
- elif [ `expr \`uname -m\` : .*64.*` != '0' ]; then
- ARCH=amd64 # linux-amd64
else
ARCH=i386 # linux-i586
fi
--- 195,200 ----

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<domain-template-descriptor>
<input-fields>
<data-value name="USER_INSTALL_DIR" value="/tmp/awips-component/awips2/java/jrockit" />
<data-value name="INSTALL_DEMOS_AND_SAMPLES" value="false" />
<data-value name="INSTALL_SOURCE_CODE" value="false" />
</input-fields>
</domain-template-descriptor>

View file

@ -84,6 +84,54 @@ if [ "${2}" = "-nobinlightning" ]; then
LIGHTNING=false
fi
if [ "${1}" = "-python-qpid" ]; then
buildRPM "awips2"
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-nose"
buildRPM "awips2-python-numpy"
buildRPM "awips2-python-h5py"
buildRPM "awips2-python-jimporter"
buildRPM "awips2-python-matplotlib"
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"
buildRPM "awips2-python-thrift"
buildRPM "awips2-python-tpg"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
if [ $? -ne 0 ]; then
exit 1
fi
buildQPID
if [ $? -ne 0 ]; then
exit 1
fi
#buildRPM "awips2-ant"
#unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
#buildRPM "awips2-httpd-pypies"
#buildRPM "awips2-java"
#buildRPM "awips2-ldm"
#buildRPM "awips2-postgresql"
#buildRPM "awips2-psql"
#buildRPM "awips2-tools"
exit 0
fi
if [ "${1}" = "-delta" ]; then
buildCAVE
if [ $? -ne 0 ]; then
@ -95,6 +143,9 @@ if [ "${1}" = "-delta" ]; then
exit 1
fi
buildRPM "awips2"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-ufpy"
@ -105,8 +156,6 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-maps-database"
@ -114,7 +163,6 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-pypies"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildRPM "awips2"
buildRPM "awips2-rcm"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
@ -283,6 +331,7 @@ if [ "${1}" = "-viz" ]; then
fi
if [ "${1}" = "-edex" ]; then
buildRPM "awips2"
buildEDEX
if [ $? -ne 0 ]; then
exit 1

View file

@ -0,0 +1,368 @@
#!/bin/bash
function buildRPM()
{
# Arguments:
# ${1} == the name of the rpm.
lookupRPM "${1}"
if [ $? -ne 0 ]; then
echo "ERROR: '${1}' is not a recognized AWIPS II RPM."
exit 1
fi
/usr/bin/rpmbuild -ba \
--define '_topdir %(echo ${AWIPSII_TOP_DIR})' \
--define '_baseline_workspace %(echo ${WORKSPACE})' \
--define '_uframe_eclipse %(echo ${UFRAME_ECLIPSE})' \
--define '_awipscm_share %(echo ${AWIPSCM_SHARE})' \
--define '_build_root %(echo ${AWIPSII_BUILD_ROOT})' \
--define '_component_version %(echo ${AWIPSII_VERSION})' \
--define '_component_release %(echo ${AWIPSII_RELEASE})' \
--define '_component_build_date %(echo ${COMPONENT_BUILD_DATE})' \
--define '_component_build_time %(echo ${COMPONENT_BUILD_TIME})' \
--define '_component_build_system %(echo ${COMPONENT_BUILD_SYSTEM})' \
--buildroot ${AWIPSII_BUILD_ROOT} \
${RPM_SPECIFICATION}/component.spec
if [ $? -ne 0 ]; then
echo "ERROR: Failed to build RPM ${1}."
exit 1
fi
return 0
}
# This script will build all of the 32-bit rpms.
# Ensure that we are on a machine with the correct architecture.
architecture=`uname -i`
if [ ! "${architecture}" = "i386" ]; then
echo "ERROR: This build can only be performed on a 32-bit Operating System."
exit 1
fi
# Determine which directory we are running from.
path_to_script=`readlink -f $0`
dir=$(dirname $path_to_script)
common_dir=`cd ${dir}/../common; pwd;`
if [ $? -ne 0 ]; then
echo "ERROR: Unable to find the common functions directory."
exit 1
fi
# source the common functions.
source ${common_dir}/lookupRPM.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/usage.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/rpms.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/systemInfo.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to retrieve the system information."
exit 1
fi
# prepare the build environment.
source ${dir}/buildEnvironment.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to prepare the build environment."
exit 1
fi
export LIGHTNING=true
# Determine if the optional '-nobinlightning' argument has been specified.
if [ "${2}" = "-nobinlightning" ]; then
LIGHTNING=false
fi
if [ "${1}" = "-custom" ]; then
buildRPM "awips2-java"
buildRPM "awips2-postgresql"
buildRPM "awips2-psql"
buildRPM "awips2-tools"
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
exit 0
fi
if [ "${1}" = "-delta" ]; then
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-adapt-native"
buildRPM "awips2-aviation-shared"
buildRPM "awips2-cli"
buildRPM "awips2-database"
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-maps-database"
buildRPM "awips2-notification"
buildRPM "awips2-pypies"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildRPM "awips2"
buildRPM "awips2-rcm"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-full" ]; then
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-h5py"
buildRPM "awips2-python-jimporter"
buildRPM "awips2-python-matplotlib"
buildRPM "awips2-python-nose"
buildRPM "awips2-python-numpy"
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"
buildRPM "awips2-python-thrift"
buildRPM "awips2-python-tpg"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildRPM "awips2-adapt-native"
buildRPM "awips2-aviation-shared"
buildRPM "awips2-cli"
buildRPM "awips2-database"
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-data.gfe"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-maps-database"
buildRPM "awips2-notification"
buildRPM "awips2-pypies"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2"
buildRPM "awips2-rcm"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
fi
buildQPID
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-ant"
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
buildRPM "awips2-java"
#buildRPM "awips2-ldm"
buildRPM "awips2-postgresql"
buildRPM "awips2-psql"
buildRPM "awips2-tools"
exit 0
fi
if [ "${1}" = "-ade" ]; then
buildRPM "awips2-eclipse"
buildRPM "awips2-java"
buildRPM "awips2-ant"
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-h5py"
buildRPM "awips2-python-jimporter"
buildRPM "awips2-python-matplotlib"
buildRPM "awips2-python-nose"
buildRPM "awips2-python-numpy"
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"
buildRPM "awips2-python-thrift"
buildRPM "awips2-python-tpg"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildQPID -ade
if [ $? -ne 0 ]; then
exit 1
fi
# Package the ade.
# Create the containing directory.
ade_directory="awips2-ade-${AWIPSII_VERSION}-${AWIPSII_RELEASE}"
if [ -d ${WORKSPACE}/${ade_directory} ]; then
rm -rf ${WORKSPACE}/${ade_directory}
if [ $? -ne 0 ]; then
exit 1
fi
fi
mkdir -p ${WORKSPACE}/${ade_directory}
if [ $? -ne 0 ]; then
exit 1
fi
# Copy the rpms to the directory.
cp -v ${AWIPSII_TOP_DIR}/RPMS/i386/* \
${AWIPSII_TOP_DIR}/RPMS/noarch/* \
${WORKSPACE}/${ade_directory}
if [ $? -ne 0 ]; then
exit 1
fi
awips2_ade_directory="${WORKSPACE}/rpms/awips2.ade"
# Copy the install and uninstall script to the directory.
cp -v ${awips2_ade_directory}/tar.ade/scripts/*.sh \
${WORKSPACE}/${ade_directory}
if [ $? -ne 0 ]; then
exit 1
fi
# Tar the directory.
pushd . > /dev/null 2>&1
cd ${WORKSPACE}
tar -cvf ${ade_directory}.tar ${ade_directory}
popd > /dev/null 2>&1
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-viz" ]; then
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
exit 0
fi
if [ "${1}" = "-edex" ]; then
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-qpid" ]; then
buildQPID
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-ldm" ]; then
# Ensure that the user has root privileges.
if [ ! ${UID} = 0 ]; then
echo "ERROR: You must have root privileges to build ldm."
exit 1
fi
buildRPM "awips2-ldm"
exit 0
fi
if [ "${1}" = "-package" ]; then
repository_directory="awips2-repository-${AWIPSII_VERSION}-${AWIPSII_RELEASE}"
if [ -d ${WORKSPACE}/${repository_directory} ]; then
rm -rf ${WORKSPACE}/${repository_directory}
if [ $? -ne 0 ]; then
exit 1
fi
fi
mkdir -p ${WORKSPACE}/${repository_directory}/${AWIPSII_VERSION}-${AWIPSII_RELEASE}
if [ $? -ne 0 ]; then
exit 1
fi
cp -r ${AWIPSII_TOP_DIR}/RPMS/* \
${WORKSPACE}/${repository_directory}/${AWIPSII_VERSION}-${AWIPSII_RELEASE}
if [ $? -ne 0 ]; then
exit 1
fi
rpms_directory="${WORKSPACE}/rpms"
comps_xml="${rpms_directory}/common/yum/arch.x86/comps.xml"
cp -v ${comps_xml} ${WORKSPACE}/${repository_directory}
if [ $? -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
cd ${WORKSPACE}
tar -cvf ${repository_directory}.tar ${repository_directory}
RC=$?
popd > /dev/null
if [ ${RC} -ne 0 ]; then
exit 1
fi
exit 0
fi
usage
exit 0

View file

@ -0,0 +1,51 @@
JasPer License Version 2.0
Copyright (c) 2001-2006 Michael David Adams
Copyright (c) 1999-2000 Image Power, Inc.
Copyright (c) 1999-2000 The University of British Columbia
All rights reserved.
Permission is hereby granted, free of charge, to any person (the
"User") obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
1. The above copyright notices and this permission notice (which
includes the disclaimer below) shall be included in all copies or
substantial portions of the Software.
2. The name of a copyright holder shall not be used to endorse or
promote products derived from the Software without specific prior
written permission.
THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.

View file

@ -8,7 +8,7 @@
Name: awips2-python-qpid
Summary: AWIPS II Python qpid Distribution
Version: 0.6
Release: 4
Release: 5
Group: AWIPSII
BuildRoot: %{_build_root}
BuildArch: %{_build_arch}
@ -60,6 +60,7 @@ QPID_SRC_DIR="%{_python_pkgs_dir}/qpid"
QPID_SRC="qpid-0.6/python"
QPID_SPECS="qpid-0.6/specs"
QPID_QUEUE_COUNT_SCRIPT="qpid-queue-count"
QPID_MONITOR_SCRIPT="monitor_qpid_host.sh"
pushd . > /dev/null
cd %{_build_root}/build-python/${QPID_SRC}
@ -77,6 +78,10 @@ popd > /dev/null
cp -v ${QPID_SRC_DIR}/bin/${QPID_QUEUE_COUNT_SCRIPT} \
%{_build_root}/awips2/python/bin
# Copy the queue-counting script to bin
cp -v ${QPID_SRC_DIR}/bin/${QPID_MONITOR_SCRIPT} \
%{_build_root}/awips2/python/bin
# Copy the amqp dtd/xml data to share
mkdir -p %{_build_root}/awips2/python/share/amqp
cp -prv %{_build_root}/build-python/${QPID_SPECS}/* \

View file

@ -0,0 +1,116 @@
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%define _build_arch %(uname -i)
%define _python_pkgs_dir "%{_baseline_workspace}/pythonPackages"
#
# AWIPS II Python qpid Spec File
#
Name: awips2-python-qpid
Summary: AWIPS II Python qpid Distribution
Version: 0.6
Release: 4
Group: AWIPSII
BuildRoot: %{_build_root}
BuildArch: %{_build_arch}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: Bryan Kowal
AutoReq: no
requires: awips2-python
provides: awips2-python-qpid
%description
AWIPS II Python qpid Site-Package
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "" ]
then
echo "A Build Root has not been specified."
echo "Unable To Continue ... Terminating"
exit 1
fi
rm -rf %{_build_root}
mkdir -p %{_build_root}
mkdir -p %{_build_root}/build-python
%build
QPID_SRC_DIR="%{_python_pkgs_dir}/qpid"
QPID_TAR="qpid-0.6.tar.gz"
cp -rv ${QPID_SRC_DIR}/${QPID_TAR} \
%{_build_root}/build-python
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
cd %{_build_root}/build-python
tar -xvf ${QPID_TAR}
rm -f ${QPID_TAR}
popd > /dev/null
%install
QPID_SRC_DIR="%{_python_pkgs_dir}/qpid"
QPID_SRC="qpid-0.6/python"
QPID_SPECS="qpid-0.6/specs"
QPID_QUEUE_COUNT_SCRIPT="qpid-queue-count"
pushd . > /dev/null
cd %{_build_root}/build-python/${QPID_SRC}
mkdir -p %{_build_root}/awips2/python
export LD_LIBRARY_PATH=/awips2/python/lib
export PATH=/awips2/python/bin:${PATH}
make install PREFIX=%{_build_root}/awips2/python
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
popd > /dev/null
# Copy the queue-counting script to bin
cp -v ${QPID_SRC_DIR}/bin/${QPID_QUEUE_COUNT_SCRIPT} \
%{_build_root}/awips2/python/bin
# Copy the amqp dtd/xml data to share
mkdir -p %{_build_root}/awips2/python/share/amqp
cp -prv %{_build_root}/build-python/${QPID_SPECS}/* \
%{_build_root}/awips2/python/share/amqp
rm -rf %{_build_root}/build-python
%pre
%post
# get the path to the awips2-python that is installed
PYDIR="/awips2/python"
# get the python version so we can fix the amqp xml/dtd
PYTHON_VERSION=$( LD_LIBRARY_PATH=${PYDIR}/lib ${PYDIR}/bin/python -c "from distutils.sysconfig import get_python_version; print get_python_version()" )
# the file /awips2/python/lib/python$PYTHON_VERSION/site-packages/qpid_config.py is wrong
# this substitution will put the correct path in the file qpid_config.py
# otherwise it will generate AMQP errors when run, it won't find the directory
sed -i "s|^AMQP_SPEC_DIR=.*/share/amqp\"|AMQP_SPEC_DIR=\"${PYDIR}/share/amqp\"|g" \
${PYDIR}/lib/python${PYTHON_VERSION}/site-packages/qpid_config.py
%preun
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(644,awips,fxalpha,755)
%dir /awips2/python/lib/python2.7/site-packages
/awips2/python/lib/python2.7/site-packages/*
%dir /awips2/python/share
/awips2/python/share/*
%defattr(755,awips,fxalpha,755)
%dir /awips2/python/bin
/awips2/python/bin/*