Merge branch 'master_14.3.1' into asm_14.3.1

Former-commit-id: a4bfbea3c2 [formerly 0be927be2d [formerly 5ed17c0e24] [formerly a4bfbea3c2 [formerly 622e63224b6d6bf1d6ced874658bbd9db381799b]]]
Former-commit-id: 0be927be2d [formerly 5ed17c0e24]
Former-commit-id: 0be927be2d
Former-commit-id: 64529eea01
This commit is contained in:
Brian.Dyke 2014-10-01 15:36:06 -04:00
commit efd1497e54
20 changed files with 399 additions and 363 deletions

View file

@ -108,7 +108,9 @@ import com.vividsolutions.jts.geom.LineString;
* and generateExistingTrackInfo()
* 08-21-2014 DR 15700 Qinglu Lin handle the situation where frameTime is null in paintTrack().
* 09-09-2014 RM #657 Qinglu Lin handle StormTrackState.trackType is null.
*
* 09-25-2014 ASM #16773 D. Friedman Fix NPE.
*
>>>>>>> master_14.2.4
* </pre>
*
* @author mschenke
@ -1319,6 +1321,11 @@ public class StormTrackDisplay implements IRenderable {
private void paintLabels(IGraphicsTarget target,
StormTrackProperties paintProps) throws VizException {
StormTrackState state = paintProps.getState();
if (state.timePoints == null || state.futurePoints == null) {
return;
}
// get the magnification from the state
float magnification = state.magnification;
// find a nice looking radius

View file

@ -120,6 +120,8 @@ import com.raytheon.viz.gfe.core.parm.Parm;
* 11/20/2013 #2331 randerso Added getTopoData method
* 04/03/2014 #2737 randerso Moved clientISCSendStatus to SaveGFEGridRequest
* 04/09/2014 #3004 dgilling Support moved ClearPracticeVTECTableRequest.
* 09/23/14 #3648 randerso Changed getParmList to return results even if some DbIds
* have errors
*
* </pre>
*
@ -192,8 +194,20 @@ public class IFPClient {
throws GFEServerException {
GetParmListRequest request = new GetParmListRequest();
request.setDbIds(ids);
ServerResponse<?> sr = makeRequest(request);
return (List<ParmID>) sr.getPayload();
ServerResponse<?> sr = makeRequest(request, false);
List<ParmID> parmIds = (List<ParmID>) sr.getPayload();
if (!sr.isOkay()) {
String msg = formatSRMessage(sr);
if (parmIds != null && !parmIds.isEmpty()) {
// got something so display an error message and continue
statusHandler.error(msg);
} else {
// got nothing so throw exception
throw new GFEServerException(msg);
}
}
return parmIds;
}
/**
@ -731,27 +745,33 @@ public class IFPClient {
if ((throwExceptionsBasedOnResponse) && (rval != null)
&& (!rval.isOkay())) {
StringBuilder msg = new StringBuilder();
if (rval.getMessages().size() > 1) {
msg.append("Errors ");
} else {
msg.append("Error ");
}
msg.append("occurred on GFE server -");
Iterator<ServerMsg> iter = rval.getMessages().iterator();
while (iter.hasNext()) {
msg.append(iter.next().getMessage());
if (iter.hasNext()) {
msg.append(", ");
}
}
throw new GFEServerException(msg.toString());
String msg = formatSRMessage(rval);
throw new GFEServerException(msg);
}
return rval;
}
private String formatSRMessage(ServerResponse<?> rval) {
StringBuilder sb = new StringBuilder();
if (rval.getMessages().size() > 1) {
sb.append("Errors ");
} else {
sb.append("Error ");
}
sb.append("occurred on GFE server: ");
Iterator<ServerMsg> iter = rval.getMessages().iterator();
while (iter.hasNext()) {
sb.append(iter.next().getMessage());
if (iter.hasNext()) {
sb.append(", ");
}
}
String msg = sb.toString();
return msg;
}
public void clearPracticeTable(String siteId) throws VizException {
try {
ClearPracticeVTECTableRequest request = new ClearPracticeVTECTableRequest(

View file

@ -390,7 +390,6 @@
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="850MB-700MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="925MB-700MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="925MB-850MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-400MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-500MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-700MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-850MB" indentText="false"/>

View file

@ -34,6 +34,7 @@ import java.util.List;
* ------------ ---------- ----------- --------------------------
* Jul 16, 2014 3419 jsanchez Initial creation
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zone list.
* Sep 25, 2014 ASM #16783 D. Friedman Remove action field.
*
* </pre>
*
@ -45,8 +46,6 @@ public class Watch {
private String phenSig;
private String action;
private String etn;
private Date startTime;
@ -59,12 +58,11 @@ public class Watch {
private List<String> partOfState;
private List<String> marineAreas;
private String marineArea;
public Watch(String state, String action, String phenSig, String etn,
public Watch(String state, String phenSig, String etn,
Date startTime, Date endTime) {
this.state = state;
this.action = action;
this.phenSig = phenSig;
this.etn = etn;
this.startTime = startTime;
@ -119,14 +117,6 @@ public class Watch {
this.partOfState = partOfState;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getEtn() {
return etn;
}
@ -135,19 +125,18 @@ public class Watch {
this.etn = etn;
}
public List<String> getMarineAreas() {
return marineAreas;
public String getMarineArea() {
return marineArea;
}
public void setMarineAreas(List<String> marineAreas) {
this.marineAreas = marineAreas;
public void setMarineArea(String marineArea) {
this.marineArea = marineArea;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
result = prime * result + ((etn == null) ? 0 : etn.hashCode());
result = prime * result + ((phenSig == null) ? 0 : phenSig.hashCode());
@ -166,11 +155,6 @@ public class Watch {
if (getClass() != obj.getClass())
return false;
Watch other = (Watch) obj;
if (action == null) {
if (other.action != null)
return false;
} else if (!action.equals(other.action))
return false;
if (endTime == null) {
if (other.endTime != null)
return false;

View file

@ -28,6 +28,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -78,9 +79,12 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zones.
* Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord
* with act of CAN and EXP in processRecords().
* Sep 12, 2014 ASM #15551 Qinglu Lin Prevent a county's WOU from being used while its
* corresponding WCN is canceled or expired.
*
* Sep 25, 2014 ASM #15551 Qinglu Lin Prevent a county's WOU from being used while its
* corresponding WCN is canceled or expired, prevent NEW
* from being used while CON/EXT is issued, and prevent duplicate
* /missing (part of state, state abbreviation) which resulted from
* extension of a watch to counties which are of same/different fe_area.
* Sep 25, 2014 ASM #16783 D. Friedman Do not use VTEC action to determine Watch uniqueness.
* </pre>
*
* @author jsanchez
@ -365,6 +369,16 @@ public class WatchUtil {
}
}
Collections.sort(records, PEUI);
// Filters out extra ActiveTableRecords that have same phenSig, etn, and ugcZone.
Map<String, ActiveTableRecord> atrMap = new LinkedHashMap<String, ActiveTableRecord>();
for (ActiveTableRecord atr: records) {
String key = atr.getPhensig() + atr.getEtn() + atr.getUgcZone();
atrMap.put(key, atr);
}
records = new ArrayList<ActiveTableRecord>(atrMap.values());
return records;
}
@ -414,14 +428,13 @@ public class WatchUtil {
}
}
String action = ar.getAct();
String phenSig = ar.getPhensig();
String etn = ar.getEtn();
Date startTime = ar.getStartTime().getTime();
Date endTime = ar.getEndTime().getTime();
if (validUgcZones.contains(ugcZone)) {
Watch watch = new Watch(state, action, phenSig, etn, startTime,
Watch watch = new Watch(state, phenSig, etn, startTime,
endTime);
List<String> areas = map.get(watch);
if (areas == null) {
@ -440,19 +453,35 @@ public class WatchUtil {
List<String> partOfState = new ArrayList<String>(
determineAffectedPortions(watch.getAreas()));
watch.setPartOfState(partOfState);
watches.add(watch);
} else {
watch.setMarineAreas(determineMarineAreas(watch.getAreas()));
watches.addAll(generateMarineWatchItems(watch,
determineMarineAreas(watch.getAreas())));
}
watches.add(watch);
}
// keep the code for their use in the future
/*
// Sorts the watches based on state name.
/* Sorts the watches based on ETN, then state. Marine areas
* have a null state value so they appear at the end of each
* watch.
*/
Collections.sort(watches, new Comparator<Watch>() {
@Override
public int compare(Watch watch1, Watch watch2) {
String etn1 = watch1.getEtn();
String etn2 = watch2.getEtn();
int c;
if (etn1 == etn2)
c = 0;
else if (etn1 == null)
return 1;
else if (etn2 == null)
return -1;
else
c = etn1.compareTo(etn2);
if (c != 0)
return c;
String state1 = watch1.getState();
String state2 = watch2.getState();
if (state1 == state2)
@ -465,25 +494,23 @@ public class WatchUtil {
return state1.compareTo(state2);
}
});
*/
// Sorts the watches based on ETN.
Collections.sort(watches, new Comparator<Watch>() {
@Override
public int compare(Watch watch1, Watch watch2) {
String etn1 = watch1.getEtn();
String etn2 = watch2.getEtn();
if (etn1 == etn2)
return 0;
else if (etn1 == null)
return 1;
else if (etn2 == null)
return -1;
else
return etn1.compareTo(etn2);
// Filters out extra Watches that have different startTime but same phenSig, etn, state, partOfState, endTime, and marineArea.
Map<String, Watch> watchMap = new LinkedHashMap<String, Watch>();
for (Watch w: watches) {
List<String> pos = w.getPartOfState() != null ?
new ArrayList<String>(w.getPartOfState()) : null;
if (pos != null)
Collections.sort(pos);
String key = String.valueOf(w.getPhenSig())
+ String.valueOf(w.getEtn()) + String.valueOf(w.getState())
+ String.valueOf(pos) + String.valueOf(w.getEndTime());
if (w.getMarineArea() != null) {
key = key + '.' + w.getMarineArea();
}
});
watchMap.put(key, w);
}
watches = new ArrayList<Watch>(watchMap.values());
return watches;
}
@ -513,6 +540,18 @@ public class WatchUtil {
return affectedPortions;
}
private List<Watch> generateMarineWatchItems(Watch template, List<String> areas) {
ArrayList<Watch> result = new ArrayList<Watch>();
for (String area: areas) {
Watch watch = new Watch(template.getState(), template.getPhenSig(),
template.getEtn(), template.getStartTime(),
template.getEndTime());
watch.setMarineArea(area);
result.add(watch);
}
return result;
}
private List<String> determineMarineAreas(List<String> areas) {
HashSet<Pair<Integer, String>> groupedAreas = new HashSet<Pair<Integer,String>>();
for (String area : areas) {
@ -529,6 +568,7 @@ public class WatchUtil {
groupedAreas.add(new Pair<Integer, String>(entryIndex,
getMarineZoneName(area)));
}
break;
}
entryIndex++;
}
@ -698,4 +738,22 @@ public class WatchUtil {
return abrev;
}
// ActiveTableRecord: phenSig, etn, ugcZone, issueTime
public static final Comparator<ActiveTableRecord> PEUI = new Comparator<ActiveTableRecord>() {
@Override
public int compare(ActiveTableRecord o1, ActiveTableRecord o2) {
int i = o1.getPhensig().compareTo(o2.getPhensig());
if (i == 0) {
i = o1.getEtn().compareTo(o2.getEtn());
if (i == 0) {
i = o1.getUgcZone().compareTo(o2.getUgcZone());
if (i == 0) {
i = o1.getIssueTime().compareTo(o2.getIssueTime());
}
}
}
return i;
}
};
}

View file

@ -103,6 +103,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 08/05/13 #1571 randerso Added support for storing GridLocation and ParmStorageInfo in database
* 09/30/2013 #2147 rferrel Changes to archive hdf5 files.
* 10/15/2013 #2446 randerso Added ORDER BY clause to getOverlappingTimes
* 09/21/2014 #3648 randerso Changed to do version purging when new databases are added
*
* </pre>
*
@ -482,7 +483,6 @@ public class GFEDao extends DefaultPluginDao {
try {
GridParmManager gridParmMgr = ifpServer.getGridParmMgr();
gridParmMgr.versionPurge();
gridParmMgr.gridsPurge(gridNotifcations, lockNotifications);
PurgeLogger.logInfo(
"Purging Expired pending isc send requests...", "gfe");
@ -1063,9 +1063,38 @@ public class GFEDao extends DefaultPluginDao {
* Remove all GFE records for a particular DatabaseID
*
* @param dbId
* database to be purged
* @return true if database was removed, false if not found (already
* removed)
*/
public void purgeGFEGrids(final DatabaseID dbId) {
delete(dbId);
public boolean purgeGFEGrids(final DatabaseID dbId) {
Session sess = null;
boolean purged = false;
try {
sess = getHibernateTemplate().getSessionFactory().openSession();
Transaction tx = sess.beginTransaction();
Object toDelete = sess.get(DatabaseID.class, dbId.getId(),
LockOptions.UPGRADE);
if (toDelete != null) {
sess.delete(toDelete);
}
tx.commit();
purged = true;
} catch (Exception e) {
statusHandler.error("Error purging " + dbId, e);
} finally {
if (sess != null) {
try {
sess.close();
} catch (Exception e) {
statusHandler.error(
"Error occurred closing database session", e);
}
}
}
return purged;
}
/**

View file

@ -123,6 +123,7 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger;
* created in response to another DBInvChangeNotification so IFPServers stay in synch.
* Cleaned up commented code.
* 07/21/2014 #3415 randerso Fixed d2dGridDataPurged to not purge NetCDF databases.
* 09/21/2014 #3648 randerso Changed to do version purging when new databases are added
* </pre>
*
* @author bphillip
@ -200,7 +201,6 @@ public class GridParmManager {
} else {
statusHandler
.debug("No matching GridDatabase for requested ParmID in createParm()");
// TODO: should we return null?
return new GridParm();
}
}
@ -853,13 +853,23 @@ public class GridParmManager {
ServerResponse<GridDatabase> status = createDB(dbId);
if (status.isOkay()) {
db = status.getPayload();
} else {
statusHandler.error(status.message());
}
}
if (db != null) {
this.addDB(db);
// do version purging
List<DatabaseID> purged = null;
if (!db.getDbId().getModelTime()
.equals(DatabaseID.NO_MODEL_TIME)) {
purged = versionPurge(db.getDbId());
}
if (notify) {
createDbNotification(Arrays.asList(dbId), null);
createDbNotification(Arrays.asList(dbId), purged);
}
}
}
@ -961,83 +971,6 @@ public class GridParmManager {
return sr;
}
/**
* Perform database based on versions
*
* @return ServerResponse containing status only
*/
public ServerResponse<?> versionPurge() {
ServerResponse<List<DatabaseID>> sr = new ServerResponse<List<DatabaseID>>();
sr = getDbInventory();
if (!sr.isOkay()) {
sr.addMessage("VersionPurge failed - couldn't get inventory");
return sr;
}
List<DatabaseID> currentInv = sr.getPayload();
// sort the inventory by site, type, model, time (most recent first)
Collections.sort(currentInv);
// process the inventory looking for "old" unwanted databases
String model = null;
String site = null;
String type = null;
int count = 0;
int desiredVersions = 0;
for (DatabaseID dbId : currentInv) {
// new series?
if (!dbId.getSiteId().equals(site)
|| !dbId.getDbType().equals(type)
|| !dbId.getModelName().equals(model)) {
site = dbId.getSiteId();
type = dbId.getDbType();
model = dbId.getModelName();
count = 0;
// determine desired number of versions
desiredVersions = this.config.desiredDbVersions(dbId);
}
// process the id and determine whether it should be purged
count++;
if ((count > desiredVersions)
&& !dbId.getModelTime().equals(DatabaseID.NO_MODEL_TIME)) {
deallocateDb(dbId, true);
PurgeLogger.logInfo("Purging " + dbId, "gfe");
}
}
List<DatabaseID> newInv = getDbInventory().getPayload();
List<DatabaseID> additions = new ArrayList<DatabaseID>(newInv);
additions.removeAll(currentInv);
List<DatabaseID> deletions = new ArrayList<DatabaseID>(currentInv);
deletions.removeAll(newInv);
// kludge to keep dbMap in synch until GridParmManager/D2DParmICache
// merge/refactor
List<DatabaseID> toRemove = new ArrayList<DatabaseID>(dbMap.keySet());
toRemove.removeAll(newInv);
for (DatabaseID dbId : toRemove) {
if (dbMap.remove(dbId) != null) {
statusHandler
.info("Synching GridParmManager with database inventory, removing "
+ dbId);
}
// add any removals to the deletions list
// so notifications go to the other JVMs
if (!deletions.contains(dbId)) {
deletions.add(dbId);
}
}
createDbNotification(additions, deletions);
return sr;
}
/**
* Purge grids based on time
*
@ -1100,13 +1033,8 @@ public class GridParmManager {
}
private ServerResponse<GridDatabase> createDB(DatabaseID id) {
// TODO: consider merging this into getDatabase()
ServerResponse<GridDatabase> status = new ServerResponse<GridDatabase>();
GridDatabase db = this.dbMap.get(id);
if (db != null) {
status.setPayload(db);
return status;
} // already exists
if (!id.isValid() || !id.getFormat().equals(DataType.GRID)) {
status.addMessage("Database id "
+ id
@ -1115,6 +1043,7 @@ public class GridParmManager {
}
// create the grid database
IFPGridDatabase db = null;
GridDbConfig dbConfig = this.config.gridDbConfig(id);
if (dbConfig == null) {
status.addMessage("Unable to obtain GridDbConfig information for creation"
@ -1137,9 +1066,6 @@ public class GridParmManager {
"Unable to mark database restored: " + dbId, e);
}
}
// add to list of databases
addDB(db);
} else {
status.addMessage("Database " + id + " is not valid.");
db = null;
@ -1190,12 +1116,8 @@ public class GridParmManager {
}
// create the databases (the list should now only contain GRID dbs)
ServerResponse<GridDatabase> sr = new ServerResponse<GridDatabase>();
for (DatabaseID dbId : inventory) {
sr = createDB(dbId);
if (!sr.isOkay()) {
statusHandler.error(sr.message());
}
getDatabase(dbId, false);
}
NetCDFDatabaseManager.initializeNetCDFDatabases(config);
@ -1257,11 +1179,9 @@ public class GridParmManager {
for (Date refTime : D2DGridDatabase.getModelRunTimes(
d2dModelName, desiredVersions)) {
D2DGridDatabase db = D2DGridDatabase.getDatabase(config,
d2dModelName, refTime);
if (db != null) {
addDB(db);
}
dbId = D2DGridDatabase.getDbId(d2dModelName, refTime,
config);
getDatabase(dbId, false);
}
} catch (Exception e) {
statusHandler.error("Error initializing D2D model: "
@ -1276,30 +1196,18 @@ public class GridParmManager {
public void filterGridRecords(List<GridRecord> gridRecords) {
List<GridUpdateNotification> guns = new LinkedList<GridUpdateNotification>();
for (GridRecord record : gridRecords) {
String d2dModelName = record.getDatasetId();
Date refTime = record.getDataTime().getRefTime();
DatabaseID dbId = D2DGridDatabase.getDbId(d2dModelName, refTime,
config);
// not a d2d model we care about
if (dbId == null) {
continue;
}
D2DGridDatabase db = (D2DGridDatabase) this.dbMap.get(dbId);
if (db == null) {
// New database
db = D2DGridDatabase.getDatabase(config, d2dModelName, refTime);
if (db == null) {
continue;
}
addDB(db);
statusHandler.info("filterGridRecords new D2D database: "
+ dbId);
GfeNotification dbInv = new DBInvChangeNotification(
Arrays.asList(dbId), null, siteID);
SendNotifications.send(dbInv);
}
D2DGridDatabase db = (D2DGridDatabase) getDatabase(dbId, true);
GridUpdateNotification gun = db.update(record);
if (gun != null) {
@ -1497,6 +1405,10 @@ public class GridParmManager {
if (notif instanceof DBInvChangeNotification) {
DBInvChangeNotification invChanged = (DBInvChangeNotification) notif;
for (DatabaseID dbId : invChanged.getDeletions()) {
deallocateDb(dbId, false);
}
ServerResponse<GridDatabase> sr = new ServerResponse<GridDatabase>();
for (DatabaseID dbId : invChanged.getAdditions()) {
this.getDatabase(dbId, false);
@ -1505,14 +1417,6 @@ public class GridParmManager {
statusHandler.error("Error updating GridParmManager: "
+ sr.message());
}
for (DatabaseID dbId : invChanged.getDeletions()) {
if (this.dbMap.remove(dbId) != null) {
statusHandler
.info("handleGfeNotification removing database: "
+ dbId);
}
}
} else if (notif instanceof GridUpdateNotification) {
DatabaseID satDbId = D2DSatDatabase.getDbId(siteID);
GridUpdateNotification gun = (GridUpdateNotification) notif;
@ -1573,10 +1477,7 @@ public class GridParmManager {
iter.remove();
} else {
// remove the database
if (this.dbMap.remove(dbid) != null) {
statusHandler.info("d2dGridDataPurged removing database: "
+ dbid);
}
deallocateDb(dbid, false);
}
}
@ -1599,4 +1500,46 @@ public class GridParmManager {
SendNotifications.send(notifs);
}
/**
* Perform database purge based on versions for the given model
*
* @param modelToPurge
* DatabaseID for model to be purged
*
* @return list of purged databases
*/
public List<DatabaseID> versionPurge(DatabaseID modelToPurge) {
int desiredVersions = this.config.desiredDbVersions(modelToPurge);
List<DatabaseID> currentInv = new ArrayList<DatabaseID>(
this.dbMap.keySet());
// sort the inventory by site, type, model, time (most recent first)
Collections.sort(currentInv);
// process the inventory looking for "old" unwanted databases
List<DatabaseID> purged = new ArrayList<DatabaseID>();
String model = modelToPurge.getModelName();
String site = modelToPurge.getSiteId();
String type = modelToPurge.getDbType();
int count = 0;
for (DatabaseID dbId : currentInv) {
// new series?
if (dbId.getSiteId().equals(site) && dbId.getDbType().equals(type)
&& dbId.getModelName().equals(model)) {
// process the id and determine whether it should be purged
count++;
if ((count > desiredVersions)
&& !dbId.getModelTime()
.equals(DatabaseID.NO_MODEL_TIME)) {
deallocateDb(dbId, true);
purged.add(dbId);
PurgeLogger.logInfo("Purging " + dbId, "gfe");
}
}
}
return purged;
}
}

View file

@ -114,6 +114,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* 08/05/13 #1571 randerso Refactored to store GridParmInfo and ParmStorageinfo in postgres database
* 10/31/2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* 12/10/13 #2611 randerso Change saveGridData to set update time when saving grids
* 09/21/2014 #3648 randerso Changed deleteDatabase to handle database already being deleted by other JVM
*
* </pre>
*
@ -154,22 +155,22 @@ public class IFPGridDatabase extends GridDatabase {
this.valid = true;
ServerResponse<Object> failResponse = new ServerResponse<Object>();
try {
// lookup actual database id row from database
// if it doesn't exist, it will be created at this point
try {
// lookup actual database id row from database
// if it doesn't exist, it will be created at this point
this.dao = new GFEDao();
// Make a DatabaseID and save it.
this.dbId = dao.getDatabaseId(dbId);
} catch (Exception e) {
this.dbId = dao.getDatabaseId(dbId);
} catch (Exception e) {
String msg = "Unable to look up database id for ifp database: "
+ dbId;
statusHandler.handle(Priority.PROBLEM, msg, e);
failResponse.addMessage(msg);
}
}
if (!failInitCheck(failResponse)) {
return;
}
}
// Get the current database configuration and store the information
// in private data _parmInfo, _parmStorageInfo, and _areaStorageInfo
@ -220,7 +221,7 @@ public class IFPGridDatabase extends GridDatabase {
statusHandler.error("DatabaseFAIL: " + this.dbId + "\n"
+ failResponse.getMessages());
this.valid = false;
}
}
return this.valid;
}
@ -574,19 +575,19 @@ public class IFPGridDatabase extends GridDatabase {
* The list of parms to delete
*/
private void removeOldParms(List<String> parms) {
for (String item : parms) {
statusHandler.handle(Priority.INFO, "Removing: " + item
+ " from the " + this.dbId + " database.");
try {
// Remove the entire data structure for the parm
for (String item : parms) {
statusHandler.handle(Priority.INFO, "Removing: " + item
+ " from the " + this.dbId + " database.");
try {
// Remove the entire data structure for the parm
dao.removeParm(parmStorageInfo.get(item).getParmID());
this.parmStorageInfo.remove(item);
} catch (DataAccessLayerException e) {
statusHandler.handle(Priority.PROBLEM, "Error removing: "
+ item + " from the database");
}
this.parmStorageInfo.remove(item);
} catch (DataAccessLayerException e) {
statusHandler.handle(Priority.PROBLEM, "Error removing: "
+ item + " from the database");
}
}
}
@Override
public ServerResponse<List<ParmID>> getParmList() {
@ -1138,7 +1139,7 @@ public class IFPGridDatabase extends GridDatabase {
if (!glocUser.equals(glocDb)) {
// save/update the database GridLocation
try {
try {
dao.saveOrUpdateGridLocation(glocUser);
// remap the actual gridded data to the new gridLocation
@ -1177,7 +1178,7 @@ public class IFPGridDatabase extends GridDatabase {
ParmStorageInfo newPSI = parmStorageInfoUser.get(compositeName);
if (newPSI == null) {
continue; // this parm not in new database, so skip
}
}
GridParmInfo newGPI = newPSI.getGridParmInfo();
@ -1197,12 +1198,12 @@ public class IFPGridDatabase extends GridDatabase {
statusHandler.error("Unable to retrieve GFERecords for "
+ compositeName, e);
continue;
}
}
// process each grid
for (GFERecord rec : records) {
List<TimeRange> times = new ArrayList<TimeRange>();
times.add(rec.getTimeRange());
for (GFERecord rec : records) {
List<TimeRange> times = new ArrayList<TimeRange>();
times.add(rec.getTimeRange());
ServerResponse<List<IGridSlice>> ssr = this.getGridData(
rec.getParmId(), times, oldGL);
sr.addMessages(ssr);
@ -1213,24 +1214,24 @@ public class IFPGridDatabase extends GridDatabase {
continue;
}
IGridSlice slice = ssr.getPayload().get(0);
IGridSlice newSlice = null;
try {
switch (slice.getGridInfo().getGridType()) {
case NONE:
break;
case SCALAR:
ScalarGridSlice scalarSlice = (ScalarGridSlice) slice;
IGridSlice newSlice = null;
try {
switch (slice.getGridInfo().getGridType()) {
case NONE:
break;
case SCALAR:
ScalarGridSlice scalarSlice = (ScalarGridSlice) slice;
Grid2DFloat newGrid = remapper.remap(scalarSlice
.getScalarGrid(), scalarSlice.getGridInfo()
.getMinValue(), scalarSlice.getGridInfo()
.getMaxValue(), scalarSlice.getGridInfo()
.getMinValue(), scalarSlice.getGridInfo()
.getMinValue());
scalarSlice.setScalarGrid(newGrid);
newSlice = scalarSlice;
break;
case VECTOR:
VectorGridSlice vectorSlice = (VectorGridSlice) slice;
.getMinValue());
scalarSlice.setScalarGrid(newGrid);
newSlice = scalarSlice;
break;
case VECTOR:
VectorGridSlice vectorSlice = (VectorGridSlice) slice;
Grid2DFloat magOutput = new Grid2DFloat(newGL.getNx(),
newGL.getNy());
Grid2DFloat dirOutput = new Grid2DFloat(newGL.getNx(),
@ -1241,38 +1242,38 @@ public class IFPGridDatabase extends GridDatabase {
.getMaxValue(), vectorSlice.getGridInfo()
.getMinValue(), vectorSlice.getGridInfo()
.getMinValue(), magOutput, dirOutput);
vectorSlice.setDirGrid(dirOutput);
vectorSlice.setMagGrid(magOutput);
newSlice = vectorSlice;
break;
case WEATHER:
WeatherGridSlice weatherSlice = (WeatherGridSlice) slice;
vectorSlice.setDirGrid(dirOutput);
vectorSlice.setMagGrid(magOutput);
newSlice = vectorSlice;
break;
case WEATHER:
WeatherGridSlice weatherSlice = (WeatherGridSlice) slice;
Grid2DByte newWeatherGrid = remapper.remap(
weatherSlice.getWeatherGrid(), 0, 0);
weatherSlice.setWeatherGrid(newWeatherGrid);
newSlice = weatherSlice;
break;
case DISCRETE:
DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice;
weatherSlice.getWeatherGrid(), 0, 0);
weatherSlice.setWeatherGrid(newWeatherGrid);
newSlice = weatherSlice;
break;
case DISCRETE:
DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice;
Grid2DByte newDiscreteGrid = remapper.remap(
discreteSlice.getDiscreteGrid(), 0, 0);
discreteSlice.setDiscreteGrid(newDiscreteGrid);
newSlice = discreteSlice;
break;
}
newSlice.setGridInfo(newGPI);
rec.setMessageData(newSlice);
this.removeFromHDF5(rec);
this.saveGridsToHdf5(Arrays.asList(rec), newPSI);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error remapping data for record [" + rec + "]", e);
}
discreteSlice.getDiscreteGrid(), 0, 0);
discreteSlice.setDiscreteGrid(newDiscreteGrid);
newSlice = discreteSlice;
break;
}
newSlice.setGridInfo(newGPI);
rec.setMessageData(newSlice);
this.removeFromHDF5(rec);
this.saveGridsToHdf5(Arrays.asList(rec), newPSI);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error remapping data for record [" + rec + "]", e);
}
}
}
return sr;
}
}
private ServerResponse<?> getDBConfiguration() {
ServerResponse<?> sr = new ServerResponse<Object>();
@ -1293,9 +1294,9 @@ public class IFPGridDatabase extends GridDatabase {
+ e.getLocalizedMessage();
statusHandler.error(msg, e);
sr.addMessage(msg);
}
return sr;
}
return sr;
}
private void compareParmInfoWithDB(
Map<String, ParmStorageInfo> parmStorageInfoUser,
@ -1390,12 +1391,12 @@ public class IFPGridDatabase extends GridDatabase {
return null;
} else {
psi = this.gridDbConfig.getParmStorageInfo(nameLevel[0],
nameLevel[1]);
if (psi == null) {
statusHandler.handle(Priority.DEBUG, compositeName
+ " not found in ParmStorageInfo config");
nameLevel[1]);
if (psi == null) {
statusHandler.handle(Priority.DEBUG, compositeName
+ " not found in ParmStorageInfo config");
return null;
}
}
}
psi.getGridParmInfo().resetParmID(
@ -1726,7 +1727,7 @@ public class IFPGridDatabase extends GridDatabase {
first = false;
} else {
sb.append(GfeUtil.KEY_SEPARATOR);
}
}
sb.append(key.toString());
}
byte[] keyBytes = sb.toString().getBytes();
@ -2037,15 +2038,18 @@ public class IFPGridDatabase extends GridDatabase {
* the DatabaseID of the datbase to be deleted
*/
public static void deleteDatabase(DatabaseID id) {
boolean purged = false;
try {
GFEDao gfeDao = new GFEDao();
gfeDao.purgeGFEGrids(id);
purged = gfeDao.purgeGFEGrids(id);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to delete model database: " + id, e);
}
deleteModelHDF5(id);
if (purged) {
deleteModelHDF5(id);
}
}
/**

View file

@ -38,7 +38,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* 04/08/08 #875 bphillip Initial Creation
* 09/22/09 3058 rjpeter Converted to IRequestHandler
* 05/02/13 #1969 randerso Fixed null pointer if getParmList fails
* 06/13/13 2044 randerso Refactored to use IFPServer
* 06/13/13 #2044 randerso Refactored to use IFPServer
* 09/23/14 #3648 randerso Changed to send results even if some DbIds fail
* </pre>
*
* @author bphillip
@ -52,6 +53,8 @@ public class GetParmListHandler extends BaseGfeRequestHandler implements
List<ParmID> retVal = new ArrayList<ParmID>();
ServerResponse<List<ParmID>> sr = new ServerResponse<List<ParmID>>();
sr.setPayload(retVal);
for (DatabaseID id : request.getDbIds()) {
ServerResponse<List<ParmID>> ssr = getIfpServer(request)
.getGridParmMgr().getParmList(id);
@ -61,9 +64,6 @@ public class GetParmListHandler extends BaseGfeRequestHandler implements
sr.addMessages(ssr);
}
}
if (sr.isOkay()) {
sr.setPayload(retVal);
}
return sr;
}
}

View file

@ -290,9 +290,12 @@ class WECache(object):
saveSize = 0 # number of grids in saveRequest
# get full time range for flush
sortedList = sorted(trList, key=lambda t: t[0])
flushTR = (sortedList[0][0], sortedList[-1][1])
if (len(trList)):
sortedList = sorted(trList, key=lambda t: t[0])
flushTR = (sortedList[0][0], sortedList[-1][1])
else:
flushTR = (0, 2**31-1) # all times
timeSpan = None # time span if this contiguous batch
gridsToSave = ArrayList(self._batchSize) # grids in this contiguous batch
saveBatch = False
@ -421,7 +424,7 @@ class WECache(object):
def flush(self):
"""Writes all dirty time ranges in the WECache to HDF5/DB"""
# flush entire inventory
self.__flushGrids(self._dirty)
self.__flushGrids(self.keys())
def overlaps(self, tr1, tr2):
if (tr1[0] >= tr2[0] and tr1[0] < tr2[1]) or \

View file

@ -128,6 +128,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 07/14/2014 mpduff Fix data range checks
* 08/05/2014 15671 snaples Fixed check for posting when not found in ingestfilter and token is set for load_shef_ingest
* 09/03/2014 mpduff Fixed river status table updates.
* 09/12/2014 mpduff Fix for shef_load_ingest token
* </pre>
*
* @author mduff
@ -2145,14 +2146,14 @@ public class PostShef {
ingestSwitch = ShefConstants.IngestSwitch.POST_PE_OFF;
}
matchFound = true;
ingestSwitchMap.put(key, ingestSwitch);
break;
}
}
}
ingestSwitchMap.put(key, ingestSwitch);
}
matchFound = ingestSwitchMap.containsKey(key);
ingestSwitch = ingestSwitchMap.get(key);
/*

View file

@ -230,10 +230,10 @@ ${currTime}##
#set($lastTime = ${currTime})
#end
#end
#if(!${watch.marineAreas})
#if(!${watch.marineArea})
#areaFormat(${watch.partOfState} true false true)${watch.state}##
#else
#formatMarineAreas(${watch.marineAreas})
#formatMarineArea(${watch.marineArea})
#end
#set($lastEtn = ${watch.etn})
#end
@ -291,10 +291,10 @@ ${currTime}##
#set($lastTime = ${currTime})
#end
#end
#if(!${watch.marineAreas})
#if(!${watch.marineArea})
#areaFormat(${watch.partOfState} true false true)${watch.state}##
#else
#formatMarineAreas(${watch.marineAreas})
#formatMarineArea(${watch.marineArea})
#end
#set($lastEtn = ${watch.etn})
#end
@ -304,23 +304,9 @@ ${currTime}##
#end
########END MACRO
#macro(formatMarineAreas $marineAreas)
#set($macount = 0)
#set($numMarineAreas = ${list.size(${marineAreas})})
#foreach(${marineArea} in ${marineAreas})
#set($macount = $macount + 1)
#if(${marineArea}=="THE ADJACENT COASTAL WATERS" && $macount > 1)
OTHER ADJACENT COASTAL WATERS##
#else
#macro(formatMarineArea $marineArea)
${marineArea}##
#end
#if($macount == $numMarineAreas - 1)
AND ##
#elseif($macount < $numMarineAreas)
...##
#end
#end
#end
########END MACRO
#macro(printcoords $coordinates $list)

View file

@ -385,10 +385,10 @@ DENSE FOG WAS REDUCING VISIBILITIES TO BELOW ${visibility}. REDUCE YOUR SPEED...
#############
## WATCHES ##
#############
#if(${list.contains($includedWatches, "torWatches")} && ${list.contains(${bullets}, "includeTorWatches")})
#if(${list.contains($includedWatches, "TO.A")} && ${list.contains(${bullets}, "includeTorWatches")})
#inserttorwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end
#if(${list.contains(${includedWatches}, "svrWatches")} && ${list.contains(${bullets}, "includeSvrWatches")})
#if(${list.contains(${includedWatches}, "SV.A")} && ${list.contains(${bullets}, "includeSvrWatches")})
#insertsvrwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end
####################################

View file

@ -13,12 +13,12 @@
values passed to the template.
-->
<zoneWordingConfig>
<entry match="^LEZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE ERIE" />
<entry match="^LHZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE HURON" />
<entry match="^LMZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE MICHIGAN" />
<entry match="^LOZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE ONTARIO" />
<entry match="^LSZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE SUPERIOR" />
<entry match="^LCZ.*" replace="THE ADJACENT COASTAL WATERS OF LAKE SAINT CLAIRE" />
<entry match="^LEZ.*" replace="THE ADJACENT WATERS OF LAKE ERIE" />
<entry match="^LHZ.*" replace="THE ADJACENT WATERS OF LAKE HURON" />
<entry match="^LMZ.*" replace="THE ADJACENT WATERS OF LAKE MICHIGAN" />
<entry match="^LOZ.*" replace="THE ADJACENT WATERS OF LAKE ONTARIO" />
<entry match="^LSZ.*" replace="THE ADJACENT WATERS OF LAKE SUPERIOR" />
<entry match="^LCZ.*" replace="THE ADJACENT WATERS OF LAKE SAINT CLAIRE" />
<entry match="^SLZ.*" replace="" /> <!-- Saint Lawrence River -->
<entry match="^.*" replace="THE ADJACENT COASTAL WATERS" />
</zoneWordingConfig>

View file

@ -354,10 +354,10 @@ CONDITIONS CAN DETERIORATE RAPIDLY IN WINTER WEATHER SITUATIONS. BE PREPARED FOR
#############
## WATCHES ##
#############
#if(${list.contains(${includedWatches}, "torWatches")} && ${list.contains(${bullets}, "includeTorWatches")})
#if(${list.contains($includedWatches, "TO.A")} && ${list.contains(${bullets}, "includeTorWatches")})
#inserttorwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end
#if(${list.contains(${includedWatches}, "svrWatches")} && ${list.contains(${bullets}, "includeSvrWatches")})
#if(${list.contains(${includedWatches}, "SV.A")} && ${list.contains(${bullets}, "includeSvrWatches")})
#insertsvrwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end
####################################

View file

@ -76,24 +76,6 @@ public class RegistryRESTServices {
/** JAXB Manager */
private RegistryJaxbManager jaxbManager;
/** Policy used for rest connections */
private static final HTTPClientPolicy restPolicy;
static {
ProxyConfiguration proxyConfig = RegistrySOAPServices
.getProxyConfiguration();
restPolicy = new HTTPClientPolicy();
restPolicy.setConnection(ConnectionType.CLOSE);
restPolicy.setConnectionTimeout(2000);
restPolicy.setReceiveTimeout(30000);
restPolicy.setMaxRetransmits(1);
if (proxyConfig != null) {
restPolicy.setProxyServer(proxyConfig.getHost());
restPolicy.setProxyServerPort(proxyConfig.getPort());
restPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
}
}
public RegistryRESTServices() throws JAXBException {
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
}
@ -193,11 +175,27 @@ public class RegistryRESTServices {
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
ClientConfiguration config = WebClient.getConfig(service);
HTTPConduit conduit = config.getHttpConduit();
conduit.setClient(restPolicy);
conduit.setClient(getRestPolicy());
// Create HTTP header containing the calling registry
client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
RegistryUtil.LOCAL_REGISTRY_ADDRESS);
return service;
}
protected HTTPClientPolicy getRestPolicy(){
ProxyConfiguration proxyConfig = RegistrySOAPServices
.getProxyConfiguration();
HTTPClientPolicy restPolicy = new HTTPClientPolicy();
restPolicy.setConnection(ConnectionType.CLOSE);
restPolicy.setConnectionTimeout(2000);
restPolicy.setReceiveTimeout(30000);
restPolicy.setMaxRetransmits(1);
if (proxyConfig != null) {
restPolicy.setProxyServer(proxyConfig.getHost());
restPolicy.setProxyServerPort(proxyConfig.getPort());
restPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
}
return restPolicy;
}
}

View file

@ -112,44 +112,12 @@ public class RegistrySOAPServices {
/** The name of the validator service */
protected static final String VALIDATOR_SERVICE_NAME = "validator";
protected static final ProxyConfiguration proxyConfig;
protected static final HTTPClientPolicy httpClientPolicy;
protected static final ProxyConfiguration proxyConfig = getProxyConfiguration();
protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
protected static final String HTTP_CONNECTION_TIMEOUT_PROPERTY = "ebxml-http-connection-timeout";
static {
proxyConfig = getProxyConfiguration();
httpClientPolicy = new HTTPClientPolicy();
try {
httpClientPolicy.setReceiveTimeout(Long.parseLong(System
.getProperty(HTTP_RECEIVE_TIMEOUT_PROPERTY)));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-receive-timeout not specified. Using default value of 1 minute",
e);
httpClientPolicy.setReceiveTimeout(DEFAULT_RECEIVE_TIMEOUT);
}
try {
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
.getProperty(HTTP_CONNECTION_TIMEOUT_PROPERTY)));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-connection-timeout not specified. Using default value of 10 seconds",
e);
httpClientPolicy.setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT);
}
httpClientPolicy.setConnection(ConnectionType.CLOSE);
httpClientPolicy.setMaxRetransmits(5);
if (proxyConfig != null) {
httpClientPolicy.setProxyServer(proxyConfig.getHost());
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
}
}
/**
* Gets the notification listener service URL for the given host
@ -346,7 +314,7 @@ public class RegistrySOAPServices {
T port = (T) ref.getPort(serviceInterface);
Client client = ClientProxy.getClient(port);
((HTTPConduit) client.getConduit()).setClient(httpClientPolicy);
((HTTPConduit) client.getConduit()).setClient(getSoapPolicy());
// Create HTTP header containing the calling registry
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
@ -374,4 +342,36 @@ public class RegistrySOAPServices {
}
return proxyConfig;
}
private HTTPClientPolicy getSoapPolicy(){
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
try {
httpClientPolicy.setReceiveTimeout(Long.parseLong(System
.getProperty(HTTP_RECEIVE_TIMEOUT_PROPERTY)));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-receive-timeout not specified. Using default value of 1 minute",
e);
httpClientPolicy.setReceiveTimeout(DEFAULT_RECEIVE_TIMEOUT);
}
try {
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
.getProperty(HTTP_CONNECTION_TIMEOUT_PROPERTY)));
} catch (NumberFormatException e) {
statusHandler
.error("ebxml-http-connection-timeout not specified. Using default value of 10 seconds",
e);
httpClientPolicy.setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT);
}
httpClientPolicy.setConnection(ConnectionType.CLOSE);
httpClientPolicy.setMaxRetransmits(5);
if (proxyConfig != null) {
httpClientPolicy.setProxyServer(proxyConfig.getHost());
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
}
return httpClientPolicy;
}
}

View file

@ -161,6 +161,9 @@ _ldm_root_dir=${_ldm_dir}/ldm-%{_ldm_version}
_myHost=`hostname`
_myHost=`echo ${_myHost} | cut -f1 -d'-'`
# Remove old ldm dir
rm -rf ${_ldm_root_dir}
pushd . > /dev/null 2>&1
cp ${_ldm_dir}/SOURCES/%{_ldm_src_tar} ${_ldm_dir}
# unpack the ldm source
@ -176,7 +179,6 @@ if [ $? -ne 0 ]; then
exit 1
fi
chown -R ldm:fxalpha ${_ldm_dir}
popd . > /dev/null 2>&1
# create .bash_profile
if [ ! -f /usr/local/ldm/.bash_profile ]; then
@ -223,6 +225,8 @@ fi
popd > /dev/null 2>&1
# unpack bin, decoders, and etc.
pushd . > /dev/null 2>&1
cd ${_ldm_dir}/SOURCES
_PATCH_DIRS=( 'bin' 'decoders' 'etc' )
for patchDir in ${_PATCH_DIRS[*]};
do