rm REGION, DESK, WORKSTATION localization levels
This commit is contained in:
parent
0a5fe069d0
commit
0cd7d7e322
10 changed files with 20 additions and 165 deletions
|
@ -84,9 +84,6 @@ public class ConfigurationManager {
|
|||
public static final ConfigContext DEFAULT_SITE_CONFIG = new ConfigContext(
|
||||
ConfigContext.DEFAULT_NAME, LocalizationLevel.SITE);
|
||||
|
||||
public static final ConfigContext DEFAULT_WORKSTATION_CONFIG = new ConfigContext(
|
||||
ConfigContext.DEFAULT_NAME, LocalizationLevel.WORKSTATION);
|
||||
|
||||
private static final String CONFIG_DIR = ConfigContext.ALERTVIZ_DIR
|
||||
+ IPathManager.SEPARATOR + ConfigContext.DEFAULT_SUBDIR;
|
||||
|
||||
|
@ -158,32 +155,13 @@ public class ConfigurationManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get default WORKSTATION configuration file for host machine. When it does
|
||||
* not exist create from Default SITE or BASE.
|
||||
* Get default config (SITE)
|
||||
*
|
||||
* @return hostContext
|
||||
*/
|
||||
private ConfigContext getDefaultHostContext() {
|
||||
ConfigContext workstationContext = DEFAULT_WORKSTATION_CONFIG;
|
||||
|
||||
try {
|
||||
ILocalizationFile file = getLocalizationFile(workstationContext);
|
||||
|
||||
if (file == null || !file.exists()) {
|
||||
ConfigContext sourceContext = DEFAULT_SITE_CONFIG;
|
||||
file = getLocalizationFile(sourceContext);
|
||||
|
||||
if (file == null || !file.exists()) {
|
||||
sourceContext = DEFAULT_BASE_CONFIG;
|
||||
}
|
||||
Configuration config = retrieveConfiguration(sourceContext);
|
||||
saveToFile(workstationContext, config);
|
||||
}
|
||||
} catch (NullPointerException ex) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Unable to load configuration context " + context, ex);
|
||||
}
|
||||
return workstationContext;
|
||||
ConfigContext siteContext = DEFAULT_SITE_CONFIG;
|
||||
return siteContext;
|
||||
}
|
||||
|
||||
public ConfigContext[] getConfigurations() {
|
||||
|
@ -271,7 +249,7 @@ public class ConfigurationManager {
|
|||
}
|
||||
if (configurationMap.containsKey(context)) {
|
||||
if (current.equals(context)) {
|
||||
loadAsCurrent(DEFAULT_WORKSTATION_CONFIG);
|
||||
loadAsCurrent(DEFAULT_SITE_CONFIG);
|
||||
}
|
||||
ILocalizationFile file = getLocalizationFile(context);
|
||||
try {
|
||||
|
@ -563,8 +541,7 @@ public class ConfigurationManager {
|
|||
}
|
||||
|
||||
public static boolean isDefaultConfig(ConfigContext context) {
|
||||
return DEFAULT_WORKSTATION_CONFIG.equals(context)
|
||||
|| DEFAULT_SITE_CONFIG.equals(context)
|
||||
|| DEFAULT_BASE_CONFIG.equals(context);
|
||||
return DEFAULT_SITE_CONFIG.equals(context)
|
||||
|| DEFAULT_BASE_CONFIG.equals(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,6 @@ public class AlertVizApplication implements IStandaloneComponent {
|
|||
protected void initializeLocalization() throws Exception {
|
||||
PathManagerFactory.setAdapter(new CAVELocalizationAdapter());
|
||||
new LocalizationInitializer(true, false).run();
|
||||
AlertVizLocalizationConfigurer.registerExtraLevels();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
**/
|
||||
package com.raytheon.uf.viz.product.alertviz;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.viz.core.ProgramArguments;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
|
||||
/**
|
||||
* Configures extra localization information for AlertViz. This whole class
|
||||
* exists to get around the fact that plugins can contribute custom localization
|
||||
* levels but AlertViz is not full of extra plugins and should not be full of
|
||||
* extra plugins. AlertViz still needs to respect localization levels to some
|
||||
* degree, hence this workaround class.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 21, 2015 4759 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AlertVizLocalizationConfigurer {
|
||||
|
||||
private static final String DESK = "DESK";
|
||||
|
||||
private AlertVizLocalizationConfigurer() {
|
||||
// don't allow instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers other localization levels that AlertViz may need but not have
|
||||
* plugins contributing.
|
||||
*/
|
||||
public static void registerExtraLevels() {
|
||||
/*
|
||||
* This code is borrowed from NmapCommon and NcPathManager. Should that
|
||||
* code change, this code should change.
|
||||
*/
|
||||
String deskName = ProgramArguments.getInstance().getString("-desk");
|
||||
if (deskName != null) {
|
||||
LocalizationLevel deskLevel = LocalizationLevel.createLevel(DESK,
|
||||
650);
|
||||
LocalizationManager.registerContextName(deskLevel, deskName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -667,43 +667,22 @@ public class AlarmAlertFunctions {
|
|||
}
|
||||
|
||||
/*
|
||||
* Try to load the workstation file. If there is no workstation file then
|
||||
* try to load the site file and create a new workstation file from it. If
|
||||
* there is no site file, then create a new default workstation file.
|
||||
* Try to load the site file.
|
||||
*/
|
||||
public static AAPACombined loadSiteAlarms(ILocalizationFileObserver listener) {
|
||||
LocalizationFile workstationFile = getFile(
|
||||
initLocalization(LocalizationLevel.WORKSTATION), SITE_FILE);
|
||||
AAPACombined aapaCombined = null;
|
||||
|
||||
if (workstationFile == null || !workstationFile.exists()) {
|
||||
// no workstation file found. try the site file
|
||||
LocalizationFile siteFile = getFile(initSiteLocalization(),
|
||||
SITE_FILE);
|
||||
if (siteFile == null) {
|
||||
aapaCombined = createDefaultAAPACombined();
|
||||
} else {
|
||||
try {
|
||||
aapaCombined = loadFile(siteFile.getFile());
|
||||
} catch (FileNotFoundException e) {
|
||||
aapaCombined = createDefaultAAPACombined();
|
||||
}
|
||||
}
|
||||
// save work file
|
||||
if (workstationFile != null) {
|
||||
saveAlarms(aapaCombined, workstationFile);
|
||||
}
|
||||
LocalizationFile siteFile = getFile(initSiteLocalization(), SITE_FILE);
|
||||
if (siteFile == null) {
|
||||
aapaCombined = createDefaultAAPACombined();
|
||||
} else {
|
||||
try {
|
||||
aapaCombined = loadFile(workstationFile.getFile());
|
||||
aapaCombined = loadFile(siteFile.getFile());
|
||||
} catch (FileNotFoundException e) {
|
||||
aapaCombined = createDefaultAAPACombined();
|
||||
}
|
||||
}
|
||||
|
||||
if (workstationFile != null) {
|
||||
workstationFile.addFileUpdatedObserver(listener);
|
||||
}
|
||||
return aapaCombined;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,10 +48,8 @@ CAVE_CONFIG = LocalizationType.CAVE_CONFIG
|
|||
COMMON_STATIC = LocalizationType.COMMON_STATIC
|
||||
|
||||
BASE = LocalizationLevel.BASE
|
||||
REGION = LocalizationLevel.REGION
|
||||
CONFIGURED = LocalizationLevel.CONFIGURED
|
||||
SITE = LocalizationLevel.SITE
|
||||
WORKSTATION = LocalizationLevel.WORKSTATION
|
||||
USER = LocalizationLevel.USER
|
||||
|
||||
def getLocalizationFile(loctype, loclevel, contextname, filename):
|
||||
|
@ -79,4 +77,4 @@ def writeFile(loctype, loclevel, contextname, filename, contents):
|
|||
|
||||
def deleteFile(loctype, loclevel, contextname, filename):
|
||||
localizationFile = getLocalizationFile(loctype, loclevel, contextname, filename)
|
||||
localizationFile.delete()
|
||||
localizationFile.delete()
|
||||
|
|
|
@ -317,8 +317,8 @@ public class GribPostProcessor {
|
|||
private synchronized void initProcessorMap() {
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationLevel[] levels = new LocalizationLevel[] {
|
||||
LocalizationLevel.BASE, LocalizationLevel.REGION,
|
||||
LocalizationLevel.CONFIGURED, LocalizationLevel.SITE };
|
||||
LocalizationLevel.BASE, LocalizationLevel.CONFIGURED,
|
||||
LocalizationLevel.SITE };
|
||||
|
||||
Map<LocalizationLevel, ? extends ILocalizationFile> files = pathMgr
|
||||
.getTieredLocalizationFile(LocalizationType.COMMON_STATIC,
|
||||
|
|
|
@ -438,8 +438,8 @@ public class PrecipAccumPostProcessor extends DecoderPostProcessor {
|
|||
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationLevel[] levels = new LocalizationLevel[] {
|
||||
LocalizationLevel.BASE, LocalizationLevel.REGION,
|
||||
LocalizationLevel.CONFIGURED, LocalizationLevel.SITE };
|
||||
LocalizationLevel.BASE, LocalizationLevel.CONFIGURED,
|
||||
LocalizationLevel.SITE };
|
||||
|
||||
Map<LocalizationLevel, ? extends ILocalizationFile> files = pathMgr
|
||||
.getTieredLocalizationFile(LocalizationType.COMMON_STATIC,
|
||||
|
|
|
@ -49,7 +49,6 @@ Import-Package: com.raytheon.uf.common.activetable,
|
|||
com.raytheon.uf.common.gridcoverage,
|
||||
com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.common.localization.exception,
|
||||
com.raytheon.uf.common.localization.region,
|
||||
com.raytheon.uf.common.message,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.python,
|
||||
|
|
|
@ -353,7 +353,6 @@ public class GfePyIncludeUtil extends PythonIncludePathUtil {
|
|||
}
|
||||
|
||||
public static String getVCModUtilsIncludePath() {
|
||||
return getPath(PATH_MANAGER.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.BASE), VCMOD_UTILS);
|
||||
return buildIncludePath(LocalizationType.COMMON_STATIC, VCMOD_UTILS, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,3 @@
|
|||
# #
|
||||
# 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.
|
||||
# #
|
||||
|
||||
#
|
||||
# The pure python module override solution. Merges multiple python modules retrieved
|
||||
# from localization.
|
||||
|
@ -31,10 +11,7 @@
|
|||
# 03/12/13 bkowal Initial Creation.
|
||||
# 02/17/14 2712 bkowal Provide a default value for localization site.
|
||||
# 03/19/14 2929 bkowal 'REGION' is now recognized as a valid localization level.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
# 02/04/19 mjames@ucar Removed REGION.
|
||||
#
|
||||
# TODO: Update to use the HTTP Rest Service to retrieve localization files instead
|
||||
# of thrift.
|
||||
|
@ -53,7 +30,7 @@ from dynamicserialize.dstypes.com.raytheon.uf.common.localization import Localiz
|
|||
from dynamicserialize.dstypes.com.raytheon.uf.common.localization.stream import LocalizationStreamGetRequest
|
||||
|
||||
BUFFER_SIZE = 512 * 1024
|
||||
availableLevels = ['BASE', 'REGION', 'CONFIGURED', 'SITE', 'USER']
|
||||
availableLevels = ['BASE', 'CONFIGURED', 'SITE', 'USER']
|
||||
|
||||
def importModule(name, localizationHost, localizationPort, localizedSite=None, localizationUser=None,
|
||||
loctype='COMMON_STATIC', level=None):
|
||||
|
@ -258,4 +235,4 @@ def _retrieveFileFromServer(localizationContext, filename, thrift):
|
|||
request.setOffset(request.getOffset() + len(bytes))
|
||||
finished = serverResponse.getEnd()
|
||||
|
||||
return bytes
|
||||
return bytes
|
||||
|
|
Loading…
Add table
Reference in a new issue