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" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.datadelivery.service"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.stats" id="com.raytheon.uf.common.stats"
download-size="0" 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.registry.ebxml;bundle-version="1.0.0",
com.raytheon.uf.common.gridcoverage;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.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-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,org.osgi.framework", 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" /> class="com.raytheon.uf.common.datadelivery.bandwidth.BandwidthService" />
<bean id="subscriptionNotificationService" <bean id="subscriptionNotificationService"
class="com.raytheon.uf.viz.datadelivery.subscription.SendToServerSubscriptionNotificationService" /> class="com.raytheon.uf.common.datadelivery.service.SendToServerSubscriptionNotificationService" />
<bean id="permissionsService" <bean id="permissionsService"
class="com.raytheon.uf.viz.datadelivery.subscription.RequestFromServerPermissionsService" /> class="com.raytheon.uf.viz.datadelivery.subscription.RequestFromServerPermissionsService" />
<bean id="groupDefinitionService"
class="com.raytheon.uf.common.datadelivery.service.GroupDefinitionService" />
<bean id="subscriptionService" <bean id="subscriptionService"
class="com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService" class="com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService"
factory-method="newInstance"> factory-method="newInstance">
@ -28,6 +31,7 @@
<property name="subscriptionNotificationService" ref="subscriptionNotificationService" /> <property name="subscriptionNotificationService" ref="subscriptionNotificationService" />
<property name="bandwidthService" ref="bandwidthService" /> <property name="bandwidthService" ref="bandwidthService" />
<property name="permissionsService" ref="permissionsService" /> <property name="permissionsService" ref="permissionsService" />
<property name="groupDefinitionService" ref="groupDefinitionService" />
</bean> </bean>
<bean id="systemRuleManager" <bean id="systemRuleManager"

View file

@ -61,7 +61,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Slider; import org.eclipse.swt.widgets.Slider;
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;

View file

@ -20,8 +20,9 @@
package com.raytheon.uf.viz.datadelivery.services; package com.raytheon.uf.viz.datadelivery.services;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService; 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.IPermissionsService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionNotificationService;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService; import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
/** /**
@ -55,6 +56,8 @@ public final class DataDeliveryServices {
private IPermissionsService permissionsService; private IPermissionsService permissionsService;
private IGroupDefinitionService groupDefinitionService;
/** /**
* Disabled constructor. * Disabled constructor.
*/ */
@ -147,4 +150,24 @@ public final class DataDeliveryServices {
public void setPermissionsService(IPermissionsService permissionsService) { public void setPermissionsService(IPermissionsService permissionsService) {
this.permissionsService = 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 org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; 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.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction; 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.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -48,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -68,6 +71,9 @@ public class DeleteGroupDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus private final IUFStatusHandler statusHandler = UFStatus
.getHandler(DeleteGroupDlg.class); .getHandler(DeleteGroupDlg.class);
private final IGroupDefinitionService groupService = DataDeliveryServices
.getGroupDefinitionService();
/** /**
* @param shell * @param shell
* @param groupAction * @param groupAction
@ -144,8 +150,11 @@ public class DeleteGroupDlg extends CaveSWTDialog {
+ groupName + "?")) { + groupName + "?")) {
try { try {
DataDeliveryHandlers.getGroupDefinitionHandler() groupService
.deleteByName(groupName); .deleteGroupDefinition(
DataDeliveryHandlers
.getGroupDefinitionHandler()
.getByName(groupName));
groupAction.loadGroupNames(); groupAction.loadGroupNames();
return true; return true;
} catch (RegistryHandlerException e) { } 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.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.Subscription; 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.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;

View file

@ -19,12 +19,14 @@
**/ **/
package com.raytheon.uf.viz.datadelivery.subscription; 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.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest; 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.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.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
/** /**
* {@link IPermissionsService} implementation that requests permissions from the * {@link IPermissionsService} implementation that requests permissions from the
@ -37,6 +39,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 04, 2013 1441 djohnson Initial creation * Jan 04, 2013 1441 djohnson Initial creation
* Jan 21, 2013 1441 djohnson Use RequestRouter.
* *
* </pre> * </pre>
* *
@ -93,8 +96,13 @@ public class RequestFromServerPermissionsService implements IPermissionsService
*/ */
private DataDeliveryAuthRequest sendAuthorizationRequest( private DataDeliveryAuthRequest sendAuthorizationRequest(
DataDeliveryAuthRequest request) throws VizException { DataDeliveryAuthRequest request) throws VizException {
return (DataDeliveryAuthRequest) ThriftClient try {
.sendPrivilegedRequest(request); 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler; 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.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; 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.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; 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 org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.auth.user.IUser; 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.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; 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.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler; 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.TableColumn;
import org.eclipse.swt.widgets.TableItem; 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.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; 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.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.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler; 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.CancelForceApplyAndIncreaseLatencyDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService; import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService.IAuthorizedPermissionResponse; 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;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult; import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse; 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.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; 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.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; 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.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText; import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.GroupDefinitionManager; 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;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult; import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView; 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.DeleteNotificationResponse;
import com.raytheon.uf.common.datadelivery.event.notification.GetNotificationRequest; import com.raytheon.uf.common.datadelivery.event.notification.GetNotificationRequest;
import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; 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.INotificationObserver;
import com.raytheon.uf.viz.core.notification.NotificationException; import com.raytheon.uf.viz.core.notification.NotificationException;
import com.raytheon.uf.viz.core.notification.NotificationMessage; 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; 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 12, 2012 jsanchez Initial creation * Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery.
* *
* </pre> * </pre>
* *
@ -115,10 +116,10 @@ public class NotificationHandler implements INotificationObserver {
request.setUsername(username); request.setUsername(username);
request.setHours(hours); request.setHours(hours);
request.setMaxResults(maxResults); request.setMaxResults(maxResults);
ArrayList<NotificationRecord> response = (ArrayList<NotificationRecord>) ThriftClient ArrayList<NotificationRecord> response = (ArrayList<NotificationRecord>) RequestRouter
.sendRequest(request); .route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return response; return response;
} catch (VizException e) { } catch (Exception e) {
statusHandler.error( statusHandler.error(
"Error trying to retrieve notifications from database", e); "Error trying to retrieve notifications from database", e);
} }
@ -139,10 +140,10 @@ public class NotificationHandler implements INotificationObserver {
try { try {
DeleteNotificationRequest request = new DeleteNotificationRequest(); DeleteNotificationRequest request = new DeleteNotificationRequest();
request.setIds(ids); request.setIds(ids);
DeleteNotificationResponse response = (DeleteNotificationResponse) ThriftClient DeleteNotificationResponse response = (DeleteNotificationResponse) RequestRouter
.sendRequest(request); .route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
rowsDeleted = response.getRowsDeleted(); rowsDeleted = response.getRowsDeleted();
} catch (VizException e) { } catch (Exception e) {
statusHandler.error( statusHandler.error(
"Error trying to delete notification(s) from database", e); "Error trying to delete notification(s) from database", e);
} }

View file

@ -364,7 +364,8 @@ public class StatsDisplayCanvas extends Canvas {
GRAPH_BORDER + GRAPH_HEIGHT, GRAPH_BORDER + GRAPH_HEIGHT,
(int) (GRAPH_BORDER + (i - startMillis) / millisPerPixelX), (int) (GRAPH_BORDER + (i - startMillis) / millisPerPixelX),
GRAPH_BORDER + GRAPH_HEIGHT + height }; 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); gc.setLineWidth(3);
} else { } else {
gc.setLineWidth(1); gc.setLineWidth(1);
@ -406,9 +407,12 @@ public class StatsDisplayCanvas extends Canvas {
buffer.setLength(0); // Clear the buffer buffer.setLength(0); // Clear the buffer
int y = GRAPH_BORDER + GRAPH_HEIGHT + 20; int y = GRAPH_BORDER + GRAPH_HEIGHT + 20;
int hr = cal.get(Calendar.HOUR_OF_DAY); int hr = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
if ((numHours <= 24) || (hour % 6 == 0 && numHours <= 168)) { if ((numHours <= 24) || (hour % 6 == 0 && numHours <= 168)) {
if (numHours <= 3) { 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); buffer.setLength(0);
int x = (int) (GRAPH_BORDER + (i - startMillis + j int x = (int) (GRAPH_BORDER + (i - startMillis + j
* TimeUtil.MILLIS_PER_MINUTE) * TimeUtil.MILLIS_PER_MINUTE)
@ -417,11 +421,12 @@ public class StatsDisplayCanvas extends Canvas {
|| (numHours == 3 && (j == 0 || j == 30))) { || (numHours == 3 && (j == 0 || j == 30))) {
String hrStr = (hr < 10) ? ZERO.concat(String String hrStr = (hr < 10) ? ZERO.concat(String
.valueOf(hr)) : String.valueOf(hr); .valueOf(hr)) : String.valueOf(hr);
if (j == 0) { if (minute == 0) {
buffer.append(hrStr).append(COLON) buffer.append(hrStr).append(COLON)
.append(MINUTE_00); .append(MINUTE_00);
} else { } else {
buffer.append(hrStr).append(COLON).append(j); buffer.append(hrStr).append(COLON)
.append(minute);
} }
int adjustment = buffer.length() * fontAveWidth / 2 int adjustment = buffer.length() * fontAveWidth / 2
- 1; - 1;
@ -437,9 +442,24 @@ public class StatsDisplayCanvas extends Canvas {
* j) * j)
/ millisPerPixelX), / millisPerPixelX),
GRAPH_BORDER }; GRAPH_BORDER };
if (hr == 0 && minute == 0) {
gc.setLineWidth(3);
}
gc.drawPolyline(gridLineArray); 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[] minorTickArray = {
(int) (GRAPH_BORDER + (i - startMillis + TimeUtil.MILLIS_PER_MINUTE (int) (GRAPH_BORDER + (i - startMillis + TimeUtil.MILLIS_PER_MINUTE
* j) * j)
@ -462,7 +482,7 @@ public class StatsDisplayCanvas extends Canvas {
if (callback.drawGridLines()) { if (callback.drawGridLines()) {
if ((numHours == 24 && hr % 6 == 0) if ((numHours == 24 && hr % 6 == 0)
|| (numHours == 168 && hr == 0)) { || (numHours == TimeUtil.HOURS_PER_WEEK && hr == 0)) {
int[] gridLineArray = { int[] gridLineArray = {
(int) (GRAPH_BORDER + (i - startMillis) (int) (GRAPH_BORDER + (i - startMillis)
@ -847,7 +867,9 @@ public class StatsDisplayCanvas extends Canvas {
/** /**
* Set the view type. * Set the view type.
* @param view The view type *
* @param view
* The view type
*/ */
public void setView(String view) { public void setView(String view) {
this.view = view; this.view = view;

View file

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

View file

@ -24,9 +24,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -109,6 +108,9 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
* on imageOnEdit * 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 * 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> * </pre>
* *
@ -256,8 +258,6 @@ public class GridCanvas extends Canvas implements IMessageClient {
private ArrayList<GridBar> gridBarList; private ArrayList<GridBar> gridBarList;
private Map<Parm, GridBar> parmToGridBar;
private Rectangle selection; private Rectangle selection;
private MenuManager menuMgr; private MenuManager menuMgr;
@ -294,7 +294,6 @@ public class GridCanvas extends Canvas implements IMessageClient {
dataMgr = gridManager.getDataManager(); dataMgr = gridManager.getDataManager();
gridBarList = new ArrayList<GridBar>(); gridBarList = new ArrayList<GridBar>();
parmToGridBar = new HashMap<Parm, GridBar>();
Parm[] displayedParms = gridManager.getDataManager().getParmManager() Parm[] displayedParms = gridManager.getDataManager().getParmManager()
.getDisplayedParms(); .getDisplayedParms();
@ -684,22 +683,22 @@ public class GridCanvas extends Canvas implements IMessageClient {
if (deletions != null) { if (deletions != null) {
for (Parm parm : deletions) { for (Parm parm : deletions) {
GridBar gridBar = parmToGridBar.remove(parm); Iterator<GridBar> iter = gridBarList.iterator();
if (gridBar != null) { while (iter.hasNext()) {
gridBarList.remove(gridBar); GridBar gridBar = iter.next();
if (gridBar.getParm().equals(parm)) {
iter.remove();
gridBar.dispose(); gridBar.dispose();
} }
} }
} }
}
if (additions != null) { if (additions != null) {
for (Parm parm : additions) { for (Parm parm : additions) {
if (!parm.getGridInfo().isTimeIndependentParm()) { if (!parm.getGridInfo().isTimeIndependentParm()) {
if (!parmToGridBar.containsKey(parm)) {
GridBar gridBar = new GridBar(this, parm, gridManager); GridBar gridBar = new GridBar(this, parm, gridManager);
gridBarList.add(gridBar); gridBarList.add(gridBar);
parmToGridBar.put(parm, gridBar);
}
} }
} }
} }

View file

@ -21,7 +21,6 @@ package com.raytheon.viz.gfe.ifpimage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection;
import java.util.Formatter; import java.util.Formatter;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -31,6 +30,7 @@ import java.util.TimeZone;
import org.eclipse.swt.graphics.RGB; 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.DataTime;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.RGBColors; 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.core.ColorUtil;
import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager; 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.Parm;
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode; import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
import com.raytheon.viz.gfe.rsc.GFELegendResource; 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 * Jul 10, 2012 15186 ryu Set legend font
* Aug 20, 2012 #1078 dgilling Fix handling of ImageLegend_color * Aug 20, 2012 #1078 dgilling Fix handling of ImageLegend_color
* setting. * 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> * </pre>
* *
@ -100,9 +103,8 @@ public class ImageLegendResource extends GFELegendResource {
@Override @Override
public LegendEntry[] getLegendData(IDescriptor descriptor) { public LegendEntry[] getLegendData(IDescriptor descriptor) {
Map<Parm, ResourcePair> parmRscMap = new HashMap<Parm, ResourcePair>(); List<Pair<Parm, ResourcePair>> parms = getLegendOrderedParms(descriptor);
Collection<Parm> parms = getLegendOrderedParms(descriptor, parmRscMap); LegendData[] data = makeLegend(parms);
LegendData[] data = makeLegend(parms, parmRscMap);
LegendEntry[] entries = new LegendEntry[data.length]; LegendEntry[] entries = new LegendEntry[data.length];
for (int i = 0; i < entries.length; ++i) { for (int i = 0; i < entries.length; ++i) {
@ -113,15 +115,15 @@ public class ImageLegendResource extends GFELegendResource {
return entries; return entries;
} }
private LegendData[] makeLegend(Collection<Parm> parms, private LegendData[] makeLegend(List<Pair<Parm, ResourcePair>> parms) {
Map<Parm, ResourcePair> parmRscMap) {
FramesInfo currInfo = descriptor.getFramesInfo(); FramesInfo currInfo = descriptor.getFramesInfo();
DataTime curTime = currInfo.getCurrentFrame(); DataTime curTime = currInfo.getCurrentFrame();
// loop through the grids // loop through the grids
List<LegendData> legendData = new ArrayList<LegendData>(); List<LegendData> legendData = new ArrayList<LegendData>();
for (Parm parm : parms) { for (Pair<Parm, ResourcePair> pair : parms) {
ResourcePair rp = parmRscMap.get(parm); Parm parm = pair.getFirst();
ResourcePair rp = pair.getSecond();
GFEResource rsc = (GFEResource) rp.getResource(); GFEResource rsc = (GFEResource) rp.getResource();
String parmName = parm.getParmID().getParmName(); String parmName = parm.getParmID().getParmName();
ResourceProperties props = rp.getProperties(); ResourceProperties props = rp.getProperties();
@ -150,7 +152,6 @@ public class ImageLegendResource extends GFELegendResource {
// get the units for the time string // get the units for the time string
String units = rsc.getParm().getGridInfo().getUnitString(); String units = rsc.getParm().getGridInfo().getUnitString();
IGridData[] gd = new IGridData[0];
Locale locale = Locale.getDefault(); Locale locale = Locale.getDefault();
String lang = getLanguage(); 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.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import org.eclipse.jface.preference.IPreferenceStore; 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.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.DataManager;
import com.raytheon.viz.gfe.core.ISpatialDisplayManager; import com.raytheon.viz.gfe.core.ISpatialDisplayManager;
import com.raytheon.viz.gfe.core.griddata.IGridData; 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;
import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient; import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient;
import com.raytheon.viz.gfe.core.msgs.ShowQuickViewDataMsg; 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. * 03/17/2008 chammack Initial Creation.
* 08/19/2009 2547 rjpeter Implement Test/Prac database display. * 08/19/2009 2547 rjpeter Implement Test/Prac database display.
* 07/10/2012 15186 ryu Clean up initInternal per Ron * 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> * </pre>
* *
* @author chammack * @author chammack
* @version 1.0 * @version 1.0
*/ */
public class GFELegendResource extends public class GFELegendResource extends
AbstractLegendResource<GFELegendResourceData> implements IMessageClient { AbstractLegendResource<GFELegendResourceData> implements
IMessageClient, INewModelAvailableListener {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GFELegendResource.class); .getHandler(GFELegendResource.class);
@ -118,8 +123,6 @@ public class GFELegendResource extends
private class GFELegendInputHandler extends InputAdapter { private class GFELegendInputHandler extends InputAdapter {
private boolean inDrag;
ResourcePair mouseDownRsc = null; ResourcePair mouseDownRsc = null;
@Override @Override
@ -158,10 +161,9 @@ public class GFELegendResource extends
if (rsc.getResource() instanceof GFEResource) { if (rsc.getResource() instanceof GFEResource) {
GFEResource gfeRsc = (GFEResource) rsc GFEResource gfeRsc = (GFEResource) rsc
.getResource(); .getResource();
DataManager GFELegendResource.this.dataManager
.getCurrentInstance() .getSpatialDisplayManager().makeVisible(
.getSpatialDisplayManager() gfeRsc.getParm(),
.makeVisible(gfeRsc.getParm(),
!props.isVisible(), false); !props.isVisible(), false);
} else { } else {
@ -173,8 +175,7 @@ public class GFELegendResource extends
} else if (mouseButton == 2) { } else if (mouseButton == 2) {
if (rsc.getResource() instanceof GFEResource) { if (rsc.getResource() instanceof GFEResource) {
GFEResource gfeRsc = (GFEResource) rsc.getResource(); GFEResource gfeRsc = (GFEResource) rsc.getResource();
ISpatialDisplayManager sdm = DataManager ISpatialDisplayManager sdm = GFELegendResource.this.dataManager
.getCurrentInstance()
.getSpatialDisplayManager(); .getSpatialDisplayManager();
Parm parm = gfeRsc.getParm(); Parm parm = gfeRsc.getParm();
@ -242,7 +243,6 @@ public class GFELegendResource extends
}.run(); }.run();
} }
@SuppressWarnings("unchecked")
public GFELegendResource(DataManager dataManager, public GFELegendResource(DataManager dataManager,
GFELegendResourceData resourceData, LoadProperties loadProps) { GFELegendResourceData resourceData, LoadProperties loadProps) {
super(resourceData, loadProps); super(resourceData, loadProps);
@ -257,8 +257,6 @@ public class GFELegendResource extends
} catch (Exception e) { } catch (Exception e) {
mode = LegendMode.GRIDS; mode = LegendMode.GRIDS;
} }
Message.registerInterest(this, ShowQuickViewDataMsg.class);
} }
protected void addSpaces(StringBuilder sb, int numSpace) { 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) * (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 descriptor
* @param parmRscMap
* optional map to create Parm->ResourcePair mapping for parms
* returned
* @return * @return
*/ */
protected Collection<Parm> getLegendOrderedParms(IDescriptor descriptor, protected List<Pair<Parm, ResourcePair>> getLegendOrderedParms(
Map<Parm, ResourcePair> parmRscMap) { IDescriptor descriptor) {
List<Parm> parms = new ArrayList<Parm>(); List<Pair<Parm, ResourcePair>> parms = new ArrayList<Pair<Parm, ResourcePair>>();
for (ResourcePair rp : descriptor.getResourceList()) { for (ResourcePair rp : descriptor.getResourceList()) {
if (rp.getResource() instanceof GFEResource) { if (rp.getResource() instanceof GFEResource) {
Parm parm = ((GFEResource) rp.getResource()).getParm(); Parm parm = ((GFEResource) rp.getResource()).getParm();
if (qvGrid == null if (qvGrid == null
|| (qvGrid != null && qvGrid.getParm() == parm)) { || (qvGrid != null && qvGrid.getParm() == parm)) {
parms.add(parm); parms.add(new Pair<Parm, ResourcePair>(parm, rp));
if (parmRscMap != null) {
parmRscMap.put(parm, rp);
}
if (qvGrid != null) { if (qvGrid != null) {
break; break;
} }
@ -346,8 +322,14 @@ public class GFELegendResource extends
} }
} }
Collections.sort(parms); Collections.sort(parms, new Comparator<Pair<Parm, ResourcePair>>() {
Collections.reverse(parms);
@Override
public int compare(Pair<Parm, ResourcePair> o1,
Pair<Parm, ResourcePair> o2) {
return o2.getFirst().compareTo(o1.getFirst());
}
});
return parms; return parms;
} }
@ -362,8 +344,7 @@ public class GFELegendResource extends
.getActivatedParm(); .getActivatedParm();
StringBuilder labelBuilder = new StringBuilder(); StringBuilder labelBuilder = new StringBuilder();
Map<Parm, ResourcePair> parmRscMap = new HashMap<Parm, ResourcePair>(); List<Pair<Parm, ResourcePair>> parms = getLegendOrderedParms(descriptor);
Collection<Parm> parms = getLegendOrderedParms(descriptor, parmRscMap);
Parm qvParm = null; Parm qvParm = null;
if (qvGrid != null) { if (qvGrid != null) {
qvParm = qvGrid.getParm(); qvParm = qvGrid.getParm();
@ -374,11 +355,12 @@ public class GFELegendResource extends
ParmID topoID = dataManager.getTopoManager().getCompositeParmID(); ParmID topoID = dataManager.getTopoManager().getCompositeParmID();
// Topmost resources: GFE Parms // Topmost resources: GFE Parms
for (Parm parm : parms) { for (Pair<Parm, ResourcePair> pair : parms) {
Parm parm = pair.getFirst();
ParmID parmId = parm.getParmID(); ParmID parmId = parm.getParmID();
DatabaseID dbId = parmId.getDbId(); DatabaseID dbId = parmId.getDbId();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
ResourcePair rp = parmRscMap.get(parm); ResourcePair rp = pair.getSecond();
GFEResource rsc = (GFEResource) rp.getResource(); GFEResource rsc = (GFEResource) rp.getResource();
LegendData ld = new LegendData(); LegendData ld = new LegendData();
ResourceProperties props = rp.getProperties(); ResourceProperties props = rp.getProperties();
@ -435,33 +417,27 @@ public class GFELegendResource extends
// get the model name // get the model name
labelBuilder.setLength(0); labelBuilder.setLength(0);
labelBuilder.append(dbId.getModelName()); labelBuilder.append(dbId.getShortModelId());
boolean iscTyped = false; // FIXME this is from A1 and is not consistent with the code in
if (dataManager.getParmManager().iscMode() // getLongestFields
&& dbId.equals(dataManager.getParmManager()
.getMutableDatabase())) {
ParmID iscPID = dataManager.getParmManager().getISCParmID( // if (_showISCMode && _quickViewGrid == GridID()
parmId); // && _grids[i].gridID().parm()->parmID().databaseID() ==
if (iscPID.isValid()) { // _dbss->dataManager()->parmMgr()->mutableDatabase())
// vparms (i.e. temp hazards) can't get here // {
String iscStr = "+" + iscPID.getDbId().getDbType() // unsigned int mpos = 0;
+ iscPID.getDbId().getModelName(); // if (modelText.found(' ', mpos))
labelBuilder.append(iscStr); // {
iscTyped = true; // 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()); sb.append(labelBuilder.toString());
diff = lengths[3] - labelBuilder.length(); diff = lengths[3] - labelBuilder.length();
addSpaces(sb, diff + 1); addSpaces(sb, diff + 1);
@ -562,16 +538,14 @@ public class GFELegendResource extends
* @param descriptor * @param descriptor
* @return * @return
*/ */
private int[] getLongestFields(Collection<Parm> parms) { private int[] getLongestFields(List<Pair<Parm, ResourcePair>> parms) {
// Iterator<ResourcePair> rl = descriptor.getResourceList().iterator(); // Iterator<ResourcePair> rl = descriptor.getResourceList().iterator();
int[] sz = new int[4]; int[] sz = new int[4];
StringBuilder labelBuilder = new StringBuilder(); StringBuilder labelBuilder = new StringBuilder();
// synchronized (rl) { // synchronized (rl) {
// while (rl.hasNext()) { // while (rl.hasNext()) {
for (Parm parm : parms) { for (Pair<Parm, ResourcePair> pair : parms) {
// AbstractVizResource<?, ?> resource = rl.next().getResource(); Parm parm = pair.getFirst();
// if (resource instanceof GFEResource) {
// Parm parm = ((GFEResource) resource).getParm();
ParmID parmId = parm.getParmID(); ParmID parmId = parm.getParmID();
sz[0] = Math.max(sz[0], parmId.getParmName().length()); sz[0] = Math.max(sz[0], parmId.getParmName().length());
sz[1] = Math.max(sz[1], parmId.getParmLevel().length()); sz[1] = Math.max(sz[1], parmId.getParmLevel().length());
@ -580,52 +554,33 @@ public class GFELegendResource extends
DatabaseID dbId = parmId.getDbId(); DatabaseID dbId = parmId.getDbId();
labelBuilder.setLength(0); labelBuilder.setLength(0);
labelBuilder.append(dbId.getModelName()); labelBuilder.append(dbId.getShortModelId());
boolean iscTyped = false; // FIXME this is A1 code and is not consistent with the code in
if (dataManager.getParmManager().iscMode() // getLegendDataGrids
&& dbId.equals(dataManager.getParmManager()
.getMutableDatabase())) {
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 // if (showIscMode
// && ids[i].gridID().parm()->parmID().databaseID() == // && ids[i].gridID().parm()->parmID().databaseID() ==
// _dbss->dataManager()->parmMgr()->mutableDatabase()) // _dbss->dataManager()->parmMgr()->mutableDatabase())
// label += "+VISC"; // label += "+VISC";
sz[3] = Math.max(sz[3], labelBuilder.length());
// } sz[3] = Math.max(sz[3], labelBuilder.length());
} }
// }
return sz; return sz;
} }
@SuppressWarnings("unchecked")
@Override @Override
protected void disposeInternal() { protected void disposeInternal() {
super.disposeInternal(); super.disposeInternal();
this.dataManager.getParmManager().removeNewModelAvailableListener(this);
Message.unregisterInterest(this, ShowQuickViewDataMsg.class);
if (font != null) { if (font != null) {
font.dispose(); font.dispose();
font = null;
} }
IDisplayPaneContainer container = getResourceContainer(); IDisplayPaneContainer container = getResourceContainer();
if (container != null) { if (container != null) {
@ -633,9 +588,14 @@ public class GFELegendResource extends
} }
} }
@SuppressWarnings("unchecked")
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
super.initInternal(target); super.initInternal(target);
Message.registerInterest(this, ShowQuickViewDataMsg.class);
this.dataManager.getParmManager().addNewModelAvailableListener(this);
int fontNum = 3; int fontNum = 3;
if (GFEPreference.contains("SELegend_font")) { if (GFEPreference.contains("SELegend_font")) {
fontNum = GFEPreference.getIntPreference("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"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="jmock-2.0.0.jar" sourcepath="org.junitsrc.zip"/> <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="mockito-all-1.9.0.jar"/>
<classpathentry exported="true" kind="lib" path="objenesis-1.2.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="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"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -11,7 +11,8 @@ Bundle-ClassPath: jmock-2.0.0.jar,
mockito-all-1.9.0.jar, mockito-all-1.9.0.jar,
objenesis-1.2.jar, objenesis-1.2.jar,
powermock-mockito-1.4.12-full.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, Export-Package: javassist,
javassist.bytecode, javassist.bytecode,
javassist.bytecode.analysis, javassist.bytecode.analysis,
@ -43,8 +44,28 @@ Export-Package: javassist,
net.sf.cglib.transform.impl, net.sf.cglib.transform.impl,
net.sf.cglib.util, net.sf.cglib.util,
org.hamcrest, org.hamcrest,
org.hamcrest.beans,
org.hamcrest.collection,
org.hamcrest.core, 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.internal,
org.hamcrest.number,
org.hamcrest.object,
org.hamcrest.text,
org.hamcrest.xml,
org.jmock, org.jmock,
org.jmock.api, org.jmock.api,
org.jmock.example.qcon, org.jmock.example.qcon,

View file

@ -8,4 +8,5 @@ bin.includes = META-INF/,\
mockito-all-1.9.0.jar,\ mockito-all-1.9.0.jar,\
objenesis-1.2.jar,\ objenesis-1.2.jar,\
powermock-mockito-1.4.12-full.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): def getParmId(self):
return self.__pid.getParmId() 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 @staticmethod
def shortSerializer(parmID): def shortSerializer(parmID):
return JavaParmID.shortSerializer(parmID.javaParmId()) return JavaParmID.shortSerializer(parmID.javaParmId())

View file

@ -21,6 +21,7 @@
package com.raytheon.edex.plugin.gfe.cache.d2dparms; package com.raytheon.edex.plugin.gfe.cache.d2dparms;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; 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.D2DSatDatabase;
import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager; import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; 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.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.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.database.DataAccessLayerException;
import com.raytheon.uf.edex.site.SiteAwareRegistry; 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 * 01/08/09 1674 bphillip Initial creation
* 11/05/12 #1310 dgilling Modify cache to listen to plugin * 11/05/12 #1310 dgilling Modify cache to listen to plugin
* purged topic. * 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> * </pre>
* *
* @author bphillip * @author bphillip
@ -77,8 +85,19 @@ public class D2DParmIdCache {
private static final Pattern RangeFilter = Pattern private static final Pattern RangeFilter = Pattern
.compile("(.*?)\\d{1,2}hr"); .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 */ /** 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; private static D2DParmIdCache instance;
@ -93,7 +112,8 @@ public class D2DParmIdCache {
* Constructs a new D2DParmIdCache * Constructs a new D2DParmIdCache
*/ */
public 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) { private void putParmIDInternal(ParmID parmId) {
DatabaseID dbId = parmId.getDbId();
synchronized (parmIds) { synchronized (parmIds) {
Set<ParmID> dbParms = parmIds.get(dbId);
// Add the database entry to the map if it does not exist // Add the database entry to the map if it does not exist
if (!parmIds.containsKey(parmId.getDbId().toString())) { if (dbParms == null) {
parmIds.put(parmId.getDbId().toString(), new HashSet<String>()); 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);
}
} }
/** // Insert the ParmID into the map
* Places a parmId into the cache dbParms.add(parmId);
* }
* @param parmId
* String representation of a ParmID
*/
public void putParmID(String parmId) {
putParmID(new ParmID(parmId));
} }
/** /**
@ -209,18 +194,10 @@ public class D2DParmIdCache {
* @return The ParmIDs in the given DatabaseID * @return The ParmIDs in the given DatabaseID
*/ */
public List<ParmID> getParmIDs(DatabaseID dbId) { public List<ParmID> getParmIDs(DatabaseID dbId) {
Set<String> parmStrings = null; List<ParmID> parms = Collections.emptyList();
synchronized (parmIds) { synchronized (parmIds) {
if (parmIds.containsKey(dbId.toString())) { if (parmIds.containsKey(dbId.toString())) {
parmStrings = new HashSet<String>(parmIds.get(dbId.toString())); parms = new ArrayList<ParmID>(parmIds.get(dbId));
}
}
List<ParmID> parms = Collections.emptyList();
if (parmStrings != null) {
parms = new ArrayList<ParmID>(parmStrings.size());
for (String parmStr : parmStrings) {
parms.add(new ParmID(parmStr));
} }
} }
return parms; return parms;
@ -244,14 +221,9 @@ public class D2DParmIdCache {
* @return The list of DatabaseIDs * @return The list of DatabaseIDs
*/ */
public List<DatabaseID> getDatabaseIDs() { public List<DatabaseID> getDatabaseIDs() {
Set<String> dbStrs; List<DatabaseID> dbIds = null;
synchronized (parmIds) { synchronized (parmIds) {
dbStrs = new HashSet<String>(parmIds.keySet()); dbIds = new ArrayList<DatabaseID>(parmIds.keySet());
}
List<DatabaseID> dbIds = new ArrayList<DatabaseID>(dbStrs.size());
for (String dbId : dbStrs) {
dbIds.add(new DatabaseID(dbId));
} }
return dbIds; return dbIds;
} }
@ -382,6 +354,19 @@ public class D2DParmIdCache {
for (DatabaseID dbId : dbsToRemove) { for (DatabaseID dbId : dbsToRemove) {
GridParmManager.removeDbFromMap(dbId); 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, statusHandler.handle(Priority.EVENTA,
"Total time to build D2DParmIdCache for " + siteID "Total time to build D2DParmIdCache for " + siteID
+ " took " + (System.currentTimeMillis() - start) + " took " + (System.currentTimeMillis() - start)
@ -397,7 +382,7 @@ public class D2DParmIdCache {
public long getSize() { public long getSize() {
long size = 0; long size = 0;
synchronized (parmIds) { synchronized (parmIds) {
for (Set<String> parms : parmIds.values()) { for (Set<ParmID> parms : parmIds.values()) {
size += parms.size(); size += parms.size();
} }
} }
@ -410,4 +395,63 @@ public class D2DParmIdCache {
buildCache(null); 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

@ -35,6 +35,8 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotificatio
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 1/10/09 1674 bphillip Initial creation * 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> * </pre>
* *
@ -53,8 +55,8 @@ public class D2DParmIdFilter {
public void updateParmIdCache(List<? extends GfeNotification> notifications) { public void updateParmIdCache(List<? extends GfeNotification> notifications) {
for (GfeNotification notify : notifications) { for (GfeNotification notify : notifications) {
if (notify instanceof GridUpdateNotification) { if (notify instanceof GridUpdateNotification) {
D2DParmIdCache.getInstance().putParmID( D2DParmIdCache.getInstance().processGridUpdateNotification(
((GridUpdateNotification) notify).getParmId()); (GridUpdateNotification) notify);
} }
} }
} }

View file

@ -108,6 +108,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 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 * adding it to the inventory
* 12/06/12 #1394 rjpeter Optimized D2D grid access. * 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> * </pre>
* *
* @author bphillip * @author bphillip

View file

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

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.gridcoverage;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;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, Export-Package: com.raytheon.uf.common.datadelivery.registry,
com.raytheon.uf.common.datadelivery.registry.ebxml, com.raytheon.uf.common.datadelivery.registry.ebxml,
com.raytheon.uf.common.datadelivery.registry.handlers 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.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.util;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", 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.DynamicSerialize;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.Subscription;
import com.raytheon.uf.common.serialization.ISerializableObject; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.InitialPendingSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.Subscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; 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 * 8/19/09 2899 njensen Rewrote equals() for performance
* 5/08/12 #600 dgilling Implement clone(). * 5/08/12 #600 dgilling Implement clone().
* 6/25/12 #766 dgilling Fix isValid(). * 6/25/12 #766 dgilling Fix isValid().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
* *
* </pre> * </pre>
* *
@ -487,42 +488,6 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
return date; 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() { public Date getModelTimeAsDate() {
if (this.modelTime.equals(NO_MODEL_TIME)) { if (this.modelTime.equals(NO_MODEL_TIME)) {
return new Date(0); 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 * 3/6/08 875 bphillip Initial Creation
* 5/8/12 #600 dgilling Implement clone(). * 5/8/12 #600 dgilling Implement clone().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
* *
* </pre> * </pre>
* *
@ -95,12 +96,7 @@ public class ParmID implements Comparable<ParmID>, Serializable,
@Override @Override
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); return this.parmId;
buffer.append(parmName).append("_");
buffer.append(parmLevel).append(":");
buffer.append(dbId.toString());
return buffer.toString();
} }
/* /*
@ -140,7 +136,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = defaultLevel(); this.parmLevel = defaultLevel();
this.dbId = new DatabaseID(parmModel); this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier(); encodeIdentifier();
} }
@ -158,7 +153,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = level; this.parmLevel = level;
this.dbId = new DatabaseID(parmModel); this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + level;
encodeIdentifier(); encodeIdentifier();
} }
@ -170,7 +164,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/ */
public ParmID(String parmIdentifier) { public ParmID(String parmIdentifier) {
decodeIdentifier(parmIdentifier); decodeIdentifier(parmIdentifier);
this.compositeName = this.parmName + "_" + this.parmLevel;
encodeIdentifier(); encodeIdentifier();
} }
@ -186,7 +179,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = defaultLevel(); this.parmLevel = defaultLevel();
this.dbId = dbId; this.dbId = dbId;
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier(); encodeIdentifier();
} }
@ -204,7 +196,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = level; this.parmLevel = level;
this.dbId = dbId; this.dbId = dbId;
this.compositeName = parmName + "_" + level;
encodeIdentifier(); encodeIdentifier();
} }
@ -333,12 +324,10 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/ */
private void encodeIdentifier() { private void encodeIdentifier() {
this.compositeName = this.parmName + "_" + this.parmLevel;
shortParmId = this.compositeName + ":" + dbId.getShortModelId(); shortParmId = this.compositeName + ":" + dbId.getShortModelId();
if (parmId == null || parmId.length() == 0) {
parmId = this.compositeName + ":" + dbId.getModelId(); parmId = this.compositeName + ":" + dbId.getModelId();
} }
}
/** /**
* @return the parmName * @return the parmName
@ -442,30 +431,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
return true; 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) * (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 09, 2012 1322 djohnson Add SECONDS_PER_MINUTE.
* Nov 21, 2012 728 mpduff Added MILLIS_PER_MONTH. * Nov 21, 2012 728 mpduff Added MILLIS_PER_MONTH.
* Jan 07, 2013 1451 djohnson Add newGmtCalendar() and time constants. * Jan 07, 2013 1451 djohnson Add newGmtCalendar() and time constants.
* Jan 22, 2013 1484 mpduff Add HOURS_PER_WEEK.
* *
* </pre> * </pre>
* *
@ -67,6 +68,7 @@ public class TimeUtil {
private static class NullClock extends AbstractTimer { private static class NullClock extends AbstractTimer {
private static final ITimePoint CONSTANT_TIME = TimePoints private static final ITimePoint CONSTANT_TIME = TimePoints
.fromMillis(1L); .fromMillis(1L);
@Override @Override
protected ITimePoint getCurrentTime() { protected ITimePoint getCurrentTime() {
return CONSTANT_TIME; return CONSTANT_TIME;
@ -97,6 +99,8 @@ public class TimeUtil {
private static final int DAYS_PER_WEEK = 7; 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 // 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 // plugin and this is a more appropriate place for them anyways
public static final long MILLIS_PER_SECOND = 1000; 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.event;bundle-version="1.0.0",
com.raytheon.uf.common.datadelivery.registry;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.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" /> <constructor-arg type="java.lang.String" value="jms-generic:topic:notify.msg" />
</bean> </bean>
<bean factory-bean="handlerRegistry" factory-method="register"> <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"/> <constructor-arg ref="subscriptionNotificationHandler"/>
</bean> </bean>
<bean factory-bean="handlerRegistry" factory-method="register"> <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"/> <constructor-arg ref="subscriptionNotificationHandler"/>
</bean> </bean>
<bean factory-bean="handlerRegistry" factory-method="register"> <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"/> <constructor-arg ref="subscriptionNotificationHandler"/>
</bean> </bean>
<bean factory-bean="handlerRegistry" factory-method="register"> <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"/> <constructor-arg ref="subscriptionNotificationHandler"/>
</bean> </bean>

View file

@ -21,11 +21,11 @@ package com.raytheon.uf.edex.datadelivery.event.handler;
import java.util.Calendar; 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.event.notification.NotificationRecord;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler; 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.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;

View file

@ -133,6 +133,13 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.datadelivery.service"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.edex.datadelivery.service" id="com.raytheon.uf.edex.datadelivery.service"
download-size="0" 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.registry.event;bundle-version="1.0.0",
com.raytheon.uf.common.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.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" /> <constructor-arg ref="datadeliveryAuthorization" />
</bean> </bean>
<bean id="subscriptionDeleteService" <bean id="subscriptionDeleteServiceHandler"
class="com.raytheon.uf.edex.datadelivery.service.services.SubscriptionDeleteHandler" /> 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"> <bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg <constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest" /> 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> </bean>
</beans> </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: else:
self.parmLevel = level self.parmLevel = level
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier() self.__encodeIdentifier()
elif parmIdentifier is not None: elif parmIdentifier is not None:
self.__decodeIdentifier(parmIdentifier) self.__decodeIdentifier(parmIdentifier)
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier() self.__encodeIdentifier()
def getParmName(self): def getParmName(self):
return self.parmName return self.parmName
def setParmName(self, parmName):
self.parmName = parmName
def getParmLevel(self): def getParmLevel(self):
return self.parmLevel return self.parmLevel
def setParmLevel(self, parmLevel):
self.parmLevel = parmLevel
def getDbId(self): def getDbId(self):
return self.dbId return self.dbId
def setDbId(self, dbId):
self.dbId = dbId
def getCompositeName(self): def getCompositeName(self):
return self.compositeName return self.compositeName
def setCompositeName(self, compositeName):
self.compositeName = compositeName
def getShortParmId(self): def getShortParmId(self):
return self.shortParmId return self.shortParmId
def setShortParmId(self, shortParmId):
self.shortParmId = shortParmId
def getParmId(self): def getParmId(self):
return self.parmId return self.parmId
def setParmId(self, parmId):
self.parmId = parmId
def __decodeIdentifier(self, parmIdentifier): def __decodeIdentifier(self, parmIdentifier):
parts = parmIdentifier.split(":") parts = parmIdentifier.split(":")
nameLevel = parts[0].split("_") nameLevel = parts[0].split("_")
@ -104,8 +84,8 @@ class ParmID(object):
self.parmLevel = self.defaultLevel() self.parmLevel = self.defaultLevel()
def __encodeIdentifier(self): def __encodeIdentifier(self):
self.compositeName = self.parmName + "_" + self.parmLevel
self.shortParmId = self.compositeName + ":" + self.dbId.getShortModelId() 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): def isValid(self):

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.edex.stats"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.viz.plugin.nwsauth"/> <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.edex.plugin.nwsauth"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.datadelivery.service"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -59,7 +59,6 @@ public class ParameterFixture extends AbstractFixture<Parameter> {
obj.setBaseType("baseType" + seedValue); obj.setBaseType("baseType" + seedValue);
obj.setDataType(DataType.GRID); obj.setDataType(DataType.GRID);
obj.setDefinition("definition" + seedValue); obj.setDefinition("definition" + seedValue);
obj.setEnsemble(0);
obj.setFillValue("fillValue" + seedValue); obj.setFillValue("fillValue" + seedValue);
obj.setLevels(LevelsFixture.INSTANCE.get(seedValue)); obj.setLevels(LevelsFixture.INSTANCE.get(seedValue));
obj.setLevelType(Arrays.asList(DataLevelTypeFixture.INSTANCE 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; 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.junit.Ignore;
import org.mockito.Mockito;
/** /**
* Allows setting a specific {@link RegistryHandler} instance for test purposes. * Allows setting a specific {@link RegistryHandler} instance for test purposes.
@ -48,9 +53,23 @@ public class RegistryManagerTest {
* *
* @return the mock {@link RegistryHandler}. * @return the mock {@link RegistryHandler}.
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static RegistryHandler setMockInstance() { public static RegistryHandler setMockInstance() {
RegistryHandler mock = Mockito.mock(RegistryHandler.class); RegistryHandler mock = mock(RegistryHandler.class);
RegistryManagerTest.setInstance(mock); 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; 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.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; 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.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult; 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 * @author djohnson
* @version 1.0 * @version 1.0
*/ */
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "rawtypes" })
public class OperatorAdapterTest { public class OperatorAdapterTest {
@Test @Test
@ -66,9 +66,9 @@ public class OperatorAdapterTest {
private void verifyOperatorsUnmarshalAsSameOperator(Operator... operators) { private void verifyOperatorsUnmarshalAsSameOperator(Operator... operators) {
for (Operator operator : operators) { for (Operator operator : operators) {
assertThat(operator, Operator expected = OperatorAdapter.fromString(OperatorAdapter
is(sameInstance(OperatorAdapter.fromString(OperatorAdapter .toString(operator));
.toString(operator))))); assertThat(operator, is(sameInstance(expected)));
} }
} }