Merge "ASM #330 - Fix reloading of TextDB static files" into asm_14.2.2

Former-commit-id: 30545f79c5 [formerly 85fd3b3888] [formerly 30545f79c5 [formerly 85fd3b3888] [formerly ef873880b6 [formerly 0d338537015e8e8a98fa67bc658fa3a4ed0f15f0]]]
Former-commit-id: ef873880b6
Former-commit-id: bd6ae766c2 [formerly 67f8f79e9f]
Former-commit-id: cc3e0b3360
This commit is contained in:
Juliya Dynina 2014-03-18 08:47:22 -05:00 committed by Gerrit Code Review
commit 5505320aa3
3 changed files with 37 additions and 23 deletions

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.site.SiteMap;
* ------------ ---------- ----------- --------------------------
* Sep 2, 2008 1538 jkorman Initial creation
* Jul 10, 2009 2191 rjpeter Added additional methods.
* Mar 17, 2014 DR 16449 D. Friedman Fix reload/populate.
* </pre>
*
* @author jkorman
@ -351,47 +352,33 @@ public class TextDBStaticData {
tablesLoaded = true;
// ******************************
if (stdCollectiveMap != null) {
stdCollectiveMap = new HashMap<String, String>();
}
stdCollectiveMap = new HashMap<String, String>();
tablesLoaded &= loadFile("textdb/collective_table.dat",
stdCollectiveMap, COLLECTIVE_TABLE_KEY_LEN);
// ******************************
if (uaCollectiveMap != null) {
uaCollectiveMap = new HashMap<String, String>();
}
uaCollectiveMap = new HashMap<String, String>();
tablesLoaded &= loadFile("textdb/upair_table.dat", uaCollectiveMap,
UPAIR_KEY_LEN);
// ******************************
if (stationTable != null) {
stationTable = new HashMap<String, String>();
}
stationTable = new HashMap<String, String>();
tablesLoaded &= loadFile("textdb/station_table.dat", stationTable,
STATION_TABLE_KEY_LEN);
// ******************************
if (exclusionList != null) {
exclusionList = new HashSet<String>();
}
exclusionList = new HashSet<String>();
if (exclusionFileInplay) {
tablesLoaded &= loadFile("textdb/exclusionProductList.dat",
exclusionList);
}
// ******************************
if (duplicateCheckList != null) {
duplicateCheckList = new HashSet<String>();
}
duplicateCheckList = new HashSet<String>();
tablesLoaded &= loadFile("textdb/checkProductFile.dat",
duplicateCheckList);
// ******************************
if (ispanTable != null) {
ispanTable = new HashMap<String, String>();
}
ispanTable = new HashMap<String, String>();
tablesLoaded &= loadISpanFile("textdb/ispan_table.dat", ispanTable);
// ******************************
if (bitTable != null) {
bitTable = new HashMap<String, String>();
}
bitTable = new HashMap<String, String>();
tablesLoaded &= loadFile("textdb/bit_table.dat", bitTable,
BIT_TABLE_KEY_LEN);
String node = SiteMap.getInstance().getCCCFromXXXCode(siteId);

View file

@ -39,6 +39,8 @@ import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
/**
* TODO Add Description
@ -51,6 +53,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* ------------ ---------- ----------- --------------------------
* Jan 25, 2011 bfarmer Initial creation
* Oct 18, 2011 10909 rferrel notify() now saves a file.
* Mar 17, 2014 DR 16449 D. Friedman Send 'setDirty' notification to all nodes.
*
* </pre>
*
@ -62,6 +65,12 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TextDBStaticDataSubscriber.class);
private String setDirtyURI;
public TextDBStaticDataSubscriber(String setDirtyURI) {
this.setDirtyURI = setDirtyURI;
}
@Override
public void notify(String fileName, File file) {
// Assumes the fileName is the name of the file to place
@ -98,7 +107,18 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
}
}
TextDBStaticData.setDirty();
try {
if (setDirtyURI != null) {
EDEXUtil.getMessageProducer().sendAsyncUri(setDirtyURI, "");
} else {
setDirty();
}
} catch (EdexException e) {
statusHandler.error("Unable to notify that TextDB static files have changes", e);
}
}
public void setDirty() {
TextDBStaticData.setDirty();
}
}

View file

@ -23,6 +23,11 @@
<from ref="ndmFileEndpoint" />
<bean ref="ndmProc" method="processEvent" />
</route>
<route id="textDBStaticSetDirty">
<from uri="jms-generic:topic:textDBFilesChanged" />
<bean ref="textDBStaticDataListener" method="setDirty" />
</route>
</camelContext>
<bean factory-bean="clusteredCamelContextMgr"
@ -38,7 +43,9 @@
<bean id="mtrListener" class="com.raytheon.uf.common.site.ingest.MTRSubscriber" />
<bean id="afosToAwipsListener" class="com.raytheon.edex.plugin.text.ingest.AfosToAwipsListener" />
<bean id="disseminationListener" class="com.raytheon.uf.edex.dissemination.ingest.DisseminationNationalDatasetSubscriber" />
<bean id="textDBStaticDataListener" class="com.raytheon.edex.textdb.ingest.TextDBStaticDataSubscriber" />
<bean id="textDBStaticDataListener" class="com.raytheon.edex.textdb.ingest.TextDBStaticDataSubscriber">
<constructor-arg value="jms-generic:topic:textDBFilesChanged"/>
</bean>
<bean id="modelBufrListener" class="com.raytheon.edex.plugin.modelsounding.ingest.ModelBufrSubscriber" />
<bean id="radarMenuCreator" class="com.raytheon.edex.plugin.radar.util.RadarMenuUtil"/>