Merge branch 'master_13.5.3' (13.5.2-12) into omaha_13.5.3

Conflicts:
	cave/com.raytheon.uf.viz.archive.feature/feature.xml
	edexOsgi/com.raytheon.edex.plugin.ldadhydro/src/com/raytheon/edex/plugin/ldadhydro/dao/HydroDecoder.java
	ncep/gov.noaa.nws.ncep.edex.plugin.gpd/res/spring/gpd-ingest.xml
	ncep/gov.noaa.nws.ncep.edex.plugin.ntrans/src/gov/noaa/nws/ncep/edex/plugin/ntrans/decoder/NtransDecoder.java

Former-commit-id: 64062fa355 [formerly 702b66ee52] [formerly 64062fa355 [formerly 702b66ee52] [formerly ca54ffaad1 [formerly 7233d9cff9df6668f967810d8bd09c99e4ad2807]]]
Former-commit-id: ca54ffaad1
Former-commit-id: 6aab62b7b9 [formerly 38e4e0c572]
Former-commit-id: 3a2a83bc4b
This commit is contained in:
Steve Harris 2013-10-25 10:51:42 -05:00
commit 2864f20285
41 changed files with 2519 additions and 1803 deletions

View file

@ -161,4 +161,10 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.apache.commons.io"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -5,7 +5,7 @@
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=cmce_avgspr
modelName=cmce-avgspr
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>

View file

@ -5,7 +5,7 @@
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=ecens_avgspr
modelName=ecens-avgspr
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>

View file

@ -5,7 +5,7 @@
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=ecmwf_hr
modelName=ecmwf-hr
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>

View file

@ -5,7 +5,7 @@
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=gefs_avgspr
modelName=gefs-avgspr
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
<resourceDefnName>NAVGEM_NT</resourceDefnName>
<inventoryEnabled>false</inventoryEnabled>
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=navgem
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>60</frameSpan>
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>
<dfltGeogArea>XY</dfltGeogArea>
</ResourceDefinition>

View file

@ -0,0 +1,2 @@
! No real attributes for NTRANS
color= RGB {255,255,255}

View file

@ -5,7 +5,7 @@
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=opc_ens
modelName=opc-ens
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResourceDefinition xmlns:ns2="group" xmlns:ns3="http://www.example.org/productType">
<resourceDefnName>OTHER_NT</resourceDefnName>
<inventoryEnabled>false</inventoryEnabled>
<resourceCategory>NTRANS</resourceCategory>
<resourceParameters>
pluginName=ntrans
modelName=other
</resourceParameters>
<rscImplementation>NTRANS</rscImplementation>
<subTypeGenerator>metafileName,productName</subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>60</frameSpan>
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>
<dfltGeogArea>XY</dfltGeogArea>
</ResourceDefinition>

View file

@ -0,0 +1,2 @@
! No real attributes for NTRANS
color= RGB {255,255,255}

View file

@ -345,6 +345,9 @@
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAMVER_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAVGEM_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NOGAPS_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>
@ -357,6 +360,9 @@
<ResourceDefinitionFilter isEnabled="true" rscDefnName="OPC_ENS_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="OTHER_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="RAP_NT">
<filters>Forecast,NTRANS</filters>
</ResourceDefinitionFilter>

View file

@ -49,18 +49,4 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -485,4 +485,10 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.apache.commons.io"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -95,6 +95,9 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* Changes for non-blocking ZoneColorEditorDlg.
* Mar 14, 2013 1794 djohnson Consolidate common FilenameFilter implementations.
* Sep 05, 2013 2329 randerso Removed obsolete methods, added ApplyZoneCombo method
* Oct 17, 2013 2481 randerso Fixed regression which cause configured level combinations
* files to not be found. Removed message when combinations file
* not found to match A1.
*
* </pre>
*
@ -781,7 +784,7 @@ public class ZoneCombinerComp extends Composite implements
colorMap = getColorsFromFile();
String comboName = theFile;
if (comboName == null || comboName.isEmpty()) {
if ((comboName == null) || comboName.isEmpty()) {
comboName = getCombinationsFileName();
}
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
@ -911,18 +914,16 @@ public class ZoneCombinerComp extends Composite implements
public Map<String, Integer> loadCombinationsFile(String comboName) {
Map<String, Integer> dict = new HashMap<String, Integer>();
try {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext ctx = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
File localFile = pm.getFile(ctx, FileUtil.join(
CombinationsFileUtil.COMBO_DIR_PATH, comboName + ".py"));
File localFile = PathManagerFactory.getPathManager().getStaticFile(
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py"));
List<List<String>> combolist = new ArrayList<List<String>>();
if (localFile != null && localFile.exists()) {
if ((localFile != null) && localFile.exists()) {
combolist = CombinationsFileUtil.init(comboName);
} else {
statusHandler.error("Combinations file does not found: "
+ comboName);
// statusHandler
// .error("Combinations file not found: " + comboName);
}
// reformat combinations into combo dictionary
@ -1004,7 +1005,7 @@ public class ZoneCombinerComp extends Composite implements
@Override
public void applyButtonState(final boolean enabled) {
if (this.applyZoneComboBtn != null
if ((this.applyZoneComboBtn != null)
&& !this.applyZoneComboBtn.isDisposed()) {
VizApp.runAsync(new Runnable() {
@Override
@ -1017,7 +1018,7 @@ public class ZoneCombinerComp extends Composite implements
private boolean buttonState() {
final boolean[] state = { false };
if (this.applyZoneComboBtn != null
if ((this.applyZoneComboBtn != null)
&& !this.applyZoneComboBtn.isDisposed()) {
VizApp.runSync(new Runnable() {
@Override

View file

@ -89,6 +89,7 @@ import com.raytheon.uf.edex.site.notify.SendSiteActivationNotifications;
* Mar 20, 2013 #1774 randerso Changed to use GFED2DDao
* May 02, 2013 #1969 randerso Moved updateDbs method into IFPGridDatabase
* Sep 13, 2013 2368 rjpeter Used durable jms settings.
* Oct 16, 2013 #2475 dgilling Better error handling for IRT activation.
* </pre>
*
* @author njensen
@ -370,6 +371,7 @@ public class GFESiteActivation implements ISiteActivationListener {
// Doesn't need to be cluster locked
statusHandler.handle(Priority.EVENTA, "Checking ISC configuration...");
boolean isIscActivated = false;
if (config.requestISC()) {
String host = InetAddress.getLocalHost().getCanonicalHostName();
String gfeHost = config.getServerHost();
@ -382,7 +384,15 @@ public class GFESiteActivation implements ISiteActivationListener {
if (host.contains(hostNameToCompare)
&& System.getProperty("edex.run.mode").equals("request")) {
statusHandler.handle(Priority.EVENTA, "Enabling ISC...");
IRTManager.getInstance().enableISC(siteID, config.getMhsid());
try {
IRTManager.getInstance().enableISC(siteID,
config.getMhsid());
isIscActivated = true;
} catch (Exception e) {
statusHandler
.error("Error starting GFE ISC. ISC functionality will be unavailable!!",
e);
}
} else {
statusHandler.handle(Priority.EVENTA,
"ISC Enabled but will use another EDEX instance");
@ -491,7 +501,7 @@ public class GFESiteActivation implements ISiteActivationListener {
};
postActivationTaskExecutor.submit(smartInit);
if (config.tableFetchTime() > 0) {
if (config.tableFetchTime() > 0 && isIscActivated) {
Runnable activateFetchAT = new Runnable() {
@Override

View file

@ -33,10 +33,10 @@ import jep.JepException;
import com.raytheon.edex.plugin.gfe.config.GridDbConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.server.GridParmManager;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@ -47,6 +47,7 @@ import com.raytheon.uf.common.python.PyUtil;
import com.raytheon.uf.common.python.PythonScript;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
/**
@ -60,6 +61,8 @@ import com.raytheon.uf.common.util.FileUtil;
* ------------ ---------- ----------- --------------------------
* 07/14/09 1995 bphillip Initial creation
* Mar 14, 2013 1794 djohnson FileUtil.listFiles now returns List.
* Oct 16, 2013 2475 dgilling Move logic previously in IrtServer.py
* into this class to avoid Jep memory leak.
*
* </pre>
*
@ -72,14 +75,29 @@ public class GfeIRT extends Thread {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GfeIRT.class);
private static final String PYTHON_INSTANCE = "irt";
/** The site ID associated with this IRT thread */
private final String siteID;
/** The MHS ID associated with this IRT thread */
private final String mhsID;
/** The script file name */
private final String scriptFile;
private final String serverHost;
private final long serverPort;
private final long serverProtocol;
private List<String> parmsWanted;
private final List<Integer> gridDims;
private final String gridProj;
private final List<Double> gridBoundBox;
private List<String> iscWfosWanted;
/** The Python script object */
private PythonScript script;
@ -94,20 +112,83 @@ public class GfeIRT extends Thread {
*
* @param siteID
* The site ID to create the GfeIRT object for
* @throws GfeException
* @throws GfeConfigurationException
* If the GFE configuration for the specified site could not be
* loaded.
*/
public GfeIRT(String mhsid, String siteid) throws GfeException {
public GfeIRT(String mhsid, String siteid) throws GfeConfigurationException {
this.setDaemon(true);
this.siteID = siteid;
this.mhsID = mhsid;
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext cx = pathMgr.getContext(
LocalizationType.EDEX_STATIC, LocalizationLevel.BASE);
scriptFile = pathMgr
.getLocalizationFile(cx,
"gfe/isc" + File.separator + "IrtServer.py").getFile()
.getPath();
IFPServerConfig config = IFPServerConfigManager.getServerConfig(siteID);
this.serverHost = config.getServerHost();
this.serverPort = config.getRpcPort();
this.serverProtocol = config.getProtocolVersion();
GridLocation domain = config.dbDomain();
this.gridProj = domain.getProjection().getProjectionID().toString();
this.gridDims = new ArrayList<Integer>(2);
this.gridDims.add(domain.getNy());
this.gridDims.add(domain.getNx());
this.gridBoundBox = new ArrayList<Double>(4);
this.gridBoundBox.add(domain.getOrigin().x);
this.gridBoundBox.add(domain.getOrigin().y);
this.gridBoundBox.add(domain.getExtent().x);
this.gridBoundBox.add(domain.getExtent().y);
this.parmsWanted = config.requestedISCparms();
if (this.parmsWanted.isEmpty()) {
List<DatabaseID> dbs = GridParmManager.getDbInventory(this.siteID)
.getPayload();
for (DatabaseID dbId : dbs) {
if ((dbId.getModelName().equals("ISC"))
&& (dbId.getDbType().equals(""))
&& (dbId.getSiteId().equals(this.siteID))) {
GridDbConfig gdc = config.gridDbConfig(dbId);
this.parmsWanted = gdc.parmAndLevelList();
}
}
config.setRequestedISCparms(this.parmsWanted);
}
statusHandler.info("ParmsWanted: " + this.parmsWanted);
this.iscWfosWanted = config.requestedISCsites();
if (this.iscWfosWanted.isEmpty()) {
List<String> knownSites = config.allSites();
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext commonStaticConfig = pathMgr.getContext(
LocalizationType.COMMON_STATIC,
LocalizationLevel.CONFIGURED);
commonStaticConfig.setContextName(this.siteID);
File editAreaDir = pathMgr.getFile(commonStaticConfig,
"gfe/editAreas");
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.trim().matches("ISC_\\p{Alnum}{3}\\.xml");
}
};
List<File> editAreas = FileUtil.listFiles(editAreaDir, filter,
false);
this.iscWfosWanted = new ArrayList<String>();
for (File f : editAreas) {
String name = f.getName().replace("ISC_", "")
.replace(".xml", "");
if (knownSites.contains(name)) {
iscWfosWanted.add(name);
}
}
config.setRequestedISCsites(this.iscWfosWanted);
}
Thread hook = new Thread() {
@Override
public void run() {
@ -123,111 +204,97 @@ public class GfeIRT extends Thread {
@Override
public void run() {
try {
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext cx = pathMgr.getContext(
LocalizationType.EDEX_STATIC, LocalizationLevel.BASE);
String scriptPath = pathMgr
.getLocalizationFile(cx, "gfe/isc/IrtAccess.py").getFile()
.getPath();
String includePath = PyUtil.buildJepIncludePath(
GfePyIncludeUtil.getCommonPythonIncludePath(),
GfePyIncludeUtil.getIscScriptsIncludePath(),
GfePyIncludeUtil.getGfeConfigIncludePath(siteID));
script = new PythonScript(scriptFile, includePath);
Map<String, Object> args = new HashMap<String, Object>();
GfePyIncludeUtil.getGfeConfigIncludePath(this.siteID));
this.script = new PythonScript(scriptPath, includePath, getClass()
.getClassLoader());
IFPServerConfig config = IFPServerConfigManager
.getServerConfig(siteID);
GridLocation domain = config.dbDomain();
String site = config.getSiteID().get(0);
List<Integer> gridDims = new ArrayList<Integer>();
gridDims.add(domain.getNy());
gridDims.add(domain.getNx());
List<Double> gridBoundBox = new ArrayList<Double>();
gridBoundBox.add(domain.getOrigin().x);
gridBoundBox.add(domain.getOrigin().y);
gridBoundBox.add(domain.getExtent().x);
gridBoundBox.add(domain.getExtent().y);
// determine which parms are wanted
List<String> parmsWanted = config.requestedISCparms();
if (parmsWanted.isEmpty()) {
List<DatabaseID> dbs = GridParmManager.getDbInventory(site)
.getPayload();
for (int i = 0; i < dbs.size(); i++) {
if (dbs.get(i).getModelName().equals("ISC")
&& dbs.get(i).getDbType().equals("")
&& dbs.get(i).getSiteId().equals(site)) {
GridDbConfig gdc = config.gridDbConfig(dbs.get(i));
parmsWanted = gdc.parmAndLevelList();
}
}
}
statusHandler.info("ParmsWanted: " + parmsWanted);
// reset them to actual values
config.setRequestedISCparms(parmsWanted);
// determine isc areas that are wanted
List<String> iscWfosWanted = config.requestedISCsites();
if (iscWfosWanted.isEmpty()) {
List<String> knownSites = config.allSites();
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext commonStaticConfig = pathMgr.getContext(
LocalizationType.COMMON_STATIC,
LocalizationLevel.CONFIGURED);
commonStaticConfig.setContextName(site);
File editAreaDir = pathMgr.getFile(commonStaticConfig,
"gfe/editAreas");
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.trim().matches("ISC_\\p{Alnum}{3}\\.xml");
}
};
List<File> editAreas = FileUtil.listFiles(editAreaDir,
filter, false);
String name = "";
for (File f : editAreas) {
name = f.getName().replace("ISC_", "").replace(".xml", "");
if (knownSites.contains(name)) {
iscWfosWanted.add(name);
}
}
config.setRequestedISCsites(iscWfosWanted);
}
args.put("ancfURL", config.iscRoutingTableAddress().get("ANCF"));
args.put("bncfURL", config.iscRoutingTableAddress().get("BNCF"));
args.put("mhsid", config.getMhsid());
args.put("serverHost", config.getServerHost());
args.put("serverPort", config.getRpcPort());
args.put("serverProtocol", config.getProtocolVersion());
args.put("site", site);
args.put("parmsWanted", config.requestedISCparms());
args.put("gridDims", gridDims);
args.put("gridProj", domain.getProjection().getProjectionID()
.toString());
args.put("gridBoundBox", gridBoundBox);
args.put("iscWfosWanted", iscWfosWanted);
boolean regSuccess = (Boolean) script.execute("irtReg", args);
if (!regSuccess) {
statusHandler
.error("Error registering site with IRT server. ISC functionality will be unavailable. Check config and IRT connectivity.");
removeShutdownHook(this.mhsID, this.siteID);
}
Map<String, Object> initArgs = new HashMap<String, Object>(2, 1f);
initArgs.put("ancfURL", config.iscRoutingTableAddress().get("ANCF"));
initArgs.put("bncfURL", config.iscRoutingTableAddress().get("BNCF"));
this.script.instantiatePythonClass(PYTHON_INSTANCE, "IrtAccess",
initArgs);
} catch (GfeConfigurationException e) {
throw new RuntimeException("Could not load GFE configuration", e);
} catch (JepException e) {
statusHandler
.fatal("Error starting GFE ISC. ISC functionality will be unavailable!!",
e);
} catch (GfeException e) {
statusHandler
.fatal("Unable to get Mhs ID. ISC functionality will be unavailable!!",
e);
throw new RuntimeException(
"Could not instantiate IRT python script instance", e);
}
try {
// upon any overall failure, start thread over
while (IRTManager.getInstance().isRegistered(mhsID, siteID)) {
try {
// do initial registration, keep trying until successful
while (IRTManager.getInstance().isRegistered(mhsID, siteID)) {
statusHandler
.info("performing initial IRT registration.");
Map<String, Object> args = new HashMap<String, Object>(
10, 1f);
args.put("mhsid", mhsID);
args.put("serverHost", serverHost);
args.put("serverPort", serverPort);
args.put("serverProtocol", serverProtocol);
args.put("site", siteID);
args.put("parmsWanted", parmsWanted);
args.put("gridDims", gridDims);
args.put("gridProj", gridProj);
args.put("gridBoundBox", gridBoundBox);
args.put("iscWfosWanted", iscWfosWanted);
Boolean okay = (Boolean) script.execute("register",
PYTHON_INSTANCE, args);
if (okay) {
break;
} else if (!IRTManager.getInstance().isRegistered(
mhsID, siteID)) {
break; // exit processing loop
} else {
sleep(3 * TimeUtil.MILLIS_PER_SECOND);
}
}
// if we are here, we had a successful registration, check
// for re-register every few seconds, check the StopIRT flag
// every few seconds
statusHandler.info("initial IRT registration complete.");
while (IRTManager.getInstance().isRegistered(mhsID, siteID)) {
sleep(3 * TimeUtil.MILLIS_PER_SECOND); // wait 3 seconds
Boolean status1 = (Boolean) script.execute(
"checkForReregister", PYTHON_INSTANCE, null);
if (!status1) {
statusHandler.error("FAIL on checkForRegister().");
break; // break out of rereg loop, to cause another
// reg
}
}
} catch (Throwable t) {
statusHandler.error("Exception in IRT register thread.", t);
}
}
// if we get here, we have been told to stop IRT, so we unregister.
// We try only once.
statusHandler.info("FINAL IRT unregister.");
try {
script.execute("unregister", PYTHON_INSTANCE, null);
} catch (JepException e) {
statusHandler.error("Exception unregister IRT.", e);
}
statusHandler.info("FINAL -- exiting IRT registration thread.");
} finally {
if (script != null) {
script.dispose();

View file

@ -105,6 +105,9 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger;
* Changed to call D2DGridDatabase.getDatabase instead of calling
* the constructor directly to ensure the data exists before creating
* the D2DGridDatabase object
* 10/02/13 #2444 randerso Fix error handling when creating IFPGridDatabases.
* DO NOT ATTEMPT TO MERGE THIS CHANGE INTO 14.2 as the GFE
* server code has been significantly refactored.
*
* </pre>
*
@ -1262,9 +1265,15 @@ public class GridParmManager {
db = TopoDatabaseManager.getTopoDatabase(dbId.getSiteId());
} else {
db = new IFPGridDatabase(dbId);
if (db.databaseIsValid()) {
((IFPGridDatabase) db).updateDbs();
try {
db = new IFPGridDatabase(dbId);
if (db.databaseIsValid()) {
((IFPGridDatabase) db).updateDbs();
}
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error creating IFPGridDatbase for " + dbId, e);
db = null;
}
}
}

View file

@ -44,12 +44,11 @@ from com.raytheon.edex.plugin.gfe.isc import IRTManager
# to interact better with IscScript.
# 05/22/13 1759 dgilling Add missing import to
# makeISCrequest().
# 10/16/13 2475 dgilling Remove unneeded code to handle
# registration with IRT.
#
#
#
# starts the IRT thread and registers.
StopIRT = 0 #flag to shut down the 2nd thread
IRTthread = None #flag to hold the IRTthread object
def logEvent(*msg):
iscUtil.getLogger("irtServer").info(iscUtil.tupleToString(*msg))
@ -188,51 +187,6 @@ def putVTECActiveTable(strTable, xmlPacket):
except:
logProblem("Error executing ingestAT: ", traceback.format_exc())
logEvent("ingesAT command output: ", output)
def initIRT(ancfURL, bncfURL, mhsid, serverHost, serverPort, serverProtocol,
site, parmsWanted, gridDims, gridProj, gridBoundBox, iscWfosWanted):
global IRTthread
import threading
IRTthread = threading.Thread(target=irtReg, args=[ancfURL, bncfURL, mhsid,
serverHost, serverPort, serverProtocol, site, parmsWanted, gridDims,
gridProj, gridBoundBox, iscWfosWanted])
IRTthread.setDaemon(True)
IRTthread.start()
# IRT registration thread
def irtReg(ancfURL, bncfURL, mhsid, serverHost, serverPort, serverProtocol,
site, parmsWanted, gridDims, gridProj, gridBoundBox, iscWfosWanted):
import IrtAccess, threading
irt = IrtAccess.IrtAccess(ancfURL, bncfURL)
# do initial registration, keep trying until successful
while True:
okay = irt.register(mhsid, serverHost, serverPort, serverProtocol,
site, parmsWanted, gridDims, gridProj, gridBoundBox, iscWfosWanted)
if okay:
break
elif StopIRT:
return False#stop this thread
else:
return False
# if we are here, we had a successful registration, check for re-register
# every few seconds, check the StopIRT flag every few seconds
while IRTManager.getInstance().isRegistered(mhsid,site) == True:
time.sleep(3.0) #wait 3 seconds
irt.checkForReregister()
# if we get here, we have been told to stop IRT, so we unregister. We
# try only once.
irt.unregister()
return True
# call from C++ to Python to tell IRT thread to shut itself down
def irtStop():
global StopIRT
StopIRT = True #tells irt thread to exit
if IRTthread:
IRTthread.join() #wait till thread returns then return to caller
# get servers direct call for IRT
def irtGetServers(ancfURL, bncfURL, iscWfosWanted):

View file

@ -68,6 +68,8 @@ import com.raytheon.uf.common.time.DataTime;
* ------------ ---------- ----------- --------------------------
* Sep 30, 2009 vkorolev Initial creation
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* 10/16/13 DR 16685 M.Porricelli Add error checking for date
* format
* </pre>
*
* @author vkorolev
@ -75,6 +77,8 @@ import com.raytheon.uf.common.time.DataTime;
*/
public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
private static final String BAD_PROPERTY_FMT = "NumberFormatException setting property %s.%s(%s %s)";
private String traceId = null;
@ -195,11 +199,13 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
}
// DataTime = Observation time
Calendar ot = record.getObservationTime();
DataTime dt = new DataTime(ot);
record.setDataTime(dt);
record.setLocation(location);
record.constructDataURI();
retVal.add(record);
if (ot != null){
DataTime dt = new DataTime(ot);
record.setDataTime(dt);
record.setLocation(location);
record.constructDataURI();
retVal.add(record);
}
// logger.info("-------------------------------------------------------");
}
@ -250,14 +256,29 @@ public class HydroDecoder<E> extends AbstractDecoder implements IBinaryDecoder {
if (clazz == String.class) {
val = value.trim();
} else if (clazz == Calendar.class) {
Date ot = sdf.parse(value);
Calendar cal = Calendar.getInstance();
cal.setTime(ot);
val = cal;
Date ot = null;
try {
ot = sdf.parse(value);
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
cal.setTime(ot);
val = cal;
} catch(Exception e) {
logger.error("Could not parse date field [" + name + ":" + value + "]");
return;
}
// only numbers
} else {
Double tval = Double.parseDouble(value);
} else {
Double tval = null;
try {
tval = Double.parseDouble(value);
} catch (NumberFormatException nfe) {
String msg = String.format(BAD_PROPERTY_FMT,
cls.getSimpleName(), fld.getName(),
clazz.getSimpleName(), value);
logger.error(msg);
return;
}
if (configFile.containsKey(vunit)) {
Unit<?> inUnit = (Unit<?>) UnitFormat.getUCUMInstance()
.parseObject(configFile.getProperty(vunit));

View file

@ -59,6 +59,9 @@ public class RadarDecompressor {
private static final int Z_DEFLATED = 8;
private static final int DEF_WBITS = 15;
//max buffer for decompressed radar data, DPR is 1346648
private static final int MAXBUF = 2000000;
/** The logger */
private static final transient IUFStatusHandler theHandler = UFStatus
@ -285,21 +288,34 @@ public class RadarDecompressor {
ByteArrayInputStream is = new ByteArrayInputStream(tmpBuf);
BZip2InputStream bis= new BZip2InputStream(is,false);
try {
//use 10x85716 should be safe
byte[] tmpBuf2= new byte[860000];
byte[] tmpBuf2= new byte[MAXBUF];
int actualByte=bis.read(tmpBuf2);
byte[] bigBuf = new byte[0];
int currentSize = 0 ;
//The decompressed size in header don't seems always correct
// and bis.available()
while (actualByte != -1) {
byte[] tmpBuf3 = new byte[bigBuf.length];
System.arraycopy(bigBuf, 0, tmpBuf3, 0, bigBuf.length);
bigBuf = new byte[currentSize+actualByte] ;
System.arraycopy(tmpBuf3, 0, bigBuf, 0, tmpBuf3.length);
System.arraycopy(tmpBuf2, 0, bigBuf, currentSize, actualByte);
currentSize = bigBuf.length;
actualByte=bis.read(tmpBuf2);
}
bis.close();
outBuf = new byte[actualByte+120];
outBuf = new byte[bigBuf.length+120];
//the 120 bytes:description block and symbology block
System.arraycopy(inBuf, offset, outBuf, 0, 8);
byte[] lengthMsg2=ByteBuffer.allocate(4).putInt(outBuf.length).array();
System.arraycopy(lengthMsg2, 0, outBuf, 8, 4);
System.arraycopy(inBuf, offset+8+4, outBuf, 12, 108);
System.arraycopy(tmpBuf2, 0, outBuf, 120, actualByte);
System.arraycopy(bigBuf, 0, outBuf, 120, bigBuf.length);
} catch (Exception e) {
theHandler.handle(Priority.ERROR,
"Failed to decompress " + headers.get("ingestfilename"));
return null;
}
}
return outBuf;

View file

@ -399,4 +399,10 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.apache.commons.io"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Apr 29, 2011 DR#8986 zhao Read in Counties instead of Forecast Zones
* Feb 21 2012 14413 zhao add code handling "adjacent areas"
* Nov 20 2012 1297 skorolev Cleaned code
* Oct 17 2013 16682 zhao fixed a bug in readConfigXml()
*
* </pre>
*
@ -136,7 +137,7 @@ public abstract class MonitorConfigurationManager {
configXml = configXmltmp;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"No mopnitor area configuration file found", e);
"No monitor area configuration file found", e);
monitorAreaFileExists = false;
}
@ -173,14 +174,14 @@ public abstract class MonitorConfigurationManager {
}
List<String> marineZones = MonitorAreaUtils
.getMarineZones(currentSite);
if (zones.isEmpty()) {
if (!zones.isEmpty()) {
for (String zone : zones) {
AreaIdXML zoneXml = new AreaIdXML();
zoneXml.setAreaId(zone);
zoneXml.setType(ZoneType.REGULAR);
List<StationIdXML> stations = MonitorAreaUtils
.getZoneReportingStationXMLs(zone);
if (stations.isEmpty()) {
if (!stations.isEmpty()) {
for (StationIdXML station : stations) {
zoneXml.addStationIdXml(station);
}
@ -189,14 +190,14 @@ public abstract class MonitorConfigurationManager {
}
}
// add marine zones if any exist
if (marineZones.isEmpty()) {
if (!marineZones.isEmpty()) {
for (String zone : marineZones) {
AreaIdXML zoneXml = new AreaIdXML();
zoneXml.setAreaId(zone);
zoneXml.setType(ZoneType.MARITIME);
List<StationIdXML> stations = MonitorAreaUtils
.getZoneReportingStationXMLs(zone);
if (stations.isEmpty()) {
if (!stations.isEmpty()) {
for (StationIdXML station : stations) {
zoneXml.addStationIdXml(station);
}

View file

@ -8,7 +8,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="1.0.0",
org.apache.commons.beanutils;bundle-version="1.8.3",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
org.apache.commons.lang;bundle-version="2.3.0"
org.apache.commons.lang;bundle-version="2.3.0",
org.apache.commons.io;bundle-version="2.4.0"
Export-Package: com.raytheon.uf.common.util,
com.raytheon.uf.common.util.algorithm,
com.raytheon.uf.common.util.cache,

View file

@ -30,13 +30,14 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.apache.commons.io.IOUtils;
/**
* Contains common file utilities. Methods are generally static to use without a
* class instance. Methods in class should not log directly; rather they should
@ -54,11 +55,13 @@ import java.util.zip.GZIPOutputStream;
* Jun 28, 2012 0819 djohnson Add write method.
* Jul 06, 2012 798 jkorman Added more robust {@link #copyFile}. Added methods
* to create temporary directories and files.
* 02/15/2013 #1597 randerso Fixed error when copying empty files
* Feb 15, 2013 1597 randerso Fixed error when copying empty files
* Feb 15, 2013 1638 mschenke Moved EOL field from edex.common Util
* Mar 11, 2013 1645 djohnson Added file modification watcher.
* Mar 14, 2013 1794 djohnson FileUtil.listFiles now returns List.
* May 16, 2013 1966 rferrel Add sizeOfDirectory and listDirFiles method.
* Oct 9, 2013 2467 randerso Change coypFile to use apache instead of FileChannel
* to improve memory utilization
*
* </pre>
*
@ -74,6 +77,9 @@ public class FileUtil {
private static final Pattern VALID_FILENAME = Pattern
.compile("^[A-Za-z0-9._\\- ]+$");
/**
* regex to match both Linux and Windows file separators
*/
public final static String fileSeparatorRegex = "[/\\\\]";
/**
@ -134,7 +140,7 @@ public class FileUtil {
File entry = entries[i];
// If there is no filter or the filter accepts the
// file / directory, add it to the list
if (filter == null || filter.accept(directory, entry.getName())) {
if ((filter == null) || filter.accept(directory, entry.getName())) {
files.add(entry);
}
@ -152,9 +158,12 @@ public class FileUtil {
* List files/directories that match a FileFilter.
*
* @param directory
* source directory
* @param filter
* file filter
* @param recurse
* @return
* true to recursively walk the directory tree
* @return list of files in directory matching filter
*/
public static List<File> listDirFiles(File directory, FileFilter filter,
boolean recurse) {
@ -171,7 +180,7 @@ public class FileUtil {
// Go over entries
for (File entry : entries) {
files.add(entry);
if (recurse && filter != null && entry.isDirectory()) {
if (recurse && (filter != null) && entry.isDirectory()) {
files.addAll(listDirFiles(entry, filter, recurse));
}
}
@ -241,19 +250,7 @@ public class FileUtil {
file));
}
} else {
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(destination);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
copyFile(source, destination);
}
}
@ -361,24 +358,13 @@ public class FileUtil {
}
/**
* Copy a file to a another file.
* Read the contents of a file into a string
*
* @param fileToCopy
* The source file. This file reference must exist.
* @param outputFile
* The destination file. This file may exist, if so it will be
* overwritten.
* @param file
* file to be read
* @return string containing the file contents
* @throws IOException
* An error occurred while copying the data.
* @throws NullPointerException
* Either the source or target file references are null.
*/
public static void copyFile(File fileToCopy, File outputFile)
throws IOException {
// Copy the entire file.
copyFile(fileToCopy, outputFile, 0);
}
public static String file2String(File file) throws IOException {
return new String(file2bytes(file));
}
@ -415,8 +401,9 @@ public class FileUtil {
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
while ((offset < bytes.length)
&& ((numRead = is
.read(bytes, offset, bytes.length - offset)) >= 0)) {
offset += numRead;
}
@ -500,9 +487,9 @@ public class FileUtil {
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead = is.read(bytes, offset, bytes.length
- offset)) >= 0) {
while ((offset < bytes.length)
&& ((numRead = is.read(bytes, offset, bytes.length
- offset)) >= 0)) {
offset += numRead;
}
@ -546,6 +533,8 @@ public class FileUtil {
* The data to store
* @param outFile
* The file to write this data
* @param compress
* if true file will be compressed using gzip
* @throws IOException
*/
public static void bytes2File(byte[] outBytes, File outFile,
@ -564,7 +553,7 @@ public class FileUtil {
// only write out buffer at a time
for (int counter = 0; counter < outBytes.length; counter += buffer) {
if ((outBytes.length - counter) - buffer >= 0) {
if (((outBytes.length - counter) - buffer) >= 0) {
out.write(outBytes, counter, buffer);
} else {
out.write(outBytes, counter, (outBytes.length - counter));
@ -627,7 +616,7 @@ public class FileUtil {
String replacement = (File.separatorChar == '\\') ? "\\\\"
: File.separator;
if (aPath != null && aPath.length() > 0) {
if ((aPath != null) && (aPath.length() > 0)) {
return aPath.replaceAll(fileSeparatorRegex, replacement);
} else {
return aPath;
@ -643,9 +632,9 @@ public class FileUtil {
*/
public static String edexPath(String aPath) {
if (aPath != null && aPath.length() > 0) {
if ((aPath != null) && (aPath.length() > 0)) {
// Remove drive letter
if (aPath.length() > 1 && aPath.charAt(1) == ':') {
if ((aPath.length() > 1) && (aPath.charAt(1) == ':')) {
aPath = aPath.substring(2);
}
return aPath.replace("\\", "/");
@ -683,92 +672,68 @@ public class FileUtil {
}
/**
* Copy a file from one location to another. The file copy may begin at some
* specified position within the source file.
* Copy a file to another file.
*
* @param source
* The source file. This file reference must exist.
* @param target
* @param destination
* The destination file. This file may exist, if so it will be
* overwritten.
* @param position
* The start position within the source file where the copy
* operation will begin. The position must be greater than or
* equal to zero, and less than the file length of the source.
* @return Was the required data copied to the target file.
* @throws IOException
* An error occurred while copying the data.
* @throws IllegalArgumentException
* The position is less than zero or greater than the length of
* the source file or either of the source, target files are
* null.
* Either the source or target file references are null.
*/
public static boolean copyFile(File source, File target, int position)
public static void copyFile(File source, File destination)
throws IOException {
boolean status = false;
if (source != null) {
if (target != null) {
if ((position >= 0) && (position <= source.length())) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
FileChannel fci = fis.getChannel();
fos = new FileOutputStream(target);
FileChannel fco = fos.getChannel();
long count = source.length() - position;
long transfered = fci.transferTo(position, count, fco);
// ensure we copied all of the data.
status = (transfered == count);
} finally {
String cause = null;
try {
close(fis);
} catch (IOException e) {
cause = String.format(
"copyFile.source.close[%s][%s]", e
.getClass().getName(), e
.getMessage());
}
try {
close(fos);
} catch (IOException e) {
if (cause == null) {
cause = String.format(
"copyFile.target.close[%s][%s]", e
.getClass().getName(), e
.getMessage());
} else {
cause = String.format(
"%s copyFile.target.close[%s][%s]",
cause, e.getClass().getName(),
e.getMessage());
}
}
// One or more closes failed. Construct and throw an
// exception.
if (cause != null) {
throw new IOException(cause);
}
}
} else {
String msg = String.format(
"position [%d] is out of range. Max is [%d]",
position, source.length());
throw new IllegalArgumentException(msg);
}
} else {
throw new IllegalArgumentException(
"target file reference is null");
}
} else {
if (source == null) {
throw new IllegalArgumentException("source file reference is null");
}
return status;
if (destination == null) {
throw new IllegalArgumentException("target file reference is null");
}
FileInputStream fis = null;
FileOutputStream fos = null;
IOException exception = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
IOUtils.copyLarge(fis, fos);
} catch (IOException e) {
// close the output stream ignoring any exceptions
close(fos);
fos = null;
// remove the invalid destination file
destination.delete();
exception = new IOException(String.format("Error copying %s to %s",
source.getCanonicalPath(), destination.getCanonicalPath()),
e);
} finally {
// close destination and source files reporting first exception
IOException e = close(fos);
if ((exception == null) && (e != null)) {
exception = new IOException(String.format("Error closing %s",
destination.getCanonicalPath()), e);
}
e = close(fis);
if ((exception == null) && (e != null)) {
exception = new IOException(String.format("Error closing %s",
source.getCanonicalPath()), e);
}
if (exception != null) {
throw exception;
}
}
}
/**
@ -887,13 +852,17 @@ public class FileUtil {
*
* @param c
* An object that needs to be closed.
* @throws IOException
* An error occurred attempting to close the object.
* @return IOException if one occurs or null
*/
public static void close(Closeable c) throws IOException {
private static IOException close(Closeable c) {
if (c != null) {
c.close();
try {
c.close();
} catch (IOException e) {
return e;
}
}
return null;
}
/**

View file

@ -1,32 +1,32 @@
#!/usr/bin/ksh
#setenv FXA_HOME /awips/fxa
#setenv LOG_DIR /data/logs/fxa
#source $FXA_HOME/readenv.csh
###############################################################################
# AWIPS2 wrapper script for the daily scheduled NRLDB process. This uses the #
# nrldb.pl script to extract the static data from the IHFSDB, packages it in #
# an XML file and uploads it to the NRLDB server on the NHOR. #
# #
# Mark Armstrong (HSD) - 10/17/2013 #
###############################################################################
RUN_FROM_DIR=`dirname $0`
echo "RFD: $RUN_FROM_DIR"
#echo "RFD: $RUN_FROM_DIR"
# set up SOME environment variables for WHFS applications
export PGSQL_DRIVER_DIR=/awips2/cave/plugins/org.postgres_9.2.0
export EDEX_HOME=/awips2/edex
export apps_dir=/awips2/edex/data/share/hydroapps
. $RUN_FROM_DIR/../../set_hydro_env
. $RUN_FROM_DIR/../../check_app_context
#set NRLDB_DATA=`/awips/hydroapps/public/bin/get_apps_defaults.LX nrldb_data`
#set NRLDB_LOG=`/awips/hydroapps/public/bin/get_apps_defaults.LX nrldb_log`
#set NRLDB_CONFIG=`/awips/hydroapps/public/bin/get_apps_defaults.LX nrldb_config`
#set WHFS_BIN=`/awips/hydroapps/public/bin/get_apps_defaults.LX whfs_bin_dir`
#cd /awips/hydroapps/whfs/local/data/backup_db/nrldb
export NRLDB_DATA=$(get_apps_defaults nrldb_data)
echo "NRLDB data: $NRLDB_DATA"
#echo "NRLDB data: $NRLDB_DATA"
export NRLDB_LOG=$(get_apps_defaults nrldb_log)
echo "NRLDB log: $NRLDB_LOG"
#echo "NRLDB log: $NRLDB_LOG"
export NRLDB_CONFIG=$(get_apps_defaults nrldb_config)
echo "NRLDB config: $NRLDB_CONFIG"
#echo "NRLDB config: $NRLDB_CONFIG"
export WHFS_BIN=$(get_apps_defaults whfs_bin_dir)
echo "WHFS_BIN: $WHFS_BIN"
#echo "WHFS_BIN: $WHFS_BIN"
export NRLDBLOGFILE=${NRLDB_LOG}/nrldb.log
export NRLDBTMPFILE=${NRLDB_LOG}/nrldb.tmp

View file

@ -0,0 +1,21 @@
#!/bin/ksh
RUN_FROM_DIR=`dirname $0`
# set up SOME environment variables for WHFS applications
export PGSQL_DRIVER_DIR=/awips2/cave/plugins/org.postgres_9.2.0
. $RUN_FROM_DIR/../../set_hydro_env
. $RUN_FROM_DIR/../../check_app_context
export APPS_DEFAULTS=~/caveData/common/base/hydro/Apps_defaults
export APPS_DEFAULTS_SITE=~/caveData/common/site/${AW_SITE_IDENTIFIER}/hydro/Apps_defaults
export PGUSER="awips"
export BIN_DIR=`get_apps_defaults whfs_bin_dir"`
export NRLDB_LOG=`get_apps_defaults nrldb_log`
export NRLDB_CONFIG=`get_apps_defaults nrldb_config`
export NRLDB_DATA=`get_apps_defaults nrldb_data`
export NRLDB_TMP=`get_apps_defaults nrldb_tmp`
export db_name=`get_apps_defaults db_name`
export PGHOST=`get_apps_defaults pghost`
$RUN_FROM_DIR/update_nrldb.pl
exit 0

View file

@ -21,19 +21,13 @@ then
exit 0
fi
# set up SOME environment variables for NRLDB applications
export apps_dir=/awips2/edex/data/share/hydroapps
export EDEX_HOME=/awips2/edex
export NRLDB_DATA=`get_apps_defaults nrldb_data`
export NRLDB_LOG=$(get_apps_defaults nrldb_log)
export NRLDB_CONFIG=$(get_apps_defaults nrldb_config)
export db_name=$(get_apps_defaults db_name)
export NRLDB_TMP=$(get_apps_defaults nrldb_tmp)
export PGUSER=awips
# get the nrldb host and wfo from the nrldb.conf file/database
nrldb_host=`grep nrldb_host $NRLDB_CONFIG/nrldb.conf | cut -d= -f2 | sed 's/"//g' | sed 's/ //g'`
wfo=`psql -d $db_name -c "select hsa from admin;" | tail -3 | head -1 | sed -e 's/ //g'`
echo "DB NAME: $db_name"
wfo=`psql -h $PGHOST -d $db_name -c "select hsa from admin;" | tail -3 | head -1 | sed -e 's/ //g'`
echo `date`
echo "WFO $wfo"
# create the final SQL file that will be sent to the NRLDB host
timestamp=`date +%Y%m%d%H%N`
@ -90,7 +84,7 @@ then
touch $NRLDB_TMP/update.txt
chmod ugo+rw $NRLDB_TMP/update.txt
ls -l $NRLDB_TMP/update.txt
psql -d $db_name -c "copy (select * from $table where lid = '$lid') to '$NRLDB_TMP/update.txt' with delimiter '|';"
psql -h $PGHOST -d $db_name -c "copy (select * from $table where lid = '$lid') to '$NRLDB_TMP/update.txt' with delimiter '|';"
cp $NRLDB_TMP/update.txt ${NRLDB_DATA}/update.txt
sed -f ${NRLDB_CONFIG}/sed_script.txt ${NRLDB_TMP}/update.txt > ${NRLDB_DATA}/update11.txt
sed -e "s/|/'|'/g" ${NRLDB_DATA}/update11.txt > ${NRLDB_DATA}/update1.txt
@ -118,7 +112,7 @@ then
sql_stmt="update location set lid = '$lid'"
for col in county coe cpm detail elev hdatum hsa hu lat lon lremark lrevise name network rb rfc sbd sn state waro wfo wsfo type des det post stntype tzone
do
psql -d $db_name -c "select $col from location where lid = '$lid' and $col is not null;" > ${NRLDB_DATA}/update.txt
psql -h $PGHOST -d $db_name -c "select $col from location where lid = '$lid' and $col is not null;" > ${NRLDB_DATA}/update.txt
ct_zero=`grep -c "0 row" ${NRLDB_DATA}/update.txt`
if [ $ct_zero -eq 0 ]
then
@ -135,7 +129,7 @@ then
sql_stmt="update riverstat set lid = '$lid'"
for col in primary_pe bf cb da response_time threshold_runoff fq fs gsno level mile pool por rated lat lon remark rrevise rsource stream tide backwater vdatum action_flow wstg zd ratedat usgs_ratenum uhgdur use_latest_fcst
do
psql -d $db_name -c "select $col from riverstat where lid = '$lid' and $col is not null;" > ${NRLDB_DATA}/update.txt
psql -h $PGHOST -d $db_name -c "select $col from riverstat where lid = '$lid' and $col is not null;" > ${NRLDB_DATA}/update.txt
ct_zero=`grep -c "0 row" ${NRLDB_DATA}/update.txt`
if [ $ct_zero -eq 0 ]
then

View file

@ -15,12 +15,11 @@ use warnings;
use AppConfig qw(:expand :argcount);
use DBI;
$ENV{EDEX_HOME}="/awips2/edex";
$ENV{apps_dir}="/awips2/edex/data/share/hydroapps";
our $BIN_DIR = `get_apps_defaults.LX whfs_bin_dir`;
our $BIN_DIR = `echo \$BIN_DIR`;
chomp($BIN_DIR);
our $LOG_DIR = `get_apps_defaults.LX nrldb_log`;
chomp($LOG_DIR);
our $NRLDB_LOG = `echo \$NRLDB_LOG`;
chomp($NRLDB_LOG);
my $lids;
my $tables;
@ -104,7 +103,6 @@ our @lid_list; # = ($wildcard);
#get the data from the DB
get_results($qhw,\@lid_list);
#print "ct: " . @lid_list;
#set up a static array with the tables that are allowed for ad-hoc updates
#table_list is the actual name of the DB tables, while tabledesc is a friendlier description that is displayed to the user
@ -120,27 +118,17 @@ $index=0;
my $num_lids=scalar(@lid_list);
while ($index < $num_lids){
my $line = $lid_list[$index];
# print "line: $line\n";
my @results = split('\|',$line);
#my $lid = $lid_list[$index];
my $lid_lid = $results[0];
my $lid_name = $results[1];
my $lid_hsa = $results[2];
# print "lid: $lid_lid name: $lid_name hsa: $lid_hsa\n";
push(@liddeschsa,"$lid_hsa | $lid_lid | $lid_name");
push(@lidsend,$lid_lid);
$index++;
}
# Create the GUI object
#my $mw = MainWindow->new;
#$mw->title('Ad-Hoc NRLDB Update');
#my $lst_lab= $mw->Label(-text => 'Locations List: ');
#my $lst_rad_riv = $mw-> Radiobutton(-text=>'AHPS River Points',
# -value=>'river', -variable=>\$list_type);
#my $lst_rad_precip = $mw-> Radiobutton(-text=>'Precip Points',
# -value=>'precip', -variable=>\$list_type);
# Labels for the LID and table scroll boxes
my $misc_ent = $mw->Entry();
my $label1 = $mw->Label(-text => 'HSA|LID|Location Name');
@ -169,13 +157,11 @@ my $update_list = $mw->Button(-text => 'Update List', -command => \&upd_list);
# create the label and text box for the last pdate window
my $status_box = $mw->Text(-width=>20, -height=>3);
my $lb_status = $mw->Label(-width=>20, -height=>3,-text=>"Last Ad-Hoc Update:");
my $last_update = `cat $LOG_DIR/last_nrldb_update.txt`;
my $last_update = `cat $NRLDB_LOG/last_nrldb_update.txt`;
$status_box->insert('end',"$last_update");
# Crate the GUI using grid to specify the physical locations of the objects
#$lst_rad_riv->grid(-row=>1, -column=>2, -columnspan=>1);
#$lst_rad_precip->grid(-row=>1, -column=>3, -columnspan=>1);
$label1->grid(-row=>1, -column=>1, -columnspan=>3) ;
$label2->grid(-row=>1, -column=>4) ;
$lb1->grid(-row=>2, -column=>1, -columnspan=>3, -sticky=>"ew") ;#pack;
@ -192,12 +178,6 @@ MainLoop;
# End of main
#
#sub upd_list {
# $mw => 'destroy';
# my $cmd = "${DIR}/update_nrldb.pl.exp $list_type\n";
# print "cmd: $cmd\n";
# system($cmd);
#}
# The Send button functionality function
sub send_button {
@ -226,17 +206,14 @@ sub send_button {
$tables .= "," . $table_list[$Tableindex[$index]];
$index++;
}
# print "l0: ${lid_list[$LIDindex[0]]} t0: ${table_list[$Tableindex[0]]} lids: $lids tables: $tables\n";
# Create the call to the script and execute it using system()
my $cmd = "${BIN_DIR}/send_nrldb_update.sh -table $tables -lid $lids > ${LOG_DIR}/send_nrldb_update.log\n";
# print "cmd: $cmd\n";
my $cmd = "${BIN_DIR}/send_nrldb_update.sh -table $tables -lid $lids > ${NRLDB_LOG}/send_nrldb_update.log\n";
system($cmd);
# Create a dialog box to inform the user that their data has been sent
my $dsend=$mw->Dialog(-title=>'Sent NRLDB Update',-buttons=>['OK']);
my $text_field="NRLDB Update Sent for LIDs: $lids \n and tables: $tables\n";
# my $addbox=$dsend->('Label',-text=>"$text_field")->pack(-side => 'left',-fill => 'both',-expand => 1);
my $box=$dsend->add('Label',-text=>"$text_field")->pack(-side => 'left',-fill => 'both',-expand => 1);
my $button = $dsend->Show;
}
@ -247,7 +224,6 @@ sub get_results
my $array = shift;
my $record;
#print "qh: $qh\n";
if(defined $qh) {
if($qh->execute(@_)) {
while($record = $qh->fetchrow_arrayref) {
@ -256,7 +232,6 @@ sub get_results
}
} else {
warn $DBI::errstr;
# print $qh->errstr;
}
} else { warn "unable to prepare query \"$sql\"\n"; }
}
@ -265,10 +240,9 @@ sub get_results
sub show_log
{
use Tk::Dialog;
my $text_field=`cat ${LOG_DIR}/send_nrldb_update.log`;
my $text_field=`cat ${NRLDB_LOG}/send_nrldb_update.log`;
my $d = $mw->Dialog(-title=>'Show Log',-buttons => ['OK']);
my $box=$d->add('Label',-text=>"$text_field")->pack(-side => 'left',-fill => 'both',-expand => 1);
my $button = $d->Show;
# exit;
}

View file

@ -1,55 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="gpdDecoder" class="gov.noaa.nws.ncep.edex.plugin.gpd.decoder.GenericPointDataDecoder">
<property name="pluginName" value="gpd" />
</bean>
<bean id="gpdCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="gpd-camel"/>
</bean>
<camelContext id="gpd-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<endpoint id="gpdEndpoint" uri="file:${edex.home}/data/sbn/gpd?noop=true&amp;idempotent=false" />
<route id="gpdFileConsumerRoute">
<from ref="gpdEndpoint" />
<bean ref="fileToString" />
<setHeader headerName="pluginName">
<constant>gpd</constant>
</setHeader>
<to uri="jms-generic:queue:ingest.gpd" />
</route>
<route id="gpdIngestRoute">
<from uri="jms-generic:queue:ingest.gpd" />
<setHeader headerName="pluginName">
<constant>gpd</constant>
</setHeader>
<bean ref="stringToFile" />
<doTry>
<pipeline>
<bean ref="gpdDecoder" method="decodeXmlProdFmSbn" />
<!-- multicast>
<to uri="directvm:persistIndexAlert" />
</multicast-->
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:ncuair?level=ERROR" />
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -1,3 +1,4 @@
* 10/2013 B. Hebbard Modify model name inference from metafile name
package gov.noaa.nws.ncep.edex.plugin.ntrans.decoder;
import gov.noaa.nws.ncep.common.dataplugin.ntrans.NtransRecord;
@ -366,6 +367,61 @@ public class NtransDecoder extends AbstractDecoder {
*/
}
private enum Model {
//TODO - Remove this, to make decoder agnostic w.r.t. list of available models.
// We do this temporarily because we don't yet know the possible formats
// of filename strings we're going to be fed, so for now we just look for
// known model names appearing anywhere in the file name.
// NOTE: Sequence is important only insofar as any model name must appear
// after all model names of which it is a proper substring.
// Also, OPC_ENC comes first, since its metafiles may contain other
// model substrings
OPC_ENS,
CMCE_AVGSPR,
CMCE,
CMCVER,
CMC,
CPC,
DGEX,
ECENS_AVGSPR,
ECENS,
ECMWFVER,
ECMWF_HR,
ECMWF,
ENSVER,
FNMOCWAVE,
GDAS,
GEFS_AVGSPR,
GEFS,
GFSP,
GFSVERP,
GFSVER,
GFS,
GHM,
HPCQPF,
HPCVER,
HWRF,
ICEACCR,
JMAP,
JMA,
MEDRT,
NAEFS,
NAM20,
NAM44,
NAMVER,
NAM,
NAVGEM,
NOGAPS,
NWW3P,
NWW3,
RAPP,
RAP,
SREFX,
SST,
UKMETVER,
UKMET,
VAFTAD };
private String inferModel(String fileName) {
// Infer the model name from the file name
@ -384,13 +440,30 @@ public class NtransDecoder extends AbstractDecoder {
fileName.contains("_GFS")) {
modelName = "vaftad";
} else if (fileName.contains("_2")) {
/*
modelName = fileName.substring(0, fileName.indexOf("_2"));
if (modelName.equals("jma")) {
modelName = "jmap";
}
}
return modelName;
*/
else {
for (Model model : Model.values()) {
if (fileName.toLowerCase().contains(model.name().toLowerCase())) {
modelName = model.name().toLowerCase();
break;
}
}
if (modelName.equals("jma")) {
modelName = "jmap";
}
return modelName;
}
return "other"; // unrecognized
}
private ByteOrder determineEndianess(ByteBuffer byteBuffer) {

View file

@ -41,12 +41,13 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
//import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.vividsolutions.jts.geom.Coordinate;
//import com.raytheon.uf.viz.core.drawables.IRenderable;
/**
* An abstract resource for displays where each grid cell is an individual
* IImage. Handles progressive disclosure algorithm.
@ -68,10 +69,11 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
public abstract class AbstractGriddedDisplay<T> { // implements IRenderable
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractGriddedDisplay.class);
private static final IUFStatusHandler statusHandler = UFStatus.getHandler(AbstractGriddedDisplay.class);
private final Queue<Coordinate> calculationQueue;
private CalculationJob calculationJob;
@ -89,13 +91,15 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
protected RGB color;
protected int skipx;
protected int skipy;
protected double filter;
protected double magnification = 1.0;
private boolean async = true;
protected boolean[] isPlotted;
/**
@ -105,22 +109,19 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
* @param size
*/
public AbstractGriddedDisplay(IMapDescriptor descriptor,
GeneralGridGeometry gridGeometryOfGrid,int nx, int ny) {
GeneralGridGeometry gridGeometryOfGrid, int nx, int ny) {
this.calculationQueue = new ConcurrentLinkedQueue<Coordinate>();
this.descriptor = descriptor;
this.gridGeometryOfGrid = gridGeometryOfGrid;
// this.size = size;
this.gridDims = new int[] {
nx,
ny };
// this.size = size;
this.gridDims = new int[] { nx, ny };
isPlotted = new boolean[gridDims[0] * gridDims[1]];
}
public void setASync(boolean async) {
@ -134,106 +135,104 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
*/
// @Override
public void paint(NcgridResourceData gridRscData, IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
boolean globalModel = isGlobalModel();
/**
* Get filter attribute
// @Override
public void paint(NcgridResourceData gridRscData, IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
boolean globalModel = isGlobalModel();
/**
* Get filter attribute
*/
String den = gridRscData.getFilter();
String noFilter = "";
if (den != null ){
try {
if (den.equalsIgnoreCase("YES") || den.equalsIgnoreCase("Y")) {
filter = 1.0;
}
else if (den.equalsIgnoreCase("NO") || den.equalsIgnoreCase("N") || den.equalsIgnoreCase("")) {
filter = 0.0;
noFilter = "NO";
}
else {
filter = Double.parseDouble(den);
}
if (filter == 0)
noFilter = "NO";
if (filter <0.1)
filter = 0.1;
}
catch (NumberFormatException e) {
System.out.println("The filter is not a double number");
filter = 1.0;
}
}
else {
filter = 1.0;
}
// /**
// * Get skip attribute
// */
//
// String[] skip = null;
// int skipx = 0;
// int skipy = 0;
//
// String skipString = gridRscData.getSkip(); //now for positive skip
// if (skipString != null && noFilter.equalsIgnoreCase("NO")) {
// int ind = skipString.indexOf("/");
// if (ind != -1) {
// skipString = skipString.substring(ind +1);
//
// if (skipString.trim().startsWith("-")) //temp fix for negative value
// skipString = skipString.substring(1);
//
// skip = skipString.split(";");
//
// if (skip != null && skip.length !=0){
// try {
// skipx = Integer.parseInt(skip[0]);
// }
// catch (NumberFormatException e) {
// System.out.println("The skip is not an interger");
// skipx = 0;
// }
//
// if (skip.length ==1 ) {
// skipy = skipx;
// }
// if (skip.length >1 && skip[0] != skip[1]) {
// try {
// skipy = Integer.parseInt(skip[1]);
// }
// catch (NumberFormatException e) {
// System.out.println("The skip is not an interger");
// skipy = skipx;
// }
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
//
for (int i = 0; i < (gridDims[0] * gridDims[1]); i++)
isPlotted[i] = false;
String den = gridRscData.getFilter();
String noFilter = "";
if (den != null) {
try {
if (den.equalsIgnoreCase("YES") || den.equalsIgnoreCase("Y")) {
filter = 1.0;
} else if (den.equalsIgnoreCase("NO")
|| den.equalsIgnoreCase("N")
|| den.equalsIgnoreCase("")) {
filter = 0.0;
noFilter = "NO";
} else {
filter = Double.parseDouble(den);
}
if (filter == 0)
noFilter = "NO";
if (filter < 0.1)
filter = 0.1;
} catch (NumberFormatException e) {
System.out.println("The filter is not a double number");
filter = 1.0;
}
} else {
filter = 1.0;
}
// /**
// * Get skip attribute
// */
//
// String[] skip = null;
// int skipx = 0;
// int skipy = 0;
//
// String skipString = gridRscData.getSkip(); //now for positive skip
// if (skipString != null && noFilter.equalsIgnoreCase("NO")) {
// int ind = skipString.indexOf("/");
// if (ind != -1) {
// skipString = skipString.substring(ind +1);
//
// if (skipString.trim().startsWith("-")) //temp fix for negative value
// skipString = skipString.substring(1);
//
// skip = skipString.split(";");
//
// if (skip != null && skip.length !=0){
// try {
// skipx = Integer.parseInt(skip[0]);
// }
// catch (NumberFormatException e) {
// System.out.println("The skip is not an interger");
// skipx = 0;
// }
//
// if (skip.length ==1 ) {
// skipy = skipx;
// }
// if (skip.length >1 && skip[0] != skip[1]) {
// try {
// skipy = Integer.parseInt(skip[1]);
// }
// catch (NumberFormatException e) {
// System.out.println("The skip is not an interger");
// skipy = skipx;
// }
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
// }
// else {
// skipx = 0;
// skipy = 0;
// }
//
for (int i = 0; i < (gridDims[0] * gridDims[1]); i++)
isPlotted[i] = false;
// Controls whether to draw images or debugging output on the map
// boolean debug = false;
// boolean debug = false;
this.target = target;
PaintProperties pp = new PaintProperties(paintProps);
@ -242,8 +241,8 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
IExtent viewPixelExtent = paintProps.getView().getExtent();
double ratio = viewPixelExtent.getWidth()
/ paintProps.getCanvasBounds().width;
//double interval = size * .75 * ratio / Math.min(2.0, filter);
// double interval = size * .75 * ratio / Math.min(2.0, filter);
double interval = size * .75 * ratio * filter;
double adjSize = size * ratio * magnification;
@ -284,18 +283,15 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
}
jcount++;
/*
if (debug == true) {
// Draw a red labeled square over the area where
// we will look for grid points
target.drawString(null, icount + "," + jcount, i, j,
0.0, TextStyle.NORMAL, new RGB(255, 0, 0),
HorizontalAlignment.CENTER,
VerticalAlignment.MIDDLE, 0.0);
target.drawRect(new PixelExtent(i - halfInterval, i
+ halfInterval, j - halfInterval, j
+ halfInterval), new RGB(255, 0, 0), 1, 1);
}
*/
* if (debug == true) { // Draw a red labeled square over
* the area where // we will look for grid points
* target.drawString(null, icount + "," + jcount, i, j, 0.0,
* TextStyle.NORMAL, new RGB(255, 0, 0),
* HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE,
* 0.0); target.drawRect(new PixelExtent(i - halfInterval, i
* + halfInterval, j - halfInterval, j + halfInterval), new
* RGB(255, 0, 0), 1, 1); }
*/
// Get a grid coordinate near i, j
ReferencedCoordinate coordToTry = new ReferencedCoordinate(
this.descriptor.getGridGeometry(), new Coordinate(
@ -304,23 +300,27 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
gridGeometryOfGrid, PixelInCell.CELL_CORNER);
gridCell.y = Math.round(gridCell.y);
gridCell.x = Math.round(gridCell.x);
// System.out.println("Look--" + i + " , " + j);
// System.out.println("grid--" + gridCell.x + " , "
// + gridCell.y);
/*
* Convert negative longitude
*/
Coordinate coord = coordToTry.asLatLon();
double x = coord.x;
if (globalModel && x < 0) {
x = x + 360;
x = x + 360;
}
Coordinate newCoord = new Coordinate(x, coord.y);
ReferencedCoordinate newrco = new ReferencedCoordinate(newCoord);
// System.out.println("latlon: " + newCoord);
ReferencedCoordinate newrco = new ReferencedCoordinate(
newCoord);
Coordinate newGridCell = newrco.asGridCell(
gridGeometryOfGrid, PixelInCell.CELL_CORNER);
newGridCell.x = Math.round(newGridCell.x);
/*
* Check for bounds
*/
@ -328,33 +328,33 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
|| (gridCell.y < 0 || gridCell.y >= gridDims[1])) {
thisRow.put(j, i);
continue;
}
ReferencedCoordinate rco = new ReferencedCoordinate(
new Coordinate((int)gridCell.x, (int)gridCell.y),
this.gridGeometryOfGrid, Type.GRID_CORNER);
Coordinate plotLoc = rco.asPixel(this.descriptor.getGridGeometry());
Coordinate gridCell2 = rco.asGridCell(
gridGeometryOfGrid, PixelInCell.CELL_CORNER);
// Coordinate plotLoc = coordToTry.asPixel(this.descriptor
// .getGridGeometry());
new Coordinate((int) gridCell.x, (int) gridCell.y),
this.gridGeometryOfGrid, Type.GRID_CORNER);
Coordinate plotLoc = rco.asPixel(this.descriptor
.getGridGeometry());
Coordinate gridCell2 = rco.asGridCell(gridGeometryOfGrid,
PixelInCell.CELL_CORNER);
// System.out.println("gridcell: " + gridCell);
// System.out.println("gridcell2: " + gridCell2);
// Coordinate plotLoc = coordToTry.asPixel(this.descriptor
// .getGridGeometry());
/*
if (debug == true) {
// draw a blue dot where the gridpoints are found.
target.drawString(null, ".", plotLoc.x, plotLoc.y, 0.0,
TextStyle.NORMAL, new RGB(0, 0, 255),
HorizontalAlignment.CENTER,
VerticalAlignment.BOTTOM, 0.0);
}
*/
* if (debug == true) { // draw a blue dot where the
* gridpoints are found. target.drawString(null, ".",
* plotLoc.x, plotLoc.y, 0.0, TextStyle.NORMAL, new RGB(0,
* 0, 255), HorizontalAlignment.CENTER,
* VerticalAlignment.BOTTOM, 0.0); }
*/
// If the real loc of this grid coordinate is close to the
// loc we wanted go with it
if (Math.abs(plotLoc.y - j) < (interval/2)
&& Math.abs(plotLoc.x - i) < (interval/2)) {
if (Math.abs(plotLoc.y - j) < (interval / 2)
&& Math.abs(plotLoc.x - i) < (interval / 2)) {
j = plotLoc.y;
thisRow.put(j, plotLoc.x);
} else {
@ -362,21 +362,24 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
continue;
}
/*
if (debug == true) {
// Draw a green label where the image will actually be
// drawn
target.drawString(null, icount + "," + jcount,
plotLoc.x, plotLoc.y, 0.0, TextStyle.NORMAL,
new RGB(0, 255, 0), HorizontalAlignment.CENTER,
VerticalAlignment.MIDDLE, 0.0);
}
*/
* if (debug == true) { // Draw a green label where the
* image will actually be // drawn target.drawString(null,
* icount + "," + jcount, plotLoc.x, plotLoc.y, 0.0,
* TextStyle.NORMAL, new RGB(0, 255, 0),
* HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE,
* 0.0); }
*/
T oldImage = getImage(gridCell2);
if (oldImage != null) {
// if (debug == false) {
paintImage((int)gridCell.x, (int)gridCell.y, pp, adjSize);
// }
// if (debug == false) {
if (globalModel)
paintGlobalImage((int) gridCell.x,
(int) gridCell.y, pp, adjSize);
else
paintImage((int) gridCell.x, (int) gridCell.y, pp,
adjSize);
// }
} else {
if (async) {
if (!this.calculationQueue.contains(gridCell2)) {
@ -384,17 +387,22 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
}
} else {
T image = createImage(gridCell2);
if (image != null /*&& debug == false*/) {
paintImage((int)gridCell.x, (int)gridCell.y, pp, adjSize);
if (image != null /* && debug == false */) {
if (globalModel)
paintGlobalImage((int) gridCell.x,
(int) gridCell.y, pp, adjSize);
else
paintImage((int) gridCell.x,
(int) gridCell.y, pp, adjSize);
}
}
}
}
}
} //while
} // while
} catch (Exception e) {
throw new VizException("Error occured during paint", e);
}
if (calculationQueue.size() > 0) {
if (this.calculationJob == null) {
this.calculationJob = new CalculationJob();
@ -429,8 +437,13 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
*/
protected abstract void disposeImages();
protected abstract void paintImage(int x, int y, PaintProperties paintProps,
double adjustedSize) throws VizException;
protected abstract void paintImage(int x, int y,
PaintProperties paintProps, double adjustedSize)
throws VizException;
protected abstract void paintGlobalImage(int x, int y,
PaintProperties paintProps, double adjustedSize)
throws VizException;
public void dispose() {
disposeImages();
@ -451,7 +464,7 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
/**
* @param filter
* the filter to set. Changed from density.
* the filter to set. Changed from density.
*/
public boolean setFilter(double filter) {
if (this.filter != filter) {
@ -461,16 +474,15 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
return false;
}
public float getSize() {
return size;
}
return size;
}
public void setSize(float size) {
this.size = size;
}
public void setSize(float size) {
this.size = size;
}
/**
/**
* @param magnification
* the magnification to set
*/
@ -482,38 +494,36 @@ public abstract class AbstractGriddedDisplay<T> { //implements IRenderable
return false;
}
private boolean isGlobalModel() throws VizException {
ReferencedCoordinate newrco0 = new ReferencedCoordinate(
new Coordinate(0, 0),
this.gridGeometryOfGrid, Type.GRID_CORNER);
ReferencedCoordinate newrco1 = new ReferencedCoordinate(
new Coordinate(gridDims[0] - 1, 0),
this.gridGeometryOfGrid, Type.GRID_CORNER);
ReferencedCoordinate newrco2 = new ReferencedCoordinate(
new Coordinate(1, 0),
this.gridGeometryOfGrid, Type.GRID_CORNER);
try {
Coordinate latLon0 = newrco0.asLatLon();
Coordinate latLon1 = newrco1.asLatLon();
Coordinate latLon2 = newrco2.asLatLon();
double dx1 = latLon2.x - latLon0.x;
double dx2 = (360 - latLon1.x) + latLon0.x;
int dx = (int) Math.round(dx2/dx1);
int dlat = (int) Math.round(latLon1.y - latLon0.y);
ReferencedCoordinate newrco0 = new ReferencedCoordinate(new Coordinate(
0, 0), this.gridGeometryOfGrid, Type.GRID_CORNER);
ReferencedCoordinate newrco1 = new ReferencedCoordinate(new Coordinate(
gridDims[0] - 1, 0), this.gridGeometryOfGrid, Type.GRID_CORNER);
ReferencedCoordinate newrco2 = new ReferencedCoordinate(new Coordinate(
1, 0), this.gridGeometryOfGrid, Type.GRID_CORNER);
if (dx <= 2 && dlat == 0) return true;
} catch (Exception e) {
throw new VizException(e);
}
return false;
try {
Coordinate latLon0 = newrco0.asLatLon();
Coordinate latLon1 = newrco1.asLatLon();
Coordinate latLon2 = newrco2.asLatLon();
double dx1 = latLon2.x - latLon0.x;
double dx2 = (360 - latLon1.x) + latLon0.x;
int dx = (int) Math.round(dx2 / dx1);
int dlat = (int) Math.round(latLon1.y - latLon0.y);
if (dx <= 2 && dlat == 0)
return true;
} catch (Exception e) {
throw new VizException(e);
}
return false;
}
/**
* Off UI Thread job for calculating the wind images
*

View file

@ -212,7 +212,8 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay<Coordinate> {
int idx = x + y * this.gridDims[0];
// System.out.println("paintImage idx==="+idx+" x=="+ijcoord.x+" y====="+ijcoord.y);
// System.out.println("INDEX " + idx + " : " + x + "," + y + " : "
// + gridDims[0] + "," + gridDims[1]);
if (idx < 0 || idx >= (gridDims[0] * gridDims[1])) {
return;
}
@ -623,4 +624,93 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay<Coordinate> {
}
return match;
}
@Override
/*
* HACK hack hack ... this version of paintImage is being used for global
* grids. I don't think the grid <-> latlon transforms are working, so the
* index calculation has been modified. This is not a good solution, but was
* implemented due to time crunch for 13.5.2
*/
protected void paintGlobalImage(int x, int y, PaintProperties paintProps,
double adjSize) throws VizException {
int adjx = x - 1;
// if (x > 0)
// adjx = 180 + x;
int adjy = y + 1;
if (x > 0) {
adjx++;
adjy = y;
}
int idx = adjx + adjy * this.gridDims[0];
// System.out.println("paintImage idx==="+idx+" x=="+ijcoord.x+" y====="+ijcoord.y);
// System.out.println("INDEX " + idx + " : " + x + "," + y + " : " +
// adjx
// + "," + adjy + " : " + gridDims[0] + "," + gridDims[1]);
if (idx < 0 || idx >= (gridDims[0] * gridDims[1])) {
return;
}
float spd = this.magnitude.get(idx);
float dir = this.direction.get(idx);
if (Float.isNaN(spd) || Float.isNaN(dir)) {
return;
}
if (this.isPlotted[idx]) {
return;
}
ReferencedCoordinate newrco = new ReferencedCoordinate(new Coordinate(
x, y), this.gridGeometryOfGrid, Type.GRID_CENTER);
Coordinate plotLoc = null;
try {
plotLoc = newrco.asPixel(this.descriptor.getGridGeometry());
latLon = newrco.asLatLon();
// System.out.println("plotloc = " + latLon);
if (latLon.x > 180 || latLon.x < -180 || latLon.y < -90
|| latLon.y > 90) {
return;
}
double[] stationLocation = { latLon.x, latLon.y };
double[] stationPixelLocation = this.descriptor
.worldToPixel(stationLocation);
if (stationPixelLocation != null) {
stationPixelLocation[1]--;
double[] newWorldLocation = this.descriptor
.pixelToWorld(stationPixelLocation);
this.gc.setStartingGeographicPoint(stationLocation[0],
stationLocation[1]);
this.gc.setDestinationGeographicPoint(newWorldLocation[0],
newWorldLocation[1]);
}
dir = dir + (float) MapUtil.rotation(latLon, gridLocation);
dir -= this.gc.getAzimuth();
} catch (Exception e) {
throw new VizException(e);
}
dir = (float) Math.toRadians(dir);
switch (displayType) {
case ARROW:
paintArrow(plotLoc, adjSize, spd, dir);
break;
case BARB:
paintBarb(plotLoc, adjSize, spd, dir);
break;
case DUALARROW:
paintDualArrow(plotLoc, adjSize, spd, dir);
break;
default:
throw new VizException("Unsupported disply type: " + displayType);
}
this.isPlotted[idx] = true;
}
}

View file

@ -1,8 +0,0 @@
/awips2/httpd_pypies/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd-pypies reload > /dev/null 2>/dev/null || true
endscript
}

View file

@ -8,12 +8,11 @@ Summary: Pypies Apache HTTP Server
Name: awips2-httpd-pypies
Version: 2.2.3
# This Is Officially Release: 22%{?dist}
Release: 30%{?dist}
Release: 31%{?dist}
URL: http://httpd.apache.org/
Prefix: /awips2/httpd_pypies
Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
Source1: centos_index.html
Source3: httpd-pypies.logrotate
Source4: httpd-pypies.init
Source5: httpd.sysconf
Source8: centos_powered_by_rh.png
@ -362,11 +361,11 @@ ln -s ../..%{_libdir}/httpd/modules $RPM_BUILD_ROOT/awips2/httpd_pypies/etc/http
mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
install -m755 %{_baseline_workspace}/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/init.d/httpd-pypies \
${RPM_BUILD_ROOT}/etc/init.d
# install log rotation stuff
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m644 $RPM_SOURCE_DIR/httpd-pypies.logrotate \
$RPM_BUILD_ROOT/etc/logrotate.d/httpd-pypies
# install cron job
mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily
install -m755 %{_baseline_workspace}/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/cron.daily/pypiesLogCleanup.sh \
${RPM_BUILD_ROOT}/etc/cron.daily
# fix man page paths
sed -e "s|/usr/local/apache2/conf/httpd.conf|/etc/httpd/conf/httpd.conf|" \
@ -571,7 +570,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) /awips2/httpd_pypies%{_sysconfdir}/httpd/conf.d/proxy_ajp.conf
%config(noreplace) /awips2/httpd_pypies%{_sysconfdir}/httpd/conf/magic
%config(noreplace) %{_sysconfdir}/logrotate.d/httpd-pypies
%{_sysconfdir}/cron.daily/pypiesLogCleanup.sh
%config(noreplace) %{_sysconfdir}/init.d/httpd-pypies
%dir /awips2/httpd_pypies%{_sysconfdir}/httpd/conf.d

View file

@ -469,7 +469,7 @@ HostnameLookups Off
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log
ErrorLog "|/awips2/httpd_pypies/usr/sbin/rotatelogs /awips2/httpd_pypies/var/log/httpd/error_log.%Y.%m.%d 86400"
#
# LogLevel: Control the number of messages logged to the error_log.
@ -511,7 +511,7 @@ LogFormat "%{User-agent}i" agent
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
CustomLog logs/access_log combined
CustomLog "|/awips2/httpd_pypies/usr/sbin/rotatelogs /awips2/httpd_pypies/var/log/httpd/access_log.%Y.%m.%d 86400" combined
#
# Optionally add a line containing the server version and virtual host

View file

@ -0,0 +1,19 @@
#!/bin/bash
# Remove any logs from a week ago, if they exist.
_PYPIES_LOG_DIRECTORY="/awips2/httpd_pypies/var/log/httpd"
_LOG_NAME_PREFIXES=( 'access_log' 'error_log' )
_COUNT_DAYS=( 7 8 9 10 11 12 13 14 )
for day in ${_COUNT_DAYS[*]}; do
_log_date=`date -d "-${day} day" +%Y.%m.%d`
for logPrefix in ${_LOG_NAME_PREFIXES[*]}; do
_log_file="${logPrefix}.${_log_date}"
echo "${_PYPIES_LOG_DIRECTORY}/${_log_file}"
rm -f ${_PYPIES_LOG_DIRECTORY}/${_log_file}
done
done

View file

@ -98,10 +98,30 @@ start() {
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
/awips2/httpd_pypies/usr/sbin/apachectl -k graceful-stop
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
echo -n $"Stopping logging service:"
# Stop the logging process
for pid in `ps aux | grep [l]ogProcess.py | awk '{print $2}'`;
do
kill -9 ${pid}
RC=$?
if [ ${RC} -ne 0 ]; then
failure
return
fi
done
success
echo
}
# When stopping httpd a delay of >10 second is required before SIGKILLing the
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
# errant children.
stop() {
forcestop() {
echo -n $"Stopping $prog: "
killproc -d 10 $httpd
RETVAL=$?
@ -128,7 +148,7 @@ reload() {
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc $httpd -HUP
/awips2/httpd_pypies/usr/sbin/apachectl -k graceful
RETVAL=$?
fi
echo
@ -142,6 +162,9 @@ case "$1" in
stop)
stop
;;
forcestop)
forcestop
;;
status)
status $httpd
RETVAL=$?
@ -164,7 +187,7 @@ case "$1" in
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
echo $"Usage: $prog {start|stop|forcestop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

View file

@ -85,7 +85,6 @@ if [ "${2}" = "-nobinlightning" ]; then
fi
if [ "${1}" = "-python-qpid" ]; then
buildRPM "awips2"
buildRPM "awips2-python-qpid"
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
@ -116,15 +115,6 @@ if [ "${1}" = "-python-qpid" ]; then
exit 1
fi
#buildRPM "awips2-ant"
#unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
#buildRPM "awips2-httpd-pypies"
#buildRPM "awips2-java"
#buildRPM "awips2-ldm"
#buildRPM "awips2-tools"
buildRPM "awips2-python-shapely"
exit 0
@ -164,7 +154,6 @@ if [ "${1}" = "-delta" ]; then
exit 1
fi
buildRPM "awips2"
buildRPM "awips2-ncep-database"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
@ -180,7 +169,6 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-maps-database"
buildRPM "awips2-notification"
@ -188,7 +176,6 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildRPM "awips2-rcm"
buildRPM "awips2-edex-environment"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
@ -229,8 +216,8 @@ if [ "${1}" = "-full" ]; then
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildRPM "awips2-python-shapely"
buildRPM "awips2"
buildRPM "awips2-adapt-native"
buildRPM "awips2-aviation-shared"
buildRPM "awips2-cli"
@ -267,14 +254,11 @@ if [ "${1}" = "-full" ]; then
buildRPM "awips2-httpd-pypies"
buildJava
buildRPM "awips2-groovy"
#buildRPM "awips2-ldm"
buildRPM "awips2-postgres"
buildRPM "awips2-pgadmin3"
buildRPM "awips2-tools"
buildRPM "awips2-edex-environment"
buildRPM "awips2-openfire"
buildRPM "awips2-httpd-collaboration"
buildRPM "awips2-python-shapely"
exit 0
fi
@ -360,9 +344,6 @@ if [ "${1}" = "-ade" ]; then
fi
if [ "${1}" = "-viz" ]; then
buildRPM "awips2-common-base"
buildRPM "awips2-rcm"
buildRPM "awips2-hydroapps-shared"
buildCAVE
if [ $? -ne 0 ]; then
exit 1
@ -373,13 +354,9 @@ if [ "${1}" = "-viz" ]; then
fi
if [ "${1}" = "-edex" ]; then
buildRPM "awips2-common-base"
buildRPM "awips2-adapt-native"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-edex-environment"
# buildRPM "awips2-ncep-database"
# buildRPM "awips2-python-dynamicserialize"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
@ -421,7 +398,18 @@ fi
# Use the custom flag for selecting specific rpms to build
if [ "${1}" = "-custom" ]; then
#buildRPM "awips2-ldm"
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
buildRPM "awips2-adapt-native"
buildRPM "awips2-hydroapps-shared"
buildRPM "awips2-common-base"
buildRPM "awips2-rcm"
#buildRPM "awips2-ant"
#buildRPM "awips2-java"
#buildRPM "awips2-tools"
exit 0
fi

View file

@ -116,7 +116,6 @@ if [ "${1}" = "-64bit" ]; then
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildJava
buildRPM "awips2"
buildRPM "awips2-python-shapely"
buildRPM "awips2-notification"
@ -155,7 +154,6 @@ if [ "${1}" = "-delta" ]; then
buildRPM "awips2-localapps-environment"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildRPM "awips2"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
@ -205,7 +203,6 @@ if [ "${1}" = "-full" ]; then
buildRPM "awips2-localapps-environment"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildRPM "awips2"
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
@ -250,6 +247,7 @@ fi
if [ "${1}" = "-edex" ]; then
buildRPM "awips2-common-base"
buildRPM "awips2-edex-environment"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
@ -273,6 +271,30 @@ if [ "${1}" = "-ldm" ]; then
exit 0
fi
if [ "${1}" = "-awips2" ]; then
buildRPM "awips2"
exit 0
fi
# Use the custom flag for selecting specific rpms to build
if [ "${1}" = "-custom" ]; then
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
buildRPM "awips2-adapt-native"
buildRPM "awips2-hydroapps-shared"
#buildRPM "awips2-ant"
#buildRPM "awips2-java"
#buildRPM "awips2-tools"
exit 0
fi
if [ "${1}" = "-package" ]; then
repository_directory="awips2-repository-${AWIPSII_VERSION}-${AWIPSII_RELEASE}"
if [ -d ${WORKSPACE}/${repository_directory} ]; then

View file

@ -0,0 +1,333 @@
#!/bin/bash
function buildRPM()
{
# Arguments:
# ${1} == the name of the rpm.
lookupRPM "${1}"
if [ $? -ne 0 ]; then
echo "ERROR: '${1}' is not a recognized AWIPS II RPM."
exit 1
fi
/usr/bin/rpmbuild -ba \
--define '_topdir %(echo ${AWIPSII_TOP_DIR})' \
--define '_baseline_workspace %(echo ${WORKSPACE})' \
--define '_uframe_eclipse %(echo ${UFRAME_ECLIPSE})' \
--define '_awipscm_share %(echo ${AWIPSCM_SHARE})' \
--define '_build_root %(echo ${AWIPSII_BUILD_ROOT})' \
--define '_component_version %(echo ${AWIPSII_VERSION})' \
--define '_component_release %(echo ${AWIPSII_RELEASE})' \
--define '_component_build_date %(echo ${COMPONENT_BUILD_DATE})' \
--define '_component_build_time %(echo ${COMPONENT_BUILD_TIME})' \
--define '_component_build_system %(echo ${COMPONENT_BUILD_SYSTEM})' \
--buildroot ${AWIPSII_BUILD_ROOT} \
${RPM_SPECIFICATION}/component.spec
if [ $? -ne 0 ]; then
echo "ERROR: Failed to build RPM ${1}."
exit 1
fi
return 0
}
# This script will build all of the 64-bit rpms.
# Ensure that we are on a machine with the correct architecture.
architecture=`uname -i`
if [ ! "${architecture}" = "x86_64" ]; then
echo "ERROR: This build can only be performed on a 64-bit Operating System."
exit 1
fi
# Determine which directory we are running from.
path_to_script=`readlink -f $0`
dir=$(dirname $path_to_script)
common_dir=`cd ${dir}/../common; pwd;`
if [ $? -ne 0 ]; then
echo "ERROR: Unable to find the common functions directory."
exit 1
fi
# source the common functions.
source ${common_dir}/lookupRPM.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/usage.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/rpms.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to source the common functions."
exit 1
fi
source ${common_dir}/systemInfo.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to retrieve the system information."
exit 1
fi
# prepare the build environment.
source ${dir}/buildEnvironment.sh
if [ $? -ne 0 ]; then
echo "ERROR: Unable to prepare the build environment."
exit 1
fi
export LIGHTNING=true
# Determine if the optional '-nobinlightning' argument has been specified.
if [ "${2}" = "-nobinlightning" ]; then
LIGHTNING=false
fi
if [ "${1}" = "-64bit" ]; then
buildRPM "awips2-common-base"
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-h5py"
buildRPM "awips2-python-jimporter"
buildRPM "awips2-python-matplotlib"
buildRPM "awips2-python-nose"
buildRPM "awips2-python-numpy"
buildRPM "awips2-python-pil"
buildRPM "awips2-python-pmw"
buildRPM "awips2-python-pupynere"
buildRPM "awips2-python-qpid"
buildRPM "awips2-python-scientific"
buildRPM "awips2-python-scipy"
buildRPM "awips2-python-tables"
buildRPM "awips2-python-thrift"
buildRPM "awips2-python-tpg"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildJava
buildRPM "awips2-python-shapely"
buildRPM "awips2-notification"
exit 0
fi
if [ "${1}" = "-postgres" ]; then
buildRPM "awips2-postgres"
buildRPM "awips2-database-server-configuration"
buildRPM "awips2-database-standalone-configuration"
buildRPM "awips2-database"
buildRPM "awips2-maps-database"
buildRPM "awips2-ncep-database"
buildRPM "awips2-pgadmin3"
exit 0
fi
if [ "${1}" = "-delta" ]; then
buildRPM "awips2-common-base"
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-cli"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-edex-environment"
buildRPM "awips2-notification"
exit 0
fi
if [ "${1}" = "-full" ]; then
buildRPM "awips2-common-base"
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-python"
buildRPM "awips2-python-cherrypy"
buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-h5py"
buildRPM "awips2-python-jimporter"
buildRPM "awips2-python-matplotlib"
buildRPM "awips2-python-nose"
buildRPM "awips2-python-numpy"
buildRPM "awips2-python-pil"
buildRPM "awips2-python-pmw"
buildRPM "awips2-python-pupynere"
buildRPM "awips2-python-qpid"
buildRPM "awips2-python-scientific"
buildRPM "awips2-python-scipy"
buildRPM "awips2-python-tables"
buildRPM "awips2-python-thrift"
buildRPM "awips2-python-tpg"
buildRPM "awips2-python-ufpy"
buildRPM "awips2-python-werkzeug"
buildRPM "awips2-python-pygtk"
buildRPM "awips2-python-pycairo"
buildRPM "awips2-cli"
buildRPM "awips2-data.hdf5-gfe.climo"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
buildRPM "awips2-localapps-environment"
buildRPM "awips2-data.hdf5-topo"
buildRPM "awips2-data.gfe"
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
buildJava
buildRPM "awips2-groovy"
buildLocalizationRPMs
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-edex-environment"
buildRPM "awips2-notification"
buildRPM "awips2-python-shapely"
buildRPM "awips2-postgres"
buildRPM "awips2-database"
buildRPM "awips2-maps-database"
buildRPM "awips2-ncep-database"
buildRPM "awips2-pgadmin3"
buildRPM "awips2-ldm"
exit 0
fi
if [ "${1}" = "-ade" ]; then
echo "INFO: AWIPS II currently does not support a 64-bit version of the ADE."
exit 0
buildRPM "awips2-eclipse"
exit 0
fi
if [ "${1}" = "-viz" ]; then
buildRPM "awips2-common-base"
buildCAVE
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-alertviz"
exit 0
fi
if [ "${1}" = "-edex" ]; then
buildRPM "awips2-common-base"
buildEDEX
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-qpid" ]; then
buildQPID
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
fi
if [ "${1}" = "-ldm" ]; then
buildRPM "awips2-ldm"
exit 0
fi
if [ "${1}" = "-awips2" ]; then
buildRPM "awips2"
exit 0
fi
# Use the custom flag for selecting specific rpms to build
if [ "${1}" = "-custom" ]; then
unpackHttpdPypies
if [ $? -ne 0 ]; then
exit 1
fi
buildRPM "awips2-httpd-pypies"
buildRPM "awips2-adapt-native"
buildRPM "awips2-hydroapps-shared"
exit 0
fi
if [ "${1}" = "-package" ]; then
repository_directory="awips2-repository-${AWIPSII_VERSION}-${AWIPSII_RELEASE}"
if [ -d ${WORKSPACE}/${repository_directory} ]; then
rm -rf ${WORKSPACE}/${repository_directory}
if [ $? -ne 0 ]; then
exit 1
fi
fi
mkdir -p ${WORKSPACE}/${repository_directory}/${AWIPSII_VERSION}-${AWIPSII_RELEASE}
if [ $? -ne 0 ]; then
exit 1
fi
cp -r ${AWIPSII_TOP_DIR}/RPMS/* \
${WORKSPACE}/${repository_directory}/${AWIPSII_VERSION}-${AWIPSII_RELEASE}
if [ $? -ne 0 ]; then
exit 1
fi
rpms_directory="${WORKSPACE}/rpms"
comps_xml="${rpms_directory}/common/yum/arch.x86_64/comps.xml"
cp -v ${comps_xml} ${WORKSPACE}/${repository_directory}
if [ $? -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
cd ${WORKSPACE}
tar -cvf ${repository_directory}.tar ${repository_directory}
RC=$?
popd > /dev/null
if [ ${RC} -ne 0 ]; then
exit 1
fi
exit 0
fi
usage
exit 0