Issue #1841 Split up Subscription hierarchy in support of shared subscriptions.

Amend:
   Use TimeUtil.newGmtCalendar() and remove whitespace only change
   Add TODO for point data types.

Change-Id: If232ef50a63066e85b122d4247fa767fc31313d3

Former-commit-id: 6129d86be4 [formerly b91593c0a50114e4766ecf83d92e7f25b58bbbf8]
Former-commit-id: c981b7250f
This commit is contained in:
Dustin Johnson 2013-03-29 09:07:22 -05:00
parent e994040887
commit 48a2002e68
73 changed files with 2592 additions and 935 deletions

View file

@ -37,6 +37,8 @@ Export-Package: com.raytheon.uf.viz.datadelivery;uses:="org.eclipse.ui.plugin,or
com.raytheon.uf.viz.datadelivery.actions;uses:="org.eclipse.core.commands",
com.raytheon.uf.viz.datadelivery.comm,
com.raytheon.uf.viz.datadelivery.subscription;uses:="com.raytheon.uf.viz.datadelivery.test.subscription.xml,com.raytheon.viz.ui.dialogs,org.eclipse.swt.widgets",
com.raytheon.uf.viz.datadelivery.subscription.subset,
com.raytheon.uf.viz.datadelivery.subscription.xml;uses:="com.raytheon.uf.common.serialization"
Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.message
Eclipse-BuddyPolicy: ext, registered, global

View file

@ -6,8 +6,13 @@
<!-- Creation of the handlers -->
<bean name="UserSubscriptionHandler"
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
<bean name="SubscriptionHandler"
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler" />
class="com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler">
<constructor-arg ref="UserSubscriptionHandler" />
</bean>
<bean name="PendingSubscriptionHandler"
class="com.raytheon.uf.viz.datadelivery.handlers.VizPendingSubscriptionHandler" />
@ -38,59 +43,82 @@
<!-- The actual registering of the handlers -->
<bean id="registryObjectHandlerRegistry" class="com.raytheon.uf.common.registry.handler.RegistryObjectHandlers" factory-method="getInstance"/>
<bean id="registryObjectHandlerRegistry"
class="com.raytheon.uf.common.registry.handler.RegistryObjectHandlers"
factory-method="getInstance" />
<bean id="registerSubscriptionHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler" />
<bean id="registerSubscriptionHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler" />
<constructor-arg ref="SubscriptionHandler" />
</bean>
<bean id="registerPendingSubscriptionHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler" />
<bean id="registerPendingSubscriptionHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler" />
<constructor-arg ref="PendingSubscriptionHandler" />
</bean>
<bean id="registerGroupDefinitionHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IGroupDefinitionHandler" />
<bean id="registerGroupDefinitionHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IGroupDefinitionHandler" />
<constructor-arg ref="GroupDefinitionHandler" />
</bean>
<bean id="registerProviderHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler" />
<bean id="registerProviderHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler" />
<constructor-arg ref="ProviderHandler" />
</bean>
<bean id="registerDataSetNameHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetNameHandler" />
<bean id="registerDataSetNameHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetNameHandler" />
<constructor-arg ref="DataSetNameHandler" />
</bean>
<bean id="registerParameterHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IParameterHandler" />
<bean id="registerParameterHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IParameterHandler" />
<constructor-arg ref="ParameterHandler" />
</bean>
<bean id="registerParameterLevelHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IParameterLevelHandler" />
<bean id="registerParameterLevelHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IParameterLevelHandler" />
<constructor-arg ref="ParameterLevelHandler" />
</bean>
<bean id="registerDataSetMetaDataHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHandler" />
<bean id="registerDataSetMetaDataHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHandler" />
<constructor-arg ref="DataSetMetaDataHandler" />
</bean>
<bean id="registerGriddedDataSetMetaDataHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IGriddedDataSetMetaDataHandler" />
<bean id="registerGriddedDataSetMetaDataHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IGriddedDataSetMetaDataHandler" />
<constructor-arg ref="GriddedDataSetMetaDataHandler" />
</bean>
<bean id="registerDataSetHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetHandler" />
<bean id="registerDataSetHandler" factory-bean="registryObjectHandlerRegistry"
factory-method="registerHandler">
<constructor-arg
value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetHandler" />
<constructor-arg ref="DataSetHandler" />
</bean>
<!-- Used to consolidate the dependency clauses of beans that rely upon data delivery registry handlers -->
<!-- Used to consolidate the dependency clauses of beans that rely upon
data delivery registry handlers -->
<bean id="registerDataDeliveryHandlers" class="java.lang.String"
depends-on="registerSubscriptionHandler,registerPendingSubscriptionHandler,
registerGroupDefinitionHandler,

View file

@ -23,6 +23,7 @@ import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.IUserSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -41,6 +42,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
* ------------ ---------- ----------- --------------------------
* Sep 27, 2012 1187 djohnson Initial creation
* Nov 15, 2012 1286 djohnson Use server-keyed routing.
* Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler.
*
* </pre>
*
@ -50,6 +52,16 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
public class VizSubscriptionHandler extends SubscriptionHandler {
/**
* Constructor.
*
* @param userSubscriptionHandler
*/
public VizSubscriptionHandler(
IUserSubscriptionHandler userSubscriptionHandler) {
super(userSubscriptionHandler);
}
/**
* {@inheritDoc}
*/

View file

@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
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;
@ -62,6 +63,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Aug 31, 2012 1128 mpduff Notification Fixes.
* Nov 28, 2012 1286 djohnson Use the subscription service.
* Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -98,7 +100,8 @@ public class GroupAddDlg extends CaveSWTDialog {
* @param callback
* callback to parent shell
*/
public GroupAddDlg(Shell parent, Subscription subscription, IGroupAction callback) {
public GroupAddDlg(Shell parent, Subscription subscription,
IGroupAction callback) {
super(parent, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL);
setText("Add To Group");
this.subscription = subscription;
@ -250,7 +253,12 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999);
subscription.setOfficeID(LocalizationManager.getInstance().getCurrentSite());
subscription.setOwner(username);
// TODO: How to do this better? Will shared subscriptions participate in
// groups?
if (subscription instanceof UserSubscription) {
((UserSubscription) subscription).setOwner(username);
}
try {
DataDeliveryHandlers.getSubscriptionHandler().store(subscription);

View file

@ -22,7 +22,9 @@ package com.raytheon.uf.viz.datadelivery.subscription;
import java.rmi.RemoteException;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService;
@ -41,6 +43,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Jan 04, 2013 1441 djohnson Initial creation
* Jan 21, 2013 1441 djohnson Use RequestRouter.
* Feb 26, 2013 1643 djohnson Extends base class.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -95,6 +98,21 @@ public class RequestFromServerPermissionsService extends
final IUser user, String notAuthorizedMessage,
final Subscription subscription) throws VizException {
// TODO: Can this be done better?
if (subscription instanceof UserSubscription) {
return checkPermissionToChangeSubscription(user,
notAuthorizedMessage, (UserSubscription) subscription);
} else {
return checkPermissionToChangeSubscription(user,
notAuthorizedMessage, (SharedSubscription) subscription);
}
}
private IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
final IUser user, String notAuthorizedMessage,
final UserSubscription subscription) throws VizException {
final IAuthorizedPermissionResponse r = checkPermissions(user,
notAuthorizedMessage,
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE,
@ -123,6 +141,18 @@ public class RequestFromServerPermissionsService extends
}
}
private IAuthorizedPermissionResponse checkPermissionToChangeSubscription(
final IUser user, String notAuthorizedMessage,
final SharedSubscription subscription) throws VizException {
// TODO: New permission to approve/change shared subscriptions?
final IAuthorizedPermissionResponse r = checkPermissions(user,
notAuthorizedMessage,
DataDeliveryPermission.SUBSCRIPTION_APPROVE_SITE);
return r;
}
/**
* {@inheritDoc}
*/
@ -147,7 +177,6 @@ public class RequestFromServerPermissionsService extends
request.addRequestedPermissions(permissions);
request.setNotAuthorizedMessage(notAuthorizedMessage);
try {
DataDeliveryAuthRequest r = sendRequest(request,
DataDeliveryAuthRequest.class);

View file

@ -115,6 +115,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Jan 21, 2013 1501 djohnson Only send notification if subscription was actually activated/deactivated,
* remove race condition of GUI thread updating the table after notification.
* Jan 22, 2013 1520 mpduff Removed menu accelerators.
* Mar 29, 2013 1841 djohnson Subscription implementations now provide a copy method.
* </pre>
*
* @author mpduff
@ -710,7 +711,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
if (newName != null && newName.length() > 0
&& !newName.equals(sub.getName())) {
Subscription newSub = new Subscription(sub, newName);
Subscription newSub = sub.copy(newName);
// Object is copied, now store it
try {

View file

@ -72,6 +72,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Dec 20, 2012 1413 bgonzale Added new pending approve and denied request and responses.
* Jan 04, 2013 1441 djohnson Separated out notification methods into their own service.
* Jan 28, 2013 1530 djohnson Reset unscheduled flag with each update.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -446,8 +447,8 @@ public class SubscriptionService implements ISubscriptionService {
DataDeliveryHandlers.getSubscriptionHandler()
.update(subscription);
} else {
PendingSubscription pendingSub = new PendingSubscription(
subscription, username);
PendingSubscription pendingSub = subscription
.pending(username);
pendingSub
.setChangeReason("Group Definition Changed");
savePendingSub(pendingSub, username);

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
@ -88,6 +89,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Nov 20, 2012 1286 djohnson Implement IDisplay to display yes/no prompt.
* Nov 28, 2012 1286 djohnson Use subscriptionService for notification, and only notify when actually approved.
* Dec 12, 2012 1433 bgonzale Use new subscription copy ctor method for approval of pending subscription.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -490,7 +492,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
String username = System.getenv().get("LOGNAME");
for (SubscriptionApprovalRowData rd: subList) {
InitialPendingSubscription ps = rd.getSubscription();
Subscription s = new Subscription(ps);
// TODO: Add support for pending shared subscriptions
UserSubscription s = new UserSubscription(ps);
IPendingSubscriptionHandler pendingSubHandler = RegistryObjectHandlers
.get(IPendingSubscriptionHandler.class);

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Jan 14, 2013 1286 djohnson Check that message to display is not null or empty, and
* only send notification of subscription creation on OK status.
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers, default to existing priority on edit.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* </pre>
*
* @author mpduff
@ -602,8 +603,8 @@ public class CreateSubscriptionDlgPresenter {
job.schedule();
return false;
} else {
InitialPendingSubscription pendingSub = new InitialPendingSubscription(
subscription, currentUser);
InitialPendingSubscription pendingSub = subscription
.initialPending(currentUser);
try {
handler.store(pendingSub);
@ -624,8 +625,8 @@ public class CreateSubscriptionDlgPresenter {
}
} else {
// Check for pending subscription, can only have one pending change
PendingSubscription pendingSub = new PendingSubscription(
subscription, LocalizationManager.getInstance()
PendingSubscription pendingSub = subscription
.pending(LocalizationManager.getInstance()
.getCurrentUser());
pendingSub.setChangeReason(view.getChangeReason());

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.serialization.JAXBManager;
@ -87,6 +88,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Jan 18, 2013 1414 bsteffen Add ensemble tab.
* Jan 28, 2013 1533 djohnson Update the calculated dataset size after loading subset xml.
* Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
*
* </pre>
@ -256,7 +258,7 @@ public class GriddedSubsetManagerDlg
* {@inheritDoc}
*/
@Override
protected <T extends Subscription> T createSubscription(T sub,
public <T extends UserSubscription> T createSubscription(T sub,
Network defaultRoute) {
T subscription = super.createSubscription(sub, defaultRoute);
if (subscription == null) {

View file

@ -0,0 +1,50 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.subscription.subset;
/**
* Interface that will be implemented for phase3 datadelivery, but not in the
* common baseline.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public interface ISharedSubscriptionHandler {
/**
* Launch the GUI to create a shared subscription.
*
* @param subsetManagerDlg
*/
void launchCreateSharedSubscriptionGui(
SubsetManagerDlg<?, ?, ?> subsetManagerDlg);
}

View file

@ -0,0 +1,58 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.subscription.subset;
import org.eclipse.swt.SWT;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
* Placeholder shared subscription handler that will display a notice the
* functionality is not available. It should never be invoked unless the
* 5-Data_Delivery phase 3 code is available, but provides another layer in case
* it somehow is invoked.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class NotEnabledSubscriptionHandler implements
ISharedSubscriptionHandler {
/**
* {@inheritDoc}
*/
@Override
public void launchCreateSharedSubscriptionGui(SubsetManagerDlg<?, ?, ?> subsetManagerDlg) {
DataDeliveryUtils.showMessage(subsetManagerDlg.getShell(), SWT.OK,
"Unavailable option", "Shared subscriptions are not enabled.");
}
}

View file

@ -56,8 +56,10 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Levels;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.retrieval.util.DataSizeUtils;
@ -68,6 +70,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.ServiceLoaderUtil;
import com.raytheon.uf.viz.core.VizAppTaskExecutor;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
@ -131,6 +134,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Jan 28, 2013 1530 djohnson Break out long method chaining into local variables for debugging.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* </pre>
*
* @author mpduff
@ -146,6 +150,10 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubsetManagerDlg.class);
private final ISharedSubscriptionHandler sharedSubscriptionHandler = ServiceLoaderUtil
.load(SubsetManagerDlg.class, ISharedSubscriptionHandler.class,
new NotEnabledSubscriptionHandler());
/** Subset Name text box */
private Text nameText;
@ -469,7 +477,8 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
subscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
launchCreateSubscriptionGui(Network.OPSNET);
launchCreateSubscriptionGui(createSubscription(
new UserSubscription(), Network.OPSNET));
}
});
@ -484,7 +493,8 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
sharedSubscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
launchCreateSubscriptionGui(Network.SBN);
sharedSubscriptionHandler
.launchCreateSharedSubscriptionGui(SubsetManagerDlg.this);
}
});
}
@ -514,9 +524,9 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
});
}
private void launchCreateSubscriptionGui(Network defaultRoute) {
public void launchCreateSubscriptionGui(Subscription sub) {
DataDeliveryGUIUtils.markBusyInUIThread(shell);
if (handleOK(defaultRoute)) {
if (handleOK(sub)) {
close();
} else {
DataDeliveryGUIUtils.markNotBusyInUIThread(shell);
@ -530,12 +540,9 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
*
* @return true if data are valid
*/
private boolean handleOK(Network defaultRoute) {
private boolean handleOK(Subscription sub) {
if (this.validated(true)) {
Subscription sub = createSubscription(new Subscription(),
defaultRoute);
if (subDlg != null && !subDlg.isDisposed()) {
subDlg.setSubscriptionData(sub);
subDlg.bringToTop();
@ -582,7 +589,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
}
/**
* Create the subscription.
* Create the shared subscription.
*
* @param <T>
* The subscription object reference type
@ -593,7 +600,49 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
*
* @return the populated subscription
*/
protected <T extends Subscription> T createSubscription(T sub,
public SharedSubscription createSubscription(SharedSubscription sub,
Network defaultRoute) {
return setupCommonSubscriptionAttributes(sub, defaultRoute);
}
/**
* Create the user subscription.
*
* @param <T>
* The subscription object reference type
* @param sub
* The subscription to populate
* @param the
* route for the subscription
*
* @return the populated subscription
*/
public <T extends UserSubscription> T createSubscription(T sub,
Network defaultRoute) {
Preconditions.checkNotNull(sub, "A subscription must be provided.");
Preconditions.checkNotNull(defaultRoute,
"A defaultRoute must be provided.");
sub.setOwner((create) ? LocalizationManager.getInstance()
.getCurrentUser() : this.subscription.getOwner());
return setupCommonSubscriptionAttributes(sub, defaultRoute);
}
/**
* Sets up common subscription attributes.
*
* @param <T>
* The subscription object reference type
* @param sub
* The subscription to populate
* @param the
* route for the subscription
*
* @return the populated subscription
*/
private <T extends Subscription> T setupCommonSubscriptionAttributes(T sub,
Network defaultRoute) {
Preconditions.checkNotNull(sub, "A subscription must be provided.");
@ -605,10 +654,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
sub.setRoute(defaultRoute);
sub.setName(nameText.getText());
sub.setOfficeID(LocalizationManager.getInstance().getCurrentSite());
if (create) {
sub.setOwner(LocalizationManager.getInstance().getCurrentUser());
} else {
sub.setOwner(this.subscription.getOwner());
if (!create) {
sub.setGroupName(this.subscription.getGroupName());
sub.setSubscriptionEnd(this.subscription.getSubscriptionEnd());
sub.setSubscriptionStart(this.subscription.getSubscriptionStart());

View file

@ -0,0 +1,23 @@
#!/bin/bash
SQL_SCRIPT="renameSubscriptionToUserSubscription.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - renaming Subscription to UserSubscription"
# run the update
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -0,0 +1,48 @@
/**
* 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.
**/
\set ON_ERROR_STOP 1
\connect metadata;
-- Start a transaction
BEGIN;
-- New classification nodes for UserSubscription
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'com.raytheon.uf.common.datadelivery.registry.UserSubscription', parent, '/com.raytheon.uf.common.datadelivery.registry.UserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
insert into ebxml.classificationnode(id, lid, objecttype, owner, status, userversionname, versionname, description_key, name_key, code, parent, path) SELECT 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription', 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription', objecttype, owner, status, userversionname, versionname, description_key, name_key, 'UserSubscription', parent, '/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/UserSubscription' FROM ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
-- Update foreign keys for the taxonomy to UserSubscription
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.taxonomyelementtype_classificationnode set classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:UserSubscription' where classificationnode_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
-- Delete Subscription classification nodes
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Subscription';
delete from ebxml.classificationnode where id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
-- Update registry object references from Subscription to UserSubscription
update ebxml.registryobjectlist_registryobject set registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where registryobject_id = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.registryobject set objecttype = 'urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.UserSubscription' where objecttype ='urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:com.raytheon.uf.common.datadelivery.registry.Subscription';
update ebxml.value set stringvalue = regexp_replace(stringvalue, '<subscription ', '<userSubscription ', 'g');
update ebxml.value set stringvalue = regexp_replace(stringvalue, '</subscription>', '</userSubscription>', 'g');
-- Update the aggregated events
update events.aggregate set grouping = regexp_replace(grouping, 'com\.raytheon\.uf\.common\.datadelivery\.registry\.Subscription', 'com.raytheon.uf.common.datadelivery.registry.UserSubscription', 'g');
-- Commit the transaction
END;

View file

@ -40,6 +40,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import com.raytheon.edex.util.Util;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializableManager;
@ -50,8 +51,8 @@ import com.raytheon.uf.edex.database.DatabasePluginRegistry;
import com.raytheon.uf.edex.database.DatabaseSessionFactoryBean;
import com.raytheon.uf.edex.database.IDatabasePluginRegistryChanged;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
import com.raytheon.uf.edex.database.plugin.PluginVersion;
@ -67,6 +68,7 @@ import com.raytheon.uf.edex.database.plugin.PluginVersionDao;
* 10/8/2008 1532 bphillip Initial checkin
* 2/9/2009 1990 bphillip Fixed index creation
* 03/20/09 njensen Implemented IPluginRegistryChanged
* Mar 29, 2013 1841 djohnson Remove unused method, warnings, and close streams with utility method.
* </pre>
*
* @author bphillip
@ -75,7 +77,8 @@ import com.raytheon.uf.edex.database.plugin.PluginVersionDao;
public class SchemaManager implements IDatabasePluginRegistryChanged {
/** The logger */
protected transient Log logger = LogFactory.getLog(getClass());
private static final Log logger = LogFactory
.getLog(IDatabasePluginRegistryChanged.class);
private static final String resourceSelect = "select relname from pg_class where relname = '";
@ -88,18 +91,18 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
private static SchemaManager instance;
/** The directory which the plugins reside */
private String pluginDir;
private final String pluginDir;
private DatabasePluginRegistry dbPluginRegistry;
private final DatabasePluginRegistry dbPluginRegistry;
private Map<String, ArrayList<String>> pluginCreateSql = new HashMap<String, ArrayList<String>>();
private final Map<String, ArrayList<String>> pluginCreateSql = new HashMap<String, ArrayList<String>>();
private Map<String, ArrayList<String>> pluginDropSql = new HashMap<String, ArrayList<String>>();
private final Map<String, ArrayList<String>> pluginDropSql = new HashMap<String, ArrayList<String>>();
private Pattern createResourceNamePattern = Pattern
private final Pattern createResourceNamePattern = Pattern
.compile("^create (?:table |index |sequence )(?:[A-Za-z_0-9]*\\.)?(.+?)(?: .*)?$");
private Pattern createIndexTableNamePattern = Pattern
private final Pattern createIndexTableNamePattern = Pattern
.compile("^create index %TABLE%.+? on (.+?) .*$");
/**
@ -126,52 +129,6 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
.getEnvValue("PLUGINDIR");
}
private PluginSchema populateSchema(String pluginName, String database,
PluginSchema schema, List<String> tableNames) {
List<String> ddls = null;
for (String sql : ddls) {
for (String table : tableNames) {
if (sql.startsWith("create table " + table.toLowerCase() + " ")) {
schema.addCreateSql(sql);
break;
} else if (sql.startsWith("drop table " + table.toLowerCase()
+ ";")) {
sql = sql.replace("drop table ", "drop table if exists ");
schema.addDropSql(sql.replace(";", " cascade;"));
break;
} else if (sql.startsWith("create index")
&& sql.contains(" on " + table.toLowerCase())) {
if (sql.contains("%TABLE%")) {
sql = sql.replaceFirst("%TABLE%", table.toLowerCase());
}
String dropIndexSql = sql.replace("create index",
"drop index if exists");
dropIndexSql = dropIndexSql.substring(0,
dropIndexSql.indexOf(" on "))
+ ";";
sql = dropIndexSql + sql;
schema.addCreateSql(sql);
break;
} else if (sql.startsWith("alter table " + table.toLowerCase()
+ " ")
&& sql.contains(" drop ")) {
schema.addDropSql(sql);
break;
} else if (sql.startsWith("alter table " + table.toLowerCase()
+ " ")
&& sql.contains(" add ")) {
if (sql.contains("foreign key")) {
sql = sql.replace(";", " ON DELETE CASCADE;");
}
schema.addCreateSql(sql);
break;
}
}
}
return schema;
}
/**
* Runs all scripts for a particular plugin
*
@ -216,25 +173,14 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
"Unable to execute scripts for plugin FQN "
+ pluginFQN);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Util.close(reader);
Util.close(stream);
}
}
}
}
@SuppressWarnings("unchecked")
@Override
public void pluginAdded(String pluginName) throws PluginException {
boolean haveLock = false;

View file

@ -22,8 +22,6 @@ com.raytheon.uf.common.datadelivery.registry.ParameterLevel
com.raytheon.uf.common.datadelivery.registry.PendingSubscription
com.raytheon.uf.common.datadelivery.registry.Projection
com.raytheon.uf.common.datadelivery.registry.Provider
com.raytheon.uf.common.datadelivery.registry.Subscription
com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle
com.raytheon.uf.common.datadelivery.registry.Time
com.raytheon.uf.common.datadelivery.registry.PointTime
com.raytheon.uf.common.datadelivery.registry.GriddedTime

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Oct 10, 2012 1261 djohnson Copy constructor.
* Dec 11, 2012 1403 djohnson No longer a registry object.
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -52,7 +53,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@XmlRootElement(name = "AdhocSubscription")
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class AdhocSubscription extends Subscription implements ISerializableObject {
public class AdhocSubscription extends UserSubscription implements
ISerializableObject {
private static final long serialVersionUID = -2200080380095632486L;
@ -60,7 +62,7 @@ public class AdhocSubscription extends Subscription implements ISerializableObje
setGroupName("Adhoc");
}
public AdhocSubscription(Subscription subscription) {
public AdhocSubscription(UserSubscription subscription) {
super(subscription);
setGroupName("Adhoc");
}

View file

@ -49,8 +49,11 @@ public final class DataDeliveryRegistryObjectTypes {
public static final String DATASETMETADATA = RegistryUtil
.getObjectType(DataSetMetaData.class);
public static final String SUBSCRIPTION = RegistryUtil
.getObjectType(Subscription.class);
public static final String USER_SUBSCRIPTION = RegistryUtil
.getObjectType(UserSubscription.class);
public static final String SHARED_SUBSCRIPTION = RegistryUtil
.getObjectType(SharedSubscription.class);
public static final String DATASET = RegistryUtil
.getObjectType(DataSet.class);

View file

@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -41,6 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sep 24, 2012 mpduff Initial creation
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Dec 12, 2012 1433 bgonzale Use new Subscription copy ctor.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -54,7 +56,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT })
public class InitialPendingSubscription extends Subscription {
public class InitialPendingSubscription extends UserSubscription {
private static final long serialVersionUID = 2779084460608459754L;
public static final String CHANGE_REQUEST_ID_SLOT = "changeReqId";
/** ID of the user requesting the change */
@ -83,11 +87,12 @@ public class InitialPendingSubscription extends Subscription {
* @param user
* user
*/
public InitialPendingSubscription(Subscription subscription, String user) {
public InitialPendingSubscription(UserSubscription subscription, String user) {
super(subscription);
this.setChangeReqId(user);
this.setDeleted(subscription.isDeleted());
this.setId(RegistryUtil.getRegistryObjectKey(this));
}

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Sep 14, 2012 1169 djohnson Include owner in the registry id and association.
* Sep 24, 2012 1157 mpduff Changed to extend IniitialPendingSubscription.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -58,17 +59,20 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
Subscription.OWNER_SLOT,
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = Subscription.class) })
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) })
public class PendingSubscription extends InitialPendingSubscription
implements ISerializableObject {
private static final long serialVersionUID = 7607153845750089310L;
public PendingSubscription() {
}
public PendingSubscription(Subscription subscription,
public PendingSubscription(UserSubscription subscription,
String currentUser) {
super(subscription, currentUser);
}

View file

@ -0,0 +1,955 @@
/**
* 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 java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Base definition of a recurring subscription.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2013 1841 djohnson Extracted from Subscription.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso({ PendingSubscription.class, AdhocSubscription.class,
UserSubscription.class, SharedSubscription.class })
public abstract class RecurringSubscription implements ISerializableObject,
Serializable, Subscription {
private static final long serialVersionUID = -6422673887457060034L;
/**
* Constructor.
*/
public RecurringSubscription() {
}
/**
* Initialization constructor.
*
* @param sub
* Subscription object
* @param name
* New subscription name
*/
public RecurringSubscription(RecurringSubscription sub, String name) {
this.setActive(sub.isActive());
this.setActivePeriodEnd(sub.getActivePeriodEnd());
this.setActivePeriodStart(sub.getActivePeriodStart());
this.setCoverage(sub.getCoverage());
this.setDataSetName(sub.getDataSetName());
this.setDataSetSize(sub.getDataSetSize());
this.setDescription(sub.getDescription());
this.setFullDataSet(sub.isFullDataSet());
this.setGroupName(sub.getGroupName());
this.setId(sub.getId());
this.setName(name);
this.setNotify(sub.isNotify());
this.setOfficeID(sub.getOfficeID());
this.setParameter(sub.getParameter());
this.setPriority(sub.getPriority());
this.setProvider(sub.getProvider());
this.setSubscriptionEnd(sub.getSubscriptionEnd());
this.setSubscriptionId(sub.getSubscriptionId());
this.setSubscriptionStart(sub.getSubscriptionStart());
this.setTime(sub.getTime());
this.setUrl(sub.getUrl());
this.setDataSetType(sub.getDataSetType());
this.setRoute(sub.getRoute());
this.setLatencyInMinutes(sub.getLatencyInMinutes());
this.setEnsemble(sub.getEnsemble());
// Set the registry id
this.setId(RegistryUtil.getRegistryObjectKey(this));
}
/**
* Copy constructor.
*
* @param sub
* Subscription object
*/
public RecurringSubscription(RecurringSubscription sub) {
this(sub, sub.getName());
}
@XmlAttribute
@DynamicSerializeElement
private String subscriptionId;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute(NAME_SLOT)
private String name;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private String groupName = GroupDefinition.NO_GROUP;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute(PROVIDER_NAME_SLOT)
private String provider;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private String officeID;
@XmlAttribute
@DynamicSerializeElement
private SubscriptionPriority priority = SubscriptionPriority.NORMAL;
@XmlAttribute
@DynamicSerializeElement
private Date subscriptionStart;
@XmlAttribute
@DynamicSerializeElement
private Date subscriptionEnd;
@XmlAttribute
@DynamicSerializeElement
private Date activePeriodStart;
@XmlAttribute
@DynamicSerializeElement
private Date activePeriodEnd;
@XmlAttribute
@DynamicSerializeElement
private boolean notify;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private boolean fullDataSet;
@XmlAttribute
@DynamicSerializeElement
private long dataSetSize;
@XmlElement(name = "coverage")
@DynamicSerializeElement
private Coverage coverage;
@XmlElement
@DynamicSerializeElement
@SlotAttribute
@SlotAttributeConverter(TimeSlotConverter.class)
private Time time;
@XmlAttribute
@DynamicSerializeElement
private String description;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute(Subscription.DATA_SET_SLOT)
private String dataSetName;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private boolean active;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private boolean valid = true;
@XmlAttribute
@DynamicSerializeElement
private boolean unscheduled;
@XmlAttribute
@DynamicSerializeElement
private String url;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute
private DataType dataSetType;
@XmlElements({ @XmlElement })
@DynamicSerializeElement
private List<Parameter> parameter;
@XmlElement
@DynamicSerializeElement
private Ensemble ensemble;
@XmlAttribute
@DynamicSerializeElement
private boolean deleted;
@XmlAttribute
@DynamicSerializeElement
private String id;
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute(Subscription.ROUTE_SLOT)
private Network route = Network.OPSNET;
@XmlAttribute
@DynamicSerializeElement
private int latencyInMinutes;
/**
* Get subscription name.
*
* @return subscription name
*/
@Override
public String getName() {
return name;
}
/**
* Set subscription name.
*
* @param name
* the name of the subscription
*/
@Override
public void setName(String name) {
this.name = name;
}
/**
* Get subscription group name.
*
* @return subscription group name
*/
@Override
public String getGroupName() {
return groupName;
}
/**
* Set subscription group name.
*
* @param groupName
* the name of the subscription group
*/
@Override
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* Set subscription provider name.
*
* @param provider
* the name of the subscription provider
*/
@Override
public void setProvider(String provider) {
this.provider = provider;
}
/**
* Get provider name.
*
* @return provider name
*/
@Override
public String getProvider() {
return provider;
}
/**
* Get owner office id.
*
* @return office id
*/
@Override
public String getOfficeID() {
return officeID;
}
/**
* Set office id.
*
* @param officeID
* the office id
*/
@Override
public void setOfficeID(String officeID) {
this.officeID = officeID;
}
/**
* Get subscription priority for fulfillment.
*
* @return subscription name
*/
@Override
public SubscriptionPriority getPriority() {
return priority;
}
/**
* Set subscription priority.
*
* @param priority
* priority
*/
@Override
public void setPriority(SubscriptionPriority priority) {
this.priority = priority;
}
/**
* Get subscription start time.
*
* @return subscription start
*/
@Override
public Date getSubscriptionStart() {
return subscriptionStart;
}
/**
* Set subscription start time.
*
* @param subscriptionStart
* date time group for subscription start
*/
@Override
public void setSubscriptionStart(Date subscriptionStart) {
this.subscriptionStart = subscriptionStart;
}
/**
* Get subscription end time.
*
* @return subscription end time date time group for subscription end
*/
@Override
public Date getSubscriptionEnd() {
return subscriptionEnd;
}
/**
* Set subscription end time.
*
* @param subscriptionEnd
* date time group for subscription end
*/
@Override
public void setSubscriptionEnd(Date subscriptionEnd) {
this.subscriptionEnd = subscriptionEnd;
}
/**
* Get active period start date.
*
* @return activePeriodStart
*/
@Override
public Date getActivePeriodStart() {
return activePeriodStart;
}
/**
* Set active period start date.
*
* @param activePeriodStart
* date for subscription start
*/
@Override
public void setActivePeriodStart(Date activePeriodStart) {
this.activePeriodStart = activePeriodStart;
}
/**
* Get active period end date.
*
* @return activePeriodEnd
*/
@Override
public Date getActivePeriodEnd() {
return activePeriodEnd;
}
/**
* Set active period end date.
*
* @param activePeriodEnd
* date for subscription end
*/
@Override
public void setActivePeriodEnd(Date activePeriodEnd) {
this.activePeriodEnd = activePeriodEnd;
}
/**
* isNotify flag for subscription.
*
* @return boolean true if notify subscriber false if deliver to subscriber
*/
@Override
public boolean isNotify() {
return notify;
}
/**
* Set isNotify flag.
*
* @param notify
* date for subscription end
*/
@Override
public void setNotify(boolean notify) {
this.notify = notify;
}
/**
* isNotify flag for subscription.
*
* @return boolean true if full dataset
*/
@Override
public boolean isFullDataSet() {
return fullDataSet;
}
/**
* Set fullDataSet flag.
*
* @param fullDataSet
* true if full dataset
*/
@Override
public void setFullDataSet(boolean fullDataSet) {
this.fullDataSet = fullDataSet;
}
/**
* Get size of the dataset for the subscription.
*
* @return dataSetSize size of dataset
*/
@Override
public long getDataSetSize() {
return dataSetSize;
}
/**
* Set the dataset size for the subscription.
*
* @param dataSetSize
* size of dataset
*/
@Override
public void setDataSetSize(long dataSetSize) {
this.dataSetSize = dataSetSize;
}
/**
* Get subscription coverage area.
*
* @return coverage
*/
@Override
public Coverage getCoverage() {
return coverage;
}
/**
* Set the coverage area for the subscription.
*
* @param coverage
* coverage area
*/
@Override
public void setCoverage(Coverage coverage) {
this.coverage = coverage;
}
/**
* Get subscription submission time.
*
* @return subscription time
*/
@Override
public Time getTime() {
return time;
}
/**
* Set the subscription submission time.
*
* @param time
* time stamp
*/
@Override
public void setTime(Time time) {
this.time = time;
}
/**
* Set the subscription parameters.
*
* @param parameter
* subscription parameter list
*/
@Override
public void setParameter(List<Parameter> parameter) {
this.parameter = parameter;
}
/**
* Get subscription parameter list.
*
* @return subscription parameter list
*/
@Override
public List<Parameter> getParameter() {
return parameter;
}
/**
* Add subscription parameters.
*
* @param par
* a subscription parameter
*/
@Override
public void addParameter(Parameter par) {
if (parameter == null) {
parameter = new ArrayList<Parameter>();
}
parameter.add(par);
}
/**
* Remove subscription parameters.
*
* @param par
* a subscription parameter
*/
@Override
public void removeParameter(Parameter par) {
parameter.remove(par);
}
/**
* Add subscription id.
*
* @param subscriptionId
* a subscription id
*/
@Override
public void setSubscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
}
/**
* Get subscription id.
*
* @return subscription id
*/
@Override
public String getSubscriptionId() {
return subscriptionId;
}
/**
* Get subscription description.
*
* @return subscription description
*/
@Override
public String getDescription() {
return description;
}
/**
* Set the subscription description.
*
* @param description
* subscription description
*/
@Override
public void setDescription(String description) {
this.description = description;
}
/**
* Get subscription dataset name.
*
* @return subscription dataset name
*/
@Override
public String getDataSetName() {
return dataSetName;
}
/**
* Set the subscription dataSetName.
*
* @param dataSetName
* subscription dataSetName
*/
@Override
public void setDataSetName(String dataSetName) {
this.dataSetName = dataSetName;
}
/**
* isActive flag for subscription status.
*
* @return boolean true if subscription is Active
*/
@Override
public boolean isActive() {
return active;
}
/**
* Set the subscription status to active.
*
* @param active
* subscription active
*/
@Override
public void setActive(boolean active) {
this.active = active;
}
/**
* Set subscription valid.
*
* @param valid
* true if subscription valid
*/
@Override
public void setValid(boolean valid) {
this.valid = valid;
}
/**
* Return if subscription is valid or invalid
*
* @return true if subscription is valid
*/
@Override
public boolean isValid() {
return valid;
}
/**
* Get the subscription url.
*
* @return the url
*/
@Override
public String getUrl() {
return url;
}
/**
* Set the subscription url.
*
* @param url
* the url to set
*/
@Override
public void setUrl(String url) {
this.url = url;
}
/**
* Get subscription dataset type.
*
* @return subscription dataset type
*/
@Override
public DataType getDataSetType() {
return dataSetType;
}
/**
* Set the dataset type
*
* @param dataSetType
* the dataSetType to set
*/
@Override
public void setDataSetType(DataType dataSetType) {
this.dataSetType = dataSetType;
}
/**
* isDeleted flag.
*
* @return true if the subscription has been deleted
*/
@Override
public boolean isDeleted() {
return deleted;
}
/**
* Set the deleted flag.
*
* @param deleted
* set subscription to deleted
*/
@Override
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
/**
* @return the unscheduled
*/
@Override
public boolean isUnscheduled() {
return unscheduled;
}
/**
* @param unscheduled
* the unscheduled to set
*/
@Override
public void setUnscheduled(boolean unscheduled) {
this.unscheduled = unscheduled;
}
/**
* Get subscription id.
*
* @return subscription id
*/
@Override
public String getId() {
return id;
}
/**
* Set the subscription id.
*
* @param id
* set subscription id
*/
@Override
public void setId(String id) {
this.id = id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Subscription) {
Subscription other = (Subscription) obj;
EqualsBuilder builder = new EqualsBuilder();
builder.append(getProvider(), other.getProvider());
builder.append(getName(), other.getName());
builder.append(getDataSetName(), other.getDataSetName());
builder.append(getOwner(), other.getOwner());
return builder.isEquals();
}
return super.equals(obj);
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
builder.append(getProvider());
builder.append(getName());
builder.append(getDataSetName());
builder.append(getOwner());
return builder.toHashCode();
}
@Override
public String toString() {
return getName() + "::" + getProvider() + "::" + getDataSetName()
+ "::" + getOwner();
}
/**
* Determine if subscription status is expired.
*
* @return true if status is expired
*/
@Override
public boolean isExpired() {
Calendar cal = TimeUtil.newGmtCalendar();
Date today = cal.getTime();
boolean expired = false;
if (this.getSubscriptionEnd() != null
&& today.after(this.getSubscriptionEnd())) {
expired = true;
}
return expired;
}
/**
* Get the current subscription status.
*
* @return String value of SUBSCRIPTION_STATUS
*/
@Override
public String getStatus() {
SubscriptionStatus status = SubscriptionStatus.INVALID;
if (isValid()) {
if (isExpired()) {
status = SubscriptionStatus.EXPIRED;
} else if (!isActive()) {
status = SubscriptionStatus.INACTIVE;
} else {
Calendar cal = TimeUtil.newGmtCalendar();
Date today = cal.getTime();
status = (inWindow(today)) ? SubscriptionStatus.ACTIVE
: SubscriptionStatus.INACTIVE;
if (status == SubscriptionStatus.ACTIVE && isUnscheduled()) {
status = SubscriptionStatus.UNSCHEDULED;
}
}
}
return status.toString();
}
private boolean inWindow(Date checkDate) {
if (activePeriodStart == null && activePeriodEnd == null) {
return true;
} else if (activePeriodStart != null && activePeriodEnd != null) {
Calendar startCal = TimeUtil.newGmtCalendar();
startCal.setTime(activePeriodStart);
startCal = TimeUtil.minCalendarFields(startCal,
Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND,
Calendar.MILLISECOND);
activePeriodStart = startCal.getTime();
Calendar endCal = TimeUtil.newGmtCalendar();
endCal.setTime(activePeriodEnd);
endCal = TimeUtil.maxCalendarFields(endCal, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND);
// If the period crosses a year boundary, add a year to the end
if (endCal.before(startCal)) {
endCal.add(Calendar.YEAR, 1);
}
activePeriodEnd = endCal.getTime();
// Only concerned with month and day, need to set the years equal
Calendar c = TimeUtil.newGmtCalendar();
c.setTime(checkDate);
c.set(Calendar.YEAR, startCal.get(Calendar.YEAR));
Date date = c.getTime();
return (activePeriodStart.before(date) && activePeriodEnd
.after(date));
}
return false;
}
@Override
public Network getRoute() {
return this.route;
}
@Override
public void setRoute(Network route) {
this.route = route;
}
/**
* Set the latency in minutes.
*
* @param latencyInMinutes
* the latency, in minutes
*
*/
@Override
public void setLatencyInMinutes(int latencyInMinutes) {
this.latencyInMinutes = latencyInMinutes;
}
/**
* Get the latency, in minutes.
*
* @return the latency in minutes
*/
@Override
public int getLatencyInMinutes() {
return latencyInMinutes;
}
@Override
public Ensemble getEnsemble() {
return ensemble;
}
@Override
public void setEnsemble(Ensemble ensemble) {
this.ensemble = ensemble;
}
}

View file

@ -0,0 +1,119 @@
/**
* 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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Subscription that is shared among sites.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@RegistryObject(value = { Subscription.PROVIDER_NAME_SLOT,
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
Subscription.OWNER_SLOT })
@DynamicSerialize
public class SharedSubscription extends RecurringSubscription {
private static final long serialVersionUID = -7221500266253493273L;
public static final String SHARED_SUBSCRIPTION_OWNER = "shared";
/**
* Constructor.
*/
public SharedSubscription() {
}
/**
* @param sharedSubscription
*/
public SharedSubscription(SharedSubscription sub) {
super(sub);
}
/**
* @param sharedSubscription
*/
public SharedSubscription(SharedSubscription sub, String newName) {
super(sub, newName);
}
/**
* {@inheritDoc}
*/
@Override
public String getOwner() {
return SHARED_SUBSCRIPTION_OWNER;
}
/**
* {@inheritDoc}
*/
@Override
public SharedSubscription copy() {
return new SharedSubscription(this);
}
/**
* {@inheritDoc}
*/
@Override
public SharedSubscription copy(String newName) {
return new SharedSubscription(this, newName);
}
/**
* {@inheritDoc}
*/
@Override
public InitialPendingSubscription initialPending(String currentUser) {
// TODO: Implement pending subscription types for shared subscriptions
return null;
}
/**
* {@inheritDoc}
*/
@Override
public PendingSubscription pending(String currentUser) {
// TODO: Implement pending subscription types for shared subscriptions
return null;
}
}

View file

@ -1,13 +1,6 @@
package com.raytheon.uf.common.datadelivery.registry;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
import com.raytheon.uf.common.serialization.ISerializableObject;
@ -25,14 +18,13 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Mar 29, 2013 1841 djohnson Remove JAXB annotations.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SubscriptionBundle implements ISerializableObject {
@ -40,7 +32,6 @@ public class SubscriptionBundle implements ISerializableObject {
}
@XmlElement
@DynamicSerializeElement
private Subscription subscription;
@ -48,23 +39,18 @@ public class SubscriptionBundle implements ISerializableObject {
* If this is an aggregation, these are the subscriptions being full filled
* that may need to be subsetted/stored separately from what is returned.
*/
@XmlElements({ @XmlElement(name = "subscriptionsMet", type = Subscription.class) })
@DynamicSerializeElement
private ArrayList<Subscription> subscriptionsMet;
private List<Subscription> subscriptionsMet;
@XmlAttribute
@DynamicSerializeElement
private String bundleId;
@XmlAttribute
@DynamicSerializeElement
private Integer priority;
@XmlElement
@DynamicSerializeElement
private Connection connection;
@XmlElement
@DynamicSerializeElement
private Provider provider;
@ -76,11 +62,11 @@ public class SubscriptionBundle implements ISerializableObject {
this.subscription = subscription;
}
public ArrayList<Subscription> getSubscriptionsMet() {
public List<Subscription> getSubscriptionsMet() {
return subscriptionsMet;
}
public void setSubscriptionsMet(ArrayList<Subscription> subscriptionsMet) {
public void setSubscriptionsMet(List<Subscription> subscriptionsMet) {
this.subscriptionsMet = subscriptionsMet;
}
@ -126,7 +112,11 @@ public class SubscriptionBundle implements ISerializableObject {
if (subscription != null) {
if (subscription.getCoverage() instanceof GriddedCoverage) {
pt = ProviderType.GRID;
} else {
}
// TODO: Add more data types, currently defaulting to POINT only if
// not a GriddedCoverage, when there could be other data types than
// just Grid/Point
else {
pt = ProviderType.POINT;
}
}

View file

@ -0,0 +1,162 @@
/**
* 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 javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Subscription XML
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 07, 2011 191 dhladky Initial creation.
* Mar 13, 2012 jpiatt Modified for additional elements.
* Jul 2, 2012 702 jpiatt Added group name.
* Aug 10, 2012 1002 mpduff Change dataset size from int to long.
* Aug 22, 2012 0743 djohnson Store data type, fix copy constructor.
* Aug 31, 2012 1128 mpduff Fixed subscription status indication.
* Sep 07, 2012 1102 djohnson Add some JAXB XmlSeeAlso values.
* Oct 1, 2012 1103 jpiatt Added invalid subscription status.
* Oct 10, 2012 0726 djohnson Add network route.
* Oct 26, 2012 1286 djohnson Add toString, equals, hashcode.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Nov 20, 2012 1166 djohnson Use attributes for Subscription fields.
* Nov 20, 2012 1286 djohnson Add unscheduled.
* Dec 12, 2012 1433 bgonzale Refactored Subscription copy ctor into two ctors.
* Jan 03, 2013 1441 djohnson Default to no group.
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
* Feb 20, 2013 1543 djohnson Route is now a slot.
* Mar 29, 2013 1841 djohnson Renamed to UserSubscription.
*
* </pre>
*
* @author dhladky
* @version 1.0
* @param <RegistryTypeObject>
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
@DynamicSerialize
public class UserSubscription extends RecurringSubscription {
private static final long serialVersionUID = -6422673887457060034L;
/**
* Constructor.
*/
public UserSubscription() {
}
/**
* Initialization constructor.
*
* @param sub
* Subscription object
* @param name
* New subscription name
*/
public UserSubscription(UserSubscription sub, String name) {
this(sub);
this.setName(name);
this.setId(RegistryUtil.getRegistryObjectKey(this));
}
/**
* Copy constructor.
*
* @param sub
* Subscription object
*/
public UserSubscription(UserSubscription sub) {
super(sub);
this.setOwner(sub.getOwner());
}
@XmlAttribute
@DynamicSerializeElement
@SlotAttribute(OWNER_SLOT)
private String owner;
/**
* Get subscription owner name.
*
* @return subscription owner name
*/
@Override
public String getOwner() {
return owner;
}
/**
* Set subscription owner name.
*
* @param owner
* the name of the subscription owner
*/
public void setOwner(String owner) {
this.owner = owner;
}
/**
* {@inheritDoc}
*/
@Override
public Subscription copy() {
return new UserSubscription(this);
}
/**
* {@inheritDoc}
*/
@Override
public Subscription copy(String newName) {
return new UserSubscription(this, newName);
}
/**
* {@inheritDoc}
*/
@Override
public InitialPendingSubscription initialPending(String currentUser) {
return new InitialPendingSubscription(this, currentUser);
}
/**
* {@inheritDoc}
*/
@Override
public PendingSubscription pending(String currentUser) {
return new PendingSubscription(this, currentUser);
}
}

View file

@ -22,12 +22,12 @@ package com.raytheon.uf.common.datadelivery.registry.ebxml;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Implementation of {@link SubscriptionFilterableQuery} to retrieve
* {@link Subscription}s.
* {@link UserSubscription}s.
*
* <pre>
*
@ -38,6 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
* Jul 23, 2012 702 jpiatt Added setters for groupName & officeId.
* Oct 03, 2012 1241 djohnson Move query parameters to {@link SubscriptionFilterableQuery}.
* Mar 29, 2013 1841 djohnson Renamed from SubscriptionQuery.
*
* </pre>
*
@ -47,21 +48,21 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SubscriptionQuery extends
SubscriptionFilterableQuery<Subscription> {
public class UserSubscriptionQuery extends
SubscriptionFilterableQuery<UserSubscription> {
/**
* {@inheritDoc}
*/
@Override
public Class<Subscription> getResultType() {
return Subscription.class;
public Class<UserSubscription> getResultType() {
return UserSubscription.class;
}
/**
* {@inheritDoc}
*/
@Override
public Class<Subscription> getObjectType() {
return Subscription.class;
public Class<UserSubscription> getObjectType() {
return UserSubscription.class;
}
}

View file

@ -53,7 +53,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* @version 1.0
*/
abstract class BaseSubscriptionHandler<T extends Subscription, QUERY extends SubscriptionFilterableQuery<T>>
public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY extends SubscriptionFilterableQuery<T>>
extends BaseRegistryObjectHandler<T, QUERY> implements
IBaseSubscriptionHandler<T> {
/**

View file

@ -35,8 +35,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 17, 2012 1169 djohnson Initial creation
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
* Mar 29, 2013 1841 djohnson Initial creation
*
* </pre>
*

View file

@ -0,0 +1,86 @@
/**
* 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 java.util.List;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
/**
* The {@link IRegistryObjectHandler} interface for {@link Subscription}s.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 17, 2012 1169 djohnson Initial creation
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
* Mar 29, 2013 1841 djohnson Renamed to specify UserSubscription.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public interface IUserSubscriptionHandler extends
IBaseSubscriptionHandler<UserSubscription> {
/**
* Retrieve a subscription that a {@link PendingSubscription} is associated
* to.
*
* @param pending
* the pending subscription
* @return the subscription, or null if not found
* @throws RegistryHandlerException
*/
UserSubscription getByPendingSubscription(
PendingSubscription pending)
throws RegistryHandlerException;
/**
* Retrieve a subscription that a {@link PendingSubscription} is associated
* to by the pending subscription's id.
*
* @param id
* the pending subscription id
* @return the subscription, or null if not found
* @throws RegistryHandlerException
*/
UserSubscription getByPendingSubscriptionId(String id)
throws RegistryHandlerException;
/**
* Retrieve active subscriptions for the dataset name and provider.
*
* @param dataSetName
* the dataset name
* @param providerName
* the provider name
*/
List<UserSubscription> getActiveByDataSetAndProvider(String dataSetName,
String providerName) throws RegistryHandlerException;
}

View file

@ -19,23 +19,24 @@
**/
package com.raytheon.uf.common.datadelivery.registry.handlers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionQuery;
import com.raytheon.uf.common.registry.RegistryManager;
import com.raytheon.uf.common.registry.RegistryQueryResponse;
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.CollectionUtil;
/**
* {@link IRegistryObjectHandler} implementation for {@link Subscription}.
* Currently only handles {@link UserSubscription} types.
*
* <pre>
*
@ -43,18 +44,31 @@ import com.raytheon.uf.common.util.CollectionUtil;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 17, 2012 1169 djohnson Initial creation.
* Sep 24, 2012 1157 mpduff Change to use InitialPendingSubscription.
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
* Mar 28, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class SubscriptionHandler extends
BaseSubscriptionHandler<Subscription, SubscriptionQuery>
implements ISubscriptionHandler {
public class SubscriptionHandler implements ISubscriptionHandler {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubscriptionHandler.class);
private static final String SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED = "Shared subscriptions are not currently supported.";
private final IUserSubscriptionHandler userSubscriptionHandler;
/**
* Constructor.
*
* @param userSubscriptionHandler
* the user subscription handler
*/
public SubscriptionHandler(IUserSubscriptionHandler userSubscriptionHandler) {
this.userSubscriptionHandler = userSubscriptionHandler;
}
/**
* {@inheritDoc}
@ -62,8 +76,7 @@ public class SubscriptionHandler extends
@Override
public Subscription getByPendingSubscription(PendingSubscription pending)
throws RegistryHandlerException {
return getByPendingSubscriptionId(RegistryUtil
.getRegistryObjectKey(pending));
return userSubscriptionHandler.getByPendingSubscription(pending);
}
/**
@ -72,63 +85,16 @@ public class SubscriptionHandler extends
@Override
public Subscription getByPendingSubscriptionId(final String id)
throws RegistryHandlerException {
// Checks for the existence of the subscription
AssociationQuery query = new AssociationQuery();
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
query.setSourceObjectId(id);
query.setReturnObjects(true);
RegistryQueryResponse<Object> response = RegistryManager
.getRegistyObjects(query);
checkResponse(response, "getByPendingSubscriptionId");
List<Object> results = response.getResults();
// Currently only Subscriptions are associated to
// PendingSubscriptions, but there could be other types of objects in
// the future
for (Object obj : results) {
if (obj instanceof Subscription) {
return Subscription.class.cast(obj);
}
}
return null;
return userSubscriptionHandler.getByPendingSubscriptionId(id);
}
/**
* Overridden because subscriptions must also have their
* {@link PendingSubscription} object deleted.
* @param username the username of the requester
* @param ids the registry ids of the subscription objects
* {@inheritDoc}
*/
@Override
public void deleteByIds(String username, List<String> ids)
throws RegistryHandlerException {
IPendingSubscriptionHandler handler = RegistryObjectHandlers
.get(IPendingSubscriptionHandler.class);
List<InitialPendingSubscription> pending = handler.getBySubscriptionIds(ids);
if (!CollectionUtil.isNullOrEmpty(pending)) {
handler.delete(username, pending);
}
super.deleteByIds(username, ids);
}
/**
* {@inheritDoc}
*/
@Override
protected SubscriptionQuery getQuery() {
return new SubscriptionQuery();
}
/**
* {@inheritDoc}
*/
@Override
protected Class<Subscription> getRegistryObjectClass() {
return Subscription.class;
this.userSubscriptionHandler.deleteByIds(username, ids);
}
/**
@ -137,16 +103,204 @@ public class SubscriptionHandler extends
@Override
public List<Subscription> getActiveByDataSetAndProvider(String dataSetName,
String providerName) throws RegistryHandlerException {
SubscriptionQuery query = getQuery();
query.setDataSetName(dataSetName);
query.setProviderName(providerName);
query.setActive(true);
return nullOrSubscriptionList(userSubscriptionHandler
.getActiveByDataSetAndProvider(dataSetName, providerName));
}
RegistryQueryResponse<Subscription> response = RegistryManager
.getRegistyObjects(query);
/**
* {@inheritDoc}
*/
@Override
public Subscription getByName(String name) throws RegistryHandlerException {
return userSubscriptionHandler.getByName(name);
}
checkResponse(response, "getActiveByDataSetAndProvider");
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getByOwner(String owner)
throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler.getByOwner(owner));
}
return response.getResults();
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getByGroupName(String group)
throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler
.getByGroupName(group));
}
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getByFilters(String group, String officeId)
throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler.getByFilters(
group, officeId));
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getSubscribedToDataSetNames()
throws RegistryHandlerException {
return userSubscriptionHandler.getSubscribedToDataSetNames();
}
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getActive() throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler.getActive());
}
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getActiveForRoute(Network route)
throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler
.getActiveForRoute(route));
}
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getActiveForRoutes(Network... routes)
throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler
.getActiveForRoutes(routes));
}
/**
* {@inheritDoc}
*/
@Override
public Subscription getById(String id) throws RegistryHandlerException {
return userSubscriptionHandler.getById(id);
}
/**
* {@inheritDoc}
*/
@Override
public List<Subscription> getAll() throws RegistryHandlerException {
return nullOrSubscriptionList(userSubscriptionHandler.getAll());
}
/**
* {@inheritDoc}
*/
@Override
public void store(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) {
userSubscriptionHandler.store((UserSubscription) obj);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
/**
* {@inheritDoc}
*/
@Override
public void update(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) {
userSubscriptionHandler.update((UserSubscription) obj);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
/**
* {@inheritDoc}
*/
@Override
public void delete(Subscription obj) throws RegistryHandlerException {
if (obj instanceof UserSubscription) {
userSubscriptionHandler.delete((UserSubscription) obj);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
/**
* {@inheritDoc}
*/
@Override
public void deleteById(String username, String registryId)
throws RegistryHandlerException {
userSubscriptionHandler.deleteById(username, registryId);
}
/**
* {@inheritDoc}
*/
@Override
public void delete(String username, Subscription obj)
throws RegistryHandlerException {
if (obj instanceof UserSubscription) {
userSubscriptionHandler.delete(username, (UserSubscription) obj);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void delete(Collection<Subscription> objects)
throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) {
if (objects.iterator().next() instanceof UserSubscription) {
final Collection asSubtype = objects;
userSubscriptionHandler.delete(asSubtype);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
}
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void delete(String username, Collection<Subscription> objects)
throws RegistryHandlerException {
if (!CollectionUtil.isNullOrEmpty(objects)) {
if (objects.iterator().next() instanceof UserSubscription) {
final Collection asSubtype = objects;
userSubscriptionHandler.delete(username, asSubtype);
} else {
statusHandler
.info(SHARED_SUBSCRIPTIONS_ARE_NOT_CURRENTLY_SUPPORTED);
}
}
}
private List<Subscription> nullOrSubscriptionList(
List<? extends Subscription> subscriptionList) {
if (subscriptionList == null) {
return null;
} else {
return new ArrayList<Subscription>(subscriptionList);
}
}
}

View file

@ -0,0 +1,159 @@
/**
* 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 java.util.List;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.ebxml.UserSubscriptionQuery;
import com.raytheon.uf.common.registry.RegistryManager;
import com.raytheon.uf.common.registry.RegistryQueryResponse;
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.util.CollectionUtil;
/**
* {@link IRegistryObjectHandler} implementation for {@link Subscription}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 17, 2012 1169 djohnson Initial creation.
* Sep 24, 2012 1157 mpduff Change to use InitialPendingSubscription.
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
* Mar 29, 2013 1841 djohnson Renamed from SubscriptionHandler.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class UserSubscriptionHandler extends
BaseSubscriptionHandler<UserSubscription, UserSubscriptionQuery>
implements IUserSubscriptionHandler {
/**
* {@inheritDoc}
*/
@Override
public UserSubscription getByPendingSubscription(PendingSubscription pending)
throws RegistryHandlerException {
return getByPendingSubscriptionId(RegistryUtil
.getRegistryObjectKey(pending));
}
/**
* {@inheritDoc}
*/
@Override
public UserSubscription getByPendingSubscriptionId(final String id)
throws RegistryHandlerException {
// Checks for the existence of the subscription
AssociationQuery query = new AssociationQuery();
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
query.setSourceObjectId(id);
query.setReturnObjects(true);
RegistryQueryResponse<Object> response = RegistryManager
.getRegistyObjects(query);
checkResponse(response, "getByPendingSubscriptionId");
List<Object> results = response.getResults();
// Currently only Subscriptions are associated to
// PendingSubscriptions, but there could be other types of objects in
// the future
for (Object obj : results) {
if (obj instanceof Subscription) {
return UserSubscription.class.cast(obj);
}
}
return null;
}
/**
* Overridden because subscriptions must also have their
* {@link PendingSubscription} object deleted.
*
* @param username
* the username of the requester
* @param ids
* the registry ids of the subscription objects
*/
@Override
public void deleteByIds(String username, List<String> ids)
throws RegistryHandlerException {
IPendingSubscriptionHandler handler = RegistryObjectHandlers
.get(IPendingSubscriptionHandler.class);
List<InitialPendingSubscription> pending = handler
.getBySubscriptionIds(ids);
if (!CollectionUtil.isNullOrEmpty(pending)) {
handler.delete(username, pending);
}
super.deleteByIds(username, ids);
}
/**
* {@inheritDoc}
*/
@Override
protected UserSubscriptionQuery getQuery() {
return new UserSubscriptionQuery();
}
/**
* {@inheritDoc}
*/
@Override
protected Class<UserSubscription> getRegistryObjectClass() {
return UserSubscription.class;
}
/**
* {@inheritDoc}
*/
@Override
public List<UserSubscription> getActiveByDataSetAndProvider(
String dataSetName, String providerName)
throws RegistryHandlerException {
UserSubscriptionQuery query = getQuery();
query.setDataSetName(dataSetName);
query.setProviderName(providerName);
query.setActive(true);
RegistryQueryResponse<UserSubscription> response = RegistryManager
.getRegistyObjects(query);
checkResponse(response, "getActiveByDataSetAndProvider");
return response.getResults();
}
}

View file

@ -167,7 +167,7 @@ public class HarvesterServiceManager implements ILocalizationFileObserver {
statusHandler.handle(
Priority.PROBLEM,
"Couldn't read the Service Config file: "
+ file.getAbsolutePath());
+ file.getAbsolutePath(), e);
}
} else {
// We might not be implementing a particular service so we only

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.common.datadelivery.service;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@ -31,6 +32,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 20, 2012 1413 bgonzale Initial creation.
* Apr 01, 2013 1841 djohnson Changed to use correct response class.
* </pre>
*
* @author bgonzale
@ -38,7 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@DynamicSerialize
public class ApprovedPendingSubscriptionNotificationRequest extends
SubscriptionNotificationRequest {
BaseSubscriptionNotificationRequest<InitialPendingSubscription> {
/**
* Default Constructor.
@ -47,7 +49,7 @@ public class ApprovedPendingSubscriptionNotificationRequest extends
}
@Override
public SubscriptionNotificationResponse getResponse() {
public ApprovedPendingSubscriptionNotificationResponse getResponse() {
return new ApprovedPendingSubscriptionNotificationResponse();
}
}

View file

@ -19,6 +19,9 @@
**/
package com.raytheon.uf.common.datadelivery.service;
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.IBaseSubscriptionHandler;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@ -31,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 20, 2012 1413 bgonzale Initial creation.
* Apr 01, 2013 1841 djohnson Changed to use correct response subscription handler.
* </pre>
*
* @author bgonzale
@ -38,5 +42,14 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@DynamicSerialize
public class ApprovedPendingSubscriptionNotificationResponse extends
SubscriptionNotificationResponse {
BaseSubscriptionNotificationResponse<InitialPendingSubscription> {
/**
* {@inheritDoc}
*/
@Override
public IBaseSubscriptionHandler<InitialPendingSubscription> getSubscriptionHandler() {
return DataDeliveryHandlers.getPendingSubscriptionHandler();
}
}

View file

@ -25,6 +25,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
@ -56,6 +57,7 @@ import com.raytheon.uf.common.serialization.jaxb.JaxbDummyObject;
* Aug 11, 2008 njensen Initial creation
* Aug 31, 2009 2924 rjpeter Added Embeddable.
* Feb 07, 2013 1543 djohnson Implement IJaxbableClassesLocator.
* Mar 29, 2013 1841 djohnson Never return null from hibernatables for plugin.
* </pre>
*
* @author njensen
@ -82,8 +84,6 @@ public class SerializableManager implements IJaxbableClassesLocator {
*/
@SuppressWarnings(value = { "unchecked" })
private synchronized void initialize() {
ClassLoader cl = getClass().getClassLoader();
long t0 = System.currentTimeMillis(), total = 0;
// this is here in case in the future we want to re-initialize the lists
// during runtime, i.e. hot deploy of a new plugin
hibernatables.clear();
@ -120,6 +120,7 @@ public class SerializableManager implements IJaxbableClassesLocator {
jaxbables = new ArrayList<Class<ISerializableObject>>(
clazzSet.size() + 1);
// Add jaxb dummy object so jaxb.properties gets picked up immediately
@SuppressWarnings("rawtypes")
Class jaxb = JaxbDummyObject.class;
jaxbables.add(jaxb);
jaxbables.addAll(clazzSet);
@ -129,23 +130,27 @@ public class SerializableManager implements IJaxbableClassesLocator {
+ (System.currentTimeMillis() - realStartTime) + "ms");
}
private static void fail(Class service, String msg, Throwable cause)
private static void fail(@SuppressWarnings("rawtypes") Class service,
String msg, Throwable cause)
throws ServiceConfigurationError {
throw new ServiceConfigurationError(service.getName() + ": " + msg,
cause);
}
private static void fail(Class service, String msg)
private static void fail(@SuppressWarnings("rawtypes") Class service,
String msg)
throws ServiceConfigurationError {
throw new ServiceConfigurationError(service.getName() + ": " + msg);
}
private static void fail(Class service, URL u, int line, String msg)
private static void fail(@SuppressWarnings("rawtypes") Class service,
URL u, int line, String msg)
throws ServiceConfigurationError {
fail(service, u + ":" + line + ": " + msg);
}
private static int parseLine(Class service, URL u, BufferedReader r,
private static int parseLine(@SuppressWarnings("rawtypes") Class service,
URL u, BufferedReader r,
int lc, List<String> names) throws IOException,
ServiceConfigurationError {
String ln = r.readLine();
@ -196,7 +201,11 @@ public class SerializableManager implements IJaxbableClassesLocator {
*/
public List<Class<ISerializableObject>> getHibernatablesForPluginFQN(
String pluginFQN) {
return hibernatables.get(pluginFQN);
List<Class<ISerializableObject>> list = hibernatables.get(pluginFQN);
if (list == null) {
list = Collections.<Class<ISerializableObject>> emptyList();
}
return list;
}
/**
@ -298,6 +307,7 @@ public class SerializableManager implements IJaxbableClassesLocator {
String clazz = iter.next();
try {
long t0 = System.currentTimeMillis();
@SuppressWarnings("unchecked")
Class<ISerializableObject> c = (Class<ISerializableObject>) Class
.forName(clazz, true, cl);
boolean added = false;

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.event.EventBus;
import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
@ -106,6 +107,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Feb 20, 2013 1543 djohnson Add try/catch blocks during the shutdown process.
* Feb 27, 2013 1644 djohnson Force sub-classes to provide an implementation for how to schedule SBN routed subscriptions.
* Mar 11, 2013 1645 djohnson Watch configuration file for changes.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* </pre>
*
* @author dhladky
@ -205,7 +207,9 @@ public abstract class BandwidthManager extends
+ "]");
}
} else if (DataDeliveryRegistryObjectTypes.SUBSCRIPTION
} else if (DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION
.equals(objectType)
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
.equals(objectType)) {
Subscription subscription = getSubscription(id);
@ -303,7 +307,12 @@ public abstract class BandwidthManager extends
Subscription sub = updateSubscriptionWithDataSetMetaData(
subscription, dataSetMetaData);
schedule(new AdhocSubscription(sub));
if (sub instanceof UserSubscription) {
schedule(new AdhocSubscription((UserSubscription) sub));
} else {
statusHandler
.warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future...");
}
}
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
@ -572,7 +581,10 @@ public abstract class BandwidthManager extends
public void subscriptionRemoved(RemoveRegistryEvent event) {
String objectType = event.getObjectType();
if (objectType != null) {
if (DataDeliveryRegistryObjectTypes.SUBSCRIPTION.equals(objectType)) {
if (DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION
.equals(objectType)
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
.equals(objectType)) {
statusHandler
.info("Recieved Subscription removal notification for Subscription ["
+ event.getId() + "]");
@ -739,9 +751,11 @@ public abstract class BandwidthManager extends
// Create an adhoc subscription based on the new subscription,
// and set it to retrieve the most recent cycle (or most recent
// url if a daily product)
AdhocSubscription adhoc = new AdhocSubscription(subscription);
adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime(adhoc,
useMostRecentDataSetUpdate);
if (subscription instanceof UserSubscription) {
AdhocSubscription adhoc = new AdhocSubscription(
(UserSubscription) subscription);
adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime(
adhoc, useMostRecentDataSetUpdate);
if (adhoc == null) {
statusHandler
@ -752,6 +766,10 @@ public abstract class BandwidthManager extends
} else {
unscheduled = schedule(adhoc);
}
} else {
statusHandler
.warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future...");
}
return unscheduled;
} else if (!subscription.isActive() || subscription.isUnscheduled()) {
// See if the subscription was inactivated or unscheduled..
@ -1598,7 +1616,7 @@ public abstract class BandwidthManager extends
previousLatency = latency;
latency *= 2;
Subscription clone = new Subscription(subscription);
Subscription clone = subscription.copy();
clone.setLatencyInMinutes(latency);
foundLatency = isSchedulableWithoutConflict(clone);
} while (!foundLatency);
@ -1612,7 +1630,7 @@ public abstract class BandwidthManager extends
possibleLatencies, new Comparable<Integer>() {
@Override
public int compareTo(Integer valueToCheck) {
Subscription clone = new Subscription(subscription);
Subscription clone = subscription.copy();
clone.setLatencyInMinutes(valueToCheck);
boolean latencyWouldWork = isSchedulableWithoutConflict(clone);

View file

@ -4,11 +4,15 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- Moved in to an EDEX specific file so that the registration of handlers Spring file
can be reused for automated testing -->
<!-- Moved in to an EDEX specific file so that the registration of handlers
Spring file can be reused for automated testing -->
<bean name="UserSubscriptionHandler"
class="com.raytheon.uf.common.datadelivery.registry.handlers.UserSubscriptionHandler" />
<bean name="SubscriptionHandler"
class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler" />
class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler">
<constructor-arg ref="UserSubscriptionHandler" />
</bean>
<bean name="PendingSubscriptionHandler"
class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler" />

View file

@ -17,11 +17,11 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1
com.raytheon.uf.common.status,
com.raytheon.uf.common.dataplugin.level;bundle-version="1.11.31",
com.raytheon.uf.common.sounding;bundle-version="1.12.1112",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0"
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.edex.plugin.scan.common;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
com.raytheon.uf.edex.dat.utils;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.edex.plugin.scan,
com.raytheon.uf.edex.plugin.scan.process
Import-Package: com.raytheon.uf.common.localization,
com.raytheon.uf.edex.dat.utils,
com.raytheon.uf.edex.plugin.scan.common,
javax.measure.converter,
Import-Package: javax.measure.converter,
javax.measure.unit

View file

@ -28,7 +28,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
@ -73,7 +72,8 @@ public class SubscriptionDeleteHandlerDeployTest {
public void testDeletingSubscriptionDeletesPendingAlso() throws Exception {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
PendingSubscription pending = PendingSubscriptionFixture.INSTANCE.get();
PendingSubscription pending = subscription.pending(subscription
.getOwner());
ISubscriptionHandler subHandler = DataDeliveryHandlers
.getSubscriptionHandler();

View file

@ -36,8 +36,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.time.util.TimeUtilTest;
@ -62,6 +62,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Dec 11, 2012 1403 djohnson No longer valid to run without bandwidth management.
* Feb 07, 2013 1543 djohnson Remove unnecessary test setup methods.
* Feb 20, 2013 1543 djohnson Delegate to sub-classes for which route to create subscriptions for.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -149,7 +150,7 @@ public abstract class AbstractBandwidthManagerIntTest {
*
* @return the subscription
*/
protected Subscription createSubscriptionThatFillsUpABucket() {
protected UserSubscription createSubscriptionThatFillsUpABucket() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize);
}
@ -158,7 +159,7 @@ public abstract class AbstractBandwidthManagerIntTest {
*
* @return the subscription
*/
protected Subscription createSubscriptionThatFillsUpTenBuckets() {
protected UserSubscription createSubscriptionThatFillsUpTenBuckets() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 10);
}
@ -167,7 +168,7 @@ public abstract class AbstractBandwidthManagerIntTest {
*
* @return the subscription
*/
protected Subscription createSubscriptionThatFillsHalfABucket() {
protected UserSubscription createSubscriptionThatFillsHalfABucket() {
return createSubscriptionWithDataSetSizeInBytes(halfBucketSize);
}
@ -176,7 +177,7 @@ public abstract class AbstractBandwidthManagerIntTest {
*
* @return the subscription
*/
protected Subscription createSubscriptionThatFillsAThirdOfABucket() {
protected UserSubscription createSubscriptionThatFillsAThirdOfABucket() {
return createSubscriptionWithDataSetSizeInBytes(thirdBucketSizeInBytes);
}
@ -185,12 +186,13 @@ public abstract class AbstractBandwidthManagerIntTest {
*
* @return the subscription
*/
protected Subscription createSubscriptionThatFillsUpTwoBuckets() {
protected UserSubscription createSubscriptionThatFillsUpTwoBuckets() {
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 2);
}
protected Subscription createSubscriptionWithDataSetSizeInBytes(long bytes) {
Subscription subscription = SubscriptionFixture.INSTANCE
protected UserSubscription createSubscriptionWithDataSetSizeInBytes(
long bytes) {
UserSubscription subscription = SubscriptionFixture.INSTANCE
.get(subscriptionSeed++);
subscription.setDataSetSize(BandwidthUtil
.convertBytesToKilobytes(bytes));

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -102,6 +103,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent;
* Feb 14, 2013 1595 djohnson Fix expired subscription updates that weren't scheduling retrievals.
* Feb 14, 2013 1596 djohnson Add test duplicating errors deleting multiple subscriptions for the same provider/dataset.
* Mar 11, 2013 1645 djohnson Test configuration file modifications.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -798,7 +800,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
final int numberOfSubscriptionsWithSameProviderDataSet = 4;
final Subscription templateSubscription = createSubscriptionThatFillsUpABucket();
final UserSubscription templateSubscription = createSubscriptionThatFillsUpABucket();
final Network route = templateSubscription.getRoute();
templateSubscription.setDataSetSize(templateSubscription
.getDataSetSize()
@ -810,7 +812,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
final Subscription[] subscriptions = new Subscription[numberOfSubscriptionsWithSameProviderDataSet];
for (int i = 0; i < numberOfSubscriptionsWithSameProviderDataSet; i++) {
final Subscription currentSubscription = new Subscription(
final UserSubscription currentSubscription = new UserSubscription(
templateSubscription, "ILookLikeTheOtherGuys-" + i);
subscriptions[i] = currentSubscription;
@ -997,7 +999,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
private void sendDeletedSubscriptionEvent(Subscription subscription) {
RemoveRegistryEvent event = new RemoveRegistryEvent(
subscription.getOwner(), subscription.getId());
event.setObjectType(DataDeliveryRegistryObjectTypes.SUBSCRIPTION);
event.setObjectType(DataDeliveryRegistryObjectTypes.USER_SUBSCRIPTION);
bandwidthManager.subscriptionRemoved(event);
}

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.harvester.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.harvester.CrawlAgent;
import com.raytheon.uf.common.datadelivery.harvester.HarvesterConfig;
@ -65,7 +66,7 @@ public class HarvesterConfigFixture extends AbstractFixture<HarvesterConfig> {
* {@inheritDoc}
*/
@Override
public HarvesterConfig get(long seedValue) {
public HarvesterConfig getInstance(long seedValue, Random random) {
HarvesterConfig config = new HarvesterConfig();
CrawlAgent crawl = new CrawlAgent();

View file

@ -39,7 +39,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
*/
public class AdhocSubscriptionFixture extends
BaseSubscriptionFixture<AdhocSubscription> {
BaseUserSubscriptionFixture<AdhocSubscription> {
public static final AdhocSubscriptionFixture INSTANCE = new AdhocSubscriptionFixture();

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
* Sep 27, 2012 1187 djohnson Initial creation
* Oct 16, 2012 0726 djohnson Use other fixtures to get appropriate values.
* Jan 30, 2013 1543 djohnson Add coverage/parameter data.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -53,9 +54,7 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
* {@inheritDoc}
*/
@Override
public T get(long seedValue) {
Random random = new Random(seedValue);
public T getInstance(long seedValue, Random random) {
T subscription = getSubscription();
subscription.setActive(random.nextBoolean());
subscription.setActivePeriodStart(TimeUtil.newDate());
@ -76,7 +75,6 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
subscription.setName("name" + seedValue);
subscription.setNotify(random.nextBoolean());
subscription.setOfficeID("officeID" + random.nextInt());
subscription.setOwner("owner" + random.nextInt());
subscription.addParameter(ParameterFixture.INSTANCE.get());
// Same priority for all, individual tests needing to test specific
// priorities should set it manually anyway

View file

@ -0,0 +1,64 @@
/**
* 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 java.util.Random;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
/**
* Adds attributes specific to {@link UserSubscription} types.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 29, 2013 1841 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public abstract class BaseUserSubscriptionFixture<T extends UserSubscription>
extends BaseSubscriptionFixture<T> {
/**
* {@inheritDoc}
*/
@Override
public T getInstance(long seedValue, Random random) {
T subscription = super.getInstance(seedValue, random);
subscription.setOwner("owner" + random.nextInt());
subscription.setId(RegistryUtil.getRegistryObjectKey(subscription));
return subscription;
}
/**
* @return
*/
@Override
protected abstract T getSubscription();
}

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Random;
import com.raytheon.uf.common.util.AbstractFixture;
/**
@ -53,7 +55,7 @@ public class ConnectionFixture extends AbstractFixture<Connection> {
* {@inheritDoc}
*/
@Override
public Connection get(long seedValue) {
public Connection getInstance(long seedValue, Random random) {
Connection connection = new Connection();
connection.setPassword("somePassword");
connection.setUrl("http://someUrl");

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Random;
import com.raytheon.uf.common.util.AbstractFixture;
/**
@ -52,7 +54,7 @@ public class DataLevelTypeFixture extends AbstractFixture<DataLevelType> {
* {@inheritDoc}
*/
@Override
public DataLevelType get(long seedValue) {
public DataLevelType getInstance(long seedValue, Random random) {
DataLevelType obj = new DataLevelType();
// TODO: Populate attributes

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Random;
import com.raytheon.uf.common.gridcoverage.Corner;
import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage;
import com.raytheon.uf.common.gridcoverage.exception.GridCoverageException;
@ -56,7 +58,7 @@ public class GriddedCoverageFixture extends AbstractFixture<GriddedCoverage> {
* {@inheritDoc}
*/
@Override
public GriddedCoverage get(long seedValue) {
public GriddedCoverage getInstance(long seedValue, Random random) {
LatLonGridCoverage gridCoverage = new LatLonGridCoverage();
gridCoverage.setCrsWKT("Polygon");
gridCoverage.setLa1(10);

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Arrays;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.util.AbstractFixture;
@ -58,7 +59,7 @@ public class LevelsFixture extends AbstractFixture<Levels> {
* {@inheritDoc}
*/
@Override
public Levels get(long seedValue) {
public Levels getInstance(long seedValue, Random random) {
Levels obj = new Levels();
obj.setLevel(Arrays.<Double> asList(1D, 2D, 3D));
obj.setLevelType(LevelType.SFC.getLevelTypeId());

View file

@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.TreeSet;
import com.raytheon.uf.common.util.AbstractFixture;
@ -61,7 +62,7 @@ public class OpenDapGriddedDataSetFixture extends
* {@inheritDoc}
*/
@Override
public OpenDapGriddedDataSet get(long seedValue) {
public OpenDapGriddedDataSet getInstance(long seedValue, Random random) {
OpenDapGriddedDataSet obj = new OpenDapGriddedDataSet();
obj.setCollectionName("collectionName-" + seedValue);
// TODO: CoverageFixture

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.datadelivery.registry;
import java.text.ParseException;
import java.util.Random;
import com.raytheon.uf.common.time.util.ImmutableDate;
import com.raytheon.uf.common.util.AbstractFixture;
@ -58,7 +59,7 @@ public class OpenDapGriddedDataSetMetaDataFixture extends
* {@inheritDoc}
*/
@Override
public OpenDapGriddedDataSetMetaData get(long seedValue) {
public OpenDapGriddedDataSetMetaData getInstance(long seedValue, Random random) {
final Time time = TimeFixture.INSTANCE.get(seedValue);
final OpenDapGriddedDataSet dataSet = OpenDapGriddedDataSetFixture.INSTANCE
.get(seedValue);

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Arrays;
import java.util.Random;
import com.raytheon.uf.common.util.AbstractFixture;
@ -55,7 +56,7 @@ public class ParameterFixture extends AbstractFixture<Parameter> {
* {@inheritDoc}
*/
@Override
public Parameter get(long seedValue) {
public Parameter getInstance(long seedValue, Random random) {
Parameter obj = new Parameter();
obj.setBaseType("baseType" + seedValue);
obj.setDataType(DataType.GRID);

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
import java.util.Random;
import com.raytheon.uf.common.util.AbstractFixture;
/**
@ -40,7 +42,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
*/
public class PendingSubscriptionFixture extends
BaseSubscriptionFixture<PendingSubscription> {
BaseUserSubscriptionFixture<PendingSubscription> {
public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture();
@ -54,8 +56,8 @@ public class PendingSubscriptionFixture extends
* {@inheritDoc}
*/
@Override
public PendingSubscription get(long seedValue) {
PendingSubscription sub = super.get(seedValue);
public PendingSubscription getInstance(long seedValue, Random random) {
PendingSubscription sub = super.getInstance(seedValue, random);
sub.setChangeReqId("change" + seedValue);
return sub;

View file

@ -33,6 +33,7 @@ import org.junit.Test;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 27, 2012 0743 djohnson Initial creation
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -44,7 +45,7 @@ public class PendingSubscriptionTest {
@Test
public void testCopyConstructorSetsOriginalSubNameAsName() {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
PendingSubscription pendingSubscription = new PendingSubscription(
subscription, "djohnson");
@ -55,7 +56,7 @@ public class PendingSubscriptionTest {
@Test
public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
PendingSubscription copied = new PendingSubscription(
subscription, "djohnson");
@ -70,7 +71,6 @@ public class PendingSubscriptionTest {
assertEquals(subscription.getDataSetType(), copied.getDataSetType());
assertEquals(subscription.getDescription(), copied.getDescription());
assertEquals(subscription.getGroupName(), copied.getGroupName());
assertEquals(subscription.getId(), copied.getId());
assertEquals(subscription.getOfficeID(), copied.getOfficeID());
assertEquals(subscription.getPriority(), copied.getPriority());
assertEquals(subscription.getProvider(), copied.getProvider());

View file

@ -60,9 +60,7 @@ public class ProviderFixture extends AbstractFixture<Provider> {
* {@inheritDoc}
*/
@Override
public Provider get(long seedValue) {
Random random = new Random(seedValue);
public Provider getInstance(long seedValue, Random random) {
Provider provider = new Provider();
provider.setConnection(ConnectionFixture.INSTANCE.get(seedValue));
provider.setErrorResponsePattern("error");

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* ------------ ---------- ----------- --------------------------
* Jan 07, 2013 1453 djohnson Initial creation
* Jan 30, 2013 1543 djohnson Add ability to specify route.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -94,8 +95,8 @@ public class SubscriptionBuilder {
/**
* {@inheritDoc}
*/
public Subscription build() {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
public UserSubscription build() {
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
subscription.setActive(active);
subscription.setActivePeriodStart(activePeriodStart);
subscription.setActivePeriodEnd(activePeriodEnd);

View file

@ -32,6 +32,7 @@ import com.raytheon.uf.common.util.AbstractFixture;
* ------------ ---------- ----------- --------------------------
* Aug 27, 2012 0743 djohnson Initial creation
* Sep 28, 2012 1187 djohnson Move reusable code to {@link BaseSubscriptionFixture}.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -39,7 +40,8 @@ import com.raytheon.uf.common.util.AbstractFixture;
* @version 1.0
*/
public class SubscriptionFixture extends BaseSubscriptionFixture<Subscription> {
public class SubscriptionFixture extends
BaseUserSubscriptionFixture<UserSubscription> {
public static final SubscriptionFixture INSTANCE = new SubscriptionFixture();
@ -53,7 +55,7 @@ public class SubscriptionFixture extends BaseSubscriptionFixture<Subscription> {
* {@inheritDoc}
*/
@Override
protected Subscription getSubscription() {
return new Subscription();
protected UserSubscription getSubscription() {
return new UserSubscription();
}
}

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.common.datadelivery.registry;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Random;
import com.raytheon.uf.common.time.util.ImmutableDate;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -61,7 +62,7 @@ public class TimeFixture extends AbstractFixture<Time> {
* {@inheritDoc}
*/
@Override
public Time get(long seedValue) {
public Time getInstance(long seedValue, Random random) {
Time time = new Time();
time.setFormat("HHddMMMyyyy");
time.setCycleTimes(Arrays.<Integer> asList(getCycleForSeed(seedValue)));

View file

@ -49,13 +49,14 @@ import com.raytheon.uf.common.time.util.TimeUtilTest;
* Aug 27, 2012 0743 djohnson Initial creation
* Jan 02, 2013 1345 djohnson Fix broken assertion that id matches copied object.
* Jan 11, 2013 1453 djohnson Add test for active period crossing year boundary.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class SubscriptionTest {
public class UserSubscriptionTest {
@Before
public void setUp() {
@ -73,9 +74,9 @@ public class SubscriptionTest {
@Test
public void testCopyConstructorSetsSpecifiedName() throws Exception {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
Subscription copied = new Subscription(subscription, "newName");
Subscription copied = new UserSubscription(subscription, "newName");
assertEquals("Expected the new name to be set on the subscription!",
"newName", copied.getName());
@ -84,9 +85,9 @@ public class SubscriptionTest {
@Test
public void testCopyConstructorSetsValuesFromSourceSubscription()
throws Exception {
Subscription subscription = SubscriptionFixture.INSTANCE.get();
UserSubscription subscription = SubscriptionFixture.INSTANCE.get();
Subscription copied = new Subscription(subscription, "newName");
Subscription copied = new UserSubscription(subscription, "newName");
assertEquals(subscription.getActivePeriodEnd(),
copied.getActivePeriodEnd());

View file

@ -38,6 +38,7 @@ 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.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService;
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
import com.raytheon.uf.common.registry.RegistryManagerTest;
@ -56,6 +57,7 @@ import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionService
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 1441 djohnson Initial creation
* Feb 26, 2013 1643 djohnson Change exception type thrown.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -95,9 +97,11 @@ public class GroupDefinitionServiceTest {
group.setGroupName(GROUP_NAME);
groupHandler.store(group);
Subscription subscription = new SubscriptionBuilder().withGroupName(
UserSubscription subscription = new SubscriptionBuilder()
.withGroupName(
GROUP_NAME).build();
Subscription subscription2 = new Subscription(subscription, "sub2");
UserSubscription subscription2 = new UserSubscription(subscription,
"sub2");
subscriptionHandler.store(subscription);
subscriptionHandler.store(subscription2);

View file

@ -76,14 +76,13 @@ public class TestJaxbableClassesLocator implements IJaxbableClassesLocator {
com.raytheon.uf.common.datadelivery.registry.PendingSubscription.class,
com.raytheon.uf.common.datadelivery.registry.Projection.class,
com.raytheon.uf.common.datadelivery.registry.Provider.class,
com.raytheon.uf.common.datadelivery.registry.Subscription.class,
com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle.class,
com.raytheon.uf.common.datadelivery.registry.SharedSubscription.class,
com.raytheon.uf.common.datadelivery.registry.UserSubscription.class,
com.raytheon.uf.common.datadelivery.registry.Time.class,
com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterLookup.class,
com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig.class,
com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate.class,
com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription.class,
com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval.class,
com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation.class,
com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap.class,
com.raytheon.uf.common.datadelivery.retrieval.xml.ServiceConfig.class,

View file

@ -48,7 +48,7 @@ public abstract class AbstractFixture<T> {
*
* @return the instance
*/
public T get() {
public final T get() {
return get(DEFAULT_SEED);
}
@ -59,7 +59,22 @@ public abstract class AbstractFixture<T> {
* the seed value
* @return the instance based on the seed value
*/
public abstract T get(long seedValue);
public final T get(long seedValue) {
Random random = new Random(seedValue);
return getInstance(seedValue, random);
}
/**
* Retrieve the instance generated via the specified seed value.
*
* @param seedValue
* the seed value
* @param random
* the random instance, if a random value is needed
* @return the instance
*/
protected abstract T getInstance(long seedValue, Random random);
/**
* Get a random enum value.

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.AbstractFixture;
@ -49,7 +51,7 @@ public abstract class BaseBandwidthAllocationFixture<T extends BandwidthAllocati
* {@inheritDoc}
*/
@Override
public T get(long seedValue) {
public T getInstance(long seedValue, Random random) {
T entity = getBandwidthAllocation();
entity.setActualStart(BandwidthUtil.now());
entity.setActualEnd(BandwidthUtil.now());

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
import com.raytheon.uf.common.util.AbstractFixture;
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
@ -47,7 +49,7 @@ public class DataSetMetaDataDaoFixture extends
* {@inheritDoc}
*/
@Override
public BandwidthDataSetUpdate get(long seedValue) {
public BandwidthDataSetUpdate getInstance(long seedValue, Random random) {
return BandwidthUtil
.newDataSetMetaDataDao(OpenDapGriddedDataSetMetaDataFixture.INSTANCE
.get(seedValue));

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.serialization.SerializationException;
@ -57,7 +59,7 @@ public class SubscriptionDaoFixture extends AbstractFixture<BandwidthSubscriptio
* {@inheritDoc}
*/
@Override
public BandwidthSubscription get(long seedValue) {
public BandwidthSubscription getInstance(long seedValue, Random random) {
Subscription sub = SubscriptionFixture.INSTANCE.get(seedValue);
try {
return BandwidthUtil.getSubscriptionDaoForSubscription(sub,

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
import java.util.Random;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.SubscriptionRetrievalAgent;
@ -55,8 +57,8 @@ public class SubscriptionRetrievalFixture extends
* {@inheritDoc}
*/
@Override
public SubscriptionRetrieval get(long seedValue) {
SubscriptionRetrieval entity = super.get(seedValue);
public SubscriptionRetrieval getInstance(long seedValue, Random random) {
SubscriptionRetrieval entity = super.getInstance(seedValue, random);
entity.setDataSetAvailablityDelay(0);
entity.setAgentType(SubscriptionRetrievalAgent.SUBSCRIPTION_AGENT);
entity.setEstimatedSize(seedValue);

View file

@ -31,6 +31,7 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
@ -46,6 +47,7 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 19, 2013 1543 djohnson Initial creation
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -62,15 +64,16 @@ public class FindActiveSubscriptionsForRouteTest {
.getSubscriptionHandler();
// Two OPSNET subscriptions
final Subscription opsnetSub1 = new SubscriptionBuilder()
final UserSubscription opsnetSub1 = new SubscriptionBuilder()
.withName("opsnetSub1").withRoute(Network.OPSNET).build();
final Subscription opsnetSub2 = new Subscription(opsnetSub1,
final UserSubscription opsnetSub2 = new UserSubscription(opsnetSub1,
"opsnetSub2");
// Two SBN subscriptions
final Subscription sbnSub1 = new SubscriptionBuilder()
final UserSubscription sbnSub1 = new SubscriptionBuilder()
.withName("sbnSub1").withRoute(Network.SBN).build();
final Subscription sbnSub2 = new Subscription(sbnSub1, "sbnSub2");
final UserSubscription sbnSub2 = new UserSubscription(sbnSub1,
"sbnSub2");
// Store all subscriptions
for (Subscription sub : new Subscription[] { opsnetSub1, opsnetSub2,

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.edex.datadelivery.retrieval.handlers;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
@ -65,7 +66,7 @@ public class RetrievalPluginDataObjectsFixture extends
* {@inheritDoc}
*/
@Override
public RetrievalResponseXml get(long seedValue) {
public RetrievalResponseXml getInstance(long seedValue, Random random) {
RetrievalRequestRecord requestRecord = RetrievalRequestRecordFixture.INSTANCE
.get(seedValue);
List<RetrievalResponseWrapper> retrievalAttributePluginDataObjects = new ArrayList<RetrievalResponseWrapper>();

View file

@ -19,6 +19,8 @@
**/
package com.raytheon.uf.edex.datadelivery.retrieval.handlers;
import java.util.Random;
import com.raytheon.uf.common.datadelivery.registry.GriddedCoverageFixture;
import com.raytheon.uf.common.datadelivery.registry.Provider;
import com.raytheon.uf.common.datadelivery.registry.ProviderFixture;
@ -69,7 +71,7 @@ public class RetrievalRequestRecordFixture extends
* {@inheritDoc}
*/
@Override
public RetrievalRequestRecord get(long seedValue) {
public RetrievalRequestRecord getInstance(long seedValue, Random random) {
Subscription subscription = SubscriptionFixture.INSTANCE.get(seedValue);
final Provider provider = ProviderFixture.INSTANCE.get(seedValue);

View file

@ -30,6 +30,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.registry.RegistryManagerTest;
/**
@ -46,6 +47,7 @@ import com.raytheon.uf.common.registry.RegistryManagerTest;
* Aug 20, 2012 0743 djohnson Use {@link RegistryManagerTest} to set the handler.
* Sep 24, 2012 1209 djohnson Test for NO_CYCLE metadatas and subscriptions.
* Oct 17, 2012 0726 djohnson Remove unused code.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -59,7 +61,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12));
Subscription subscription = new Subscription();
UserSubscription subscription = new UserSubscription();
subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -75,7 +77,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12));
Subscription subscription = new Subscription();
UserSubscription subscription = new UserSubscription();
subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -91,7 +93,7 @@ public class OpenDAPRetrievalGeneratorTest {
Time time = new Time();
time.setCycleTimes(Arrays.asList(0, 12));
Subscription subscription = new Subscription();
Subscription subscription = new UserSubscription();
subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
@ -108,7 +110,7 @@ public class OpenDAPRetrievalGeneratorTest {
time.setCycleTimes(Arrays
.<Integer> asList(GriddedDataSetMetaData.NO_CYCLE));
Subscription subscription = new Subscription();
Subscription subscription = new UserSubscription();
subscription.setTime(time);
GriddedDataSetMetaData metaData = OpenDapGriddedDataSetMetaDataFixture.INSTANCE

View file

@ -45,6 +45,7 @@ import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.time.CalendarBuilder;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -71,6 +72,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlg
* Jan 02, 2012 1345 djohnson Remove obsolete test.
* Jan 04, 2013 1453 djohnson Add tests for setting the active period.
* Jan 11, 2013 1453 djohnson Add test from failed test scenario.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -204,7 +206,7 @@ public class CreateSubscriptionPresenterTest {
cal.add(Calendar.YEAR, -1);
Date oneYearAgo = cal.getTime();
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(oneYearAgo)
.withActivePeriodEnd(oneYearAgo).build();
@ -228,7 +230,7 @@ public class CreateSubscriptionPresenterTest {
// Freeze time at Jan. 5
TimeUtilTest.freezeTime(yesterday.getTime() + TimeUtil.MILLIS_PER_DAY);
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(yesterday)
.withActivePeriodEnd(yesterday).build();
@ -261,7 +263,7 @@ public class CreateSubscriptionPresenterTest {
cal.add(Calendar.DAY_OF_MONTH, 3);
Date threeDaysFromNow = cal.getTime();
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(yesterday)
.withActivePeriodEnd(threeDaysFromNow).build();
@ -288,7 +290,7 @@ public class CreateSubscriptionPresenterTest {
cal2.add(Calendar.DAY_OF_YEAR, 3);
Date oneYearAgoPlusThreeDays = cal2.getTime();
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(oneYearAgo)
.withActivePeriodEnd(oneYearAgoPlusThreeDays).build();
@ -320,7 +322,7 @@ public class CreateSubscriptionPresenterTest {
cal2.set(Calendar.YEAR, 1970);
Date januaryFourth = cal2.getTime();
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(decemberThirtieth)
.withActivePeriodEnd(januaryFourth).build();
@ -384,7 +386,7 @@ public class CreateSubscriptionPresenterTest {
cal2.set(Calendar.YEAR, 1970);
final Date endDate = cal2.getTime();
Subscription subscription = new SubscriptionBuilder()
UserSubscription subscription = new SubscriptionBuilder()
.withActivePeriodStart(startDate).withActivePeriodEnd(endDate)
.build();

View file

@ -30,6 +30,7 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.UserSubscription;
import com.raytheon.uf.common.units.DataSizeUnit;
import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions;
import com.raytheon.uf.viz.datadelivery.system.Operator;
@ -50,6 +51,7 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
* Jan 03, 2013 1420 mpduff Initial creation.
* Jan 14, 2013 1286 djohnson Use the rule operator as an {@link Operator}.
* Jan 17, 2013 1357 mpduff DataSizeUnits was moved.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
*
* </pre>
*
@ -62,7 +64,7 @@ public class RuleXMLTest {
@Before
public void setUp() {
sub = new Subscription();
sub = new UserSubscription();
sub.setDataSetName("GFS");
sub.setDataSetType(DataType.GRID);
sub.setDataSetSize(100);