Merge branch '13.2.1_delivery' into development

Former-commit-id: 11b9bfc187 [formerly 11b9bfc187 [formerly 920b282de84def082dac82832d80e67f7bff2b19]]
Former-commit-id: 1af055a04b
Former-commit-id: 29b9077291
This commit is contained in:
Steve Harris 2013-01-22 16:45:48 -06:00
commit b03d5ce450
78 changed files with 1227 additions and 542 deletions

View file

@ -99,6 +99,13 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.datadelivery.service"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.stats"
download-size="0"

View file

@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0",
com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.bandwidth;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.retrieval;bundle-version="1.0.0"
com.raytheon.uf.common.datadelivery.retrieval;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework",

View file

@ -8,11 +8,14 @@
class="com.raytheon.uf.common.datadelivery.bandwidth.BandwidthService" />
<bean id="subscriptionNotificationService"
class="com.raytheon.uf.viz.datadelivery.subscription.SendToServerSubscriptionNotificationService" />
class="com.raytheon.uf.common.datadelivery.service.SendToServerSubscriptionNotificationService" />
<bean id="permissionsService"
class="com.raytheon.uf.viz.datadelivery.subscription.RequestFromServerPermissionsService" />
<bean id="groupDefinitionService"
class="com.raytheon.uf.common.datadelivery.service.GroupDefinitionService" />
<bean id="subscriptionService"
class="com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService"
factory-method="newInstance">
@ -28,6 +31,7 @@
<property name="subscriptionNotificationService" ref="subscriptionNotificationService" />
<property name="bandwidthService" ref="bandwidthService" />
<property name="permissionsService" ref="permissionsService" />
<property name="groupDefinitionService" ref="groupDefinitionService" />
</bean>
<bean id="systemRuleManager"

View file

@ -61,7 +61,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Slider;
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
import com.raytheon.uf.common.datadelivery.event.notification.SubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.service.SubscriptionNotificationResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;

View file

@ -20,8 +20,9 @@
package com.raytheon.uf.viz.datadelivery.services;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionNotificationService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
/**
@ -55,6 +56,8 @@ public final class DataDeliveryServices {
private IPermissionsService permissionsService;
private IGroupDefinitionService groupDefinitionService;
/**
* Disabled constructor.
*/
@ -147,4 +150,24 @@ public final class DataDeliveryServices {
public void setPermissionsService(IPermissionsService permissionsService) {
this.permissionsService = permissionsService;
}
/**
* Get the group definition service.
*
* @return the groupDefinitionService
*/
public static IGroupDefinitionService getGroupDefinitionService() {
return INSTANCE.groupDefinitionService;
}
/**
* Set the group definition service.
*
* @param groupDefinitionService
* the groupDefinitionService to set
*/
public void setGroupDefinitionService(
IGroupDefinitionService groupDefinitionService) {
this.groupDefinitionService = groupDefinitionService;
}
}

View file

@ -29,12 +29,14 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
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.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;
@ -47,7 +49,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 2, 2013 1441 djohnson Initial creation
* Jan 2, 2013 1441 djohnson Initial creation
* Jan 18, 2013 1441 djohnson Use group definition service.
*
* </pre>
*
@ -68,6 +71,9 @@ public class DeleteGroupDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(DeleteGroupDlg.class);
private final IGroupDefinitionService groupService = DataDeliveryServices
.getGroupDefinitionService();
/**
* @param shell
* @param groupAction
@ -144,8 +150,11 @@ public class DeleteGroupDlg extends CaveSWTDialog {
+ groupName + "?")) {
try {
DataDeliveryHandlers.getGroupDefinitionHandler()
.deleteByName(groupName);
groupService
.deleteGroupDefinition(
DataDeliveryHandlers
.getGroupDefinitionHandler()
.getByName(groupName));
groupAction.loadGroupNames();
return true;
} catch (RegistryHandlerException e) {

View file

@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;

View file

@ -19,12 +19,14 @@
**/
package com.raytheon.uf.viz.datadelivery.subscription;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
/**
* {@link IPermissionsService} implementation that requests permissions from the
@ -37,6 +39,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 04, 2013 1441 djohnson Initial creation
* Jan 21, 2013 1441 djohnson Use RequestRouter.
*
* </pre>
*
@ -93,8 +96,13 @@ public class RequestFromServerPermissionsService implements IPermissionsService
*/
private DataDeliveryAuthRequest sendAuthorizationRequest(
DataDeliveryAuthRequest request) throws VizException {
return (DataDeliveryAuthRequest) ThriftClient
.sendPrivilegedRequest(request);
try {
return (DataDeliveryAuthRequest) ((SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER))
.getResponse();
} catch (Exception e) {
throw new VizException(e);
}
}
/**

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler;

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;

View file

@ -47,12 +47,12 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.event.notification.SubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.SubscriptionNotificationResponse;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler;

View file

@ -33,14 +33,14 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.datadelivery.event.notification.ApprovedPendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.BaseSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.DeniedPendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.PendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.ApprovedPendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.service.DeniedPendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.service.PendingSubscriptionNotificationResponse;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -57,7 +58,6 @@ import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService.IAuthorizedPermissionResponse;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionNotificationService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
@ -62,7 +63,6 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.GroupDefinitionManager;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionNotificationService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;

View file

@ -9,13 +9,13 @@ import com.raytheon.uf.common.datadelivery.event.notification.DeleteNotification
import com.raytheon.uf.common.datadelivery.event.notification.DeleteNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.GetNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.notification.INotificationObserver;
import com.raytheon.uf.viz.core.notification.NotificationException;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
/**
@ -29,6 +29,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery.
*
* </pre>
*
@ -115,10 +116,10 @@ public class NotificationHandler implements INotificationObserver {
request.setUsername(username);
request.setHours(hours);
request.setMaxResults(maxResults);
ArrayList<NotificationRecord> response = (ArrayList<NotificationRecord>) ThriftClient
.sendRequest(request);
ArrayList<NotificationRecord> response = (ArrayList<NotificationRecord>) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return response;
} catch (VizException e) {
} catch (Exception e) {
statusHandler.error(
"Error trying to retrieve notifications from database", e);
}
@ -139,10 +140,10 @@ public class NotificationHandler implements INotificationObserver {
try {
DeleteNotificationRequest request = new DeleteNotificationRequest();
request.setIds(ids);
DeleteNotificationResponse response = (DeleteNotificationResponse) ThriftClient
.sendRequest(request);
DeleteNotificationResponse response = (DeleteNotificationResponse) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
rowsDeleted = response.getRowsDeleted();
} catch (VizException e) {
} catch (Exception e) {
statusHandler.error(
"Error trying to delete notification(s) from database", e);
}

View file

@ -61,17 +61,17 @@ import com.raytheon.uf.viz.stats.display.ScaleManager;
/**
* Statistics graph canvas.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 3, 2012 728 mpduff Initial creation
*
*
* </pre>
*
*
* @author mpduff
* @version 1.0
*/
@ -199,7 +199,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Constructor
*
*
* @param parent
* Parent composite
* @param callback
@ -262,7 +262,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Initialize drawing settings.
*
*
* @param gc
* The Graphics Context
*/
@ -280,7 +280,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Draw on the canvas.
*
*
* @param gc
* The Graphics Context
*/
@ -327,7 +327,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Draw the X axis.
*
*
* @param gc
* The Graphics Context
*/
@ -364,7 +364,8 @@ public class StatsDisplayCanvas extends Canvas {
GRAPH_BORDER + GRAPH_HEIGHT,
(int) (GRAPH_BORDER + (i - startMillis) / millisPerPixelX),
GRAPH_BORDER + GRAPH_HEIGHT + height };
if (cal.get(Calendar.HOUR_OF_DAY) == 0) {
if (cal.get(Calendar.HOUR_OF_DAY) == 0
&& cal.get(Calendar.MINUTE) == 0) {
gc.setLineWidth(3);
} else {
gc.setLineWidth(1);
@ -406,9 +407,12 @@ public class StatsDisplayCanvas extends Canvas {
buffer.setLength(0); // Clear the buffer
int y = GRAPH_BORDER + GRAPH_HEIGHT + 20;
int hr = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
if ((numHours <= 24) || (hour % 6 == 0 && numHours <= 168)) {
if (numHours <= 3) {
for (int j = 0; j < 60; j += 15) {
for (int j = 0; j < TimeUtil.MINUTES_PER_HOUR; j += 15) {
buffer.setLength(0);
int x = (int) (GRAPH_BORDER + (i - startMillis + j
* TimeUtil.MILLIS_PER_MINUTE)
@ -417,11 +421,12 @@ public class StatsDisplayCanvas extends Canvas {
|| (numHours == 3 && (j == 0 || j == 30))) {
String hrStr = (hr < 10) ? ZERO.concat(String
.valueOf(hr)) : String.valueOf(hr);
if (j == 0) {
if (minute == 0) {
buffer.append(hrStr).append(COLON)
.append(MINUTE_00);
} else {
buffer.append(hrStr).append(COLON).append(j);
buffer.append(hrStr).append(COLON)
.append(minute);
}
int adjustment = buffer.length() * fontAveWidth / 2
- 1;
@ -437,9 +442,24 @@ public class StatsDisplayCanvas extends Canvas {
* j)
/ millisPerPixelX),
GRAPH_BORDER };
if (hr == 0 && minute == 0) {
gc.setLineWidth(3);
}
gc.drawPolyline(gridLineArray);
gc.setLineWidth(1);
}
minute += 15;
// Roll the minutes and hours, account for rolling
// to the next hour/minute
if (minute >= TimeUtil.MINUTES_PER_HOUR) {
minute = 0;
hr++;
if (hr == TimeUtil.HOURS_PER_DAY) {
hr = 0;
}
}
}
int[] minorTickArray = {
(int) (GRAPH_BORDER + (i - startMillis + TimeUtil.MILLIS_PER_MINUTE
* j)
@ -462,7 +482,7 @@ public class StatsDisplayCanvas extends Canvas {
if (callback.drawGridLines()) {
if ((numHours == 24 && hr % 6 == 0)
|| (numHours == 168 && hr == 0)) {
|| (numHours == TimeUtil.HOURS_PER_WEEK && hr == 0)) {
int[] gridLineArray = {
(int) (GRAPH_BORDER + (i - startMillis)
@ -556,7 +576,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Draw the Y axis.
*
*
* @param gc
* The Graphics Context
*/
@ -607,7 +627,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Draw the YAxis label.
*
*
* @param gc
* The Graphics Context
*/
@ -639,7 +659,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Draw the data on the canvas.
*
*
* @param gc
* The Graphics Context
*/
@ -727,7 +747,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Y Value to pixel conversion.
*
*
* @param yMin
* The smallest y value
* @param yMax
@ -744,7 +764,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Mouse move event hanler.
*
*
* @param e
* MouseEvent object
*/
@ -792,7 +812,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Show the "tooltip" mouseover.
*
*
* @param parent
* @param x
* @param y
@ -824,7 +844,7 @@ public class StatsDisplayCanvas extends Canvas {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.swt.widgets.Widget#dispose()
*/
@Override
@ -837,7 +857,7 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Set the graph data.
*
*
* @param graphData
* The GraphData object
*/
@ -847,7 +867,9 @@ public class StatsDisplayCanvas extends Canvas {
/**
* Set the view type.
* @param view The view type
*
* @param view
* The view type
*/
public void setView(String view) {
this.view = view;

View file

@ -73,6 +73,7 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
* to use IFPClient
* 02/23/12 #346 dgilling Implement a dispose method.
* 03/01/12 #346 dgilling Re-order dispose method.
* 01/21/12 #1504 randerso Cleaned up old debug logging to improve performance
*
* </pre>
*
@ -411,6 +412,7 @@ public class DbParm extends Parm {
// normal mode
if (normal) {
Arrays.sort(grids);
// Now replace the existing grids with the new ones
replaceGrids(affectedTimeRange, grids);
@ -757,10 +759,10 @@ public class DbParm extends Parm {
List<LockRequest> lreq = new ArrayList<LockRequest>(timesToSave.size());
for (int i = 0; i < timesToSave.size(); i++) {
String msg = "Reverting " + getParmID() + " tr="
+ timesToSave.get(i);
statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
+ msg));
// String msg = "Reverting " + getParmID() + " tr="
// + timesToSave.get(i);
// statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
// + msg));
boolean success = true;
IGridData[] grids = null;

View file

@ -24,9 +24,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@ -107,8 +106,11 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
* Apr 7, 2009 randerso Initial creation
* Jun 3, 2011 8919 rferrel Determine grid's VisMode based
* on imageOnEdit
* 08/20/2012 #1082 randerso Moved calcStepTimes to AbstractParmManager for
* 08/20/2012 #1082 randerso Moved calcStepTimes to AbstractParmManager for
* use in PngWriter
* 11/30/2012 #1328 mschenke Made GFE use descriptor for time matching
* and time storage and manipulation
* 01/22/2013 #1518 randerso Removed use of Map with Parms as keys
*
* </pre>
*
@ -256,8 +258,6 @@ public class GridCanvas extends Canvas implements IMessageClient {
private ArrayList<GridBar> gridBarList;
private Map<Parm, GridBar> parmToGridBar;
private Rectangle selection;
private MenuManager menuMgr;
@ -294,7 +294,6 @@ public class GridCanvas extends Canvas implements IMessageClient {
dataMgr = gridManager.getDataManager();
gridBarList = new ArrayList<GridBar>();
parmToGridBar = new HashMap<Parm, GridBar>();
Parm[] displayedParms = gridManager.getDataManager().getParmManager()
.getDisplayedParms();
@ -684,10 +683,13 @@ public class GridCanvas extends Canvas implements IMessageClient {
if (deletions != null) {
for (Parm parm : deletions) {
GridBar gridBar = parmToGridBar.remove(parm);
if (gridBar != null) {
gridBarList.remove(gridBar);
gridBar.dispose();
Iterator<GridBar> iter = gridBarList.iterator();
while (iter.hasNext()) {
GridBar gridBar = iter.next();
if (gridBar.getParm().equals(parm)) {
iter.remove();
gridBar.dispose();
}
}
}
}
@ -695,11 +697,8 @@ public class GridCanvas extends Canvas implements IMessageClient {
if (additions != null) {
for (Parm parm : additions) {
if (!parm.getGridInfo().isTimeIndependentParm()) {
if (!parmToGridBar.containsKey(parm)) {
GridBar gridBar = new GridBar(this, parm, gridManager);
gridBarList.add(gridBar);
parmToGridBar.put(parm, gridBar);
}
GridBar gridBar = new GridBar(this, parm, gridManager);
gridBarList.add(gridBar);
}
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.viz.gfe.ifpimage;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
@ -31,6 +30,7 @@ import java.util.TimeZone;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.dataplugin.gfe.type.Pair;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.RGBColors;
@ -42,7 +42,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.viz.core.ColorUtil;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.griddata.IGridData;
import com.raytheon.viz.gfe.core.parm.Parm;
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
import com.raytheon.viz.gfe.rsc.GFELegendResource;
@ -62,6 +61,10 @@ import com.raytheon.viz.gfe.rsc.GFEResource;
* Jul 10, 2012 15186 ryu Set legend font
* Aug 20, 2012 #1078 dgilling Fix handling of ImageLegend_color
* setting.
* Nov 30, 2012 #1328 mschenke Made GFE use descriptor for time matching
* and time storage and manipulation
* Jan 22, 2013 #1518 randerso Removed use of Map with Parms as keys,
* really just needed a list anyway.
*
* </pre>
*
@ -100,9 +103,8 @@ public class ImageLegendResource extends GFELegendResource {
@Override
public LegendEntry[] getLegendData(IDescriptor descriptor) {
Map<Parm, ResourcePair> parmRscMap = new HashMap<Parm, ResourcePair>();
Collection<Parm> parms = getLegendOrderedParms(descriptor, parmRscMap);
LegendData[] data = makeLegend(parms, parmRscMap);
List<Pair<Parm, ResourcePair>> parms = getLegendOrderedParms(descriptor);
LegendData[] data = makeLegend(parms);
LegendEntry[] entries = new LegendEntry[data.length];
for (int i = 0; i < entries.length; ++i) {
@ -113,15 +115,15 @@ public class ImageLegendResource extends GFELegendResource {
return entries;
}
private LegendData[] makeLegend(Collection<Parm> parms,
Map<Parm, ResourcePair> parmRscMap) {
private LegendData[] makeLegend(List<Pair<Parm, ResourcePair>> parms) {
FramesInfo currInfo = descriptor.getFramesInfo();
DataTime curTime = currInfo.getCurrentFrame();
// loop through the grids
List<LegendData> legendData = new ArrayList<LegendData>();
for (Parm parm : parms) {
ResourcePair rp = parmRscMap.get(parm);
for (Pair<Parm, ResourcePair> pair : parms) {
Parm parm = pair.getFirst();
ResourcePair rp = pair.getSecond();
GFEResource rsc = (GFEResource) rp.getResource();
String parmName = parm.getParmID().getParmName();
ResourceProperties props = rp.getProperties();
@ -150,7 +152,6 @@ public class ImageLegendResource extends GFELegendResource {
// get the units for the time string
String units = rsc.getParm().getGridInfo().getUnitString();
IGridData[] gd = new IGridData[0];
Locale locale = Locale.getDefault();
String lang = getLanguage();

View file

@ -23,13 +23,11 @@ import static com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode.IMAGE
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import org.eclipse.jface.preference.IPreferenceStore;
@ -37,6 +35,7 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.type.Pair;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -65,6 +64,7 @@ import com.raytheon.viz.gfe.PreferenceInitializer;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.ISpatialDisplayManager;
import com.raytheon.viz.gfe.core.griddata.IGridData;
import com.raytheon.viz.gfe.core.msgs.INewModelAvailableListener;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient;
import com.raytheon.viz.gfe.core.msgs.ShowQuickViewDataMsg;
@ -83,13 +83,18 @@ import com.raytheon.viz.ui.input.InputAdapter;
* 03/17/2008 chammack Initial Creation.
* 08/19/2009 2547 rjpeter Implement Test/Prac database display.
* 07/10/2012 15186 ryu Clean up initInternal per Ron
* 11/30/2012 #1328 mschenke Made GFE use descriptor for time matching
* and time storage and manipulation
* 01/22/2013 #1518 randerso Removed use of Map with Parms as keys,
* really just needed a list anyway.
* </pre>
*
* @author chammack
* @version 1.0
*/
public class GFELegendResource extends
AbstractLegendResource<GFELegendResourceData> implements IMessageClient {
AbstractLegendResource<GFELegendResourceData> implements
IMessageClient, INewModelAvailableListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GFELegendResource.class);
@ -118,8 +123,6 @@ public class GFELegendResource extends
private class GFELegendInputHandler extends InputAdapter {
private boolean inDrag;
ResourcePair mouseDownRsc = null;
@Override
@ -158,10 +161,9 @@ public class GFELegendResource extends
if (rsc.getResource() instanceof GFEResource) {
GFEResource gfeRsc = (GFEResource) rsc
.getResource();
DataManager
.getCurrentInstance()
.getSpatialDisplayManager()
.makeVisible(gfeRsc.getParm(),
GFELegendResource.this.dataManager
.getSpatialDisplayManager().makeVisible(
gfeRsc.getParm(),
!props.isVisible(), false);
} else {
@ -173,8 +175,7 @@ public class GFELegendResource extends
} else if (mouseButton == 2) {
if (rsc.getResource() instanceof GFEResource) {
GFEResource gfeRsc = (GFEResource) rsc.getResource();
ISpatialDisplayManager sdm = DataManager
.getCurrentInstance()
ISpatialDisplayManager sdm = GFELegendResource.this.dataManager
.getSpatialDisplayManager();
Parm parm = gfeRsc.getParm();
@ -242,7 +243,6 @@ public class GFELegendResource extends
}.run();
}
@SuppressWarnings("unchecked")
public GFELegendResource(DataManager dataManager,
GFELegendResourceData resourceData, LoadProperties loadProps) {
super(resourceData, loadProps);
@ -257,8 +257,6 @@ public class GFELegendResource extends
} catch (Exception e) {
mode = LegendMode.GRIDS;
}
Message.registerInterest(this, ShowQuickViewDataMsg.class);
}
protected void addSpaces(StringBuilder sb, int numSpace) {
@ -267,23 +265,6 @@ public class GFELegendResource extends
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#finalize()
*/
@SuppressWarnings("unchecked")
@Override
protected void finalize() throws Throwable {
// FIXME: this needs to be a dispose method.
Message.unregisterInterest(this, ShowQuickViewDataMsg.class);
if (font != null) {
font.dispose();
font = null;
}
}
/*
* (non-Javadoc)
*
@ -319,26 +300,21 @@ public class GFELegendResource extends
}
/**
* Gets an ordered collection of Parms to display for the legend.
* Gets an ordered list of Parm/ResourcePair pairs to display for the
* legend.
*
* @param descriptor
* @param parmRscMap
* optional map to create Parm->ResourcePair mapping for parms
* returned
* @return
*/
protected Collection<Parm> getLegendOrderedParms(IDescriptor descriptor,
Map<Parm, ResourcePair> parmRscMap) {
List<Parm> parms = new ArrayList<Parm>();
protected List<Pair<Parm, ResourcePair>> getLegendOrderedParms(
IDescriptor descriptor) {
List<Pair<Parm, ResourcePair>> parms = new ArrayList<Pair<Parm, ResourcePair>>();
for (ResourcePair rp : descriptor.getResourceList()) {
if (rp.getResource() instanceof GFEResource) {
Parm parm = ((GFEResource) rp.getResource()).getParm();
if (qvGrid == null
|| (qvGrid != null && qvGrid.getParm() == parm)) {
parms.add(parm);
if (parmRscMap != null) {
parmRscMap.put(parm, rp);
}
parms.add(new Pair<Parm, ResourcePair>(parm, rp));
if (qvGrid != null) {
break;
}
@ -346,8 +322,14 @@ public class GFELegendResource extends
}
}
Collections.sort(parms);
Collections.reverse(parms);
Collections.sort(parms, new Comparator<Pair<Parm, ResourcePair>>() {
@Override
public int compare(Pair<Parm, ResourcePair> o1,
Pair<Parm, ResourcePair> o2) {
return o2.getFirst().compareTo(o1.getFirst());
}
});
return parms;
}
@ -362,8 +344,7 @@ public class GFELegendResource extends
.getActivatedParm();
StringBuilder labelBuilder = new StringBuilder();
Map<Parm, ResourcePair> parmRscMap = new HashMap<Parm, ResourcePair>();
Collection<Parm> parms = getLegendOrderedParms(descriptor, parmRscMap);
List<Pair<Parm, ResourcePair>> parms = getLegendOrderedParms(descriptor);
Parm qvParm = null;
if (qvGrid != null) {
qvParm = qvGrid.getParm();
@ -374,11 +355,12 @@ public class GFELegendResource extends
ParmID topoID = dataManager.getTopoManager().getCompositeParmID();
// Topmost resources: GFE Parms
for (Parm parm : parms) {
for (Pair<Parm, ResourcePair> pair : parms) {
Parm parm = pair.getFirst();
ParmID parmId = parm.getParmID();
DatabaseID dbId = parmId.getDbId();
StringBuilder sb = new StringBuilder();
ResourcePair rp = parmRscMap.get(parm);
ResourcePair rp = pair.getSecond();
GFEResource rsc = (GFEResource) rp.getResource();
LegendData ld = new LegendData();
ResourceProperties props = rp.getProperties();
@ -435,33 +417,27 @@ public class GFELegendResource extends
// get the model name
labelBuilder.setLength(0);
labelBuilder.append(dbId.getModelName());
labelBuilder.append(dbId.getShortModelId());
boolean iscTyped = false;
if (dataManager.getParmManager().iscMode()
&& dbId.equals(dataManager.getParmManager()
.getMutableDatabase())) {
// FIXME this is from A1 and is not consistent with the code in
// getLongestFields
ParmID iscPID = dataManager.getParmManager().getISCParmID(
parmId);
if (iscPID.isValid()) {
// vparms (i.e. temp hazards) can't get here
String iscStr = "+" + iscPID.getDbId().getDbType()
+ iscPID.getDbId().getModelName();
labelBuilder.append(iscStr);
iscTyped = true;
}
}
// if (_showISCMode && _quickViewGrid == GridID()
// && _grids[i].gridID().parm()->parmID().databaseID() ==
// _dbss->dataManager()->parmMgr()->mutableDatabase())
// {
// unsigned int mpos = 0;
// if (modelText.found(' ', mpos))
// {
// ParmID iscPID =
// _dbss->dataManager()->parmMgr()->getISCParmID(
// _grids[i].gridID().parm()->parmID());
// TextString iscStr = "+" + iscPID.databaseID().type() +
// iscPID.databaseID().model();
// modelText.insertBefore(mpos, iscStr);
// }
// }
if (!iscTyped) {
String type = dbId.getDbType();
if ((type != null) && (type.length() > 0)) {
labelBuilder.append("_");
labelBuilder.append(type);
}
}
labelBuilder.append(" (" + dbId.getSiteId() + ")");
sb.append(labelBuilder.toString());
diff = lengths[3] - labelBuilder.length();
addSpaces(sb, diff + 1);
@ -562,16 +538,14 @@ public class GFELegendResource extends
* @param descriptor
* @return
*/
private int[] getLongestFields(Collection<Parm> parms) {
private int[] getLongestFields(List<Pair<Parm, ResourcePair>> parms) {
// Iterator<ResourcePair> rl = descriptor.getResourceList().iterator();
int[] sz = new int[4];
StringBuilder labelBuilder = new StringBuilder();
// synchronized (rl) {
// while (rl.hasNext()) {
for (Parm parm : parms) {
// AbstractVizResource<?, ?> resource = rl.next().getResource();
// if (resource instanceof GFEResource) {
// Parm parm = ((GFEResource) resource).getParm();
for (Pair<Parm, ResourcePair> pair : parms) {
Parm parm = pair.getFirst();
ParmID parmId = parm.getParmID();
sz[0] = Math.max(sz[0], parmId.getParmName().length());
sz[1] = Math.max(sz[1], parmId.getParmLevel().length());
@ -580,52 +554,33 @@ public class GFELegendResource extends
DatabaseID dbId = parmId.getDbId();
labelBuilder.setLength(0);
labelBuilder.append(dbId.getModelName());
labelBuilder.append(dbId.getShortModelId());
boolean iscTyped = false;
if (dataManager.getParmManager().iscMode()
&& dbId.equals(dataManager.getParmManager()
.getMutableDatabase())) {
// FIXME this is A1 code and is not consistent with the code in
// getLegendDataGrids
ParmID iscPID = dataManager.getParmManager().getISCParmID(
parmId);
if (iscPID.isValid()) {
// vparms (i.e. temp hazards) can't get here
String iscStr = "+" + iscPID.getDbId().getDbType()
+ iscPID.getDbId().getModelName();
labelBuilder.append(iscStr);
iscTyped = true;
}
}
if (!iscTyped) {
String type = dbId.getDbType();
if ((type != null) && (type.length() > 0)) {
labelBuilder.append("_");
labelBuilder.append(type);
}
}
labelBuilder.append(" (" + dbId.getSiteId() + ")");
// TODO: FIXME
// if (showIscMode
// && ids[i].gridID().parm()->parmID().databaseID() ==
// _dbss->dataManager()->parmMgr()->mutableDatabase())
// label += "+VISC";
sz[3] = Math.max(sz[3], labelBuilder.length());
// }
sz[3] = Math.max(sz[3], labelBuilder.length());
}
// }
return sz;
}
@SuppressWarnings("unchecked")
@Override
protected void disposeInternal() {
super.disposeInternal();
this.dataManager.getParmManager().removeNewModelAvailableListener(this);
Message.unregisterInterest(this, ShowQuickViewDataMsg.class);
if (font != null) {
font.dispose();
font = null;
}
IDisplayPaneContainer container = getResourceContainer();
if (container != null) {
@ -633,9 +588,14 @@ public class GFELegendResource extends
}
}
@SuppressWarnings("unchecked")
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
super.initInternal(target);
Message.registerInterest(this, ShowQuickViewDataMsg.class);
this.dataManager.getParmManager().addNewModelAvailableListener(this);
int fontNum = 3;
if (GFEPreference.contains("SELegend_font")) {
fontNum = GFEPreference.getIntPreference("SELegend_font");
@ -689,4 +649,9 @@ public class GFELegendResource extends
}
}
@Override
public void newModelAvailable(DatabaseID additions) {
issueRefresh();
}
}

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="hamcrest-all-1.3.jar" sourcepath="hamcrest-all-1.3-sources.jar"/>
<classpathentry exported="true" kind="lib" path="junit-dep-4.11.jar" sourcepath="junit-4.11-src.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="jmock-2.0.0.jar" sourcepath="org.junitsrc.zip"/>
@ -10,6 +12,5 @@
<classpathentry exported="true" kind="lib" path="mockito-all-1.9.0.jar"/>
<classpathentry exported="true" kind="lib" path="objenesis-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="powermock-mockito-1.4.12-full.jar"/>
<classpathentry exported="true" kind="lib" path="junit-4.10.jar" sourcepath="junit-4.10-src.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -11,7 +11,8 @@ Bundle-ClassPath: jmock-2.0.0.jar,
mockito-all-1.9.0.jar,
objenesis-1.2.jar,
powermock-mockito-1.4.12-full.jar,
junit-4.10.jar
hamcrest-all-1.3.jar,
junit-dep-4.11.jar
Export-Package: javassist,
javassist.bytecode,
javassist.bytecode.analysis,
@ -43,8 +44,28 @@ Export-Package: javassist,
net.sf.cglib.transform.impl,
net.sf.cglib.util,
org.hamcrest,
org.hamcrest.beans,
org.hamcrest.collection,
org.hamcrest.core,
org.hamcrest.generator,
org.hamcrest.generator.config,
org.hamcrest.generator.qdox,
org.hamcrest.generator.qdox.ant,
org.hamcrest.generator.qdox.directorywalker,
org.hamcrest.generator.qdox.junit,
org.hamcrest.generator.qdox.model,
org.hamcrest.generator.qdox.model.annotation,
org.hamcrest.generator.qdox.model.util,
org.hamcrest.generator.qdox.parser,
org.hamcrest.generator.qdox.parser.impl,
org.hamcrest.generator.qdox.parser.structs,
org.hamcrest.generator.qdox.tools,
org.hamcrest.integration,
org.hamcrest.internal,
org.hamcrest.number,
org.hamcrest.object,
org.hamcrest.text,
org.hamcrest.xml,
org.jmock,
org.jmock.api,
org.jmock.example.qcon,

View file

@ -8,4 +8,5 @@ bin.includes = META-INF/,\
mockito-all-1.9.0.jar,\
objenesis-1.2.jar,\
powermock-mockito-1.4.12-full.jar,\
junit-4.10.jar
hamcrest-all-1.3.jar,\
junit-dep-4.11.jar

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
edexOsgi/build.edex/edex/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dist/

View file

@ -97,24 +97,6 @@ class ParmID(JUtil.JavaWrapperClass):
def getParmId(self):
return self.__pid.getParmId()
def setParmName(self, parmName):
self.__pid.setParmName(parmName)
def setParmLevel(self, parmLevel):
self.__pid.setParmLevel(parmLevel)
def setDbId(self, dbId):
self.__pid.setDbId(dbId.toJavaObj())
def setCompositeName(self, compositeName):
self.__pid.setCompositeName(compositeName)
def setShortParmId(self, shortParmId):
self.__pid.setShortParmId(shortParmId)
def setParmId(self, parmId):
self.__pid.setParmId(parmId)
@staticmethod
def shortSerializer(parmID):
return JavaParmID.shortSerializer(parmID.javaParmId())

View file

@ -108,7 +108,7 @@
<route id="gfeVtecChangeNotification">
<from uri="jms-generic:topic:edex.alerts.vtec"/>
<doTry>
<bean ref="serializationUtil" method="transformFromThrift" />
<bean ref="serializationUtil" method="transformFromThrift" />
<bean ref="vtecChangeListener" method="handleNotification" />
<doCatch>
<exception>java.lang.Throwable</exception>
@ -130,7 +130,7 @@
</doTry>
</route>
</camelContext>
<!-- Beans to define a custom jms connection which will allow a durable subscription -->
<bean id="gfeNotifyConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
<constructor-arg type="java.lang.String" value="amqp://guest:guest@gfeNotify/edex?brokerlist='tcp://${broker.addr}?retries='9999'&amp;connecttimeout='5000'&amp;connectdelay='5000''&amp;maxprefetch='0'&amp;sync_publish='all'&amp;sync_ack='true'"/>

View file

@ -21,6 +21,7 @@
package com.raytheon.edex.plugin.gfe.cache.d2dparms;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@ -40,15 +41,18 @@ import com.raytheon.edex.plugin.gfe.server.database.D2DGridDatabase;
import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase;
import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.parameter.mapping.ParameterMapper;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification;
import com.raytheon.uf.common.message.WsId;
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.mapping.MultipleMappingException;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.site.SiteAwareRegistry;
@ -62,6 +66,10 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
* 01/08/09 1674 bphillip Initial creation
* 11/05/12 #1310 dgilling Modify cache to listen to plugin
* purged topic.
* 01/18/13 #1504 randerso Moved D2D to GFE parameter name translation from
* D2DParmIdCache toGfeIngestNotificationFilter.
* Added code to match wind components and send
* GridUpdateNotifications.
* </pre>
*
* @author bphillip
@ -77,8 +85,19 @@ public class D2DParmIdCache {
private static final Pattern RangeFilter = Pattern
.compile("(.*?)\\d{1,2}hr");
private static final Map<String, String> WIND_COMP_PARMS;
static {
WIND_COMP_PARMS = new HashMap<String, String>();
WIND_COMP_PARMS.put("uw", "vw");
WIND_COMP_PARMS.put("vw", "uw");
WIND_COMP_PARMS.put("ws", "wd");
WIND_COMP_PARMS.put("wd", "ws");
}
/** Map containing the ParmIDs */
private Map<String, Set<String>> parmIds;
private Map<DatabaseID, Set<ParmID>> parmIds;
private Map<ParmID, Set<TimeRange>> windComps;
private static D2DParmIdCache instance;
@ -93,7 +112,8 @@ public class D2DParmIdCache {
* Constructs a new D2DParmIdCache
*/
public D2DParmIdCache() {
parmIds = new HashMap<String, Set<String>>();
parmIds = new HashMap<DatabaseID, Set<ParmID>>();
windComps = new HashMap<ParmID, Set<TimeRange>>();
}
/**
@ -140,53 +160,18 @@ public class D2DParmIdCache {
}
private void putParmIDInternal(ParmID parmId) {
DatabaseID dbId = parmId.getDbId();
synchronized (parmIds) {
Set<ParmID> dbParms = parmIds.get(dbId);
// Add the database entry to the map if it does not exist
if (!parmIds.containsKey(parmId.getDbId().toString())) {
parmIds.put(parmId.getDbId().toString(), new HashSet<String>());
if (dbParms == null) {
dbParms = new HashSet<ParmID>();
parmIds.put(dbId, dbParms);
}
// Insert the ParmID into the map
String parmStr = parmId.toString();
// Ensure that the staticTopo parameter has the correct
// capitalization, or the smart init scripts will not be able to
// find it
String parmName = parmId.getParmName();
if (parmName.equalsIgnoreCase("staticTopo")) {
parmStr = parmStr.replace("statictopo", "staticTopo");
} else if (parmName.equalsIgnoreCase("staticspacing")) {
parmStr = parmStr.replace("staticspacing", "staticSpacing");
} else if (parmName.equalsIgnoreCase("staticXspacing")) {
parmStr = parmStr.replace("staticxspacing", "staticXspacing");
} else if (parmName.equalsIgnoreCase("staticYspacing")) {
parmStr = parmStr.replace("staticyspacing", "staticYspacing");
} else if (parmName.equalsIgnoreCase("staticCoriolis")) {
parmStr = parmStr.replace("staticcoriolis", "staticCoriolis");
} else {
String gfeParamName = null;
try {
gfeParamName = ParameterMapper.getInstance().lookupAlias(
parmId.getParmName(), "gfeParamName");
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN,
e.getLocalizedMessage(), e);
gfeParamName = e.getArbitraryMapping();
}
parmStr = parmStr.replaceFirst(
parmId.getParmName(),
gfeParamName);
}
parmIds.get(parmId.getDbId().toString()).add(parmStr);
}
}
/**
* Places a parmId into the cache
*
* @param parmId
* String representation of a ParmID
*/
public void putParmID(String parmId) {
putParmID(new ParmID(parmId));
// Insert the ParmID into the map
dbParms.add(parmId);
}
}
/**
@ -209,18 +194,10 @@ public class D2DParmIdCache {
* @return The ParmIDs in the given DatabaseID
*/
public List<ParmID> getParmIDs(DatabaseID dbId) {
Set<String> parmStrings = null;
List<ParmID> parms = Collections.emptyList();
synchronized (parmIds) {
if (parmIds.containsKey(dbId.toString())) {
parmStrings = new HashSet<String>(parmIds.get(dbId.toString()));
}
}
List<ParmID> parms = Collections.emptyList();
if (parmStrings != null) {
parms = new ArrayList<ParmID>(parmStrings.size());
for (String parmStr : parmStrings) {
parms.add(new ParmID(parmStr));
parms = new ArrayList<ParmID>(parmIds.get(dbId));
}
}
return parms;
@ -244,14 +221,9 @@ public class D2DParmIdCache {
* @return The list of DatabaseIDs
*/
public List<DatabaseID> getDatabaseIDs() {
Set<String> dbStrs;
List<DatabaseID> dbIds = null;
synchronized (parmIds) {
dbStrs = new HashSet<String>(parmIds.keySet());
}
List<DatabaseID> dbIds = new ArrayList<DatabaseID>(dbStrs.size());
for (String dbId : dbStrs) {
dbIds.add(new DatabaseID(dbId));
dbIds = new ArrayList<DatabaseID>(parmIds.keySet());
}
return dbIds;
}
@ -382,6 +354,19 @@ public class D2DParmIdCache {
for (DatabaseID dbId : dbsToRemove) {
GridParmManager.removeDbFromMap(dbId);
}
// purge the windComps
List<ParmID> wcToRemove = new ArrayList<ParmID>();
synchronized (windComps) {
for (ParmID id : windComps.keySet()) {
if (dbsToRemove.contains(id.getDbId())) {
wcToRemove.add(id);
}
}
for (ParmID id : wcToRemove) {
windComps.remove(id);
}
}
statusHandler.handle(Priority.EVENTA,
"Total time to build D2DParmIdCache for " + siteID
+ " took " + (System.currentTimeMillis() - start)
@ -397,7 +382,7 @@ public class D2DParmIdCache {
public long getSize() {
long size = 0;
synchronized (parmIds) {
for (Set<String> parms : parmIds.values()) {
for (Set<ParmID> parms : parmIds.values()) {
size += parms.size();
}
}
@ -410,4 +395,63 @@ public class D2DParmIdCache {
buildCache(null);
}
}
public void processGridUpdateNotification(GridUpdateNotification gun) {
ParmID parmId = gun.getParmId();
String otherCompName = WIND_COMP_PARMS.get(parmId.getParmName());
if (otherCompName == null) {
// if it's not a wind component just add it to the cache
putParmID(parmId);
} else {
Set<TimeRange> windTrs = null;
synchronized (windComps) {
// add this parms times to windComps map
Set<TimeRange> trs = windComps.get(parmId);
if (trs == null) {
trs = new HashSet<TimeRange>();
windComps.put(parmId, trs);
}
trs.addAll(gun.getHistories().keySet());
// get the other components times
ParmID otherCompId = new ParmID(otherCompName,
parmId.getDbId(), parmId.getParmLevel());
Set<TimeRange> otherTrs = windComps.get(otherCompId);
// if we have both components
if (otherTrs != null) {
// find times where we have both components
windTrs = new HashSet<TimeRange>(trs);
windTrs.retainAll(otherTrs);
// remove the matching times since we don't need them
// anymore
trs.removeAll(windTrs);
otherTrs.removeAll(windTrs);
}
}
// if we found any matching times for both components
if (windTrs != null && !windTrs.isEmpty()) {
// add the wind parmId to the cache
ParmID windId = new ParmID("wind", parmId.getDbId(),
parmId.getParmLevel());
putParmID(windId);
// create GridUpdateNotifications for the wind parm
Map<TimeRange, List<GridDataHistory>> history = new HashMap<TimeRange, List<GridDataHistory>>();
ArrayList<GridUpdateNotification> guns = new ArrayList<GridUpdateNotification>(
windTrs.size());
for (TimeRange tr : windTrs) {
history.put(tr, Arrays.asList(new GridDataHistory(
GridDataHistory.OriginType.INITIALIZED, windId, tr,
null, (WsId) null)));
guns.add(new GridUpdateNotification(windId, tr, history,
null, windId.getDbId().getSiteId()));
}
SendNotifications.send(guns);
}
}
}
}

View file

@ -34,7 +34,9 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotificatio
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 1/10/09 1674 bphillip Initial creation
* 10/06/09 3172 njensen Based on grib notification
* 10/06/09 3172 njensen Based on grib notification
* 01/18/13 #1504 randerso Changed to send full GridUpdateNotification
* to D2DParmIdCache
*
* </pre>
*
@ -53,8 +55,8 @@ public class D2DParmIdFilter {
public void updateParmIdCache(List<? extends GfeNotification> notifications) {
for (GfeNotification notify : notifications) {
if (notify instanceof GridUpdateNotification) {
D2DParmIdCache.getInstance().putParmID(
((GridUpdateNotification) notify).getParmId());
D2DParmIdCache.getInstance().processGridUpdateNotification(
(GridUpdateNotification) notify);
}
}
}

View file

@ -105,9 +105,11 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 08/07/09 #2763 njensen Refactored queryByD2DParmId
* 09/10/12 DR15137 ryu Changed for MOSGuide D2D mxt/mnt grids for consistency
* with A1.
* 10/10/12 #1260 randerso Added check to ensure db can be created before
* 10/10/12 #1260 randerso Added check to ensure db can be created before
* adding it to the inventory
* 12/06/12 #1394 rjpeter Optimized D2D grid access.
* 01/21/12 #1504 randerso Back ported change to use ParameterMapper into 13.1.2
*
* </pre>
*
* @author bphillip
@ -321,13 +323,13 @@ public class GFEDao extends DefaultPluginDao {
}
if (sess != null) {
try {
sess.close();
sess.close();
} catch (Exception e) {
statusHandler.error(
"Error occurred closing database session", e);
}
}
}
}
return failedToSave.toArray(new GFERecord[failedToSave.size()]);
@ -460,9 +462,9 @@ public class GFEDao extends DefaultPluginDao {
dataStore.delete(groupsToDelete);
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG,
"Deleted: " + Arrays.toString(groupsToDelete)
+ " from " + hdf5File.getName());
statusHandler.handle(Priority.DEBUG,
"Deleted: " + Arrays.toString(groupsToDelete)
+ " from " + hdf5File.getName());
}
} catch (Exception e) {
statusHandler.handle(
@ -657,10 +659,10 @@ public class GFEDao extends DefaultPluginDao {
s = getHibernateTemplate().getSessionFactory().openSession();
// TODO: clean up so we only make one db query
SortedMap<DataTime, Integer> rawTimes = queryByD2DParmId(id, s);
List<TimeRange> gribTimes = new ArrayList<TimeRange>();
List<TimeRange> gribTimes = new ArrayList<TimeRange>();
for (DataTime dt : rawTimes.keySet()) {
gribTimes.add(dt.getValidPeriod());
}
}
try {
if (isMos(id)) {
@ -670,26 +672,26 @@ public class GFEDao extends DefaultPluginDao {
.getValidPeriod();
TimeRange time = info.getTimeConstraints()
.constraintTime(gribTime.getEnd());
if (timeRange.getEnd().equals(time.getEnd())
|| !info.getTimeConstraints().anyConstraints()) {
if (timeRange.getEnd().equals(time.getEnd())
|| !info.getTimeConstraints().anyConstraints()) {
GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
}
} else if (D2DGridDatabase.isNonAccumDuration(id, gribTimes)) {
for (Map.Entry<DataTime, Integer> timeEntry : rawTimes
.entrySet()) {
TimeRange gribTime = timeEntry.getKey()
.getValidPeriod();
if (timeRange.getStart().equals(gribTime.getEnd())
|| timeRange.equals(gribTime)) {
if (timeRange.getStart().equals(gribTime.getEnd())
|| timeRange.equals(gribTime)) {
GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
}
} else {
for (Map.Entry<DataTime, Integer> timeEntry : rawTimes
@ -698,15 +700,15 @@ public class GFEDao extends DefaultPluginDao {
.getValidPeriod();
TimeRange time = info.getTimeConstraints()
.constraintTime(gribTime.getStart());
if ((timeRange.getStart().equals(time.getStart()) || !info
.getTimeConstraints().anyConstraints())) {
if ((timeRange.getStart().equals(time.getStart()) || !info
.getTimeConstraints().anyConstraints())) {
GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
retVal.setPluginName(GridConstants.GRID);
return retVal;
}
}
}
} catch (GfeConfigurationException e) {
throw new DataAccessLayerException(
"Error getting configuration for "
@ -720,7 +722,7 @@ public class GFEDao extends DefaultPluginDao {
statusHandler.error(
"Error occurred closing database session", e);
}
}
}
}
return null;
@ -743,48 +745,48 @@ public class GFEDao extends DefaultPluginDao {
@SuppressWarnings("unchecked")
public SortedMap<DataTime, Integer> queryByD2DParmId(ParmID id, Session s)
throws DataAccessLayerException {
String levelName = GridTranslator.getLevelName(id.getParmLevel());
String levelName = GridTranslator.getLevelName(id.getParmLevel());
double[] levelValues = GridTranslator.getLevelValue(id.getParmLevel());
boolean levelOnePresent = (levelValues[0] != Level
.getInvalidLevelValue());
boolean levelTwoPresent = (levelValues[1] != Level
.getInvalidLevelValue());
Level level = null;
boolean levelOnePresent = (levelValues[0] != Level
.getInvalidLevelValue());
boolean levelTwoPresent = (levelValues[1] != Level
.getInvalidLevelValue());
Level level = null;
// to have a level 2, must have a level one
try {
if (levelOnePresent && levelTwoPresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0], levelValues[1]);
} else if (levelOnePresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0]);
} else {
level = LevelFactory.getInstance().getLevel(levelName, 0.0);
// to have a level 2, must have a level one
try {
if (levelOnePresent && levelTwoPresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0], levelValues[1]);
} else if (levelOnePresent) {
level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0]);
} else {
level = LevelFactory.getInstance().getLevel(levelName, 0.0);
}
} catch (CommunicationException e) {
logger.error(e.getLocalizedMessage(), e);
}
} catch (CommunicationException e) {
logger.error(e.getLocalizedMessage(), e);
}
if (level == null) {
logger.warn("Unable to query D2D parms, ParmID " + id
+ " does not map to a level");
if (level == null) {
logger.warn("Unable to query D2D parms, ParmID " + id
+ " does not map to a level");
return new TreeMap<DataTime, Integer>();
}
}
SQLQuery modelQuery = s.createSQLQuery(SQL_D2D_GRID_PARM_QUERY);
modelQuery.setLong("level_id", level.getId());
DatabaseID dbId = id.getDbId();
try {
IFPServerConfig config = IFPServerConfigManager
.getServerConfig(dbId.getSiteId());
try {
IFPServerConfig config = IFPServerConfigManager
.getServerConfig(dbId.getSiteId());
modelQuery.setString(GridInfoConstants.DATASET_ID,
config.d2dModelNameMapping(dbId.getModelName()));
} catch (GfeConfigurationException e) {
throw new DataAccessLayerException(
"Error occurred looking up model name mapping", e);
}
} catch (GfeConfigurationException e) {
throw new DataAccessLayerException(
"Error occurred looking up model name mapping", e);
}
String abbreviation = null;
try {
@ -793,38 +795,38 @@ public class GFEDao extends DefaultPluginDao {
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN, e.getLocalizedMessage(), e);
abbreviation = e.getArbitraryMapping();
}
}
abbreviation = abbreviation.toLowerCase();
abbreviation = abbreviation.toLowerCase();
modelQuery.setString("abbrev", abbreviation);
modelQuery.setString("hourAbbrev", abbreviation + "%hr");
List<?> results = modelQuery.list();
Integer modelId = null;
if (results.size() == 0) {
if (results.size() == 0) {
return new TreeMap<DataTime, Integer>();
} else if (results.size() > 1) {
// hours matched, take hour with least number that matches exact
// param
Pattern p = Pattern.compile("^" + abbreviation + "(\\d+)hr$");
int lowestHr = -1;
} else if (results.size() > 1) {
// hours matched, take hour with least number that matches exact
// param
Pattern p = Pattern.compile("^" + abbreviation + "(\\d+)hr$");
int lowestHr = -1;
for (Object[] rows : (List<Object[]>) results) {
String param = ((String) rows[0]).toLowerCase();
if (param.equals(abbreviation) && (lowestHr < 0)) {
if (param.equals(abbreviation) && (lowestHr < 0)) {
modelId = (Integer) rows[1];
} else {
Matcher matcher = p.matcher(param);
if (matcher.matches()) {
int hr = Integer.parseInt(matcher.group(1));
if ((lowestHr < 0) || (hr < lowestHr)) {
} else {
Matcher matcher = p.matcher(param);
if (matcher.matches()) {
int hr = Integer.parseInt(matcher.group(1));
if ((lowestHr < 0) || (hr < lowestHr)) {
modelId = (Integer) rows[1];
lowestHr = hr;
lowestHr = hr;
}
}
}
}
}
} else {
} else {
modelId = (Integer) ((Object[]) results.get(0))[1];
}
}
Query timeQuery = s.createQuery(HQL_D2D_GRID_TIME_QUERY);
timeQuery.setInteger("info_id", modelId);
@ -832,7 +834,7 @@ public class GFEDao extends DefaultPluginDao {
List<Object[]> timeResults = timeQuery.list();
if (timeResults.isEmpty()) {
return new TreeMap<DataTime, Integer>();
}
}
SortedMap<DataTime, Integer> dataTimes = new TreeMap<DataTime, Integer>();
for (Object[] rows : timeResults) {
@ -848,7 +850,7 @@ public class GFEDao extends DefaultPluginDao {
try {
s = getHibernateTemplate().getSessionFactory().openSession();
if (id.getParmName().equalsIgnoreCase("wind")) {
if (id.getParmName().equalsIgnoreCase("wind")) {
String idString = id.toString();
Matcher idWindMatcher = WIND_PATTERN.matcher(idString);
@ -858,53 +860,53 @@ public class GFEDao extends DefaultPluginDao {
List<TimeRange> uTimeList = new ArrayList<TimeRange>(
results.size());
for (DataTime o : results.keySet()) {
uTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
uTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
ParmID vWindId = new ParmID(idWindMatcher.replaceAll("vW"));
results = queryByD2DParmId(vWindId, s);
Set<TimeRange> vTimeList = new HashSet<TimeRange>(
results.size(), 1);
for (DataTime o : results.keySet()) {
vTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
vTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
for (TimeRange tr : uTimeList) {
if (vTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
for (TimeRange tr : uTimeList) {
if (vTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
}
if (!timeList.isEmpty()) {
return timeList;
}
if (!timeList.isEmpty()) {
return timeList;
}
ParmID sWindId = new ParmID(idWindMatcher.replaceAll("ws"));
results = queryByD2DParmId(sWindId, s);
List<TimeRange> sTimeList = new ArrayList<TimeRange>(
results.size());
for (DataTime o : results.keySet()) {
sTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
sTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
ParmID dWindId = new ParmID(idWindMatcher.replaceAll("wd"));
results = queryByD2DParmId(dWindId, s);
Set<TimeRange> dTimeList = new HashSet<TimeRange>(
results.size(), 1);
for (DataTime o : results.keySet()) {
dTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
dTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000));
}
for (TimeRange tr : sTimeList) {
if (dTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
for (TimeRange tr : sTimeList) {
if (dTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
} else {
}
} else {
SortedMap<DataTime, Integer> results = queryByD2DParmId(id, s);
if (isMos(id)) {
for (DataTime o : results.keySet()) {
@ -913,10 +915,10 @@ public class GFEDao extends DefaultPluginDao {
}
} else {
for (DataTime o : results.keySet()) {
timeList.add(o.getValidPeriod());
}
timeList.add(o.getValidPeriod());
}
}
}
} finally {
if (s != null) {
try {

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.gfe.server.notify;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@ -54,10 +53,13 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotificatio
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.parameter.mapping.ParameterMapper;
import com.raytheon.uf.common.serialization.SerializationUtil;
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.TimeRange;
import com.raytheon.uf.common.util.mapping.MultipleMappingException;
import com.raytheon.uf.edex.core.EDEXUtil;
/**
@ -71,6 +73,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
* ------------ ---------- ----------- --------------------------
* Aug 12, 2011 dgilling Initial creation
* Sep 19, 2012 jdynina DR 15442 fix
* Jan 18, 2013 #1504 randerso Moved D2D to GFE parameter name translation from
* D2DParmIdCache to GfeIngestNotificationFilter
*
* </pre>
*
@ -80,7 +84,7 @@ import com.raytheon.uf.edex.core.EDEXUtil;
public class GfeIngestNotificationFilter {
private static final transient IUFStatusHandler handler = UFStatus
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GfeIngestNotificationFilter.class);
private SmartInitQueue smartInitQueue = null;
@ -106,8 +110,7 @@ public class GfeIngestNotificationFilter {
}
}
public void filterGridRecords(List<GridRecord> gridRecords,
Date arrivalTime)
public void filterGridRecords(List<GridRecord> gridRecords, Date arrivalTime)
throws Exception {
StringBuilder initNameBuilder = new StringBuilder(120);
@ -126,7 +129,8 @@ public class GfeIngestNotificationFilter {
try {
config = IFPServerConfigManager.getServerConfig(site);
} catch (GfeConfigurationException e) {
handler.error("Unable to retrieve site config for " + site, e);
statusHandler.error("Unable to retrieve site config for "
+ site, e);
continue;
}
for (GridRecord grid : gridRecords) {
@ -152,24 +156,30 @@ public class GfeIngestNotificationFilter {
}
String abbrev = grid.getParameter().getAbbreviation();
String level = GridTranslator.getShortLevelName(
grid
.getLevel().getMasterLevel().getName(), grid
.getLevel().getLevelonevalue(), grid.getLevel()
.getLeveltwovalue());
ParmID parmID = new ParmID(abbrev, dbId, level);
String gfeParmName = null;
try {
gfeParmName = ParameterMapper.getInstance()
.lookupAlias(abbrev, "gfeParamName");
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN,
e.getLocalizedMessage(), e);
gfeParmName = e.getArbitraryMapping();
}
if (!gridInv.containsKey(parmID)) {
gridInv.put(parmID, new ArrayList<TimeRange>());
String level = GridTranslator.getShortLevelName(grid
ParmID parmID = new ParmID(gfeParmName, dbId, level);
List<TimeRange> trs = gridInv.get(parmID);
if (trs == null) {
trs = new ArrayList<TimeRange>();
gridInv.put(parmID, trs);
}
TimeRange validPeriod = grid.getDataTime().getValidPeriod();
if (validPeriod.getDuration() > 0) {
gridInv.get(parmID).add(validPeriod);
trs.add(validPeriod);
} else {
gridInv.get(parmID).add(
new TimeRange(grid.getDataTime()
.getValidPeriod().getStart(),
3600 * 1000));
trs.add(new TimeRange(grid.getDataTime()
.getValidPeriod().getStart(), 3600 * 1000));
}
List<String> siteInitModules = config.initModels(gfeModel);
@ -201,23 +211,20 @@ grid
// DR 15442 - move last for loop out of the for loop at line 110
for (ParmID parmId : gridInv.keySet()) {
Map<TimeRange, List<GridDataHistory>> hist = new HashMap<TimeRange, List<GridDataHistory>>();
try {
List<TimeRange> trs = gridInv.get(parmId);
Collections.sort(trs);
for (TimeRange time : trs) {
List<GridDataHistory> histList = new ArrayList<GridDataHistory>();
histList.add(new GridDataHistory(
GridDataHistory.OriginType.INITIALIZED,
parmId, time, null, (WsId) null));
GridDataHistory.OriginType.INITIALIZED, parmId,
time, null, (WsId) null));
Map<TimeRange, List<GridDataHistory>> hist = new HashMap<TimeRange, List<GridDataHistory>>();
hist.put(time, histList);
guns.add(new GridUpdateNotification(parmId, time, hist,
null, parmId.getDbId().getSiteId()));
}
guns.add(new GridUpdateNotification(parmId,
new TimeRange(trs.get(0).getStart(), trs.get(
trs.size() - 1).getEnd()), hist, null,
parmId.getDbId().getSiteId()));
} catch (Exception e) {
handler.error("Unable to retrieve grid history for "
statusHandler.error("Unable to retrieve grid history for "
+ parmId.toString(), e);
}
}
@ -225,7 +232,8 @@ grid
try {
sendNotifications(guns);
} catch (Exception e) {
handler.error("Unable to send grib ingest notifications", e);
statusHandler.error("Unable to send grib ingest notifications",
e);
}
smartInitQueue.addInits(inits.values());
@ -233,8 +241,7 @@ grid
}
public void filterSatelliteRecords(List<SatelliteRecord> records,
Date arrivalTime)
throws Exception {
Date arrivalTime) throws Exception {
StringBuilder initNameBuilder = new StringBuilder(120);
Set<String> activeSites = GFESiteActivation.getInstance()
@ -249,7 +256,8 @@ grid
try {
config = IFPServerConfigManager.getServerConfig(site);
} catch (GfeConfigurationException e) {
handler.error("Error retrieiving site config for " + site, e);
statusHandler.error(
"Error retrieiving site config for " + site, e);
continue;
}
@ -298,8 +306,8 @@ grid
try {
sendNotifications(guns);
} catch (Exception e) {
handler.error("Unable to send satellite ingest notifications",
e);
statusHandler.error(
"Unable to send satellite ingest notifications", e);
}
smartInitQueue.addInits(inits.values());

View file

@ -62,7 +62,7 @@
<pipeline>
<bean ref="stringToFile" />
<bean ref="satelliteDecoder" method="decode" />
<to uri="directvm:persistIndexAlert" />
<to uri="directvm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>

View file

@ -23,7 +23,8 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0"
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.common.datadelivery.registry,
com.raytheon.uf.common.datadelivery.registry.ebxml,
com.raytheon.uf.common.datadelivery.registry.handlers

View file

@ -0,0 +1,85 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.registry;
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Service request for {@link GroupDefinition}s.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@DynamicSerialize
public class GroupDefinitionServiceRequest extends AbstractPrivilegedRequest {
public static enum Type {
DELETE;
}
@DynamicSerializeElement
private GroupDefinition group;
@DynamicSerializeElement
private Type type;
/**
* @return the type
*/
public Type getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(Type type) {
this.type = type;
}
/**
* @return the group
*/
public GroupDefinition getGroup() {
return group;
}
/**
* @param group
* the group to set
*/
public void setGroup(GroupDefinition group) {
this.group = group;
}
}

View file

@ -8,4 +8,5 @@ Require-Bundle: com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.util;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.common.datadelivery.request;uses:="com.raytheon.uf.common.auth.req,com.raytheon.uf.common.serialization",
com.raytheon.uf.common.datadelivery.request.user;uses:="com.raytheon.uf.common.auth.user"
com.raytheon.uf.common.datadelivery.request.user;uses:="com.raytheon.uf.common.auth.user",
com.raytheon.uf.common.datadelivery.service

View file

@ -0,0 +1,69 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.service;
import java.rmi.RemoteException;
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.ExceptionWrapper;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
/**
* Base class for services that send requests to the data delivery server.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class BaseDataDeliveryService<T extends AbstractPrivilegedRequest> {
/**
* Send a request to the data delivery server.
*
* @param request
* @return
* @throws Exception
*/
protected Object sendRequest(T request) throws Exception {
Object object = RequestRouter.route(request,
DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (object instanceof SuccessfulExecution) {
SuccessfulExecution response = (SuccessfulExecution) object;
return response.getResponse();
} else {
throw new RemoteException("Error communicating with the server!",
ExceptionWrapper
.unwrapThrowable(((ServerErrorResponse) object)
.getException()));
}
}
}

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.datadelivery.service</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Tue Feb 14 11:27:19 CST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.raytheon.uf.common.datadelivery.service
Bundle-SymbolicName: com.raytheon.uf.common.datadelivery.service
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: javax.persistence
Require-Bundle:
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.datadelivery.registry;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0",
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0",
com.raytheon.uf.common.auth;bundle-version="1.12.1174"
Export-Package:
com.raytheon.uf.common.datadelivery.service

View file

@ -0,0 +1,6 @@
source.. = src/,\
res/
output.. = bin/
bin.includes = META-INF/,\
res/,\
.

View file

@ -0,0 +1,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="subscriptionNotificationService"
class="com.raytheon.uf.common.datadelivery.service.SendToServerSubscriptionNotificationService" />
</beans>

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.serialization.ISerializableObject;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;

View file

@ -0,0 +1,75 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest.Type;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
/**
* Base implementation of {@link IGroupDefinitionService}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class GroupDefinitionService extends
BaseDataDeliveryService<GroupDefinitionServiceRequest> implements
IGroupDefinitionService {
/**
* {@inheritDoc}
* @throws Exception
*/
@Override
public void deleteGroupDefinition(GroupDefinition group)
throws RegistryHandlerException {
GroupDefinitionServiceRequest request = new GroupDefinitionServiceRequest();
request.setGroup(group);
request.setType(Type.DELETE);
sendRequest(request);
}
/**
* {@inheritDoc}
*/
@Override
protected Object sendRequest(GroupDefinitionServiceRequest request)
throws RegistryHandlerException {
try {
return super.sendRequest(request);
} catch (Exception e) {
throw new RegistryHandlerException(e);
}
}
}

View file

@ -0,0 +1,52 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
/**
* Defines the service to interact with {@link GroupDefinition} objects.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public interface IGroupDefinitionService {
/**
* Delete the group definition.
*
* @param group
* the group
* @throws RegistryHandlerException
*/
void deleteGroupDefinition(GroupDefinition group)
throws RegistryHandlerException;
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.subscription;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;

View file

@ -17,13 +17,8 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.subscription;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.event.notification.ApprovedPendingSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.BaseSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.DeniedPendingSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.PendingSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.SubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.event.notification;
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap
* 8/19/09 2899 njensen Rewrote equals() for performance
* 5/08/12 #600 dgilling Implement clone().
* 6/25/12 #766 dgilling Fix isValid().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
*
* </pre>
*
@ -487,42 +488,6 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
return date;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public void setFormat(DataType format) {
this.format = format;
}
public void setFormat(String format) {
if (format.equals("GRID")) {
this.format = DataType.GRID;
} else {
this.format = DataType.NONE;
}
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public void setModelTime(String modelTime) {
this.modelTime = modelTime;
}
public void setModelId(String modelId) {
this.modelId = modelId.intern();
}
public void setShortModelId(String shortModelId) {
this.shortModelId = shortModelId;
}
public Date getModelTimeAsDate() {
if (this.modelTime.equals(NO_MODEL_TIME)) {
return new Date(0);

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap
* ------------ ---------- ----------- --------------------------
* 3/6/08 875 bphillip Initial Creation
* 5/8/12 #600 dgilling Implement clone().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
*
* </pre>
*
@ -95,12 +96,7 @@ public class ParmID implements Comparable<ParmID>, Serializable,
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(parmName).append("_");
buffer.append(parmLevel).append(":");
buffer.append(dbId.toString());
return buffer.toString();
return this.parmId;
}
/*
@ -140,7 +136,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName;
this.parmLevel = defaultLevel();
this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier();
}
@ -158,7 +153,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName;
this.parmLevel = level;
this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + level;
encodeIdentifier();
}
@ -170,7 +164,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/
public ParmID(String parmIdentifier) {
decodeIdentifier(parmIdentifier);
this.compositeName = this.parmName + "_" + this.parmLevel;
encodeIdentifier();
}
@ -186,7 +179,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName;
this.parmLevel = defaultLevel();
this.dbId = dbId;
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier();
}
@ -204,7 +196,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName;
this.parmLevel = level;
this.dbId = dbId;
this.compositeName = parmName + "_" + level;
encodeIdentifier();
}
@ -333,11 +324,9 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/
private void encodeIdentifier() {
this.compositeName = this.parmName + "_" + this.parmLevel;
shortParmId = this.compositeName + ":" + dbId.getShortModelId();
if (parmId == null || parmId.length() == 0) {
parmId = this.compositeName + ":" + dbId.getModelId();
}
parmId = this.compositeName + ":" + dbId.getModelId();
}
/**
@ -442,30 +431,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
return true;
}
public void setParmName(String parmName) {
this.parmName = parmName;
}
public void setParmLevel(String parmLevel) {
this.parmLevel = parmLevel;
}
public void setDbId(DatabaseID dbId) {
this.dbId = dbId;
}
public void setCompositeName(String compositeName) {
this.compositeName = compositeName;
}
public void setShortParmId(String shortParmId) {
this.shortParmId = shortParmId;
}
public void setParmId(String parmId) {
this.parmId = parmId;
}
/*
* (non-Javadoc)
*

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.common.time.domain.api.ITimePoint;
* Nov 09, 2012 1322 djohnson Add SECONDS_PER_MINUTE.
* Nov 21, 2012 728 mpduff Added MILLIS_PER_MONTH.
* Jan 07, 2013 1451 djohnson Add newGmtCalendar() and time constants.
* Jan 22, 2013 1484 mpduff Add HOURS_PER_WEEK.
*
* </pre>
*
@ -67,6 +68,7 @@ public class TimeUtil {
private static class NullClock extends AbstractTimer {
private static final ITimePoint CONSTANT_TIME = TimePoints
.fromMillis(1L);
@Override
protected ITimePoint getCurrentTime() {
return CONSTANT_TIME;
@ -97,6 +99,8 @@ public class TimeUtil {
private static final int DAYS_PER_WEEK = 7;
public static final int HOURS_PER_WEEK = HOURS_PER_DAY * DAYS_PER_WEEK;
// Util.java has a few of these constants, but that is located in an EDEX
// plugin and this is a more appropriate place for them anyways
public static final long MILLIS_PER_SECOND = 1000;

View file

@ -19,4 +19,5 @@ Require-Bundle: com.google.guava;bundle-version="1.0.0",
com.raytheon.uf.common.event;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.registry;bundle-version="1.0.0",
com.raytheon.uf.common.registry.event;bundle-version="1.0.0",
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0"
com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0"

View file

@ -24,19 +24,19 @@
<constructor-arg type="java.lang.String" value="jms-generic:topic:notify.msg" />
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.datadelivery.event.notification.SubscriptionNotificationRequest"/>
<constructor-arg value="com.raytheon.uf.common.datadelivery.service.SubscriptionNotificationRequest"/>
<constructor-arg ref="subscriptionNotificationHandler"/>
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.datadelivery.event.notification.ApprovedPendingSubscriptionNotificationRequest"/>
<constructor-arg value="com.raytheon.uf.common.datadelivery.service.ApprovedPendingSubscriptionNotificationRequest"/>
<constructor-arg ref="subscriptionNotificationHandler"/>
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.datadelivery.event.notification.DeniedPendingSubscriptionNotificationRequest"/>
<constructor-arg value="com.raytheon.uf.common.datadelivery.service.DeniedPendingSubscriptionNotificationRequest"/>
<constructor-arg ref="subscriptionNotificationHandler"/>
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.datadelivery.event.notification.PendingSubscriptionNotificationRequest"/>
<constructor-arg value="com.raytheon.uf.common.datadelivery.service.PendingSubscriptionNotificationRequest"/>
<constructor-arg ref="subscriptionNotificationHandler"/>
</bean>

View file

@ -21,11 +21,11 @@ package com.raytheon.uf.edex.datadelivery.event.handler;
import java.util.Calendar;
import com.raytheon.uf.common.datadelivery.event.notification.BaseSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.BaseSubscriptionNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationRequest;
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;

View file

@ -133,6 +133,13 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.datadelivery.service"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.datadelivery.service"
download-size="0"

View file

@ -21,4 +21,5 @@ Require-Bundle: com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.common.registry.event;bundle-version="1.0.0",
com.raytheon.uf.common.event;bundle-version="1.0.0",
com.google.guava;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.event;bundle-version="1.0.0"
com.raytheon.uf.common.datadelivery.event;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0"

View file

@ -12,13 +12,24 @@
<constructor-arg ref="datadeliveryAuthorization" />
</bean>
<bean id="subscriptionDeleteService"
<bean id="subscriptionDeleteServiceHandler"
class="com.raytheon.uf.edex.datadelivery.service.services.SubscriptionDeleteHandler" />
<bean id="groupDefinitionServiceHandler"
class="com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionServiceHandler">
<constructor-arg ref="subscriptionNotificationService" />
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest" />
<constructor-arg ref="subscriptionDeleteService" />
<constructor-arg ref="subscriptionDeleteServiceHandler" />
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest" />
<constructor-arg ref="groupDefinitionServiceHandler" />
</bean>
</beans>

View file

@ -0,0 +1,131 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.datadelivery.service.services;
import java.util.List;
import com.raytheon.uf.common.auth.exception.AuthorizationException;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
/**
* Handles request from the {@link IGroupDefinitionService}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class GroupDefinitionServiceHandler extends
AbstractPrivilegedRequestHandler<GroupDefinitionServiceRequest> {
private final ISubscriptionNotificationService notificationService;
/**
* Constructor.
*
* @param notificationService
* the subscription notification service
*/
public GroupDefinitionServiceHandler(
ISubscriptionNotificationService notificationService) {
this.notificationService = notificationService;
}
/**
* {@inheritDoc}
*/
@Override
public Object handleRequest(GroupDefinitionServiceRequest request)
throws Exception {
final IUser user = request.getUser();
switch (request.getType()) {
case DELETE:
handleDelete(request.getGroup(), user);
break;
}
return null;
}
/**
* Handles the delete of a group. First it updates any subscriptions in the
* group to not have a group, and then deletes the actual group.
*
* @param user
*
* @param groupDefinition
* @return
* @throws RegistryHandlerException
*/
private void handleDelete(GroupDefinition group, IUser user)
throws RegistryHandlerException {
ISubscriptionHandler handler = DataDeliveryHandlers
.getSubscriptionHandler();
List<Subscription> subsForGroup = handler.getByGroupName(group
.getGroupName());
if (!CollectionUtil.isNullOrEmpty(subsForGroup)) {
for (Subscription sub : subsForGroup) {
sub.setGroupName(GroupDefinition.NO_GROUP);
handler.update(sub);
// TODO: Would be nice to use a subset of the
// SubscriptionService functionality here so we didn't have to
// manually send the subscription updated notification
String username = user != null ? user.uniqueId().toString()
: "none";
notificationService.sendUpdatedSubscriptionNotification(sub,
username);
}
}
DataDeliveryHandlers.getGroupDefinitionHandler().delete(group);
}
/**
* {@inheritDoc}
*/
@Override
public AuthorizationResponse authorized(IUser user,
GroupDefinitionServiceRequest request)
throws AuthorizationException {
return new AuthorizationResponse(true);
}
}

View file

@ -48,50 +48,30 @@ class ParmID(object):
else:
self.parmLevel = level
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier()
elif parmIdentifier is not None:
self.__decodeIdentifier(parmIdentifier)
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier()
def getParmName(self):
return self.parmName
def setParmName(self, parmName):
self.parmName = parmName
def getParmLevel(self):
return self.parmLevel
def setParmLevel(self, parmLevel):
self.parmLevel = parmLevel
def getDbId(self):
return self.dbId
def setDbId(self, dbId):
self.dbId = dbId
def getCompositeName(self):
return self.compositeName
def setCompositeName(self, compositeName):
self.compositeName = compositeName
def getShortParmId(self):
return self.shortParmId
def setShortParmId(self, shortParmId):
self.shortParmId = shortParmId
def getParmId(self):
return self.parmId
def setParmId(self, parmId):
self.parmId = parmId
def __decodeIdentifier(self, parmIdentifier):
parts = parmIdentifier.split(":")
nameLevel = parts[0].split("_")
@ -104,9 +84,9 @@ class ParmID(object):
self.parmLevel = self.defaultLevel()
def __encodeIdentifier(self):
self.compositeName = self.parmName + "_" + self.parmLevel
self.shortParmId = self.compositeName + ":" + self.dbId.getShortModelId()
if self.parmId is None or len(self.parmId) == 0:
self.parmId = self.compositeName + ":" + self.dbId.getModelId()
self.parmId = self.compositeName + ":" + self.dbId.getModelId()
def isValid(self):
if len(self.parmName) is None or len(self.parmLevel) is None or self.dbId is None:

View file

@ -68,5 +68,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.edex.stats"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.viz.plugin.nwsauth"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.edex.plugin.nwsauth"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.datadelivery.service"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -59,7 +59,6 @@ public class ParameterFixture extends AbstractFixture<Parameter> {
obj.setBaseType("baseType" + seedValue);
obj.setDataType(DataType.GRID);
obj.setDefinition("definition" + seedValue);
obj.setEnsemble(0);
obj.setFillValue("fillValue" + seedValue);
obj.setLevels(LevelsFixture.INSTANCE.get(seedValue));
obj.setLevelType(Arrays.asList(DataLevelTypeFixture.INSTANCE

View file

@ -0,0 +1,135 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.datadelivery.registry.handlers;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.emptyCollectionOf;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinitionServiceRequest;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.RegistryManagerTest;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionServiceHandler;
/**
* Test {@link GroupDefinitionHandler}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class GroupDefinitionServiceTest {
private static final String GROUP_NAME = "someGroup";
private ISubscriptionHandler subscriptionHandler;
private IGroupDefinitionHandler groupHandler;
private final ISubscriptionNotificationService subscriptionNotificationService = mock(ISubscriptionNotificationService.class);
private final GroupDefinitionService service = new GroupDefinitionService() {
@Override
protected Object sendRequest(GroupDefinitionServiceRequest request)
throws RegistryHandlerException {
try {
return new GroupDefinitionServiceHandler(
subscriptionNotificationService).handleRequest(request);
} catch (Exception e) {
throw new RegistryHandlerException(e);
}
}
};
private final GroupDefinition group = new GroupDefinition();
@Before
public void setUp() throws RegistryHandlerException {
RegistryObjectHandlersUtil.initMemory();
RegistryManagerTest.setMockInstance();
subscriptionHandler = DataDeliveryHandlers.getSubscriptionHandler();
groupHandler = DataDeliveryHandlers.getGroupDefinitionHandler();
group.setGroupName(GROUP_NAME);
groupHandler.store(group);
Subscription subscription = new SubscriptionBuilder().withGroupName(
GROUP_NAME).build();
Subscription subscription2 = new Subscription(subscription, "sub2");
subscriptionHandler.store(subscription);
subscriptionHandler.store(subscription2);
}
@Test
public void deletingAGroupUpdatesSubscriptionsToNotHaveAGroupName()
throws RegistryHandlerException {
service.deleteGroupDefinition(group);
assertThat(subscriptionHandler.getByGroupName(GROUP_NAME),
is(emptyCollectionOf(Subscription.class)));
}
@Test
public void deletingAGroupNotifiesOfSubscriptionUpdates()
throws RegistryHandlerException {
service.deleteGroupDefinition(group);
verify(subscriptionNotificationService, times(2))
.sendUpdatedSubscriptionNotification(any(Subscription.class),
anyString());
}
@Test
public void deletingAGroupDeletesTheGroup() throws RegistryHandlerException {
service.deleteGroupDefinition(group);
assertNull(groupHandler.getByName(GROUP_NAME));
}
}

View file

@ -19,8 +19,13 @@
**/
package com.raytheon.uf.common.registry;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyList;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Ignore;
import org.mockito.Mockito;
/**
* Allows setting a specific {@link RegistryHandler} instance for test purposes.
@ -48,9 +53,23 @@ public class RegistryManagerTest {
*
* @return the mock {@link RegistryHandler}.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static RegistryHandler setMockInstance() {
RegistryHandler mock = Mockito.mock(RegistryHandler.class);
RegistryHandler mock = mock(RegistryHandler.class);
RegistryManagerTest.setInstance(mock);
RegistryQueryResponse response = mock(RegistryQueryResponse.class);
when(response.getStatus()).thenReturn(OperationStatus.SUCCESS);
// Handles the responses for deletes, stores, and updates...
// TODO: Handle retrieving objects?
when(mock.removeObjects(any(RegistryQuery.class))).thenReturn(response);
when(mock.removeObjects(anyString(), anyList())).thenReturn(response);
when(mock.removeObjects(anyString(), any(RegistryQuery.class)))
.thenReturn(response);
when(mock.storeObject(any())).thenReturn(response);
when(mock.storeOrReplaceObject(any())).thenReturn(response);
when(mock.removeObjects(anyString(), any(RegistryQuery.class)))
.thenReturn(response);
return mock;
}

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;

View file

@ -46,7 +46,7 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
* @author djohnson
* @version 1.0
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "rawtypes" })
public class OperatorAdapterTest {
@Test
@ -66,9 +66,9 @@ public class OperatorAdapterTest {
private void verifyOperatorsUnmarshalAsSameOperator(Operator... operators) {
for (Operator operator : operators) {
assertThat(operator,
is(sameInstance(OperatorAdapter.fromString(OperatorAdapter
.toString(operator)))));
Operator expected = OperatorAdapter.fromString(OperatorAdapter
.toString(operator));
assertThat(operator, is(sameInstance(expected)));
}
}