Merge branch 'master_14.2.4' into master_14.3.1 CM-MERGE:14.2.4-13-14 into 14.3.1

Conflicts:
	cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/IFPClient.java
	edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/specialWeatherStatement.vm

Former-commit-id: 70cb8d81b0 [formerly f704781f4f] [formerly 8c3625cfec] [formerly 9f4560c480 [formerly 8c3625cfec [formerly 0bf7ecb27d41f81f1d6727674fc1475eeaa8512c]]]
Former-commit-id: 9f4560c480
Former-commit-id: 674f011faa89a8d6263043b42cfc79d80e3b82b4 [formerly b884e5e32d]
Former-commit-id: 07f84c6b26
This commit is contained in:
dmsys 2014-09-30 13:45:54 -04:00
commit 0cb584f44e
20 changed files with 399 additions and 363 deletions

View file

@ -108,7 +108,9 @@ import com.vividsolutions.jts.geom.LineString;
* and generateExistingTrackInfo() * and generateExistingTrackInfo()
* 08-21-2014 DR 15700 Qinglu Lin handle the situation where frameTime is null in paintTrack(). * 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-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> * </pre>
* *
* @author mschenke * @author mschenke
@ -1319,6 +1321,11 @@ public class StormTrackDisplay implements IRenderable {
private void paintLabels(IGraphicsTarget target, private void paintLabels(IGraphicsTarget target,
StormTrackProperties paintProps) throws VizException { StormTrackProperties paintProps) throws VizException {
StormTrackState state = paintProps.getState(); StormTrackState state = paintProps.getState();
if (state.timePoints == null || state.futurePoints == null) {
return;
}
// get the magnification from the state // get the magnification from the state
float magnification = state.magnification; float magnification = state.magnification;
// find a nice looking radius // 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 * 11/20/2013 #2331 randerso Added getTopoData method
* 04/03/2014 #2737 randerso Moved clientISCSendStatus to SaveGFEGridRequest * 04/03/2014 #2737 randerso Moved clientISCSendStatus to SaveGFEGridRequest
* 04/09/2014 #3004 dgilling Support moved ClearPracticeVTECTableRequest. * 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> * </pre>
* *
@ -192,8 +194,20 @@ public class IFPClient {
throws GFEServerException { throws GFEServerException {
GetParmListRequest request = new GetParmListRequest(); GetParmListRequest request = new GetParmListRequest();
request.setDbIds(ids); request.setDbIds(ids);
ServerResponse<?> sr = makeRequest(request); ServerResponse<?> sr = makeRequest(request, false);
return (List<ParmID>) sr.getPayload(); 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) if ((throwExceptionsBasedOnResponse) && (rval != null)
&& (!rval.isOkay())) { && (!rval.isOkay())) {
StringBuilder msg = new StringBuilder(); String msg = formatSRMessage(rval);
if (rval.getMessages().size() > 1) { throw new GFEServerException(msg);
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());
} }
return rval; 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 { public void clearPracticeTable(String siteId) throws VizException {
try { try {
ClearPracticeVTECTableRequest request = new ClearPracticeVTECTableRequest( 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="850MB-700MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="925MB-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="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-500MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-700MB" indentText="false"/> <contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-700MB" indentText="false"/>
<contribute xsi:type="menuItem" textLookup="LevelMapping" key="1000MB-850MB" 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 * Jul 16, 2014 3419 jsanchez Initial creation
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zone list. * Aug 28, 2014 ASM #15658 D. Friedman Add marine zone list.
* Sep 25, 2014 ASM #16783 D. Friedman Remove action field.
* *
* </pre> * </pre>
* *
@ -45,8 +46,6 @@ public class Watch {
private String phenSig; private String phenSig;
private String action;
private String etn; private String etn;
private Date startTime; private Date startTime;
@ -59,12 +58,11 @@ public class Watch {
private List<String> partOfState; 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) { Date startTime, Date endTime) {
this.state = state; this.state = state;
this.action = action;
this.phenSig = phenSig; this.phenSig = phenSig;
this.etn = etn; this.etn = etn;
this.startTime = startTime; this.startTime = startTime;
@ -119,14 +117,6 @@ public class Watch {
this.partOfState = partOfState; this.partOfState = partOfState;
} }
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getEtn() { public String getEtn() {
return etn; return etn;
} }
@ -135,19 +125,18 @@ public class Watch {
this.etn = etn; this.etn = etn;
} }
public List<String> getMarineAreas() { public String getMarineArea() {
return marineAreas; return marineArea;
} }
public void setMarineAreas(List<String> marineAreas) { public void setMarineArea(String marineArea) {
this.marineAreas = marineAreas; this.marineArea = marineArea;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
result = prime * result + ((etn == null) ? 0 : etn.hashCode()); result = prime * result + ((etn == null) ? 0 : etn.hashCode());
result = prime * result + ((phenSig == null) ? 0 : phenSig.hashCode()); result = prime * result + ((phenSig == null) ? 0 : phenSig.hashCode());
@ -166,11 +155,6 @@ public class Watch {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
Watch other = (Watch) obj; 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 (endTime == null) {
if (other.endTime != null) if (other.endTime != null)
return false; return false;

View file

@ -28,6 +28,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; 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 28, 2014 ASM #15658 D. Friedman Add marine zones.
* Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord * Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord
* with act of CAN and EXP in processRecords(). * 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 * Sep 25, 2014 ASM #15551 Qinglu Lin Prevent a county's WOU from being used while its
* corresponding WCN is canceled or expired. * 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> * </pre>
* *
* @author jsanchez * @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; return records;
} }
@ -414,14 +428,13 @@ public class WatchUtil {
} }
} }
String action = ar.getAct();
String phenSig = ar.getPhensig(); String phenSig = ar.getPhensig();
String etn = ar.getEtn(); String etn = ar.getEtn();
Date startTime = ar.getStartTime().getTime(); Date startTime = ar.getStartTime().getTime();
Date endTime = ar.getEndTime().getTime(); Date endTime = ar.getEndTime().getTime();
if (validUgcZones.contains(ugcZone)) { if (validUgcZones.contains(ugcZone)) {
Watch watch = new Watch(state, action, phenSig, etn, startTime, Watch watch = new Watch(state, phenSig, etn, startTime,
endTime); endTime);
List<String> areas = map.get(watch); List<String> areas = map.get(watch);
if (areas == null) { if (areas == null) {
@ -440,19 +453,35 @@ public class WatchUtil {
List<String> partOfState = new ArrayList<String>( List<String> partOfState = new ArrayList<String>(
determineAffectedPortions(watch.getAreas())); determineAffectedPortions(watch.getAreas()));
watch.setPartOfState(partOfState); watch.setPartOfState(partOfState);
watches.add(watch);
} else { } 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 ETN, then state. Marine areas
/* * have a null state value so they appear at the end of each
// Sorts the watches based on state name. * watch.
*/
Collections.sort(watches, new Comparator<Watch>() { Collections.sort(watches, new Comparator<Watch>() {
@Override @Override
public int compare(Watch watch1, Watch watch2) { 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 state1 = watch1.getState();
String state2 = watch2.getState(); String state2 = watch2.getState();
if (state1 == state2) if (state1 == state2)
@ -465,25 +494,23 @@ public class WatchUtil {
return state1.compareTo(state2); return state1.compareTo(state2);
} }
}); });
*/
// Sorts the watches based on ETN. // Filters out extra Watches that have different startTime but same phenSig, etn, state, partOfState, endTime, and marineArea.
Collections.sort(watches, new Comparator<Watch>() { Map<String, Watch> watchMap = new LinkedHashMap<String, Watch>();
for (Watch w: watches) {
@Override List<String> pos = w.getPartOfState() != null ?
public int compare(Watch watch1, Watch watch2) { new ArrayList<String>(w.getPartOfState()) : null;
String etn1 = watch1.getEtn(); if (pos != null)
String etn2 = watch2.getEtn(); Collections.sort(pos);
if (etn1 == etn2) String key = String.valueOf(w.getPhenSig())
return 0; + String.valueOf(w.getEtn()) + String.valueOf(w.getState())
else if (etn1 == null) + String.valueOf(pos) + String.valueOf(w.getEndTime());
return 1; if (w.getMarineArea() != null) {
else if (etn2 == null) key = key + '.' + w.getMarineArea();
return -1;
else
return etn1.compareTo(etn2);
} }
}); watchMap.put(key, w);
}
watches = new ArrayList<Watch>(watchMap.values());
return watches; return watches;
} }
@ -513,6 +540,18 @@ public class WatchUtil {
return affectedPortions; 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) { private List<String> determineMarineAreas(List<String> areas) {
HashSet<Pair<Integer, String>> groupedAreas = new HashSet<Pair<Integer,String>>(); HashSet<Pair<Integer, String>> groupedAreas = new HashSet<Pair<Integer,String>>();
for (String area : areas) { for (String area : areas) {
@ -529,6 +568,7 @@ public class WatchUtil {
groupedAreas.add(new Pair<Integer, String>(entryIndex, groupedAreas.add(new Pair<Integer, String>(entryIndex,
getMarineZoneName(area))); getMarineZoneName(area)));
} }
break;
} }
entryIndex++; entryIndex++;
} }
@ -698,4 +738,22 @@ public class WatchUtil {
return abrev; 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 * 08/05/13 #1571 randerso Added support for storing GridLocation and ParmStorageInfo in database
* 09/30/2013 #2147 rferrel Changes to archive hdf5 files. * 09/30/2013 #2147 rferrel Changes to archive hdf5 files.
* 10/15/2013 #2446 randerso Added ORDER BY clause to getOverlappingTimes * 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> * </pre>
* *
@ -482,7 +483,6 @@ public class GFEDao extends DefaultPluginDao {
try { try {
GridParmManager gridParmMgr = ifpServer.getGridParmMgr(); GridParmManager gridParmMgr = ifpServer.getGridParmMgr();
gridParmMgr.versionPurge();
gridParmMgr.gridsPurge(gridNotifcations, lockNotifications); gridParmMgr.gridsPurge(gridNotifcations, lockNotifications);
PurgeLogger.logInfo( PurgeLogger.logInfo(
"Purging Expired pending isc send requests...", "gfe"); "Purging Expired pending isc send requests...", "gfe");
@ -1063,9 +1063,38 @@ public class GFEDao extends DefaultPluginDao {
* Remove all GFE records for a particular DatabaseID * Remove all GFE records for a particular DatabaseID
* *
* @param dbId * @param dbId
* database to be purged
* @return true if database was removed, false if not found (already
* removed)
*/ */
public void purgeGFEGrids(final DatabaseID dbId) { public boolean purgeGFEGrids(final DatabaseID dbId) {
delete(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. * created in response to another DBInvChangeNotification so IFPServers stay in synch.
* Cleaned up commented code. * Cleaned up commented code.
* 07/21/2014 #3415 randerso Fixed d2dGridDataPurged to not purge NetCDF databases. * 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> * </pre>
* *
* @author bphillip * @author bphillip
@ -200,7 +201,6 @@ public class GridParmManager {
} else { } else {
statusHandler statusHandler
.debug("No matching GridDatabase for requested ParmID in createParm()"); .debug("No matching GridDatabase for requested ParmID in createParm()");
// TODO: should we return null?
return new GridParm(); return new GridParm();
} }
} }
@ -853,13 +853,23 @@ public class GridParmManager {
ServerResponse<GridDatabase> status = createDB(dbId); ServerResponse<GridDatabase> status = createDB(dbId);
if (status.isOkay()) { if (status.isOkay()) {
db = status.getPayload(); db = status.getPayload();
} else {
statusHandler.error(status.message());
} }
} }
if (db != null) { if (db != null) {
this.addDB(db); 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) { if (notify) {
createDbNotification(Arrays.asList(dbId), null); createDbNotification(Arrays.asList(dbId), purged);
} }
} }
} }
@ -961,83 +971,6 @@ public class GridParmManager {
return sr; 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 * Purge grids based on time
* *
@ -1100,13 +1033,8 @@ public class GridParmManager {
} }
private ServerResponse<GridDatabase> createDB(DatabaseID id) { private ServerResponse<GridDatabase> createDB(DatabaseID id) {
// TODO: consider merging this into getDatabase()
ServerResponse<GridDatabase> status = new ServerResponse<GridDatabase>(); 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)) { if (!id.isValid() || !id.getFormat().equals(DataType.GRID)) {
status.addMessage("Database id " status.addMessage("Database id "
+ id + id
@ -1115,6 +1043,7 @@ public class GridParmManager {
} }
// create the grid database // create the grid database
IFPGridDatabase db = null;
GridDbConfig dbConfig = this.config.gridDbConfig(id); GridDbConfig dbConfig = this.config.gridDbConfig(id);
if (dbConfig == null) { if (dbConfig == null) {
status.addMessage("Unable to obtain GridDbConfig information for creation" status.addMessage("Unable to obtain GridDbConfig information for creation"
@ -1137,9 +1066,6 @@ public class GridParmManager {
"Unable to mark database restored: " + dbId, e); "Unable to mark database restored: " + dbId, e);
} }
} }
// add to list of databases
addDB(db);
} else { } else {
status.addMessage("Database " + id + " is not valid."); status.addMessage("Database " + id + " is not valid.");
db = null; db = null;
@ -1190,12 +1116,8 @@ public class GridParmManager {
} }
// create the databases (the list should now only contain GRID dbs) // create the databases (the list should now only contain GRID dbs)
ServerResponse<GridDatabase> sr = new ServerResponse<GridDatabase>();
for (DatabaseID dbId : inventory) { for (DatabaseID dbId : inventory) {
sr = createDB(dbId); getDatabase(dbId, false);
if (!sr.isOkay()) {
statusHandler.error(sr.message());
}
} }
NetCDFDatabaseManager.initializeNetCDFDatabases(config); NetCDFDatabaseManager.initializeNetCDFDatabases(config);
@ -1257,11 +1179,9 @@ public class GridParmManager {
for (Date refTime : D2DGridDatabase.getModelRunTimes( for (Date refTime : D2DGridDatabase.getModelRunTimes(
d2dModelName, desiredVersions)) { d2dModelName, desiredVersions)) {
D2DGridDatabase db = D2DGridDatabase.getDatabase(config, dbId = D2DGridDatabase.getDbId(d2dModelName, refTime,
d2dModelName, refTime); config);
if (db != null) { getDatabase(dbId, false);
addDB(db);
}
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Error initializing D2D model: " statusHandler.error("Error initializing D2D model: "
@ -1276,30 +1196,18 @@ public class GridParmManager {
public void filterGridRecords(List<GridRecord> gridRecords) { public void filterGridRecords(List<GridRecord> gridRecords) {
List<GridUpdateNotification> guns = new LinkedList<GridUpdateNotification>(); List<GridUpdateNotification> guns = new LinkedList<GridUpdateNotification>();
for (GridRecord record : gridRecords) { for (GridRecord record : gridRecords) {
String d2dModelName = record.getDatasetId(); String d2dModelName = record.getDatasetId();
Date refTime = record.getDataTime().getRefTime(); Date refTime = record.getDataTime().getRefTime();
DatabaseID dbId = D2DGridDatabase.getDbId(d2dModelName, refTime, DatabaseID dbId = D2DGridDatabase.getDbId(d2dModelName, refTime,
config); config);
// not a d2d model we care about // not a d2d model we care about
if (dbId == null) { if (dbId == null) {
continue; continue;
} }
D2DGridDatabase db = (D2DGridDatabase) this.dbMap.get(dbId); D2DGridDatabase db = (D2DGridDatabase) getDatabase(dbId, true);
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);
}
GridUpdateNotification gun = db.update(record); GridUpdateNotification gun = db.update(record);
if (gun != null) { if (gun != null) {
@ -1497,6 +1405,10 @@ public class GridParmManager {
if (notif instanceof DBInvChangeNotification) { if (notif instanceof DBInvChangeNotification) {
DBInvChangeNotification invChanged = (DBInvChangeNotification) notif; DBInvChangeNotification invChanged = (DBInvChangeNotification) notif;
for (DatabaseID dbId : invChanged.getDeletions()) {
deallocateDb(dbId, false);
}
ServerResponse<GridDatabase> sr = new ServerResponse<GridDatabase>(); ServerResponse<GridDatabase> sr = new ServerResponse<GridDatabase>();
for (DatabaseID dbId : invChanged.getAdditions()) { for (DatabaseID dbId : invChanged.getAdditions()) {
this.getDatabase(dbId, false); this.getDatabase(dbId, false);
@ -1505,14 +1417,6 @@ public class GridParmManager {
statusHandler.error("Error updating GridParmManager: " statusHandler.error("Error updating GridParmManager: "
+ sr.message()); + sr.message());
} }
for (DatabaseID dbId : invChanged.getDeletions()) {
if (this.dbMap.remove(dbId) != null) {
statusHandler
.info("handleGfeNotification removing database: "
+ dbId);
}
}
} else if (notif instanceof GridUpdateNotification) { } else if (notif instanceof GridUpdateNotification) {
DatabaseID satDbId = D2DSatDatabase.getDbId(siteID); DatabaseID satDbId = D2DSatDatabase.getDbId(siteID);
GridUpdateNotification gun = (GridUpdateNotification) notif; GridUpdateNotification gun = (GridUpdateNotification) notif;
@ -1573,10 +1477,7 @@ public class GridParmManager {
iter.remove(); iter.remove();
} else { } else {
// remove the database // remove the database
if (this.dbMap.remove(dbid) != null) { deallocateDb(dbid, false);
statusHandler.info("d2dGridDataPurged removing database: "
+ dbid);
}
} }
} }
@ -1599,4 +1500,46 @@ public class GridParmManager {
SendNotifications.send(notifs); 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 * 08/05/13 #1571 randerso Refactored to store GridParmInfo and ParmStorageinfo in postgres database
* 10/31/2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() * 10/31/2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* 12/10/13 #2611 randerso Change saveGridData to set update time when saving grids * 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> * </pre>
* *
@ -154,22 +155,22 @@ public class IFPGridDatabase extends GridDatabase {
this.valid = true; this.valid = true;
ServerResponse<Object> failResponse = new ServerResponse<Object>(); ServerResponse<Object> failResponse = new ServerResponse<Object>();
try { try {
// lookup actual database id row from database // lookup actual database id row from database
// if it doesn't exist, it will be created at this point // if it doesn't exist, it will be created at this point
this.dao = new GFEDao(); this.dao = new GFEDao();
// Make a DatabaseID and save it. // Make a DatabaseID and save it.
this.dbId = dao.getDatabaseId(dbId); this.dbId = dao.getDatabaseId(dbId);
} catch (Exception e) { } catch (Exception e) {
String msg = "Unable to look up database id for ifp database: " String msg = "Unable to look up database id for ifp database: "
+ dbId; + dbId;
statusHandler.handle(Priority.PROBLEM, msg, e); statusHandler.handle(Priority.PROBLEM, msg, e);
failResponse.addMessage(msg); failResponse.addMessage(msg);
} }
if (!failInitCheck(failResponse)) { if (!failInitCheck(failResponse)) {
return; return;
} }
// Get the current database configuration and store the information // Get the current database configuration and store the information
// in private data _parmInfo, _parmStorageInfo, and _areaStorageInfo // in private data _parmInfo, _parmStorageInfo, and _areaStorageInfo
@ -220,7 +221,7 @@ public class IFPGridDatabase extends GridDatabase {
statusHandler.error("DatabaseFAIL: " + this.dbId + "\n" statusHandler.error("DatabaseFAIL: " + this.dbId + "\n"
+ failResponse.getMessages()); + failResponse.getMessages());
this.valid = false; this.valid = false;
} }
return this.valid; return this.valid;
} }
@ -574,19 +575,19 @@ public class IFPGridDatabase extends GridDatabase {
* The list of parms to delete * The list of parms to delete
*/ */
private void removeOldParms(List<String> parms) { private void removeOldParms(List<String> parms) {
for (String item : parms) { for (String item : parms) {
statusHandler.handle(Priority.INFO, "Removing: " + item statusHandler.handle(Priority.INFO, "Removing: " + item
+ " from the " + this.dbId + " database."); + " from the " + this.dbId + " database.");
try { try {
// Remove the entire data structure for the parm // Remove the entire data structure for the parm
dao.removeParm(parmStorageInfo.get(item).getParmID()); dao.removeParm(parmStorageInfo.get(item).getParmID());
this.parmStorageInfo.remove(item); this.parmStorageInfo.remove(item);
} catch (DataAccessLayerException e) { } catch (DataAccessLayerException e) {
statusHandler.handle(Priority.PROBLEM, "Error removing: " statusHandler.handle(Priority.PROBLEM, "Error removing: "
+ item + " from the database"); + item + " from the database");
}
} }
} }
}
@Override @Override
public ServerResponse<List<ParmID>> getParmList() { public ServerResponse<List<ParmID>> getParmList() {
@ -1138,7 +1139,7 @@ public class IFPGridDatabase extends GridDatabase {
if (!glocUser.equals(glocDb)) { if (!glocUser.equals(glocDb)) {
// save/update the database GridLocation // save/update the database GridLocation
try { try {
dao.saveOrUpdateGridLocation(glocUser); dao.saveOrUpdateGridLocation(glocUser);
// remap the actual gridded data to the new gridLocation // remap the actual gridded data to the new gridLocation
@ -1177,7 +1178,7 @@ public class IFPGridDatabase extends GridDatabase {
ParmStorageInfo newPSI = parmStorageInfoUser.get(compositeName); ParmStorageInfo newPSI = parmStorageInfoUser.get(compositeName);
if (newPSI == null) { if (newPSI == null) {
continue; // this parm not in new database, so skip continue; // this parm not in new database, so skip
} }
GridParmInfo newGPI = newPSI.getGridParmInfo(); GridParmInfo newGPI = newPSI.getGridParmInfo();
@ -1197,12 +1198,12 @@ public class IFPGridDatabase extends GridDatabase {
statusHandler.error("Unable to retrieve GFERecords for " statusHandler.error("Unable to retrieve GFERecords for "
+ compositeName, e); + compositeName, e);
continue; continue;
} }
// process each grid // process each grid
for (GFERecord rec : records) { for (GFERecord rec : records) {
List<TimeRange> times = new ArrayList<TimeRange>(); List<TimeRange> times = new ArrayList<TimeRange>();
times.add(rec.getTimeRange()); times.add(rec.getTimeRange());
ServerResponse<List<IGridSlice>> ssr = this.getGridData( ServerResponse<List<IGridSlice>> ssr = this.getGridData(
rec.getParmId(), times, oldGL); rec.getParmId(), times, oldGL);
sr.addMessages(ssr); sr.addMessages(ssr);
@ -1213,24 +1214,24 @@ public class IFPGridDatabase extends GridDatabase {
continue; continue;
} }
IGridSlice slice = ssr.getPayload().get(0); IGridSlice slice = ssr.getPayload().get(0);
IGridSlice newSlice = null; IGridSlice newSlice = null;
try { try {
switch (slice.getGridInfo().getGridType()) { switch (slice.getGridInfo().getGridType()) {
case NONE: case NONE:
break; break;
case SCALAR: case SCALAR:
ScalarGridSlice scalarSlice = (ScalarGridSlice) slice; ScalarGridSlice scalarSlice = (ScalarGridSlice) slice;
Grid2DFloat newGrid = remapper.remap(scalarSlice Grid2DFloat newGrid = remapper.remap(scalarSlice
.getScalarGrid(), scalarSlice.getGridInfo() .getScalarGrid(), scalarSlice.getGridInfo()
.getMinValue(), scalarSlice.getGridInfo() .getMinValue(), scalarSlice.getGridInfo()
.getMaxValue(), scalarSlice.getGridInfo() .getMaxValue(), scalarSlice.getGridInfo()
.getMinValue(), scalarSlice.getGridInfo() .getMinValue(), scalarSlice.getGridInfo()
.getMinValue()); .getMinValue());
scalarSlice.setScalarGrid(newGrid); scalarSlice.setScalarGrid(newGrid);
newSlice = scalarSlice; newSlice = scalarSlice;
break; break;
case VECTOR: case VECTOR:
VectorGridSlice vectorSlice = (VectorGridSlice) slice; VectorGridSlice vectorSlice = (VectorGridSlice) slice;
Grid2DFloat magOutput = new Grid2DFloat(newGL.getNx(), Grid2DFloat magOutput = new Grid2DFloat(newGL.getNx(),
newGL.getNy()); newGL.getNy());
Grid2DFloat dirOutput = new Grid2DFloat(newGL.getNx(), Grid2DFloat dirOutput = new Grid2DFloat(newGL.getNx(),
@ -1241,38 +1242,38 @@ public class IFPGridDatabase extends GridDatabase {
.getMaxValue(), vectorSlice.getGridInfo() .getMaxValue(), vectorSlice.getGridInfo()
.getMinValue(), vectorSlice.getGridInfo() .getMinValue(), vectorSlice.getGridInfo()
.getMinValue(), magOutput, dirOutput); .getMinValue(), magOutput, dirOutput);
vectorSlice.setDirGrid(dirOutput); vectorSlice.setDirGrid(dirOutput);
vectorSlice.setMagGrid(magOutput); vectorSlice.setMagGrid(magOutput);
newSlice = vectorSlice; newSlice = vectorSlice;
break; break;
case WEATHER: case WEATHER:
WeatherGridSlice weatherSlice = (WeatherGridSlice) slice; WeatherGridSlice weatherSlice = (WeatherGridSlice) slice;
Grid2DByte newWeatherGrid = remapper.remap( Grid2DByte newWeatherGrid = remapper.remap(
weatherSlice.getWeatherGrid(), 0, 0); weatherSlice.getWeatherGrid(), 0, 0);
weatherSlice.setWeatherGrid(newWeatherGrid); weatherSlice.setWeatherGrid(newWeatherGrid);
newSlice = weatherSlice; newSlice = weatherSlice;
break; break;
case DISCRETE: case DISCRETE:
DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice; DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice;
Grid2DByte newDiscreteGrid = remapper.remap( Grid2DByte newDiscreteGrid = remapper.remap(
discreteSlice.getDiscreteGrid(), 0, 0); discreteSlice.getDiscreteGrid(), 0, 0);
discreteSlice.setDiscreteGrid(newDiscreteGrid); discreteSlice.setDiscreteGrid(newDiscreteGrid);
newSlice = discreteSlice; newSlice = discreteSlice;
break; 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);
}
} }
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; return sr;
} }
private ServerResponse<?> getDBConfiguration() { private ServerResponse<?> getDBConfiguration() {
ServerResponse<?> sr = new ServerResponse<Object>(); ServerResponse<?> sr = new ServerResponse<Object>();
@ -1293,9 +1294,9 @@ public class IFPGridDatabase extends GridDatabase {
+ e.getLocalizedMessage(); + e.getLocalizedMessage();
statusHandler.error(msg, e); statusHandler.error(msg, e);
sr.addMessage(msg); sr.addMessage(msg);
}
return sr;
} }
return sr;
}
private void compareParmInfoWithDB( private void compareParmInfoWithDB(
Map<String, ParmStorageInfo> parmStorageInfoUser, Map<String, ParmStorageInfo> parmStorageInfoUser,
@ -1390,12 +1391,12 @@ public class IFPGridDatabase extends GridDatabase {
return null; return null;
} else { } else {
psi = this.gridDbConfig.getParmStorageInfo(nameLevel[0], psi = this.gridDbConfig.getParmStorageInfo(nameLevel[0],
nameLevel[1]); nameLevel[1]);
if (psi == null) { if (psi == null) {
statusHandler.handle(Priority.DEBUG, compositeName statusHandler.handle(Priority.DEBUG, compositeName
+ " not found in ParmStorageInfo config"); + " not found in ParmStorageInfo config");
return null; return null;
} }
} }
psi.getGridParmInfo().resetParmID( psi.getGridParmInfo().resetParmID(
@ -1726,7 +1727,7 @@ public class IFPGridDatabase extends GridDatabase {
first = false; first = false;
} else { } else {
sb.append(GfeUtil.KEY_SEPARATOR); sb.append(GfeUtil.KEY_SEPARATOR);
} }
sb.append(key.toString()); sb.append(key.toString());
} }
byte[] keyBytes = sb.toString().getBytes(); byte[] keyBytes = sb.toString().getBytes();
@ -2037,15 +2038,18 @@ public class IFPGridDatabase extends GridDatabase {
* the DatabaseID of the datbase to be deleted * the DatabaseID of the datbase to be deleted
*/ */
public static void deleteDatabase(DatabaseID id) { public static void deleteDatabase(DatabaseID id) {
boolean purged = false;
try { try {
GFEDao gfeDao = new GFEDao(); GFEDao gfeDao = new GFEDao();
gfeDao.purgeGFEGrids(id); purged = gfeDao.purgeGFEGrids(id);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to delete model database: " + id, e); "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 * 04/08/08 #875 bphillip Initial Creation
* 09/22/09 3058 rjpeter Converted to IRequestHandler * 09/22/09 3058 rjpeter Converted to IRequestHandler
* 05/02/13 #1969 randerso Fixed null pointer if getParmList fails * 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> * </pre>
* *
* @author bphillip * @author bphillip
@ -52,6 +53,8 @@ public class GetParmListHandler extends BaseGfeRequestHandler implements
List<ParmID> retVal = new ArrayList<ParmID>(); List<ParmID> retVal = new ArrayList<ParmID>();
ServerResponse<List<ParmID>> sr = new ServerResponse<List<ParmID>>(); ServerResponse<List<ParmID>> sr = new ServerResponse<List<ParmID>>();
sr.setPayload(retVal);
for (DatabaseID id : request.getDbIds()) { for (DatabaseID id : request.getDbIds()) {
ServerResponse<List<ParmID>> ssr = getIfpServer(request) ServerResponse<List<ParmID>> ssr = getIfpServer(request)
.getGridParmMgr().getParmList(id); .getGridParmMgr().getParmList(id);
@ -61,9 +64,6 @@ public class GetParmListHandler extends BaseGfeRequestHandler implements
sr.addMessages(ssr); sr.addMessages(ssr);
} }
} }
if (sr.isOkay()) {
sr.setPayload(retVal);
}
return sr; return sr;
} }
} }

View file

@ -290,9 +290,12 @@ class WECache(object):
saveSize = 0 # number of grids in saveRequest saveSize = 0 # number of grids in saveRequest
# get full time range for flush # get full time range for flush
sortedList = sorted(trList, key=lambda t: t[0]) if (len(trList)):
flushTR = (sortedList[0][0], sortedList[-1][1]) 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 timeSpan = None # time span if this contiguous batch
gridsToSave = ArrayList(self._batchSize) # grids in this contiguous batch gridsToSave = ArrayList(self._batchSize) # grids in this contiguous batch
saveBatch = False saveBatch = False
@ -421,7 +424,7 @@ class WECache(object):
def flush(self): def flush(self):
"""Writes all dirty time ranges in the WECache to HDF5/DB""" """Writes all dirty time ranges in the WECache to HDF5/DB"""
# flush entire inventory # flush entire inventory
self.__flushGrids(self._dirty) self.__flushGrids(self.keys())
def overlaps(self, tr1, tr2): def overlaps(self, tr1, tr2):
if (tr1[0] >= tr2[0] and tr1[0] < tr2[1]) or \ 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 * 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 * 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/03/2014 mpduff Fixed river status table updates.
* 09/12/2014 mpduff Fix for shef_load_ingest token
* </pre> * </pre>
* *
* @author mduff * @author mduff
@ -2145,14 +2146,14 @@ public class PostShef {
ingestSwitch = ShefConstants.IngestSwitch.POST_PE_OFF; ingestSwitch = ShefConstants.IngestSwitch.POST_PE_OFF;
} }
matchFound = true; matchFound = true;
ingestSwitchMap.put(key, ingestSwitch);
break; break;
} }
} }
} }
ingestSwitchMap.put(key, ingestSwitch);
} }
matchFound = ingestSwitchMap.containsKey(key);
ingestSwitch = ingestSwitchMap.get(key); ingestSwitch = ingestSwitchMap.get(key);
/* /*

View file

@ -230,10 +230,10 @@ ${currTime}##
#set($lastTime = ${currTime}) #set($lastTime = ${currTime})
#end #end
#end #end
#if(!${watch.marineAreas}) #if(!${watch.marineArea})
#areaFormat(${watch.partOfState} true false true)${watch.state}## #areaFormat(${watch.partOfState} true false true)${watch.state}##
#else #else
#formatMarineAreas(${watch.marineAreas}) #formatMarineArea(${watch.marineArea})
#end #end
#set($lastEtn = ${watch.etn}) #set($lastEtn = ${watch.etn})
#end #end
@ -291,10 +291,10 @@ ${currTime}##
#set($lastTime = ${currTime}) #set($lastTime = ${currTime})
#end #end
#end #end
#if(!${watch.marineAreas}) #if(!${watch.marineArea})
#areaFormat(${watch.partOfState} true false true)${watch.state}## #areaFormat(${watch.partOfState} true false true)${watch.state}##
#else #else
#formatMarineAreas(${watch.marineAreas}) #formatMarineArea(${watch.marineArea})
#end #end
#set($lastEtn = ${watch.etn}) #set($lastEtn = ${watch.etn})
#end #end
@ -304,23 +304,9 @@ ${currTime}##
#end #end
########END MACRO ########END MACRO
#macro(formatMarineAreas $marineAreas) #macro(formatMarineArea $marineArea)
#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
${marineArea}## ${marineArea}##
#end #end
#if($macount == $numMarineAreas - 1)
AND ##
#elseif($macount < $numMarineAreas)
...##
#end
#end
#end
########END MACRO ########END MACRO
#macro(printcoords $coordinates $list) #macro(printcoords $coordinates $list)

View file

@ -385,10 +385,10 @@ DENSE FOG WAS REDUCING VISIBILITIES TO BELOW ${visibility}. REDUCE YOUR SPEED...
############# #############
## WATCHES ## ## 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}) #inserttorwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end #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}) #insertsvrwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end #end
#################################### ####################################

View file

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

View file

@ -354,10 +354,10 @@ CONDITIONS CAN DETERIORATE RAPIDLY IN WINTER WEATHER SITUATIONS. BE PREPARED FOR
############# #############
## WATCHES ## ## 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}) #inserttorwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end #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}) #insertsvrwatches(${watches}, ${list}, ${secondtimezone}, ${dateUtil}, ${timeFormat})
#end #end
#################################### ####################################

View file

@ -76,24 +76,6 @@ public class RegistryRESTServices {
/** JAXB Manager */ /** JAXB Manager */
private RegistryJaxbManager jaxbManager; 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 { public RegistryRESTServices() throws JAXBException {
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper()); jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
} }
@ -193,11 +175,27 @@ public class RegistryRESTServices {
Client client = (Client) Proxy.getInvocationHandler((Proxy) service); Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
ClientConfiguration config = WebClient.getConfig(service); ClientConfiguration config = WebClient.getConfig(service);
HTTPConduit conduit = config.getHttpConduit(); HTTPConduit conduit = config.getHttpConduit();
conduit.setClient(restPolicy); conduit.setClient(getRestPolicy());
// Create HTTP header containing the calling registry // Create HTTP header containing the calling registry
client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME, client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
RegistryUtil.LOCAL_REGISTRY_ADDRESS); RegistryUtil.LOCAL_REGISTRY_ADDRESS);
return service; 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 */ /** The name of the validator service */
protected static final String VALIDATOR_SERVICE_NAME = "validator"; protected static final String VALIDATOR_SERVICE_NAME = "validator";
protected static final ProxyConfiguration proxyConfig; protected static final ProxyConfiguration proxyConfig = getProxyConfiguration();
protected static final HTTPClientPolicy httpClientPolicy;
protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout"; protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
protected static final String HTTP_CONNECTION_TIMEOUT_PROPERTY = "ebxml-http-connection-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 * Gets the notification listener service URL for the given host
@ -346,7 +314,7 @@ public class RegistrySOAPServices {
T port = (T) ref.getPort(serviceInterface); T port = (T) ref.getPort(serviceInterface);
Client client = ClientProxy.getClient(port); Client client = ClientProxy.getClient(port);
((HTTPConduit) client.getConduit()).setClient(httpClientPolicy); ((HTTPConduit) client.getConduit()).setClient(getSoapPolicy());
// Create HTTP header containing the calling registry // Create HTTP header containing the calling registry
Map<String, List<String>> headers = new HashMap<String, List<String>>(); Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME, headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
@ -374,4 +342,36 @@ public class RegistrySOAPServices {
} }
return proxyConfig; 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=`hostname`
_myHost=`echo ${_myHost} | cut -f1 -d'-'` _myHost=`echo ${_myHost} | cut -f1 -d'-'`
# Remove old ldm dir
rm -rf ${_ldm_root_dir}
pushd . > /dev/null 2>&1 pushd . > /dev/null 2>&1
cp ${_ldm_dir}/SOURCES/%{_ldm_src_tar} ${_ldm_dir} cp ${_ldm_dir}/SOURCES/%{_ldm_src_tar} ${_ldm_dir}
# unpack the ldm source # unpack the ldm source
@ -176,7 +179,6 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
chown -R ldm:fxalpha ${_ldm_dir} chown -R ldm:fxalpha ${_ldm_dir}
popd . > /dev/null 2>&1
# create .bash_profile # create .bash_profile
if [ ! -f /usr/local/ldm/.bash_profile ]; then if [ ! -f /usr/local/ldm/.bash_profile ]; then
@ -223,6 +225,8 @@ fi
popd > /dev/null 2>&1 popd > /dev/null 2>&1
# unpack bin, decoders, and etc. # unpack bin, decoders, and etc.
pushd . > /dev/null 2>&1
cd ${_ldm_dir}/SOURCES
_PATCH_DIRS=( 'bin' 'decoders' 'etc' ) _PATCH_DIRS=( 'bin' 'decoders' 'etc' )
for patchDir in ${_PATCH_DIRS[*]}; for patchDir in ${_PATCH_DIRS[*]};
do do