Merge "Issue #1447: Add troubleshooting mode to ServiceBackup from A1 DR 21404, add support for localVTECPartners.py to ServiceBackup." into omaha_13.3.1

Former-commit-id: 6ab9303526 [formerly f4f180face] [formerly 73678261b6 [formerly 8394ce66975f5915fd82dbc950ce43e5db3cfbe3]]
Former-commit-id: 73678261b6
Former-commit-id: 7e6b601a09
This commit is contained in:
Ron Anderson 2013-03-25 17:53:46 -05:00 committed by Gerrit Code Review
commit e4c4862938
11 changed files with 125 additions and 62 deletions

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.viz.gfe;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
@ -36,6 +33,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* ------------ ---------- ----------- --------------------------
* Aug 12, 2011 bphillip Initial creation
* Oct 26, 2012 1287 rferrel Change to force blocking of ServiceBackupDlg.
* Mar 21, 2013 1447 dgilling Fix dialog construction so this dialog
* is created as a top-level shell.
*
* </pre>
*
@ -54,8 +53,7 @@ public class ServiceBackupComponent extends AbstractCAVEComponent {
*/
@Override
protected void startInternal(String componentName) throws Exception {
ServiceBackupDlg svcBuDlg = new ServiceBackupDlg(new Shell(
Display.getCurrent()));
ServiceBackupDlg svcBuDlg = new ServiceBackupDlg(null);
svcBuDlg.setBlockOnOpen(true);
svcBuDlg.open();
}

View file

@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
/**
* TODO Add Description
* Asks the user if they want to import digital data and/or start GFE.
*
* <pre>
*
@ -39,7 +39,9 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 randerso Initial creation
* Aug 04, 2011 randerso Initial creation
* Mar 20, 2013 1447 dgilling Implement changes from A1 DR 21404,
* make default selections match A1.
*
* </pre>
*
@ -55,6 +57,8 @@ public class QueryOptionsDlg extends CaveJFACEDialog {
private boolean startGfe;
private boolean trMode;
private Button importGridsBtn;
private Button startGfeBtn;
@ -96,23 +100,37 @@ public class QueryOptionsDlg extends CaveJFACEDialog {
if (doImCon) {
importGridsBtn = new Button(top, SWT.CHECK);
importGridsBtn.setText("Import Digital Forecast");
importGridsBtn.setSelection(true);
importGridsBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
importGrids = importGridsBtn.getSelection();
}
});
importGridsBtn.getSelection();
importGrids = importGridsBtn.getSelection();
final Button trModeBtn = new Button(top, SWT.CHECK);
trModeBtn.setText("Troubleshooting Mode (no ISC/VTEC AT sharing)");
trModeBtn.setSelection(false);
trModeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
trMode = trModeBtn.getSelection();
}
});
trMode = trModeBtn.getSelection();
}
startGfeBtn = new Button(top, SWT.CHECK);
startGfeBtn.setText("Start GFE");
startGfeBtn.setSelection(true);
startGfeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
startGfe = startGfeBtn.getSelection();
}
});
startGfe = startGfeBtn.getSelection();
return top;
}
@ -124,4 +142,8 @@ public class QueryOptionsDlg extends CaveJFACEDialog {
public boolean startGFE() {
return this.startGfe;
}
public boolean trMode() {
return this.trMode;
}
}

View file

@ -19,7 +19,6 @@
**/
package com.raytheon.viz.gfe.dialogs.sbu;
import java.io.IOException;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
@ -39,6 +38,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@ -57,7 +57,6 @@ import com.raytheon.uf.common.site.requests.GetActiveSitesRequest;
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.RunProcess;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
@ -87,10 +86,12 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 randerso Initial creation
* Sep 19,2011 10955 rferrel Use RunProcess
* Aug 04, 2011 randerso Initial creation
* Sep 19, 2011 10955 rferrel Use RunProcess
* Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog.
* Nov 15,2012 15614 jdynina Added check for national center
* Nov 15, 2012 15614 jdynina Added check for national center
* Mar 20, 2013 1447 dgilling Port troubleshooting mode changes
* from A1 DR 21404, some code cleanup.
*
* </pre>
*
@ -342,15 +343,11 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
helpItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
// DR#10955
RunProcess
.getRunProcess()
.exec("/usr/bin/firefox http://"
final String url = "http://"
+ getServiceBackupServer()
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_help.html");
} catch (IOException e1) {
statusHandler.error("Unable to open Help page!", e1);
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_help.html";
if (!Program.launch(url)) {
statusHandler.error("Unable to open Help page: " + url);
}
}
});
@ -360,15 +357,12 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
instructionsItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
// DR#10955
RunProcess
.getRunProcess()
.exec("/usr/bin/firefox http://"
final String url = "http://"
+ getServiceBackupServer()
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_instructions.html");
} catch (IOException e1) {
statusHandler.error("Unable to open Help page!", e1);
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_instructions.html";
if (!Program.launch(url)) {
statusHandler.error("Unable to open Instructions page: "
+ url);
}
}
});
@ -378,15 +372,11 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
faqItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
// DR#10955
RunProcess
.getRunProcess()
.exec("/usr/bin/firefox http://"
final String url = "http://"
+ getServiceBackupServer()
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_faq.html");
} catch (IOException e1) {
statusHandler.error("Unable to open Help page!", e1);
+ ":8080/uEngineWeb/GfeServiceBackup/help/svcbu_faq.html";
if (!Program.launch(url)) {
statusHandler.error("Unable to open FAQ page: " + url);
}
}
});
@ -493,7 +483,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
jobManager.addJob(new SvcbuDeactivateSiteJob(failedSite,
this.site));
jobManager.addJob(new SvcbuImportConfJob(site, failedSite,
progress));
false, progress));
jobManager.addJob(new SvcbuActivateSiteJob(failedSite,
this.site));
jobManager.addJob(new SvcbuStartGfeJob(failedSite, this.site));
@ -544,11 +534,12 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
if (dlg.open() == Window.OK) {
boolean importGrids = dlg.importGrids();
boolean startGFE = dlg.startGFE();
boolean trMode = dlg.trMode();
String failedSite = getFailedSite();
jobManager.addJob(new SvcbuDeactivateSiteJob(failedSite,
this.site));
jobManager.addJob(new SvcbuImportConfJob(site, failedSite,
progress));
trMode, progress));
jobManager.addJob(new SvcbuActivateSiteJob(failedSite,
this.site));
if (importGrids) {
@ -1191,8 +1182,8 @@ public class ServiceBackupDlg extends CaveJFACEDialog {
doExGrids.setEnabled(true);
doExGrids.setText("Export " + this.site
+ "'s Digital Forecast to the Central Server");
updateBanner("YOU ARE NOT IN BACKUP MODE", getShell().getParent()
.getFont(), black, gray);
updateBanner("YOU ARE NOT IN BACKUP MODE", getShell().getFont(),
black, gray);
currentOperation = SVCBU_OP.no_backup;
}

View file

@ -49,7 +49,9 @@ import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 5, 2011 bphillip Initial creation
* Aug 05, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Add support for service backup
* troubleshooting mode from A1.
*
* </pre>
*
@ -62,6 +64,8 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
private String failedSite;
private boolean trMode;
private ProgressDlg progress;
private boolean complete;
@ -70,21 +74,19 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
private String errorMsg;
/**
* @param name
*/
public SvcbuImportConfJob(String primarySite, String failedSite,
ProgressDlg progress) {
boolean trMode, ProgressDlg progress) {
super("Import Configuration: " + failedSite, primarySite);
this.failedSite = failedSite;
this.progress = progress;
this.trMode = trMode;
NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this);
}
@Override
public void run() {
ImportConfRequest request = new ImportConfRequest(primarySite,
failedSite);
failedSite, trMode);
try {
VizApp.runAsync(new Runnable() {
@ -158,7 +160,7 @@ public class SvcbuImportConfJob extends ServiceBackupJob implements
+ failedSite, e);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"SERVICE BACKUP: "+e.getLocalizedMessage());
"SERVICE BACKUP: " + e.getLocalizedMessage());
} finally {
NotificationManagerJob.removeObserver(
ServiceBackupDlg.NOTIFY_TOPIC, this);

View file

@ -26,7 +26,8 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.12.1174"
ucar.nc2;bundle-version="1.0.0",
com.raytheon.uf.common.parameter;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
com.google.guava;bundle-version="1.0.0"
com.google.guava;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0"
Export-Package: com.raytheon.edex.plugin.gfe,
com.raytheon.edex.plugin.gfe.config,
com.raytheon.edex.plugin.gfe.db.dao,

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.edex.plugin.gfe.server.handler.svcbu;
import org.apache.commons.lang.BooleanUtils;
import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
@ -33,7 +35,9 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation
* Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Support troubleshooting mode
* added to match A1 DR 21404.
*
* </pre>
*
@ -49,7 +53,8 @@ public class ImportConfRequestHandler implements
ServerResponse<String> sr = new ServerResponse<String>();
SvcBackupUtil.execute("request_configuration", request.getPrimarySite()
.toLowerCase(), request.getFailedSite().toLowerCase());
.toLowerCase(), request.getFailedSite().toLowerCase(), Integer
.toString(BooleanUtils.toInteger(request.isTrMode())));
return sr;
}
}

View file

@ -31,7 +31,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2011 bphillip Initial creation
* Aug 04, 2011 bphillip Initial creation
* Mar 20, 2013 1447 dgilling Add support for service backup
* troubleshooting mode from A1.
*
* </pre>
*
@ -48,13 +50,18 @@ public class ImportConfRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String failedSite;
@DynamicSerializeElement
private boolean trMode;
public ImportConfRequest() {
}
public ImportConfRequest(String primarySite, String failedSite) {
public ImportConfRequest(String primarySite, String failedSite,
boolean trMode) {
this.primarySite = primarySite;
this.failedSite = failedSite;
this.trMode = trMode;
}
/**
@ -87,4 +94,12 @@ public class ImportConfRequest extends AbstractGfeRequest {
this.failedSite = failedSite;
}
public void setTrMode(boolean trMode) {
this.trMode = trMode;
}
public boolean isTrMode() {
return trMode;
}
}

View file

@ -64,6 +64,7 @@ log_msg 30
# Copies the localization information to the staging area
log_msg Copying common site configuration for site ${CAPS_SITE} to temporary directory...
cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/gfe $commonDest/site
cp -r ${LOCALIZATION_PATH}/common_static/site/${CAPS_SITE}/vtec $commonDest/site
log_msg 40
log_msg Copying edex site configuration for site ${CAPS_SITE} to temporary directory...

View file

@ -49,6 +49,7 @@ then
then
log_msg You cannot import configuration data for your own site.
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
@ -66,6 +67,7 @@ then
else
log_msg "Unable to locate ${import_file}. Service backup exits now"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
@ -79,6 +81,7 @@ gunzip -c GFEconfig.${SITE}.tar.gz | tar xf -
if [ $? -ne 0 ]; then
log_msg -e "\nERROR: Could not explode GFEconfig.${SITE_CAPS}.tar.gz..."
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
@ -90,6 +93,7 @@ if [ -d GFEconfig ]; then
else
log_msg "Incorrectly formatted configuration received. Cannot continue!"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
touch ${LOCK_DIR}/svcbuerr
log_msg 100
exit 1
@ -152,6 +156,19 @@ fi
log_msg 95
#
# DR21404 - disable ISC/VTEC for troubleshooting mode
#
if [ -f ${LOCK_DIR}/trMode ]; then
log_msg "Activating troubleshooting mode..."
rm -f ${LOCALIZATION_PATH}/common_static/site/${SITE_CAPS}/vtec/localVTECPartners.py*
echo "serverConfig.REQUEST_ISC = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_SAVE = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
echo "serverConfig.SEND_ISC_ON_PUBLISH = 0" >> ${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/localConfig.py
fi
log_msg "Updating siteConfig.py..."
#Change the MHS ID of the received configuration
backup_config=${LOCALIZATION_PATH}/edex_static/site/${my_site_caps}/config/gfe/siteConfig.py
failed_config=${LOCALIZATION_PATH}/edex_static/site/${SITE_CAPS}/config/gfe/siteConfig.py
@ -170,6 +187,7 @@ cd ${SVCBU_HOME}
rm -rf *
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
touch ${LOCK_DIR}/${SITE}svcbuMode
log_msg "Configuration Import Complete!"

View file

@ -21,6 +21,7 @@ then
log_msg Lock file not present for importing configuration! Cannot continue!
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
exit 1
fi
@ -36,6 +37,7 @@ else
log_msg "Script must be run as user root or awips"
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
exit 1
fi
@ -46,6 +48,7 @@ if [ $exitValue -ne 0 ]; then
log_msg "Receive configuration returned with errors..."
touch ${LOCK_DIR}/svcbuerr
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg 100
exit 1
fi

View file

@ -7,10 +7,11 @@ fi
# $1 = Primary site
# $2 = Failed site
# $3 = enable/disable troubleshooting mode
if [ $# -ne 2 ]
if [ $# -ne 3 ]
then
log_msg "Incorrect number of arguments\nCorrect usage: request_configuration primary_site failed_site"
log_msg "Incorrect number of arguments\nCorrect usage: request_configuration primary_site failed_site trMode"
exit 1
fi
@ -32,6 +33,10 @@ then
fi
touch ${LOCK_DIR}/importConfiguration
if [ $3 -eq 1 ]; then
touch ${LOCK_DIR}/trMode
log_msg "You are in troubleshooting mode - no ISC/VTEC will be available"
fi
log_msg Contacting central server to get configuration for ${2}
log_msg 0
@ -42,6 +47,7 @@ if [ -n "${SVCBU_WMO_HEADER}" ]; then
if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${CAPS_SITE}`date`"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1
fi
@ -51,6 +57,7 @@ else
if [ $exitValue -ne 0 ]; then
log_msg "msg_send failed while requesting configuration for ${2}`date`"
rm -f ${LOCK_DIR}/importConfiguration
rm -f ${LOCK_DIR}/trMode
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
exit 1
fi