Rebased omaha_14.2.1_set_4 delivery on master_14.2.1-7

Former-commit-id: 2faab606e5 [formerly f7a43d07109a7c04ffb9754c285043ce446d46b5]
Former-commit-id: 1a8a0b703e
This commit is contained in:
Brian.Dyke 2014-02-24 14:51:00 -05:00
commit 227131e5f1
228 changed files with 7103 additions and 5408 deletions

View file

@ -21,10 +21,6 @@
package com.raytheon.uf.viz.core;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@ -52,6 +48,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
* jms connection string
* Feb 17, 2014 2812 njensen getHostName() now uses getWsId()'s hostname
*
* </pre>
*
@ -255,45 +252,20 @@ public final class VizApp {
private static String host = null;
/**
* Gets the ip address of the host machine calling the function
* Gets the host name from the WsId of the host machine calling the function
*
* @return
*/
public static synchronized String getHostName() {
if (host == null) {
InetAddress addrToUse = null;
boolean found = false;
try {
Enumeration<NetworkInterface> nis = NetworkInterface
.getNetworkInterfaces();
while (nis.hasMoreElements() && !found) {
NetworkInterface ni = nis.nextElement();
ni.isVirtual();
ni.isUp();
Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements() && !found) {
InetAddress addr = addrs.nextElement();
if (addr.isLinkLocalAddress() == false
&& addr.isSiteLocalAddress() == false
&& addr.isLoopbackAddress() == false) {
addrToUse = addr;
found = true;
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
if (addrToUse == null) {
host = getWsId().getHostName();
if (host == null) {
String hostname = System.getenv("HOSTNAME");
if (hostname != null && hostname.trim().length() == 0) {
if (hostname != null && hostname.trim().length() > 0) {
host = hostname;
} else {
host = "localhost";
}
} else {
host = addrToUse.getHostName();
}
}
return host;

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.core.comm;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
import com.raytheon.uf.viz.core.auth.UserController;
@ -34,6 +38,7 @@ import com.raytheon.uf.viz.core.auth.UserController;
* ------------ ---------- ----------- --------------------------
* Mar 04, 2013 1786 mpduff Initial creation.
* Jun 07, 2013 1981 mpduff Save user's username in UserController.
* Feb 10, 2014 2704 njensen Added credentialsFailed()
*
* </pre>
*
@ -59,4 +64,11 @@ public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
UserController.updateUserData(credentials[0]);
return credentials;
}
@Override
public void credentialsFailed() {
MessageDialog.openError(new Shell(Display.getDefault()),
"Login failed",
"Invalid username and/or password. Please try again.");
}
}

View file

@ -20,9 +20,7 @@
package com.raytheon.uf.viz.core.comm;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -55,7 +53,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Mar 22, 2013 1786 mpduff Changed to use HttpClient for
* connectivity.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Jan 15, 2013 njensen Added printConnectivityProblems()
* Jan 15, 2014 njensen Added printConnectivityProblems()
* Feb 04, 2014 2704 njensen Check JMS capability, return exceptions with results
*
* </pre>
*
@ -77,9 +76,16 @@ public class ConnectivityManager {
public String server;
public Exception exception;
public ConnectivityResult(boolean hc, String server) {
this(hc, server, null);
}
public ConnectivityResult(boolean hc, String server, Exception e) {
this.hasConnectivity = hc;
this.server = server;
this.exception = e;
}
}
@ -94,6 +100,7 @@ public class ConnectivityManager {
public static void checkHttpServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
HttpClient client = HttpClient.getInstance();
HttpGet request = new HttpGet();
@ -101,9 +108,9 @@ public class ConnectivityManager {
client.executeRequest(request);
good = true;
} catch (Exception e) {
printConnectivityProblem(server, "http", e);
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -115,12 +122,13 @@ public class ConnectivityManager {
public static void checkLocalizationServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
good = checkLocalizationServer(server, true) != null;
} catch (Exception e) {
printConnectivityProblem(server, "localization", e);
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -142,47 +150,49 @@ public class ConnectivityManager {
.sendRequest(req, server);
getServersResponseCache.put(server, resp);
return resp;
}
/**
* Checks the connectivity of the given server
* Checks the connectivity of the given alert service
*
* @param server
* server to check
* @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity
*/
public static void checkJmsServer(String server,
public static void checkAlertService(String server,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(server);
f.createConnection().close();
} catch (JMSException e) {
printConnectivityProblem(server, "JMS", e);
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
* Prints the connectivity exception to the console, to help with diagnosing
* connection issues
* Checks the connectivity of the given JMS server
*
* @param server
* the server address it attempted to connect to
* @param serverType
* the type of server it attempted to connect to
* @param e
* the exception that occurred
* @param connectionString
* @param callback
*/
private static void printConnectivityProblem(String server,
String serverType, Exception e) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(new Date()) + " MAY NOT BE AN ERROR:");
System.out.println("Couldn't connect to " + serverType + " server at "
+ server);
e.printStackTrace(System.out);
public static void checkJmsServer(String connectionString,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
JMSConnection jms = new JMSConnection(connectionString);
jms.getFactory().createConnection().close();
} catch (JMSException e) {
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good,
connectionString, exc));
}
}

View file

@ -42,7 +42,8 @@ import org.eclipse.ui.PlatformUI;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 6, 2013 1786 mpduff Initial creation
* Mar 06, 2013 1786 mpduff Initial creation
* Feb 10, 2014 2704 njensen Allow message to expand size of dialog
*
* </pre>
*
@ -50,6 +51,7 @@ import org.eclipse.ui.PlatformUI;
* @version 1.0
*/
public class HttpsLoginDlg extends Dialog {
private static final long serialVersionUID = 1L;
private Shell shell;
@ -76,7 +78,7 @@ public class HttpsLoginDlg extends Dialog {
*/
public HttpsLoginDlg(String message) {
super(new Shell(Display.getDefault(), SWT.TITLE));
this.message = message;
this.message = message.replace("\"", "");
}
/**
@ -112,7 +114,9 @@ public class HttpsLoginDlg extends Dialog {
comp.setLayout(new GridLayout(2, false));
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 500;
if (message == null || message.length() < 50) {
gd.widthHint = 500;
}
gd.horizontalSpan = 2;
Label authMessage = new Label(comp, SWT.CENTER);

View file

@ -19,11 +19,17 @@
**/
package com.raytheon.uf.viz.core.localization;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.UnknownHostException;
import java.util.regex.Pattern;
import org.apache.http.conn.HttpHostConnectException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
@ -41,6 +47,8 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.comm.HttpServerException;
import com.raytheon.uf.common.comm.InvalidURIException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -58,6 +66,9 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
* ------------ ---------- ----------- --------------------------
* Aug 05, 2009 mschenke Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Shifted some private fields/methods to protected,
* Added status and details, better site validation
* Feb 17, 2014 2704 njensen Changed some alertviz fields to protected
*
* </pre>
*
@ -66,16 +77,23 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
*/
public class ConnectivityPreferenceDialog extends Dialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ConnectivityPreferenceDialog.class, "CAVE");
protected static final Pattern VALID_SITENAME = Pattern
.compile("^[A-Za-z0-9._-]+$");
private class LocalizationCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
localizationGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class AlertVizCallback implements IConnectivityCallback {
@ -83,31 +101,32 @@ public class ConnectivityPreferenceDialog extends Dialog {
@Override
public void connectionChecked(ConnectivityResult results) {
alertVizGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
/**
* Set time dialog shell
*/
private Shell shell;
/**
* Display component
*/
private Display display;
protected Display display;
private Label localizationLabel;
private Text localizationText;
protected Text localizationText;
private String localization = "";
private boolean localizationGood = false;
private Text alertVizText;
protected Text alertVizText;
private String alertVizServer = null;
protected String alertVizServer = null;
private boolean alertVizGood = true;
@ -115,10 +134,16 @@ public class ConnectivityPreferenceDialog extends Dialog {
private String site = "";
private Text siteText;
protected Text siteText;
private Label statusLabel;
private boolean canceled = false;
private Composite detailsComp;
private StyledText detailsText;
private IConnectivityCallback localizationCallback = new LocalizationCallback();
private IConnectivityCallback alertCallback = new AlertVizCallback();
@ -126,14 +151,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
/**
* Title of the dialog.
*/
private static final String dialogTitle = "Connectivity Preferences";
private String title;
public ConnectivityPreferenceDialog(boolean checkAlertViz) {
this(new Shell(Display.getDefault()), checkAlertViz);
protected String status;
protected String details;
public ConnectivityPreferenceDialog(boolean checkAlertViz, String title) {
this(new Shell(Display.getDefault()), checkAlertViz, title);
}
public ConnectivityPreferenceDialog(Shell parentShell, boolean checkAlertViz) {
public ConnectivityPreferenceDialog(Shell parentShell,
boolean checkAlertViz, String title) {
super(parentShell);
this.title = title;
localization = LocalizationManager.getInstance()
.getLocalizationServer();
site = LocalizationManager.getInstance().getSite();
@ -155,8 +186,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
if (!validate()) {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText(dialogTitle);
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setText(title);
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
@ -165,6 +196,9 @@ public class ConnectivityPreferenceDialog extends Dialog {
initializeComponents();
shell.pack();
shell.setMinimumSize(shell.getBounds().width,
shell.getBounds().height);
updateStatus(false, status, details);
shell.open();
while (!shell.isDisposed()) {
@ -177,16 +211,69 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
private void initializeComponents() {
createErrorText();
Composite textBoxComp = new Composite(shell, SWT.NONE);
textBoxComp.setLayout(new GridLayout(2, false));
createTextBoxes(textBoxComp);
createStatusText();
createBottomButtons();
}
private void createErrorText() {
Label label = new Label(shell, SWT.CENTER);
label.setText("Error: Unable to connect to localization server");
/**
* Creates the status label, text, and details button
*/
protected void createStatusText() {
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new GridLayout(3, false));
comp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label lbl = new Label(comp, SWT.NONE);
lbl.setText("Status:");
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
statusLabel = new Label(comp, SWT.BORDER);
statusLabel.setLayoutData(gd);
statusLabel.setText("");
final Button detailsButton = new Button(comp, SWT.TOGGLE);
detailsButton.setText("Details");
detailsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (detailsComp.isVisible()) {
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
shell.pack();
} else {
((GridData) detailsComp.getLayoutData()).exclude = false;
((GridData) detailsComp.getLayoutData()).widthHint = detailsComp
.getBounds().width;
detailsComp.setVisible(true);
shell.pack();
}
}
});
createDetailsText();
}
/**
* Creates the expanding details text
*/
protected void createDetailsText() {
detailsComp = new Composite(shell, SWT.NONE);
detailsComp.setLayout(new GridLayout(1, false));
detailsComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 150;
detailsText = new StyledText(detailsComp, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
detailsText.setText("");
detailsText.setLayoutData(gd);
/*
* Hide the composite
*/
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
}
protected void createTextBoxes(Composite textBoxComp) {
@ -194,12 +281,12 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationLabel = new Label(textBoxComp, SWT.RIGHT);
localizationLabel.setText("Localization Server:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
localizationLabel.setLayoutData(gd);
localizationText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
localizationText = new Text(textBoxComp, SWT.BORDER);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
localizationText.setLayoutData(gd);
localizationText.setText(localization == null ? "" : localization);
@ -207,17 +294,18 @@ public class ConnectivityPreferenceDialog extends Dialog {
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Site:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
siteText = new Text(textBoxComp, SWT.NONE);
siteText = new Text(textBoxComp, SWT.BORDER);
siteText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
e.text = e.text.toUpperCase();
}
});
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
siteText.setLayoutData(gd);
siteText.setText(site == null ? "" : site);
@ -299,7 +387,7 @@ public class ConnectivityPreferenceDialog extends Dialog {
shell.setVisible(false);
MessageDialog
.openError(
null,
shell,
"Connectivity Error",
"Unable to validate localization preferences, please enter valid options or quit the application");
shell.setVisible(true);
@ -327,6 +415,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
public boolean validate() {
status = null;
details = null;
if (localizationText != null && !localizationText.isDisposed()
&& localizationText.isEnabled()) {
String localization = localizationText.getText().trim();
@ -360,20 +450,28 @@ public class ConnectivityPreferenceDialog extends Dialog {
} else {
validateSite();
}
return siteGood && localizationGood && alertVizGood;
boolean everythingGood = siteGood && localizationGood && alertVizGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateLocalization() {
ConnectivityManager.checkLocalizationServer(localization, localizationCallback);
ConnectivityManager.checkLocalizationServer(localization,
localizationCallback);
}
private void validateAlertviz() {
ConnectivityManager.checkJmsServer(alertVizServer, alertCallback);
protected void validateAlertviz() {
ConnectivityManager.checkAlertService(alertVizServer, alertCallback);
}
private void validateSite() {
if (site == null || site.trim().equals("")) {
protected void validateSite() {
if (site == null || site.trim().length() == 0
|| !VALID_SITENAME.matcher(site).find()) {
siteGood = false;
if (status == null) {
status = "Invalid Site ID";
}
} else {
siteGood = true;
}
@ -387,6 +485,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
}
/**
* Gets the color for the status label
*
* @param isGood
* @return
*/
protected Color getForegroundColor(boolean isGood) {
if (isGood) {
return display.getSystemColor(SWT.COLOR_DARK_GREEN);
} else {
return display.getSystemColor(SWT.COLOR_DARK_RED);
}
}
public String getLocalization() {
return localization;
}
@ -438,4 +550,118 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationText.setEnabled(enabled);
}
}
/**
* Builds a details string based on a stacktrace of connectivity results. If
* there is no exception with the results, this returns the empty string.
*
* @param results
* @return
*/
protected String buildDetails(ConnectivityResult results) {
StringBuilder sb = new StringBuilder();
if (results.exception != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
results.exception.printStackTrace(ps);
String stack = baos.toString();
ps.close();
sb.append(stack);
}
return sb.toString();
}
/**
* Adds new details to the details field without overwriting it
*
* @param newDetails
*/
protected void appendDetails(String newDetails) {
if (details == null) {
details = "";
}
if (details.length() > 0) {
details += "\n\n\n";
}
details += newDetails;
}
/**
* Creates an error message for the status label by attempting to find the
* most relevant error message from the exception's stacktrace.
*
* @param result
* @return
*/
protected String buildErrorMessage(ConnectivityResult result) {
StringBuilder sb = new StringBuilder();
Exception prettyErrExc = result.exception;
/*
* Loop through the Caused Bys and try to find one that is the most
* useful for the label. This is totally arbitrary and corresponds to
* what njensen predicted would be most useful.
*/
while (prettyErrExc != null) {
if (prettyErrExc instanceof HttpHostConnectException
|| prettyErrExc instanceof InvalidURIException) {
sb.append(prettyErrExc.getMessage());
break;
}
if (prettyErrExc instanceof UnknownHostException) {
sb.append("Unknown host: " + prettyErrExc.getMessage());
break;
} else if (prettyErrExc instanceof HttpServerException) {
sb.append("Server returned Error ");
String emsg = prettyErrExc.getMessage();
int titleIndex = emsg.indexOf("<title>");
if (titleIndex > -1) {
String httpMsg = emsg.substring(titleIndex + 7,
emsg.indexOf("</title>"));
sb.append(httpMsg);
} else {
int statusCode = ((HttpServerException) prettyErrExc)
.getStatusCode();
sb.append(statusCode);
break;
}
}
prettyErrExc = (Exception) prettyErrExc.getCause();
}
if (sb.length() == 0) {
if (result.exception != null
&& result.exception.getMessage() != null) {
sb.append(result.exception.getMessage());
} else {
sb.append("Connectivity Error");
}
}
return sb.toString();
}
/**
* Updates the status label and details of the connectivity dialog
*
* @param good
* @param status
* @param details
*/
protected void updateStatus(boolean good, String status, String details) {
if (statusLabel != null && !statusLabel.isDisposed()
&& detailsText != null && !detailsText.isDisposed()) {
statusLabel.setForeground(getForegroundColor(good));
detailsText.setText(details != null ? details : "");
if (good) {
statusLabel.setText("Successful connection");
} else {
if (status != null) {
statusLabel.setText(status);
} else {
// shoudln't be able to reach this but just in case
statusLabel.setText("Connection error");
}
}
}
}
}

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Pass connectivity dialog title
*
* </pre>
*
@ -108,7 +109,7 @@ public class LocalizationInitializer {
protected void setupServers() throws VizException {
if (promptUI) {
ConnectivityPreferenceDialog dlg = new ConnectivityPreferenceDialog(
checkAlertviz);
checkAlertviz, "Connectivity Preferences");
if (dlg.open() == true) {
System.exit(0);
}

View file

@ -95,6 +95,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Allow setting server without saving
*
* </pre>
*
@ -210,19 +211,39 @@ public class LocalizationManager implements IPropertyChangeListener {
}
}
/**
* Sets the localization server and saves the setting
*
* @param currentServer
* the localization URI
*/
public void setCurrentServer(String currentServer) {
setCurrentServer(currentServer, true);
}
/**
* Sets the localization server
*
* @param currentServer
* the localization URI
* @param save
* whether or not to save the setting
*/
public void setCurrentServer(String currentServer, boolean save) {
if (!this.currentServer.equals(currentServer)) {
this.currentServer = currentServer;
if (!overrideServer) {
localizationStore.putValue(
LocalizationConstants.P_LOCALIZATION_HTTP_SERVER,
this.currentServer);
applyChanges();
if (save) {
applyChanges();
}
}
try {
GetServersResponse resp = ConnectivityManager.checkLocalizationServer(
currentServer, false);
GetServersResponse resp = ConnectivityManager
.checkLocalizationServer(currentServer, false);
VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
VizApp.setPypiesServer(resp.getPypiesServer());

View file

@ -236,7 +236,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
if (alertEditor != null) {
text = alertEditor.getTextControl(getFieldEditorParent());
ConnectivityManager.checkJmsServer(text.getText().trim(),
ConnectivityManager.checkAlertService(text.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
@ -260,6 +260,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
}

View file

@ -86,7 +86,7 @@ public class LocalizationServerEditor extends StringFieldEditor implements
ConnectivityManager.checkHttpServer(this.getTextControl().getText(),
this);
} else {
ConnectivityManager.checkJmsServer(this.getTextControl().getText(),
ConnectivityManager.checkAlertService(this.getTextControl().getText(),
this);
}
if (!good) {

View file

@ -20,19 +20,18 @@
package com.raytheon.uf.viz.core.reflect;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
import org.reflections.scanners.SubTypesScanner;
@ -56,6 +55,7 @@ import com.raytheon.uf.viz.core.Activator;
* Oct 18, 2013 2491 bsteffen Initial creation
* Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded
* bundles.
* Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies.
*
* </pre>
*
@ -68,15 +68,11 @@ public class SubClassLocator implements ISubClassLocator {
private static final String CACHE_FILENAME = "subclassCache.txt";
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>();
private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>();
private final Map<String, List<Bundle>> requiredBundles = new HashMap<String, List<Bundle>>();
private final Map<String, Collection<Bundle>> requiredBundles = new HashMap<String, Collection<Bundle>>();
private final BundleClassCache cache;
@ -145,8 +141,8 @@ public class SubClassLocator implements ISubClassLocator {
*/
return Collections.emptySet();
}
if(bundle.getState() == Bundle.UNINSTALLED){
if (bundle.getState() == Bundle.UNINSTALLED) {
/*
* We won't be able to get a class loader for uninstalled bundles so
* don't process them.
@ -167,7 +163,8 @@ public class SubClassLocator implements ISubClassLocator {
Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle,
recursiveClasses);
/* Must pass dependencies in so type heirarchy is complete. */
Set<Class<?>> owned = loadSubClassesReflectively(bundle, dependencies);
Set<Class<?>> owned = loadSubClassesReflectively(bundle,
dependencies);
/* populate the cache */
ownedNames = new String[owned.size()];
int index = 0;
@ -188,8 +185,7 @@ public class SubClassLocator implements ISubClassLocator {
Arrays.asList(ownedNames));
if (includeRequiredSubclasses) {
Set<Class<?>> dependencies = getRequiredSubclasses(base,
bundle,
recursiveClasses);
bundle, recursiveClasses);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned);
recursiveClasses.put(bundleName, all);
@ -287,31 +283,32 @@ public class SubClassLocator implements ISubClassLocator {
}
/**
* Parse bundle header to get all required bundles
* Get back all the bundles this bundle depends on.
*
* @param bundle
* the bundle
* @return bundles required by bundle.
*/
private List<Bundle> getRequiredBundles(Bundle bundle) {
private Collection<Bundle> getRequiredBundles(Bundle bundle) {
String bundleName = bundle.getSymbolicName();
List<Bundle> required = requiredBundles.get(bundle);
Collection<Bundle> required = requiredBundles.get(bundleName);
if (required == null) {
required = new ArrayList<Bundle>();
String requiredBundlesHeader = bundle.getHeaders().get(
Constants.REQUIRE_BUNDLE);
if (requiredBundlesHeader != null) {
String[] requiredBundles = COMMA_SPLIT
.split(requiredBundlesHeader);
for (String requiredBundleName : requiredBundles) {
String[] nameParts = SEMICOLON_SPLIT
.split(requiredBundleName);
Bundle reqBundle = bundleLookup.get(nameParts[0]);
if (reqBundle != null) {
required.add(reqBundle);
}
required = new HashSet<Bundle>();
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
if (bundleWiring != null) {
/* Get Required bundles */
for (BundleWire bw : bundleWiring
.getRequiredWires(BundleNamespace.BUNDLE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
/* Get Bundles through import package */
for (BundleWire bw : bundleWiring
.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
}
/* Avoid recursion */
required.remove(bundle);
requiredBundles.put(bundleName, required);
}

View file

@ -36,6 +36,7 @@ import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -63,14 +64,17 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 8, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made
* canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take units
* Date Ticket# Engineer Description
* ------------- -------- ----------- -----------------------------------------
* Aug 08, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and
* made canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take
* units
* Feb 07, 2014 2211 bsteffen Fix sampling units when data mapping is
* enabled.
*
* </pre>
*
@ -539,55 +543,65 @@ public class TileSetRenderable implements IRenderable {
public double interrogate(Coordinate coordinate, Unit<?> resultUnit,
double nanValue) throws VizException {
double dataValue = Double.NaN;
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = null;
try {
double[] local = new double[2];
llToLocalProj
.transform(new double[] { coordinate.x, coordinate.y }, 0,
local, 0, 1);
double localX = local[0];
double localY = local[1];
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = level.crsToGrid(localX, localY);
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
IColormappedImage cmapImage = (IColormappedImage) image;
dataValue = cmapImage.getValue(
(int) grid[0] % tileSize, (int) grid[1]
% tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
Unit<?> dataUnit = cmapImage.getDataUnit();
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(
resultUnit).convert(dataValue);
} else {
throw new IllegalArgumentException(
"Unable to interrogate tile set. "
+ String.format(
"Desired unit (%s) is not compatible with data unit (%s).",
UnitFormat
.getUCUMInstance()
.format(resultUnit),
UnitFormat
.getUCUMInstance()
.format(dataUnit)));
}
}
}
}
}
}
grid = level.crsToGrid(local[0], local[1]);
} catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
IColormappedImage cmapImage = null;
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
cmapImage = (IColormappedImage) image;
}
}
}
if (cmapImage != null) {
dataValue = cmapImage.getValue((int) grid[0] % tileSize,
(int) grid[1] % tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
ColorMapParameters parameters = cmapImage
.getColorMapParameters();
Unit<?> dataUnit = cmapImage.getDataUnit();
if (parameters.getDataMapping() != null) {
/*
* Ignore dataUnit, use colorMapUnit which is derived from
* the data mapping
*/
dataUnit = parameters.getColorMapUnit();
}
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(resultUnit)
.convert(dataValue);
} else {
UnitFormat uf = UnitFormat.getUCUMInstance();
String message = String
.format("Unable to interrogate tile set. Desired unit (%s) is not compatible with data unit (%s).",
uf.format(resultUnit),
uf.format(dataUnit));
throw new IllegalArgumentException(message);
}
}
}
}
return dataValue;
}
}

View file

@ -43,11 +43,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference;
@ -74,6 +74,7 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
* Nov 19, 2013 2458 mpduff Only pull subscriptions for the local site
* Nov 21, 2013 2554 dhladky Restored ADHOC's to working.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -439,8 +440,8 @@ public class DataDeliveryProductBrowserDataDefinition
final ISubscriptionHandler handler = RegistryObjectHandlers
.get(ISubscriptionHandler.class);
try {
subList = handler.getByFilters(null, LocalizationManager
.getInstance().getCurrentSite());
subList = handler.getByFilters(null,
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}

View file

@ -26,7 +26,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthUtilizationDlg;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
/**
* Action handler for the bandwidth scheduling graph.
@ -40,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
* Nov 25, 2012 1269 mpduff Initial creation.
* Dec 13, 2012 1269 lvenable Updated to use a graph utility for the graph data.
* Oct 28, 2013 2430 mpduff Removed redraw if already open.
* Jan 29, 2014 2722 mpduff Don't get graph data up front.
*
* </pre>
*
@ -58,11 +58,9 @@ public class BandwidthScheduleGraphAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (dlg == null || dlg.isDisposed()) {
GraphDataUtil gdu = new GraphDataUtil(null);
gdu.retrieveData();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dlg = new BandwidthUtilizationDlg(shell, gdu);
dlg = new BandwidthUtilizationDlg(shell);
dlg.open();
} else {
dlg.open();

View file

@ -31,11 +31,11 @@ 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.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
* Subscription Manager Dialog Action class.
@ -49,8 +49,9 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
* Jan 10, 2012 mpduff Initial creation
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
* May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Sep 04, 2013 2330 bgonzale execute now filters subscriptions by current site id.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
*
* </pre>
@ -81,7 +82,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) {
return loadSubscriptionManager(SubscriptionManagerFilters
.getBySiteId(LocalizationManager.getInstance().getCurrentSite()));
.getBySiteId(DataDeliveryUtils.getDataDeliveryId()));
}
/**

View file

@ -103,7 +103,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Nov 19, 2013 1531 mpduff Made graph resizable.
* Nov 25, 2013 2545 mpduff Default to Opsnet if Network not available yet.
* Dec 17, 2013 2633 mpduff Fix redraw problems..
* Jan 09, 2013 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 09, 2014 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 29, 2014 2722 mpduff Changed how graph data are requested.
* </pre>
*
* @author lvenable
@ -250,13 +251,13 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphDataUtil
* Bandwidth graph data object
*/
public BandwidthCanvasComp(Composite parentComp, GraphDataUtil graphDataUtil) {
public BandwidthCanvasComp(Composite parentComp) {
super(parentComp, SWT.BORDER);
this.parentComp = parentComp;
this.display = this.parentComp.getDisplay();
this.graphDataUtil = graphDataUtil;
this.bgd = this.graphDataUtil.getGraphData(false);
this.graphDataUtil = new GraphDataUtil(this);
this.bgd = this.graphDataUtil.getGraphData();
init();
}
@ -265,7 +266,6 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* Initialize method.
*/
private void init() {
this.graphDataUtil.setDataUpdateCallback(this);
NotificationManagerJob.addObserver("notify.msg", this);
this.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@ -1409,7 +1409,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphData
* Bandwidth graph data.
*/
public void setGraphData(BandwidthGraphData graphData) {
private void setGraphData(BandwidthGraphData graphData) {
this.bgd = graphData;
generateCanvasSettings();
@ -1527,14 +1527,15 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
// Do a full update every 10 minutes
if (fullUpdateMinuteCount > 10) {
graphDataUtil.requestGraphDataUsingThread();
fullUpdateMinuteCount = 0;
}
}
}
}
/**
* This method will update the subscription table with any updates,
* deletions, or new subscriptions.
* This method will update the graph with any updates, deletions, or new
* subscriptions.
*/
@Override
public void notificationArrived(NotificationMessage[] messages) {
@ -1559,7 +1560,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
VizApp.runAsync(new Runnable() {
@Override
public void run() {
setGraphData(graphDataUtil.getGraphData(true));
setGraphData(graphDataUtil.getGraphData());
updateCanvasSettings();
updateCanvases();
layout();

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Dec 13, 2012 1269 lvenable Fixes and updates.
* Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph.
* Nov 19, 2013 1531 mpduff Made resizable.
* Jan 29, 2014 2722 mpduff GraphDataUtil not in this class.
*
* </pre>
*
@ -77,9 +78,6 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
/** Graph composite */
private BandwidthCanvasComp canvasComp;
/** Graph data utility class */
private final GraphDataUtil graphDataUtil;
private MenuItem displayOpsNetMI;
private MenuItem displaySbnMI;
@ -92,12 +90,10 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
* @param graphDataUtil
* Graph data utility object
*/
public BandwidthUtilizationDlg(Shell parent, GraphDataUtil graphDataUtil) {
public BandwidthUtilizationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL);
setText("Bandwidth Utilization");
this.graphDataUtil = graphDataUtil;
}
/**
@ -133,7 +129,7 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
canvasComp = new BandwidthCanvasComp(mainComp, graphDataUtil);
canvasComp = new BandwidthCanvasComp(mainComp);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false);

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
* Mar 26, 2013 1827 djohnson Graph data should be requested from data delivery.
* Jan 29, 2014 2722 mpduff Callback is now passed in.
*
* </pre>
*
@ -67,7 +68,7 @@ public class GraphDataUtil implements Runnable {
private BandwidthGraphData graphData;
/** Callback called when the data has been updated */
private IDataUpdated dataUpdatedCB;
private final IDataUpdated dataUpdatedCB;
/** Executor service used for the threaded data retrieval */
private final ExecutorService service = Executors.newSingleThreadExecutor();
@ -83,21 +84,10 @@ public class GraphDataUtil implements Runnable {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Set the updated data callback.
*
* @param dataUpdatedCB
* Call back called when the data has been updated via separate
* thread.
*/
public void setDataUpdateCallback(IDataUpdated dataUpdatedCB) {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Perform a data retrieval on the UI thread.
*/
public void retrieveData() {
private void retrieveData() {
response = sendRequest(request);
if (response != null) {
@ -115,10 +105,11 @@ public class GraphDataUtil implements Runnable {
* returning the data.
* @return Bandwidth graph data.
*/
public BandwidthGraphData getGraphData(boolean newData) {
if (newData || graphData == null) {
public BandwidthGraphData getGraphData() {
if (graphData == null) {
retrieveData();
}
return graphData;
}

View file

@ -48,7 +48,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -57,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
import com.raytheon.uf.viz.datadelivery.common.ui.ViewDetailsDlg;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.BrowserColumnNames;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
@ -85,6 +85,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -627,7 +628,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
try {
datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
.getSubscribedToDataSetNames(
LocalizationManager.getInstance().getCurrentSite());
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve subscription dataset names!", e);

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.datadelivery.common.ui;
import java.util.List;
import com.raytheon.uf.viz.datadelivery.notification.NotificationRowData;
/**
* Table find interface.
*
@ -30,6 +34,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation.
* Sep 26, 2013 2417 mpduff Add clearSelection method.
* Feb 07, 2014 2453 mpduff Added getCurrentSelectionIndex method.
* </pre>
*
* @author jpiatt
@ -38,26 +43,34 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
public interface ITableFind {
/**
* handleFind call
* handle page selection
*/
void handlePageSelection();
/**
* handleFind call
* select a row
*
* @param index
*/
void selectIndex(int index);
void selectRow(NotificationRowData row);
/**
* handleFind call
* handle multiple rows
*
* @param indices
*/
void selectIndices(int[] indices);
void selectRows(List<NotificationRowData> rows);
/**
* Clear any table selections.
*/
void clearSelections();
/**
* Get the currently selected index within the data array, not the visible
* table.
*
* @return
*/
int getCurrentSelectionIndex();
}

View file

@ -29,7 +29,8 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 06, 2012 lvenable Initial creation
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Feb 07, 2014 2453 mpduff Added getSize().
*
* </pre>
*
@ -132,8 +133,7 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public T getDataRow(int index) {
if (index >= 0 && index < tableData.size()) {
return tableData.get(index);
}
else {
} else {
return tableData.get(0);
}
}
@ -187,4 +187,13 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public SortDirection getSortDirection() {
return currentSortDirection;
}
/**
* Get the size of the data array.
*
* @return The size
*/
public int getSize() {
return this.tableData.size();
}
}

View file

@ -97,6 +97,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jun 13, 2013 2108 mpduff Refactored DataSizeUtils.
* Oct 28, 2013 2292 mpduff Change overlap services.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre>
*
* @author jpiatt
@ -410,8 +411,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
subscription.setCoverage(cov);
}
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
if (sizeUtils != null) {
subscription.setDataSetSize(sizeUtils
.getDataSetSizeInKb(subscription));

View file

@ -20,21 +20,18 @@
package com.raytheon.uf.viz.datadelivery.notification;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
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.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@ -59,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
* Feb 07, 2014 2453 mpduff Refactored dialog.
*
* </pre>
*
@ -95,41 +93,20 @@ public class FindDlg extends CaveSWTDialog {
/** ITableFind callback */
private final ITableFind callback;
/** Table row Index */
int tableIndex = -1;
/** Table row start Index */
int startIndex = 0;
/** Table row end Index */
int endIndex = 0;
/** Table row selected Index */
int selectedIndex = 0;
private int selectedIndex = 0;
/** Message Checkbox flag */
boolean msgFlag = false;
private boolean msgFlag = false;
/** Category Checkbox flag */
boolean categoryFlag = false;
private boolean categoryFlag = false;
/** Case Sensitive flag */
boolean caseFlag = false;
/** Yes continue search flag */
boolean yesFlag = false;
/** Found Item flag */
boolean exists = false;
private boolean caseFlag = false;
/** Exclude search flag */
boolean excludeFlag = false;
/** Message string */
String msg = null;
/** Subscription string */
String sub = null;
private boolean excludeFlag = false;
/**
* Constructor.
@ -150,13 +127,11 @@ public class FindDlg extends CaveSWTDialog {
*/
public FindDlg(Shell parent,
TableDataManager<NotificationRowData> filteredTableList,
int sIndex, int eIndex, int selected, ITableFind callback) {
int selected, ITableFind callback) {
super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK);
this.setText("Find");
this.filteredTableList = filteredTableList;
sIndex = startIndex;
eIndex = endIndex;
selectedIndex = selected;
this.callback = callback;
}
@ -185,12 +160,6 @@ public class FindDlg extends CaveSWTDialog {
*/
@Override
protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout();
createBottomButtons();
}
@ -219,12 +188,6 @@ public class FindDlg extends CaveSWTDialog {
findTxt.setLayoutData(gd);
findTxt.selectAll();
findTxt.setLayoutData(gd);
findTxt.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
findText();
}
});
gl = new GridLayout(2, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
@ -314,89 +277,16 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close();
}
});
}
/**
* Find text on key release. Check all pages of filtered list. Stop when
* match is found and don't move to the next.
*/
private void findText() {
// Text in the find text box
String text = findTxt.getText();
// Get button selections
msgFlag = msgBtn.getSelection();
categoryFlag = categoryBtn.getSelection();
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
int itemCount = filteredTableList.getDataArray().size();
tableIndex = 0;
if (filteredTableList != null) {
// Check rows in the entire filtered list - all pages
for (NotificationRowData row : filteredTableList.getDataArray()) {
// Column data
msg = row.getMessage();
sub = row.getCategory();
if (tableIndex <= itemCount) {
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
// Select index if matches message or subscription
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive
// message or subscription
if ((!msg.toUpperCase()
.contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else if ((msg.toUpperCase().contains(
text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
}
}
}
}
}
/**
* Find Button action handler. Find the next matching row upon button click.
*/
private void handleFindBtn() {
int prevSelectedIndex = selectedIndex;
// Text in the find text box
String text = findTxt.getText();
@ -420,56 +310,20 @@ public class FindDlg extends CaveSWTDialog {
boolean continueSearch = true;
boolean exists = false;
boolean hitEnd = false;
selectedIndex = selectedIndex + 1;
selectedIndex = callback.getCurrentSelectionIndex() + 1;
while (continueSearch) {
if (tableIndex < itemCount) {
// Get the row data starting at the currently highlighted row
if (selectedIndex < itemCount) {
NotificationRowData row = filteredTableList.getDataArray().get(
tableIndex);
selectedIndex);
// Column data
msg = row.getMessage();
sub = row.getCategory();
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
}
// If the item was found set exists to true
if (!continueSearch) {
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
continueSearch = false;
exists = true;
callback.selectRow(row);
}
selectedIndex++;
} else {
if (!hitEnd) {
int answer = DataDeliveryUtils
@ -480,10 +334,11 @@ public class FindDlg extends CaveSWTDialog {
"The end of the table has been reached. Would you like to search from the beginning of the table?");
if (answer == SWT.NO) {
exists = true;
selectedIndex = prevSelectedIndex;
break;
// Start search over at beginning of table
} else if (answer == SWT.YES) {
tableIndex = 0;
// Start search over at beginning of table
selectedIndex = 0;
continueSearch = true;
}
hitEnd = true;
@ -499,7 +354,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setText("Find Warning");
mb.setMessage("No item matching your search was found.");
mb.open();
tableIndex = 0;
selectedIndex = prevSelectedIndex;
callback.clearSelections();
}
}
@ -509,7 +364,6 @@ public class FindDlg extends CaveSWTDialog {
* text.
*/
private void handleHighlightBtn() {
// Text in the find text box
String text = findTxt.getText();
@ -519,61 +373,54 @@ public class FindDlg extends CaveSWTDialog {
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
ArrayList<Integer> items = new ArrayList<Integer>();
int[] indices = new int[0];
// Start search at beginning of table
tableIndex = 0;
List<NotificationRowData> items = new ArrayList<NotificationRowData>();
if (filteredTableList != null) {
for (int i = 0; i < filteredTableList.getDataArray().size(); i++) {
for (int i = 0; i < filteredTableList.getSize(); i++) {
NotificationRowData row = filteredTableList.getDataArray().get(
i);
// Message Column
msg = row.getMessage();
// Subscription Name column
sub = row.getCategory();
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
items.add(i);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
items.add(i);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
items.add(row);
}
tableIndex++;
}
indices = new int[items.size()];
// Create an int array of the rows to highlight
for (int i = 0; i < items.size(); i++) {
indices[i] = items.get(i);
}
callback.selectIndices(indices);
callback.selectRows(items);
}
}
}
/**
* Check if the matchText matches the row.
*
* @param matchText
* The text to match
* @param row
* The row to check
* @return true if matches
*/
private boolean checkForMatch(String matchText, NotificationRowData row) {
boolean matchFound = false;
String msg = row.getMessage();
String sub = row.getCategory();
if (!caseFlag) {
msg = msg.toUpperCase();
sub = sub.toUpperCase();
matchText = matchText.toUpperCase();
}
if (excludeFlag) {
if ((!msg.contains(matchText) && msgFlag)
|| (!sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
} else {
if ((msg.contains(matchText) && msgFlag)
|| (sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
}
return matchFound;
}
}

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking.
* Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu.
* Sep 25, 2013 2410 mpduff Check type of localization file.
* Feb 07, 2013 2453 mpduff Support find dialog refactor..
*
* </pre>
*
@ -394,7 +395,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideOlderMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteOlderThan();
tableComp.handleHideOlderThan();
}
});
@ -405,7 +406,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
tableComp.handleDeleteNotification();
tableComp.handleHideNotification();
}
});
@ -493,7 +494,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteByPriority((Integer) ((MenuItem) e
tableComp.handleHideByPriority((Integer) ((MenuItem) e
.getSource()).getData());
}
});
@ -572,8 +573,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
private void handleFind() {
if (fnd == null || fnd.isDisposed()) {
fnd = new FindDlg(shell, tableComp.getFilteredTableList(),
tableComp.getStartIndex(), tableComp.getEndIndex(),
tableComp.getSelectedIndex(), tableComp);
tableComp.getTable().getSelectionIndex(), tableComp);
fnd.open();
} else {
fnd.bringToTop();
@ -839,7 +839,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
if (isDisposed() == false && tableComp.passesFilter(records)) {
tableComp.populateTableDataRows(records);
tableComp.populateTable();
tableComp.handlePageSelection();
// update title display......
if (tableComp.isLocked()) {
setText(TITLE_TEXT + tableComp.getPauseCountLabel());

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jun 07, 2012 687 lvenable Table data refactor.
* Aug 30, 2013 2314 mpduff Fix formatting.
* Sep 16, 2013 2375 mpduff Change date sort order.
* Feb 07, 2014 2453 mpduff Added toString()
*
* </pre>
*
@ -299,4 +300,8 @@ public class NotificationRowData implements ITableData<NotificationRowData> {
}
}
@Override
public String toString() {
return this.date.toString() + " - " + this.message;
}
}

View file

@ -144,6 +144,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -471,8 +472,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
btn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String currentSite = LocalizationManager.getInstance()
.getCurrentSite();
String currentSite = DataDeliveryUtils.getDataDeliveryId();
SiteSelectionDlg dlg = new SiteSelectionDlg(shell, currentSite,
sharedSites);
dlg.setCloseCallback(new ICloseCallback() {
@ -1030,7 +1030,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
subscription = sharedSub;
} else {
Set<String> officeList = Sets.newHashSet();
officeList.add(LocalizationManager.getInstance().getCurrentSite());
officeList.add(DataDeliveryUtils.getDataDeliveryId());
subscription.setOfficeIDs(officeList);
}
@ -1540,8 +1540,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
*/
private void setSubscriptionId(Subscription sub) {
if (sub.getOriginatingSite() == null) {
LocalizationManager lm = LocalizationManager.getInstance();
sub.setOriginatingSite(lm.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
}
String id = RegistryUtil.getRegistryObjectKey(sub);
sub.setId(id);

View file

@ -41,10 +41,10 @@ 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.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
import com.raytheon.viz.ui.presenter.components.WidgetConf;
@ -67,7 +67,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 14, 2013 1040 mpduff Changed to add office Id rather than setting it.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -263,8 +264,7 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999);
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
// TODO: How to do this better? Will shared subscriptions participate in
// groups?

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
* Feb 11, 2014 2771 bgonzale Show all SiteDataTypes in site list.
*
* </pre>
*
@ -153,9 +154,7 @@ public class SiteSelectionDlg extends CaveSWTDialog {
for (Entry<String, SiteData> entry : siteDataMap.entrySet()) {
SiteDataType type = entry.getValue().getType();
if (type == SiteDataType.WFO || type == SiteDataType.RFC) {
siteList.add(entry.getKey());
}
siteList.add(entry.getKey());
}
// Remove the current site

View file

@ -26,6 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException;
@ -72,6 +75,7 @@ import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -148,6 +152,10 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Dec 05, 2013 2570 skorolev Show All subscriptions.
* Jan 08, 2014 2642 mpduff Update dialog for permissions, adding site to shared
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 04, 2014 2722 mpduff Add auto-refresh task.
* Feb 14, 2014 2806 mpduff Disable activate/deactivate buttons when viewing other site's subscriptions
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
* @author mpduff
@ -184,8 +192,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
/** Current site */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** The activate button */
private Button activateBtn;
@ -278,6 +285,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
/** New menu */
private MenuItem newMI;
private final ScheduledExecutorService scheduler;
/**
* Constructor
*
@ -292,6 +301,9 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
| CAVE.DO_NOT_BLOCK);
this.filter = filter;
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new RefreshTask(), 15, 15,
TimeUnit.MINUTES);
setText("Data Delivery Subscription Manager");
}
@ -346,7 +358,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
createBottomButtons();
enableMenus(true);
enableControls(true);
}
/*
@ -364,6 +376,17 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
scheduler.shutdownNow();
}
/**
* Create subscription menu.
*/
@ -634,7 +657,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
handleFilterSelection();
enableMenus(officeCbo.getText().equals(CURRENT_SITE));
enableControls(officeCbo.getText().equals(CURRENT_SITE));
}
});
@ -659,8 +682,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/
@Override
public void handleRefresh() {
tableComp.populateData();
tableComp.populateTable();
tableComp.handleRefresh();
}
private void createBottomButtons() {
@ -1498,9 +1520,12 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
/**
* Enable/Disable menus.
* Enable/Disable controls.
*
* @param enable
* true to enable, false to disable
*/
private void enableMenus(boolean enable) {
private void enableControls(boolean enable) {
copyMI.setEnabled(enable);
deleteGroupMI.setEnabled(enable);
editMI.setEnabled(enable);
@ -1510,5 +1535,24 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
groupMI.setEnabled(enable);
newMI.setEnabled(enable);
tableComp.enableMenus(enable);
activateBtn.setEnabled(enable);
deactivateBtn.setEnabled(enable);
}
/**
* Private inner work thread used to auto refresh dialog.
*/
private class RefreshTask implements Runnable {
@Override
public void run() {
if (TimeUtil.currentTimeMillis() - tableComp.getLastUpdateTime() >= TimeUtil.MILLIS_PER_MINUTE * 5) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleRefresh();
}
});
}
}
}
}

View file

@ -97,6 +97,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
* Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
* Feb 04, 2014 2677 mpduff Don't do overlap checks when deactivating subs.
*
* </pre>
*
@ -542,28 +543,42 @@ public class SubscriptionService implements ISubscriptionService {
final IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (subscriptions == null || subscriptions.isEmpty()) {
return new SubscriptionServiceResult(false,
"No subscriptions submitted.");
}
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
/*
* If activating the subscriptions check for overlaps.
*
* Only need to check one because all are being updated the same way.
*/
if (subscriptions.get(0).getSubscriptionState() == SubscriptionState.ON) {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy, StringUtil
.createMessage(OVERLAPPING_SUBSCRIPTIONS, subNames));
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy,
StringUtil.createMessage(OVERLAPPING_SUBSCRIPTIONS,
subNames));
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping",
e);
return new SubscriptionServiceResult(false);
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping", e);
return new SubscriptionServiceResult(false);
}
try {

View file

@ -57,9 +57,9 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
@ -110,6 +110,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 08, 2014 2642 mpduff Enable/disable menus based on site, allow user to add their site to a shared sub.
* Feb 04, 2014 2722 mpduff Add last update time.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* @version 1.0
*/
@ -120,8 +122,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
.getHandler(SubscriptionTableComp.class);
/** Current site constant */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** Pop up menu object. */
private Menu popupMenu;
@ -163,6 +164,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
/** Currently selected site */
private boolean currentSiteSelected;
/** Last table update time */
protected long lastUpdateTime = TimeUtil.currentTimeMillis();
/**
* Constructor.
*
@ -760,6 +764,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
lastUpdateTime = TimeUtil.currentTimeMillis();
if (!isDisposed()) {
handleRefresh();
}
@ -783,9 +788,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
*/
@Override
public void handleRefresh() {
populateData();
populateTable();
if (!isDisposed()) {
populateData();
populateTable();
this.lastUpdateTime = TimeUtil.currentTimeMillis();
}
}
@Override
@ -888,4 +895,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
});
job.schedule();
}
/**
* @return the lastUpdateTime
*/
public long getLastUpdateTime() {
return lastUpdateTime;
}
}

View file

@ -142,6 +142,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Nov 14, 2013 2548 mpduff Set the subscription type (QUERY OR RECURRING)
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 20, 2014 2538 mpduff Call doesNameExist method to check for dupes
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre>
*
* @author mpduff
@ -570,8 +571,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setOwner((create) ? LocalizationManager.getInstance()
.getCurrentUser() : this.subscription.getOwner());
sub.setOriginatingSite(LocalizationManager.getInstance()
.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
sub.setSubscriptionType(SubscriptionType.RECURRING);
return setupCommonSubscriptionAttributes(sub, defaultRoute);
@ -599,7 +599,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setRoute(defaultRoute);
sub.setName(nameText.getText());
if (subscription == null || subscription.getOfficeIDs() == null) {
sub.addOfficeID(LocalizationManager.getInstance().getCurrentSite());
sub.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
} else {
sub.setOfficeIDs(subscription.getOfficeIDs());
}

View file

@ -34,6 +34,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataType;
@ -43,6 +46,8 @@ import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil;
@ -82,8 +87,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jul 26, 2031 2232 mpduff Removed sendAuthorizationRequest method.
* Aug 30, 2013 2288 bgonzale Added latency to details display.
* Sep 30, 2013 1797 dhladky Time GriddedTime separation
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Feb 11, 2014 2771 bgonzale Added Data Delivery ID, getter, and retrieval method.
* </pre>
*
* @author mpduff
@ -121,6 +127,8 @@ public class DataDeliveryUtils {
public static final String UNABLE_TO_RETRIEVE_PENDING_SUBSCRIPTIONS = "Unable to retrieve pending subscriptions!";
private static final String dataDeliveryId = retrieveDataDeliveryId();
/**
* TABLE_TYPE enumeration.
*/
@ -832,4 +840,21 @@ public class DataDeliveryUtils {
public static int getMaxLatency(GriddedDataSet dataSet) {
return getMaxLatency(new ArrayList<Integer>(dataSet.getCycles()));
}
public static String getDataDeliveryId() {
return dataDeliveryId;
}
private static String retrieveDataDeliveryId() {
IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(RequestType.GET_DATADELIVERY_ID);
try {
SuccessfulExecution response = (SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return (String) response.getResponse();
} catch (Exception e) {
throw new RuntimeException(
"Unable to retrieve Data Delivery ID from EDEX.", e);
}
}
}

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
* Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery.
* Sep 05, 2013 2314 mpduff support the load all messages option.
* Feb 07, 2014 2453 mpduff Remove username query param.
*
* </pre>
*
@ -84,10 +85,9 @@ public class NotificationHandler implements INotificationObserver {
public List<NotificationRecord> intialLoad(MessageLoadXML messageLoad,
ArrayList<String> users) {
int loadAmount;
String username = null;
Integer hours = null;
Integer maxResults = null;
Boolean loadAll = false;
boolean loadAll = false;
// Retrieve the message load configuration
if (messageLoad != null) {
loadAll = messageLoad.isLoadAllMessages();
@ -100,22 +100,11 @@ public class NotificationHandler implements INotificationObserver {
}
}
// Set usernames from filter
if (users != null && users.isEmpty() == false) {
StringBuffer sb = new StringBuffer();
for (String user : users) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(user);
}
username = sb.toString();
}
// Request data from the notification table.
// Note: Removing username query parameter for front end label
// consistency
try {
GetNotificationRequest request = new GetNotificationRequest();
request.setUsername(username);
request.setHours(hours);
request.setMaxResults(maxResults);
request.setLoadAll(loadAll);

View file

@ -123,8 +123,10 @@ public class AlertVizApplication implements IStandaloneComponent {
AlertvizJob as = new AlertvizJob(port);
if (as.isAlreadyStarted()) {
Container.logInternal(Priority.ERROR,
"Alertviz already started on port: " + port + ", exiting");
String exitMsg = "Alertviz already started on port: " + port
+ ", exiting";
System.out.println(exitMsg);
Container.logInternal(Priority.ERROR, exitMsg);
return IApplication.EXIT_OK;
}

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
@ -51,6 +52,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a
* preference.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Only one field for proxy server
*
* </pre>
*
@ -61,9 +63,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private BooleanFieldEditor useProxies;
private StringFieldEditor pypiesServer;
private StringFieldEditor servicesServer;
private StringFieldEditor proxyServer;
private Button connectivityButton;
@ -92,18 +92,11 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
"&Use Proxy Servers", getFieldEditorParent());
addField(useProxies);
servicesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_SERVICES_PROXY,
"&Services Address: ", getFieldEditorParent());
servicesServer.setErrorMessage("Cannot connect to Services server");
addField(servicesServer);
pypiesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PYPIES_PROXY,
"&Pypies Address: ", getFieldEditorParent());
pypiesServer.setErrorMessage("Cannot connect to Pypies server");
addField(pypiesServer);
proxyServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PROXY_ADDRESS,
"&Proxy Address: ", getFieldEditorParent());
proxyServer.setErrorMessage("Cannot connect to Proxy server");
addField(proxyServer);
addConnectivityButton();
}
@ -131,43 +124,40 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
* Check the connectivity of the server field editors
*/
private void checkConnectivity() {
final ConnectivityResult result = new ConnectivityResult(false, "");
final ConnectivityResult servicesResult = new ConnectivityResult(false,
"");
final ConnectivityResult pypiesResult = new ConnectivityResult(false,
"");
String errorMessage = "Cannot connect to proxy server: ";
boolean serverError = false;
// check HTTP Server
Text text = servicesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkLocalizationServer(text.getText().trim(),
Text text = proxyServer.getTextControl(getFieldEditorParent());
String proxyAddr = text.getText().trim();
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
servicesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
// check Pypies Server
Text textPypies = pypiesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkHttpServer(textPypies.getText().trim(),
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
pypiesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
textPypies.setBackground(Display.getDefault().getSystemColor(
if (servicesResult.hasConnectivity && pypiesResult.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
textPypies.setBackground(Display.getDefault().getSystemColor(
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
@ -191,8 +181,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private void updateEnabledFields() {
boolean useProxies = this.useProxies.getBooleanValue();
servicesServer.setEnabled(useProxies, connectivityButton.getParent());
pypiesServer.setEnabled(useProxies, connectivityButton.getParent());
proxyServer.setEnabled(useProxies, connectivityButton.getParent());
connectivityButton.setEnabled(useProxies);
}

View file

@ -0,0 +1,91 @@
/**
* 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.thinclient;
/**
* Utilities for manipulating thin client URIs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 3, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ThinClientUriUtil {
private static String services = "services";
private static String pypies = "pypies";
static {
services = System.getProperty("thinclient.proxy.services", services);
pypies = System.getProperty("thinclient.proxy.pypies", pypies);
}
private ThinClientUriUtil() {
}
/**
* Returns the address to connect to EDEX services when going through the
* thin client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getServicesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + services;
}
/**
* Returns the address to connect to PyPIES when going through the thin
* client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getPypiesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + pypies;
}
/**
* Appends a trailing slash to an address if the address does not have one
*
* @param proxyAddress
* @return
*/
private static String appendTrailingSlash(String proxyAddress) {
if (!proxyAddress.endsWith("/")) {
proxyAddress += "/";
}
return proxyAddress;
}
}

View file

@ -25,15 +25,15 @@ import org.apache.commons.collections.map.DefaultedMap;
import org.eclipse.jface.preference.IPreferenceStore;
import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.localization.msgs.GetServersRequest;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.VizServers;
import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
@ -51,8 +51,9 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
* Dec 06, 2012 1396 njensen Added setting VizServers
* Jan 14, 2013 1469 bkowal Removed setting the hdf5 data directory
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* now provided by EDEX.
* Feb 04, 2014 2704 njensen Single proxy address/preference
*
* </pre>
*
@ -87,20 +88,25 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) {
String servicesProxy = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
LocalizationManager.getInstance().setCurrentServer(servicesProxy);
String proxyAddr = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
String servicesProxy = ThinClientUriUtil
.getServicesAddress(proxyAddr);
LocalizationManager.getInstance().setCurrentServer(servicesProxy,
false);
VizApp.setHttpServer(servicesProxy);
if (!disableJMS) {
GetServersRequest req = new GetServersRequest();
GetServersResponse resp = (GetServersResponse) ThriftClient
.sendLocalizationRequest(req);
GetServersResponse resp = ConnectivityManager
.checkLocalizationServer(servicesProxy, false);
if (!disableJMS) {
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
}
}
VizApp.setHttpServer(servicesProxy);
VizApp.setPypiesServer(store
.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY));
String pypiesProxy = ThinClientUriUtil
.getPypiesAddress(proxyAddr);
VizApp.setPypiesServer(pypiesProxy);
boolean compressRequests = store
.getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION);
HttpClient.getInstance().setCompressRequests(compressRequests);

View file

@ -30,6 +30,7 @@ package com.raytheon.uf.viz.thinclient.preferences;
* ------------ ---------- ----------- --------------------------
* Oct 20, 2011 mschenke Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant.
* Feb 04, 2014 2704 njensen Single proxy preference constant
*
* </pre>
*
@ -47,10 +48,6 @@ public class ThinClientPreferenceConstants {
public static String P_USE_PROXIES = "useHttpProxy";
public static String P_SERVICES_PROXY = "servicesProxyAddress";
public static String P_PYPIES_PROXY = "pypiesProxyAddress";
public static String P_MENU_TIME_UPDATE_INTERVALS = "menuTimeUpdateInterval";
public static String P_DATA_UPDATE_INTERVALS = "dataUpdateInterval";
@ -70,4 +67,6 @@ public class ThinClientPreferenceConstants {
public static String P_ENABLE_REQUEST_COMPRESSION = "enableRequestCompression";
public static String P_PREFERENCE_PLACEHOLDER = "placeholderPreference";
public static String P_PROXY_ADDRESS = "proxyAddress";
}

View file

@ -27,25 +27,30 @@ 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.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
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.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.ConnectivityPreferenceDialog;
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
* TODO Add Description
* Connectivity dialog for launching thinclient or thinalertviz. Contains extra
* options not available when connecting with a normal CAVE.
*
* <pre>
*
@ -55,6 +60,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* ------------ ---------- ----------- --------------------------
* Nov 23, 2011 bsteffen Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Refactored
* Feb 17, 2014 2704 njensen Added checks for alertviz connectivity
*
* </pre>
*
@ -71,8 +78,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
servicesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class PypiesCallback implements IConnectivityCallback {
@ -80,26 +90,30 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
pypiesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class JmsCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
jmsGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private Label servicesLabel;
private Text servicesText;
private String services = "";
private boolean servicesGood = false;
private IConnectivityCallback servicesCallback = new ServicesCallback();
private Label pypiesLabel;
private Text pypiesText;
private String pypies = "";
private boolean pypiesGood = false;
private IConnectivityCallback pypiesCallback = new PypiesCallback();
@ -108,15 +122,29 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
private boolean useProxy = false;
private Button disableJmsCheck;
private boolean disableJms = false;
private boolean jmsGood = false;
private Label jmsErrorLabel;
private IConnectivityCallback jmsCallback = new JmsCallback();
private Text proxyText;
private String proxyAddress;
public ThinClientConnectivityDialog(boolean checkAlertViz) {
super(checkAlertViz);
super(checkAlertViz, "Thin Client Connectivity Preferences");
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
useProxy = store
.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES);
services = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
pypies = store.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY);
disableJms = store
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
proxyAddress = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
}
@Override
@ -124,66 +152,75 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
super.createTextBoxes(textBoxComp);
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Servers:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
label.setText("Disable JMS:");
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
useProxyCheck = new Button(textBoxComp, SWT.CHECK | SWT.LEFT);
Composite jmsComp = new Composite(textBoxComp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
jmsComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
jmsComp.setLayoutData(gd);
disableJmsCheck = new Button(jmsComp, SWT.CHECK | SWT.LEFT);
disableJmsCheck.setSelection(disableJms);
disableJmsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
disableJms = disableJmsCheck.getSelection();
validate();
}
});
jmsErrorLabel = new Label(jmsComp, SWT.LEFT);
jmsErrorLabel.setText("Error connecting to JMS");
jmsErrorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
jmsErrorLabel.setVisible(false);
label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Server:");
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
Composite proxyComp = new Composite(textBoxComp, SWT.NONE);
gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
proxyComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
proxyComp.setLayoutData(gd);
useProxyCheck = new Button(proxyComp, SWT.CHECK | SWT.LEFT);
useProxyCheck.setSelection(useProxy);
useProxyCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateProxyEnabled();
}
});
servicesLabel = new Label(textBoxComp, SWT.RIGHT);
servicesLabel.setText("Services Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
servicesLabel.setLayoutData(gd);
proxyText = new Text(proxyComp, SWT.NONE | SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.None, true, true);
proxyText.setLayoutData(gd);
proxyText.setText(proxyAddress == null ? "" : proxyAddress);
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
servicesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
servicesText.setLayoutData(gd);
servicesText.setText(services);
if (!servicesGood) {
servicesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
pypiesLabel = new Label(textBoxComp, SWT.RIGHT);
pypiesLabel.setText("Pypies Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
pypiesLabel.setLayoutData(gd);
pypiesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
pypiesText.setLayoutData(gd);
pypiesText.setText(pypies);
if (!pypiesGood) {
pypiesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
updateProxyEnabled();
}
@Override
protected void applySettings() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES, useProxy);
store.setValue(ThinClientPreferenceConstants.P_DISABLE_JMS, disableJms);
if (useProxy) {
store.setValue(ThinClientPreferenceConstants.P_SERVICES_PROXY,
services);
store.setValue(ThinClientPreferenceConstants.P_PYPIES_PROXY, pypies);
// Set the site and alertViz server for super.
LocalizationManager.getInstance().setCurrentSite(getSite());
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES,
useProxy);
store.setValue(ThinClientPreferenceConstants.P_PROXY_ADDRESS,
proxyAddress);
if (getAlertVizServer() != null) {
LocalizationManager
.getInstance()
@ -191,11 +228,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
.setValue(LocalizationConstants.P_ALERT_SERVER,
getAlertVizServer());
}
// setting the site will save the preference store
LocalizationManager.getInstance().setCurrentSite(getSite());
try {
((IPersistentPreferenceStore) store).save();
((IPersistentPreferenceStore) LocalizationManager.getInstance()
.getLocalizationStore()).save();
} catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT,
"Unable to persist localization preference store", e);
@ -208,50 +245,103 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public boolean validate() {
boolean superValid = super.validate();
if (!useProxy) {
return superValid;
return super.validate();
}
if (servicesText != null && !servicesText.isDisposed()
&& servicesText.isEnabled()) {
String services = servicesText.getText().trim();
if (!servicesGood || !this.services.equals(services)) {
this.services = services;
validateServices();
servicesText.setBackground(getTextColor(servicesGood));
}
} else {
status = null;
details = null;
// validate proxy
if (proxyText != null && !proxyText.isDisposed()
&& proxyText.isEnabled()) {
proxyAddress = proxyText.getText();
}
if (proxyAddress != null && proxyAddress.length() > 0) {
validateServices();
}
if (pypiesText != null && !pypiesText.isDisposed()
&& pypiesText.isEnabled()) {
String pypies = pypiesText.getText().trim();
if (!pypiesGood || !this.pypies.equals(pypies)) {
this.pypies = pypies;
validatePypies();
pypiesText.setBackground(getTextColor(pypiesGood));
}
} else {
validatePypies();
} else {
status = "Please enter a thin client proxy server address";
}
return servicesGood && pypiesGood && isSiteGood() && isAlertVizGood();
if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
}
// only check Jms if it's enabled and we can connect to the services
if (!disableJms) {
if (servicesGood) {
try {
GetServersResponse response = ConnectivityManager
.checkLocalizationServer(ThinClientUriUtil
.getServicesAddress(proxyAddress), false);
ConnectivityManager.checkJmsServer(
response.getJmsConnectionString(), jmsCallback);
} catch (VizException e) {
if (status == null) {
status = "Error connecting to JMS";
}
appendDetails(buildDetails(new ConnectivityResult(false,
null, e)));
jmsGood = false;
}
} else {
// JMS can't be good if services fail cause then we don't
// even know where to connect JMS to
jmsGood = false;
}
}
jmsGood = (jmsGood || disableJms);
if (jmsErrorLabel != null && !jmsErrorLabel.isDisposed()) {
jmsErrorLabel.setVisible(!jmsGood);
}
// validate site
if (siteText != null && !siteText.isDisposed()) {
super.setSite(siteText.getText());
}
super.validateSite();
if (siteText != null && !siteText.isDisposed()) {
siteText.setBackground(getTextColor(isSiteGood()));
}
// validate alertviz
// apparently alertvizserver == null means it's alertviz itself
if (alertVizServer != null) {
if (alertVizText != null && !alertVizText.isDisposed()) {
setAlertVizServer(alertVizText.getText());
super.validateAlertviz();
alertVizText.setBackground(getTextColor(isAlertVizGood()));
}
}
boolean everythingGood = servicesGood && pypiesGood && isSiteGood()
&& isAlertVizGood() && jmsGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateServices() {
ConnectivityManager.checkLocalizationServer(services, servicesCallback);
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddress),
servicesCallback);
}
private void validatePypies() {
ConnectivityManager.checkHttpServer(pypies, pypiesCallback);
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddress),
pypiesCallback);
}
private void updateProxyEnabled() {
useProxy = useProxyCheck.getSelection();
servicesLabel.setEnabled(useProxy);
servicesText.setEnabled(useProxy);
pypiesLabel.setEnabled(useProxy);
pypiesText.setEnabled(useProxy);
setLocalizationEnabled(!useProxy);
proxyText.setEnabled(useProxy);
super.setLocalizationEnabled(!useProxy);
if (useProxy) {
if (localizationText != null && !localizationText.isDisposed()) {
localizationText.setBackground(getTextColor(true));
}
}
validate();
}

View file

@ -6,8 +6,13 @@ const int RED_BAND = 0;
const int GREEN_BAND = 1;
const int BLUE_BAND = 2;
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform ColorMapping colorMapping;
uniform sampler2D trueColorTexture;
@ -49,7 +54,7 @@ vec4 applyColorBand(int colorband) {
vec2((xy.x / width), (xy.y / height)));
// Lookup raw data value
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
float r = curVal.r;
float g = curVal.g;
@ -58,7 +63,7 @@ vec4 applyColorBand(int colorband) {
if (dataValue != rawData.noDataValue && dataValue == dataValue) {
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
float index = getColorMappingIndex(cmapValue, colorMapping);
int currentMask = toBitMask(a);
@ -86,4 +91,4 @@ void main(void) {
} else {
gl_FragColor = applyColorBand(band);
}
}
}

View file

@ -3,7 +3,10 @@
#include <mapping>
#include <coloring>
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
uniform float bkgrndRed;
@ -11,22 +14,20 @@ uniform float bkgrndGreen;
uniform float bkgrndBlue;
void main(void){
sampler1D colorMap = colorMapping.colorMap;
float logFactor = colorMapping.logFactor;
int applyMask = colorMapping.applyMask;
sampler1D alphaMask = colorMapping.alphaMask;
// Lookup color in colorMap for index
float index = gl_TexCoord[0].s;
if ( logFactor > 0.0 ) {
index = getLogFactorIndex(index, logFactor);
}
vec4 color = texture1D(colorMap, index).rgba;
vec4 color = texture1D(colorMappingColorMap, index).rgba;
// Apply alpha mask if set
float alpha = color.a;
if ( applyMask == 1 ) {
if ( texture1D(alphaMask , index ).r != 0.0 ) {
if ( texture1D(colorMappingAlphaMask , index ).r != 0.0 ) {
color = vec4(bkgrndRed, bkgrndGreen, bkgrndBlue, alpha);
}
}

View file

@ -1,13 +1,21 @@
#include <mapping>
#include <coloring>
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
void main(void) {
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
// No data check/special NaN check
if (dataValue == rawData.noDataValue || dataValue != dataValue) {
@ -16,9 +24,9 @@ void main(void) {
}
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
// Get color for colormapping, given value
vec4 textureColor = getColorByValue(cmapValue, colorMapping);
vec4 textureColor = getColorByValue(cmapValue, colorMapping, colorMappingColorMap, colorMappingAlphaMask);
// Apply the color modifiers into gl_FragColor
gl_FragColor = applyColorModifiers(textureColor, modifiers);
}

View file

@ -8,8 +8,7 @@
* implied data will range 0-1 and need scaling to get raw value
* where scaleMin maps to 0 and scaleMax maps to 1.
*/
struct DataTexture {
sampler2D rawTex;
struct DataTextureInfo {
float noDataValue;
int isScaled;
float scaleMin;
@ -18,23 +17,9 @@ struct DataTexture {
float height;
};
/**
* Fields used for converting from image data values to
* colormapping data values. Done to avoid conversions in
* application code. dmv[i] -> cmv[i]. Linear interpolation
* is done where non-exact matches are found. Mappings should
* be uploaded as floats so no scaling is needed
*/
struct DataMapping {
sampler1D dataMappingValues;
sampler1D colorMappingValues;
int numMappingValues;
};
struct ColorMapping {
/** Fields for color map and size. colorMap contains colors to
* use for mapping. cmapMin/Max is range colormap is applied over */
sampler1D colorMap;
float cmapMin;
float cmapMax;
@ -42,7 +27,6 @@ struct ColorMapping {
* same size as colorMap and contains 0s and 1s, 1 indicating alpha
* should be set to completely transparent */
int applyMask;
sampler1D alphaMask;
/** Fields for logarithmic and mirrored indexing into the colorMap */
int isMirrored;
@ -51,28 +35,28 @@ struct ColorMapping {
};
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float textureToDataValue(DataTexture texture, vec2 location) {
vec4 textureValue = texture2D(texture.rawTex, location);
float textureToDataValue(sampler2D texture, DataTextureInfo info, vec2 location) {
vec4 textureValue = texture2D(texture, location);
float dataValue = textureValue.r;
if (texture.isScaled == 1) {
if (info.isScaled == 1) {
// Convert to non-scaled value
dataValue = ((dataValue * (texture.scaleMax - texture.scaleMin))
+ texture.scaleMin);
dataValue = ((dataValue * (info.scaleMax - info.scaleMin))
+ info.scaleMin);
}
return dataValue;
}
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float dataToTextureValue(DataTexture texture, float dataValue) {
float dataToTextureValue(DataTextureInfo info, float dataValue) {
float textureValue = dataValue;
if (texture.isScaled == 1) {
textureValue = (dataValue - texture.scaleMin)
/ (texture.scaleMax - texture.scaleMin);
if (info.isScaled == 1) {
textureValue = (dataValue - info.scaleMin)
/ (info.scaleMax - info.scaleMin);
}
return textureValue;
}
@ -86,10 +70,9 @@ float lookupMappingValue(sampler1D mappingTex, int index,
}
/**
* Converts a data value into a colorMap value given the DataMapping
* Converts a data value into a colorMap value given the data mapping info
*/
float dataToColorMapValue(float dataValue, DataMapping mapping) {
int numMappingValues = mapping.numMappingValues;
float dataToColorMapValue(float dataValue, sampler1D dataMappingDataValues, sampler1D dataMappingColorValues, int numMappingValues) {
if (numMappingValues == 0) {
// Short circuit if no mapping is needed
return dataValue;
@ -99,9 +82,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int lowIndex = 0;
int highIndex = numMappingValues - 1;
float lowValue = lookupMappingValue(mapping.dataMappingValues, lowIndex,
float lowValue = lookupMappingValue(dataMappingDataValues, lowIndex,
numMappingValues);
float highValue = lookupMappingValue(mapping.dataMappingValues, highIndex,
float highValue = lookupMappingValue(dataMappingDataValues, highIndex,
numMappingValues);
int reversed = 0;
if (lowValue > highValue) {
@ -117,7 +100,7 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int nextIndex = lowIndex + ((highIndex - lowIndex) / 2);
if (nextIndex > lowIndex && nextIndex < highIndex) {
// Look up next value and determine if it is a high or low
float nextValue = lookupMappingValue(mapping.dataMappingValues,
float nextValue = lookupMappingValue(dataMappingDataValues,
nextIndex, numMappingValues);
if (nextValue < dataValue) {
if (reversed == 0) {
@ -146,9 +129,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
factor = 1.0 - factor;
}
float lowCmapValue = lookupMappingValue(mapping.colorMappingValues,
float lowCmapValue = lookupMappingValue(dataMappingColorValues,
lowIndex, numMappingValues);
float highCmapValue = lookupMappingValue(mapping.colorMappingValues,
float highCmapValue = lookupMappingValue(dataMappingColorValues,
highIndex, numMappingValues);
return lowCmapValue + (highCmapValue - lowCmapValue) * factor;
@ -180,16 +163,16 @@ float getLinearIndex(float cmapValue, float cmapMin, float cmapMax) {
*/
float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Account for 0 min index
if (rangeMin == 0) {
if (rangeMin == 0.0) {
rangeMin = 0.0000001;
if (rangeMax < 0) {
if (rangeMax < 0.0) {
rangeMin = -rangeMin;
}
}
int reverse = 0;
if ((value < rangeMin && rangeMin > 0)
|| (value > rangeMin && rangeMin < 0)) {
if ((value < rangeMin && rangeMin > 0.0)
|| (value > rangeMin && rangeMin < 0.0)) {
reverse = 1;
}
@ -200,10 +183,10 @@ float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Check uncomputable index value, everything between this range is 0,
// rangeMin->rangeMax 0 -> 1, -rangeMin->-rangeMax 0 -> -1
if (value <= rangeMin && value >= -rangeMin) {
return 0;
return 0.0;
}
double index = (log(value) - log(rangeMin))
float index = (log(value) - log(rangeMin))
/ (log(rangeMax) - log(rangeMin));
if (reverse != 0) {
index = -index;
@ -232,12 +215,12 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float index = 0.0;
// Flag if min/max values are on opposite sides of zero
int minMaxOpposite = 0;
if ((cmapMin < 0 && cmapMax > 0) || (cmapMin > 0 && cmapMax < 0)) {
if ((cmapMin < 0.0 && cmapMax > 0.0) || (cmapMin > 0.0 && cmapMax < 0.0)) {
minMaxOpposite = 1;
}
if (mirror != 0 || minMaxOpposite != 0) {
if (cmapMax < 0) {
if (cmapMax < 0.0) {
// Invert colormapping if negative range was given
cmapValue = -cmapValue;
}
@ -261,9 +244,9 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float logPosCmapMax = absLogZeroVal + log(posCmapMax);
// Calculate index which zeroVal is at based on neg max and pos max
float zeroValIndex = logNegCmapMax / (logNegCmapMax + logPosCmapMax);
if (cmapValue > 0) {
if (cmapValue > 0.0) {
index = valueToLogIndex(rangeValue, zeroVal, posCmapMax);
index = zeroValIndex + (1 - zeroValIndex) * index;
index = zeroValIndex + (1.0 - zeroValIndex) * index;
} else {
index = valueToLogIndex(rangeValue, zeroVal, negCmapMax);
index = zeroValIndex - zeroValIndex * index;
@ -277,8 +260,8 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
if (inverted == 1) {
index = 1.0 - index;
}
if (cmapMin > 0 && cmapValue < rangeMin
|| (cmapMin < 0 && cmapValue > -rangeMin)) {
if (cmapMin > 0.0 && cmapValue < rangeMin
|| (cmapMin < 0.0 && cmapValue > -rangeMin)) {
index = -index;
}
}
@ -333,13 +316,13 @@ float getColorMappingIndex(float cmapValue, ColorMapping colorMapping) {
/**
* Returns a color for the index based on the ColorMapping
*/
vec4 getColorByIndex(float index, ColorMapping colorMapping) {
vec4 getColorByIndex(float index, sampler1D colorMap, sampler1D alphaMask, int applyMask) {
// Lookup color in colorMap for index
vec4 textureColor = texture1D(colorMapping.colorMap, index).rgba;
vec4 textureColor = texture1D(colorMap, index).rgba;
// Apply alpha mask
if (colorMapping.applyMask == 1) {
if (texture1D(colorMapping.alphaMask, index).r != 0.0) {
if (applyMask == 1) {
if (texture1D(alphaMask, index).r != 0.0) {
textureColor = vec4(textureColor.rgb, 0.0);
}
}
@ -349,7 +332,7 @@ vec4 getColorByIndex(float index, ColorMapping colorMapping) {
/**
* Returns a color for the cmapValue based on the ColorMapping
*/
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping) {
return getColorByIndex(getColorMappingIndex(cmapValue, colorMapping),
colorMapping);
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping, sampler1D colorMap, sampler1D alphaMask) {
float index = getColorMappingIndex(cmapValue, colorMapping);
return getColorByIndex(index, colorMap, alphaMask, colorMapping.applyMask);
}

View file

@ -3,21 +3,27 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue = mosaicValue;
// No data check/special NaN check
if (imageValue != imageData.noDataValue && imageValue == imageValue) {
// Convert image value to mosaic value
imageValue = dataToColorMapValue(imageValue, imageToMosaic);
imageValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
if (imageValue > mosaicValue) {
newValue = imageValue;
}

View file

@ -3,14 +3,20 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue;
@ -19,7 +25,7 @@ void main(void) {
// Use existing value
newValue = mosaicValue;
} else {
newValue = dataToColorMapValue(imageValue, imageToMosaic);
newValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
}
gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0,
1.0);

View file

@ -110,8 +110,7 @@ public class GLStats {
lowMem |= getSystemStats(output);
lowMem |= getImageCacheStats(output);
lowMem |= getNvidiaStats(gl, output);
// The ATI version is untested, only enable if it has been tested.
// lowMem |= getAtiStats(gl, output);
lowMem |= getAtiStats(gl, output);
if (lowMem) {
lastPrintTime = curTime;

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.viz.core.gl.ext.imaging;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.HashSet;
import java.util.Set;
@ -41,6 +38,9 @@ import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.AbstractGLMesh;
import com.raytheon.viz.core.gl.GLCapabilities;
import com.raytheon.viz.core.gl.GLGeometryObject2D;
import com.raytheon.viz.core.gl.GLGeometryObject2D.GLGeometryObjectData;
import com.raytheon.viz.core.gl.GLGeometryPainter;
import com.raytheon.viz.core.gl.IGLTarget;
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
@ -57,7 +57,10 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 15, 2011 mschenke Initial creation
* Dec 15, 2011 mschenke Initial creation
* Jan 9, 2014 2680 mschenke Switched simple PixelCoverage mesh
* rendering to use VBOs instead of
* deprecated immediate mode rendering
*
* </pre>
*
@ -206,6 +209,11 @@ public abstract class AbstractGLImagingExtension extends
continue;
}
}
// Needed to fix ATI driver bug, after each image render, flush the
// GL pipeline to avoid random images being drawn improperly. May be
// fixed with driver update or cleaning up how image coverages are
// rendered (getting rid of glEnableClientState as it is deprecated)
gl.glFlush();
}
if (lastTextureType != -1) {
@ -258,46 +266,36 @@ public abstract class AbstractGLImagingExtension extends
return ((AbstractGLMesh) mesh).paint(target, paintProps);
}
} else if (coords != null) {
FloatBuffer fb = ByteBuffer.allocateDirect(4 * 5 * 4)
.order(ByteOrder.nativeOrder()).asFloatBuffer();
Coordinate ul = pc.getUl();
Coordinate ur = pc.getUr();
Coordinate lr = pc.getLr();
Coordinate ll = pc.getLl();
fb.put(new float[] { coords.left() + corrFactor,
coords.bottom() + corrFactor });
fb.put(new float[] { (float) ll.x, (float) ll.y, (float) ll.z });
int geometryType = GL.GL_TRIANGLE_STRIP;
GLGeometryObject2D vertexData = new GLGeometryObject2D(
new GLGeometryObjectData(geometryType, GL.GL_VERTEX_ARRAY));
vertexData.allocate(4);
vertexData.addSegment(new double[][] { { ll.x, ll.y },
{ lr.x, lr.y }, { ul.x, ul.y }, { ur.x, ur.y } });
vertexData.compile(gl);
fb.put(new float[] { coords.right() - corrFactor,
coords.bottom() + corrFactor });
fb.put(new float[] { (float) lr.x, (float) lr.y, (float) lr.z });
GLGeometryObject2D textureData = new GLGeometryObject2D(
new GLGeometryObjectData(geometryType,
GL.GL_TEXTURE_COORD_ARRAY));
textureData.allocate(4);
textureData.addSegment(new double[][] {
{ coords.left(), coords.bottom() },
{ coords.right(), coords.bottom() },
{ coords.left(), coords.top() },
{ coords.right(), coords.top() } });
textureData.compile(gl);
fb.put(new float[] { coords.left() + corrFactor,
coords.top() - corrFactor });
fb.put(new float[] { (float) ul.x, (float) ul.y, (float) ul.z });
GLGeometryPainter.paintGeometries(gl, vertexData, textureData);
fb.put(new float[] { coords.right() - corrFactor,
coords.top() - corrFactor });
fb.put(new float[] { (float) ur.x, (float) ur.y, (float) ur.z });
vertexData.dispose();
textureData.dispose();
// Clear error bit
gl.glGetError();
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
gl.glInterleavedArrays(GL.GL_T2F_V3F, 0, fb.rewind());
int error = gl.glGetError();
if (error == GL.GL_NO_ERROR) {
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
} else {
target.handleError(error);
}
gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
return PaintStatus.PAINTED;
}
return PaintStatus.ERROR;

View file

@ -56,7 +56,9 @@ public class GLSLStructFactory {
int texBinding, AbstractGLColormappedImage image) {
ColorMapParameters parameters = image.getColorMapParameters();
AbstractGLColorMapDataFormat dataFormat = image.getDataFormat();
setFieldUniform(program, name, "rawTex", texBinding);
// Set the texture outside the struct
setFieldUniform(program, name + "Tex", texBinding);
// Set struct fields
setFieldUniform(program, name, "noDataValue",
parameters.getNoDataValue());
setFieldUniform(program, name, "isScaled", dataFormat.isScaled());
@ -82,11 +84,9 @@ public class GLSLStructFactory {
public static void createDataMapping(GLShaderProgram program, String name,
int dataMappingTexBinding, int colorMappingTexBinding,
int numMappingValues) {
setFieldUniform(program, name, "dataMappingValues",
dataMappingTexBinding);
setFieldUniform(program, name, "colorMappingValues",
colorMappingTexBinding);
setFieldUniform(program, name, "numMappingValues", numMappingValues);
setFieldUniform(program, name + "DataValues", dataMappingTexBinding);
setFieldUniform(program, name + "ColorValues", colorMappingTexBinding);
setFieldUniform(program, name + "Values", numMappingValues);
}
/**
@ -101,12 +101,12 @@ public class GLSLStructFactory {
public static void createColorMapping(GLShaderProgram program, String name,
int colorMapTexBinding, int alphaMaskTexBinding,
ColorMapParameters parameters) {
setFieldUniform(program, name, "colorMap", colorMapTexBinding);
setFieldUniform(program, name + "ColorMap", colorMapTexBinding);
setFieldUniform(program, name, "cmapMin", parameters.getColorMapMin());
setFieldUniform(program, name, "cmapMax", parameters.getColorMapMax());
setFieldUniform(program, name, "applyMask", parameters.isUseMask());
setFieldUniform(program, name, "alphaMask", alphaMaskTexBinding);
setFieldUniform(program, name + "AlphaMask", alphaMaskTexBinding);
setFieldUniform(program, name, "isMirrored", parameters.isMirror());
setFieldUniform(program, name, "isLogarithmic",
@ -132,6 +132,13 @@ public class GLSLStructFactory {
private static void setFieldUniform(GLShaderProgram program,
String structName, String fieldName, Object fieldValue) {
program.setUniform(structName + FIELD_SEPERATOR + fieldName, fieldValue);
setFieldUniform(program, structName + FIELD_SEPERATOR + fieldName,
fieldValue);
}
private static void setFieldUniform(GLShaderProgram program,
String fieldName, Object fieldValue) {
program.setUniform(fieldName, fieldValue);
}
}

View file

@ -280,7 +280,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
gl = GLU.getCurrentGL();
theWidth = width;
theHeight = width;
theHeight = height;
float magnificationVal = Activator.getDefault().getPreferenceStore()
.getFloat(PreferenceConstants.P_FONT_MAGNIFICATION);
@ -324,7 +324,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
gl = GLU.getCurrentGL();
theWidth = width;
theHeight = width;
theHeight = height;
float magnificationVal = Activator.getDefault().getPreferenceStore()
.getFloat(PreferenceConstants.P_FONT_MAGNIFICATION);
@ -1706,8 +1706,9 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
endAzm += 360.0;
}
double totalAzimuth = (endAzm - startAzm);
boolean includeSides = circle.includeSides && !fill
&& ((endAzm - startAzm) < 360.0);
&& (totalAzimuth < 360.0);
if (fill) {
gl.glBegin(GL.GL_TRIANGLE_FAN);
@ -1720,8 +1721,16 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
}
}
double step = (endAzm - startAzm) / (circle.numberOfPoints);
for (double azm = startAzm; azm <= endAzm; azm += step) {
// Get the number of unique points in the circle
int points = circle.numberOfPoints;
if (totalAzimuth >= 360) {
// If angle is meant to be complete circle, add extra point
// to ensure circle is touching
points += 1;
}
double step = totalAzimuth / (points - 1);
for (int i = 0; i < points; ++i) {
double azm = startAzm + (i * step);
double[] pointOnCircle = getPointOnCircle(x, y, z, radius,
azm);
gl.glVertex3d(pointOnCircle[0], pointOnCircle[1],
@ -1784,8 +1793,12 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
message = "GL table too large?";
break;
}
case GL.GL_INVALID_FRAMEBUFFER_OPERATION_EXT: {
message = "Invalid FrameBuffer operation";
break;
}
default: {
message = "GL Error" + errorid;
message = "GL Error: " + errorid;
}
}

View file

@ -35,6 +35,9 @@ import com.raytheon.viz.core.gl.GLDisposalManager.GLDisposer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 13, 2007 chammack Initial Creation.
* Jan 9, 2013 2680 mschenke Changed size calculation to longs to
* avoid int overflow when using cache
* size > 1GB
*
* </pre>
*
@ -90,14 +93,15 @@ public class ImageCache extends LRUCache<Object, IImageCacheable> implements
public static ImageCache getInstance(CacheType type) {
if (type == CacheType.MEMORY) {
if (memoryCache == null) {
memoryCache = new ImageCache(1024 * 1024 * MEMORY_CACHE_SIZE);
memoryCache = new ImageCache(1024L * 1024L * MEMORY_CACHE_SIZE);
}
return memoryCache;
}
if (type == CacheType.TEXTURE) {
if (textureCache == null) {
textureCache = new ImageCache(1024 * 1024 * TEXTURE_CACHE_SIZE);
textureCache = new ImageCache(
1024L * 1024L * TEXTURE_CACHE_SIZE);
}
return textureCache;
}

View file

@ -32,7 +32,8 @@ import javax.media.opengl.GL;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 17, 2012 bsteffen Initial creation
* Feb 17, 2012 bsteffen Initial creation
* Jan 9, 2014 2680 mschenke Added default error message handling
*
* </pre>
*
@ -113,8 +114,11 @@ public class GLFrameBufferObject extends GLIdWrapper {
errorMessage = "Error: Framebuffer not supported by hardware/drivers";
break;
}
default: {
errorMessage = "Framebuffer is not complete, unknown reason";
break;
}
}
return errorMessage;
}
}

View file

@ -36,6 +36,8 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParameters;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.style.LabelingPreferences;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -91,6 +93,8 @@ public class TopoResource extends
protected TileSetRenderable topoTileSet;
private double noDataValue;
protected TopoResource(TopoResourceData topoData,
LoadProperties loadProperties, File dataFile) throws VizException {
super(topoData, loadProperties);
@ -189,12 +193,13 @@ public class TopoResource extends
}
SamplePreferences samplePrefs = prefs.getSamplePrefs();
if (samplePrefs != null && samplePrefs.getFormatString() != null) {
if ((samplePrefs != null)
&& (samplePrefs.getFormatString() != null)) {
params.setFormatString(samplePrefs.getFormatString());
}
LabelingPreferences labelPrefs = prefs.getColorbarLabeling();
if (labelPrefs != null && labelPrefs.getValues() != null) {
if ((labelPrefs != null) && (labelPrefs.getValues() != null)) {
params.setColorBarIntervals(labelPrefs.getValues());
}
}
@ -213,6 +218,16 @@ public class TopoResource extends
getCapability(ColorMapCapability.class).setColorMapParameters(params);
IDataStore dataStore = DataStoreFactory.getDataStore(this.dataFile);
try {
IDataRecord rec = dataStore.retrieve("/", "full",
Request.buildPointRequest(new java.awt.Point(0, 0)));
noDataValue = rec.getFillValue().doubleValue();
} catch (Exception e) {
statusHandler.error(e.getLocalizedMessage(), e);
noDataValue = Double.NaN;
}
topoTileSet = new TileSetRenderable(
getCapability(ImagingCapability.class), getTopoGeometry(),
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
@ -284,7 +299,7 @@ public class TopoResource extends
double height;
try {
// height = TopoQuery.getInstance().getHeight(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon(), noDataValue);
} catch (Exception e) {
throw new VizException("Error transforming", e);
}

View file

@ -1,5 +1,34 @@
#!/bin/sh
# 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.
#
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Feb 07, 2014 #2509 dgilling Fix baseline merge issue.
#
#
# get path to cave
path_to_script=`readlink -f $0`
RUN_FROM_DIR=`dirname $path_to_script`
@ -9,7 +38,7 @@ CAVE_DIR=/awips2/cave
# execute the runProcedure module
_GFECLI="${RUN_FROM_DIR}/gfeclient.sh"
_MODULE="${CAVE_DIR}/etc/gfe/utility/PngWriter.py"
_MODULE="${RUN_FROM_DIR}/src/ifpimage/PngWriter.py"
# quoting of '$@' is used to prevent command line interpretation
if [ ! -f $_GFECLI ] || [ ! -d $CAVE_DIR ]

View file

@ -59,6 +59,8 @@ import com.raytheon.viz.gfe.rsc.GFEResource;
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* 02/11/2014 #2788 randerso Fixed infinite loop in computeIntervalAndPrecision
* when pmax < pmin
*
* </pre>
*
@ -186,10 +188,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.font = colorbarResource.getColorbarScaleFont();
dstring.textStyle = TextStyle.NORMAL;
for (int i = 0; (minParm + i * interval) <= maxParm; i++) {
for (int i = 0; (minParm + (i * interval)) <= maxParm; i++) {
// check to see whether this colorTable item needs to be
// rendered
float labelValue = minParm + i * interval;
float labelValue = minParm + (i * interval);
// Check to see if value is same as previous unless float....
if ((tmpValue != (int) labelValue) || (precision > 0)) {
@ -197,7 +199,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue, precision);
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -219,10 +221,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue = labelValueObj.floatValue();
if (precision == 0) {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
} else {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
}
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -246,7 +248,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
float floatValue = ((ScalarWxValue) wxv).getValue();
if ((floatValue >= minParm) && (floatValue <= maxParm)) {
labelLoc = llx
+ ((floatValue - minParm) / (maxParm - minParm) * xExtent);
+ (((floatValue - minParm) / (maxParm - minParm)) * xExtent);
String s = wxv.toString();
dstring.font = colorbarResource.getPickupValueFont();
@ -261,12 +263,11 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.shadowColor = new RGB(0, 0, 0);
}
double halfWidth = target.getStringsBounds(dstring).getWidth()
* ratio / 2;
double halfWidth = (target.getStringsBounds(dstring).getWidth() * ratio) / 2;
if (labelLoc - halfWidth < pe.getMinX()) {
if ((labelLoc - halfWidth) < pe.getMinX()) {
labelLoc = pe.getMinX() + halfWidth;
} else if (labelLoc + halfWidth > pe.getMaxX()) {
} else if ((labelLoc + halfWidth) > pe.getMaxX()) {
labelLoc = pe.getMaxX() - halfWidth;
}
dstring.setCoordinates(labelLoc,
@ -298,7 +299,8 @@ public class ContinuousColorbar implements IColorBarDisplay {
// initial values are good if decade < parmExtent
// loop is infinite if parmExtent is NaN or 0, so avoid it
if (decade < parmExtent || Float.isNaN(parmExtent) || parmExtent == 0.0) {
if (Float.isNaN(parmExtent) || (parmExtent <= 0.0)
|| (decade < parmExtent)) {
return new float[] { finterval, precision, labelLength };
}
@ -438,7 +440,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
switch (parm.getGridInfo().getGridType()) {
case SCALAR:
return new ScalarWxValue(min + (max - min) * fractionX, parm);
return new ScalarWxValue(min + ((max - min) * fractionX), parm);
case VECTOR:
WxValue previous = parm.getParmState().getPickUpValue();
float mag = 0.0f;
@ -448,7 +450,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
dir = ((VectorWxValue) previous).getDir();
}
if (mouseButton == 1) {
mag = min + (max - min) * fractionX;
mag = min + ((max - min) * fractionX);
} else if (mouseButton == 2) {
dir = 360 * fractionX;
}

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.grid.rsc;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.exception.VizException;
@ -39,9 +42,11 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
*
* </pre>
*
@ -71,29 +76,36 @@ public class DataMappedGridResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
Double val = ((Float) map.get(INTERROGATE_VALUE)).doubleValue();
Double val = ((Number) map.get(INTERROGATE_VALUE)).doubleValue();
if (val.isNaN() || val <= -9999) {
return "No Data";
}
ColorMapParameters params = getCapability(ColorMapCapability.class)
.getColorMapParameters();
if (params != null) {
UnitConverter d2cm = params.getDisplayToColorMapConverter();
if (d2cm != null) {
val = d2cm.convert(val);
}
val = params.getDisplayToImageConverter().convert(val);
DataMappingPreferences dataMapping = params.getDataMapping();
if (dataMapping != null) {
for (DataMappingEntry entry : dataMapping.getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
}
}
}
for (DataMappingEntry entry : params.getDataMapping().getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
UnitConverter cm2d = params.getColorMapToDisplayConverter();
if (cm2d != null) {
val = cm2d.convert(val);
}
}
if (params != null && params.getImageToDisplayConverter() != null) {
val = params.getImageToDisplayConverter().convert(val);
}
return ((DataMappedGridResourceData) this.getResourceData())
.getSampleFormat().format(val) + map.get(INTERROGATE_UNIT);
}

View file

@ -39,9 +39,10 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
* </pre>
*
@ -71,7 +72,7 @@ public class RcmResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
float val = (Float) map.get(INTERROGATE_VALUE);
float val = ((Number) map.get(INTERROGATE_VALUE)).floatValue();
String sampleVal = "";
if (val < 1f) {
sampleVal = "No Data";

View file

@ -56,7 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* ------------- -------- ----------- -----------------------------------------
* Mar 09, 2011 bsteffen Initial creation
* Jul 17, 2013 2185 bsteffen Cache computed grid reprojections.
* Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by error
@ -64,6 +64,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 09, 2013 2617 bsteffen Added 180 degree rotation into reproject
* so wind direction is calculated as
* direction wind is coming from.
* Feb 03, 2013 2764 bsteffen Ensure that internal buffers are array
* backed heap buffers.
*
* </pre>
*
@ -152,15 +154,23 @@ public class GeneralGridData {
private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer scalarData, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
this.scalarData = scalarData;
this.dataUnit = dataUnit;
this(gridGeometry, scalarData, null, null, null, dataUnit);
}
private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer magnitude, FloatBuffer direction,
FloatBuffer uComponent, FloatBuffer vComponent, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
if (magnitude != null && !magnitude.hasArray()) {
/*
* TODO refactor dispaly code so it doesn't need array instead of
* copying data.
*/
FloatBuffer copy = FloatBuffer.allocate(magnitude.capacity());
magnitude.rewind();
copy.put(magnitude);
magnitude = copy;
}
this.scalarData = magnitude;
this.direction = direction;
this.uComponent = uComponent;

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.printing.PrinterData;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizApp;
/**
* Common class for handling printing of text.
@ -45,13 +46,14 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Text is printed using same font as the GUI
* Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing
* Sep 30, 2013 #2420 lvenable Fixed memory leak in the setFont method.
* Feb 12, 2014 #2773 lvenable Added code to provide a workaround to an Eclipse/SWT bug
* that occurs when disposing of the printer.
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class PrintDisplay {
public static void print(final String printedText, final FontData fontData,
IUFStatusHandler statusHandler) {
@ -108,19 +110,46 @@ public class PrintDisplay {
int end;
/**
* Constructor
*
* @param printer
* Printer object.
* @param text
* Text to print.
* @param fontData
* Font information.
*/
private PrintDisplay(Printer printer, String text, FontData fontData) {
this.printer = printer;
this.textToPrint = text;
this.printerFontData = fontData;
}
/**
* Print thread that will print the information to the printer.
*/
private void printJob() {
Thread thread = new Thread("Printing") {
public void run() {
printIt();
/** Dispose of the resources. */
printer.dispose();
/*
* Dispose of the printer resource. Running the dispose on the
* UI Thread should prevent the Eclipse/SWT bug from occurring.
*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=259371
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=276438
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265028
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265265
*/
VizApp.runAsync(new Runnable() {
@Override
public void run() {
printer.dispose();
}
});
if (tmpFont != null && tmpFont.isDisposed() == false) {
tmpFont.dispose();
@ -130,9 +159,12 @@ public class PrintDisplay {
thread.start();
}
protected void setFont() {
/**
* Set the font using the fontData.
*/
private void setFont() {
/*
* get the max number of characters in a line of text and add a length
* Get the max number of characters in a line of text and add a length
* of tab
*/
String[] textLines = textToPrint.split("[\n]");
@ -197,6 +229,9 @@ public class PrintDisplay {
gc.setFont(tmpFont);
}
/**
* Print to the printer.
*/
private void printIt() {
if (printer.startJob("Text")) { // the string is the job name - shows up
// in the printer's job list
@ -245,6 +280,9 @@ public class PrintDisplay {
}
}
/**
* Print the text.
*/
private void printText() {
printer.startPage();
wordBuffer = new StringBuilder();
@ -281,6 +319,9 @@ public class PrintDisplay {
}
}
/**
* Print the work buffer.
*/
private void printWordBuffer() {
if (wordBuffer.length() > 0) {
String word = wordBuffer.toString();
@ -295,6 +336,9 @@ public class PrintDisplay {
}
}
/**
* Start a new line for printing.
*/
private void newline() {
x = leftMargin;
y += lineHeight;

View file

@ -0,0 +1,29 @@
#!/bin/bash
# DR #2581 - This update script will add the dataURI column to the lsr table
# The column needs to be there for 14.2.1.
# Only run this if you have already run dropLSRdataURI.sh, otherwise
# don't run this script or that one.
PSQL="/awips2/psql/bin/psql"
# adds the datauri constraint and column
function addDataUriLSR {
echo "INFO: Adding DataURI column to lsr"
${PSQL} -U awips -d metadata -c "ALTER TABLE lsr DROP CONSTRAINT IF EXISTS lsr_latitude_longitude_stationId_reftime_forecasttime_eventtype;"
${PSQL} -U awips -d metadata -c "ALTER TABLE lsr ADD COLUMN datauri varchar(255);"
${PSQL} -U awips -d metadata -c "ALTER TABLE lsr ADD CONSTRAINT lsr_datauri_key UNIQUE (datauri);"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to repair dataURI for lsr"
echo "FATAL: The update has failed."
exit 1
fi
}
echo "INFO: Adding LSR dataURI column back in."
addDataUriLSR
echo "INFO: LSR dataURI column added successfully"

View file

@ -1,5 +1,8 @@
### EDEX localization related variables ###
export AW_SITE_IDENTIFIER=OAX
## Cluster id can be set to the cluster's id (example:tbw for dx1-tbwo)
## it will be autogenerated if not set
export CLUSTER_ID
# database names
export DC_DB_NAME=dc_ob7oax

View file

@ -164,6 +164,18 @@
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
</encoder>
</appender>
<!-- ohd log -->
<appender name="OhdLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${edex.home}/logs/edex-${edex.run.mode}-ohd-%d{yyyyMMdd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
</encoder>
</appender>
<appender name="ThreadBasedLog" class="com.raytheon.uf.common.status.logback.ThreadBasedAppender">
<threadPatterns>RadarLog:radarThreadPool.*;SatelliteLog:satelliteThreadPool.*;ShefLog:shefThreadPool.*;TextLog:textThreadPool.*;SmartInitLog:smartInit.*;PurgeLog:Purge.*;ArchiveLog:Archive.*</threadPatterns>
@ -300,6 +312,12 @@
<level value="ERROR"/>
<appender-ref ref="FailedTriggerLog"/>
</logger>
<logger name="com.raytheon.uf.edex.ohd" additivity="false">
<level value="INFO"/>
<appender-ref ref="OhdLog" />
<appender-ref ref="console" />
</logger>
<!-- default logging -->
<root>

View file

@ -28,4 +28,5 @@ export MGMT_PORT=9607
export METADATA_POOL_MIN=10
export METADATA_POOL_MAX=25
export METADATA_POOL_TIMEOUT=60
export METADATA_POOL_TIMEOUT=60
export CLUSTER_ID=NCF

View file

@ -0,0 +1,2 @@
com.raytheon.edex.subscription.data.ReplacementRecord
com.raytheon.edex.subscription.data.SubscriptionRecord

View file

@ -38,7 +38,7 @@
<camelContext id="gfe-camel-spring" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<route id="SPCWatch">
<from uri="vm:edex.spcWatch"/>
<from uri="vm:gfe.spcWatch"/>
<doTry>
<bean ref="spcWatch" method="handleSpcWatch"/>
<doCatch>
@ -50,7 +50,7 @@
</route>
<route id="TPCWatch">
<from uri="vm:edex.tpcWatch"/>
<from uri="vm:gfe.tpcWatch"/>
<doTry>
<bean ref="tpcWatch" method="handleTpcWatch"/>
<doCatch>
@ -63,7 +63,14 @@
<route id="WCLWatch">
<from uri="direct-vm:wclWatch"/>
<bean ref="wclWatch" method="handleWclWatch"/>
<doTry>
<bean ref="wclWatch" method="handleWclWatch"/>
<doCatch>
<exception>java.lang.Throwable</exception>
<to
uri="log:gfeWatch?level=ERROR"/>
</doCatch>
</doTry>
</route>
<route id="smartInitTrigger">

View file

@ -74,6 +74,7 @@ import com.raytheon.uf.common.topo.TopoQuery;
* Jun 13, 2013 #2044 randerso Refactored to use non-singleton GridParmManager,
* code cleanup
* Nov 20, 2013 #2331 randerso Changed return type of getTopoData
* Feb 11, 2014 #2788 randerso Set missing data points to 0 to match A1
*
* </pre>
*
@ -236,6 +237,8 @@ public class TopoDatabaseManager {
if (!allowValuesBelowZero && (heights[i] < 0)) {
heights[i] = 0.0f;
}
} else {
heights[i] = 0.0f;
}
}

View file

@ -33,8 +33,9 @@
# 08/09/2013 #1571 randerso Changed projections to use the Java
# ProjectionType enumeration
# 10/03/2013 #2418 dgilling Update for new pSurge 2.0 data.
# 10/03/2013 2424 randerso Change localTC to use dateutil instead of pytz
# 10/03/2013 #2424 randerso Change localTC to use dateutil instead of pytz
# to get correct offsets for Alaska
# 01/17/2014 #2719 randerso Added NHA domain
#
########################################################################
@ -628,12 +629,17 @@ NDFD_Oceanic_10K = ('NDFD_Oceanic_10km', MERCATOR,
(-230.094, -30.4192), (10.71, 80.01),
(0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1793), 0.0, -109.962, 0.0)
# Add a new domain for NHC purposes
GridForNHA = ('GridForNHA', LAMBERT_CONFORMAL,
(-102.551, 16.6069), (-50.5524, 47.3806),
(-95.0, 35.0), 35.0, 35.0, (1, 1), (1729,1601), 0.0, 0.0, 0.0)
# list of all projections
allProjections = [Grid201, Grid202, Grid203, Grid204, Grid205, Grid206,
Grid207, Grid208, Grid209, Grid210, Grid211, Grid212, Grid213, Grid214,
Grid214AK, Grid215, Grid216, Grid217, Grid218, Grid219, Grid221, Grid222,
Grid225, Grid226, Grid227, Grid228, Grid229, Grid230, Grid231, Grid232,
Grid233, Grid234, Grid235, HRAP, NDFD_Oceanic_10K]
Grid233, Grid234, Grid235, HRAP, NDFD_Oceanic_10K, GridForNHA]
#---------------------------------------------------------------------------
#
@ -838,6 +844,7 @@ SITES = {
#National Centers
'HAK' : ( [825,553], ( 1.0, 1.0), (103.0, 69.0), 'EST5EDT', Grid214AK, "nc"),
'HUS' : ([1073,689], (19.0, 8.0), ( 67.0, 43.0), 'EST5EDT', Grid211, "nc"),
'NHA' : ([1729,1601], (1.0,1.0), (1728.0, 1600.0), 'EST5EDT', GridForNHA, "nc"),
}
@ -1146,7 +1153,7 @@ elif SID in CONUS_EAST_SITES:
('HiResW-NMM-East', 'HIRESWnmm'),
('SPCGuide', 'SPC'),
('ECMWF-HiRes','ECMWFHiRes'),
('ENPWAVE253', 'ENPwave'),
('ENPWAVE253', 'ENPwave'),
]
else: #######DCS3501 WEST_CONUS
@ -1197,7 +1204,7 @@ else: #######DCS3501 WEST_CONUS
('HiResW-NMM-West', 'HIRESWnmm'),
('SPCGuide', 'SPC'),
('ECMWF-HiRes','ECMWFHiRes'),
('ENPWAVE253', 'ENPwave'),
('ENPWAVE253', 'ENPwave'),
]
if SID in GreatLake_SITES:
@ -1433,7 +1440,7 @@ else:
# "WCwave4" : ["WCwave4"],
# "WNAwave10" : ["WNAwave10"],
# "WNAwave4" : ["WNAwave4"],
# "ENPwave": ["ENPwave"],
# "ENPwave": ["ENPwave"],
}
#initialization skip certain model runs
@ -1875,7 +1882,7 @@ DATABASES = [(Official, OFFICIALDBS + localParms),
(RTMA, RTMAPARMS + localRTMAParms),
(NamDNG5, NamDNG5PARMS + localNamDNG5Parms),
(TPCProb, TPCProbPARMS + localTPCProbParms),
(ENPwave, ENPwave_parms + localENPwaveParms),
(ENPwave, ENPwave_parms + localENPwaveParms),
(Test, OFFICIALDBS + localParms)] + localDBs
# Intersite coordination database parameter groupings, based on
@ -1984,4 +1991,4 @@ def doIt():
IFPConfigServer.requestedISCparms = requestedISCparms
IFPConfigServer.transmitScript = transmitScript
doIt()
doIt()

View file

@ -105,8 +105,8 @@ THINNED_GRID_VALUES = THINNED_GRID_PT_MAP.values()
logHandler = UFStatusHandler.UFStatusHandler("com.raytheon.edex.plugin.grib", "EDEX")
#
# Python implementation of the grib decoder. This decoder uses the python ctypes
# library to access the NCEP grib decoder for extracting data
# Python implementation of the grib decoder. This decoder uses the grib2 module
# to access the NCEP grib decoder for extracting data
#
#
# SOFTWARE HISTORY
@ -121,6 +121,8 @@ logHandler = UFStatusHandler.UFStatusHandler("com.raytheon.edex.plugin.grib", "E
# UFStatusHandler.
# Sep 06, 2013 2402 bsteffen Switch to use file extents for multipart
# grib files.
# Feb 11, 2014 2765 bsteffen Better handling of probability parameters.
#
class GribDecoder():
##
@ -513,7 +515,6 @@ class GribDecoder():
#statisticalProcess = pdsTemplate[25]
elif pdsTemplateNumber == 5 or pdsTemplateNumber == 9:
gribDict['parameterUnit'] = "%"
probabilityNumber = pdsTemplate[15]
forecastProbabilities = pdsTemplate[16]
probabilityType = pdsTemplate[17]
@ -533,10 +534,13 @@ class GribDecoder():
scaledValue = None
if(probabilityType == 1 or probabilityType ==2):
scaledValue = self._convertScaledValue(scaledValueUL, scaleFactorUL)
gribDict['parameterName'] = "Prob of " + gribDict['parameterName'] + " > " + str(scaledValue) + gribDict['parameterUnit']
else:
scaledValue = self._convertScaledValue(scaledValueLL, scaleFactorLL)
parameterAbbreviation = parameterAbbreviation + str(scaledValue) + "m"
gribDict['parameterName'] = "Prob of " + gribDict['parameterName'] + " < " + str(scaledValue) + gribDict['parameterUnit']
parameterAbbreviation = parameterAbbreviation + str(scaledValue) + gribDict['parameterUnit']
gribDict['parameterUnit'] = "%"
elif pdsTemplateNumber == 8:
gribDict['endTime'] = self._convertToCalendar(pdsTemplate, 15)
@ -547,6 +551,7 @@ class GribDecoder():
elif pdsTemplateNumber == 10:
parameterAbbreviation = parameterAbbreviation + str(pdsTemplate[15]) + "pct"
gribDict['parameterName'] = str(pdsTemplate[15]) +"th percentile " + gribDict['parameterName']
gribDict['endTime'] = self._convertToCalendar(pdsTemplate, 16)
#numTimeRanges = pdsTemplate[22]

View file

@ -50,12 +50,12 @@ ThP_T170L42A-NCEP-MDL_1073x689_21600-0 ThP6hr
ThP_T170L42A-NCEP-MDL_1073x689_10800-0 ThP3hr
TP_254E3_T170L42A-NCEP-MDL_1649x1105_21600-0 POP6hr
TP_254E3_T170L42A-NCEP-MDL_1649x1105_43200-0 POP12hr
WS_17491E3 Prob34
WS_25722E3 Prob50
WS_32924E3 Prob64
PWS34_17491E3 PWS34
PWS50_25722E3 PWS50
PWS64_32924E3 PWS64
WS17.491m/s Prob34
WS25.722m/s Prob50
WS32.924m/s Prob64
PWS17.491m/s PWS34
PWS25.722m/s PWS50
PWS32.924m/s PWS64
MxT_ECMFMOD-1DEG-ECMF_10800-0 MxT3hr
MxT_ECMFMOD-1DEG-ECMF_21600-0 MxT6hr
MnT_ECMFMOD-1DEG-ECMF_10800-0 MnT3hr
@ -74,72 +74,72 @@ TPmean_43200-0 TP12mean
TPsprd_43200-0 TP12sprd
TPmean_86400-0 TP24mean
TPsprd_86400-0 TP24sprd
Vis_1609000E3 Visc1
Vis_4827000E3 Visc2
WS_12890E3 WSc1
WS_17500E3 WSc2
WS_25700E3 WSc3
WS_25780E3 WSc4
GH_152500E3 Cigc1
GH_305000E3 Cigc2
GH_914600E3 Cigc3
T_273000E3 Tc1
CAPE_500000E3 CAPEc1
CAPE_1000000E3 CAPEc2
CAPE_2000000E3 CAPEc3
CAPE_3000000E3 CAPEc4
CAPE_4000000E3 CAPEc5
CFRZR_1000E3 CFRZRc1
CICEP_1000E3 CICEPc1
CRAIN_1000E3 CRAINc1
CSNOW_1000E3 CSNOWc1
PLI_0E3 PLIxc1
PLI_-2000E3 PLIxc2
PLI_-4000E3 PLIxc3
PLI_-6000E3 PLIxc4
PLI_-8000E3 PLIxc5
TP_250E3_10800-0 tp3c1
TP_1270E3_10800-0 tp3c2
TP_2540E3_10800-0 tp3c3
TP_6350E3_10800-0 tp3c4
TP_12700E3_10800-0 tp3c5
TP_25400E3_10800-0 tp3c6
TP_38100E3_10800-0 tp3c7
TP_50800E3_10800-0 tp3c8
TP_250E3_21600-0 tp6c1
TP_1270E3_21600-0 tp6c2
TP_2540E3_21600-0 tp6c3
TP_6350E3_21600-0 tp6c4
TP_12700E3_21600-0 tp6c5
TP_25400E3_21600-0 tp6c6
TP_38100E3_21600-0 tp6c7
TP_50800E3_21600-0 tp6c8
TP_250E3_43200-0 tp12c1
TP_1270E3_43200-0 tp12c2
TP_2540E3_43200-0 tp12c3
TP_6350E3_43200-0 tp12c4
TP_12700E3_43200-0 tp12c5
TP_25400E3_43200-0 tp12c6
TP_38100E3_43200-0 tp12c7
TP_50800E3_43200-0 tp12c8
TP_250E3_86400-0 tp24c1
TP_1270E3_86400-0 tp24c2
TP_2540E3_86400-0 tp24c3
TP_6350E3_86400-0 tp24c4
TP_12700E3_86400-0 tp24c5
TP_25400E3_86400-0 tp24c6
TP_38100E3_86400-0 tp24c7
TP_50800E3_86400-0 tp24c8
SNOL_25400E3_43200-0 SNOL12c1
SNOL_50800E3_43200-0 SNOL12c2
SNOL_101600E3_43200-0 SNOL12c3
SNOL_152400E3_43200-0 SNOL12c4
SNOL_190500E3_43200-0 SNOL12c5
SNOL_203200E3_43200-0 SNOL12c6
SNOL_254000E3_43200-0 SNOL12c7
SNOL_304800E3_43200-0 SNOL12c8
SNOL_406400E3_43200-0 SNOL12c9
SNOL_609600E3_43200-0 SNOL12c10
Vis1609.0m Visc1
Vis4827.0m Visc2
WS12.89m/s WSc1
WS17.5m/s WSc2
WS25.7m/s WSc3
WS25.78m/s WSc4
GH152.5gpm Cigc1
GH305.0gpm Cigc2
GH914.6gpm Cigc3
T273.0K Tc1
CAPE500.0J/kg CAPEc1
CAPE1000.0J/kg CAPEc2
CAPE2000.0J/kg CAPEc3
CAPE3000.0J/kg CAPEc4
CAPE4000.0J/kg CAPEc5
CFRZR1.0 CFRZRc1
CICEP1.0 CICEPc1
CRAIN1.0 CRAINc1
CSNOW1.0 CSNOWc1
PLI0.0K PLIxc1
PLI-2.0K PLIxc2
PLI-4.0K PLIxc3
PLI-6.0K PLIxc4
PLI-8.0K PLIxc5
TP0.25mm_10800-0 tp3c1
TP1.27mm_10800-0 tp3c2
TP2.54mm_10800-0 tp3c3
TP6.35mm_10800-0 tp3c4
TP12.7mm_10800-0 tp3c5
TP25.4mm_10800-0 tp3c6
TP38.1mm_10800-0 tp3c7
TP50.8mm_10800-0 tp3c8
TP0.25mm_21600-0 tp6c1
TP1.27mm_21600-0 tp6c2
TP2.54mm_21600-0 tp6c3
TP6.35mm_21600-0 tp6c4
TP12.7mm_21600-0 tp6c5
TP25.4mm_21600-0 tp6c6
TP38.1mm_21600-0 tp6c7
TP50.8mm_21600-0 tp6c8
TP0.25mm_43200-0 tp12c1
TP1.27mm_43200-0 tp12c2
TP2.54mm_43200-0 tp12c3
TP6.35mm_43200-0 tp12c4
TP12.7mm_43200-0 tp12c5
TP25.4mm_43200-0 tp12c6
TP38.1mm_43200-0 tp12c7
TP50.8mm_43200-0 tp12c8
TP0.25mm_86400-0 tp24c1
TP1.27mm_86400-0 tp24c2
TP2.54mm_86400-0 tp24c3
TP6.35mm_86400-0 tp24c4
TP12.7mm_86400-0 tp24c5
TP25.4mm_86400-0 tp24c6
TP38.1mm_86400-0 tp24c7
TP50.8mm_86400-0 tp24c8
SNOL25.4mm_43200-0 SNOL12c1
SNOL508.0mm_43200-0 SNOL12c2
SNOL101.6mm_43200-0 SNOL12c3
SNOL152.4mm_43200-0 SNOL12c4
SNOL190.5mm_43200-0 SNOL12c5
SNOL203.2mm_43200-0 SNOL12c6
SNOL254.0mm_43200-0 SNOL12c7
SNOL304.8mm_43200-0 SNOL12c8
SNOL406.4mm_43200-0 SNOL12c9
SNOL609.6mm_43200-0 SNOL12c10
T_66E2_CPCMANU-NCEP-CPC_1073x689_604800-0 PTAM
T_33E2_CPCMANU-NCEP-CPC_1073x689_604800-0 PTBM
TP_66E2_CPCMANU-NCEP-CPC_1073x689_604800-0 PPAM

View file

@ -130,4 +130,11 @@ SREF243::SNOL12c3::Prob 12-hr SNOW > 4 in
SREF243::SNOL12c2::Prob 12-hr SNOW > 2 in
SREF243::SNOL12c5::Prob 12-hr SNOW > 7.5 in
SREF243::SNOL12c4::Prob 12-hr SNOW > 6 in
SREF243::SNOL12c1::Prob 12-hr SNOW > 1 in
SREF243::SNOL12c1::Prob 12-hr SNOW > 1 in
TPCWindProb::Prob34::Probability of Wind Speed > 34 knots
TPCWindProb::Prob50::Probability of Wind Speed > 50 knots
TPCWindProb::Prob64::Probability of Wind Speed > 64 knots
TPCWindProb::PWS34::Incremental Prob WS 34 kts or greater
TPCWindProb::PWS50::Incremental Prob WS 50 kts or greater
TPCWindProb::PWS64::Incremental Prob WS 64 kts or greater

View file

@ -111,9 +111,6 @@ diam | || | Feature Diameter
g2gsh | || | Gate to Gate Shear
wDiv | || | Divergence
ICEG | iceg || | Ice growth rate
Prob34 | prob34 || | Probability of Wind Speed > 34 knots
Prob50 | prob50 || | Probability of Wind Speed > 50 knots
Prob64 | prob64 || | Probability of Wind Speed > 64 knots
POP12hr | pop12hr || | Probability of 12hr precip
POP6hr | pop6hr || | Probability of 6hr precip
POP3hr | pop3hr || | Probability of 3hr precip
@ -265,9 +262,6 @@ TP_ECMWF |tp_ecmwf || | ECMWF Total Precipitation
TP_ECMWF12hr | || | ECMWF 12-hr Total Precipitation
TP120hr |tp120hr || | 120-hr Total Precipitation
PPFFG | ppffg || | Probability of excessive rain
PWS34 | pws34 || | Incremental Prob WS 34 kts or greater
PWS50 | pws50 || | Incremental Prob WS 50 kts or greater
PWS64 | pws64 || | Incremental Prob WS 64 kts or greater
SHerranl | sherranl || | RTMA Alaska specific humidity error analysis
Perranl | perranl || | RTMA Alaska pressure error analysis
TiltAng | || | Tilt angle of a radar PPI

View file

@ -32,8 +32,4 @@
30:30:Frictional velocity:m/s:FRICV
# 31-191 Reserved
# 192-254 Reserved for local use
# AWIPS override of the PWS parameters
198:198:Incremental Prob WS 34 kts or greater:%:PWS34
199:199:Incremental Prob WS 50 kts or greater:%:PWS50
200:200:Incremental Prob WS 50 kts or greater:%:PWS64
255:255:Missing

View file

@ -6,9 +6,9 @@
195:195:V-Component Storm Motion:m/s:VSTM
196:196:Drag Coefficient::CD
197:197:Frictional Velocity:m/s:FRICV
198:198:Incremental Prob WS 34 kts or greater:%:PWS34
199:199:Incremental Prob WS 50 kts or greater:%:PWS50
200:200:Incremental Prob WS 64 kts or greater:%:PWS64
198:198:Wind speed:m/s:PWS
199:199:Wind speed:m/s:PWS
200:200:Wind speed:m/s:PWS
201:201:Longitude of V Wind Component of Velocity:degrees:LOVV
202:202:Latitude of Presure Point:degrees:LAPP
203:203:Longitude of Presure Point:degrees:LOPP

View file

@ -1,6 +1,6 @@
# Product Discipline 10: Oceanographic products, Parameter Category 3: Surface Properties
#192-254 Reserved for local use
192:192:Surge 10% Exceedance Ht:m:Surge
192:192:Surge Height:m:Surge
193:193:Extra Tropical Storm Surge:m:ETSRG
194:194:Ocean Surface Elevation Relative to Geoid:m:ELEV
195:195:Sea Surface Height Relative to Geoid:m:SSHG
@ -11,13 +11,13 @@
200:200:Surface Salinity Trend:psu per day:SSST
201:201:Kinetic Energy:J/kg:KENG
202:202:Salt Flux:mm*s:SLTFL
242:242:Surge 20% Exceedance Ht:m:Surge
243:243:Surge 30% Exceedance Ht:m:Surge
244:244:Surge 40% Exceedance Ht:m:Surge
245:245:Surge 50% Exceedance Ht:m:Surge
246:246:Surge 60% Exceedance Ht:m:Surge
247:247:Surge 70% Exceedance Ht:m:Surge
248:248:Surge 80% Exceedance Ht:m:Surge
249:249:Surge 90% Exceedance Ht:m:Surge
242:242:Surge Height:m:Surge
243:243:Surge Height:m:Surge
244:244:Surge Height:m:Surge
245:245:Surge Height:m:Surge
246:246:Surge Height:m:Surge
247:247:Surge Height:m:Surge
248:248:Surge Height:m:Surge
249:249:Surge Height:m:Surge
250:250:Extra Tropical Storm Surge Combined Surge and Tide:m:ETCWL
255:255:Missing

View file

@ -6,7 +6,6 @@ Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Export-Package: com.raytheon.edex.plugin.shef,
com.raytheon.edex.plugin.shef.alarms,
com.raytheon.edex.plugin.shef.data,
com.raytheon.edex.plugin.shef.data.precip,
com.raytheon.edex.plugin.shef.database,

View file

@ -1,339 +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.edex.plugin.shef.alarms;
import java.io.File;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.text.request.WriteProductRequest;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.edex.core.EDEXUtil;
/**
* Provides SHEF with the ability to generate alert/alarms report products and
* write them to the text database.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* June 15, 2011 9377 jnjanga Initial creation
* July 12, 2013 15711 wkwock Fix verbose, observe mode, etc
*
*
* </pre>
*
* @author jnjanga
* @version 1.0
*/
public class AlertalarmStdTextProductUtil {
private static Log log = LogFactory
.getLog(AlertalarmStdTextProductUtil.class);
private static final Options cliOptions = createCmdLineOptions();
private static ReportWriter reportWriter = null;
private static ReportOptions reportOptions = null;
private static File currReport = null;
private static String reportDir = null;
/**
* this application main entry point
*
* @param args
*/
public static void main(String[] args) {
loadEnvironment();
setApplicationSpringContext(Constants.IHFS_CONFIG);
setReportOptions(args);
setCurrentReportfile();
reportAlarm();
System.exit(reportWriter.getAlarmCount());
}
/*
* create the org.apache.commons.cli.Options object
*/
private static Options createCmdLineOptions() {
CmdlineOptions options = new CmdlineOptions();
options.addMandatoryOption(CmdlineOptionId.DB_NAME);
options.addMandatoryOption(CmdlineOptionId.PRODUCT_ID);
options.addOption(CmdlineOptionId.REPORT_MODE);
options.addOption(CmdlineOptionId.MINUTES);
options.addOption(CmdlineOptionId.FILE_SUFFIX);
options.addOption(CmdlineOptionId.FLAGS);
options.addOption(CmdlineOptionId.PE);
options.addOption(CmdlineOptionId.VERBOSE,false);
return options;
}
/*
* initialize the ReportOptions object based on command line arguments
*/
private static void setReportOptions(String[] args) {
CommandLine line = null;
ReportOptions rptOptions = new ReportOptions();
// Check CmdLine arguments
if (args.length < 3) {
System.out.println("Invalid or missing arguments.");
printUsage();
System.exit(0);
}
// Process CmdLine Arguments
GnuParser parser = new GnuParser();
try {
line = parser.parse(cliOptions, args);
} catch (ParseException exp) {
System.err.println("Command line Parsing failed. Reason: "
+ exp.getMessage());
printUsage();
System.exit(0);
}
// duplicate options
if (hasDuplicateOptions(line)) {
System.err.println("Error : Duplicate command line options.");
printUsage();
System.exit(0);
}
// All user specified options, including mandatory ones
// are recognized , and there are no duplicate options.
// Query the CmdLine and build the report options object
for (CmdlineOptionId optId : CmdlineOptionId.values()) {
String optName = optId.toString();
System.out.println("optName = " + optName);
if (optName.equalsIgnoreCase("v")) {
if (line.hasOption(optName)) {
System.out.println(" optValue = true");
} else {
System.out.println(" optValue = false");
}
} else {
System.out.println(" optValue = " + line.getOptionValue(optName));
}
if (line.hasOption(optName)) {
CmdlineOption option = new CmdlineOption(optId,
line.getOptionValue(optName));
try {
rptOptions.addOption(option);
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
System.exit(0);
}
}
}
// The report options are all valid
Set<ReportMode> ignoreMin = new HashSet<ReportMode>();
ignoreMin.add(ReportMode.ALL);
ignoreMin.add(ReportMode.UNREPORTED);
ignoreMin.add(ReportMode.NEAREST);
ignoreMin.add(ReportMode.LATEST_MAXFCST);
if (rptOptions.isMinutesGiven()
&& ignoreMin.contains(rptOptions.getMode()))
System.out
.println("Usage : -m<minutes> value ignored for this -r<report_mode>");
reportOptions = rptOptions;
}
/*
* check whether user has entered duplicate options on the command line
*/
private static boolean hasDuplicateOptions(CommandLine line) {
Option[] userOptions = line.getOptions();
Set<String> unique = new HashSet<String>();
for (Option option : userOptions)
if (!unique.add(option.getOpt()))
return true;
return false;
}
/*
* Display a usage message
*/
private static void printUsage() {
System.out.print("Usage: report_alarm -d<dbase> -p<product_id> ");
System.out.print("[-r<report_mode>] [-m<minutes>] [-s<file_suffix>] ");
System.out.println("[-f<include_flags>] [-e<PE>] [-v<verbose>]");
}
/*
* process alertalarmval data. if there data meets alert/alarm conditions,
* report them in a text file and send it to the text database.
*/
private static void reportAlarm() {
Date now = new Date(System.currentTimeMillis());
// Get the whole data for the report
AlertalarmRecord aaRecord = RecordMgr.getAlarmData(reportOptions);
// write the report
reportWriter = new ReportWriter(currReport, reportOptions, now);
reportWriter.writeHeader();
reportWriter.writeBody(aaRecord);
if (reportOptions.getVerbose()) {
reportWriter.writeVerboseTrailer();
} else {
reportWriter.writeReportTrailer();
}
// save it to the text database if indeed
// there are alarm events to report.
int alarmCount = reportWriter.getAlarmCount();
if (alarmCount > 0) {
log.info(alarmCount + " alarms reported, report written to "
+ reportWriter.getFilename());
//saveReportTotextDb();
} else {
log.info("No alarms reported, info sent to "
+ reportWriter.getFilename());
log.info("File NOT sent to text database.");
}
}
/*
* saves the report contents to the text database.
*/
private static void saveReportTotextDb() {
setApplicationSpringContext(Constants.FXA_CONFIG);
WriteProductRequest request = new WriteProductRequest();
request.setProductId(reportOptions.getProductId());
request.setOperationalMode(true);
request.setNotifyAlarmAlert(true);
String rptData = reportWriter.getReportData();
request.setReportData(rptData);
log.info("Sending " + reportWriter.getFilename() + " to textdb as id "
+ request.getProductId());
TextDB textdb = new TextDB();
long result = textdb.writeProduct(request.getProductId(),
request.getReportData(), request.getOperationalMode(), null);
if (result != Long.MIN_VALUE) {
log.info("Product " + request.getProductId()
+ " successfully sent to textdb");
} else {
log.error("Error sending product " + request.getProductId()
+ " to textdb. status=" + result);
}
}
/*
* verify whether necessary application tokens have been defined.
*/
private static void loadEnvironment() {
System.setProperty("edex.home", System.getenv("EDEX_HOME"));
System.setProperty("db.addr", System.getenv("PGHOST"));
System.setProperty("ih.db.name", System.getenv("DB_NAME"));
System.setProperty("fxa.db.name", System.getenv("FXA_DB_NAME"));
System.setProperty("db.port", System.getenv("PGPORT"));
AppsDefaults appDefaults = AppsDefaults.getInstance();
String aalogDir = appDefaults.getToken(Constants.WHFS_UTIL_LOG_DIR);
if (aalogDir == null) {
System.out
.println("whfs_util_log_dir directory undefined. Aborting.");
}
reportDir = appDefaults.getToken(Constants.WHFS_PRODUCT_DIR);
if (reportDir == null) {
System.out
.println("whfs_product_dir directory undefined . Aborting.");
System.exit(0);
}
}
/*
* initializes a File object that points to the current alert/alarm report
*/
private static void setCurrentReportfile() {
String pid = reportOptions.getProductId();
String suffix = reportOptions.getFileSuffix();
if (suffix.length() > 0)
currReport = new File(reportDir + File.separator + pid + "." + suffix);
else
currReport = new File(reportDir + File.separator + pid);
try {
currReport.createNewFile();
} catch (Exception e) {
log.fatal("Could not create report file "
+ String.valueOf(currReport));
log.info("Exiting.");
System.exit(0);
}
}
private static void setApplicationSpringContext(String... configLocations) {
if (configLocations.length > 0) {
ClassPathXmlApplicationContext ctxt = new ClassPathXmlApplicationContext(
configLocations);
EDEXUtil edexUtil = new EDEXUtil();
edexUtil.setApplicationContext(ctxt);
} else {
log.fatal("Application spring config location not specified");
log.info("Exiting.");
System.exit(0);
}
}
}

View file

@ -1,106 +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.edex.plugin.shef.alarms;
/**
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* June 15, 2011 9377 jnjanga Initial creation
* July 12, 2013 15711 wkwock Fix verbose, observe mode, etc
*
* </pre>
*
* @author jnjanga
* @version 1.0
*/
public enum CmdlineOptionId {
DB_NAME("Database Name") {
public String toString() {
return "d";
}
},
PRODUCT_ID("Product Id") {
public String toString() {
return "p";
}
},
REPORT_MODE("Report mode") {
public String toString() {
return "r";
}
},
MINUTES("minutes") {
public String toString() {
return "m";
}
},
FILE_SUFFIX("File Suffix") {
public String toString() {
return "s";
}
},
FLAGS("Include Flags") {
public String toString() {
return "f";
}
},
PE("Physical Element") {
public String toString() {
return "e";
}
},
VERBOSE("Verbose") {
public String toString() {
return "v";
}
};
CmdlineOptionId(String desc) {
this.desc = desc;
}
public String description() {
return this.desc;
}
private String desc;
}

View file

@ -1,245 +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.edex.plugin.shef.alarms;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.ALARM_CATEGSTR;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.ALERT_CATEGSTR;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.DIFF_CHECKSTR;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.LOWER_CHECKSTR;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.ROC_CHECKSTR;
import static com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.UPPER_CHECKSTR;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
/**
* Reads Alertalarmval table and creates an organized record.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* June 15, 2011 9377 jnjanga Initial creation
* Sep 05, 2013 16549 wkwock Fix the query
*
*
* </pre>
*
* @author jnjanga
* @version 1.0
*/
class RecordMgr {
static final int MODE = 101;
static final int TYPE_SRC = 102;
static final int AA_CAT = 103;
static final int AA_CHCK = 104;
static final int PEFILTER = 105;
private static Log log = LogFactory
.getLog(RecordMgr.class);
private static ReportOptions options = null;
public static AlertalarmRecord getAlarmData(ReportOptions opt) {
options = opt;
StringBuilder query = new StringBuilder(
"select aav.lid, "
+ "aav.pe, aav.dur, "
+ "aav.ts, aav.extremum, "
+ "aav.probability, aav.validtime, aav.basistime, "
+ "aav.aa_categ, aav.aa_check, "
+ "aav.value, aav.suppl_value, "
+ "aav.shef_qual_code, aav.quality_code, aav.revision, "
+ "aav.product_id, aav.producttime, aav.postingtime, aav.action_time, "
+ "location.name from location, alertalarmval aav where location.lid = aav.lid");
// Build 'where' clause according to report mode
// if getting only unreported data, let the query filter out the
// reported data
query.append(whereSubClauseFor(MODE))
.append(whereSubClauseFor(TYPE_SRC))
.append(whereSubClauseFor(AA_CAT))
.append(whereSubClauseFor(AA_CHCK))
.append(whereSubClauseFor(PEFILTER))
.append(" AND (aav.ts NOT LIKE 'F%' OR aav.validtime >= current_timestamp) ")
.append(" ORDER BY aav.lid ASC, aav.pe, aav.ts, aav.aa_check, aav.validtime DESC ");
log.info("Query for getting alertalarmval data :" + query.toString());
Object[] aaData = null;
CoreDao dao = null;
AlertalarmRecord aaRecord = null;
// Get the data
try {
dao = new CoreDao(DaoConfig.forDatabase(opt.getDbname()));
aaData = dao.executeSQLQuery(query.toString());
if (aaData != null && aaData.length > 0) {
aaRecord = AlertalarmRecord.newInstance();
for (int i = 0; i < aaData.length; i++) {
Object[] aaRow = (Object[]) aaData[i];
aaRecord.put(aaRow);
}
}
} catch (Exception e) {
log.error("Query = [" + query + "]");
log.error(" - PostgresSQL error retrieving from alertalarmval ", e);
System.exit(0);
}
return aaRecord;
}
private static String whereSubClauseFor(int userSelection) {
switch (userSelection) {
case MODE:
return modeSubClause();
case TYPE_SRC:
return typeSrcSubClause();
case AA_CAT:
return aaCatSubClause();
case AA_CHCK:
return aaCheckSubClause();
case PEFILTER:
return peFilterSubClause();
default:
return null;
}
}
/**
* Adjust the query to any PE Filter
*
* @return
*/
private static String peFilterSubClause() {
String pe = options.getPEfilter();
return pe == null ? "" : " AND pe = " + pe;
}
private static String modeSubClause() {
if (options.getMode() == ReportMode.UNREPORTED)
return " AND action_time IS NULL ";
else
return " ";
}
private static String typeSrcSubClause() {
String flags = options.getFilter();
if(flags==null)
return " AND aav.ts like '%'";
if (flags.contains("O") && !flags.contains("F"))
return " AND (aav.ts like 'R%' or aav.ts like 'P%')";
else if (!flags.contains("O") && flags.contains("F"))
return " AND (aav.ts like 'F%' or aav.ts like 'C%')";
else
return " AND aav.ts like '%'";
}
/**
* append the where clause based on the alert/alarm category field
*
* @return
*/
private static String aaCatSubClause() {
String flags = options.getFilter();
if(flags == null)
return " ";
if (flags.contains("T") && !flags.contains("M"))
return " AND aav.aa_categ = " + ALERT_CATEGSTR;
else if (!flags.contains("T") && flags.contains("M"))
return " AND aav.aa_categ = " + ALARM_CATEGSTR;
else
return " ";
}
/**
* append the where clause based on the alert/alarm check field
*
* @return
*/
private static String aaCheckSubClause() {
String subClause = " AND aa_check in (";
String flags = options.getFilter();
if(flags == null)
return " ";
boolean rocFlag = flags.contains("R");
boolean lowFlag = flags.contains("L");
boolean upFlag = flags.contains("U");
boolean diffFlag = flags.contains("D");
if (!rocFlag && !lowFlag && !upFlag && !diffFlag)
return " ";
else {
boolean init = true;
char[] checks = { 'R', 'L', 'U', 'D' };
for (char c : checks) {
switch (c) {
case 'U':
if (upFlag)
subClause
.concat(aaCheckSubClause(init, UPPER_CHECKSTR));
break;
case 'L':
if (lowFlag)
subClause
.concat(aaCheckSubClause(init, LOWER_CHECKSTR));
break;
case 'R':
if (rocFlag)
subClause.concat(aaCheckSubClause(init, ROC_CHECKSTR));
break;
case 'D':
if (diffFlag)
subClause.concat(aaCheckSubClause(init, DIFF_CHECKSTR));
break;
default:
break;
}
}
}
return subClause.concat(" ) ");
}
private static String aaCheckSubClause(boolean initialEntry, String checkStr) {
if (initialEntry) {
initialEntry = !initialEntry;
return checkStr;
} else
return "," + checkStr;
}
}

View file

@ -1,267 +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.edex.plugin.shef.alarms;
import java.util.ArrayList;
import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants;
/**
* Place holder for user defined report options
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* June 15, 2011 9377 jnjanga Initial creation
* July 12, 2013 15711 wkwock Fix verbose, observe mode, etc
*
* </pre>
*
* @author jnjanga
* @version 1.0
*/
class ReportOptions {
private String dbname=null;
private String productId=null;
private ReportMode mode=null;
private String filter=null;
private String PEfilter=null;
private String fileSuffix=null;
private float min_val_diff=0;
private int minutes=0;
private boolean minGiven=false;
private boolean verboseFlag=false;
ReportOptions() {
}
public String getDbname() {
return dbname;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
int pidlength = productId.length();
if (pidlength != 9 && pidlength != 10) {
final String msg = "Invalid length for Product_Id : " + pidlength;
throw new IllegalArgumentException(msg);
}
this.productId = productId;
}
public void setDbname(String dbname) {
if(!dbname.equals( System.getProperty("ih.db.name"))) {
final String msg = "Invalid database name : " + dbname;
throw new IllegalArgumentException(msg);
}
this.dbname = ShefConstants.IHFS;
}
public int getMinutes() {
return minutes;
}
public void setMinutes(String minutes) throws IllegalArgumentException {
boolean invalid = false;
int argl = minutes.length();
int tmp = Integer.valueOf(minutes);
if (argl == 0 || argl > 6) {
invalid = true;
} else {
invalid = isWithinWindow(tmp);
}
if (invalid) {
final String msg = getWindowOptionUsage(tmp);
throw new IllegalArgumentException(msg);
}
this.minutes = tmp;
minGiven = true;
}
public boolean isMinutesGiven() {
return minGiven;
}
public ReportMode getMode() {
return mode;
}
public void setMode(String mode) throws IllegalArgumentException {
try {
this.mode = ReportMode.valueOf(mode);
} catch (Exception e) {
final String msg = "Invalid report mode : " + mode + Constants.EOL
+ "Report mode must be either : "
+ printValid(ReportMode.values());
throw new IllegalArgumentException(msg);
}
}
public String getFilter() {
return filter;
}
public void setFilter(String filter) throws IllegalArgumentException {
boolean invalid = false;
int fltrlen = filter.length();
if (fltrlen == 0 || fltrlen > 8)
invalid = true;
else
invalid = !tokensValid(filter);
if (invalid) {
final String msg = printFilterOptionUsage(filter);
throw new IllegalArgumentException(msg);
}
this.filter = filter;
}
public String getPEfilter() {
return PEfilter;
}
public void setPEfilter(String pEfilter) throws IllegalArgumentException {
if (pEfilter.length() != 2) {
final String msg = "PE filter option must be two characters";
throw new IllegalArgumentException(msg);
}
PEfilter = pEfilter;
}
public String getFileSuffix() {
return fileSuffix;
}
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public float getMin_val_diff() {
return min_val_diff;
}
public void setMin_val_diff(float min_val_diff) {
this.min_val_diff = min_val_diff;
}
public boolean getVerbose () {
return verboseFlag ;
}
public void setVerbose (boolean verboseFlg) {
verboseFlag = verboseFlg;
}
public void addOption(CmdlineOption option) throws IllegalArgumentException {
String arg = (String) option.getArg();
switch (option.getId()) {
case DB_NAME:
setDbname(arg);
break;
case PRODUCT_ID:
setProductId(arg);
break;
case REPORT_MODE:
setMode(arg);
break;
case FLAGS:
setFilter(arg);
break;
case PE:
setPEfilter(arg);
break;
case MINUTES:
setMinutes(arg);
break;
case FILE_SUFFIX:
setFileSuffix(arg);
break;
case VERBOSE:
setVerbose(true);
break;
default:
break;
}
}
public String toString() {
StringBuilder str = new StringBuilder();
str.append("Product_Id = " + productId + Constants.EOL);
str.append("Report_Mode = " + mode.toString() + Constants.EOL);
str.append("Filter = " + filter + Constants.EOL);
str.append("PE Filter = " + PEfilter + Constants.EOL);
str.append("File suffix = " + fileSuffix + Constants.EOL);
str.append("minutes = " + minutes + Constants.EOL);
return str.toString();
}
private static <E> String printValid(E[] array) {
StringBuilder str = new StringBuilder();
for (E element : array)
str.append(element.toString() + ", ");
str.delete(str.length() - 2, str.length());
return str.toString();
}
private boolean isWithinWindow(int min) {
return (min <= 0 || min > 999999);
}
private String getWindowOptionUsage(int min) {
return "Invalid number of minutes : " + min
+ " . Must be between 1 - 999999 ";
}
private String printFilterOptionUsage(String filter) {
return "Invalid length or token for filter option : " + filter + Constants.EOL
+ "Filter option must be either : "
+ printValid(FilterOption.values());
}
private boolean tokensValid(String filter) {
ArrayList<Character> validArgs = FilterOption.asList();
for (char c : filter.toCharArray())
if (!validArgs.contains(c))
return false;
return true;
}
}

View file

@ -104,6 +104,8 @@ import com.raytheon.uf.common.util.ByteArrayOutputStreamPool.ByteArrayOutputStre
* Mar 11, 2013 1786 mpduff Add https capability.
* Jun 12, 2013 2102 njensen Better error handling when using
* DynamicSerializeStreamHandler
* Feb 04, 2014 2704 njensen Better error message with bad address
* Https authentication failures notify handler
*
* </pre>
*
@ -400,7 +402,6 @@ public class HttpClient {
private HttpClient() {
}
private org.apache.http.client.HttpClient getHttpsInstance() {
return HttpsHolder.sslClient;
}
@ -539,6 +540,14 @@ public class HttpClient {
"Error retrying http request", e);
return resp;
}
if (resp.getStatusLine().getStatusCode() == 401) {
// obtained credentials and they failed!
if (handler != null) {
handler.credentialsFailed();
}
}
}
} else {
resp = getHttpInstance().execute(put);
@ -589,6 +598,10 @@ public class HttpClient {
try {
String host = put.getURI().getHost();
if (host == null) {
throw new InvalidURIException("Invalid URI: "
+ put.getURI().toString());
}
ongoing = currentRequestsCount.get(host);
if (ongoing == null) {
ongoing = new AtomicInteger();
@ -651,21 +664,21 @@ public class HttpClient {
// so we only want to error off here if we're using a
// DynamicSerializeStreamHandler because deserializing will fail
// badly
String exceptionMsg = "HTTP server returned error code: "
+ resp.getStatusLine().getStatusCode();
int statusCode = resp.getStatusLine().getStatusCode();
DefaultInternalStreamHandler errorHandler = new DefaultInternalStreamHandler();
String serverErrorMsg = null;
String exceptionMsg = null;
try {
errorHandler.handleStream(resp.getEntity().getContent());
serverErrorMsg = new String(errorHandler.byteResult);
exceptionMsg = new String(errorHandler.byteResult);
} catch (IOException e) {
statusHandler
.warn("Error reading the server's error message");
}
if (serverErrorMsg != null) {
exceptionMsg += "\n" + serverErrorMsg;
if (exceptionMsg == null) {
exceptionMsg = "HTTP server returned error code: "
+ statusCode;
}
throw new CommunicationException(exceptionMsg);
throw new HttpServerException(exceptionMsg, statusCode);
}
// should only be able to get here if we didn't encounter the
@ -720,7 +733,7 @@ public class HttpClient {
// if there was an error reading the input stream,
// notify but continue
statusHandler.handle(Priority.EVENTB,
"Error reading InputStream, assuming closed", e);
"Error reading InputStream, assuming closed");
}
try {
SafeGzipDecompressingEntity.close();
@ -1173,7 +1186,7 @@ public class HttpClient {
new AuthScope(host, port),
new UsernamePasswordCredentials(username, password));
}
/**
* @param httpsConfiguration
* the httpsConfiguration to set
@ -1188,5 +1201,5 @@ public class HttpClient {
public IHttpsConfiguration getHttpsConfiguration() {
return httpsConfiguration;
}
}

View file

@ -17,54 +17,55 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.shef.alarms;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
package com.raytheon.uf.common.comm;
/**
* Convenience wrapper around org.apache.commons.cli.Options
* A communication exception corresponding to an error returned from an http
* server and including the http status code.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* June 15, 2011 9377 jnjanga Initial creation
*
* Feb 6, 2014 njensen Initial creation
*
* </pre>
*
* @author jnjanga
* @author njensen
* @version 1.0
*/
public class CmdlineOptions extends Options {
public class HttpServerException extends CommunicationException {
private static final long serialVersionUID = 1L;
CmdlineOptions() {
private int statusCode;
public HttpServerException() {
super();
}
public void addOption(CmdlineOptionId optId) {
Option opt = new Option(optId.toString(), true, optId.description());
addOption(opt);
public HttpServerException(String message, Throwable cause) {
super(message, cause);
}
public void addOption(CmdlineOptionId optId, boolean hasArg) {
Option opt = new Option(optId.toString(), hasArg, optId.description());
addOption(opt);
public HttpServerException(String message) {
super(message);
}
public void addMandatoryOption(CmdlineOptionId optId) {
Option opt = new Option(optId.toString(), true, optId.description());
opt.setRequired(true);
addOption(opt);
public HttpServerException(Throwable cause) {
super(cause);
}
public boolean hasOption(CmdlineOptionId optId) {
return hasOption(optId.toString());
public HttpServerException(String message, int statusCode) {
super(message);
this.statusCode = statusCode;
}
}
public int getStatusCode() {
return statusCode;
}
}

View file

@ -28,7 +28,9 @@ package com.raytheon.uf.common.comm;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 4, 2013 1786 mpduff Initial creation
* Mar 04, 2013 1786 mpduff Initial creation
* Feb 10, 2014 2704 njensen Added credentialsFailed()
*
*
* </pre>
*
@ -48,4 +50,6 @@ public interface IHttpsCredentialsHandler {
* @return String Array, username and password
*/
String[] getCredentials(String authValue);
void credentialsFailed();
}

View file

@ -0,0 +1,60 @@
/**
* 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.comm;
/**
* A communication exception specific to an invalid URI, such as
* http//someAddress (instead of http://someAddress)
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 6, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class InvalidURIException extends CommunicationException {
private static final long serialVersionUID = 1L;
public InvalidURIException() {
super();
}
public InvalidURIException(String message, Throwable cause) {
super(message, cause);
}
public InvalidURIException(String message) {
super(message);
}
public InvalidURIException(Throwable cause) {
super(cause);
}
}

View file

@ -32,6 +32,7 @@ import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.StorageException;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.localization.IPathManager;
@ -49,10 +50,12 @@ import com.raytheon.uf.common.localization.IPathManager;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 03, 2013 bkowal Initial creation
* Jan 31, 2013 #1555 bkowal Made hdf5 variable generic
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 03, 2013 bkowal Initial creation
* Jan 31, 2013 1555 bkowal Made hdf5 variable generic
* Feb 06, 2014 2762 bsteffen Get geometry from IGridGeometryProvider.
*
*
* </pre>
*
@ -114,7 +117,15 @@ public final class PDOUtil {
* @return the grid geometry
*/
public static GridGeometry2D retrieveGeometry(PluginDataObject pdo) {
return MapUtil.getGridGeometry(((ISpatialEnabled) pdo)
if (pdo instanceof IGridGeometryProvider) {
return ((IGridGeometryProvider) pdo).getGridGeometry();
} else if (pdo instanceof ISpatialEnabled) {
return MapUtil.getGridGeometry(((ISpatialEnabled) pdo)
.getSpatialObject());
} else {
throw new IllegalArgumentException(
"Unable to extract a GridGeometry from an object of type: "
+ pdo.getClass().getSimpleName());
}
}
}

View file

@ -27,6 +27,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Dec 06, 2012 1397 djohnson Add GET_BANDWIDTH_GRAPH_DATA.
* Jul 18, 2013 1653 mpduff Add GET_SUBSCRIPTION_STATUS.
* Oct 2 2013 1797 dhladky generic attempt
* Feb 11, 2014 2771 bgonzale Added GET_DATADELIVERY_ID to RequestTypes.
*
* </pre>
*
@ -43,7 +44,11 @@ public class IBandwidthRequest<T extends Time, C extends Coverage> extends Abstr
/**
* Schedule a subscription.
*/
SCHEDULE_SUBSCRIPTION, SHOW_BUCKET, SHOW_DEFERRED, GET_BANDWIDTH, FORCE_SET_BANDWIDTH, PROPOSE_SET_BANDWIDTH, PROPOSE_SCHEDULE_SUBSCRIPTION, REINITIALIZE, GET_ESTIMATED_COMPLETION, GET_BANDWIDTH_GRAPH_DATA, GET_SUBSCRIPTION_STATUS
SCHEDULE_SUBSCRIPTION, SHOW_BUCKET, SHOW_DEFERRED, GET_BANDWIDTH, FORCE_SET_BANDWIDTH, PROPOSE_SET_BANDWIDTH, PROPOSE_SCHEDULE_SUBSCRIPTION, REINITIALIZE,
/**
* Request information.
*/
GET_ESTIMATED_COMPLETION, GET_BANDWIDTH_GRAPH_DATA, GET_SUBSCRIPTION_STATUS, GET_DATADELIVERY_ID
}
@DynamicSerializeElement

View file

@ -159,4 +159,5 @@ public interface IBandwidthService<T extends Time, C extends Coverage> {
*/
SubscriptionStatusSummary getSubscriptionStatusSummary(
Subscription<T, C> subscription);
}

View file

@ -15,6 +15,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.geotools.geometry.jts.ReferencedEnvelope;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.serialization.adapters.ReferencedEnvelopeAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -36,6 +37,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Jan 02, 2013 1441 djohnson Add constants.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 22, 2013 1650 djohnson Remove option instance variable.
* Feb 4, 2014 2686 dhladky This one got missed previously.
*
* </pre>
*
@ -46,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@RegistryObject({ GroupDefinition.GROUP_NAME_SLOT })
@RegistryObjectVersion(value = 1.0f)
public class GroupDefinition {
public static final String GROUP_NAME_SLOT = "groupName";

View file

@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -43,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sept 30, 2013 1797 dhladky Generics
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
* Feb 18, 2013 2786 dhladky Forgot this one in version changes.
*
* </pre>
*
@ -57,6 +59,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT,
Subscription.ORIGINATING_SITE_SLOT, Subscription.SUBSCRIPTION_TYPE_SLOT })
@RegistryObjectVersion(value = 1.0f)
public class InitialPendingSharedSubscription<T extends Time, C extends Coverage>
extends SharedSubscription<T, C> implements
InitialPendingSubscription<T, C> {

View file

@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -47,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Sept 30, 2013 1797 dhladky Some Generics
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
* Feb 18, 2013 2786 dhladky Forgot this one in version changes.
*
* </pre>
*
@ -61,6 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT,
Subscription.ORIGINATING_SITE_SLOT, Subscription.SUBSCRIPTION_TYPE_SLOT })
@RegistryObjectVersion(value = 1.0f)
public class InitialPendingSiteSubscription<T extends Time, C extends Coverage>
extends SiteSubscription<T, C> implements
InitialPendingSubscription<T, C> {

View file

@ -1,19 +1,19 @@
/**
* 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.
**/
@ -65,9 +65,11 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
* Jan 08, 2014 2615 bgonzale Implement calculate start and calculate end methods.
* Jan 14, 2014 2459 mpduff Add subscription state.
* Jan 20, 2013 2398 dhladky Fixed rescheduling beyond active period/expired window.
* Jan 24, 2013 2709 bgonzale Fix setting of active period end. Change active period checks
* Jan 20, 2014 2398 dhladky Fixed rescheduling beyond active period/expired window.
* Jan 24, 2014 2709 bgonzale Fix setting of active period end. Change active period checks
* to check day of year. removed now unused active period methods.
* Jan 28, 2014 2636 mpduff Changed to use GMT calendar.
* Feb 12, 2014 2636 mpduff Return new instance of calculated start and end.
*
* </pre>
*
@ -472,15 +474,15 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
private Integer getStartActivePeriodDayOfYear() {
if (startActivePeriodDayOfYear == null && activePeriodStart != null) {
startActivePeriodDayOfYear = TimeUtil
.newCalendar(activePeriodStart).get(Calendar.DAY_OF_YEAR);
startActivePeriodDayOfYear = TimeUtil.newGmtCalendar(
activePeriodStart).get(Calendar.DAY_OF_YEAR);
}
return startActivePeriodDayOfYear;
}
private Integer getEndActivePeriodDayOfYear() {
if (endActivePeriodDayOfYear == null && activePeriodEnd != null) {
endActivePeriodDayOfYear = TimeUtil.newCalendar(activePeriodEnd)
endActivePeriodDayOfYear = TimeUtil.newGmtCalendar(activePeriodEnd)
.get(Calendar.DAY_OF_YEAR);
}
return endActivePeriodDayOfYear;
@ -488,14 +490,34 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
@Override
public Calendar calculateStart(Calendar startConstraint) {
return TimeUtil.newCalendar(TimeUtil.max(subscriptionStart,
startConstraint));
if (subscriptionStart == null) {
return startConstraint;
}
long subStartMillis = subscriptionStart.getTime();
long constaintMillis = startConstraint.getTimeInMillis();
if (subStartMillis > constaintMillis) {
return TimeUtil.newGmtCalendar(subscriptionStart);
}
return TimeUtil.newGmtCalendar(startConstraint.getTime());
}
@Override
public Calendar calculateEnd(Calendar endConstraint) {
return TimeUtil.newCalendar(TimeUtil
.min(subscriptionEnd, endConstraint));
if (subscriptionEnd == null) {
return endConstraint;
}
long subEndMillis = subscriptionEnd.getTime();
long constaintMillis = endConstraint.getTimeInMillis();
if (subEndMillis < constaintMillis) {
return TimeUtil.newGmtCalendar(subscriptionEnd);
}
return TimeUtil.newGmtCalendar(endConstraint.getTime());
}
/**
@ -891,9 +913,10 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
return expired;
}
/**
* Check for expiration on date
*
* @param date
* @return
*/
@ -941,9 +964,10 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
return subscriptionState == SubscriptionState.ON
&& !checkAndSetExpiration();
}
/**
* Should this be scheduled for this time.
*
* @param checkDate
* @return
*/
@ -951,10 +975,11 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
if (!isExpired(checkCal.getTime()) && inActivePeriodWindow(checkCal)) {
return true;
}
return false;
}
@Override
public boolean inActivePeriodWindow(Calendar checkDate) {
if (activePeriodStart == null && activePeriodEnd == null) {
// no active period set
@ -967,7 +992,7 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
boolean isAfterPeriodStart = startDay <= checkDay;
boolean isBeforePeriodEnd = checkDay < endDay;
boolean periodCrossesYearBoundary = endDay < startDay;
if (periodCrossesYearBoundary) {
return isAfterPeriodStart || isBeforePeriodEnd;
} else {
@ -1048,6 +1073,7 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
/**
* @return the subscriptionState
*/
@Override
public SubscriptionState getSubscriptionState() {
return subscriptionState;
}
@ -1056,6 +1082,7 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
* @param subscriptionState
* the subscriptionState to set
*/
@Override
public void setSubscriptionState(SubscriptionState subscriptionState) {
this.subscriptionState = subscriptionState;
}
@ -1084,4 +1111,4 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
public boolean shouldUpdate() {
return shouldUpdate;
}
}
}

View file

@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
/**
* Definition of a subscription.
*
@ -47,6 +48,7 @@ import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
* Jan 08, 2014 2615 bgonzale Added calculate start and calculate end methods.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 24, 2013 2709 bgonzale Added method inActivePeriodWindow.
* Feb 05, 2014 2677 mpduff Add subscription state getter/setter.
*
* </pre>
*
@ -704,4 +706,19 @@ public interface Subscription<T extends Time, C extends Coverage> {
* Deactivate the subscription
*/
void deactivate();
/**
* Set the subscription's state
*
* @param state
* The state to set
*/
void setSubscriptionState(SubscriptionState state);
/**
* Get the subscription's state
*
* @return This subscrition's state
*/
SubscriptionState getSubscriptionState();
}

View file

@ -22,8 +22,10 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -60,6 +62,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Jan 14, 2014 2459 mpduff Validate subs should be scheduled before returning them.
* Jan 17, 2014 2459 mpduff Persist the state of the expired subs.
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -198,14 +201,14 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
@Override
public List<T> getActiveForRoute(Network route)
throws RegistryHandlerException {
return getActiveForRoutes(route);
return getActiveForRoutes(route).get(route);
}
/**
* {@inheritDoc}
*/
@Override
public List<T> getActiveForRoutes(Network... routes)
public Map<Network, List<T>> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
SubscriptionFilterableQuery<T> query = getQuery();
query.setActive(true);
@ -215,10 +218,13 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
checkResponse(response, "getActiveForRoutes");
List<T> returnList = new ArrayList<T>();
Map<Network, List<T>> returnMap = new HashMap<Network, List<T>>();
for (Network network : routes) {
returnMap.put(network, new ArrayList<T>());
}
for (T sub : response.getResults()) {
if (((RecurringSubscription) sub).shouldSchedule()) {
returnList.add(sub);
returnMap.get(sub.getRoute()).add(sub);
} else if (((RecurringSubscription) sub).shouldUpdate()) {
updateList.add(sub);
}
@ -250,6 +256,6 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
});
}
return returnList;
return returnMap;
}
}

View file

@ -20,7 +20,9 @@
package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
@ -37,6 +39,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 20, 2014 2538 mpduff Initial creation
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -102,10 +105,10 @@ public class EmptyAdhocSubscriptionHandler implements IAdhocSubscriptionHandler
}
@Override
public List<AdhocSubscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
// TODO Auto-generated method stub
return null;
public Map<Network, List<AdhocSubscription>> getActiveForRoutes(
Network... routes) throws RegistryHandlerException {
// an empty map
return new HashMap<Network, List<AdhocSubscription>>(0);
}
@Override

View file

@ -21,7 +21,9 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.Network;
@ -40,7 +42,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 4, 2013 2545 bgonzale Initial creation
* Nov 04, 2013 2545 bgonzale Initial creation
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -51,8 +54,13 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
public class EmptySharedSubscriptionHandler implements
ISharedSubscriptionHandler {
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscription(com.raytheon.uf.common.datadelivery.registry.PendingSubscription)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler
* #getByPendingSubscription(com.raytheon.uf.common.datadelivery
* .registry.PendingSubscription)
*/
@Override
public SharedSubscription getByPendingSubscription(
@ -60,8 +68,11 @@ public class EmptySharedSubscriptionHandler implements
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String)
*/
@Override
public SharedSubscription getByPendingSubscriptionId(String id)
@ -69,8 +80,12 @@ public class EmptySharedSubscriptionHandler implements
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String,
* java.lang.String)
*/
@Override
public List<SharedSubscription> getActiveByDataSetAndProvider(
@ -79,8 +94,11 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByName(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByName(java.lang.String)
*/
@Override
public SharedSubscription getByName(String name)
@ -88,8 +106,11 @@ public class EmptySharedSubscriptionHandler implements
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByNames(java.util.Collection)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByNames(java.util.Collection)
*/
@Override
public List<SharedSubscription> getByNames(Collection<String> names)
@ -97,8 +118,11 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByOwner(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByOwner(java.lang.String)
*/
@Override
public List<SharedSubscription> getByOwner(String owner)
@ -106,8 +130,11 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByGroupName(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByGroupName(java.lang.String)
*/
@Override
public List<SharedSubscription> getByGroupName(String group)
@ -115,8 +142,11 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String)
*/
@Override
public List<SharedSubscription> getByFilters(String group, String officeId)
@ -124,8 +154,11 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String)
*/
@Override
public Set<String> getSubscribedToDataSetNames(String siteId)
@ -133,16 +166,23 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_SET;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActive()
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getActive()
*/
@Override
public List<SharedSubscription> getActive() throws RegistryHandlerException {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler
* #getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network)
*/
@Override
public List<SharedSubscription> getActiveForRoute(Network route)
@ -150,17 +190,26 @@ public class EmptySharedSubscriptionHandler implements
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoutes(com.raytheon.uf.common.datadelivery.registry.Network[])
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler
* #getActiveForRoutes(com.raytheon.uf.common.datadelivery
* .registry.Network[])
*/
@Override
public List<SharedSubscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
return Collections.EMPTY_LIST;
public Map<Network, List<SharedSubscription>> getActiveForRoutes(
Network... routes) throws RegistryHandlerException {
return new HashMap<Network, List<SharedSubscription>>(0);
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById(java.lang.String)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById
* (java.lang.String)
*/
@Override
public SharedSubscription getById(String id)
@ -168,69 +217,104 @@ public class EmptySharedSubscriptionHandler implements
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll()
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll()
*/
@Override
public List<SharedSubscription> getAll() throws RegistryHandlerException {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(
* java.lang.Object)
*/
@Override
public void store(SharedSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update
* (java.lang.Object)
*/
@Override
public void update(SharedSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.Object)
*/
@Override
public void delete(SharedSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById
* (java.lang.String, java.lang.String)
*/
@Override
public void deleteById(String username, String registryId)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds(java.lang.String, java.util.List)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds
* (java.lang.String, java.util.List)
*/
@Override
public void deleteByIds(String username, List<String> registryIds)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.String, java.lang.Object)
*/
@Override
public void delete(String username, SharedSubscription obj)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.util.Collection)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.util.Collection)
*/
@Override
public void delete(Collection<SharedSubscription> objects)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.util.Collection)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.String, java.util.Collection)
*/
@Override
public void delete(String username, Collection<SharedSubscription> objects)

View file

@ -21,7 +21,9 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.Network;
@ -40,7 +42,8 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 4, 2013 2545 bgonzale Initial creation
* Nov 04, 2013 2545 bgonzale Initial creation
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -50,8 +53,13 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscription(com.raytheon.uf.common.datadelivery.registry.PendingSubscription)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler
* #getByPendingSubscription(com.raytheon.uf.common.datadelivery
* .registry.PendingSubscription)
*/
@Override
public SiteSubscription getByPendingSubscription(PendingSubscription pending)
@ -59,8 +67,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String)
*/
@Override
public SiteSubscription getByPendingSubscriptionId(String id)
@ -68,8 +79,12 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String,
* java.lang.String)
*/
@Override
public List<SiteSubscription> getActiveByDataSetAndProvider(
@ -78,8 +93,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByName(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByName(java.lang.String)
*/
@Override
public SiteSubscription getByName(String name)
@ -87,8 +105,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByNames(java.util.Collection)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByNames(java.util.Collection)
*/
@Override
public List<SiteSubscription> getByNames(Collection<String> names)
@ -96,8 +117,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByOwner(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByOwner(java.lang.String)
*/
@Override
public List<SiteSubscription> getByOwner(String owner)
@ -105,8 +129,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByGroupName(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByGroupName(java.lang.String)
*/
@Override
public List<SiteSubscription> getByGroupName(String group)
@ -114,8 +141,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String)
*/
@Override
public List<SiteSubscription> getByFilters(String group, String officeId)
@ -123,8 +153,11 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String)
*/
@Override
public Set<String> getSubscribedToDataSetNames(String siteId)
@ -132,16 +165,23 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_SET;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActive()
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler#getActive()
*/
@Override
public List<SiteSubscription> getActive() throws RegistryHandlerException {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network)
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler
* #getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network)
*/
@Override
public List<SiteSubscription> getActiveForRoute(Network route)
@ -149,86 +189,130 @@ public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoutes(com.raytheon.uf.common.datadelivery.registry.Network[])
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datadelivery.registry.handlers.
* IBaseSubscriptionHandler
* #getActiveForRoutes(com.raytheon.uf.common.datadelivery
* .registry.Network[])
*/
@Override
public List<SiteSubscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
return Collections.EMPTY_LIST;
public Map<Network, List<SiteSubscription>> getActiveForRoutes(
Network... routes) throws RegistryHandlerException {
return new HashMap<Network, List<SiteSubscription>>(0);
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById(java.lang.String)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById
* (java.lang.String)
*/
@Override
public SiteSubscription getById(String id) throws RegistryHandlerException {
return null;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll()
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll()
*/
@Override
public List<SiteSubscription> getAll() throws RegistryHandlerException {
return Collections.EMPTY_LIST;
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(
* java.lang.Object)
*/
@Override
public void store(SiteSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update
* (java.lang.Object)
*/
@Override
public void update(SiteSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.Object)
*/
@Override
public void delete(SiteSubscription obj) throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById(java.lang.String, java.lang.String)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById
* (java.lang.String, java.lang.String)
*/
@Override
public void deleteById(String username, String registryId)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds(java.lang.String, java.util.List)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds
* (java.lang.String, java.util.List)
*/
@Override
public void deleteByIds(String username, List<String> registryIds)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.lang.Object)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.String, java.lang.Object)
*/
@Override
public void delete(String username, SiteSubscription obj)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.util.Collection)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.util.Collection)
*/
@Override
public void delete(Collection<SiteSubscription> objects)
throws RegistryHandlerException {
}
/* (non-Javadoc)
* @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.util.Collection)
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete
* (java.lang.String, java.util.Collection)
*/
@Override
public void delete(String username, Collection<SiteSubscription> objects)

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.Network;
@ -44,6 +45,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Feb 20, 2013 1543 djohnson Add ability to filter on routes.
* May 28, 2013 1650 djohnson Add getByNames.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -151,6 +153,6 @@ public interface IBaseSubscriptionHandler<T extends Subscription> extends
* @throws RegistryHandlerException
* on error
*/
List<T> getActiveForRoutes(Network... routes)
Map<Network, List<T>> getActiveForRoutes(Network... routes)
throws RegistryHandlerException;
}

View file

@ -22,8 +22,10 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Lists;
@ -54,6 +56,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* May 28, 2013 1650 djohnson Add getByNames.
* May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -186,12 +189,36 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler {
* {@inheritDoc}
*/
@Override
public List<InitialPendingSubscription> getActiveForRoutes(
public Map<Network, List<InitialPendingSubscription>> getActiveForRoutes(
Network... routes) throws RegistryHandlerException {
List<InitialPendingSubscription> subs = Lists.newArrayList();
subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes));
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
return subs;
Map<Network, List<InitialPendingSubscription>> returnMap = new HashMap<Network, List<InitialPendingSubscription>>(
2);
Map<Network, List<InitialPendingSiteSubscription>> subMap = siteSubscriptionHandler
.getActiveForRoutes(routes);
returnMap
.putAll((Map<? extends Network, ? extends List<InitialPendingSubscription>>) subMap);
Map<Network, List<InitialPendingSharedSubscription>> sharedSubMap = sharedSubscriptionHandler
.getActiveForRoutes(routes);
// Check for existing networks and add to them if they exist
for (Map.Entry<Network, List<InitialPendingSharedSubscription>> entry : sharedSubMap
.entrySet()) {
Network key = entry.getKey();
if (returnMap.containsKey(key)) {
returnMap.get(key).addAll(entry.getValue());
} else {
List<InitialPendingSharedSubscription> sharedList = entry
.getValue();
returnMap.put(key, new ArrayList<InitialPendingSubscription>(
sharedList.size()));
returnMap.get(key).addAll(sharedList);
}
}
return returnMap;
}
/**

View file

@ -19,9 +19,12 @@
**/
package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Lists;
@ -59,6 +62,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
* May 31, 2013 1650 djohnson Fix ability to get shared subscriptions by id.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Jan 20, 2014 2538 mpduff Added AdhocSubscriptionHandler.
* Jan 29, 2014 2636 mpduff Scheduling refactor.
*
* </pre>
*
@ -250,12 +254,32 @@ public class SubscriptionHandler implements ISubscriptionHandler {
* {@inheritDoc}
*/
@Override
public List<Subscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
List<Subscription> subs = Lists.newArrayList();
subs.addAll(siteSubscriptionHandler.getActiveForRoutes(routes));
subs.addAll(sharedSubscriptionHandler.getActiveForRoutes(routes));
return subs;
public Map<Network, List<Subscription>> getActiveForRoutes(
Network... routes) throws RegistryHandlerException {
Map<Network, List<Subscription>> returnMap = new HashMap<Network, List<Subscription>>();
Map<Network, List<SiteSubscription>> subMap = siteSubscriptionHandler
.getActiveForRoutes(routes);
returnMap
.putAll((Map<? extends Network, ? extends List<Subscription>>) subMap);
Map<Network, List<SharedSubscription>> sharedSubMap = sharedSubscriptionHandler
.getActiveForRoutes(routes);
// Check for existing networks and add to them if they exist
for (Map.Entry<Network, List<SharedSubscription>> entry : sharedSubMap
.entrySet()) {
Network key = entry.getKey();
if (returnMap.containsKey(key)) {
returnMap.get(key).addAll(entry.getValue());
} else {
List<SharedSubscription> sharedList = entry.getValue();
returnMap.put(key,
new ArrayList<Subscription>(sharedList.size()));
returnMap.get(key).addAll(sharedList);
}
}
return returnMap;
}
/**

View file

@ -37,6 +37,7 @@ import java.util.Map;
* Jan 03, 2014 2581 njensen Added coastal flood
* Jan 13, 2014 2581 njensen Added debris flow
* Jan 17, 2014 2581 njensen Added blowing snow
* Jan 30, 2014 2581 njensen Added rain
*
* </pre>
*
@ -89,7 +90,8 @@ public enum LSREventType {
FREEZINGDRIZZLE("FREEZING DRIZZLE", 40, LSRUnits.NOUNITS),
COASTALFLOOD("COASTAL FLOOD", 41, LSRUnits.NOUNITS),
DEBRISFLOW("DEBRIS FLOW", 42, LSRUnits.NOUNITS),
BLOWINGSNOW("BLOWING SNOW", 43, LSRUnits.NOUNITS);
BLOWINGSNOW("BLOWING SNOW", 43, LSRUnits.NOUNITS),
RAIN("RAIN", 44, LSRUnits.NOUNITS);
// TODO contemplate storing the event type as a string in the database instead of an enum/integer

View file

@ -30,6 +30,8 @@ import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -70,6 +72,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Oct 14, 2013 2361 njensen Removed XML annotations and IDecoderGettable
* Dec 10, 2013 2581 njensen Removed dataURI column
* Jan 15, 2014 2581 njensen Changed constraint to use officeId instead of stationId
* Jan 30, 2014 2581 njensen Added dataURI column back in
*
* </pre>
*
@ -79,8 +82,8 @@ import com.vividsolutions.jts.geom.Geometry;
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "lsrseq")
@Table(name = "lsr", uniqueConstraints = { @UniqueConstraint(columnNames = {
"latitude", "longitude", "officeId", "refTime", "forecastTime",
"eventType" }) })
// "latitude", "longitude", "officeId", "refTime", "forecastTime", "eventType"
"dataURI" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -509,4 +512,11 @@ public class LocalStormReport extends PersistablePluginDataObject implements
public String getPluginName() {
return "lsr";
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

Some files were not shown because too many files have changed in this diff Show more