Issue #1655 - Implement the framework for DD system status messaging

Change-Id: I621cd07fdf6a742b0af4408dad534844d08e9e55

Former-commit-id: c07c4b9e8c [formerly 1ca50d2c4f] [formerly 7acfe076a0] [formerly c07c4b9e8c [formerly 1ca50d2c4f] [formerly 7acfe076a0] [formerly 2c98a91d05 [formerly 7acfe076a0 [formerly 4f51d50f9d6ea76f3b2cb2e828c6b6f8e192fb38]]]]
Former-commit-id: 2c98a91d05
Former-commit-id: 87ebf5b62c [formerly 7971b31475] [formerly 20fcd925338e1b43130104d89f2dd2ca5f14a124 [formerly 218c46928b]]
Former-commit-id: e550532c1ec421d33570b8321aa72307f2f9aba9 [formerly 299845987c]
Former-commit-id: f8dde28fc5
This commit is contained in:
Mike Duff 2013-07-16 11:30:03 -05:00
parent ad32bbd91d
commit 9b97f03f55
19 changed files with 1313 additions and 10 deletions

View file

@ -64,6 +64,7 @@ Export-Package: com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.geom,
com.raytheon.uf.viz.core.globals,
com.raytheon.uf.viz.core.icon,
com.raytheon.uf.viz.core.image,
com.raytheon.uf.viz.core.interp,
com.raytheon.uf.viz.core.jobs,
com.raytheon.uf.viz.core.legend,

View file

@ -0,0 +1,155 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.core.image;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
* Images for use in Viz Code. These are small circular images.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 17, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class StatusImages {
/**
* Status Image enum.
*/
public enum StatusImage {
RED(SWT.COLOR_RED), YELLOW(SWT.COLOR_YELLOW), GREEN(SWT.COLOR_GREEN), UNKNOWN(
SWT.COLOR_GRAY);
private final int colorId;
StatusImage(int id) {
colorId = id;
}
public int getColorId() {
return colorId;
}
}
/** Array of images */
private final Map<StatusImage, Image> statusImages = new HashMap<StatusImage, Image>();
private final Shell shell;
/**
* Constructor.
*
* @param shell
* The shell these images are associated with.
*/
public StatusImages(Shell shell) {
this.shell = shell;
this.shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
for (StatusImage si : statusImages.keySet()) {
statusImages.get(si).dispose();
}
}
});
}
/**
* Get a status image.
*
* @param image
* The image to get
* @param width
* image width
* @param height
* image height
* @return The image
*/
private Image getStatusImage(StatusImage image, int width, int height) {
Image img = statusImages.get(image);
if (img == null) {
img = new Image(Display.getCurrent(), width, height);
GC gc = new GC(img);
drawCircleImage(gc, width, height, image.getColorId());
gc.dispose();
statusImages.put(image, img);
}
return img;
}
/**
* Get a status image 12 x 12 in size.
*
* @param image
* The image to get
* @return The image
*/
public Image getStatusImage(StatusImage image) {
return getStatusImage(image, 12, 12);
}
/**
* Draw the circle image.
*
* @param gc
* Graphics context.
* @param imgWidth
* Image width.
* @param imgHeight
* Image height.
* @param colorId
* Color to paint the image.
*/
private void drawCircleImage(GC gc, int imgWidth, int imgHeight, int colorId) {
gc.setAntialias(SWT.ON);
Display disp = Display.getCurrent();
gc.setBackground(disp.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(0, 0, imgWidth, imgHeight);
gc.setBackground(disp.getSystemColor(colorId));
gc.fillOval(0, 0, imgWidth - 1, imgHeight - 1);
gc.setBackground(disp.getSystemColor(SWT.COLOR_BLACK));
gc.drawOval(0, 0, imgWidth - 1, imgHeight - 1);
}
}

View file

@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.datadelivery.retrieval;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0",
com.raytheon.uf.common.units;bundle-version="1.0.0",
com.raytheon.uf.common.site;bundle-version="1.12.1174"
com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.common.event;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework",

View file

@ -0,0 +1,260 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.system;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatusDefinition;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusRequest;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusResponse;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.image.StatusImages;
import com.raytheon.uf.viz.core.image.StatusImages.StatusImage;
/**
* Data Delivery Status Tab
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 17, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class StatusTab extends SystemTab {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(StatusTab.class);
/** Provider Group */
private Composite providerComp;
/** Registry Group */
private Composite registryComp;
private StatusImages images;
/**
* Constructor.
*
* @param parentComp
* The Composite holding these
* controlsDataDeliverySystemStatusDefinition
*/
public StatusTab(Composite parentComp) {
super(parentComp);
}
/**
* {@inheritDoc}
*/
@Override
public void init() {
images = new StatusImages(getParentComp().getShell());
GridLayout gl = new GridLayout(2, true);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gl.marginWidth = 0;
Composite sysComp = new Composite(parentComp, SWT.NONE);
sysComp.setLayout(gl);
sysComp.setLayoutData(gd);
gl = new GridLayout(1, false);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Group registryGrp = new Group(sysComp, SWT.NONE);
registryGrp.setText(" Registry Status ");
registryGrp.setLayout(gl);
registryGrp.setLayoutData(gd);
gl = new GridLayout(1, true);
gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false);
registryComp = new Composite(registryGrp, SWT.NONE);
registryComp.setLayout(gl);
registryComp.setLayoutData(gd);
gl = new GridLayout(1, false);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Group providerGroup = new Group(sysComp, SWT.NONE);
providerGroup.setText(" Provider Status ");
providerGroup.setLayout(gl);
providerGroup.setLayoutData(gd);
gl = new GridLayout(1, true);
gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false);
providerComp = new Composite(providerGroup, SWT.NONE);
providerComp.setLayout(gl);
providerComp.setLayoutData(gd);
// Legend
gl = new GridLayout(8, false);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Group legendGrp = new Group(parentComp, SWT.NONE);
legendGrp.setText(" Legend ");
legendGrp.setLayout(gl);
legendGrp.setLayoutData(gd);
Label l = new Label(legendGrp, SWT.NONE);
l.setImage(images.getStatusImage(StatusImage.GREEN));
Label l2 = new Label(legendGrp, SWT.NONE);
l2.setText(DataDeliverySystemStatusDefinition.UP.getStatus() + " ");
Label l3 = new Label(legendGrp, SWT.NONE);
l3.setImage(images.getStatusImage(StatusImage.YELLOW));
Label l4 = new Label(legendGrp, SWT.NONE);
l4.setText(DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
+ " ");
Label l5 = new Label(legendGrp, SWT.NONE);
l5.setImage(images.getStatusImage(StatusImage.RED));
Label l6 = new Label(legendGrp, SWT.NONE);
l6.setText(DataDeliverySystemStatusDefinition.DOWN.getStatus() + " ");
Label l7 = new Label(legendGrp, SWT.NONE);
l7.setImage(images.getStatusImage(StatusImage.UNKNOWN));
Label l8 = new Label(legendGrp, SWT.NONE);
l8.setText(DataDeliverySystemStatusDefinition.UNKNOWN.getStatus() + "");
populate();
}
/**
* Populate this tab.
*/
private void populate() {
try {
SystemStatusResponse response = (SystemStatusResponse) RequestRouter
.route(new SystemStatusRequest(),
DataDeliveryConstants.DATA_DELIVERY_SERVER);
SystemStatusData statusData = new SystemStatusData(
response.getData());
for (String systemType : statusData.getSystemTypes()) {
if (systemType.equalsIgnoreCase("Provider")) {
List<DataDeliverySystemStatus> dataList = statusData
.getRecords(systemType);
addProviders(dataList);
} else if (systemType.equalsIgnoreCase("Registry")) {
List<DataDeliverySystemStatus> dataList = statusData
.getRecords(systemType);
addRegistries(dataList);
}
}
} catch (Exception e) {
statusHandler.error("Error generating Status Data", e);
}
}
/**
* Add Provider status information.
*
* @param dataList
* List of system statuses
*/
private void addProviders(List<DataDeliverySystemStatus> dataList) {
for (DataDeliverySystemStatus status : dataList) {
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite entryComp = new Composite(providerComp, SWT.NONE);
entryComp.setLayout(gl);
entryComp.setLayoutData(gd);
Label l = new Label(entryComp, SWT.NONE);
if (DataDeliverySystemStatusDefinition.UP.getStatus().equals(
status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.GREEN));
} else if (DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
.equals(status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.YELLOW));
} else if (DataDeliverySystemStatusDefinition.DOWN.getStatus()
.equals(status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.RED));
} else {
l.setImage(images.getStatusImage(StatusImage.UNKNOWN));
}
Label nameLbl = new Label(entryComp, SWT.NONE);
nameLbl.setText(status.getKey().getName());
}
}
/**
* Add Registry status information.
*
* @param dataList
* List of registry statuses
*/
private void addRegistries(List<DataDeliverySystemStatus> dataList) {
for (DataDeliverySystemStatus status : dataList) {
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite entryComp = new Composite(registryComp, SWT.NONE);
entryComp.setLayout(gl);
entryComp.setLayoutData(gd);
Label l = new Label(entryComp, SWT.NONE);
if (DataDeliverySystemStatusDefinition.UP.getStatus().equals(
status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.GREEN));
} else if (DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
.equals(status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.YELLOW));
} else if (DataDeliverySystemStatusDefinition.DOWN.getStatus()
.equals(status.getStatus())) {
l.setImage(images.getStatusImage(StatusImage.RED));
} else {
l.setImage(images.getStatusImage(StatusImage.UNKNOWN));
}
Label nameLbl = new Label(entryComp, SWT.NONE);
nameLbl.setText(status.getKey().getName());
}
}
/**
* {@inheritDoc}
*/
@Override
public String getTabText() {
return "System Status";
}
}

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Jan 17, 2013 1501 djohnson Close the dialog when force apply occurs,
* and check whether changes have already been applied when OK is pressed.
* May 17, 2013 2000 djohnson Move bandwidth configuration into its own tab, add subscription overlap rules.
* Jul 16, 2013 1655 mpduff Add system status tab.
*
* </pre>
*
@ -84,6 +85,9 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
/** The bandwidth tab */
private BandwidthTab bTab;
/** The status tab */
private StatusTab statusTab;
/**
* Constructor.
*
@ -164,6 +168,10 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
createTabItem(tabFolder, bTab);
bTab.init();
statusTab = new StatusTab(getTabComposite(tabFolder));
createTabItem(tabFolder, statusTab);
statusTab.init();
lTab.loadList();
pTab.loadList();
}

View file

@ -0,0 +1,122 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.system;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* System Status Data Object
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class SystemStatusData {
/** The Multimap data structure */
@DynamicSerializeElement
private final Multimap<String, DataDeliverySystemStatus> systemTypesMap = ArrayListMultimap
.create();
/**
* Constructor.
*/
public SystemStatusData() {
}
/**
* Constructor.
*
* @param dataRecords
* Records to add
*/
public SystemStatusData(List<DataDeliverySystemStatus> dataRecords) {
addRecords(dataRecords);
}
/**
* Add a list of records.
*
* @param dataRecords
* List of DataDeliverySystemStatus records
*/
public void addRecords(List<DataDeliverySystemStatus> dataRecords) {
for (DataDeliverySystemStatus record : dataRecords) {
this.addRecord(record);
}
}
/**
* Add a record.
*
* @param record
* The record to add
*/
public void addRecord(DataDeliverySystemStatus record) {
systemTypesMap.put(record.getKey().getSystemType(), record);
}
/**
* Get the data for the system type provided.
*
* @param systemType
* the system type
* @return the data
*/
public List<DataDeliverySystemStatus> getRecords(String systemType) {
return (List<DataDeliverySystemStatus>) systemTypesMap.get(systemType);
}
/**
* Get the different System Types in the data structure
*
* @return Set of system types
*/
public Set<String> getSystemTypes() {
return systemTypesMap.keySet();
}
/**
* Get all the records.
*
* @return Collection of DataDeliverySystemStatus records
*/
public Collection<DataDeliverySystemStatus> getRecords() {
return systemTypesMap.values();
}
}

View file

@ -9,7 +9,8 @@ Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Export-Package: com.raytheon.uf.common.datadelivery.event,
com.raytheon.uf.common.datadelivery.event.notification,
com.raytheon.uf.common.datadelivery.event.retrieval
com.raytheon.uf.common.datadelivery.event.retrieval,
com.raytheon.uf.common.datadelivery.event.status
Require-Bundle: javax.persistence;bundle-version="1.0.0",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
@ -18,4 +19,5 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.common.stats;bundle-version="1.0.0",
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0"
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0",
com.google.guava;bundle-version="1.0.0"

View file

@ -1 +1,3 @@
com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord
com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord
com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus
com.raytheon.uf.common.datadelivery.event.status.SystemStatusRequest

View file

@ -0,0 +1,118 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Data Delivery System Status.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 17, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@Entity
@Table(name = "DDSystemStatus")
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class DataDeliverySystemStatus extends
PersistableDataObject<DataDeliverySystemStatusId> {
private static final long serialVersionUID = -8864011415705803837L;
@DynamicSerializeElement
@EmbeddedId
private DataDeliverySystemStatusId key;
@XmlElement
@DynamicSerializeElement
@Column
private String status;
/**
* @return the status
*/
public String getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(String status) {
this.status = status;
}
/**
* @return the key
*/
public DataDeliverySystemStatusId getKey() {
return key;
}
/**
* @param key
* the key to set
*/
public void setKey(DataDeliverySystemStatusId key) {
this.key = key;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
if (identifier != null) {
buffer.append("SystemType: ").append(identifier.getSystemType())
.append("\n");
buffer.append("Name: ").append(identifier.getName())
.append("\n");
buffer.append("Status: ").append(status);
}
return this.toString();
}
}

View file

@ -0,0 +1,52 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
/**
* Data Delivery System Status Definitions.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 17, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public enum DataDeliverySystemStatusDefinition {
UP("System Up"), DOWN("System Down"), PROBLEM("Problem"), UNKNOWN(
"Status Unknown");
private final String status;
DataDeliverySystemStatusDefinition(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
}

View file

@ -0,0 +1,98 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Key for the Data Delivery System Status Table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@Embeddable
@DynamicSerialize
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class DataDeliverySystemStatusId implements Serializable,
ISerializableObject {
private static final long serialVersionUID = -6970802086185781078L;
@XmlElement
@DynamicSerializeElement
@Column
private String systemType;
@XmlElement
@DynamicSerializeElement
@Column
private String name;
/**
* @return the systemType
*/
public String getSystemType() {
return systemType;
}
/**
* @param systemType
* the systemType to set
*/
public void setSystemType(String systemType) {
this.systemType = systemType;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
}

View file

@ -0,0 +1,100 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
import com.raytheon.uf.common.event.Event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* System Status Event data object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class SystemStatusEvent extends Event {
private static final long serialVersionUID = 6304253608858754280L;
@DynamicSerializeElement
private String systemType;
@DynamicSerializeElement
private String name;
@DynamicSerializeElement
private DataDeliverySystemStatusDefinition status;
/**
* @return the systemType
*/
public String getSystemType() {
return systemType;
}
/**
* @param systemType
* the systemType to set
*/
public void setSystemType(String systemType) {
this.systemType = systemType;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the status
*/
public DataDeliverySystemStatusDefinition getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(DataDeliverySystemStatusDefinition status) {
this.status = status;
}
}

View file

@ -0,0 +1,44 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request object for Data Delivery System Status
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class SystemStatusRequest implements IServerRequest {
}

View file

@ -0,0 +1,90 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.status;
import java.util.List;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* The System Status Response object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class SystemStatusResponse implements ISerializableObject {
@DynamicSerializeElement
private List<DataDeliverySystemStatus> data;
/**
* Constructor.
*
* @param data
* The system status data
*/
public SystemStatusResponse(List<DataDeliverySystemStatus> data) {
this.data = data;
}
/**
* Constructor.
*/
public SystemStatusResponse() {
}
/**
* @return the data
*/
public List<DataDeliverySystemStatus> getData() {
return data;
}
/**
* @param data
* the data to set
*/
public void setData(List<DataDeliverySystemStatus> data) {
this.data = data;
}
/**
* Add a record.
*
* @param data
* the record to add.
*/
public void addData(DataDeliverySystemStatus data) {
this.data.add(data);
}
}

View file

@ -0,0 +1,24 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="statusDao" class="com.raytheon.uf.edex.datadelivery.event.dao.DataDeliverySystemStatusDao">
<property name="sessionFactory" ref="metadataSessionFactory" />
</bean>
<bean id="systemStatusHandler" class="com.raytheon.uf.edex.datadelivery.event.handler.SystemStatusRequestHandler" >
<property name="statusDao" ref="statusDao" />
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.datadelivery.event.status.SystemStatusRequest"/>
<constructor-arg ref="systemStatusHandler"/>
</bean>
<bean id="systemStatusEventBusHandler" class="com.raytheon.uf.edex.datadelivery.event.handler.SystemStatusEventBusHandler">
<property name="statusDao" ref="statusDao" />
</bean>
<bean factory-bean="eventBus" factory-method="register">
<constructor-arg ref="systemStatusEventBusHandler" />
</bean>
</beans>

View file

@ -0,0 +1,53 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.event.dao;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatusId;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
/**
* Data Delivery System Status DAO
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@DynamicSerialize
public class DataDeliverySystemStatusDao extends
SessionManagedDao<DataDeliverySystemStatusId, DataDeliverySystemStatus>
implements ISerializableObject {
@Override
protected Class<DataDeliverySystemStatus> getEntityClass() {
return DataDeliverySystemStatus.class;
}
}

View file

@ -0,0 +1,87 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.event.handler;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatusId;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusEvent;
import com.raytheon.uf.edex.datadelivery.event.dao.DataDeliverySystemStatusDao;
/**
* Event bus message handler class.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@Service
@Transactional
public class SystemStatusEventBusHandler {
/** The Data Access Object */
private DataDeliverySystemStatusDao statusDao;
/**
* Gets called when Event Bus publishes an event
*
* @param event
* EventBus's
*/
@Subscribe
@AllowConcurrentEvents
public void eventListener(SystemStatusEvent event) {
DataDeliverySystemStatus record = new DataDeliverySystemStatus();
DataDeliverySystemStatusId id = new DataDeliverySystemStatusId();
id.setName(event.getName());
record.setStatus(event.getStatus().getStatus());
id.setSystemType(event.getSystemType());
record.setKey(id);
statusDao.createOrUpdate(record);
}
/**
* @return the statusDao
*/
public DataDeliverySystemStatusDao getStatusDao() {
return statusDao;
}
/**
* @param statusDao
* the statusDao to set
*/
public void setStatusDao(DataDeliverySystemStatusDao statusDao) {
this.statusDao = statusDao;
}
}

View file

@ -0,0 +1,69 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.event.handler;
import java.util.List;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatus;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusRequest;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.datadelivery.event.dao.DataDeliverySystemStatusDao;
/**
* Data Delivery System Status Request Handler
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 18, 2013 1655 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class SystemStatusRequestHandler implements
IRequestHandler<SystemStatusRequest> {
/** System status DAO */
private DataDeliverySystemStatusDao statusDao;
/**
* {@inheritDoc}
*/
@Override
public Object handleRequest(SystemStatusRequest request) throws Exception {
List<DataDeliverySystemStatus> dataRecords = statusDao.getAll();
return new SystemStatusResponse(dataRecords);
}
/**
* @param statusDao
* the statusDao to set
*/
public void setStatusDao(DataDeliverySystemStatusDao statusDao) {
this.statusDao = statusDao;
}
}

View file

@ -23,10 +23,13 @@ import java.util.ArrayList;
import java.util.List;
import com.google.common.annotations.VisibleForTesting;
import com.raytheon.uf.common.datadelivery.event.status.DataDeliverySystemStatusDefinition;
import com.raytheon.uf.common.datadelivery.event.status.SystemStatusEvent;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -54,6 +57,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.interfaces.IRetrievalResponse
* Feb 07, 2013 1543 djohnson Expose process() for testing.
* Feb 12, 2013 1543 djohnson Retrieval responses are now passed further down the chain.
* Feb 15, 2013 1543 djohnson Retrieval responses are now xml.
* Jul 16, 2013 1655 mpduff Send a system status event based on the response from the provider.
*
* </pre>
*
@ -61,8 +65,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.interfaces.IRetrievalResponse
* @version 1.0
*/
public class PerformRetrievalsThenReturnFinder implements
IRetrievalsFinder {
public class PerformRetrievalsThenReturnFinder implements IRetrievalsFinder {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(PerformRetrievalsThenReturnFinder.class);
@ -86,8 +89,7 @@ public class PerformRetrievalsThenReturnFinder implements
* {@inheritDoc}
*/
@Override
public RetrievalResponseXml findRetrievals()
throws Exception {
public RetrievalResponseXml findRetrievals() throws Exception {
RetrievalResponseXml retVal = null;
ITimer timer = TimeUtil.getTimer();
@ -171,8 +173,7 @@ public class PerformRetrievalsThenReturnFinder implements
setCompletionStateFromResponse(requestRecord, response);
retrievalAttributePluginDataObjects
.add(new RetrievalResponseWrapper(
response));
.add(new RetrievalResponseWrapper(response));
} else {
throw new IllegalStateException("No PDO's to store: "
+ serviceType + " original: "
@ -194,6 +195,22 @@ public class PerformRetrievalsThenReturnFinder implements
retrievalPluginDataObject
.setSuccess(requestRecord.getState() == State.COMPLETED);
// Create system status event
SystemStatusEvent event = new SystemStatusEvent();
event.setName(requestRecord.getProvider());
event.setSystemType("Provider");
if (requestRecord.getState() == State.COMPLETED
|| requestRecord.getState() == State.PENDING
|| requestRecord.getState() == State.RUNNING) {
event.setStatus(DataDeliverySystemStatusDefinition.UP);
} else if (requestRecord.getState() == State.FAILED) {
event.setStatus(DataDeliverySystemStatusDefinition.DOWN);
} else {
event.setStatus(DataDeliverySystemStatusDefinition.UNKNOWN);
}
EventBus.publish(event);
return retrievalPluginDataObject;
}