Force sync of python files required by GFE perspective

This commit is contained in:
mjames-upc 2019-02-04 09:25:54 -07:00
parent 0c9d552513
commit 0a5fe069d0
5 changed files with 1568 additions and 55 deletions

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.gfe.core.internal;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -41,6 +42,7 @@ import org.eclipse.core.runtime.ListenerList;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID.DataType;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
@ -164,6 +166,8 @@ import com.raytheon.viz.gfe.types.MutableInteger;
* APIs.
* Mar 16, 2017 6092 randerso Made decodeDbString public for use in runProcedure.py
* Jan 08, 2018 19900 ryu Fix CAVE crash when starting GFE for non-activated site.
* Feb 01, 2019 ---- mjames Use only BASE level for now/dev.
* Feb 04, 2019 ---- mjames Force sync of python files required by GFE perspective.
*
* </pre>
*
@ -2908,33 +2912,59 @@ public class ParmManager implements IParmManager, IMessageClient {
private List<VCModule> initVirtualCalcParmDefinitions() {
// retrieve the inventory from the ifpServer
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext[] contexts = new LocalizationContext[] {
pathMgr.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.BASE),
pathMgr.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE),
pathMgr.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.USER) };
Map<String, LocalizationFile> modMap = new HashMap<>();
for (LocalizationContext context : contexts) {
LocalizationFile[] files = pathMgr.listFiles(context,
FileUtil.join("gfe", "vcmodule"), new String[] { "py" },
LocalizationContext context = pathMgr.getContext(
LocalizationType.COMMON_STATIC,
LocalizationLevel.BASE);
// vcmodule files
LocalizationFile[] files = pathMgr.listFiles(context,
"gfe/vcmodule", new String[] { "py" },
false, true);
for (LocalizationFile lf : files) {
String modName = LocalizationUtil.extractName(lf.getPath())
.replace(".py", "");
modMap.put(modName, lf);
}
String[] syncPaths = {
"python",
"python/time",
"python/dataaccess",
"gfe/vcmodule",
"gfe/vcmodule/utility",
"gfe/python",
"gfe/textproducts/templates/product",
"gfe/textproducts/templates",
"gfe/textproducts",
"vtec"
};
for (String path : syncPaths){
LocalizationFile[] baseGfeFiles = pathMgr.listFiles(context,
path, new String[] {"py" },
false, true);
for (LocalizationFile lf : files) {
String modName = LocalizationUtil.extractName(lf.getPath())
.replace(".py", "");
modMap.put(modName, lf);
for (LocalizationFile lf : baseGfeFiles) {
try {
File pyFile = lf.getFile(true);
} catch (LocalizationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
List<VCModule> definitions = new ArrayList<>(modMap.size());
for (Entry<String, LocalizationFile> entry : modMap.entrySet()) {
String modName = entry.getKey();
LocalizationFile modFile = entry.getValue();
try {
// gets the module from the ifpServer
modFile.getFile(true);
modFile.openInputStream();
// create the VCModule
statusHandler.debug("Loading VCModule: " + modFile);

View file

@ -1,23 +1,4 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#!/usr/bin/env python
#
# Globally import and sets up instances of the smart tool scripts.
# Designed to be used as a master controller for inspecting and running
@ -34,12 +15,6 @@
#
#
##
# This is a base file that is not intended to be overridden.
##
import numpy
import sys

View file

@ -42,7 +42,6 @@ import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.region.RegionLookup;
import com.raytheon.uf.common.protectedfiles.ProtectedFileLookup;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
@ -433,8 +432,6 @@ public class ReferenceMgr {
private LocalizationContext[] getSiteSearchContexts() {
String siteId = dbGridLocation.getSiteId();
String regionName = RegionLookup.getWfoRegion(siteId);
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext[] searchContexts = pm
.getLocalSearchHierarchy(LocalizationType.COMMON_STATIC);
@ -444,16 +441,8 @@ public class ReferenceMgr {
// Set context names on appropriate localization levels
for (LocalizationContext ctx : searchContexts) {
LocalizationLevel level = ctx.getLocalizationLevel();
if (((level.equals(LocalizationLevel.SITE))
|| (level.equals(LocalizationLevel.CONFIGURED)))) {
if (((level.equals(LocalizationLevel.SITE)) || (level.equals(LocalizationLevel.CONFIGURED)))) {
ctx.setContextName(siteId);
} else if (level.equals(LocalizationLevel.REGION)) {
if (regionName == null) {
// Don't include REGION context if no regionName
continue;
} else {
ctx.setContextName(regionName);
}
}
fixedContexts.add(ctx);

View file

@ -21,6 +21,7 @@ AutoReq: no
Provides: awips2-gfesuite
Requires: awips2-python-numpy
Requires: awips2-java
Requires: awips2-cave
Requires: xorg-x11-server-Xvfb
BuildRequires: awips2-ant
@ -91,7 +92,6 @@ if [ $? -ne 0 ]; then
exit 1
fi
%post
SETUP_ENV="/awips2/GFESuite/bin/setup.env"
SETUP_ENV_NEW="${SETUP_ENV}.rpmnew"