Issue #1420 - More Rules changes.

Peer review comments

Change-Id: I3ed89b332764bba2d995a248e361d20c1eec6edf

Former-commit-id: 84f2d0ed39e11059359558676c988a0bf1e989b9
This commit is contained in:
Mike Duff 2013-01-16 12:24:37 -06:00
parent 09fb2d0919
commit 2a31447d6d
10 changed files with 319 additions and 113 deletions

View file

@ -27,8 +27,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions;
import com.raytheon.uf.viz.datadelivery.system.Operator;
import com.raytheon.uf.viz.datadelivery.system.OpsNetFieldNames;
@ -54,11 +52,6 @@ import com.raytheon.uf.viz.datadelivery.utils.DataSizeUnit;
@SuppressWarnings({ "unchecked", "rawtypes" })
@XmlAccessorType(XmlAccessType.NONE)
public abstract class RuleXML {
/** Status Handler */
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(RuleXML.class);
/** Rule name */
@XmlElement
protected String ruleName;

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.datadelivery.system;
import java.util.List;
import java.util.regex.Pattern;
import org.eclipse.swt.SWT;
@ -227,6 +228,9 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
this(parent, create, null, ruleType);
}
/**
* Create the rule header.
*/
private void createRuleHeader() {
if (create) {
if (PRIORITY_TYPE.equals(ruleType)) {
@ -269,9 +273,9 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
protected void initializeComponents(Shell shell) {
if (!create) {
if (PRIORITY_TYPE.equals(ruleType)) {
ruleXml = srm.loadPriorityRule(ruleName);
ruleXml = srm.getPriorityRule(ruleName);
} else {
ruleXml = srm.loadLatencyRule(ruleName);
ruleXml = srm.getLatencyRule(ruleName);
}
if (DATASET_SIZE.equals(ruleXml.getRuleField())) {
@ -411,7 +415,6 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
String item = fieldCombo.getItem(index);
updateSelectionFields(item);
}
});
OpsNetFieldNames[] fieldItems = OpsNetFieldNames.values();
@ -450,7 +453,6 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
createFreqUnitItems();
}
unitsCombo.select(0);
}
if (PRIORITY_TYPE.equals(ruleType)) {
@ -481,7 +483,6 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
priorityCombo.select(0);
} else {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gl = new GridLayout(3, false);
@ -507,19 +508,16 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
Label minutesLbl = new Label(latencySelectionComp, SWT.NONE);
minutesLbl.setLayoutData(gd);
minutesLbl.setText("Minutes");
}
populateFields();
ruleDefinitionGroup.pack();
}
/**
* Upon edit, populate the fields.
*/
private void populateFields() {
if (!create) {
String field = ruleXml.getRuleField();
if (!field.isEmpty()) {
@ -602,7 +600,6 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
close();
}
});
}
/**
@ -651,6 +648,13 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
Operator operator = OperatorAdapter.fromString(operationCombo
.getItem(operationCombo.getSelectionIndex()));
List<String> ruleNames = null;
if (PRIORITY_TYPE.equals(ruleType)) {
ruleNames = srm.getPriorityRuleNames();
} else {
ruleNames = srm.getLatencyRuleNames();
}
if (create) {
valid = DataDeliveryGUIUtils.hasText(ruleNameText);
@ -663,13 +667,29 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
ruleName = ruleNameText.getText();
if (INVALID_PATTERN.matcher(ruleName.trim()).find()) {
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
INVALID_CHARS_TITLE, INVALID_CHARS_MESSAGE);
return false;
}
// Check for duplicate rule name
if (ruleNames.contains(ruleName)) {
DataDeliveryUtils
.showMessage(
shell,
SWT.ERROR,
"Duplicate Rule",
"A rule titled "
+ ruleName
+ " already exists.\n\nPlease select a different name.");
ruleNameText.selectAll();
return false;
}
}
if (INVALID_PATTERN.matcher(ruleName.trim()).find()) {
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
INVALID_CHARS_TITLE, INVALID_CHARS_MESSAGE);
return false;
}
String value = null;
if (DataDeliveryGUIUtils.hasText(ruleValue)) {
value = ruleValue.getText();
@ -770,21 +790,12 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
setReturnValue(saved);
if (!saved) {
DataDeliveryUtils
.showMessage(
getShell(),
SWT.OK,
"Duplicate Name",
"A rule named "
+ ruleName
+ " already exists\n\nPlease select a different name.");
ruleNameText.selectAll();
}
return saved;
}
/**
* Populate the units combo.
*/
private void createSizeUnitItems() {
unitsCombo.removeAll();
DataSizeUnit[] sizeUnits = DataSizeUnit.values();
@ -793,6 +804,9 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
}
/**
* Populate the operation combo.
*/
private void createSizeOpItems() {
operationCombo.removeAll();
OperatorTypes[] sizeOps = OperatorTypes.values();
@ -801,6 +815,9 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
}
/**
* Populate the frequency units combo.
*/
private void createFreqUnitItems() {
FreqUnitOptions[] freqUnits = FreqUnitOptions.values();
for (FreqUnitOptions fuo : freqUnits) {
@ -808,6 +825,9 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
}
}
/**
* populate the operation combo.
*/
private void createNameOpItems() {
operationCombo.removeAll();
NameOperationItems[] nameOperation = NameOperationItems.values();

View file

@ -0,0 +1,44 @@
/**
* 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.datadelivery.system;
/**
* Rules file update notifier interface.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 16, 2013 1420 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public interface IRulesUpdateListener {
/**
* Update rules.
*/
void update();
}

View file

@ -263,10 +263,7 @@ public class SystemLatencyTab {
ruleDlg = new CreateEditRuleDlg(parentComp.getShell(),
create, ruleName, LATENCY_TYPE);
}
boolean reloadFlag = (Boolean) ruleDlg.open();
if (reloadFlag) {
loadList();
}
ruleDlg.open();
} else {
ruleDlg.bringToTop();
}

View file

@ -45,6 +45,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
@ -71,7 +72,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* @version 1.0
*/
public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
IForceApplyPromptDisplayText {
IForceApplyPromptDisplayText, IRulesUpdateListener {
/** Status Handler */
private final IUFStatusHandler statusHandler = UFStatus
@ -128,10 +129,18 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
/** OK button */
private Button okBtn;
/** Available bandwidth modified flag */
private boolean availableBandwidthModified;
/** Available bandwidth spinner widget */
private Spinner availBandwidthSpinner;
/** The system latency tab */
private SystemLatencyTab lTab;
/** The system priority tab */
private SystemPriorityTab pTab;
/**
* Constructor.
*
@ -141,6 +150,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
public SystemManagementDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM, CAVE.NONE);
setText("Data Delivery System Management");
SystemRuleManager.getInstance().registerAsListener(this);
}
@ -181,6 +191,17 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
SystemRuleManager.getInstance().deregisterAsListener(this);
}
/**
* Create top bar route information.
*/
@ -283,7 +304,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
priorityComp.setLayout(gl);
priorityComp.setLayoutData(gd);
priorityTab.setControl(priorityComp);
SystemPriorityTab pTab = new SystemPriorityTab(priorityComp);
pTab = new SystemPriorityTab(priorityComp);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false);
@ -296,7 +317,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
latencyComp.setLayout(gl);
latencyComp.setLayoutData(gd);
latencyTab.setControl(latencyComp);
SystemLatencyTab lTab = new SystemLatencyTab(latencyComp);
lTab = new SystemLatencyTab(latencyComp);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false);
@ -309,6 +330,9 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
routingComp.setLayoutData(gd);
routingTab.setControl(routingComp);
SystemRoutingTab rTab = new SystemRoutingTab(routingComp);
lTab.loadList();
pTab.loadList();
}
/**
@ -466,4 +490,17 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
"Don't know how to handle option [" + option + "]");
}
}
@Override
public void update() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if (!shell.isDisposed()) {
lTab.loadList();
pTab.loadList();
}
}
});
}
}

View file

@ -268,10 +268,7 @@ public class SystemPriorityTab {
create, ruleName, PRIORITY_TYPE);
}
boolean reloadFlag = (Boolean) ruleDlg.open();
if (reloadFlag) {
loadList();
}
ruleDlg.open();
} else {
ruleDlg.bringToTop();
}

View file

@ -32,6 +32,8 @@ import javax.xml.bind.Unmarshaller;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -89,6 +91,12 @@ public class SystemRuleManager {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SystemRuleManager.class);
/** Latency Rules Localization File */
private LocalizationFile latencyRulesLocFile;
/** Priority Rules Localization File */
private LocalizationFile priorityRulesLocFile;
/** JAXB context */
private JAXBContext jax;
@ -101,11 +109,21 @@ public class SystemRuleManager {
/** Bandwidth service */
private IBandwidthService bandwidthService;
/** Latency Rules XML object */
private LatencyRulesXML latencyRules;
/** Priority Rules XML object */
private PriorityRulesXML priorityRules;
private final List<IRulesUpdateListener> listeners = new ArrayList<IRulesUpdateListener>();
/**
* Constructor.
*/
private SystemRuleManager() {
createContext();
loadLatencyRules();
loadPriorityRules();
}
/**
@ -144,7 +162,7 @@ public class SystemRuleManager {
* @throws JAXBException
*/
public List<String> getPriorityRuleNames() {
return getPriorityRules().getRuleNames();
return getPriorityRules(false).getRuleNames();
}
/**
@ -154,8 +172,8 @@ public class SystemRuleManager {
* the name of the rule
* @return the PriorityRuleXML object
*/
public PriorityRuleXML loadPriorityRule(String name) {
PriorityRulesXML priorityRules = getPriorityRules();
public PriorityRuleXML getPriorityRule(String name) {
PriorityRulesXML priorityRules = getPriorityRules(false);
for (PriorityRuleXML rule : priorityRules.getRules()) {
if (rule.getRuleName().equals(name)) {
return rule;
@ -172,8 +190,8 @@ public class SystemRuleManager {
* the name of the rule
* @return the LatencyRuleXML object
*/
public LatencyRuleXML loadLatencyRule(String name) {
LatencyRulesXML latencyRules = getLatencyRules();
public LatencyRuleXML getLatencyRule(String name) {
LatencyRulesXML latencyRules = getLatencyRules(false);
for (LatencyRuleXML rule : latencyRules.getRules()) {
if (rule.getRuleName().equals(name)) {
return rule;
@ -190,7 +208,7 @@ public class SystemRuleManager {
* @throws JAXBException
*/
public List<String> getLatencyRuleNames() {
return getLatencyRules().getRuleNames();
return getLatencyRules(false).getRuleNames();
}
/**
@ -203,15 +221,22 @@ public class SystemRuleManager {
public boolean savePriorityRules(PriorityRulesXML xmlObj) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile priorityRulesLocFile = pm.getLocalizationFile(context,
this.PRIORITY_RULE_FILE);
try {
marshaller.marshal(xmlObj, priorityRulesLocFile.getFile());
priorityRulesLocFile.save();
return true;
// If site, then write out, otherwise save it as site.
if (priorityRulesLocFile.getContext().getLocalizationLevel()
.equals(LocalizationLevel.SITE)) {
marshaller.marshal(xmlObj, priorityRulesLocFile.getFile());
return priorityRulesLocFile.save();
} else {
LocalizationContext context = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
priorityRulesLocFile = pm.getLocalizationFile(context,
this.PRIORITY_RULE_FILE);
addPriorityRulesFileObserver();
marshaller.marshal(xmlObj, priorityRulesLocFile.getFile());
return priorityRulesLocFile.save();
}
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
} catch (LocalizationOpFailedException e) {
@ -231,15 +256,22 @@ public class SystemRuleManager {
public boolean saveLatencyRules(LatencyRulesXML xmlObj) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile latencyRulesLocFile = pm.getLocalizationFile(context,
this.LATENCY_RULE_FILE);
try {
marshaller.marshal(xmlObj, latencyRulesLocFile.getFile());
latencyRulesLocFile.save();
return true;
// If site, then write out, otherwise save it as site.
if (latencyRulesLocFile.getContext().getLocalizationLevel()
.equals(LocalizationLevel.SITE)) {
marshaller.marshal(xmlObj, latencyRulesLocFile.getFile());
return latencyRulesLocFile.save();
} else {
LocalizationContext context = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
latencyRulesLocFile = pm.getLocalizationFile(context,
this.LATENCY_RULE_FILE);
addLatencyRulesFileObserver();
marshaller.marshal(xmlObj, latencyRulesLocFile.getFile());
return latencyRulesLocFile.save();
}
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
} catch (LocalizationOpFailedException e) {
@ -256,7 +288,7 @@ public class SystemRuleManager {
* the rule name to delete
*/
public void deleteLatencyRule(String ruleName) {
LatencyRulesXML latencyRules = getLatencyRules();
LatencyRulesXML latencyRules = getLatencyRules(false);
for (LatencyRuleXML rule : latencyRules.getRules()) {
if (rule.getRuleName().equals(ruleName)) {
@ -274,7 +306,7 @@ public class SystemRuleManager {
* the rule name to delete
*/
public void deletePriorityRule(String ruleName) {
PriorityRulesXML priorityRules = getPriorityRules();
PriorityRulesXML priorityRules = getPriorityRules(false);
for (PriorityRuleXML rule : priorityRules.getRules()) {
if (rule.getRuleName().equals(ruleName)) {
@ -293,7 +325,7 @@ public class SystemRuleManager {
* @return true if updated
*/
public boolean updateRule(LatencyRuleXML rule) {
LatencyRulesXML rulesXml = getLatencyRules();
LatencyRulesXML rulesXml = getLatencyRules(false);
boolean saved = rulesXml.updateRule(rule);
if (saved) {
return saveLatencyRules(rulesXml);
@ -310,7 +342,7 @@ public class SystemRuleManager {
* @return true if updated
*/
public boolean updateRule(PriorityRuleXML rule) {
PriorityRulesXML rulesXml = getPriorityRules();
PriorityRulesXML rulesXml = getPriorityRules(false);
boolean saved = rulesXml.updateRule(rule);
if (saved) {
saved = savePriorityRules(rulesXml);
@ -331,7 +363,7 @@ public class SystemRuleManager {
* @return true if updated
*/
public boolean saveRule(PriorityRuleXML rule) {
PriorityRulesXML rulesXml = getPriorityRules();
PriorityRulesXML rulesXml = getPriorityRules(false);
boolean saved = rulesXml.addRule(rule);
if (saved) {
saved = savePriorityRules(rulesXml);
@ -352,7 +384,7 @@ public class SystemRuleManager {
* @return true if updated
*/
public boolean saveRule(LatencyRuleXML rule) {
LatencyRulesXML rulesXml = getLatencyRules();
LatencyRulesXML rulesXml = getLatencyRules(false);
boolean saved = rulesXml.addRule(rule);
if (saved) {
saved = saveLatencyRules(rulesXml);
@ -368,19 +400,23 @@ public class SystemRuleManager {
/**
* Get the latency rules.
*
* @param reread
* true to reread the file from disk
*
* @return The latency rules xml object
*/
private LatencyRulesXML getLatencyRules() {
LocalizationFile lfile = getRules(this.LATENCY_RULE_FILE);
LatencyRulesXML latencyRules = new LatencyRulesXML();
if (lfile != null && lfile.exists()) {
try {
latencyRules = (LatencyRulesXML) unmarshaller.unmarshal(lfile
.getFile());
} catch (JAXBException e) {
statusHandler
.handle(Priority.ERROR, e.getLocalizedMessage(), e);
private LatencyRulesXML getLatencyRules(boolean reread) {
if (latencyRules == null || reread) {
if (this.latencyRulesLocFile != null
&& latencyRulesLocFile.exists()) {
try {
latencyRules = (LatencyRulesXML) unmarshaller
.unmarshal(latencyRulesLocFile.getFile());
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR,
e.getLocalizedMessage(), e);
latencyRules = new LatencyRulesXML();
}
}
}
@ -390,34 +426,26 @@ public class SystemRuleManager {
/**
* Get the priority rules
*
* @param reread
* true to reread the file from disk
*
* @return The priority rules xml object
*/
private PriorityRulesXML getPriorityRules() {
LocalizationFile lfile = getRules(this.PRIORITY_RULE_FILE);
PriorityRulesXML priorityRules = new PriorityRulesXML();
if (lfile != null && lfile.exists()) {
try {
priorityRules = (PriorityRulesXML) unmarshaller.unmarshal(lfile
.getFile());
} catch (JAXBException e) {
statusHandler
.handle(Priority.ERROR, e.getLocalizedMessage(), e);
private PriorityRulesXML getPriorityRules(boolean reread) {
if (priorityRules == null || reread)
if (this.priorityRulesLocFile != null
&& priorityRulesLocFile.exists()) {
try {
priorityRules = (PriorityRulesXML) unmarshaller
.unmarshal(priorityRulesLocFile.getFile());
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR,
e.getLocalizedMessage(), e);
priorityRules = new PriorityRulesXML();
}
}
}
return priorityRules;
}
/**
* Get the rules files
*
* @param name
* Rules file name to get
* @return The localization file
*/
private LocalizationFile getRules(String name) {
IPathManager pm = PathManagerFactory.getPathManager();
return pm.getStaticLocalizationFile(name);
return priorityRules;
}
/**
@ -442,7 +470,7 @@ public class SystemRuleManager {
* @return
*/
public int getLatency(Subscription sub, Set<Integer> cycleTimes) {
LatencyRulesXML rulesXml = this.getLatencyRules();
LatencyRulesXML rulesXml = this.getLatencyRules(false);
int latency = 999;
boolean found = false;
for (LatencyRuleXML rule : rulesXml.getRules()) {
@ -471,7 +499,7 @@ public class SystemRuleManager {
* @return
*/
public int getPriority(Subscription sub, Set<Integer> cycleTimes) {
PriorityRulesXML rulesXml = this.getPriorityRules();
PriorityRulesXML rulesXml = this.getPriorityRules(false);
int priority = 3;
boolean found = false;
for (PriorityRuleXML rule : rulesXml.getRules()) {
@ -546,4 +574,87 @@ public class SystemRuleManager {
return getInstance().bandwidthService
.setBandwidthForNetworkInKilobytes(network, bandwidth);
}
/**
* Read the latency rules file.
*/
private void loadLatencyRules() {
IPathManager pm = PathManagerFactory.getPathManager();
this.latencyRulesLocFile = pm
.getStaticLocalizationFile(this.LATENCY_RULE_FILE);
addLatencyRulesFileObserver();
getLatencyRules(true);
}
/**
* Load the priority rules file.
*/
private void loadPriorityRules() {
IPathManager pm = PathManagerFactory.getPathManager();
this.priorityRulesLocFile = pm
.getStaticLocalizationFile(this.PRIORITY_RULE_FILE);
addPriorityRulesFileObserver();
getPriorityRules(true);
}
/**
* Add a file observer to the latency rules file to get notified when the
* file changes.
*/
private void addLatencyRulesFileObserver() {
latencyRulesLocFile
.addFileUpdatedObserver(new ILocalizationFileObserver() {
@Override
public void fileUpdated(FileUpdatedMessage message) {
loadLatencyRules();
fireUpdates();
}
});
}
/**
* Add a file observer to the priority rules file to get notified when the
* file changes.
*/
private void addPriorityRulesFileObserver() {
priorityRulesLocFile
.addFileUpdatedObserver(new ILocalizationFileObserver() {
@Override
public void fileUpdated(FileUpdatedMessage message) {
loadPriorityRules();
fireUpdates();
}
});
}
/**
* Notify the listeners the files changed.
*/
private void fireUpdates() {
for (IRulesUpdateListener listener : listeners) {
listener.update();
}
}
/**
* Register as a listener for rules file changes.
*
* @param listener
*/
public void registerAsListener(IRulesUpdateListener listener) {
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
/**
* Unregister as a listener for rules files changed.
*
* @param listener
*/
public void deregisterAsListener(IRulesUpdateListener listener) {
if (listeners.contains(listener)) {
listeners.remove(listener);
}
}
}

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<latencyRules>
<latencyRule>
<rule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="latencyRuleXML">
<ruleField>Dataset Frequency</ruleField>
<ruleName>Hourly-Products</ruleName>
<ruleOperator>&lt;=</ruleOperator>
<ruleUnit>Hrs</ruleUnit>
<ruleValue>1</ruleValue>
<latency>40</latency>
</latencyRule>
<latencyRule>
</rule>
<rule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="latencyRuleXML">
<ruleField>Dataset Frequency</ruleField>
<ruleName>MultiHour-Products</ruleName>
<ruleOperator>&gt;</ruleOperator>
<ruleUnit>Hrs</ruleUnit>
<ruleValue>1</ruleValue>
<latency>115</latency>
</latencyRule>
</rule>
</latencyRules>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<priorityRules>
</priorityRules>

View file

@ -89,6 +89,8 @@
<permission id="com.raytheon.localization.site/common_static/roles">
</permission>
<permission id="com.raytheon.localization.site/common_static/datadelivery"/>
<user userId="ALL">
<userPermission>com.raytheon.localization.site/common_static/purge</userPermission>
<userPermission>com.raytheon.localization.site/cave_static/colormaps</userPermission>
@ -119,6 +121,7 @@
<userPermission>com.raytheon.localization.site/common_static/radar/rmr/rmrAvailableRequests.xml</userPermission>
<userPermission>com.raytheon.localization.site/common_static/shef</userPermission>
<userPermission>com.raytheon.localization.site/common_static/roles</userPermission>
<userPermission>com.raytheon.localization.site/common_static/datadelivery</userPermission>
</user>
</nwsRoleData>