12.5.1-15 baseline

Former-commit-id: 1c128372ef9f478f1b807e8d0f23207d095bfc65
This commit is contained in:
Steve Harris 2012-06-11 16:02:30 -05:00
parent 8f3c9ebfb7
commit d5c238de07
19 changed files with 2030 additions and 1904 deletions

72
TextDao.java Normal file
View file

@ -0,0 +1,72 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.text.dao;
import java.util.Calendar;
import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.database.purge.PurgeLogger;
/**
* DAO for text products
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 10, 2009 2191 rjpeter Update retention time handling.
* Aug 18, 2009 2191 rjpeter Changed to version purging.
* </pre>
*
* @author
* @version 1
*/
public class TextDao extends DefaultPluginDao {
public TextDao(String pluginName) throws PluginException {
super(pluginName);
}
@Override
public void purgeAllData() {
logger.warn("purgeAllPluginData not implemented for text. No data will be purged.");
}
protected void loadScripts() throws PluginException {
// no op
}
public void purgeExpiredData() throws PluginException {
int deletedRecords = 0;
// only do full purge every few hours since incremental purge runs every
// minute
if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 3 == 0) {
TextDB.purgeStdTextProducts();
}
PurgeLogger.logInfo("Purged " + deletedRecords + " items total.",
"text");
}
}

View file

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.alertviz;
import java.io.PrintStream;
import java.io.StringWriter;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.jms.ExceptionListener;
@ -88,7 +89,11 @@ public class AlertVizClient implements MessageListener {
private CopyOnWriteArrayList<IAlertVizMessageCallback> listeners;
private Marshaller marshaller;
private static int POOL_SIZE = 5;
private java.util.Queue<Marshaller> marshallers = new ConcurrentLinkedQueue<Marshaller>();
private JAXBContext jaxbContext;
private static AlertVizClient instance;
@ -134,8 +139,7 @@ public class AlertVizClient implements MessageListener {
this.consumer.setMessageListener(this);
reconnect = false;
lastReconnectTime = System.currentTimeMillis();
JAXBContext context = JAXBContext.newInstance(StatusMessage.class);
marshaller = context.createMarshaller();
jaxbContext = JAXBContext.newInstance(StatusMessage.class);
} catch (JMSException e) {
reconnect = true;
throw new AlertvizException("Unable to connect to notification", e);
@ -158,8 +162,11 @@ public class AlertVizClient implements MessageListener {
if (retryOnExceptions == false && reconnect == true) {
printToConsole(statusMessage);
} else {
Marshaller marshaller = null;
try {
StringWriter sw = new StringWriter();
marshaller = getMarshaller();
marshaller.marshal(statusMessage, sw);
ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setText(sw.toString());
@ -178,8 +185,20 @@ public class AlertVizClient implements MessageListener {
} catch (Exception e) {
throw new AlertvizException("Error sending message", e);
}
if (marshaller != null && marshallers.size() < POOL_SIZE) {
marshallers.add(marshaller);
}
}
}
private Marshaller getMarshaller() throws JAXBException {
Marshaller m = marshallers.poll();
if (m == null) {
m = jaxbContext.createMarshaller();
}
return m;
}
/**
* @param statusMessage

View file

@ -188,38 +188,41 @@ public class Container implements IConfigurationChangedListener {
private boolean isShotGun(StatusMessage message) {
boolean retVal = false;
if (lastMessage != null) {
final long shotgunMessageCheckTime = this.shotgunMessageStartTime == 0 ? this.lastMessage
.getEventTime().getTime() : this.shotgunMessageStartTime;
if (this.lastMessage.getCategory().equals(message.getCategory())
&& this.lastMessage.getPriority() == message.getPriority()
&& this.lastMessage.getMessage().equals(
message.getMessage())
&& Math.abs(this.lastMessage.getEventTime().getTime()
- message.getEventTime().getTime()) < SHOTGUN_MESSAGE_MILLISECOND_THRESHOLD) {
&& (Math.abs(message.getEventTime().getTime()
- shotgunMessageCheckTime) < SHOTGUN_MESSAGE_MILLISECOND_THRESHOLD)) {
retVal = true;
++this.shotgunMessageCount;
if (this.shotgunMessageStartTime == 0) {
this.shotgunMessageStartTime = message.getEventTime()
this.shotgunMessageStartTime = lastMessage.getEventTime()
.getTime();
}
} else {
if (this.shotgunMessageCount != 0) {
if (this.shotgunMessageCount > 1) {
StringBuilder sb = new StringBuilder("Received ")
.append(this.shotgunMessageCount)
.append(" duplicate messages in ")
.append(message.getEventTime().getTime()
.append(this.lastMessage.getEventTime().getTime()
- this.shotgunMessageStartTime)
.append(" milliseconds. For message: ")
.append(this.lastMessage.getCategory()).append(":")
.append(this.lastMessage.getSourceKey())
.append(" ").append(this.lastMessage.getMessage());
this.shotgunMessageStartTime = 0;
this.shotgunMessageCount = 0;
StatusMessage sm = new StatusMessage(
this.lastMessage.getSourceKey(), "GDN_ADMIN",
this.lastMessage.getPriority(),
this.lastMessage.getPlugin(), sb.toString(), null);
sm.setEventTime(SimulatedTime.getSystemTime().getTime());
messageReceived(sm);
logInternal(sm);
}
this.shotgunMessageStartTime = 0;
this.shotgunMessageCount = 1;
}
}

View file

@ -86,6 +86,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 06/28/2010 4639 cjeanbap Allow user to create a new text product.
*
* 01/26/2012 14468 D.Friedman Fix initial BBB field selection.
* 05/30/2012 15046 D.Friedman Always set addressee field to ALL.
* </pre>
*
* @author lvenable
@ -448,7 +449,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
addresseeTF.setTextLimit(4);
addresseeTF.setLayoutData(rd);
// Set the "default" addressee to "ALL".
addresseeTF.setText(parentEditor.getAddressee());
addresseeTF.setText("ALL");
// When the number of characters enter reaches the max limit and
// the caret position is at the end then switch focus to the next
@ -460,15 +461,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
wmoTtaaiiTF.setFocus();
}
// If the user changes the text in the addressee text field
// then "untoggle" the toggle buttons.
if (addresseeTF.getText().compareTo("000") != 0
&& addresseeTF.getText().compareTo("DEF") != 0
&& addresseeTF.getText().compareTo("ALL") != 0) {
zerosBtn.setSelection(false);
defBtn.setSelection(false);
allBtn.setSelection(false);
}
handleAddresseeModified();
}
});
@ -518,6 +511,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
addresseeTF.setText("ALL");
}
});
handleAddresseeModified();
Label sepLbl = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
sepLbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -945,4 +939,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
});
}
private void handleAddresseeModified() {
// If the user changes the text in the addressee text field
// then update the toggle buttons.
String addressee = addresseeTF.getText();
if (zerosBtn != null)
zerosBtn.setSelection("000".equals(addressee));
if (defBtn != null)
defBtn.setSelection("DEF".equals(addressee));
if (allBtn != null)
allBtn.setSelection("ALL".equals(addressee));
}
}

View file

@ -1734,13 +1734,19 @@ public class WarngenLayer extends AbstractStormTrackResource {
Matcher m = tmlPtrn.matcher(rawMessage);
if (m.find()) {
int day = warnRecord.getIssueTime().get(Calendar.DAY_OF_MONTH);
int hour = Integer.parseInt(m.group(1));
int minute = Integer.parseInt(m.group(2));
Calendar issueTime = warnRecord.getIssueTime();
int day = issueTime.get(Calendar.DAY_OF_MONTH);
int tmlHour = Integer.parseInt(m.group(1));
// This is for the case when the warning text was created,
// but actually issued the next day.
if (tmlHour > issueTime.get(Calendar.HOUR_OF_DAY)) {
day--;
}
int tmlMinute = Integer.parseInt(m.group(2));
frameTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
frameTime.set(Calendar.DAY_OF_MONTH, day);
frameTime.set(Calendar.HOUR_OF_DAY, hour);
frameTime.set(Calendar.MINUTE, minute);
frameTime.set(Calendar.HOUR_OF_DAY, tmlHour);
frameTime.set(Calendar.MINUTE, tmlMinute);
} else {
frameTime = warnRecord.getIssueTime();
}

0
deltaScripts/12.5.1/drop_gfe_tables.sh Normal file → Executable file
View file

View file

@ -43,6 +43,7 @@
#if(${action}!="CANCON")
${WMOId} ${vtecOffice} 000000 ${BBBId}
MWS${siteId}
#if(${productClass}=="T")
TEST...MARINE WEATHER STATEMENT...TEST
#else
@ -478,6 +479,7 @@ REPORT SEVERE WEATHER TO THE COAST GUARD OR NEAREST LAW ENFORCEMENT AGENCY. THEY
#if(${action}=="CANCON")
${WMOId} ${vtecOffice} 000000 ${BBBId}
MWS${siteId}
#if(${productClass}=="T")
TEST...MARINE WEATHER STATEMENT...TEST
#else

View file

@ -450,7 +450,7 @@ public class LockManager {
for (int i = 0; i < locks.size() - 1; i++) {
currentLock = locks.get(i);
nextLock = locks.get(i + 1);
if (currentLock.getEndTime() >= nextLock.getStartTime()) {
if (currentLock.getEndTime() >= nextLock.getStartTime() && currentLock.getWsId().equals(nextLock.getWsId())) {
lockCombined = true;
deleted.add(currentLock);
deleted.add(nextLock);

View file

@ -517,7 +517,7 @@ public class GribSpatialCache {
GridCoverage gridCoverage = getGrid(referenceModel);
if (gridCoverage == null) {
if (gridCoverage != null) {
Coordinate wfoCenter = MapUtil
.latLonToGridCoordinate(wfoCenterPoint,
PixelOrientation.CENTER,

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.edex.plugin.text.dao;
import java.util.Calendar;
import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.PluginException;
@ -56,7 +58,14 @@ public class TextDao extends DefaultPluginDao {
}
public void purgeExpiredData() throws PluginException {
int deletedRecords = TextDB.purgeStdTextProducts();
int deletedRecords = 0;
// only do full purge every few hours since incremental purge runs every
// minute
if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 3 == 0) {
TextDB.purgeStdTextProducts();
}
PurgeLogger.logInfo("Purged " + deletedRecords + " items total.",
"text");
}

View file

@ -230,8 +230,6 @@ public class PurgeDao extends CoreDao {
sess.save(queryResult);
}
// any changes to PurgeJobStatus will be commited at end of
// transaction
if (queryResult.isRunning()) {
// query was previously running, update failed count
queryResult.incrementFailedCount();
@ -240,7 +238,7 @@ public class PurgeDao extends CoreDao {
queryResult.setStartTime(Calendar.getInstance(
TimeZone.getTimeZone("GMT")).getTime());
queryResult.setRunning(true);
sess.update(queryResult);
return queryResult;
}
});

View file

@ -163,9 +163,12 @@ public class PurgeJob extends Thread {
PurgeLogger.logError("Purge job has failed "
+ status.getFailedCount()
+ " consecutive times.", this.pluginName);
// Reset the start time so we can try again as soon
// as possible
status.setStartTime(new Date(0));
// Back the start time off by half an hour to try to
// purgin soon, don't want to start immediately so
// it doesn't ping pong between servers in a time
// out scenario
Date startTime = status.getStartTime();
startTime.setTime(startTime.getTime() - (1800000));
}
} else {
status.setFailedCount(0);

View file

@ -174,6 +174,7 @@ public class PurgeManager {
iter.remove();
}
}
Calendar purgeTimeOutLimit = Calendar.getInstance();
purgeTimeOutLimit.setTimeZone(TimeZone.getTimeZone("GMT"));
purgeTimeOutLimit.add(Calendar.MINUTE, -deadPurgeJobAge);
@ -218,7 +219,7 @@ public class PurgeManager {
PurgeJobStatus job = dao.getJobForPlugin(plugin);
if (job == null) {
// no job on server, generate empty job
// no job in database, generate empty job
try {
job = new PurgeJobStatus();
@ -245,28 +246,35 @@ public class PurgeManager {
plugin);
}
if (job.isRunning()) {
// check if job has timed out
if (purgeTimeOutLimit.getTimeInMillis() > job
.getStartTime().getTime()) {
// if no one else sets canPurge = false will start
// purging on this server
// is purge job currently running on this server
if (jobThread != null) {
// job currently running on our server, don't
// start another
// job currently running on our server, don't start
// another
canPurge = false;
if (purgeTimeOutLimit.getTimeInMillis() > jobThread
.getStartTime()) {
jobThread.printTimedOutMessage(deadPurgeJobAge);
}
} else {
if (job.isRunning()) {
// check if job has timed out
if (purgeTimeOutLimit.getTime().before(
job.getStartTime())) {
canPurge = false;
}
// else if no one else sets canPurge = false will
// start purging on this server
} else {
// not currently running, check if need to be purged
Date startTime = job.getStartTime();
if (startTime != null
&& startTime.getTime() >= purgeFrequencyLimit
.getTimeInMillis()) {
&& startTime.after(purgeFrequencyLimit
.getTime())) {
canPurge = false;
}
}
}
if (canPurge) {
purgeJobs.put(plugin, purgeExpiredData(plugin));

0
rpms/awips2.edex/deploy.builder/build.sh Executable file → Normal file
View file