Merge "Omaha #4300 Client-side changes for multi-site service backup" into omaha_15.1.1
Former-commit-id: f6a14fd5ffa9a3629aae5a2d9a360b75bca31878
This commit is contained in:
commit
863082515f
34 changed files with 2152 additions and 3077 deletions
|
@ -35,7 +35,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.viz.image.export;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.kml.export;bundle-version="1.14.1",
|
||||
com.raytheon.uf.common.numeric;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.topo;bundle-version="1.14.0"
|
||||
com.raytheon.uf.common.topo;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.plugin.nwsauth;bundle-version="1.14.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.viz.gfe,
|
||||
com.raytheon.viz.gfe.constants,
|
||||
|
|
|
@ -35,7 +35,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractAWIPSComponent;
|
|||
* 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.
|
||||
* Jun 11, 2014 DR-17401 lshi
|
||||
* Jun 11, 2014 DR-17401 lshi
|
||||
* Mar 19, 2015 4300 randerso Changes to support updated ServiceBackupDlg
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,12 +55,9 @@ public class ServiceBackupComponent extends AbstractAWIPSComponent {
|
|||
*/
|
||||
@Override
|
||||
protected void startInternal(String componentName) throws Exception {
|
||||
ServiceBackupDlg svcBuDlg = new ServiceBackupDlg(null);
|
||||
if (!svcBuDlg.isTerminated())
|
||||
{
|
||||
svcBuDlg.setBlockOnOpen(true);
|
||||
svcBuDlg.open();
|
||||
}
|
||||
ServiceBackupDlg svcBuDlg = new ServiceBackupDlg();
|
||||
svcBuDlg.setBlockOnOpen(true);
|
||||
svcBuDlg.open();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,18 +27,18 @@ import java.util.concurrent.ConcurrentSkipListSet;
|
|||
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.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.constants.StatusConstants;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Base class for GFE messages
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 24, 2009 randerso Initial creation
|
||||
* Aug 24, 2009 randerso Initial creation
|
||||
* Mar 19, 2015 #4300 randerso Added exception handling
|
||||
* Fixed JavaDoc
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,8 +46,20 @@ import com.raytheon.viz.gfe.constants.StatusConstants;
|
|||
* @version 1.0
|
||||
*/
|
||||
public abstract class Message {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(Message.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(Message.class);
|
||||
|
||||
/**
|
||||
* Message client interface
|
||||
*/
|
||||
public static interface IMessageClient {
|
||||
|
||||
/**
|
||||
* Called when a message is received
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public abstract void receiveMessage(Message message);
|
||||
}
|
||||
|
||||
|
@ -68,6 +80,14 @@ public abstract class Message {
|
|||
private static Map<Class<? extends Message>, Message> lastSentMap = new java.util.concurrent.ConcurrentSkipListMap<Class<? extends Message>, Message>(
|
||||
objectComparator);
|
||||
|
||||
/**
|
||||
* Register a client to receive one or more message classes
|
||||
*
|
||||
* @param client
|
||||
* the message client to register
|
||||
* @param msgClassList
|
||||
* the list of classes to register for
|
||||
*/
|
||||
public static void registerInterest(IMessageClient client,
|
||||
Class<? extends Message>... msgClassList) {
|
||||
|
||||
|
@ -82,6 +102,14 @@ public abstract class Message {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a client from one or more message classes
|
||||
*
|
||||
* @param client
|
||||
* the message client to unregister
|
||||
* @param msgClassList
|
||||
* the list of classes to unregister from
|
||||
*/
|
||||
public static void unregisterInterest(IMessageClient client,
|
||||
Class<? extends Message>... msgClassList) {
|
||||
|
||||
|
@ -93,6 +121,13 @@ public abstract class Message {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last sent message of a particular message class
|
||||
*
|
||||
* @param msgClass
|
||||
* message class
|
||||
* @return last message
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <C extends Message> C inquireLastMessage(Class<C> msgClass) {
|
||||
try {
|
||||
|
@ -111,12 +146,21 @@ public abstract class Message {
|
|||
return (C) message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to all registered clients
|
||||
*/
|
||||
public void send() {
|
||||
lastSentMap.put(this.getClass(), this);
|
||||
Set<IMessageClient> clients = registeredMap.get(this.getClass());
|
||||
if (clients != null) {
|
||||
for (IMessageClient client : clients) {
|
||||
client.receiveMessage(this);
|
||||
try {
|
||||
client.receiveMessage(this);
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error sending "
|
||||
+ this.getClass().getSimpleName() + " to "
|
||||
+ client.getClass().toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,141 +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.viz.gfe.dialogs.sbu;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
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.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.core.internal.IFPClient;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 10, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ChooseDomainDlg extends CaveJFACEDialog {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(IFPClient.class);
|
||||
|
||||
private String[] activeSites;
|
||||
|
||||
private String selectedSite;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
protected ChooseDomainDlg(Shell parentShell) {
|
||||
super(parentShell);
|
||||
GetActiveSitesRequest request = new GetActiveSitesRequest();
|
||||
try {
|
||||
Object obj = ThriftClient.sendRequest(request);
|
||||
if (obj instanceof String[]) {
|
||||
activeSites = (String[]) obj;
|
||||
} else {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"getActiveSites received " + obj);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error processing get active sites request", e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Choose Domain");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createDialogArea(org.
|
||||
* eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite top = (Composite) super.createDialogArea(parent);
|
||||
GridData gd = new GridData();
|
||||
gd.horizontalAlignment = GridData.CENTER;
|
||||
top.setLayoutData(gd);
|
||||
|
||||
Label label = new Label(top, SWT.CENTER);
|
||||
label.setText("Available Domains:");
|
||||
|
||||
for (int i = 0; i < activeSites.length; i++) {
|
||||
final Button button = new Button(top, SWT.RADIO);
|
||||
button.setText(activeSites[i]);
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectedSite = button.getText();
|
||||
}
|
||||
});
|
||||
if (i == 0){
|
||||
button.setSelection(true);
|
||||
selectedSite = button.getText();
|
||||
}
|
||||
}
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the selectedSite
|
||||
*/
|
||||
public String getSelectedSite() {
|
||||
return selectedSite;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,156 +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.viz.gfe.dialogs.sbu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 12, 2011 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class FailedSiteDlg extends CaveJFACEDialog {
|
||||
|
||||
private String ownSite;
|
||||
|
||||
private List<String> knownSites;
|
||||
|
||||
private Text failedSiteText;
|
||||
|
||||
private Label message;
|
||||
|
||||
private String failedSite;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
* @param ownSite
|
||||
* @param knownSites
|
||||
*/
|
||||
protected FailedSiteDlg(Shell parentShell, String ownSite,
|
||||
List<String> knownSites) {
|
||||
super(parentShell);
|
||||
this.ownSite = ownSite;
|
||||
this.knownSites = knownSites;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Failed Site");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createDialogArea(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite top = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Label label = new Label(top, SWT.NONE);
|
||||
label.setText("Enter the 3-letter site id for the failed site, then press OK");
|
||||
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
label.setLayoutData(layoutData);
|
||||
|
||||
failedSiteText = new Text(top, SWT.BORDER);
|
||||
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
failedSiteText.setLayoutData(layoutData);
|
||||
failedSiteText.setText("failed site");
|
||||
failedSiteText.selectAll();
|
||||
failedSiteText.addVerifyListener(new VerifyListener() {
|
||||
|
||||
@Override
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.text = e.text.toUpperCase();
|
||||
|
||||
String newText = ((Text) e.widget).getText();
|
||||
newText = newText.substring(0, e.start) + e.text
|
||||
+ newText.substring(e.end);
|
||||
|
||||
String msg = "";
|
||||
if (newText.equals(ownSite)) {
|
||||
msg = "You cannot select your own site";
|
||||
} else if (!knownSites.contains(newText)) {
|
||||
msg = "\"" + newText + "\" is not a known site";
|
||||
}
|
||||
|
||||
message.setText(msg);
|
||||
FailedSiteDlg.this.getButton(IDialogConstants.OK_ID)
|
||||
.setEnabled(msg.isEmpty());
|
||||
}
|
||||
});
|
||||
|
||||
message = new Label(top, SWT.NONE);
|
||||
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
message.setLayoutData(layoutData);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveJFACEDialog#okPressed()
|
||||
*/
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
this.failedSite = this.failedSiteText.getText();
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
public String getFailedSite() {
|
||||
return failedSite;
|
||||
}
|
||||
}
|
|
@ -1,206 +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.viz.gfe.dialogs.sbu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 11, 2011 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ProgressDlg extends CaveJFACEDialog implements
|
||||
INotificationObserver {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ProgressDlg.class);
|
||||
|
||||
private Label label;
|
||||
|
||||
private ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
public ProgressDlg(Shell parentShell) {
|
||||
super(parentShell);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Progress Bar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int open() {
|
||||
NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this);
|
||||
return super.open();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean close() {
|
||||
NotificationManagerJob.removeObserver(ServiceBackupDlg.NOTIFY_TOPIC,
|
||||
this);
|
||||
return super.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createDialogArea(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite top = (Composite) super.createDialogArea(parent);
|
||||
|
||||
label = new Label(top, SWT.NONE);
|
||||
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
layoutData.widthHint = this.convertWidthInCharsToPixels(50);
|
||||
layoutData.heightHint = this.convertHeightInCharsToPixels(3);
|
||||
label.setLayoutData(layoutData);
|
||||
|
||||
progressBar = new ProgressBar(top, SWT.HORIZONTAL);
|
||||
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
layoutData.widthHint = 500;
|
||||
layoutData.heightHint = 30;
|
||||
progressBar.setLayoutData(layoutData);
|
||||
progressBar.setMinimum(0);
|
||||
progressBar.setMaximum(100);
|
||||
progressBar.setSelection(0);
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
createButton(parent, IDialogConstants.OK_ID, "Close", true);
|
||||
}
|
||||
|
||||
public void updateProgress(int percent) {
|
||||
final int value = Math.max(0, Math.min(100, percent));
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (progressBar != null && !progressBar.isDisposed()) {
|
||||
progressBar.setSelection(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateMessage(final String message) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (label != null && !label.isDisposed()) {
|
||||
label.setText("\n" + message + "\n");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.jms.notification.INotificationObserver#
|
||||
* notificationArrived
|
||||
* (com.raytheon.uf.common.jms.notification.NotificationMessage[])
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
try {
|
||||
for (NotificationMessage msg : messages) {
|
||||
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
|
||||
.getMessagePayload();
|
||||
for (GfeNotification notification : notifications) {
|
||||
/*
|
||||
* FIXME: If we're going to continue to use this dialog fix
|
||||
* this notificationArrived handler.
|
||||
*/
|
||||
// if (notification instanceof
|
||||
// ServiceBackupMessageNotification) {
|
||||
// ServiceBackupMessageNotification notify =
|
||||
// (ServiceBackupMessageNotification) notification;
|
||||
// updateMessage(notify.getMessage());
|
||||
// } else if (notification instanceof
|
||||
// ServiceBackupProgressNotification) {
|
||||
// ServiceBackupProgressNotification notify =
|
||||
// (ServiceBackupProgressNotification) notification;
|
||||
// updateProgress(notify.getProgress());
|
||||
// }
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error processing gfe notifications!!", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,149 +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.viz.gfe.dialogs.sbu;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* Asks the user if they want to import digital data and/or start GFE.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 04, 2011 randerso Initial creation
|
||||
* Mar 20, 2013 1447 dgilling Implement changes from A1 DR 21404,
|
||||
* make default selections match A1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class QueryOptionsDlg extends CaveJFACEDialog {
|
||||
|
||||
private boolean doImCon;
|
||||
|
||||
private boolean importGrids;
|
||||
|
||||
private boolean startGfe;
|
||||
|
||||
private boolean trMode;
|
||||
|
||||
private Button importGridsBtn;
|
||||
|
||||
private Button startGfeBtn;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
protected QueryOptionsDlg(Shell parentShell, boolean doImCon) {
|
||||
super(parentShell);
|
||||
this.doImCon = doImCon;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText("Service Backup");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createDialogArea(org.
|
||||
* eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite top = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Label label = new Label(top, SWT.CENTER);
|
||||
label.setText("Would you also like to");
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean importGrids() {
|
||||
return this.importGrids;
|
||||
}
|
||||
|
||||
public boolean startGFE() {
|
||||
return this.startGfe;
|
||||
}
|
||||
|
||||
public boolean trMode() {
|
||||
return this.trMode;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,488 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.jobs.AbstractSbuTask;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.jobs.ServiceBackupTaskExecutor;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* Display Service Backup job status for a site
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 19, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ServiceBackupStatusDlg extends CaveJFACEDialog {
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ServiceBackupStatusDlg.class);
|
||||
|
||||
private static enum StatusIcons {
|
||||
NOT_STARTED("…", "Not started", SWT.COLOR_WIDGET_FOREGROUND), //
|
||||
IN_PROGRESS("", "In progress", SWT.COLOR_WIDGET_FOREGROUND), //
|
||||
SUCCESS("✔", "Successful", SWT.COLOR_GREEN), //
|
||||
FAILED("✖", "Failed", SWT.COLOR_RED); //
|
||||
|
||||
private String symbol;
|
||||
|
||||
private String toolTip;
|
||||
|
||||
private int color;
|
||||
|
||||
private int cycle = 0;
|
||||
|
||||
private StatusIcons(String symbol, String toolTip, int color) {
|
||||
this.symbol = symbol;
|
||||
this.toolTip = toolTip;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public char getSymbol() {
|
||||
cycle = (cycle + 1) % this.symbol.length();
|
||||
return this.symbol.charAt(cycle);
|
||||
}
|
||||
|
||||
public String getToolTip() {
|
||||
return this.toolTip;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
}
|
||||
|
||||
private String site;
|
||||
|
||||
private List<AbstractSbuTask> tasks;
|
||||
|
||||
private ServiceBackupTaskExecutor executor;
|
||||
|
||||
private Font bigFont;
|
||||
|
||||
private Map<String, Label[]> controls;
|
||||
|
||||
private Group statusGroup;
|
||||
|
||||
private UIJob updateJob;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
public ServiceBackupStatusDlg(Shell parentShell, String site) {
|
||||
super(parentShell);
|
||||
this.site = site;
|
||||
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.MIN);
|
||||
|
||||
updateJob = new UIJob("SvcbuUpdateJob") {
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
if (!getShell().isDisposed()) {
|
||||
doRefresh();
|
||||
if (executor.getJobStatus().equals(JobProgress.IN_PROGRESS)) {
|
||||
this.schedule(1000);
|
||||
} else {
|
||||
getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
} else {
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
updateJob.setSystem(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tasks
|
||||
*/
|
||||
public void setTasks(List<AbstractSbuTask> tasks) {
|
||||
if ((this.executor != null) && this.executor.isAlive()) {
|
||||
statusHandler.error("Service Backup job already in progress");
|
||||
return;
|
||||
}
|
||||
this.tasks = tasks;
|
||||
this.executor = new ServiceBackupTaskExecutor(tasks);
|
||||
|
||||
if (this.isOpen()) {
|
||||
for (Control control : statusGroup.getChildren()) {
|
||||
control.dispose();
|
||||
}
|
||||
|
||||
createStatusControls();
|
||||
statusGroup.pack();
|
||||
statusGroup.layout();
|
||||
Shell shell = getShell();
|
||||
shell.pack();
|
||||
shell.layout();
|
||||
|
||||
startJob();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the site
|
||||
*/
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText(this.site + " Service Backup Status");
|
||||
newShell.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
if (bigFont != null) {
|
||||
bigFont.dispose();
|
||||
}
|
||||
|
||||
if (executor != null) {
|
||||
executor.cancel();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.dialogs.Dialog#getInitialLocation(org.eclipse.swt.graphics
|
||||
* .Point)
|
||||
*/
|
||||
@Override
|
||||
protected Point getInitialLocation(Point initialSize) {
|
||||
Rectangle bounds = getParentShell().getBounds();
|
||||
int x = bounds.x + bounds.width;
|
||||
int y = bounds.y;
|
||||
|
||||
Rectangle myBounds = new Rectangle(x, y, initialSize.x, initialSize.y);
|
||||
for (Shell child : getParentShell().getShells()) {
|
||||
if (!child.equals(getShell()) && !child.isDisposed()) {
|
||||
Rectangle childBounds = child.getBounds();
|
||||
if (myBounds.contains(childBounds.x, childBounds.y)) {
|
||||
Rectangle clientArea = child.getClientArea();
|
||||
int delta = childBounds.height - clientArea.height;
|
||||
y += delta;
|
||||
// x += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Point location = new Point(x, y);
|
||||
return location;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createDialogArea(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
final Composite comp = (Composite) super.createDialogArea(parent);
|
||||
|
||||
final Button bigFontButton = new Button(comp, SWT.CHECK);
|
||||
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
bigFontButton.setLayoutData(layoutData);
|
||||
bigFontButton.setText("Use large font");
|
||||
bigFontButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (bigFontButton.getSelection()) {
|
||||
FontData fontData = comp.getFont().getFontData()[0];
|
||||
fontData.setHeight(18);
|
||||
fontData.setStyle(SWT.BOLD);
|
||||
bigFont = new Font(comp.getDisplay(), fontData);
|
||||
setFont(bigFont);
|
||||
} else {
|
||||
Font font = comp.getFont();
|
||||
setFont(font);
|
||||
if (bigFont != null) {
|
||||
bigFont.dispose();
|
||||
bigFont = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
controls = new HashMap<>();
|
||||
|
||||
statusGroup = new Group(comp, SWT.SHADOW_NONE);
|
||||
statusGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
statusGroup.setLayout(new GridLayout(3, false));
|
||||
statusGroup.setText("Job Status");
|
||||
createStatusControls();
|
||||
|
||||
comp.pack();
|
||||
comp.layout();
|
||||
|
||||
return comp;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void createStatusControls() {
|
||||
controls.clear();
|
||||
for (AbstractSbuTask task : tasks) {
|
||||
String status = task.getStatusFileName();
|
||||
String text = task.getGuiDescription();
|
||||
|
||||
Label statusIcon = new Label(statusGroup, SWT.HORIZONTAL
|
||||
| SWT.CENTER);
|
||||
statusIcon.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
|
||||
false));
|
||||
StatusIcons icon = StatusIcons.NOT_STARTED;
|
||||
statusIcon.setForeground(statusIcon.getDisplay().getSystemColor(
|
||||
icon.getColor()));
|
||||
statusIcon.setText(Character.toString(icon.getSymbol()));
|
||||
statusIcon.setToolTipText(icon.getToolTip());
|
||||
|
||||
Label time = new Label(statusGroup, SWT.HORIZONTAL);
|
||||
time.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
time.setText("00:00:00");
|
||||
|
||||
Label label = new Label(statusGroup, SWT.HORIZONTAL);
|
||||
label.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
label.setText(String.format(text, site));
|
||||
|
||||
if (bigFont != null) {
|
||||
statusIcon.setFont(bigFont);
|
||||
time.setFont(bigFont);
|
||||
label.setFont(bigFont);
|
||||
}
|
||||
|
||||
controls.put(status, new Label[] { statusIcon, time, label });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
createButton(parent, IDialogConstants.CANCEL_ID,
|
||||
IDialogConstants.CANCEL_LABEL, false).setEnabled(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
|
||||
*/
|
||||
@Override
|
||||
protected void cancelPressed() {
|
||||
cancelJob();
|
||||
getButton(IDialogConstants.CANCEL_ID).setEnabled(false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveJFACEDialog#open()
|
||||
*/
|
||||
@Override
|
||||
public int open() {
|
||||
int status = super.open();
|
||||
|
||||
startJob();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#close()
|
||||
*/
|
||||
@Override
|
||||
public boolean close() {
|
||||
if (executor.getJobStatus().equals(JobProgress.IN_PROGRESS)) {
|
||||
MessageDialog
|
||||
.openWarning(getShell(), this.site
|
||||
+ " Service Backup Status",
|
||||
"You cannot close this dialog while tasks are in progress!");
|
||||
return false;
|
||||
}
|
||||
cancelJob();
|
||||
return super.close();
|
||||
}
|
||||
|
||||
private void startJob() {
|
||||
this.executor.start();
|
||||
updateJob.schedule(1000);
|
||||
getButton(IDialogConstants.CANCEL_ID).setEnabled(true);
|
||||
}
|
||||
|
||||
private void cancelJob() {
|
||||
this.executor.cancel();
|
||||
}
|
||||
|
||||
private void setFont(Font font) {
|
||||
for (Label[] labels : controls.values()) {
|
||||
for (Label label : labels) {
|
||||
label.setFont(font);
|
||||
}
|
||||
}
|
||||
getShell().pack(true);
|
||||
}
|
||||
|
||||
private void updateStatus(final AbstractSbuTask task) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String key = task.getStatusFileName();
|
||||
JobProgress jobProgress = task.getStatus();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
Date statusTime = task.getStatusTime();
|
||||
Label[] labels = controls.get(key);
|
||||
if (labels != null) {
|
||||
Label statusIcon = labels[0];
|
||||
Label timeLabel = labels[1];
|
||||
|
||||
StatusIcons icon;
|
||||
switch (jobProgress) {
|
||||
case IN_PROGRESS:
|
||||
icon = StatusIcons.IN_PROGRESS;
|
||||
statusTime = new Date(System.currentTimeMillis()
|
||||
- statusTime.getTime());
|
||||
break;
|
||||
case SUCCESS:
|
||||
icon = StatusIcons.SUCCESS;
|
||||
break;
|
||||
case FAILED:
|
||||
icon = StatusIcons.FAILED;
|
||||
break;
|
||||
|
||||
case UNKNOWN:
|
||||
icon = StatusIcons.NOT_STARTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
statusHandler
|
||||
.error("Unknown JobProgress value received: "
|
||||
+ jobProgress.name());
|
||||
icon = StatusIcons.IN_PROGRESS;
|
||||
}
|
||||
if (!statusIcon.isDisposed()) {
|
||||
statusIcon.setForeground(statusIcon.getDisplay()
|
||||
.getSystemColor(icon.getColor()));
|
||||
statusIcon.setText(Character.toString(icon.getSymbol()));
|
||||
statusIcon.setToolTipText(icon.getToolTip());
|
||||
}
|
||||
|
||||
if (!timeLabel.isDisposed()) {
|
||||
timeLabel.setText(sdf.format(statusTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doRefresh() {
|
||||
for (AbstractSbuTask task : tasks) {
|
||||
updateStatus(task);
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
StatusIcons icon = StatusIcons.NOT_STARTED;
|
||||
|
||||
for (Label[] labels : controls.values()) {
|
||||
Label statusIcon = labels[0];
|
||||
Label timeLabel = labels[1];
|
||||
if (!statusIcon.isDisposed()) {
|
||||
statusIcon.setForeground(statusIcon.getDisplay()
|
||||
.getSystemColor(icon.getColor()));
|
||||
statusIcon.setText(Character.toString(icon.getSymbol()));
|
||||
statusIcon.setToolTipText(icon.getToolTip());
|
||||
}
|
||||
|
||||
if (!timeLabel.isDisposed()) {
|
||||
timeLabel.setText("00:00:00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Abstract base class for Service Backup tasks
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2015 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractSbuTask {
|
||||
protected final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AbstractSbuTask.class);
|
||||
|
||||
private String statusFileName;
|
||||
|
||||
private String guiDescription;
|
||||
|
||||
private JobProgress status;
|
||||
|
||||
private Date statusTime;
|
||||
|
||||
private Set<ITaskCompleteCallBack> callBacks;
|
||||
|
||||
public AbstractSbuTask(String statusFileName, String guiDescription) {
|
||||
this.statusFileName = statusFileName;
|
||||
this.guiDescription = guiDescription;
|
||||
|
||||
this.callBacks = new HashSet<>();
|
||||
|
||||
setStatus(JobProgress.UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the statusFileName
|
||||
*/
|
||||
public String getStatusFileName() {
|
||||
return statusFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the guiDescription
|
||||
*/
|
||||
public String getGuiDescription() {
|
||||
return guiDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public JobProgress getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
private void setStatus(JobProgress status) {
|
||||
this.status = status;
|
||||
if (status.equals(JobProgress.UNKNOWN)) {
|
||||
this.statusTime = new Date(0);
|
||||
} else {
|
||||
this.statusTime = new Date();
|
||||
}
|
||||
for (ITaskCompleteCallBack callBack : callBacks) {
|
||||
callBack.taskComplete(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Date getStatusTime() {
|
||||
return this.statusTime;
|
||||
}
|
||||
|
||||
public void addCallBack(ITaskCompleteCallBack callBack) {
|
||||
this.callBacks.add(callBack);
|
||||
}
|
||||
|
||||
public void removeCallBack(ITaskCompleteCallBack callBack) {
|
||||
this.callBacks.remove(callBack);
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
setStatus(JobProgress.IN_PROGRESS);
|
||||
|
||||
try {
|
||||
setStatus(runTask());
|
||||
} catch (VizException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
setStatus(JobProgress.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract JobProgress runTask() throws VizException;
|
||||
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.ServiceBackupJobStatusNotification;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
|
||||
/**
|
||||
* Service Backup Task to wait for a particular
|
||||
* ServiceBackupJobStatusNotification
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 18, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AwaitNotificationSbuTask extends AbstractSbuTask implements
|
||||
INotificationObserver {
|
||||
|
||||
private static final String NOTIFICATION_TOPIC = "edex.alerts.gfe";
|
||||
|
||||
private String siteID;
|
||||
|
||||
private String name;
|
||||
|
||||
private long timeout;
|
||||
|
||||
private Shell parent;
|
||||
|
||||
private volatile JobProgress status;
|
||||
|
||||
private long startTime;
|
||||
|
||||
/**
|
||||
* @param siteID
|
||||
* site ID to wait for
|
||||
* @param taskName
|
||||
* taskName to wait for
|
||||
* @param timeout
|
||||
* in milliseconds
|
||||
* @param statusFileName
|
||||
* @param guiDescription
|
||||
*/
|
||||
public AwaitNotificationSbuTask(String siteID, String taskName,
|
||||
long timeout, Shell parent, String statusFileName,
|
||||
String guiDescription) {
|
||||
super(statusFileName, guiDescription);
|
||||
this.siteID = siteID;
|
||||
this.name = taskName;
|
||||
this.timeout = timeout;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.dialogs.sbu.jobs.AbstractSbuTask#runTask()
|
||||
*/
|
||||
@Override
|
||||
protected JobProgress runTask() throws VizException {
|
||||
NotificationManagerJob.addObserver(NOTIFICATION_TOPIC, this);
|
||||
|
||||
try {
|
||||
status = JobProgress.IN_PROGRESS;
|
||||
startTime = System.currentTimeMillis();
|
||||
while (status.equals(JobProgress.IN_PROGRESS)) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
status = JobProgress.FAILED;
|
||||
}
|
||||
|
||||
if ((this.timeout > 0)
|
||||
&& ((System.currentTimeMillis() - startTime) > this.timeout)) {
|
||||
|
||||
parent.getDisplay().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String message = "Task " + name
|
||||
+ " has not completed after "
|
||||
+ TimeUtil.prettyDuration(timeout)
|
||||
+ ".\nDo you wish to continue waiting?";
|
||||
if (MessageDialog.openQuestion(parent, "Timeout",
|
||||
message)) {
|
||||
startTime = System.currentTimeMillis();
|
||||
} else {
|
||||
synchronized (status) {
|
||||
if (status.equals(JobProgress.IN_PROGRESS)) {
|
||||
status = JobProgress.FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(NOTIFICATION_TOPIC, this);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.jms.notification.INotificationObserver#
|
||||
* notificationArrived
|
||||
* (com.raytheon.uf.common.jms.notification.NotificationMessage[])
|
||||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj;
|
||||
try {
|
||||
obj = msg.getMessagePayload();
|
||||
if (obj instanceof ServiceBackupJobStatusNotification) {
|
||||
handleNotification((ServiceBackupJobStatusNotification) obj);
|
||||
} else if (obj instanceof List) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<GfeNotification> notifList = (List<GfeNotification>) obj;
|
||||
for (GfeNotification notif : notifList) {
|
||||
if (notif instanceof ServiceBackupJobStatusNotification) {
|
||||
handleNotification((ServiceBackupJobStatusNotification) notif);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to read incoming notification", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notif
|
||||
*/
|
||||
private void handleNotification(ServiceBackupJobStatusNotification notif) {
|
||||
if (this.siteID.equals(notif.getSiteID())) {
|
||||
if (notif.getName().equals(this.name)) {
|
||||
synchronized (status) {
|
||||
status = notif.getState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,11 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Interface for Service Backup Task Completion
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -31,46 +28,13 @@ import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 11, 2011 bphillip Initial creation
|
||||
* Mar 18, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuExitJob extends ServiceBackupJob {
|
||||
|
||||
private ServiceBackupDlg dialog;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuExitJob(ServiceBackupDlg dialog, String primarySite) {
|
||||
super("Exit Service Backup", primarySite);
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.dialogs.sbu.jobs.ServiceBackupJob#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
VizApp.runAsync(new CloseSvcBuDialog(dialog));
|
||||
}
|
||||
|
||||
private class CloseSvcBuDialog implements Runnable {
|
||||
|
||||
ServiceBackupDlg dialog;
|
||||
|
||||
public CloseSvcBuDialog(ServiceBackupDlg dialog) {
|
||||
this.dialog = dialog;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
this.dialog.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public interface ITaskCompleteCallBack {
|
||||
public void taskComplete(AbstractSbuTask task);
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* Service Backup Task to run a server request
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ServerRequestSbuTask extends AbstractSbuTask {
|
||||
protected IServerRequest request;
|
||||
|
||||
public ServerRequestSbuTask(String statusFileName, String guiDescription,
|
||||
IServerRequest request) {
|
||||
super(statusFileName, guiDescription);
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.dialogs.sbu.jobs.AbstractSbuTask#runInternal()
|
||||
*/
|
||||
@Override
|
||||
public JobProgress runTask() throws VizException {
|
||||
JobProgress rval = JobProgress.FAILED;
|
||||
|
||||
if (request instanceof AbstractGfeRequest) {
|
||||
((AbstractGfeRequest) request).setWorkstationID(VizApp.getWsId());
|
||||
}
|
||||
|
||||
Object obj = ThriftClient.sendRequest(request);
|
||||
if (obj instanceof JobProgress) {
|
||||
rval = (JobProgress) obj;
|
||||
} else {
|
||||
throw new GFEServerException(
|
||||
"Received invalid response object from GFE Server. Received ["
|
||||
+ obj.getClass().getName() + "] excepted ["
|
||||
+ JobProgress.class.getName());
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
}
|
|
@ -1,153 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Iterator;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerMsg;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
import com.raytheon.uf.common.site.requests.ActivateSiteRequest;
|
||||
import com.raytheon.uf.common.site.requests.DeactivateSiteRequest;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 5, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class ServiceBackupJob implements Runnable{
|
||||
|
||||
protected static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ServiceBackupJob.class);
|
||||
|
||||
protected String primarySite;
|
||||
|
||||
protected boolean failed = false;
|
||||
|
||||
protected boolean aborted = false;
|
||||
|
||||
protected String name;
|
||||
|
||||
protected static SimpleDateFormat dateFormat;
|
||||
|
||||
protected static final long THIRTY_MINUTES = 1800000;
|
||||
|
||||
static{
|
||||
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
protected ServiceBackupJob(String name, String primarySite) {
|
||||
this.name = name;
|
||||
this.primarySite = primarySite;
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected ServerResponse<String> makeRequest(IServerRequest request)
|
||||
throws GFEServerException {
|
||||
ServerResponse<String> rval = null;
|
||||
|
||||
try {
|
||||
if (request instanceof AbstractGfeRequest) {
|
||||
((AbstractGfeRequest) request).setWorkstationID(VizApp
|
||||
.getWsId());
|
||||
((AbstractGfeRequest) request).setSiteID(primarySite);
|
||||
}
|
||||
Object obj = ThriftClient.sendRequest(request);
|
||||
if ((request instanceof ActivateSiteRequest)
|
||||
|| (request instanceof DeactivateSiteRequest)) {
|
||||
return new ServerResponse<String>();
|
||||
}
|
||||
|
||||
if (obj instanceof ServerResponse) {
|
||||
rval = (ServerResponse<String>) obj;
|
||||
} else {
|
||||
failed = true;
|
||||
throw new GFEServerException(
|
||||
"Received invalid response object from GFE Server. Received ["
|
||||
+ obj.getClass().getName() + "] excepted ["
|
||||
+ ServerResponse.class.getName());
|
||||
}
|
||||
} catch (VizException e) {
|
||||
failed = true;
|
||||
throw new GFEServerException(e);
|
||||
}
|
||||
|
||||
if ((rval != null) && !rval.isOkay()) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if (rval.getMessages().size() > 1) {
|
||||
msg.append("Errors ");
|
||||
} else {
|
||||
msg.append("Error ");
|
||||
}
|
||||
msg.append("occurred on GFE server -");
|
||||
Iterator<ServerMsg> iter = rval.getMessages().iterator();
|
||||
while (iter.hasNext()) {
|
||||
msg.append(iter.next().getMessage());
|
||||
if (iter.hasNext()) {
|
||||
msg.append(", ");
|
||||
}
|
||||
}
|
||||
failed = true;
|
||||
throw new GFEServerException(msg.toString());
|
||||
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
public boolean aborted(){
|
||||
return aborted;
|
||||
}
|
||||
|
||||
public boolean failed() {
|
||||
return failed;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -1,104 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 10, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ServiceBackupJobManager extends Thread {
|
||||
|
||||
protected static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ServiceBackupJob.class);
|
||||
|
||||
private ArrayBlockingQueue<ServiceBackupJob> jobQueue = new ArrayBlockingQueue<ServiceBackupJob>(
|
||||
10);
|
||||
|
||||
private static ServiceBackupJobManager instance;
|
||||
|
||||
private boolean running;
|
||||
|
||||
public static ServiceBackupJobManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ServiceBackupJobManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private ServiceBackupJobManager() {
|
||||
setDaemon(true);
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
running = true;
|
||||
while (true) {
|
||||
try {
|
||||
ServiceBackupJob job = jobQueue.take();
|
||||
try {
|
||||
job.run();
|
||||
if (job.aborted()) {
|
||||
statusHandler.error("Service Backup Job: ["
|
||||
+ job.getName() + "] ABORTED!");
|
||||
jobQueue.clear();
|
||||
} else if (job.failed()) {
|
||||
statusHandler.error("Service Backup Job: ["
|
||||
+ job.getName() + "] FAILED! See Service Backup logs for details.");
|
||||
jobQueue.clear();
|
||||
} else {
|
||||
statusHandler.info("Service Backup Job: ["
|
||||
+ job.getName() + "] successfully completed!");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
statusHandler.error("Service Backup Job: [" + job.getName()
|
||||
+ "] FAILED!", e);
|
||||
jobQueue.clear();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addJob(ServiceBackupJob job) {
|
||||
jobQueue.add(job);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
|
||||
/**
|
||||
* Service Backup Task Executor
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ServiceBackupTaskExecutor extends Thread {
|
||||
|
||||
private List<AbstractSbuTask> tasks;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private JobProgress jobStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ServiceBackupTaskExecutor(List<AbstractSbuTask> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
this.cancelled = true;
|
||||
this.interrupt();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Thread#start()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void start() {
|
||||
this.jobStatus = JobProgress.IN_PROGRESS;
|
||||
this.cancelled = false;
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (AbstractSbuTask task : tasks) {
|
||||
if (cancelled) {
|
||||
break;
|
||||
}
|
||||
|
||||
task.run();
|
||||
|
||||
if (!task.getStatus().equals(JobProgress.SUCCESS)) {
|
||||
cancelled = true;
|
||||
jobStatus = JobProgress.FAILED;
|
||||
}
|
||||
}
|
||||
jobStatus = JobProgress.SUCCESS;
|
||||
}
|
||||
|
||||
public JobProgress getJobStatus() {
|
||||
return this.jobStatus;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.site.notify.ClusterActivationNotification;
|
||||
import com.raytheon.uf.common.site.notify.SiteActivationNotification.ACTIVATIONSTATUS;
|
||||
import com.raytheon.uf.common.site.notify.SiteActivationNotification.ACTIVATIONTYPE;
|
||||
import com.raytheon.uf.common.site.requests.ActivateSiteRequest;
|
||||
import com.raytheon.uf.common.site.requests.DeactivateSiteRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* Service Backup Task to activate/deactivate a GFE site
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 18, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SiteActivationSbuTask extends ServerRequestSbuTask implements
|
||||
INotificationObserver {
|
||||
private static final String SITE_ACTIVATION_TOPIC = "edex.alerts.siteActivate";
|
||||
|
||||
private JobProgress status;
|
||||
|
||||
private String siteID;
|
||||
|
||||
private ACTIVATIONTYPE type;
|
||||
|
||||
/**
|
||||
* @param siteID
|
||||
* @param activate
|
||||
* true to activate, false to deactivate
|
||||
* @param statusFileName
|
||||
* @param guiDescription
|
||||
*/
|
||||
public SiteActivationSbuTask(String siteID, ACTIVATIONTYPE type,
|
||||
String statusFileName, String guiDescription) {
|
||||
super(statusFileName, guiDescription, (type
|
||||
.equals(ACTIVATIONTYPE.ACTIVATE) ? new ActivateSiteRequest(
|
||||
siteID, "gfe") : new DeactivateSiteRequest(siteID, "gfe")));
|
||||
this.siteID = siteID;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.dialogs.sbu.jobs.ServerRequestSbuTask#runTask()
|
||||
*/
|
||||
@Override
|
||||
public JobProgress runTask() throws VizException {
|
||||
status = JobProgress.FAILED;
|
||||
|
||||
if (request instanceof AbstractGfeRequest) {
|
||||
((AbstractGfeRequest) request).setWorkstationID(VizApp.getWsId());
|
||||
}
|
||||
|
||||
NotificationManagerJob.addObserver(SITE_ACTIVATION_TOPIC, this);
|
||||
|
||||
try {
|
||||
ThriftClient.sendRequest(request);
|
||||
|
||||
status = JobProgress.IN_PROGRESS;
|
||||
while (status.equals(JobProgress.IN_PROGRESS)) {
|
||||
// TODO: add timeout
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
status = JobProgress.FAILED;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(SITE_ACTIVATION_TOPIC, this);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.jms.notification.INotificationObserver#
|
||||
* notificationArrived
|
||||
* (com.raytheon.uf.common.jms.notification.NotificationMessage[])
|
||||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj;
|
||||
try {
|
||||
obj = msg.getMessagePayload();
|
||||
if (obj instanceof ClusterActivationNotification) {
|
||||
ClusterActivationNotification notif = (ClusterActivationNotification) obj;
|
||||
if (this.siteID.equals(notif.getModifiedSite())) {
|
||||
if (notif.getType().equals(this.type)) {
|
||||
if (notif.getStatus().equals(
|
||||
ACTIVATIONSTATUS.SUCCESS)) {
|
||||
status = JobProgress.SUCCESS;
|
||||
} else if (notif.getStatus().equals(
|
||||
ACTIVATIONSTATUS.FAILURE)) {
|
||||
status = JobProgress.FAILED;
|
||||
} else {
|
||||
status = JobProgress.FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to read incoming notification", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* 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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.GetGfeStartCmdRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress;
|
||||
import com.raytheon.uf.common.util.RunProcess;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.GFEException;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* Service backup task to start a GFE session
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 18, 2015 #4300 randerso Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class StartGfeSbuTask extends ServerRequestSbuTask {
|
||||
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* @param site
|
||||
* @param statusFileName
|
||||
* @param guiDescription
|
||||
*/
|
||||
public StartGfeSbuTask(String site, String statusFileName,
|
||||
String guiDescription) {
|
||||
super(statusFileName, guiDescription, new GetGfeStartCmdRequest(site));
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.dialogs.sbu.jobs.ServerRequestSbuTask#runTask()
|
||||
*/
|
||||
@Override
|
||||
public JobProgress runTask() throws VizException {
|
||||
JobProgress rval = JobProgress.FAILED;
|
||||
|
||||
if (request instanceof AbstractGfeRequest) {
|
||||
((AbstractGfeRequest) request).setWorkstationID(VizApp.getWsId());
|
||||
}
|
||||
|
||||
Object obj = ThriftClient.sendRequest(request);
|
||||
if (obj instanceof String) {
|
||||
String cmd = (String) obj;
|
||||
|
||||
if (cmd != null) {
|
||||
statusHandler
|
||||
.info("Attempting to start GFE using the following command: "
|
||||
+ cmd);
|
||||
// start GFE session
|
||||
try {
|
||||
RunProcess.getRunProcess().exec(cmd.split(" "));
|
||||
rval = JobProgress.SUCCESS;
|
||||
} catch (IOException e) {
|
||||
throw new GFEException("Error starting GFE session for "
|
||||
+ this.site, e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new GFEServerException(
|
||||
"Received invalid response object from GFE Server. Received ["
|
||||
+ obj.getClass().getName() + "] excepted ["
|
||||
+ String.class.getName());
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,131 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.site.notify.ClusterActivationNotification;
|
||||
import com.raytheon.uf.common.site.notify.SiteActivationNotification;
|
||||
import com.raytheon.uf.common.site.requests.ActivateSiteRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 9, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuActivateSiteJob extends ServiceBackupJob implements
|
||||
INotificationObserver {
|
||||
|
||||
private String siteToActivate;
|
||||
|
||||
private ClusterActivationNotification notification;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuActivateSiteJob(String name, String primarySite) {
|
||||
super("Activate Site: " + name, primarySite);
|
||||
this.siteToActivate = name;
|
||||
NotificationManagerJob.addObserver(ServiceBackupDlg.ACTIVATION_TOPIC, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ActivateSiteRequest request = new ActivateSiteRequest(siteToActivate,
|
||||
"gfe");
|
||||
try {
|
||||
makeRequest(request);
|
||||
while (notification == null) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
if (notification.isClusterActive()) {
|
||||
statusHandler
|
||||
.info(notification.getModifiedSite()
|
||||
+ " has been successfully activated on all cluster members");
|
||||
} else if (notification.isFailure()) {
|
||||
statusHandler
|
||||
.error(notification.getModifiedSite()
|
||||
+ " has failed to activate on some or all cluster members. See logs for details");
|
||||
this.failed = true;
|
||||
}
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to activate "
|
||||
+ siteToActivate, e);
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(ServiceBackupDlg.ACTIVATION_TOPIC, this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.jms.notification.INotificationObserver#
|
||||
* notificationArrived
|
||||
* (com.raytheon.uf.common.jms.notification.NotificationMessage[])
|
||||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj;
|
||||
try {
|
||||
obj = msg.getMessagePayload();
|
||||
String message = null;
|
||||
if (obj instanceof ClusterActivationNotification) {
|
||||
ClusterActivationNotification notify = (ClusterActivationNotification) obj;
|
||||
if (notify.getPluginName().equals("gfe")
|
||||
&& notify.isActivation()) {
|
||||
this.notification = notify;
|
||||
}
|
||||
} else if (obj instanceof SiteActivationNotification) {
|
||||
message = dateFormat.format(new Date()) + " "
|
||||
+ obj.toString();
|
||||
}
|
||||
statusHandler.info(message);
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to read incoming notification", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.CleanupSvcBuRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 11, 2011 bphillip Initial creation
|
||||
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuCleanupJob extends ServiceBackupJob {
|
||||
|
||||
private String failedSite;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuCleanupJob(String primarySite, String failedSite) {
|
||||
super("Cleanup: " + failedSite, primarySite);
|
||||
this.failedSite = failedSite;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
CleanupSvcBuRequest request = new CleanupSvcBuRequest(failedSite);
|
||||
try {
|
||||
makeRequest(request);
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to clean up "
|
||||
+ this.failedSite, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,131 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.site.notify.ClusterActivationNotification;
|
||||
import com.raytheon.uf.common.site.notify.SiteActivationNotification;
|
||||
import com.raytheon.uf.common.site.requests.DeactivateSiteRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 10, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuDeactivateSiteJob extends ServiceBackupJob implements
|
||||
INotificationObserver {
|
||||
|
||||
private String siteToDeactivate;
|
||||
|
||||
private ClusterActivationNotification notification;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuDeactivateSiteJob(String name, String primarySite) {
|
||||
super("Deactivate Site: " + name, primarySite);
|
||||
this.siteToDeactivate = name;
|
||||
NotificationManagerJob.addObserver(ServiceBackupDlg.ACTIVATION_TOPIC, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
DeactivateSiteRequest request = new DeactivateSiteRequest(
|
||||
siteToDeactivate, "gfe");
|
||||
try {
|
||||
makeRequest(request);
|
||||
while (notification == null) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
if (notification.isClusterActive()) {
|
||||
statusHandler
|
||||
.info(notification.getModifiedSite()
|
||||
+ " has been successfully deactivated on all cluster members");
|
||||
} else if (notification.isFailure()) {
|
||||
statusHandler
|
||||
.error(notification.getModifiedSite()
|
||||
+ " has failed to deactivate on some or all cluster members. See logs for details");
|
||||
this.failed = true;
|
||||
}
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to activate "
|
||||
+ siteToDeactivate, e);
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(ServiceBackupDlg.ACTIVATION_TOPIC, this);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.jms.notification.INotificationObserver#
|
||||
* notificationArrived
|
||||
* (com.raytheon.uf.common.jms.notification.NotificationMessage[])
|
||||
*/
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
for (NotificationMessage msg : messages) {
|
||||
Object obj;
|
||||
try {
|
||||
obj = msg.getMessagePayload();
|
||||
String message = null;
|
||||
if (obj instanceof ClusterActivationNotification) {
|
||||
ClusterActivationNotification notify = (ClusterActivationNotification) obj;
|
||||
if (notify.getPluginName().equals("gfe")
|
||||
&& notify.isDeactivation()) {
|
||||
this.notification = notify;
|
||||
}
|
||||
} else if (obj instanceof SiteActivationNotification) {
|
||||
message = dateFormat.format(new Date()) + " "
|
||||
+ obj.toString();
|
||||
}
|
||||
statusHandler.info(message);
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to read incoming notification", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.auth.user.IUser;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ExportConfRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 5, 2011 bphillip Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuExportConfJob extends ServiceBackupJob {
|
||||
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* @param site
|
||||
*/
|
||||
public SvcbuExportConfJob(String site) {
|
||||
super("Export Configuration: " + site, site);
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IUser user = UserController.getUserObject();
|
||||
if (user != null) {
|
||||
ExportConfRequest request = new ExportConfRequest(user, this.site);
|
||||
try {
|
||||
makeRequest(request);
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to export configuration. ",
|
||||
e);
|
||||
}
|
||||
} else {
|
||||
statusHandler.handle(Priority.PROBLEM, "USER CANNOT BE NULL!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,71 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ExportGridsRequest.ExportGridsMode;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 05, 2011 bphillip Initial creation
|
||||
* Apr 30, 2013 #1761 dgilling Support changes made to
|
||||
* ExportGridsRequest.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuExportDigitalDataJob extends ServiceBackupJob {
|
||||
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuExportDigitalDataJob(String site) {
|
||||
super("Export Digital Data: " + site, site);
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ExportGridsRequest request = new ExportGridsRequest(site,
|
||||
ExportGridsMode.MANUAL);
|
||||
try {
|
||||
makeRequest(request);
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to export " + site
|
||||
+ "'s digital data to the central server!", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,70 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ExportDataToFailedSiteRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 10, 2011 bphillip Initial creation
|
||||
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuExportDigitalDataToFailedSiteJob extends ServiceBackupJob {
|
||||
|
||||
private String failedSite;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuExportDigitalDataToFailedSiteJob(String primarySite,
|
||||
String failedSite) {
|
||||
super("Export Grids to: " + failedSite, primarySite);
|
||||
this.failedSite = failedSite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ExportDataToFailedSiteRequest request = new ExportDataToFailedSiteRequest(
|
||||
failedSite);
|
||||
try {
|
||||
makeRequest(request);
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to export grids to "
|
||||
+ failedSite, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,74 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ExportFailedSiteDataToCCRequest;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 10, 2011 bphillip Initial creation
|
||||
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuExportFailedSiteDataJob extends ServiceBackupJob {
|
||||
|
||||
private String failedSite;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuExportFailedSiteDataJob(String primarySite, String failedSite) {
|
||||
super("Export Failed Site Digital Data: " + failedSite, primarySite);
|
||||
this.failedSite = failedSite;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
ExportFailedSiteDataToCCRequest request = new ExportFailedSiteDataToCCRequest(
|
||||
failedSite);
|
||||
try {
|
||||
makeRequest(request);
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to export " + failedSite
|
||||
+ "'s digital data to the central server.", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,202 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ImportConfRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ProgressDlg;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 05, 2011 bphillip Initial creation
|
||||
* Mar 20, 2013 1447 dgilling Add support for service backup
|
||||
* troubleshooting mode from A1.
|
||||
* Feb 13, 2015 #4103 dgilling Use site id in AbortOperationRequest.
|
||||
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuImportConfJob extends ServiceBackupJob implements
|
||||
INotificationObserver {
|
||||
|
||||
private String failedSite;
|
||||
|
||||
private boolean trMode;
|
||||
|
||||
private ProgressDlg progress;
|
||||
|
||||
private boolean complete;
|
||||
|
||||
private long startTime;
|
||||
|
||||
private String errorMsg;
|
||||
|
||||
public SvcbuImportConfJob(String primarySite, String failedSite,
|
||||
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(failedSite, trMode);
|
||||
try {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
progress.open();
|
||||
}
|
||||
});
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
makeRequest(request);
|
||||
while (!complete) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - startTime > THIRTY_MINUTES) {
|
||||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean wait = MessageDialog.openQuestion(
|
||||
progress.getShell(),
|
||||
"Question",
|
||||
"Configuration has not been imported after 30 minutes. Do you wish to continue to wait?");
|
||||
if (wait) {
|
||||
startTime = System.currentTimeMillis();
|
||||
} else {
|
||||
complete = true;
|
||||
aborted = true;
|
||||
progress.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (aborted) {
|
||||
AbortOperationRequest abortRequest = new AbortOperationRequest(
|
||||
"importConfiguration", failedSite);
|
||||
try {
|
||||
Object obj = ThriftClient.sendRequest(abortRequest);
|
||||
if (obj instanceof ServerResponse) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ServerResponse<String> rval = (ServerResponse<String>) obj;
|
||||
if (!rval.isOkay()) {
|
||||
errorMsg = rval.message();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error processing get abort operation request", e);
|
||||
}
|
||||
} else if (complete) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
progress.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (errorMsg != null) {
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to import digital data for "
|
||||
+ failedSite, e);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP: " + e.getLocalizedMessage());
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(
|
||||
ServiceBackupDlg.NOTIFY_TOPIC, this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
try {
|
||||
for (NotificationMessage msg : messages) {
|
||||
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
|
||||
.getMessagePayload();
|
||||
for (GfeNotification notification : notifications) {
|
||||
/*
|
||||
* FIXME: If we're going to continue to use this class, fix
|
||||
* this notificationArrived handler.
|
||||
*/
|
||||
// if (notification instanceof
|
||||
// ServiceBackupMessageNotification) {
|
||||
// ServiceBackupMessageNotification notify =
|
||||
// (ServiceBackupMessageNotification) notification;
|
||||
// if (notify.getMessage().equals(
|
||||
// "Import Configuration Complete!")) {
|
||||
// complete = true;
|
||||
// } else if (notify.getMessage().startsWith(
|
||||
// "Error Processing Configuration Data!")) {
|
||||
// complete = true;
|
||||
// failed = true;
|
||||
// errorMsg = notify.getMessage();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error processing gfe notifications!!", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,206 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.AbortOperationRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.ImportDigitalDataRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
|
||||
import com.raytheon.uf.common.jms.notification.INotificationObserver;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationException;
|
||||
import com.raytheon.uf.common.jms.notification.NotificationMessage;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ProgressDlg;
|
||||
import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 08, 2011 bphillip Initial creation
|
||||
* Feb 13, 2015 #4103 dgilling Use site id in AbortOperationRequest.
|
||||
* Mar 18, 2015 #4103 dgilling Remove unnecessary primary site field.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuImportDataJob extends ServiceBackupJob implements
|
||||
INotificationObserver {
|
||||
|
||||
private String failedSite;
|
||||
|
||||
private ProgressDlg progress;
|
||||
|
||||
private boolean complete;
|
||||
|
||||
private long startTime;
|
||||
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuImportDataJob(String primarySite, String failedSite,
|
||||
ProgressDlg progress) {
|
||||
super("Import Digital Data: " + failedSite, primarySite);
|
||||
this.failedSite = failedSite;
|
||||
this.progress = progress;
|
||||
NotificationManagerJob.addObserver(ServiceBackupDlg.NOTIFY_TOPIC, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
ImportDigitalDataRequest request = new ImportDigitalDataRequest(
|
||||
failedSite);
|
||||
|
||||
try {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
progress.open();
|
||||
}
|
||||
});
|
||||
startTime = System.currentTimeMillis();
|
||||
makeRequest(request);
|
||||
while (!complete) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - startTime > THIRTY_MINUTES) {
|
||||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean wait = MessageDialog.openQuestion(
|
||||
progress.getShell(),
|
||||
"Question",
|
||||
"Grids have not been imported after 30 minutes. Do you wish to continue to wait?");
|
||||
if (wait) {
|
||||
startTime = System.currentTimeMillis();
|
||||
} else {
|
||||
complete = true;
|
||||
aborted = true;
|
||||
progress.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (aborted) {
|
||||
AbortOperationRequest abortRequest = new AbortOperationRequest(
|
||||
"importGrids", failedSite);
|
||||
try {
|
||||
Object obj = ThriftClient.sendRequest(abortRequest);
|
||||
if (obj instanceof ServerResponse) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ServerResponse<String> rval = (ServerResponse<String>) obj;
|
||||
if (!rval.isOkay()) {
|
||||
errorMsg = rval.message();
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error processing abort operation request", e);
|
||||
}
|
||||
} else if (complete) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
progress.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (errorMsg != null) {
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to import digital data for "
|
||||
+ failedSite, e);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP: " + e.getLocalizedMessage());
|
||||
} finally {
|
||||
NotificationManagerJob.removeObserver(
|
||||
ServiceBackupDlg.NOTIFY_TOPIC, this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void notificationArrived(NotificationMessage[] messages) {
|
||||
try {
|
||||
for (NotificationMessage msg : messages) {
|
||||
ArrayList<GfeNotification> notifications = (ArrayList<GfeNotification>) msg
|
||||
.getMessagePayload();
|
||||
for (GfeNotification notification : notifications) {
|
||||
/*
|
||||
* FIXME: If we're going to continue to use this class, fix
|
||||
* this notificationArrived handler.
|
||||
*/
|
||||
// if (notification instanceof
|
||||
// ServiceBackupMessageNotification) {
|
||||
// ServiceBackupMessageNotification notify =
|
||||
// (ServiceBackupMessageNotification) notification;
|
||||
// if (notify.getMessage().equals("Import Data Complete!"))
|
||||
// {
|
||||
// complete = true;
|
||||
// } else if (notify.getMessage().startsWith(
|
||||
// "Error Processing Digital Data!")) {
|
||||
// complete = true;
|
||||
// failed = true;
|
||||
// errorMsg = notify.getMessage();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
} catch (NotificationException e) {
|
||||
statusHandler.error("Error processing gfe notifications!!", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +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.viz.gfe.dialogs.sbu.jobs;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.GetGfeStartCmdRequest;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.RunProcess;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 9, 2011 bphillip Initial creation
|
||||
* Sep 19, 2011 10955 rferrel Use RunProcess
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SvcbuStartGfeJob extends ServiceBackupJob {
|
||||
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public SvcbuStartGfeJob(String name, String primarySite) {
|
||||
super("Starting GFE: " + name, primarySite);
|
||||
this.site = name;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
GetGfeStartCmdRequest request = new GetGfeStartCmdRequest(site);
|
||||
try {
|
||||
ServerResponse<String> sr = makeRequest(request);
|
||||
String launchScript = sr.getPayload();
|
||||
// DR#10955
|
||||
RunProcess.getRunProcess().exec(launchScript.split(" "));
|
||||
} catch (GFEServerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Unable to get GFE launch script "
|
||||
+ site + e.getLocalizedMessage(), e);
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"SERVICE BACKUP problem: Error starting new GFE instance! "
|
||||
+ site + e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<nwsRoleData xmlns:ns2="group">
|
||||
<!-- AWIPS 2 User Admin Roles/Permissions file -->
|
||||
<application>GFE</application>
|
||||
<permission id="exportConfig">
|
||||
<description>
|
||||
This permission allows the user to export GFE configuration files to the Central Server
|
||||
</description>
|
||||
</permission>
|
||||
<permission id="serviceBackup">
|
||||
<description>
|
||||
This permission allows the user to run the GFE Service Backup GUI
|
||||
</description>
|
||||
</permission>
|
||||
<role roleId="focalPoint">
|
||||
<roleDescription>
|
||||
This role is a grouping of permissions for GFE Focal Points
|
||||
</roleDescription>
|
||||
<rolePermission>exportConfig</rolePermission>
|
||||
</role>
|
||||
<role roleId="gfeUser">
|
||||
<roleDescription>
|
||||
This role is a grouping of permissions for GFE users
|
||||
</roleDescription>
|
||||
<rolePermission>serviceBackup</rolePermission>
|
||||
</role>
|
||||
|
||||
<user userId="ALL">
|
||||
<userRole>gfeUser</userRole>
|
||||
</user>
|
||||
</nwsRoleData>
|
|
@ -51,6 +51,7 @@
|
|||
# Added Topo to ISCPARMS
|
||||
# 01/19/2015 #4014 dgilling Added ETSS.
|
||||
# 02/11/2015 #4053 rferrel Added GLWN and moved GLERL to display only for Great Lakes sites..
|
||||
# 03/19/2015 #4300 randerso Remove GUMa as it is obsolete (per Shannon White)
|
||||
########################################################################
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -924,7 +925,7 @@ SITES = {
|
|||
'AICE' : ([560, 340], (9.0, 11.0), (29.0, 19.0), 'America/Anchorage',
|
||||
Grid203, "nc"),
|
||||
#Nested for GUM (future)
|
||||
'GUMa': ([193, 193], (23.0, 26.0), (3.0, 3.0), 'Pacific/Guam', Grid204, "other"),
|
||||
# 'GUMa': ([193, 193], (23.0, 26.0), (3.0, 3.0), 'Pacific/Guam', Grid204, "other"),
|
||||
#Regional Offices
|
||||
'VUY' : ([337,449], (62.00, 19.00), (21.0, 28.0), 'EST5EDT', Grid211, "ro"),
|
||||
'BCQ' : ([145,145], (50.00, 27.00), (9.0, 9.0), 'CST6CDT', Grid211, "ro"),
|
||||
|
|
|
@ -63,6 +63,8 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
*/
|
||||
|
||||
public class VTECPartners {
|
||||
// TODO: move this out of the common plugin since it only works on EDEX
|
||||
// since it accesses EDEX_STATIC files
|
||||
|
||||
private static final String CONFIG_PATH = "config" + File.separator + "gfe";
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 5, 2011 randerso Initial creation
|
||||
* Aug 05, 2011 randerso Initial creation
|
||||
* Mar 19, 2015 #4300 randerso Changed return type to what is actually returned
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,7 +52,8 @@ public class GetActiveSitesHandler implements
|
|||
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
|
||||
*/
|
||||
@Override
|
||||
public Object handleRequest(GetActiveSitesRequest request) throws Exception {
|
||||
public String[] handleRequest(GetActiveSitesRequest request)
|
||||
throws Exception {
|
||||
return SiteAwareRegistry.getInstance().getActiveSites();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
# further licensing information.
|
||||
##
|
||||
##############################################################################
|
||||
# TODO: ADD DESCRIPTION
|
||||
# Activate a site
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 09/10/14 #3623 randerso Initial Creation.
|
||||
# 03/19/15 #4300 randerso Fixed comment
|
||||
##############################################################################
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
# further licensing information.
|
||||
##
|
||||
##############################################################################
|
||||
# TODO: ADD DESCRIPTION
|
||||
# Deactivate a site
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 09/10/14 #3623 randerso Initial Creation.
|
||||
# 03/19/15 #4300 randerso Fixed comment
|
||||
##############################################################################
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
|
|
Loading…
Add table
Reference in a new issue