Merge branch 'ss_builds' (12.11.1-6) into development

Conflicts:
	cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java

Former-commit-id: a7337d9160 [formerly de600d1a0e309ddbb4838526a9f92af05282cd1a]
Former-commit-id: 1807100932
This commit is contained in:
Steve Harris 2012-10-18 16:01:05 -05:00
commit 892e4df811
22 changed files with 198 additions and 153 deletions

View file

@ -25,6 +25,9 @@ from Maps import *
# The following changes the configuration of the CWAzones maps. It overrides
# every possible item that can be overridden.
# Rename by name of the CWAzones map
CWAzones.name = "MyCWAZones"
# Change the filter to only include "OH" (Ohio) zones
CWAzones.filter(lambda x : x['state'] == "OH")

View file

@ -30,7 +30,6 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 15, 2009 mschenke Initial creation
* OCT 04, 2012 15132 kshresth Restored "MSAS/LDAD QC plots" display data
*
* </pre>
*
@ -39,8 +38,7 @@ import com.raytheon.uf.common.time.DataTime;
*/
public class PlotInfo {
public Integer id;
public String stationId;
public Double latitude;
@ -78,16 +76,4 @@ public class PlotInfo {
this.plotQueued = false;
this.sampleQueued = false;
}
public PlotInfo(String stationId, Double latitude,
Double longitude, DataTime dataTime, String dataURI, Integer id) {
this.stationId = stationId;
this.latitude = latitude;
this.longitude = longitude;
this.dataTime = dataTime;
this.dataURI = dataURI;
this.id = id;
this.plotQueued = false;
this.sampleQueued = false;
}
}

View file

@ -57,7 +57,6 @@ import com.raytheon.viz.pointdata.thread.PlotSampleGeneratorJob;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 22, 2011 njensen Initial creation
* OCT 04, 2012 15132 kshresth Restored "MSAS/LDAD QC plots" display data
*
* </pre>
*
@ -180,7 +179,7 @@ public class PlotModelDataRequestJob extends Job {
private void requestData(List<PlotInfo[]> stationQuery,
List<PlotModelElement> pme) {
Map<Integer, PlotInfo> plotMap = new HashMap<Integer, PlotInfo>();
Map<String, PlotInfo> plotMap = new HashMap<String, PlotInfo>();
List<String> params = new ArrayList<String>();
for (PlotModelElement p : pme) {
@ -205,8 +204,8 @@ public class PlotModelDataRequestJob extends Job {
List<String> str = new ArrayList<String>(stationQuery.size());
for (PlotInfo[] infos : stationQuery) {
for (PlotInfo info : infos) {
str.add(Integer.toString(info.id));
plotMap.put(info.id, info);
str.add(info.dataURI);
plotMap.put(info.dataURI, info);
}
}
@ -220,7 +219,7 @@ public class PlotModelDataRequestJob extends Job {
index++;
j++;
}
map.put("id", rc);
map.put("dataURI", rc);
try {
// Try and get data from datacube
long t0 = System.currentTimeMillis();
@ -244,8 +243,8 @@ public class PlotModelDataRequestJob extends Job {
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
PointDataView pdv = pdc.readRandom(uriCounter);
if (pdv != null) {
int id = pdv.getInt("id");
PlotInfo info = plotMap.get(id);
String dataURI = pdv.getString("dataURI");
PlotInfo info = plotMap.get(dataURI);
// If the id doesn't match, try to match by
// location
if (info == null) {
@ -258,8 +257,6 @@ public class PlotModelDataRequestJob extends Job {
- pdv.getFloat("longitude"));
if (diffLat < 0.01 && diffLon < 0.01) {
info = pi;
pdv.setInt("id", pi.id);
id = pi.id;
}
}
}

View file

@ -48,7 +48,7 @@ import com.raytheon.viz.pointdata.PlotInfo;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 9, 2009 bsteffen Initial creation
* OCT 4, 2012 15132 kshresth Restored "MSAS/LDAD QC plots" display data
*
* </pre>
*
* @author bsteffen
@ -76,7 +76,6 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
} else {
dq.addColumn("dataTime");
}
dq.addColumn("id");
}
@Override
@ -104,7 +103,7 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
statusHandler.handle(Priority.CRITICAL, message, new Exception(
message));
}
stationInfo.id = (Integer) data[5];
return stationInfo;
}

View file

@ -299,6 +299,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 27SEP2012 1196 rferrel Changes for non-blocking ScriptOutputDlg.
* 01OCT2012 1229 rferrel Change WmoBrowserDlg to non-blocking
* 10OCT2012 1229 rferrel Changed AwipsBrowserDlg to non-blocking.
* 12OCT2012 15418 D.Friedman Do not store product when sending in operational mode.
* Do not use changed BBB from OUPResponse.
* </pre>
*
* @author lvenable
@ -351,6 +353,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
*/
private int endWrapLine = -1;
/**
* Last line was wrapped backwards
*/
private boolean isPreviousLineWrapped = false;
private static final String PARAGRAPH_DELIMITERS = "*$.-/^#";
private static final String PADDED_PARAGRAPH_DELIMITERS = "*";
@ -4534,11 +4541,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @param resend
* @param result
*/
private void warngenCloseCallback(boolean resend, boolean result) {
private void warngenCloseCallback(boolean resend, boolean isOperational) {
// DR14553 (make upper case in product)
String body = textEditor.getText().toUpperCase();
if (result) {
if (isOperational) {
removeOptionalFields();
try {
@ -4549,7 +4556,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
.getText().toUpperCase()), true);
}
updateTextEditor(body);
if ((inEditMode || resend) && saveEditedProduct(false, resend)) {
if ((inEditMode || resend) && saveEditedProduct(false, resend, true)) {
inEditMode = false;
}
@ -4595,7 +4602,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
.getText()));
}
updateTextEditor(body);
if ((inEditMode || resend) && saveEditedProduct(false, resend)) {
if ((inEditMode || resend) && saveEditedProduct(false, resend, false)) {
inEditMode = false;
}
SendPracticeProductRequest req = new SendPracticeProductRequest();
@ -4676,7 +4683,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
userInformation("This product MUST be edited in GFE! \n Please exit and return to GFE. \n Action Aborted!");
return;
}
boolean successful = saveEditedProduct(false, false);
boolean successful = saveEditedProduct(false, false, false);
if (successful) {
// reset the editor status flags
dirty = false;
@ -4700,7 +4707,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @return true is the save was successful
*/
synchronized private boolean saveEditedProduct(boolean isAutoSave,
boolean resend) {
boolean resend, boolean isOperationalSend) {
StdTextProduct product = TextDisplayModel.getInstance()
.getStdTextProduct(token);
if (product != null
@ -4817,7 +4824,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
*/
if (isAutoSave) {
autoSave.saveProduct(storedProduct);
} else if (resend) {
} else if (isOperationalSend || resend) {
// OUPRequest will update the StdTextProduct table.
successful = true;
} else {
@ -6484,7 +6491,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
public void run() {
if (!shell.isDisposed()) {
if (autoSave == AutoSaveTask.this) {
saveEditedProduct(true, false);
saveEditedProduct(true, false, false);
}
}
}
@ -6750,12 +6757,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
statusHandler.handle(p, response.getMessage());
} else {
// no failure
String newBBB = response.getChangedBBB();
if (newBBB != null) {
statusHandler.handle(Priority.EVENTA,
"MhsServer changed BBB field to " + newBBB);
getStdTextProduct().setBbbid(newBBB);
}
// As of DR 15418, nothing is done with response.getChangedBBB()
}
Thread.interrupted();

View file

@ -336,7 +336,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})
@ -487,7 +487,7 @@ LAT...LON ##
#end
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -302,7 +302,7 @@ REMEMBER...A TORNADO WARNING STILL REMAINS IN EFFECT FOR !** PORTION AND COUNTY
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${now}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})
@ -1161,7 +1161,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -627,7 +627,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -277,7 +277,7 @@ REMEMBER...A TORNADO WARNING STILL REMAINS IN EFFECT FOR !** PORTION AND COUNTY
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${now}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})
@ -859,7 +859,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -322,7 +322,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -563,7 +563,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})
@ -976,7 +976,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})
@ -1402,7 +1402,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${dateUtil.format(${now}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -1237,11 +1237,11 @@ elif SID == "HFO":
# San Juan OCONUS
elif SID == "SJU":
SATDATA = [("NESDIS/GOES-13(N)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-13(N)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
SATDATA = [("NESDIS/GOES-14(O)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-14(O)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
# Guam OCONUS
elif SID == "GUM":
@ -1249,16 +1249,16 @@ elif SID == "GUM":
#CONUS sites
else:
SATDATA = [("NESDIS/GOES-11(L)/West CONUS/Imager Visible", "visibleWest"),
("NESDIS/GOES-11(L)/West CONUS/Imager 11 micron IR", "ir11West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 12 micron IR", "ir13West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 3.9 micron IR", "ir39West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporWest"),
("NESDIS/GOES-13(N)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-13(N)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
SATDATA = [("NESDIS/GOES-15(P)/West CONUS/Imager Visible", "visibleWest"),
("NESDIS/GOES-15(P)/West CONUS/Imager 11 micron IR", "ir11West"),
("NESDIS/GOES-15(P)/West CONUS/Imager 12 micron IR", "ir13West"),
("NESDIS/GOES-15(P)/West CONUS/Imager 3.9 micron IR", "ir39West"),
("NESDIS/GOES-15(P)/West CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporWest"),
("NESDIS/GOES-14(O)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-14(O)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-14(O)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
#---------------------------------------------------------------------------
#

View file

@ -867,6 +867,7 @@ public class GFEDao extends DefaultPluginDao {
return timeList;
}
private List<DataTime> executeD2DParmQuery(ParmID id)
throws DataAccessLayerException {
List<DataTime> times = new ArrayList<DataTime>();

View file

@ -22,4 +22,5 @@ Import-Package: com.raytheon.edex.exception,
Require-Bundle: org.jep;bundle-version="1.0.0",
com.raytheon.edex.plugin.text,
com.raytheon.uf.common.site;bundle-version="1.12.1174",
org.springframework;bundle-version="2.5.6"
org.springframework;bundle-version="2.5.6",
com.raytheon.uf.edex.database

View file

@ -155,12 +155,12 @@ public class ModifyProduct {
TransProdHeader header) throws DataAccessLayerException {
boolean changed = false;
String productBBB = header.getBbb();
String[] splitLines = product.getProductText().split("\n");
String newBBB = TransmittedProductList.getBBB(header.getProductId(),
String[] splitLines = product.getProductText().split("\n", 2);
String bbbToUse = TransmittedProductList.getBBB(header.getProductId(),
header.getWmoId(), header.getProductTime(), header.getBbb());
if (!productBBB.equals(newBBB)) {
productBBB = newBBB;
if (!productBBB.equals(bbbToUse)) {
productBBB = bbbToUse;
}
if (productBBB != null) {
@ -168,9 +168,13 @@ public class ModifyProduct {
if (!splitLines[0].endsWith(" " + productBBB)) {
splitLines[0] += " " + productBBB;
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String line : splitLines) {
if (first)
first = false;
else
sb.append("\n");
sb.append(line);
sb.append("\n");
}
product.setProductText(sb.toString());
changed = true;
@ -182,8 +186,7 @@ public class ModifyProduct {
return changed;
}
public static String convertNewline2rrn(String textString)
throws OUPHeaderException {
public static String convertNewline2rrn(String textString) {
StringBuffer newString = new StringBuffer();
// Don't do any change if string doesn't contain any newline

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.edex.dissemination.transmitted.TransmittedProductList;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 22, 2009 njensen Initial creation
* Oct 12, 2012 DR 15418 D. Friedman Use clustered TransmittedProductList
*
* </pre>
*
@ -105,12 +106,9 @@ public class OUPHandler implements IRequestHandler<OUPRequest> {
py.dispose();
}
}
boolean success = resp.isSendLocalSuccess();
if (success) {
TransmittedProductList.addProduct(header.getProductId(),
header.getWmoId(), header.getProductTime(),
header.getBbb());
}
/* TODO: Should be updating TransmittedProductList here, after
* success has been confirmed.
*/
} catch (OUPHeaderException e) {
resp.setAttempted(false);
resp.setMessage("Product not sent, error encountered with header.\n"

View file

@ -19,13 +19,13 @@
**/
package com.raytheon.uf.edex.dissemination.transmitted;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.dissemination.StatusConstants;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.cluster.handler.CurrentTimeClusterLockHandler;
/**
* TODO Add Description
@ -37,6 +37,7 @@ import com.raytheon.uf.edex.dissemination.StatusConstants;
* ------------ ---------- ----------- --------------------------
* Nov 10, 2009 njensen Initial creation
* 08/20/2012 DR 15340 D. Friedman Fix BBB problems
* 10/12/2012 DR 15418 D. Friedman Make BBB determination cluster-aware
*
* </pre>
*
@ -47,89 +48,141 @@ import com.raytheon.uf.edex.dissemination.StatusConstants;
public class TransmittedProductList {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(TransmittedProductList.class);
private static List<TransProdHeader> transmittedProdList = new ArrayList<TransProdHeader>();
private static final String LOCK_NAME = "OUP-TransProdList";
/** Represents a BBB field that is set to an empty value (as opposed to
* an "unknown" or "not set" state.
*/
private static final String EMPTY_BBB_VAL = "-";
private static final long CLUSTER_LOCK_TIMEOUT = 15 * 1000;
public static String getBBB(String productId, String wmoId,
String productTime, String productBBB) {
// If the user has assigned a value to the BBB field, just pass the
// product
// through without incrementing the BBB value.
/* If the user has assigned a value to the BBB field, just pass the
* product through without incrementing the BBB value. If that
* assigned value is RRx, still need to need to update the
* cluster-shared header list.
*/
boolean getNextBBB = true;
if (productBBB.length() == 3) {
String left2 = productBBB.substring(0, 2);
if (left2.equals("AA") || left2.equals("CC") || left2.equals("RR"))
if (left2.equals("RR"))
getNextBBB = false;
else if (left2.equals("AA") || left2.equals("CC"))
return productBBB;
}
// Search the list for a match with the specified product header.
synchronized (transmittedProdList) {
for (TransProdHeader tph : transmittedProdList) {
if (tph.matches(productId, wmoId)
&& productTime.equals(tph.getProductTime())) {
statusHandler.handle(Priority.VERBOSE,
"Product match found in Transmitted Product List");
// Assign the correct BBB.
String newBBB = assignBBB(productBBB, tph.getBbb());
return newBBB;
}
String lockName = LOCK_NAME;
CurrentTimeClusterLockHandler lockHandler = null;
lockHandler = new CurrentTimeClusterLockHandler(CLUSTER_LOCK_TIMEOUT,
false);
ClusterTask ct = ClusterLockUtils.lock(lockName,
wmoId, lockHandler, true);
if (! ct.getLockState().equals(LockState.SUCCESSFUL))
statusHandler.handle(Priority.ERROR,
String.format("Unable to get cluster lock for %s %s. Proceeding without it.",
wmoId, productId));
try {
TphInfo info = parse(ct.getExtraInfo());
String result;
if (getNextBBB) {
String tplBBB = info.getBBBForTime(productTime);
String bbbToUse = getNextBBB(productBBB, tplBBB);
info.setBBBForTime(productTime, isSet(bbbToUse) ? bbbToUse : EMPTY_BBB_VAL);
statusHandler.handle(isSet(bbbToUse) ? Priority.INFO : Priority.VERBOSE,
String.format("For %s %s DDHHMM=%s,BBB=%s,tplBBB=%s, use BBB=%s",
wmoId, productId, productTime, productBBB, tplBBB, bbbToUse));
// Current protocol is to return null for empty case
result = isSet(bbbToUse) ? bbbToUse : null;
} else {
statusHandler.handle(Priority.INFO,
String.format("Product %s %s DDHHMM=%s explicity requested BBB=%s",
wmoId, productId, productTime, productBBB));
info.setBBBForTime(productTime, productBBB);
result = productBBB;
}
lockHandler.setExtraInfo(info.format());
return result;
} finally {
if (ct.getLockState().equals(LockState.SUCCESSFUL))
ClusterLockUtils.unlock(ct, false);
}
// If there's no entry in the list for this product, return null. This
// will
// be the first product issued, and should have an empty BBB field.
statusHandler.handle(Priority.VERBOSE,
"Product header not found in Transmitted Product list.");
return null;
}
private static String assignBBB(String productBBB, String transmittedBBB) {
if (transmittedBBB == null || transmittedBBB.length() == 0)
private static String getNextBBB(String productBBB, String transmittedBBB) {
if (! isSet(transmittedBBB))
return "";
else if (EMPTY_BBB_VAL.equals(transmittedBBB))
return "RRA";
String newBBB = null;
char[] newX = new char[] { transmittedBBB.charAt(2) };
if (newX[0] == 'X') {
newX[0] = 'A';
char newX = transmittedBBB.charAt(2);
if (newX == 'X') {
newX = 'A';
} else {
newX[0]++;
newX++;
}
newBBB = transmittedBBB.substring(0, 2) + new String(newX);
return newBBB;
return transmittedBBB.substring(0, 2) + Character.toString(newX);
}
public static void addProduct(String productId, String wmoId,
String productTime, String productBBB) {
// Don't save products with CCX or AAX in the BBB field. These are not
// currently being tracked.
if (productBBB.length() == 3) {
String left2 = productBBB.substring(0, 2);
if (left2.equals("AA") || left2.equals("CC"))
return;
public static boolean isSet(String s) {
return s != null && s.length() > 0;
}
/** Manages the storage of transmitted product header state in the
* cluster lock table. Currently only supports tracking state for
* one minute at a time (like AWIPS I.)
*/
private static class TphInfo {
private String time;
private String bbb;
public String format() {
if (isSet(time))
return String.format("%s:%s", time, isSet(bbb) ? bbb : "");
else
return "";
}
// Create a TransProdHeader object to put in the list
TransProdHeader prodHeader = new TransProdHeader(productId, wmoId,
productTime, productBBB);
public void setBBBForTime(String productTime, String bbbToUse) {
time = productTime;
bbb = isSet(bbbToUse) ? bbbToUse : null;
}
// See if this product is already in the list.
synchronized (transmittedProdList) {
for (int i = 0; i < transmittedProdList.size(); i++) {
if (transmittedProdList.get(i).matches(productId, wmoId)) {
statusHandler.handle(Priority.VERBOSE,
"Replacing product " + productId
+ " in Transmitted Product List");
transmittedProdList.remove(i);
transmittedProdList.add(prodHeader);
return;
}
public String getBBBForTime(String productTime) {
if (productTime != null && productTime.equals(time))
return isSet(bbb) ? bbb : null;
else
return null;
}
}
public static TphInfo parse(String input) {
TphInfo inf = new TphInfo();
if (input != null) {
String[] parts = input.split(":");
if (parts.length == 2) {
inf.time = parts[0]; // Only compared via String.equals; no need to validate further
if (validateBBB(parts[1]))
inf.bbb = parts[1];
}
statusHandler.handle(Priority.VERBOSE,
"Adding new product " + productId
+ " to Transmitted Product List");
transmittedProdList.add(prodHeader);
}
return inf;
}
private static boolean validateBBB(String bbb) {
if (EMPTY_BBB_VAL.equals(bbb))
return true;
else if (bbb.length() == 3) {
int i;
for (i = 0; i < bbb.length(); ++i)
if (bbb.charAt(i) < 'A' || bbb.charAt(i) > 'Z')
break;
if (i == bbb.length())
return true;
}
statusHandler.handle(Priority.ERROR,
String.format("Invalid BBB in cluster lock info: \"%s\"", bbb));
return false;
}
}

View file

@ -32,7 +32,8 @@
# 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
# 08/17/12 DR 15304 D. Friedman Use unique output file names
# 10/12/12 DR 15418 D. Friedman Use unique attachment file names
#
#
@ -159,7 +160,7 @@ def process(oup, afosID, resp, ackMgr = None):
attachedFilename = attachedFilename.replace(" ", "")
# dealing with a java byte[] so write it out with java
from java.io import File, FileOutputStream
attachedFilename = OUT_DIR + '/' + attachedFilename
attachedFilename = createTargetFile("", OUT_DIR + '/' + attachedFilename)
f = File(attachedFilename)
fos = FileOutputStream(f)
fos.write(attachedFile)

View file

@ -101,7 +101,7 @@ if fileName == "spotters.dat":
shutil.copy(file, workFile)
os.system("sed -i -e 's/spotterName/spottersName/g' /tmp/spotters.dat")
os.system("sed -i -e 's/spotterAddr/spottersAddr/g' /tmp/spotters.dat")
os.system("sed -i -e 's/spotterAddr/spottersAddress/g' /tmp/spotters.dat")
os.system("sed -i -e 's/spotterCity/spottersCity/g' /tmp/spotters.dat")
os.system("sed -i -e 's/spotterPhone/spottersPhone/g' /tmp/spotters.dat")
file = workFile

View file

@ -61,7 +61,7 @@ def getConnectionParams():
return ConfigFileUtil.parseKeyValueFile("/awips2/GFESuite/ServiceBackup/configuration/svcbu.properties")
def createRequest():
obj = ProcessReceivedConfRequest.ProcessReceivedConfRequest()
obj = ProcessReceivedConfRequest()
wsId = WsId(progName="receive_configuration")
@ -72,4 +72,4 @@ def createRequest():
if __name__ == '__main__':
main()

View file

@ -62,7 +62,7 @@ def getConnectionParams():
def createRequest():
print sys.argv
obj = ProcessReceivedDigitalDataRequest.ProcessReceivedDigitalDataRequest()
obj = ProcessReceivedDigitalDataRequest()
wsId = WsId(progName="receive_grids")
@ -73,4 +73,4 @@ def createRequest():
if __name__ == '__main__':
main()

View file

@ -325,6 +325,7 @@ if [ "${1}" = "-ade" ]; then
fi
if [ "${1}" = "-viz" ]; then
buildRPM "awips2"
buildCAVE
if [ $? -ne 0 ]; then
exit 1