diff --git a/cave/com.raytheon.uf.viz.application/src/com/raytheon/uf/viz/application/VizApplication.java b/cave/com.raytheon.uf.viz.application/src/com/raytheon/uf/viz/application/VizApplication.java
index bce63b495b..751236b7ee 100644
--- a/cave/com.raytheon.uf.viz.application/src/com/raytheon/uf/viz/application/VizApplication.java
+++ b/cave/com.raytheon.uf.viz.application/src/com/raytheon/uf/viz/application/VizApplication.java
@@ -19,6 +19,10 @@
package com.raytheon.uf.viz.application;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -40,6 +44,7 @@ import com.raytheon.uf.viz.application.component.IStandaloneComponent;
* Dec 03, 2007 461 bphillip Added persistence of workstation time to localization
* Oct 07, 2008 1433 chammack Added alertviz startup
* Nov 27, 2013 mschenke Removed ProgramArguments to make dependencies cleaner
+ * Jan 23, 2014 njensen Added shutdown hook and printout
*
*
*
@@ -55,6 +60,7 @@ public class VizApplication implements IApplication {
* @seeorg.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
* IApplicationContext)
*/
+ @Override
public Object start(IApplicationContext context) throws Exception {
String appToRun = null;
String[] arguments = Platform.getApplicationArgs();
@@ -86,6 +92,8 @@ public class VizApplication implements IApplication {
return IApplication.EXIT_OK;
}
+ addShutdownHook();
+
return component.startComponent(appToRun);
}
@@ -94,6 +102,7 @@ public class VizApplication implements IApplication {
*
* @see org.eclipse.equinox.app.IApplication#stop()
*/
+ @Override
public void stop() {
}
@@ -131,4 +140,29 @@ public class VizApplication implements IApplication {
return standalone;
}
+ protected void addShutdownHook() {
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ @Override
+ public void run() {
+ /*
+ * This may seem pointless but is actually quite helpful to
+ * confirm how the process exited. If the process is killed by a
+ * kill command on a terminal, the console output will have this
+ * message but not the normal safe shutdown output (see
+ * com.raytheon.uf.viz.core.Activator's stop() and
+ * VizWorkbenchAdvisor's preShutdown()). In contrast, a
+ * spontaneous death of the process or force kill will not have
+ * this printout.
+ */
+ SimpleDateFormat sdf = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss");
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+ System.out.println(sdf.format(new Date())
+ + " VizApplication's runtime shutdown hook triggered");
+ }
+ }) {
+
+ });
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.core/plugin.xml b/cave/com.raytheon.uf.viz.core/plugin.xml
index a8d4cfa4c8..019190c77c 100644
--- a/cave/com.raytheon.uf.viz.core/plugin.xml
+++ b/cave/com.raytheon.uf.viz.core/plugin.xml
@@ -106,5 +106,8 @@
+
+
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/colormap/GeneralColormapShadedShapeExtension.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/colormap/GeneralColormapShadedShapeExtension.java
new file mode 100644
index 0000000000..2bb9c1f346
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/colormap/GeneralColormapShadedShapeExtension.java
@@ -0,0 +1,267 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.viz.core.drawables.ext.colormap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.swt.graphics.RGB;
+import org.geotools.coverage.grid.GeneralGridGeometry;
+
+import com.raytheon.uf.viz.core.IGraphicsTarget;
+import com.raytheon.uf.viz.core.drawables.IShadedShape;
+import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
+import com.raytheon.uf.viz.core.exception.VizException;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.Polygon;
+
+/**
+ * For targets which cannot optimize support of {@link IColormapShadedShape}
+ * this will provide an inefficient default that simply generates a shaded shape
+ * whenever draw is called with new colors.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------- -------- ----------- --------------------------
+ * Jan 23, 2014 2363 bsteffen Initial creation
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+public class GeneralColormapShadedShapeExtension extends
+ GraphicsExtension implements
+ IColormapShadedShapeExtension {
+
+ @Override
+ public GeneralColormapShadedShape createColormapShadedShape(
+ GeneralGridGeometry targetGeometry, boolean tesselate) {
+ return new GeneralColormapShadedShape(targetGeometry, tesselate);
+ }
+
+ @Override
+ public IShadedShape createShadedShape(IColormapShadedShape baseShape,
+ Map colors) {
+ GeneralColormapShadedShape generalShape = (GeneralColormapShadedShape) baseShape;
+ return generalShape.generateShape(target, colors);
+ }
+
+ @Override
+ public void drawColormapShadedShape(IColormapShadedShape shape,
+ Map colors, float alpha, float brightness)
+ throws VizException {
+ if (shape.isDrawable()) {
+ GeneralColormapShadedShape generalShape = (GeneralColormapShadedShape) shape;
+ IShadedShape shadedShape = generalShape.getShape(target,
+ colors);
+ target.drawShadedShape(shadedShape, alpha, brightness);
+ }
+ }
+
+ @Override
+ public int getCompatibilityValue(IGraphicsTarget target) {
+ return Compatibilty.GENERIC;
+ }
+
+ /**
+ * Contains all the interesting logic for this extension. Basic
+ * functionality is to save off the LineStrings for each add operation so
+ * that a real {@link IShadedShape} can be generated when the colors are
+ * provided. Also keeps around a shape after rendering for potential reuse
+ * if the colors don't change.
+ */
+ private static class GeneralColormapShadedShape implements
+ IColormapShadedShape {
+
+ private final GeneralGridGeometry targetGeometry;
+
+ private final boolean tesselate;
+
+ private List addPairs = new ArrayList();
+
+ private Map lastColors;
+
+ private IShadedShape lastShape;
+
+ private GeneralColormapShadedShape(GeneralGridGeometry targetGeometry,
+ boolean tesselate) {
+ this.targetGeometry = targetGeometry;
+ this.tesselate = tesselate;
+ }
+
+ /**
+ * Get a shaded shape that can be used to render this. This method also
+ * implements the caching if colors doesn't change.
+ *
+ * @param target
+ * the target be rendered onto.
+ * @param colors
+ * the colors to use for the shape
+ * @return the shape to render.
+ */
+ public IShadedShape getShape(IGraphicsTarget target,
+ Map colors) {
+ if (!colors.equals(lastColors)) {
+ if (lastShape != null) {
+ lastShape.dispose();
+ }
+ lastShape = generateShape(target, colors);
+ lastColors = new HashMap(colors);
+ }
+
+ return lastShape;
+ }
+
+ /**
+ * Generate a new {@link IShadedShape} that renders identically to this.
+ *
+ * @param target
+ * the target be rendered onto.
+ * @param colors
+ * the colors to use for the shape
+ * @return a new shape that will render the same as this shape with
+ * colors applied.
+ */
+ public IShadedShape generateShape(IGraphicsTarget target,
+ Map colors) {
+ IShadedShape shape = target.createShadedShape(true, targetGeometry,
+ tesselate);
+ for (AddPair pair : addPairs) {
+ if (pair.pixelSpace) {
+ shape.addPolygonPixelSpace(pair.lineString,
+ colors.get(pair.colorKey));
+ } else {
+ shape.addPolygon(pair.lineString, colors.get(pair.colorKey));
+ }
+ }
+ return shape;
+ }
+
+ @Override
+ public void compile() {
+ if (lastShape != null) {
+ lastShape.compile();
+ }
+ }
+
+ @Override
+ public boolean isMutable() {
+ if (lastShape != null) {
+ return lastShape.isMutable();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isDrawable() {
+ return !addPairs.isEmpty();
+ }
+
+ @Override
+ public void dispose() {
+ if (lastShape != null) {
+ lastShape.dispose();
+ lastShape = null;
+ }
+ addPairs = new ArrayList();
+ }
+
+ @Override
+ public void reset() {
+ lastShape.reset();
+ lastColors.clear();
+ addPairs = new ArrayList();
+ }
+
+ @Override
+ public Collection getColorKeys() {
+ Set keys = new HashSet(addPairs.size(), 1.0f);
+
+ return keys;
+ }
+
+ @Override
+ public void addPolygon(LineString[] lineString, Object colorKey) {
+ addPairs.add(new AddPair(lineString, colorKey, false));
+ if (lastShape != null && lastColors != null) {
+ lastShape.addPolygon(lineString, lastColors.get(colorKey));
+ }
+ }
+
+ @Override
+ public void addPolygonPixelSpace(LineString[] contours, Object colorKey) {
+ addPairs.add(new AddPair(contours, colorKey, true));
+ if (lastShape != null && lastColors != null) {
+ lastShape.addPolygonPixelSpace(contours,
+ lastColors.get(colorKey));
+ }
+ }
+
+ @Override
+ public void addGeometry(Geometry geometry, Object colorKey) {
+ if (geometry instanceof GeometryCollection) {
+ GeometryCollection geomCollection = (GeometryCollection) geometry;
+ for (int i = 0; i < geomCollection.getNumGeometries(); i++) {
+ addGeometry(geomCollection.getGeometryN(i), colorKey);
+ }
+ } else if (geometry instanceof LineString) {
+ LineString[] lineStrings = { (LineString) geometry };
+ addPolygon(lineStrings, colorKey);
+ } else if (geometry instanceof Polygon) {
+ LineString[] lineStrings = { ((Polygon) geometry)
+ .getExteriorRing() };
+ addPolygon(lineStrings, colorKey);
+ }
+ }
+
+ }
+
+ /**
+ * Simple Object for storing the parameters to any of the add methods on
+ * {@link IColormapShadedShape}.
+ */
+ private static class AddPair {
+ public final LineString[] lineString;
+
+ public final Object colorKey;
+
+ public final boolean pixelSpace;
+
+ public AddPair(LineString[] lineString, Object colorKey,
+ boolean pixelSpace) {
+ this.lineString = lineString;
+ this.colorKey = colorKey;
+ this.pixelSpace = pixelSpace;
+ }
+
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java
index e3e0f6a6ab..7b2cc8518a 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.viz.core.reflect;
import java.io.IOException;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -45,6 +46,7 @@ import org.reflections.util.ConfigurationBuilder;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 21, 2013 2491 bsteffen Initial creation
+ * Jan 22, 2014 2062 bsteffen Handle bundles with no wiring.
*
*
*
@@ -54,19 +56,28 @@ import org.reflections.util.ConfigurationBuilder;
public class BundleReflections {
- private Reflections reflections;
+ private final Reflections reflections;
public BundleReflections(Bundle bundle, Scanner scanner) throws IOException {
ConfigurationBuilder cb = new ConfigurationBuilder();
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
- cb.addClassLoader(bundleWiring.getClassLoader());
- cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL());
- cb.setScanners(scanner);
- reflections = cb.build();
+ if (bundleWiring != null) {
+ cb.addClassLoader(bundleWiring.getClassLoader());
+ cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL());
+ cb.setScanners(scanner);
+ reflections = cb.build();
+ } else {
+ reflections = null;
+ }
+
}
public Set> getSubTypesOf(final Class type) {
- return reflections.getSubTypesOf(type);
+ if (reflections == null) {
+ return Collections.emptySet();
+ } else {
+ return reflections.getSubTypesOf(type);
+ }
}
public Set> getSubTypesOf(Class>... types) {
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java
index 49de8e9701..c375f7a8ec 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java
@@ -145,6 +145,14 @@ public class SubClassLocator implements ISubClassLocator {
*/
return Collections.emptySet();
}
+
+ if(bundle.getState() == Bundle.UNINSTALLED){
+ /*
+ * We won't be able to get a class loader for uninstalled bundles so
+ * don't process them.
+ */
+ return Collections.emptySet();
+ }
if (includeRequiredSubclasses) {
/* Short circut if we already did this. */
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
index 7c5ab489d3..d17808a4c7 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
@@ -94,6 +94,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Oct 10, 2013 2104 mschenke Switched to use MapScalesManager
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 10, 2014 2452 mpduff Add label stating all lat/lons will be converted to easting.
+ * Jan 25, 2014 2452 mpduff Changed label based on feedback.
*
*
*
@@ -405,7 +406,7 @@ public class AreaComp extends Composite implements ISubset {
gd = new GridData();
gd.horizontalSpan = 1;
Label l = new Label(regionComp, SWT.LEFT);
- l.setText("All entries will be converted to Easting (0-360)");
+ l.setText("Lat/Lon values will be in the format of the data set.");
l.setLayoutData(gd);
/*
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
index a2360cfb8f..5b89c78341 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
@@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
* Dec 4, 2012 1286 djohnson Initial creation
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jan 17, 2014 2459 mpduff Change gui usage of unscheduled to deactivated.
+ * Jan 26, 2014 2459 mpduff Change unscheduled label to deactivated.
*
*
*
@@ -92,7 +93,7 @@ public class CancelForceApplyAndIncreaseLatencyDisplayText implements
+ " and leave in a Deactivated status";
}
return titleCaseActionText + " " + name
- + " and unschedule the others";
+ + " and deactivate the others";
case EDIT_SUBSCRIPTIONS:
return "Edit the "
+ ((singleSubscription) ? "subscription" : "subscriptions");
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
index 20a5f298bf..203a1a7893 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
@@ -45,7 +45,9 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedTime;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
+import com.raytheon.uf.common.datadelivery.registry.RecurringSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionState;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
@@ -94,6 +96,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 12, 2013 2460 dhladky restored adhoc subscriptions to registry storage.
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
+ * Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
*
*
*
@@ -768,6 +771,10 @@ public class SubscriptionService implements ISubscriptionService {
continue;
}
unscheduledSub.setUnscheduled(true);
+ if (unscheduledSub instanceof RecurringSubscription) {
+ ((RecurringSubscription) unscheduledSub)
+ .setSubscriptionState(SubscriptionState.OFF);
+ }
subscriptionHandler.update(unscheduledSub);
}
}
diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/VectorGraphicsRenderable.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/VectorGraphicsRenderable.java
index f38d1ff12a..1fabca82c7 100644
--- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/VectorGraphicsRenderable.java
+++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/util/VectorGraphicsRenderable.java
@@ -278,7 +278,7 @@ public class VectorGraphicsRenderable {
lineShape.addLineSegment(new double[][] { { ix2, jy2 },
{ ix3, jy3 } });
if (config.isBarbFillFiftyTriangle()) {
- double[] triangleRaw = { ix1, jy1, ix2, jy2, ix3, jy3 };
+ double[] triangleRaw = { ix1, jy1, ix2, jy2, ix3, jy3, ix1, jy1 };
CoordinateSequence triangleSeq = new PackedCoordinateSequence.Double(
triangleRaw, 2);
LineString triangleLS = new GeometryFactory()
diff --git a/edexOsgi/build.edex/esb/conf/logback-ingest.xml b/edexOsgi/build.edex/esb/conf/logback-ingest.xml
index f987275dae..d040b385c1 100644
--- a/edexOsgi/build.edex/esb/conf/logback-ingest.xml
+++ b/edexOsgi/build.edex/esb/conf/logback-ingest.xml
@@ -200,8 +200,9 @@
-
+
+
diff --git a/edexOsgi/build.edex/esb/etc/devRegistry.sh b/edexOsgi/build.edex/esb/etc/devRegistry.sh
index c00775981d..86b41aaf4c 100644
--- a/edexOsgi/build.edex/esb/etc/devRegistry.sh
+++ b/edexOsgi/build.edex/esb/etc/devRegistry.sh
@@ -27,3 +27,6 @@ export EDEX_JMX_PORT=1620
export LOG_CONF=logback-registry.xml
export MGMT_PORT=9605
export EBXML_REGISTRY_FEDERATION_ENABLED=false
+export NCF_HOST=${DATADELIVERY_HOST}
+export NCF_ADDRESS=http://${NCF_HOST}:${EBXML_REGISTRY_WEBSERVER_PORT}
+export NCF_BANDWIDTH_MANAGER_SERVICE=http://${NCF_HOST}:${EBXML_THRIFT_SERVICE_PORT}/services
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/MapManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/MapManager.java
index f74ae6c2c2..472822d937 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/MapManager.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/reference/MapManager.java
@@ -37,6 +37,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import jep.JepException;
@@ -103,6 +104,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* from localMaps.py could not be found,
* warnings clean up.
* Sep 30, 2013 #2361 njensen Use JAXBManager for XML
+ * Jan 21, 2014 #2720 randerso Improve efficiency of merging polygons in edit area generation
*
*
*
@@ -436,7 +438,7 @@ public class MapManager {
List values = new ArrayList();
for (int j = 0; j < iscMarkersID.size(); j++) {
int index = _config.allSites().indexOf(iscMarkersID.get(j));
- if (index != -1
+ if ((index != -1)
&& _config.officeTypes().get(index)
.equals(foundOfficeTypes.get(i))) {
values.add(iscMarkers.get(j));
@@ -512,7 +514,7 @@ public class MapManager {
String thisSite = _config.getSiteID().get(0);
for (int i = 0; i < data.size(); i++) {
String n = data.get(i).getId().getName();
- if (n.length() == 7 && n.startsWith("ISC_")) {
+ if ((n.length() == 7) && n.startsWith("ISC_")) {
String cwa = n.substring(4, 7);
if (cwa.equals(thisSite)) {
statusHandler
@@ -597,8 +599,8 @@ public class MapManager {
} else {
// Write the new edit area file.
try {
- ReferenceData.getJAXBManager().marshalToXmlFile(
- ref, path.getAbsolutePath());
+ ReferenceData.getJAXBManager().marshalToXmlFile(ref,
+ path.getAbsolutePath());
} catch (Exception e) {
statusHandler.error("Error writing edit area to file "
+ path.getAbsolutePath(), e);
@@ -827,7 +829,7 @@ public class MapManager {
PreparedGeometry boundingGeometry = PreparedGeometryFactory
.prepare(p);
- Map tempData = new HashMap();
+ Map tempData = new HashMap();
while (shapeSource.hasNext()) {
SimpleFeature f = shapeSource.next();
Map info = shapeSource.getAttributes(f);
@@ -838,7 +840,7 @@ public class MapManager {
}
String editAreaName = runNamer(mapDef.getInstanceName(), info);
- ReferenceData tmp;
+ Geometry tmp;
// validate edit area name, add edit area to the dictionary
String ean = validateEAN(editAreaName);
@@ -859,14 +861,25 @@ public class MapManager {
// handle append case
tmp = tempData.get(ean);
if (tmp != null) {
- mp = mp.union(tmp.getPolygons(CoordinateType.LATLON));
- mp = mp.buffer(0.0);
+ // Combine multiple geometries into a geometry collection
+ mp = gf.buildGeometry(Arrays.asList(mp, tmp));
}
// handle new case
else {
created.add(ean);
editAreaAttrs.put(ean, info);
}
+
+ tempData.put(ean, mp);
+ }
+
+ for (Entry entry : tempData.entrySet()) {
+ String ean = entry.getKey();
+ Geometry mp = entry.getValue();
+
+ // Compute buffer(0.0) to clean up geometry issues
+ mp = mp.buffer(0.0);
+
MultiPolygon polygons;
if (mp instanceof MultiPolygon) {
polygons = (MultiPolygon) mp;
@@ -874,13 +887,21 @@ public class MapManager {
polygons = gf
.createMultiPolygon(new Polygon[] { (Polygon) mp });
} else {
- statusHandler.info("Creating empty polygon");
+ String error = "Table: " + shapeSource.getTableName()
+ + " edit area:" + ean
+ + " contains geometry of type "
+ + mp.getClass().getSimpleName()
+ + " Creating empty polygon";
+ statusHandler.error(error);
polygons = gf.createMultiPolygon(new Polygon[] {});
}
if (!polygons.isValid()) {
- String error = shapeSource.getTableName()
- + " contains invalid polygons.";
+ String error = "Table: "
+ + shapeSource.getTableName()
+ + " edit area:"
+ + ean
+ + " contains invalid polygons. This edit area will be skipped.";
for (int i = 0; i < polygons.getNumGeometries(); i++) {
Geometry g = polygons.getGeometryN(i);
if (!g.isValid()) {
@@ -888,14 +909,14 @@ public class MapManager {
}
}
statusHandler.error(error);
+ continue;
}
- tempData.put(ean, new ReferenceData(_config.dbDomain(),
- new ReferenceID(ean), polygons, CoordinateType.LATLON));
+ // transfer dictionary values to Seq values
+ data.add(new ReferenceData(_config.dbDomain(), new ReferenceID(
+ ean), polygons, CoordinateType.LATLON));
}
- // transfer dictionary values to Seq values
- data.addAll(tempData.values());
tempData.clear();
} catch (Exception e) {
String error = "********* EDIT AREA GENERATION ERROR - Create Reference Data *********\n"
@@ -954,13 +975,13 @@ public class MapManager {
// strip out white space and punctuation (except _)
for (int i = s.length() - 1; i >= 0; i--) {
- if (!Character.isLetterOrDigit(s.charAt(i)) && s.charAt(i) != '_') {
+ if (!Character.isLetterOrDigit(s.charAt(i)) && (s.charAt(i) != '_')) {
s = s.substring(0, i) + s.substring(i + 1);
}
}
// ensure 1st character is not a number. If a number, preprend.
- if (s.length() > 0 && Character.isDigit(s.charAt(0))) {
+ if ((s.length() > 0) && Character.isDigit(s.charAt(0))) {
s = "ea" + s;
}
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py
index fa25560fbb..8da06958a4 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py
@@ -21,24 +21,6 @@
# further licensing information.
##
-""":"
-
-CWD=`pwd`
-CONFIG_HOME=`dirname ${0} | sed "s%^\.%$CWD%"`
-
-. $CONFIG_HOME/site.sh
-
-# set environment variables so logStream will work
-export LOG_PREF="$GFESUITE_ETCDIR/BASE/logPref/iscDataRec.logPref"
-export LOG_DIR="$GFESUITE_LOGDIR"
-export COLLECTIVE_FILE="%L/%D/iscDataRec_%H"
-unset LOG_FILE
-
-# Ok now start iscDataRec
-cd $GFESUITE_HOME/bin
-exec $GFESUITE_HOME/bin/run/iscDataRec1 -S -O $0 ${1+"$@"}
-""" # for emacs -> "
-
import iscMosaic,iscUtil
import os, stat, sys, re, string, traceback, types
import time, xml, LogStream, IrtAccess
@@ -60,6 +42,7 @@ from java.util import ArrayList
# 03/12/13 1759 dgilling Bypass command-line processing
# for iscMosaic, support changes
# to IscReceiveSrv.
+# 01/24/14 2504 randerso removed obsolete A1 comments
#
#
#
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py
index 3ad6837ecf..4a72410c98 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscUtil.py
@@ -19,7 +19,7 @@
##
import string, IrtAccess, JUtil, logging
-import xml, pickle, tempfile, os
+import xml, pickle, tempfile, os, socket
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
import LogStream
@@ -50,7 +50,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
# 03/11/13 1759 dgilling Move siteConfig import into
# methods where it's needed.
# 11/07/13 2517 randerso Allow getLogger to override logLevel
-#
+# 01/22/14/ 2504 randerso Added hostname to log path
#
#
@@ -285,17 +285,17 @@ def getLogger(scriptName, logName=None, logLevel=logging.INFO):
# modify its include path with the proper siteConfig just before
# execution time
import siteConfig
-
+ hostname = socket.gethostname().split('.')[0]
+ logPath = os.path.join(siteConfig.GFESUITE_LOGDIR, strftime("%Y%m%d", gmtime()), hostname)
if logName is None:
- logPath = siteConfig.GFESUITE_LOGDIR + "/" + strftime("%Y%m%d", gmtime())
logName = scriptName + ".log"
else:
- logPath = os.path.dirname(logName)
- if len(logPath) == 0:
- logPath = siteConfig.GFESUITE_LOGDIR + "/" + strftime("%Y%m%d", gmtime())
+ logDir = os.path.dirname(logName)
+ if len(logDir) > 0:
+ logPath = logDir
logName = os.path.basename(logName)
- logFile = logPath + "/" + logName
+ logFile = os.path.join(logPath, logName)
if not os.path.exists(logPath):
os.makedirs(logPath)
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/TimeWindowData.java b/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/TimeWindowData.java
index 594edbd85b..71155c46b4 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/TimeWindowData.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/TimeWindowData.java
@@ -20,16 +20,14 @@
package com.raytheon.uf.common.datadelivery.bandwidth.data;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
import java.util.TimeZone;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.util.TimeUtil;
+import com.raytheon.uf.common.util.StringUtil;
/**
* Time Window Data object.
@@ -44,6 +42,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Dec 06, 2012 1397 djohnson Add dynamic serialize class annotation.
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
* Nov 25, 2013 2545 mpduff Add Network.
+ * Jan 23, 2014 2636 mpduff Removed binStartTimes, add base time and offset.
*
*
*
@@ -60,14 +59,16 @@ public class TimeWindowData implements Comparable {
@DynamicSerializeElement
private long timeWindowEndTime = 0L;
- /** Array of bin start times for this time window. */
- @DynamicSerializeElement
- private List binStartTimes;
-
/** The network for the data */
@DynamicSerializeElement
private Network network;
+ @DynamicSerializeElement
+ private long baseTime;
+
+ @DynamicSerializeElement
+ private int offset;
+
/**
* Constructor.
*
@@ -98,50 +99,6 @@ public class TimeWindowData implements Comparable {
* TimeUtil.MILLIS_PER_MINUTE;
this.timeWindowEndTime = (windowEndTime / TimeUtil.MILLIS_PER_MINUTE)
* TimeUtil.MILLIS_PER_MINUTE;
- binStartTimes = new ArrayList();
- }
-
- /**
- * Set the bin times.
- *
- * @param binTimesArray
- */
- public void setBinTimes(List binTimesArray) {
- binStartTimes = binTimesArray;
- sortBinStartTimes();
- }
-
- /**
- * Add a bin time.
- *
- * @param binStartTime
- */
- public void addBinTime(Long binStartTime) {
- if (validBinStartTime(binStartTime)) {
- long roundedBinTime = (binStartTime / TimeUtil.MILLIS_PER_MINUTE)
- * TimeUtil.MILLIS_PER_MINUTE;
- binStartTimes.add(roundedBinTime);
- sortBinStartTimes();
- return;
- }
- }
-
- /**
- * Validate the bin time.
- *
- * @param binStartTime
- * @return true if bin time is within the time window
- */
- private boolean validBinStartTime(Long binStartTime) {
- return binStartTime >= timeWindowStartTime
- && binStartTime <= timeWindowEndTime;
- }
-
- /**
- * Sort the bin times.
- */
- public void sortBinStartTimes() {
- Collections.sort(binStartTimes);
}
/**
@@ -176,15 +133,6 @@ public class TimeWindowData implements Comparable {
return timeWindowEndTime;
}
- /**
- * Get the time window end time.
- *
- * @return
- */
- public List getBinStartTimes() {
- return binStartTimes;
- }
-
/**
* @param timeWindowStartTime
* the timeWindowStartTime to set
@@ -201,14 +149,6 @@ public class TimeWindowData implements Comparable {
this.timeWindowEndTime = timeWindowEndTime;
}
- /**
- * @param binStartTimes
- * the binStartTimes to set
- */
- public void setBinStartTimes(List binStartTimes) {
- this.binStartTimes = binStartTimes;
- }
-
/**
* @return the network
*/
@@ -224,6 +164,36 @@ public class TimeWindowData implements Comparable {
this.network = network;
}
+ /**
+ * @return the offset
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ /**
+ * @param offset
+ * the offset to set
+ */
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+ /**
+ * @return the baseTime
+ */
+ public long getBaseTime() {
+ return baseTime;
+ }
+
+ /**
+ * @param baseTime
+ * the baseTime to set
+ */
+ public void setBaseTime(long baseTime) {
+ this.baseTime = baseTime;
+ }
+
/**
* {@inheritDoc}
*/
@@ -237,9 +207,15 @@ public class TimeWindowData implements Comparable {
StringBuilder sb = new StringBuilder();
sb.append("Start Time:\t").append(sdf.format(cal.getTime()))
.append(" Z");
- sb.append("\n");
+ sb.append(StringUtil.NEWLINE);
cal.setTimeInMillis(this.timeWindowEndTime);
sb.append("End Time:\t").append(sdf.format(cal.getTime())).append(" Z");
+ cal.setTimeInMillis(this.baseTime);
+ sb.append(StringUtil.NEWLINE);
+ sb.append("Base Time:\t").append(sdf.format(cal.getTime()))
+ .append(" Z");
+ sb.append(StringUtil.NEWLINE).append("Availability Offset: ")
+ .append(offset).append(" minutes");
return sb.toString();
}
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/res/spring/ebxml-jaxb-datadelivery-registry.xml b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/res/spring/ebxml-jaxb-datadelivery-registry.xml
index b12da17cde..533120623c 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/res/spring/ebxml-jaxb-datadelivery-registry.xml
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/res/spring/ebxml-jaxb-datadelivery-registry.xml
@@ -1,9 +1,10 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java
index 2f16a46da9..da8dfbfa3c 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/AdhocSubscription.java
@@ -24,6 +24,7 @@ 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.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@@ -48,6 +49,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Oct 11, 2013 2460 dhladky Restored Adhoc's to registryObject store, WFO only
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
+ * jan 23, 2013 2584 dhladky Versions.
*
*
*
@@ -61,6 +63,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT,
Subscription.ORIGINATING_SITE_SLOT, Subscription.SUBSCRIPTION_TYPE_SLOT })
+@RegistryObjectVersion(value = 1.0f)
public class AdhocSubscription extends
SiteSubscription {
@@ -74,4 +77,5 @@ public class AdhocSubscription extends
super(subscription);
setGroupName("Adhoc");
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java
index 3ce94af116..a27bcfbe69 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java
@@ -19,7 +19,11 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
+import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
+
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
+import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
+import com.raytheon.uf.common.serialization.SerializationException;
/**
* Constants file for data delivery registry object types.
@@ -36,6 +40,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
* Oct 11, 2013 2460 dhladky Restored Adhoc to registry store, WFO only.
* Nov 12, 2013 2506 bgonzale Added is recurring subscription method.
* Nov 18, 2013 1736 dhladky Data Set helper method.
+ * Dec 08, 2013 2584 dhladky Registry versions for objects.
*
*
*
@@ -48,6 +53,7 @@ public final class DataDeliveryRegistryObjectTypes {
* Private constructor.
*/
private DataDeliveryRegistryObjectTypes() {
+
}
public static final String DATASETMETADATA = RegistryUtil
@@ -67,6 +73,9 @@ public final class DataDeliveryRegistryObjectTypes {
public static final String PROVIDER = RegistryUtil
.getObjectType(Provider.class);
+
+ public static final String PARAMETER = RegistryUtil
+ .getObjectType(Parameter.class);
/**
* Is the object type a recurring subscription type, excluding adhoc
@@ -94,4 +103,47 @@ public final class DataDeliveryRegistryObjectTypes {
return DataDeliveryRegistryObjectTypes.DATASETMETADATA
.equals(objectType);
}
+
+ /**
+ * Convert the object if necessary
+ *
+ * @param content
+ * @param encoder
+ * @return
+ */
+ public static Object convertObject(Object content,
+ IRegistryEncoder encoder) {
+
+ /**
+ * TODO In next step attempt to
+ * do a conversion
+ */
+ throw new IllegalArgumentException(
+ "Can not convert Data Delivery Registry Objects in this release!");
+
+ }
+
+
+ /**
+ * Gets the object from the encoder, checking to see if conversion is
+ * necessary or not.
+ *
+ * @param registryObjectType
+ * @param encoder
+ * @return
+ * @throws SerializationException
+ */
+ public static Object getObject(RegistryObjectType registryObjectType,
+ IRegistryEncoder encoder) throws SerializationException {
+
+ Object object = encoder.decodeObject(registryObjectType);
+
+ //Returned content. Object is of different version!
+ if (object instanceof String) {
+ object = convertObject(object, encoder);
+ }
+
+ return object;
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSet.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSet.java
index da64088909..9a64bf91e6 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSet.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSet.java
@@ -18,6 +18,7 @@ import com.raytheon.uf.common.registry.annotations.RegistryObjectAssociation;
import com.raytheon.uf.common.registry.annotations.RegistryObjectDescription;
import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
import com.raytheon.uf.common.registry.annotations.RegistryObjectOwner;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.registry.ebxml.MapValuesResolver;
@@ -41,6 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sep 07, 2012 1102 djohnson Remove invalid {@code @XmlRootElement}.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Dec 18, 2013 2636 mpduff Add a data availability delay for the dataset.
+ * jan 23, 2013 2584 dhladky Versions.
*
*
*
@@ -50,6 +52,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@RegistryObject({ "providerName", "collectionName", "dataSetName" })
+@RegistryObjectVersion(value = 1.0f)
public abstract class DataSet {
@RegistryObjectOwner
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetMetaData.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetMetaData.java
index a862c7908d..2bd34d4968 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetMetaData.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetMetaData.java
@@ -17,6 +17,7 @@ import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.RegistryObjectDescription;
import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
import com.raytheon.uf.common.registry.annotations.RegistryObjectOwner;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.registry.ebxml.slots.DateSlotConverter;
@@ -42,6 +43,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Sept, 30 2013 1797 dhladky Made generic based on Time
* Dec 20, 2013 2636 mpduff Add a dataset availability offset
+ * jan 23, 2013 2584 dhladky Versions.
*
*
* @author dhladky
@@ -51,6 +53,7 @@ import com.raytheon.uf.common.time.util.ImmutableDate;
@XmlSeeAlso({ GriddedDataSetMetaData.class,
OpenDapGriddedDataSetMetaData.class, PointDataSetMetaData.class })
@RegistryObject({ "url" })
+@RegistryObjectVersion(value = 1.0f)
public abstract class DataSetMetaData {
public static final String DATE_SLOT = "date";
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetName.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetName.java
index 064f576e19..d072e68c06 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetName.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataSetName.java
@@ -13,6 +13,7 @@ import com.raytheon.uf.common.registry.annotations.RegistryObjectAssociation;
import com.raytheon.uf.common.registry.annotations.RegistryObjectDescription;
import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
import com.raytheon.uf.common.registry.annotations.RegistryObjectOwner;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.MapValuesResolver;
import com.raytheon.uf.common.serialization.XmlGenericMapAdapter;
@@ -33,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 22, 2012 0743 djohnson Store data type as an enum.
* Sep 07, 2012 1102 djohnson Add {@code @XmlRootElement}.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
+ * jan 23, 2013 2584 dhladky Versions.
*
*
*
@@ -44,6 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@RegistryObject(value = { "providerName", "dataSetType", "dataSetName" }, storeContent = false)
+@RegistryObjectVersion(value = 1.0f)
public class DataSetName {
@RegistryObjectOwner
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/GriddedTime.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/GriddedTime.java
index ce203f356c..b254c28985 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/GriddedTime.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/GriddedTime.java
@@ -33,8 +33,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
-import com.raytheon.uf.common.status.IUFStatusHandler;
-import com.raytheon.uf.common.status.UFStatus;
/**
* Request Time XML
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/IDataSetMetaDataVisitor.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/IDataSetMetaDataVisitor.java
index 8a23e994e2..78efaf40e5 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/IDataSetMetaDataVisitor.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/IDataSetMetaDataVisitor.java
@@ -19,6 +19,7 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
+
/**
* Defines a type that can visit {@link DataSetMetaData} instances and perform
* some activity.
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSet.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSet.java
index 42c7b592a4..e8f117135c 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSet.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSet.java
@@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.XmlGenericMapAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@@ -55,9 +56,14 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
+@RegistryObjectVersion(value = 1.0f)
@DynamicSerialize
public class OpenDapGriddedDataSet extends GriddedDataSet {
+ public OpenDapGriddedDataSet() {
+
+ }
+
@DynamicSerializeElement
@XmlJavaTypeAdapter(type = Map.class, value = XmlGenericMapAdapter.class)
private Map cyclesToUrls = new HashMap();
@@ -162,4 +168,5 @@ public class OpenDapGriddedDataSet extends GriddedDataSet {
public ServiceType getServiceType() {
return ServiceType.OPENDAP;
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSetMetaData.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSetMetaData.java
index 4821a8b921..faa522a6f0 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSetMetaData.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/OpenDapGriddedDataSetMetaData.java
@@ -23,6 +23,7 @@ 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.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@@ -35,6 +36,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2012 1102 djohnson Initial creation
+ * jan 23, 2013 2584 dhladky Versions
*
*
*
@@ -43,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
+@RegistryObjectVersion(value = 1.0f)
@DynamicSerialize
public class OpenDapGriddedDataSetMetaData extends GriddedDataSetMetaData {
@@ -53,4 +56,5 @@ public class OpenDapGriddedDataSetMetaData extends GriddedDataSetMetaData {
public void accept(IDataSetMetaDataVisitor visitor) {
visitor.visit(this);
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Parameter.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Parameter.java
index 245bd56124..78b209ef21 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Parameter.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Parameter.java
@@ -20,6 +20,7 @@ import com.raytheon.uf.common.registry.annotations.RegistryObject;
import com.raytheon.uf.common.registry.annotations.RegistryObjectAssociation;
import com.raytheon.uf.common.registry.annotations.RegistryObjectDescription;
import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@@ -40,6 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sep 06, 2012 1121 mpduff Added toString().
* Sep 07, 2012 1102 djohnson Add {@code @XmlRootElement}.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
+ * Dec 08, 2013 2584 dhladky Version update
*
*
* @author dhladky
@@ -51,6 +53,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@RegistryObject({ "name", "dataType" })
+@RegistryObjectVersion(value = 1.0f)
public class Parameter implements Serializable {
private static final long serialVersionUID = -2332611624661834210L;
@@ -294,4 +297,5 @@ public class Parameter implements Serializable {
return hcBuilder.toHashCode();
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscription.java
index e3b678ee8f..c7b7fc0b0d 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscription.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@@ -39,6 +40,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* ------------ ---------- ----------- --------------------------
* Apr 04, 2013 1841 djohnson Initial creation
* Sept 30, 2013 1797 dhladky Generics
+ * Dec 08, 2013 2584 dhladky Version update
*
*
*
@@ -54,6 +56,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = {
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SharedSubscription.class) })
+@RegistryObjectVersion(value = 1.0f)
public class PendingSharedSubscription extends InitialPendingSharedSubscription
implements PendingSubscription {
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java
index b70e2498f2..f7e0c1b967 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscription.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.constants.AssociationTypes;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@@ -44,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Oct 1, 2013 1797 dhladky Added some start for generics
+ * Dec 08, 2013 2584 dhladky Version update
*
*
*
@@ -59,6 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = {
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SiteSubscription.class) })
+@RegistryObjectVersion(value = 1.0f)
public class PendingSiteSubscription extends InitialPendingSiteSubscription
implements PendingSubscription {
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSubscription.java
index 0cc9941894..a7561e76d1 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PendingSubscription.java
@@ -19,6 +19,7 @@
**/
package com.raytheon.uf.common.datadelivery.registry;
+
/**
* Pending Subscription definition.
*
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PointDataSetMetaData.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PointDataSetMetaData.java
index 20aff524cb..6da6f317aa 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PointDataSetMetaData.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/PointDataSetMetaData.java
@@ -22,6 +22,7 @@ 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.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Point Meta Data object
@@ -42,11 +43,17 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
+@RegistryObjectVersion(value = 1.0f)
@DynamicSerialize
public class PointDataSetMetaData extends DataSetMetaData {
+ public PointDataSetMetaData() {
+
+ }
+
@Override
public void accept(IDataSetMetaDataVisitor visitor) {
// TODO: not sure what this does?
}
+
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Provider.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Provider.java
index 71cbb2f514..1c951f7bfc 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Provider.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Provider.java
@@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@@ -31,6 +32,7 @@ import com.raytheon.uf.common.time.domain.api.IDuration;
* ------------ ---------- ----------- --------------------------
* Feb 16, 2012 dhladky Initial creation
* jun 11, 2013 2101 dhladky Updated for username/password DPA exchanges
+ * Dec 08, 2013 2584 dhladky Version update
*
*
*
@@ -42,6 +44,7 @@ import com.raytheon.uf.common.time.domain.api.IDuration;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@RegistryObject({ "name" })
+@RegistryObjectVersion(value = 1.0f)
public class Provider {
/**
@@ -105,7 +108,7 @@ public class Provider {
return (long) (latSpan * lonSpan * (timeSpan/5) * requestOverheadInBytes);
}
}
-
+
private static final Integer BYTES_IN_FLOAT = Float.SIZE / Byte.SIZE;
/** a one degree by one degree box **/
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java
index 5283c360fd..7e312e1d3e 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/RecurringSubscription.java
@@ -1,19 +1,19 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
+ *
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
- *
+ *
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
- *
+ *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
@@ -65,7 +65,10 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
* Jan 08, 2014 2615 bgonzale Implement calculate start and calculate end methods.
* Jan 14, 2014 2459 mpduff Add subscription state.
- * Jan 20, 2013 2398 dhladky Fixed rescheduling beyond active period/expired window.
+ * Jan 20, 2014 2398 dhladky Fixed rescheduling beyond active period/expired window.
+ * Jan 24, 2014 2709 bgonzale Fix setting of active period end. Change active period checks
+ * to check day of year. removed now unused active period methods.
+ * Jan 28, 2014 2636 mpduff Changed to use GMT calendar.
*
*
*
@@ -268,6 +271,17 @@ public abstract class RecurringSubscription
@SlotAttribute(Subscription.SUBSCRIPTION_STATE_SLOT)
private SubscriptionState subscriptionState = SubscriptionState.ON;
+ /*
+ * Active Period starting day of the year. Calculated from
+ * activePeriodStart.
+ */
+ private Integer startActivePeriodDayOfYear;
+
+ /*
+ * Active Period ending day of the year. Calculated from activePeriodEnd.
+ */
+ private Integer endActivePeriodDayOfYear;
+
/** Flag stating if the object should be updated */
private boolean shouldUpdate = false;
@@ -432,6 +446,7 @@ public abstract class RecurringSubscription
@Override
public void setActivePeriodStart(Date activePeriodStart) {
this.activePeriodStart = activePeriodStart;
+ this.startActivePeriodDayOfYear = null;
}
/**
@@ -453,56 +468,55 @@ public abstract class RecurringSubscription
@Override
public void setActivePeriodEnd(Date activePeriodEnd) {
this.activePeriodEnd = activePeriodEnd;
+ this.endActivePeriodDayOfYear = null;
}
- private Calendar getActivePeriodStart(Calendar base) {
- // active period values are month and day of month only, use base
- // Calendar for active period year
- Calendar activePeriodStartCal = TimeUtil.newCalendar(activePeriodStart);
- TimeUtil.minCalendarFields(activePeriodStartCal, Calendar.MILLISECOND,
- Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY);
- activePeriodStartCal.set(Calendar.YEAR, base.get(Calendar.YEAR));
- return activePeriodStartCal;
+ private Integer getStartActivePeriodDayOfYear() {
+ if (startActivePeriodDayOfYear == null && activePeriodStart != null) {
+ startActivePeriodDayOfYear = TimeUtil.newGmtCalendar(
+ activePeriodStart).get(Calendar.DAY_OF_YEAR);
+ }
+ return startActivePeriodDayOfYear;
}
- private Calendar getActivePeriodEnd(Calendar base) {
- // active period values are month and day of month only, use base
- // Calendar for active period year
- Calendar activePeriodEndCal = TimeUtil.newCalendar(activePeriodEnd);
- TimeUtil.maxCalendarFields(activePeriodEndCal, Calendar.MILLISECOND,
- Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY);
- activePeriodEndCal.set(Calendar.YEAR, base.get(Calendar.YEAR));
- return activePeriodEndCal;
+ private Integer getEndActivePeriodDayOfYear() {
+ if (endActivePeriodDayOfYear == null && activePeriodEnd != null) {
+ endActivePeriodDayOfYear = TimeUtil.newGmtCalendar(activePeriodEnd)
+ .get(Calendar.DAY_OF_YEAR);
+ }
+ return endActivePeriodDayOfYear;
}
@Override
public Calendar calculateStart(Calendar startConstraint) {
- Calendar realStart = null;
- boolean hasActivePeriodStart = activePeriodStart != null;
- if (hasActivePeriodStart) {
- realStart = getActivePeriodStart(startConstraint);
- if (realStart.before(startConstraint)) {
- realStart = startConstraint;
- }
- } else {
- realStart = startConstraint;
+ if (subscriptionStart == null) {
+ return startConstraint;
}
- return TimeUtil.newCalendar(TimeUtil.max(subscriptionStart, realStart));
+
+ long subStartMillis = subscriptionStart.getTime();
+ long constaintMillis = startConstraint.getTimeInMillis();
+
+ if (subStartMillis > constaintMillis) {
+ return TimeUtil.newGmtCalendar(subscriptionStart);
+ }
+
+ return startConstraint;
}
@Override
public Calendar calculateEnd(Calendar endConstraint) {
- Calendar realEnd = null;
- boolean hasActivePeriodEnd = activePeriodEnd != null;
- if (hasActivePeriodEnd) {
- realEnd = getActivePeriodEnd(endConstraint);
- if (realEnd.before(endConstraint)) {
- realEnd = endConstraint;
- }
- } else {
- realEnd = endConstraint;
+ if (subscriptionEnd == null) {
+ return endConstraint;
}
- return TimeUtil.newCalendar(TimeUtil.min(subscriptionEnd, realEnd));
+
+ long subEndMillis = subscriptionEnd.getTime();
+ long constaintMillis = endConstraint.getTimeInMillis();
+
+ if (subEndMillis < constaintMillis) {
+ return TimeUtil.newGmtCalendar(subscriptionEnd);
+ }
+
+ return endConstraint;
}
/**
@@ -898,9 +912,10 @@ public abstract class RecurringSubscription
return expired;
}
-
+
/**
* Check for expiration on date
+ *
* @param date
* @return
*/
@@ -929,9 +944,8 @@ public abstract class RecurringSubscription
// At this point the subscription is in the ON state
Calendar cal = TimeUtil.newGmtCalendar();
- Date today = cal.getTime();
- if (inWindow(today)) {
+ if (inActivePeriodWindow(cal)) {
return SubscriptionStatus.ACTIVE;
}
@@ -949,60 +963,41 @@ public abstract class RecurringSubscription
return subscriptionState == SubscriptionState.ON
&& !checkAndSetExpiration();
}
-
+
/**
* Should this be scheduled for this time.
+ *
* @param checkDate
* @return
*/
- public boolean shouldScheduleForTime(Date checkDate) {
- if (!isExpired(checkDate) && inWindow(checkDate)) {
+ public boolean shouldScheduleForTime(Calendar checkCal) {
+ if (!isExpired(checkCal.getTime()) && inActivePeriodWindow(checkCal)) {
return true;
}
-
+
return false;
}
- private boolean inWindow(Date checkDate) {
+ @Override
+ public boolean inActivePeriodWindow(Calendar checkDate) {
if (activePeriodStart == null && activePeriodEnd == null) {
+ // no active period set
return true;
- } else if (activePeriodStart != null && activePeriodEnd != null) {
+ } else {
+ Integer startDay = getStartActivePeriodDayOfYear();
+ Integer endDay = getEndActivePeriodDayOfYear();
+ int checkDay = checkDate.get(Calendar.DAY_OF_YEAR);
- Calendar startCal = TimeUtil.newGmtCalendar();
- startCal.setTime(activePeriodStart);
- startCal = TimeUtil.minCalendarFields(startCal,
- Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND,
- Calendar.MILLISECOND);
- // add the current year for true comparison
- startCal = TimeUtil.addCurrentYearCalendar(startCal);
+ boolean isAfterPeriodStart = startDay <= checkDay;
+ boolean isBeforePeriodEnd = checkDay < endDay;
+ boolean periodCrossesYearBoundary = endDay < startDay;
- activePeriodStart = startCal.getTime();
-
- Calendar endCal = TimeUtil.newGmtCalendar();
- endCal.setTime(activePeriodEnd);
- endCal = TimeUtil.maxCalendarFields(endCal, Calendar.HOUR_OF_DAY,
- Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND);
- // add the current year for true comparison
- endCal = TimeUtil.addCurrentYearCalendar(endCal);
- // If the period crosses a year boundary, add a year to the end
- if (endCal.before(startCal)) {
- endCal.add(Calendar.YEAR, 1);
+ if (periodCrossesYearBoundary) {
+ return isAfterPeriodStart || isBeforePeriodEnd;
+ } else {
+ return isAfterPeriodStart && isBeforePeriodEnd;
}
-
- activePeriodEnd = endCal.getTime();
-
- // Only concerned with month and day, need to set the
- // years on equal footing for comparison sake.
- Calendar c = TimeUtil.newGmtCalendar();
- c.setTime(checkDate);
- // set the date to compare with the current date from the start
- c.set(Calendar.YEAR, startCal.get(Calendar.YEAR));
- Date date = c.getTime();
-
- return (activePeriodStart.before(date) && activePeriodEnd
- .after(date));
}
- return false;
}
@Override
@@ -1113,4 +1108,4 @@ public abstract class RecurringSubscription
public boolean shouldUpdate() {
return shouldUpdate;
}
-}
+}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java
index 812cdacf83..bffae6bc90 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java
@@ -24,6 +24,7 @@ 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.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@@ -41,6 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Sept 30, 2013 1797 dhladky Generics
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
+ * jan 23, 2013 2584 dhladky Versions.
*
*
*
@@ -53,6 +55,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
Subscription.OWNER_SLOT, Subscription.ORIGINATING_SITE_SLOT,
Subscription.SUBSCRIPTION_TYPE_SLOT })
+@RegistryObjectVersion(value = 1.0f)
@DynamicSerialize
public class SharedSubscription extends
RecurringSubscription {
@@ -143,4 +146,5 @@ public class SharedSubscription extends
this.officeIDs.add(officeId);
}
}
+
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java
index bfe78f8df0..b5bfcde1a5 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.registry.annotations.RegistryObject;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@@ -64,6 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sept 30, 2013 1797 dhladky Some Generics
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
* Nov 14, 2013 2548 mpduff Add a subscription type slot.
+ * Dec 08, 2013 2584 dhladky Version update
*
*
*
@@ -77,6 +79,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT,
Subscription.ORIGINATING_SITE_SLOT, Subscription.SUBSCRIPTION_TYPE_SLOT })
@DynamicSerialize
+@RegistryObjectVersion(value = 1.0f)
public class SiteSubscription extends
RecurringSubscription {
private static final long serialVersionUID = -6422673887457060034L;
@@ -180,4 +183,5 @@ public class SiteSubscription extends
this.officeIDs.add(officeId);
}
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java
index f884ad4b4b..846f3d5675 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/Subscription.java
@@ -28,7 +28,6 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
-
/**
* Definition of a subscription.
*
@@ -44,9 +43,10 @@ import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
* Jul 11, 2013 2106 djohnson SubscriptionPriority allows comparison.
* Sept 30,2013 1797 dhladky Abstracted and genericized.
* Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated.
- * Nov 14, 2013 2548 mpduff Add a subscription type information.
- * Jan 08, 2014 2615 bgonzale Added calculate start and calculate end methods.
- * Jan 14, 2014 2459 mpduff Change Subscription status code
+ * Nov 14, 2013 2548 mpduff Add a subscription type information.
+ * Jan 08, 2014 2615 bgonzale Added calculate start and calculate end methods.
+ * Jan 14, 2014 2459 mpduff Change Subscription status code
+ * Jan 24, 2013 2709 bgonzale Added method inActivePeriodWindow.
*
*
*
@@ -340,6 +340,17 @@ public interface Subscription {
*/
Calendar calculateEnd(Calendar endConstraint);
+ /**
+ * Check if the given value's month/day is in the Subscription's active
+ * window.
+ *
+ * @param time
+ * time with month/day value to check.
+ *
+ * @return true if in the active period; false otherwise
+ */
+ boolean inActivePeriodWindow(Calendar time);
+
/**
* isNotify flag for subscription.
*
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/WFSPointDataSet.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/WFSPointDataSet.java
index 65c0065069..185d7fb024 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/WFSPointDataSet.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/WFSPointDataSet.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
@@ -35,6 +36,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 11, 2012 754 dhladky Initial creation
+ * jan 23, 2013 2584 dhladky Versions.
*
*
*
@@ -43,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
+@RegistryObjectVersion(value = 1.0f)
@DynamicSerialize
public class WFSPointDataSet extends PointDataSet {
@@ -50,4 +53,5 @@ public class WFSPointDataSet extends PointDataSet {
public ServiceType getServiceType() {
return ServiceType.WFS;
}
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeDescriptionQuery.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeDescriptionQuery.java
index a1d6d75c0e..45ef852d51 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeDescriptionQuery.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeDescriptionQuery.java
@@ -9,6 +9,7 @@ import javax.persistence.Transient;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
+import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.registry.IMultipleResultFormatter;
@@ -46,7 +47,7 @@ public class DataLevelTypeDescriptionQuery extends
RegistryObjectType registryObjectType, IRegistryEncoder encoder)
throws SerializationException {
- Parameter object = (Parameter) encoder.decodeObject(registryObjectType);
+ Parameter object = (Parameter) DataDeliveryRegistryObjectTypes.getObject(registryObjectType, encoder);
if (alreadyFound == null) {
alreadyFound = new HashSet();
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeQuery.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeQuery.java
index 30b2acc5ca..ac95f5942a 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeQuery.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataLevelTypeQuery.java
@@ -7,6 +7,7 @@ import java.util.Map;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
+import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
@@ -59,7 +60,7 @@ public class DataLevelTypeQuery extends
RegistryObjectType registryObjectType, IRegistryEncoder encoder)
throws SerializationException {
- Object object = encoder.decodeObject(registryObjectType);
+ Object object = DataDeliveryRegistryObjectTypes.getObject(registryObjectType, encoder);
if (object instanceof DataSet) {
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQuery.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQuery.java
index f6d136ad99..93e8169e22 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQuery.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQuery.java
@@ -11,11 +11,12 @@ import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.referencing.operation.TransformException;
import com.google.common.annotations.VisibleForTesting;
+import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.registry.IResultFormatter;
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
@@ -66,8 +67,7 @@ public class DataSetWithFiltersQuery extends DataSetQuery implements
IRegistryEncoder encoder)
throws SerializationException {
DataSet retVal = null;
- DataSet object = (DataSet) encoder
- .decodeObject(registryObjectType);
+ DataSet object = (DataSet) DataDeliveryRegistryObjectTypes.getObject(registryObjectType, encoder);
if (satisfiesFilterCriteria(object, levels, envelope)) {
retVal = object;
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/DataSetHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/DataSetHandler.java
index d2c0ad1e8c..6b9f22923b 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/DataSetHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/DataSetHandler.java
@@ -29,9 +29,9 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryExceptio
import org.geotools.geometry.jts.ReferencedEnvelope;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetWithFiltersQuery;
import com.raytheon.uf.common.registry.RegistryQueryResponse;
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IDataSetHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IDataSetHandler.java
index 61b009bd7e..b0d0abb59b 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IDataSetHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/IDataSetHandler.java
@@ -24,8 +24,8 @@ import java.util.Set;
import org.geotools.geometry.jts.ReferencedEnvelope;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
index 802261b435..0a32270991 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/ISiteSubscriptionHandler.java
@@ -19,8 +19,8 @@
**/
package com.raytheon.uf.common.datadelivery.registry.handlers;
-import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
/**
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java
index 4b06740e42..dd37c4793a 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.madis/src/com/raytheon/uf/common/dataplugin/madis/MadisRecord.java
@@ -20,8 +20,8 @@ package com.raytheon.uf.common.dataplugin.madis;
* further licensing information.
**/
+import java.util.Calendar;
import java.util.Collections;
-import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -74,6 +74,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 14, 2013 2361 njensen Removed IDecoderGettable
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
*
@@ -124,7 +125,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
/** A string denoting the time of observation */
@DynamicSerializeElement
@Transient
- private Date timeObs;
+ private Calendar timeObs;
/** A float denoting the dewpoint temp */
@DynamicSerializeElement
@@ -905,11 +906,11 @@ public class MadisRecord extends PersistablePluginDataObject implements
this.pressure_qcr = pressure_qcr;
}
- public void setTimeObs(Date timeObs) {
+ public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs;
}
- public Date getTimeObs() {
+ public Calendar getTimeObs() {
return timeObs;
}
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IConvert.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IConvert.java
new file mode 100644
index 0000000000..7c670dbe6d
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IConvert.java
@@ -0,0 +1,47 @@
+package com.raytheon.uf.common.registry;
+/**
+ * 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.
+ **/
+/**
+ * Convert a different version of the Registry Object to this version.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ *Dec 08, 2013 2584 dhladky Initial creation
+ *
+ *
+ *
+ * @author dhladky
+ * @version 1.0
+ */
+
+public interface IConvert {
+
+ /**
+ * Convert a Registry Object between versions
+ *
+ * @param o
+ */
+ public void convert(Object o);
+}
+
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/annotations/RegistryObjectVersion.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/annotations/RegistryObjectVersion.java
new file mode 100644
index 0000000000..60616a8bf4
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/annotations/RegistryObjectVersion.java
@@ -0,0 +1,51 @@
+/**
+ * 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.registry.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * Denotes Version of the Registry Object
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Dec 4, 2013 2584 dhladky Initial creation
+ *
+ *
+ *
+ * @author dhladky
+ * @version 1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Documented
+public @interface RegistryObjectVersion {
+
+ public float value() default 1.0f;
+}
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/RegistryUtil.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/RegistryUtil.java
index f45b3229f3..2c997968c5 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/RegistryUtil.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/RegistryUtil.java
@@ -23,6 +23,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
+import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.registry.OperationStatus;
@@ -36,6 +37,7 @@ import com.raytheon.uf.common.registry.annotations.RegistryObjectAssociation;
import com.raytheon.uf.common.registry.annotations.RegistryObjectDescription;
import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
import com.raytheon.uf.common.registry.annotations.RegistryObjectOwner;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
import com.raytheon.uf.common.registry.constants.Languages;
@@ -76,6 +78,7 @@ import com.raytheon.uf.common.util.ReflectionUtil;
* 4/9/2013 1802 bphillip Pulled constants out into existing constants package that was moved into common
* Jun 03, 2013 2038 djohnson Allow setting the same encoder strategy.
* Jun 24, 2013 2106 djohnson Remove encoder strategy from instance variables.
+ * Dec 04, 2013 2584 dhladky Versions for Registry objects
*
*
*
@@ -89,6 +92,10 @@ public final class RegistryUtil {
}
public static String LOCAL_REGISTRY_ADDRESS = null;
+
+ public static final String registryObjectClassName = "registryObjectClassName";
+
+ public static final String registryObjectDefaultVersion = "1.0";
static {
if (System.getenv("EBXML_REGISTRY_HOST") != null
@@ -375,6 +382,28 @@ public final class RegistryUtil {
.setDescription(getInternationalString(ReflectionUtil
.getAnnotatedField(registryObject,
RegistryObjectDescription.class)));
+ // Try to harvest the current version from the PayloadObject
+ // if none exists, default to encoder provided numeric.
+ VersionInfoType version = new VersionInfoType();
+ String val = null;
+ RegistryObjectVersion rov = ReflectionUtil
+ .getAnnotationFromClass(object.getClass(),
+ RegistryObjectVersion.class);
+ if (rov != null) {
+ val = String.valueOf(rov.value());
+ }
+ // no value set in annotation field, apply version default.
+ if (val == null) {
+ // default
+ val = registryObjectDefaultVersion;
+ }
+ version.setUserVersionName(val);
+ registryObject.setVersionInfo(version);
+
+ // We need the actual payload class, not just it's ID for version comparisons
+ String clazz = object.getClass().getCanonicalName();
+ SlotType classNameSlot = new SlotType(registryObjectClassName, new StringValueType(clazz));
+ slots.add(classNameSlot);
}
// Look through all fields that need to be persisted to the
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/ContentSlotBasedEncoder.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/ContentSlotBasedEncoder.java
index 7739cdd74e..1ff369ba68 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/ContentSlotBasedEncoder.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/ContentSlotBasedEncoder.java
@@ -24,10 +24,12 @@ import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ValueType;
+import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
+import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.serialization.SerializationException;
/**
@@ -45,6 +47,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* Sep 07, 2012 1102 djohnson Initial creation
* Jun 03, 2013 2038 djohnson Add equals/hashcode.
* 12/2/2013 1829 bphillip Changed slot field in ExtensibleObjectType to be List instead of Set
+ * Dec 04, 2013 2584 dhladky Versioning for registry objects
*
*
*
@@ -79,15 +82,18 @@ abstract class ContentSlotBasedEncoder returnedSlots = registryObjectType.getSlot();
+ // Figure out which version we have and it's class
+ VersionInfoType vit = registryObjectType.getVersionInfo();
+ String className = registryObjectType.getSlotValue(RegistryUtil.registryObjectClassName);
+
// Walk the returned slots looking for the "content" slot
for (SlotType s : returnedSlots) {
if (CONTENT_SLOT.equals(s.getName())) {
SLOT_VALUE_TYPE sv = getSlotValueTypeClass().cast(
s.getSlotValue());
CONTENT_TYPE content = getContent(sv);
- object = decodeContent(content);
+ object = decodeContent(content, className, vit.getUserVersionName());
break;
}
}
@@ -167,11 +173,13 @@ abstract class ContentSlotBasedEncoder
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Sep 07, 2012 1102 djohnson Initial creation
- * Jun 03, 2013 2038 djohnson Add equals/hashcode.
- *
- *
- *
- * @author djohnson
- * @version 1.0
- */
-class DynamicSerializeEncoder extends StringBasedEncoder {
-
- /**
- * @param type
- */
- DynamicSerializeEncoder() {
- super(DYNAMIC_SERIALIZE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Object decodeContent(String content) throws SerializationException {
- return SerializationUtil.transformFromThrift(Object.class,
- Base64.decodeBase64(content));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- String encodeContent(Object objectToEncode) throws SerializationException {
- return new String(Base64.encodeBase64(SerializationUtil
- .transformToThrift(objectToEncode)));
- }
-}
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/JaxbEncoder.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/JaxbEncoder.java
index 0b82b45136..16420270e4 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/JaxbEncoder.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/JaxbEncoder.java
@@ -23,8 +23,13 @@ import static com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Typ
import javax.xml.bind.JAXBException;
+import com.raytheon.uf.common.registry.annotations.RegistryObjectVersion;
import com.raytheon.uf.common.registry.schemas.ebxml.util.EbxmlJaxbManager;
import com.raytheon.uf.common.serialization.SerializationException;
+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.ReflectionUtil;
/**
* A {@link StringBasedEncoder} implementation that uses JAXB. Package-private
@@ -40,6 +45,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* Jun 03, 2013 2038 djohnson Add equals/hashcode.
* Oct 31, 2013 2361 njensen Use specific JAXBManager instead of SerializationUtil
* Nov 14, 2013 2552 bkowal EbxmlJaxbManager is now accessed via getInstance
+ * Dec 08, 2013 2584 dhladky Versions for JAXB objects, Only use the JAXb encoder now.
*
*
*
@@ -48,7 +54,11 @@ import com.raytheon.uf.common.serialization.SerializationException;
*/
class JaxbEncoder extends StringBasedEncoder {
-
+
+ /** The logger */
+ private static final transient IUFStatusHandler statusHandler = UFStatus
+ .getHandler(JaxbEncoder.class);
+
/**
* @param type
*/
@@ -60,12 +70,24 @@ class JaxbEncoder extends StringBasedEncoder {
* {@inheritDoc}
*/
@Override
- Object decodeContent(String content) throws SerializationException {
- try {
- return EbxmlJaxbManager.getInstance().getJaxbManager()
- .unmarshalFromXml(content);
- } catch (JAXBException e) {
- throw new SerializationException("Unable to decode the object!", e);
+ Object decodeContent(String content, String className, String version)
+ throws SerializationException {
+
+ String classVersion = getClassVersion(className);
+
+ if (classVersion.equals(version)) {
+ try {
+ return EbxmlJaxbManager.getInstance().getJaxbManager()
+ .unmarshalFromXml(content);
+ } catch (JAXBException e) {
+ throw new SerializationException(
+ "Unable to decode the object!", e);
+ }
+ } else {
+ statusHandler.handle(Priority.INFO,
+ "Mismatching class versions, returning content. "
+ + className + " version: " + version);
+ return content;
}
}
@@ -75,10 +97,41 @@ class JaxbEncoder extends StringBasedEncoder {
@Override
String encodeContent(Object objectToEncode) throws SerializationException {
try {
+ // We always encode using our current version
return new String(EbxmlJaxbManager.getInstance().getJaxbManager()
.marshalToXml(objectToEncode));
} catch (JAXBException e) {
throw new SerializationException("Unable to encode the object!", e);
}
}
+
+ /**
+ * Get the version of the class
+ *
+ * @param className
+ * @return version
+ */
+ public String getClassVersion(String className) {
+
+ String version = EbxmlJaxbManager.getInstance().getVersion(className);
+
+ if (version == null) {
+
+ Class> clazz = EbxmlJaxbManager.getInstance().getClass(className);
+ RegistryObjectVersion rov = ReflectionUtil.getAnnotationFromClass(
+ clazz, RegistryObjectVersion.class);
+ if (rov != null) {
+ version = String.valueOf(rov.value());
+ EbxmlJaxbManager.getInstance().addVersion(className, version);
+ } else {
+ throw new IllegalArgumentException(
+ "Unable to extract RegistryObjectVersion tag from class! "
+ + className);
+ }
+ }
+
+ return version;
+ }
}
+
+
diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/RegistryEncoders.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/RegistryEncoders.java
index 1a33bc0ddc..9fa8428515 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/RegistryEncoders.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/ebxml/encoder/RegistryEncoders.java
@@ -33,6 +33,7 @@ import java.util.Collections;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 7, 2012 1102 djohnson Initial creation
+ * Dec 4, 2013 2584 dhladky Only a JAXB encoder for registry
*
*
*
@@ -45,14 +46,7 @@ public final class RegistryEncoders {
* An enumeration of valid {@link IRegistryEncoder} types.
*/
public static enum Type {
- /**
- * An encoder that uses dynamic serialization.
- */
- DYNAMIC_SERIALIZE(new DynamicSerializeEncoder()),
- /**
- * An encoder that uses JAXB marshalling.
- */
JAXB(new JaxbEncoder());
private final IRegistryEncoder encoder;
diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java
index d1bc9c4d14..e83be90f8d 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/EbxmlJaxbManager.java
@@ -19,7 +19,9 @@
**/
package com.raytheon.uf.common.registry.schemas.ebxml.util;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.xml.bind.JAXBException;
@@ -34,6 +36,8 @@ import org.reflections.util.ConfigurationBuilder;
import com.raytheon.uf.common.serialization.JAXBManager;
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.ReflectionUtil;
/**
* A JAXB Manager for transforming EBXML objects to/from XML.
@@ -44,11 +48,8 @@ import com.raytheon.uf.common.status.UFStatus;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Oct 30, 2013 2361 njensen Initial creation
- * Nov 14, 2013 2252 bkowal Added the ability to dynamically inject packages
- * that this jaxb implementation should support.
- * Eliminated use of System.out.
- *
+ * Nov 12, 2013 ---- njensen Initial release.
+ * Nov 24, 2013 2584 dhladky versioning
*
*
* @author njensen
@@ -61,21 +62,31 @@ public class EbxmlJaxbManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(EbxmlJaxbManager.class);
+ private JAXBManager jaxb;
+
+ private Set> jaxables;
+
+ private Map> convertables = new HashMap>(1);
+
+ private Map versions = new HashMap(1);
+
private static EbxmlJaxbManager instance;
- private static JAXBManager jaxb;
-
- private static Set> jaxables;
-
+ /**
+ * Get the desired version of the EbxmlJaxbManager
+ * @param version
+ * @return
+ */
public static synchronized EbxmlJaxbManager getInstance() {
if (instance == null) {
instance = new EbxmlJaxbManager();
}
return instance;
}
-
+
public String findJaxables(String packageName) {
- statusHandler.info("Scanning package ... " + packageName);
+
+ statusHandler.info(" Scanning package ... " + packageName);
long t0 = System.currentTimeMillis();
ConfigurationBuilder cb = new ConfigurationBuilder();
@@ -124,4 +135,86 @@ public class EbxmlJaxbManager {
statusHandler.info("Initialization Complete.");
}
+
+ /**
+ * Gets the set of classes for this encoder.
+ * @return
+ */
+ public Set> getJaxables() {
+ return jaxables;
+ }
+
+ /**
+ * Gets the class from the convertables
+ *
+ * @param className
+ * @return
+ */
+ public Class> getClass(String className) {
+
+ Class> clazz = convertables.get(className);
+
+ if (clazz == null) {
+
+ for (Class> pclazz : jaxables) {
+ if (pclazz.getCanonicalName().equals(className)) {
+ clazz = pclazz;
+ addClass(className, clazz);
+ break;
+ }
+ }
+ // Didn't find it, now we have a possible problem.
+ // Try reflecting a version of it.
+ if (clazz == null) {
+ statusHandler.handle(Priority.WARN,
+ "Didn't find class in list of jaxables! class: "
+ + className);
+ try {
+ clazz = ReflectionUtil.forName(className);
+ addClass(className, clazz);
+ } catch (Exception e) {
+ statusHandler.handle(Priority.ERROR,
+ "Can not reflect a version of this class. class: "
+ + className, e);
+ }
+ }
+ }
+
+ return clazz;
+ }
+
+ /**
+ * Set the class to the cache
+ *
+ * @param className
+ * @param clazz
+ */
+ private void addClass(String className, Class> clazz) {
+ synchronized (convertables) {
+ convertables.put(className, clazz);
+ }
+ }
+
+ /**
+ * Set the version to the cache
+ *
+ * @param className
+ * @param clazz
+ */
+ public void addVersion(String className, String version) {
+ synchronized (versions) {
+ versions.put(className, version);
+ }
+ }
+
+ /**
+ * Get the version of the class
+ *
+ * @param className
+ * @return version
+ */
+ public String getVersion(String className) {
+ return versions.get(className);
+ }
+
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/SerializedType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/SerializedType.java
index 2861a0285a..6f4b1ee287 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/SerializedType.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/com/raytheon/uf/common/registry/schemas/ebxml/util/SerializedType.java
@@ -43,6 +43,7 @@ import org.hibernate.usertype.UserType;
* --/--/---- Initial creation
* Oct 31, 2013 2361 njensen Use specific JAXBManager instead of SerializationUtil
* Nov 14, 2013 2552 bkowal EbxmlJaxbManager is now accessed via getInstance
+ * Dec 04, 2013 2584 dhladky Version based EbxmlJaxbManager
*
*
*
@@ -93,7 +94,7 @@ public class SerializedType implements UserType {
String obj = resultSet.getString(names[0]);
if (obj != null) {
- try {
+ try { // We always marshall to current version for to XML conversions
return EbxmlJaxbManager.getInstance().getJaxbManager()
.unmarshalFromXml(obj);
} catch (Exception e) {
@@ -110,8 +111,7 @@ public class SerializedType implements UserType {
if (value == null) {
statement.setString(index, null);
} else {
- try {
- ;
+ try { // We always marshall to current version for to XML conversions
statement.setString(index, EbxmlJaxbManager.getInstance()
.getJaxbManager().marshalToXml(value));
} catch (Exception e) {
diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java
index 90b3aa9063..b29c134dbb 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java
@@ -77,6 +77,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* among multiple ref lists
* 12/2/2013 1829 bphillip Modified persistence annotations, added
* constructors, hashCode, toString and equals
+ * 01/21/2014 2613 bphillip Added equals and hashcode
*
*
* @author bphillip
@@ -144,6 +145,31 @@ public class ObjectRefType implements IPersistableDataObject {
this.key = key;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ObjectRefType other = (ObjectRefType) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
diff --git a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java
index 77268b284f..2ca31e996f 100644
--- a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java
+++ b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/CalendarConverter.java
@@ -41,6 +41,7 @@ import org.apache.commons.beanutils.Converter;
* bphillip Initial Creation
* Mar 13, 2013 1789 bsteffen Move Calendar and Date parsing out of
* ConvertUtil and also fix date parsing.
+ * jan 22, 2014 2731 dhladky Calendar converter now returns a calendar.
*
*
* @author bphillip
@@ -62,7 +63,7 @@ public class CalendarConverter implements Converter {
String date = (String) value;
try {
// see if string is in ISO 8601
- return DatatypeConverter.parseDateTime(date).getTime();
+ return DatatypeConverter.parseDateTime(date);
} catch (Exception e) {
// try to match the pattern.
}
diff --git a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/TimeUtil.java b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/TimeUtil.java
index 755cbc657e..c3d3f12305 100644
--- a/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/TimeUtil.java
+++ b/edexOsgi/com.raytheon.uf.common.time/src/com/raytheon/uf/common/time/util/TimeUtil.java
@@ -56,6 +56,7 @@ import com.raytheon.uf.common.time.domain.api.ITimePoint;
* Nov 05, 2013 2499 rjpeter Added prettyDuration.
* Jan 08, 2014 2615 bgonzale Added Calendar min and max methods.
* Added newGmtCalendar from a date method.
+ * Jan 28, 2014 2636 mpduff Removed unused methods.
*
*
* @author njensen
@@ -181,6 +182,13 @@ public final class TimeUtil {
*/
static ITimeStrategy timeStrategy = SYSTEM_TIME_STRATEGY;
+ /**
+ * Disabled constructor.
+ */
+ private TimeUtil() {
+
+ }
+
/**
* Converts a Calendar in the local time zone to a GMT date
*
@@ -327,30 +335,6 @@ public final class TimeUtil {
|| (laterCal.get(Calendar.YEAR) > earlierCal.get(Calendar.YEAR));
}
- /**
- * Min comparison of a Date and a Calendar; returns the lesser.
- *
- * @param lhs
- * @param rhs
- * @return the lesser of a Data and a Calendar; returns null if either is
- * null.
- */
- public static Calendar min(Date lhs, Calendar rhs) {
- return min(TimeUtil.newCalendar(lhs), rhs);
- }
-
- /**
- * Max comparison of a Date and a Calendar; returns the greater.
- *
- * @param lhs
- * @param rhs
- * @return the greater of a Data and a Calendar; returns null if either is
- * null.
- */
- public static Calendar max(Date lhs, Calendar rhs) {
- return max(TimeUtil.newCalendar(lhs), rhs);
- }
-
/**
* Max comparison of two Calendars; returns the greater.
*
@@ -577,14 +561,9 @@ public final class TimeUtil {
return timeString.toString();
}
- /**
- * Disabled constructor.
- */
- private TimeUtil() {
- }
-
/**
* New Calendar from a Date
+ *
* @param date
* @return
*/
@@ -596,7 +575,7 @@ public final class TimeUtil {
}
return t;
}
-
+
/**
* New Calendar from an existing calendar
*
@@ -611,7 +590,7 @@ public final class TimeUtil {
}
return t;
}
-
+
/**
* New GMT Calendar from a Date
*
@@ -637,11 +616,11 @@ public final class TimeUtil {
* @return
*/
public static Calendar addCurrentYearCalendar(final Calendar calendar) {
-
+
Calendar yearTime = TimeUtil.newGmtCalendar();
calendar.set(Calendar.YEAR, yearTime.get(Calendar.YEAR));
-
+
return calendar;
}
-
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/ReflectionUtil.java b/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/ReflectionUtil.java
index 96e693721b..e656d16598 100644
--- a/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/ReflectionUtil.java
+++ b/edexOsgi/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/ReflectionUtil.java
@@ -42,6 +42,7 @@ import org.apache.commons.beanutils.PropertyUtils;
* Jul 10, 2012 455 djohnson Move in methods from RegistryUtil,
* fix setter method to use parameter types.
* Sep 28, 2012 1195 djohnson Add {@link #forName(String)}.
+ * Jan 23, 2014 2584 dhladky Versions for JAXB objects.
*
*
*
@@ -220,6 +221,26 @@ public final class ReflectionUtil {
}
return null;
}
+
+ /**
+ * Get this annotation from this class if it exists
+ *
+ * @param clazz
+ * The class to check
+ * @param annotation
+ * The annotation class to look for
+ * @return Annotation
+ */
+ public static T getAnnotationFromClass(Class> clazz,
+ Class annotation) throws ReflectionException {
+
+ T ann = clazz.getAnnotation(annotation);
+ if (ann != null) {
+ return ann;
+ }
+
+ return null;
+ }
/**
* Create a class instance from its name.
diff --git a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/MergeVTEC.py b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/MergeVTEC.py
index 016b8f3c0b..a4e45c1a4e 100644
--- a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/MergeVTEC.py
+++ b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/MergeVTEC.py
@@ -32,6 +32,7 @@
# 01/25/13 1447 dgilling Initial Creation.
# 03/19/13 1447 dgilling Merge A1 DR 21434.
# 06/11/13 #2083 randerso Move backups to edex_static
+# 01/24/14 #2504 randerso change to use iscUtil.getLogger for consistency
#
#
@@ -39,11 +40,10 @@
import copy
import cPickle
import gzip
-import logging
import os
-import sys
import time
+import iscUtil
import ActiveTableRecord
import siteConfig
import VTECPartners
@@ -404,20 +404,8 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
return SiteMap.getInstance().getSite4LetterId(id)
def __initLogging(self):
- logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
- time.strftime("%Y%m%d", time.gmtime()), 'MergeVTEC.log')
- try:
- os.makedirs(os.path.dirname(logPath))
- except OSError as e:
- if e.errno != errno.EEXIST:
- sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
- sys.exit(-1)
-
- logging.basicConfig(filename=logPath,
- format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
- datefmt="%H:%M:%S",
- level=logging.INFO)
- return logging.getLogger("MergeVTEC")
+ import logging
+ return iscUtil.getLogger("MergeVTEC", logLevel=logging.INFO)
def merge(activeTable, activeTableMode, newRecords, drt=0.0, makeBackups=True,
logger=None):
diff --git a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/ingestAT.py b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/ingestAT.py
index b09ea99b81..ca592c81c0 100644
--- a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/ingestAT.py
+++ b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/ingestAT.py
@@ -27,40 +27,25 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 02/13/13 1447 dgilling Initial Creation.
-#
+# 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency
#
-import errno
-import logging
import os
-import sys
import time
import xml.etree.ElementTree as ET
import IrtAccess
import MergeVTEC
import siteConfig
+import iscUtil
-
-log = None
+logger = None
def init_logging():
- logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
- time.strftime("%Y%m%d", time.gmtime()), 'ingestAT.log')
- try:
- os.makedirs(os.path.dirname(logPath))
- except OSError as e:
- if e.errno != errno.EEXIST:
- sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
- sys.exit(-1)
-
- logging.basicConfig(filename=logPath,
- format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
- datefmt="%H:%M:%S",
- level=logging.INFO)
- global log
- log = logging.getLogger("ingestAT")
+ import logging
+ global logger
+ logger = iscUtil.getLogger("ingestAT", logLevel=logging.INFO)
def execute_ingest_at(incomingRecords, activeTable, atName, ztime, makeBackups, xmlIncoming):
@@ -73,21 +58,21 @@ def execute_ingest_at(incomingRecords, activeTable, atName, ztime, makeBackups,
sourceServer = irt.decodeXMLAddress(addressE)
if sourceServer is None:
continue
- log.info("Source Server: " + irt.printServerInfo(sourceServer))
+ logger.info("Source Server: " + irt.printServerInfo(sourceServer))
results = None
try:
results = MergeVTEC.merge(activeTable, atName, incomingRecords, ztime, makeBackups,
logging.getLogger('MergeVTEC'))
except:
- log.exception("MergeVTEC fail:")
+ logger.exception("MergeVTEC fail:")
return results
def runFromJava(activeTable, activeTableMode, newRecords, drt, makeBackups,
xmlIncoming):
init_logging()
- log.info('************* ingestAT ************************')
+ logger.info('************* ingestAT ************************')
startT = time.time()
results = execute_ingest_at(newRecords, activeTable, activeTableMode, drt,
@@ -97,7 +82,7 @@ def runFromJava(activeTable, activeTableMode, newRecords, drt, makeBackups,
# Finish
#--------------------------------------------------------------------
endT = time.time()
- log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
+ logger.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
return results
diff --git a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/requestAT.py b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/requestAT.py
index 50f558f8a1..460a08bb94 100644
--- a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/requestAT.py
+++ b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/requestAT.py
@@ -27,12 +27,11 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 02/06/13 1447 dgilling Initial Creation.
+# 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency
#
#
import cPickle
-import errno
-import logging
import os
import sys
import tempfile
@@ -42,6 +41,7 @@ import xml.etree.ElementTree as ET
import IrtAccess
import siteConfig
import VTECPartners
+import iscUtil
from com.raytheon.uf.common.activetable import ActiveTableMode
from com.raytheon.uf.common.time.util import TimeUtil
@@ -49,24 +49,12 @@ from com.raytheon.uf.edex.activetable import ActiveTable
-log = None
+logger = None
def init_logging():
- logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
- time.strftime("%Y%m%d", time.gmtime()), 'requestAT.log')
- try:
- os.makedirs(os.path.dirname(logPath))
- except OSError as e:
- if e.errno != errno.EEXIST:
- sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
- sys.exit(-1)
-
- logging.basicConfig(filename=logPath,
- format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
- datefmt="%H:%M:%S",
- level=logging.INFO)
- global log
- log = logging.getLogger("requestAT")
+ import logging
+ global logger
+ logger = iscUtil.getLogger("requestAT", logLevel=logging.INFO)
def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, ancf,
bncf, xmtScript):
@@ -113,7 +101,7 @@ def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, an
countDict[rec.getOfficeid()] = cnt + 1
data = (mhsid, siteID, VTECPartners.VTEC_MERGE_SITES, countDict, issueTime)
- log.info("Data: " + repr(data))
+ logger.info("Data: " + repr(data))
tempdir = os.path.join(siteConfig.GFESUITE_HOME, "products", "ATBL")
with tempfile.NamedTemporaryFile(suffix='.reqat', dir=tempdir, delete=False) as fp:
@@ -132,17 +120,17 @@ def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, an
sourceServer = {'mhsid': mhsid, 'host': serverHost, 'port': serverPort,
'protocol': serverProtocol, 'site': siteID}
irt.addSourceXML(iscE, sourceServer)
- log.info("Requesting Server: " + irt.printServerInfo(sourceServer))
+ logger.info("Requesting Server: " + irt.printServerInfo(sourceServer))
# who is running the domains requested?
sites = VTECPartners.VTEC_TABLE_REQUEST_SITES
if not sites:
- log.error('No sites defined for VTEC_TABLE_REQUEST_SITES')
+ logger.error('No sites defined for VTEC_TABLE_REQUEST_SITES')
sys.exit(1)
status, xml = irt.getServers(sites)
if not status:
- log.error('Failure to getServers from IRT')
+ logger.error('Failure to getServers from IRT')
sys.exit(1)
# decode the XML
@@ -150,11 +138,11 @@ def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, an
serverTree = ET.ElementTree(ET.XML(xml))
serversE = serverTree.getroot()
except:
- log.exception("Malformed XML on getServers()")
+ logger.exception("Malformed XML on getServers()")
sys.exit(1)
if serversE.tag != "servers":
- log.error("Servers packet missing from web server")
+ logger.error("Servers packet missing from web server")
sys.exit(1)
# process each requested domain returned to us
@@ -226,13 +214,13 @@ def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, an
s = "Matching Servers:"
for x in matchingServers:
s += "\n" + irt.printServerInfo(x)
- log.info(s)
+ logger.info(s)
# Display the chosen set of servers
s = "Chosen Servers:"
for x in chosenServers:
s += "\n" + irt.printServerInfo(x)
- log.info(s)
+ logger.info(s)
irt.addDestinationXML(iscE, chosenServers)
@@ -252,18 +240,18 @@ def runFromJava(serverHost, serverPort, serverProtocol, mhsid, siteID, ancf,
bncf, xmtScript):
init_logging()
- log.info('*********** requestAT ******************')
+ logger.info('*********** requestAT ******************')
startT = time.time()
try:
execute_request_at(serverHost, serverPort, serverProtocol, mhsid,
siteID, ancf, bncf, xmtScript)
except:
- log.exception('Error requesting active table')
+ logger.exception('Error requesting active table')
#--------------------------------------------------------------------
# Finish
#--------------------------------------------------------------------
endT = time.time()
- log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
+ logger.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
diff --git a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/sendAT.py b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/sendAT.py
index fa0c6ee4c1..b7a9da8ac0 100644
--- a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/sendAT.py
+++ b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/sendAT.py
@@ -27,14 +27,13 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 02/08/13 1447 dgilling Initial Creation.
+# 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency
#
#
import cPickle
-import errno
import gzip
-import logging
import os
import sys
import time
@@ -47,46 +46,35 @@ import JUtil
import siteConfig
import VTECPartners
import VTECTableSqueeze
+import iscUtil
# Configuration Item for Test Purposes
FORCE_SEND = False #Set to True to always send even if no updates required.
-log = None
+logger = None
def init_logging():
- logPath = os.path.join(siteConfig.GFESUITE_LOGDIR,
- time.strftime("%Y%m%d", time.gmtime()), 'sendAT.log')
- try:
- os.makedirs(os.path.dirname(logPath))
- except OSError as e:
- if e.errno != errno.EEXIST:
- sys.stderr.write("Could not create log directory " + os.path.dirname(logPath))
- sys.exit(-1)
-
- logging.basicConfig(filename=logPath,
- format="%(levelname)s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s",
- datefmt="%H:%M:%S",
- level=logging.INFO)
- global log
- log = logging.getLogger("sendAT")
+ import logging
+ global logger
+ logger = iscUtil.getLogger("sendAT", logLevel=logging.INFO)
def execute_send_at(myServerHost, myServerPort, myServerProtocol,
myServerMHSID, myServerSite, sites, filterSites, mhsSites,
issueTime, countDict, fname, xmlIncoming, xmtScript):
- log.info('reqSite= ' + repr(sites))
- log.info('filterSites= ' + repr(filterSites))
- log.info('mhsSite= ' + repr(mhsSites))
- log.info('reqCountDict= ' + repr(countDict))
+ logger.info('reqSite= ' + repr(sites))
+ logger.info('filterSites= ' + repr(filterSites))
+ logger.info('mhsSite= ' + repr(mhsSites))
+ logger.info('reqCountDict= ' + repr(countDict))
if issueTime is None:
- log.info('reqIssueTime= None')
+ logger.info('reqIssueTime= None')
else:
- log.info('reqIssueTime= ' + str(issueTime) + ' ' +
+ logger.info('reqIssueTime= ' + str(issueTime) + ' ' +
time.asctime(time.gmtime(issueTime)))
irt = IrtAccess.IrtAccess("")
myServer = {'mhsid': myServerMHSID, 'host': myServerHost, 'port': myServerPort,
'protocol': myServerProtocol, 'site': myServerSite}
- log.info('MyServer: ' + irt.printServerInfo(myServer))
+ logger.info('MyServer: ' + irt.printServerInfo(myServer))
#--------------------------------------------------------------------
# Prepare the file for sending
@@ -95,7 +83,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
buf = fd.read()
os.remove(fname)
table = cPickle.loads(buf) #unpickle it
- log.info("Local Table Length= " + str(len(table)))
+ logger.info("Local Table Length= " + str(len(table)))
filtTable = []
# filter by sites listing
@@ -107,7 +95,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
filtTable.append(t)
else:
filtTable = table #no filtering
- log.info("Site Filtered Table Length= " + str(len(filtTable)))
+ logger.info("Site Filtered Table Length= " + str(len(filtTable)))
# eliminate obsolete records
ctime = time.time() #now time
@@ -115,7 +103,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
filtTable = rename_fields_for_A2(filtTable)
actTable, tossRecords = vts.squeeze(filtTable)
actTable = rename_fields_for_A1(actTable)
- log.info("Squeezed Table Length= " + str(len(actTable)))
+ logger.info("Squeezed Table Length= " + str(len(actTable)))
# check issuance time - any times newer in remote table (this table) than
# the local table (requesting site)?
@@ -128,9 +116,9 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
if issueTime < newestRec:
newerRec = True
- log.info("NewestFound= " + str(newestRec) + ' ' +
+ logger.info("NewestFound= " + str(newestRec) + ' ' +
time.asctime(time.gmtime(newestRec)))
- log.info("IssueTime check. Newer record found= " + str(newerRec))
+ logger.info("IssueTime check. Newer record found= " + str(newerRec))
else:
newerRec = True #just assume there are newer records
@@ -149,9 +137,9 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
if reqCount != localCountDict[site]: #records different in request site
missingRec = True
break
- log.info("MissingRec check. Missing record found= " + str(missingRec))
- log.info("lclCountBySite= " + repr(localCountDict))
- log.info("reqCountBySite= " + repr(countDict))
+ logger.info("MissingRec check. Missing record found= " + str(missingRec))
+ logger.info("lclCountBySite= " + repr(localCountDict))
+ logger.info("reqCountBySite= " + repr(countDict))
else:
missingRec = True #just assume there are
@@ -171,7 +159,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
fd.write(actTablePickled)
gzipSize = os.stat(fname)[stat.ST_SIZE]
- log.info('#dataSize: ' + str(rawSize) + ', #gzipSize: ' + str(gzipSize))
+ logger.info('#dataSize: ' + str(rawSize) + ', #gzipSize: ' + str(gzipSize))
#--------------------------------------------------------------------
# Create the destination XML file
@@ -214,7 +202,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
s = "Destinations:"
for destServer in destServers:
s += "\n" + irt.printServerInfo(destServer)
- log.info(s)
+ logger.info(s)
# create XML file
tempdir = os.path.join(siteConfig.GFESUITE_HOME, "products", "ATBL")
@@ -229,7 +217,7 @@ def execute_send_at(myServerHost, myServerPort, myServerProtocol,
[fname, fnameXML], xmtScript)
else:
- log.info("Send has been skipped")
+ logger.info("Send has been skipped")
def rename_fields_for_A1(table):
newTable = []
@@ -276,7 +264,7 @@ def runFromJava(myServerHost, myServerPort, myServerProtocol, myServerMHSID,
countDict, fname, xmlIncoming, xmtScript):
init_logging()
- log.info('*********** sendAT ****************')
+ logger.info('*********** sendAT ****************')
startT = time.time()
try:
@@ -290,11 +278,11 @@ def runFromJava(myServerHost, myServerPort, myServerProtocol, myServerMHSID,
mhsSites, issueTime, countDict, fname, xmlIncoming,
xmtScript)
except:
- log.exception('Error in sendAT:')
+ logger.exception('Error in sendAT:')
sys.exit(1)
#--------------------------------------------------------------------
# Finish
#--------------------------------------------------------------------
endT = time.time()
- log.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
\ No newline at end of file
+ logger.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml
index ff7f87b06b..ffd26a10ef 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml
@@ -22,7 +22,6 @@
-
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapter.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapter.java
index 8a9f16f080..bd981a9e8e 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapter.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapter.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.edex.datadelivery.bandwidth;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -41,7 +42,6 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
-import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthReservation;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
@@ -63,6 +63,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
* Nov 27, 2013 2545 mpduff Get data by network
* Dec 11, 2013 2566 bgonzale handle case when there are no reservations.
* Dec 17, 2013 2636 bgonzale Refactored bucket fill in edex.
+ * Jan 23, 2014 2636 mpduff Changed download window generation.
*
*
*
@@ -96,9 +97,8 @@ class BandwidthGraphDataAdapter {
Collection retrievalPlans = retrievalManager
.getRetrievalPlans().values();
- Map retrievals = new HashMap();
- Map> reservations = new HashMap>();
Map> networkMap = new HashMap>();
+ SubscriptionAllocationMapping subAllocationMapping = new SubscriptionAllocationMapping();
// One retrieval plan per network
for (RetrievalPlan retrievalPlan : retrievalPlans) {
@@ -118,79 +118,71 @@ class BandwidthGraphDataAdapter {
SortedSet buckets = toDescriptions(bandwidthBuckets);
bandwidthGraphData.addBucketDescriptions(network, buckets);
- // Latency window data - accumulate all the reservations
- for (BandwidthBucket bucket : bandwidthBuckets) {
- final List requests = retrievalPlan
- .getBandwidthAllocationsForBucket(bucket);
- for (BandwidthAllocation allocation : requests) {
- if (allocation instanceof SubscriptionRetrieval) {
- final SubscriptionRetrieval subRetrieval = (SubscriptionRetrieval) allocation;
- retrievals.put(allocation.getId(), subRetrieval);
- }
- }
+ // Latency window data
+ List allocationList = EdexBandwidthContextFactory
+ .getInstance().bandwidthDao
+ .getBandwidthAllocations(network);
- final List bandwidthReservations = retrievalPlan
- .getBandwidthReservationsForBucket(bucket);
-
- if (bandwidthReservations != null) {
- for (BandwidthReservation reservation : bandwidthReservations) {
- if (!reservations.containsKey(reservation.getId())) {
- reservations.put(reservation.getId(),
- new ArrayList());
- }
- reservations.get(reservation.getId()).add(reservation);
- }
+ for (BandwidthAllocation allocation : allocationList) {
+ if (allocation instanceof SubscriptionRetrieval) {
+ final SubscriptionRetrieval subRetrieval = (SubscriptionRetrieval) allocation;
+ String subName = subRetrieval.getBandwidthSubscription()
+ .getName();
+ subAllocationMapping.addAllocationForSubscription(subName,
+ allocation);
}
}
}
- // Create time windows for each subscription retrieval by aggregating
- // them with any reservations they have
- for (Long key : retrievals.keySet()) {
- final SubscriptionRetrieval retrieval = retrievals.get(key);
- BandwidthSubscription dao = retrieval.getBandwidthSubscription();
- String subName = dao.getName();
- SubscriptionPriority priority = dao.getPriority();
- String registryId = retrieval.getBandwidthSubscription()
- .getRegistryId();
- Network network = retrieval.getNetwork();
+ Map> subAllocationMap = subAllocationMapping
+ .getSubAllocationMap();
+ for (Map.Entry> entry : subAllocationMap
+ .entrySet()) {
+ String sub = entry.getKey();
+ for (BandwidthAllocation ba : entry.getValue()) {
+ if (ba instanceof SubscriptionRetrieval) {
+ ((SubscriptionRetrieval) ba).getBandwidthSubscription()
+ .getBaseReferenceTime();
+ SubscriptionRetrieval sr = (SubscriptionRetrieval) ba;
+ BandwidthSubscription dao = sr.getBandwidthSubscription();
+ SubscriptionPriority priority = dao.getPriority();
+ Calendar baseRefTime = ((SubscriptionRetrieval) ba)
+ .getBandwidthSubscription().getBaseReferenceTime();
+ int offset = ((SubscriptionRetrieval) ba)
+ .getDataSetAvailablityDelay();
+ String registryId = sr.getBandwidthSubscription()
+ .getRegistryId();
+ Network network = sr.getNetwork();
- SubscriptionWindowData windowData = null;
+ SubscriptionWindowData windowData = null;
+ List subList = networkMap
+ .get(network);
+ for (SubscriptionWindowData subData : subList) {
+ if (subData.getRegistryId().equals(registryId)) {
+ windowData = subData;
+ break;
+ }
+ }
- List subList = networkMap.get(network);
- for (SubscriptionWindowData subData : subList) {
- if (subData.getRegistryId().equals(registryId)) {
- windowData = subData;
- break;
+ if (windowData == null) {
+ windowData = new SubscriptionWindowData();
+ windowData.setNetwork(network);
+ windowData.setPriority(priority);
+ windowData.setRegistryId(registryId);
+ windowData.setSubscriptionName(sub);
+ networkMap.get(network).add(windowData);
+ }
+
+ final long startMillis = sr.getStartTime()
+ .getTimeInMillis();
+ final long endMillis = sr.getEndTime().getTimeInMillis();
+ TimeWindowData window = new TimeWindowData(startMillis,
+ endMillis);
+ window.setBaseTime(baseRefTime.getTimeInMillis());
+ window.setOffset(offset);
+ windowData.addTimeWindow(window);
}
}
-
- if (windowData == null) {
- windowData = new SubscriptionWindowData();
- windowData.setNetwork(network);
- windowData.setPriority(priority);
- windowData.setRegistryId(registryId);
- windowData.setSubscriptionName(subName);
- networkMap.get(network).add(windowData);
- }
-
- final long startMillis = retrieval.getStartTime().getTimeInMillis();
- final long endMillis = startMillis
- + (retrieval.getSubscriptionLatency() * TimeUtil.MILLIS_PER_MINUTE);
- TimeWindowData window = new TimeWindowData(startMillis, endMillis);
-
- List binStartTimes = new ArrayList();
- binStartTimes.add(retrieval.getStartTime().getTimeInMillis());
- List retrievalReservations = reservations
- .get(retrieval.getIdentifier());
-
- if (retrievalReservations != null) {
- for (BandwidthReservation reservation : retrievalReservations) {
- binStartTimes.add(reservation.getBandwidthBucket());
- }
- }
- window.setBinStartTimes(binStartTimes);
- windowData.addTimeWindow(window);
}
bandwidthGraphData.setNetworkDataMap(networkMap);
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java
index 0dc59bd340..61b928db3a 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java
@@ -138,6 +138,8 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
* handlePoint method now schedules most recent.
* Jan 14, 2014 2692 dhladky Bad Point scheduling final Empty list.
* Jan 14, 2014 2459 mpduff Change to subscription status.
+ * Jan 25, 2014 2636 mpduff Don't do an initial adhoc query for a new subscription.
+ * Jan 24, 2013 2709 bgonzale Before scheduling adhoc, check if in active period window.
*
*
*
@@ -639,7 +641,6 @@ public abstract class BandwidthManager
.getCycleTimes();
final boolean subscribedToCycles = !CollectionUtil
.isNullOrEmpty(cycles);
- final boolean useMostRecentDataSetUpdate = !subscribedToCycles;
// The subscription has cycles, so we can allocate bandwidth at
// expected times
@@ -648,8 +649,6 @@ public abstract class BandwidthManager
unscheduled = schedule(subscription, Sets.newTreeSet(cycles));
}
- unscheduled.addAll(getMostRecent(subscription,
- useMostRecentDataSetUpdate));
return unscheduled;
}
@@ -679,11 +678,13 @@ public abstract class BandwidthManager
plan.getPlanStart()).getTime();
Date subscriptionValidEnd = subscription.calculateEnd(
plan.getPlanEnd()).getTime();
- Date now = TimeUtil.newDate();
+ Calendar nowCalendar = TimeUtil.newCalendar();
+ Date now = nowCalendar.getTime();
if ((now.equals(subscriptionValidStart) || now
.after(subscriptionValidStart))
- && now.before(subscriptionValidEnd)) {
+ && now.before(subscriptionValidEnd)
+ && subscription.inActivePeriodWindow(nowCalendar)) {
unscheduled = scheduleAdhoc(adhoc);
} else {
statusHandler.info(String.format(
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java
index c2f6bca0ef..fd5e8c2747 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java
@@ -115,6 +115,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Jan 13, 2014 2679 dhladky Small Point data updates.
* Jan 14, 2014 2692 dhladky AdhocSubscription handler
* Jan 20, 2013 2398 dhladky Fixed rescheduling beyond active period/expired window.
+ * Jan 24, 2013 2709 bgonzale Changed parameter to shouldScheduleForTime to a Calendar.
*
*
*
@@ -312,25 +313,19 @@ public abstract class EdexBandwidthManager
// TODO Check if we need to set sub to "OFF" state and save to
// registry
if (((RecurringSubscription) subscription)
- .shouldScheduleForTime(next.getTime())) {
+ .shouldScheduleForTime(next)) {
// Since subscriptions are based on cycles in a day, add
- // one
- // day
- // to the
- // completed BandwidthSubscription to get the next days
- // retrieval.
+ // one day to the completed BandwidthSubscription to get
+ // the next days retrieval.
// Now check if that BandwidthSubscription has already
- // been
- // scheduled.
+ // been scheduled.
BandwidthSubscription a = bandwidthDao
.getBandwidthSubscription(dao.getRegistryId(), next);
if (a == null) {
// Create the new BandwidthSubscription record with
- // the
- // next
- // time..
+ // the next time..
a = bandwidthDao.newBandwidthSubscription(subscription,
next);
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/InMemoryBandwidthBucketDao.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/InMemoryBandwidthBucketDao.java
index e4c4561f7c..4d77529315 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/InMemoryBandwidthBucketDao.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/InMemoryBandwidthBucketDao.java
@@ -58,6 +58,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Sept 17, 2013 2383 bgonzale Switched back to start from ceiling and end from floor.
* Constrain start and end keys by each other.
* Dec 3, 2013 1736 dhladky Bandwidth bucket size attenuation.
+ * Jan 25, 2014 2741 dhladky Unsafe nullpointer being thrown.
*
*
*
@@ -244,14 +245,16 @@ public class InMemoryBandwidthBucketDao implements IBandwidthBucketDao {
final NavigableMap buckets = allBuckets
.get(network);
Long firstKey = buckets.floorKey(key);
- if (firstKey < keyConstraint) {
- // then go back to key before this one
- firstKey = buckets.ceilingKey(key);
+ if (firstKey != null) {
+ if (firstKey < keyConstraint) {
+ // then go back to key before this one
+ firstKey = buckets.ceilingKey(key);
+ }
}
+ // safety check
if (firstKey == null) {
firstKey = buckets.firstKey();
}
-
return firstKey;
}
@@ -267,14 +270,16 @@ public class InMemoryBandwidthBucketDao implements IBandwidthBucketDao {
final NavigableMap buckets = allBuckets
.get(network);
Long lastKey = buckets.ceilingKey(key);
- if (lastKey > keyConstraint) {
- // then go back to key before this one
- lastKey = buckets.floorKey(key);
+ if (lastKey != null) {
+ if (lastKey > keyConstraint) {
+ // then go back to key before this one
+ lastKey = buckets.floorKey(key);
+ }
}
+ // safety check
if (lastKey == null) {
- lastKey = buckets.lastKey();
+ lastKey = buckets.lastKey();
}
-
return lastKey;
}
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/SubscriptionAllocationMapping.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/SubscriptionAllocationMapping.java
new file mode 100644
index 0000000000..4aed907657
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/SubscriptionAllocationMapping.java
@@ -0,0 +1,100 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.edex.datadelivery.bandwidth;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
+import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
+
+/**
+ * Data class to hold Subscription to download allocations map
+ * BandwidthAllocation id to SubscriptionRetrieval map
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 23, 2014 2636 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class SubscriptionAllocationMapping {
+
+ /**
+ * Subscription name to list of BandwidthAllocations for the subscription.
+ */
+ private final Map> subAllocationMap = new HashMap>();
+
+ /**
+ * BandwidthAllocation id to SubscriptionRetrieval map.
+ */
+ private final Map subRetrievalMap = new HashMap();
+
+ /**
+ * Constructor.
+ */
+ public SubscriptionAllocationMapping() {
+
+ }
+
+ /**
+ * Add the allocation to the subscription list.
+ *
+ * @param subName
+ * The subscription name for the allocation
+ * @param allocation
+ * The allocation to add to the subscription list
+ */
+ public void addAllocationForSubscription(String subName,
+ BandwidthAllocation allocation) {
+ if (subAllocationMap.get(subName) == null) {
+ subAllocationMap
+ .put(subName, new ArrayList(8));
+ }
+
+ subAllocationMap.get(subName).add(allocation);
+ subRetrievalMap.put(allocation.getId(),
+ (SubscriptionRetrieval) allocation);
+ }
+
+ /**
+ * @return the subAllocationMap
+ */
+ public Map> getSubAllocationMap() {
+ return subAllocationMap;
+ }
+
+ /**
+ * @return the subRetrievalMap
+ */
+ public Map getSubRetrievalMap() {
+ return subRetrievalMap;
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java
index 0b33325be3..b40936ec24 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java
@@ -22,7 +22,6 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.util;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -79,6 +78,10 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
* Dec 20, 2013 2636 mpduff Fix dataset offset.
* Jan 08, 2014 2615 bgonzale Refactored getRetrievalTimes into RecurringSubscription
* calculateStart and calculateEnd methods.
+ * Jan 24, 2014 2636 mpduff Refactored retrieval time generation.
+ * Jan 24, 2013 2709 bgonzale Added inActivePeriodWindow check during retrieval time calculations
+ * because the calculate start and end time methods no longer use
+ * active period.
*
*
* @author djohnson
@@ -173,19 +176,31 @@ public class BandwidthDaoUtil {
Calendar planStart = plan.getPlanStart();
// starting time when when subscription is first valid for scheduling
- // based on plan start, subscription start, and active period start.
+ // based on plan start and subscription start.
Calendar subscriptionCalculatedStart = subscription
.calculateStart(planStart);
// end time when when subscription is last valid for scheduling based on
- // plan end, subscription end, and active period end.
+ // plan end and subscription end.
Calendar subscriptionCalculatedEnd = subscription.calculateEnd(planEnd);
+ if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
+ statusHandler.debug("**** PlanStart: " + planStart.getTime());
+ statusHandler.debug("**** PlanEnd : " + planEnd.getTime());
+ statusHandler.debug("**** CalculatedStart: "
+ + subscriptionCalculatedStart.getTime());
+ statusHandler.debug("**** CalculatedEnd : "
+ + subscriptionCalculatedEnd.getTime());
+ }
+ // drop the start time by 6 hours to account for 4 cycle/day models
+ subscriptionCalculatedStart = TimeUtil.minCalendarFields(
+ subscriptionCalculatedStart, Calendar.MINUTE, Calendar.SECOND,
+ Calendar.MILLISECOND);
+ subscriptionCalculatedStart.add(Calendar.HOUR_OF_DAY, -6);
Calendar start = (Calendar) subscriptionCalculatedStart.clone();
outerloop: while (!start.after(subscriptionCalculatedEnd)) {
for (Integer cycle : hours) {
start.set(Calendar.HOUR_OF_DAY, cycle);
-
// start base equal-to-or-after subscriptionStart
if (start.compareTo(subscriptionCalculatedStart) >= 0) {
for (Integer minute : minutes) {
@@ -206,7 +221,9 @@ public class BandwidthDaoUtil {
**/
// Subscription Start and End time first
if (time.after(subscriptionCalculatedEnd)
- || time.before(start)) {
+ || time.before(start)
+ || !subscription
+ .inActivePeriodWindow(time)) {
// don't schedule this retrieval time,
// outside subscription window
continue;
@@ -224,35 +241,6 @@ public class BandwidthDaoUtil {
start.set(Calendar.HOUR_OF_DAY, hours.first());
}
- // Now walk the subscription times and throw away anything outside the
- // plan hours, taking into account the availability delay...
- int availabilityOffset = 0;
- Iterator itr = subscriptionTimes.iterator();
- while (itr.hasNext()) {
- availabilityOffset = 0;
- Calendar time = itr.next();
-
- try {
- availabilityOffset = BandwidthUtil.getDataSetAvailablityOffset(
- subscription, time);
- } catch (RegistryHandlerException e) {
- // Error occurred querying the registry. Log and continue on
- statusHandler
- .handle(Priority.PROBLEM,
- "Unable to retrieve data availability offset, using 0 for the offset.",
- e);
- }
-
- Calendar withAvailabilityOffset = TimeUtil.newCalendar(time);
- withAvailabilityOffset.add(Calendar.MINUTE, availabilityOffset);
-
- // We allow base reference times that are still possible to retrieve
- // within the availability window to be included
- if (withAvailabilityOffset.before(planStart) || time.after(planEnd)) {
- itr.remove();
- }
- }
-
return subscriptionTimes;
}
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml
index 084a818f77..792e13219a 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml
@@ -24,7 +24,6 @@
value="com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager.addObjectTypesToSubscribeTo" />
- Test Object Type
urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Federation
urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Registry
urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java
index 07f8f7125a..5a27bd63c2 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java
@@ -156,6 +156,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 12/2/2013 1829 bphillip Modified to use correct getters for slot values
* 12/9/2013 2613 bphillip Optimized registry sync function
* 1/15/2014 2613 bphillip Added leaveFederation method to prevent inactive registries from participating in the federation unintentionally.
+ * 1/21/2014 2613 bphillip Changed max down time which requires a sync
*
*
* @author bphillip
@@ -188,8 +189,7 @@ public class RegistryFederationManager implements RegistryInitializedListener {
* The maximum time a registry can be down before a full synchronization is
* performed
*/
- private static final long MAX_DOWN_TIME_DURATION = TimeUtil.MILLIS_PER_DAY
- * 2 - TimeUtil.MILLIS_PER_HOUR;
+ private static final long MAX_DOWN_TIME_DURATION = TimeUtil.MILLIS_PER_HOUR * 6;
/** The central registry mode string */
private static final String CENTRAL_REGISTRY_MODE = "centralRegistry";
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/retrieval-datadelivery-monolithic.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/retrieval-datadelivery-monolithic.xml
new file mode 100644
index 0000000000..1ee204a9ad
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/res/spring/retrieval-datadelivery-monolithic.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/RetrievalGenerator.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/RetrievalGenerator.java
index 23b4c4b0c3..7928cd3894 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/RetrievalGenerator.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/RetrievalGenerator.java
@@ -22,10 +22,10 @@ package com.raytheon.uf.edex.datadelivery.retrieval;
import java.util.List;
+import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
-import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java
index 6e6fefe754..ffec6e323e 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java
@@ -31,6 +31,7 @@ import java.util.TreeSet;
import com.raytheon.uf.common.datadelivery.registry.Collection;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
+import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.DataType;
@@ -43,7 +44,6 @@ import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.Provider;
-import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.retrieval.util.HarvesterServiceManager;
import com.raytheon.uf.common.datadelivery.retrieval.util.LookupManager;
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGenerator.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGenerator.java
index b29d773fbd..8b216a8222 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGenerator.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPRetrievalGenerator.java
@@ -38,11 +38,11 @@ import com.raytheon.uf.common.datadelivery.registry.Levels;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.Provider;
-import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
import com.raytheon.uf.common.datadelivery.registry.Time;
+import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/RetrievalGeneratorUtilities.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/RetrievalGeneratorUtilities.java
index e0e6e8c396..cf662845a6 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/RetrievalGeneratorUtilities.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/util/RetrievalGeneratorUtilities.java
@@ -68,13 +68,17 @@ public class RetrievalGeneratorUtilities {
public static boolean findDuplicateUri(String dataUri, String plugin) {
boolean isDuplicate = false;
- String sql = "select id from " + plugin + " where datauri = '"
- + dataUri + "'";
+ try {
+ String sql = "select id from " + plugin + " where datauri = '"
+ + dataUri + "'";
- CoreDao dao = new CoreDao(DaoConfig.forDatabase("metadata"));
- Object[] results = dao.executeSQLQuery(sql);
- if (results.length > 0) {
- isDuplicate = true;
+ CoreDao dao = new CoreDao(DaoConfig.forDatabase("metadata"));
+ Object[] results = dao.executeSQLQuery(sql);
+ if (results.length > 0) {
+ isDuplicate = true;
+ }
+ } catch (Exception e) {
+ statusHandler.error("Couldn't determine duplicate status! ", e);
}
return isDuplicate;
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java
index 4a01d2f377..c2ed9e13f6 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisFeatureFactory.java
@@ -21,7 +21,7 @@ package com.raytheon.uf.edex.plugin.madis.ogc;
**/
import java.util.ArrayList;
-import java.util.Date;
+import java.util.Calendar;
import java.util.List;
import org.geotools.feature.simple.SimpleFeatureBuilder;
@@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Point;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/01/2013 1746 dhladky Initial creation
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
* @author dhladky
@@ -97,7 +98,7 @@ public class MadisFeatureFactory implements FeatureFactory {
getFeatureType());
builder.set(LOCATION_KEY, record.getLocation().getLocation());
builder.set(MadisPointDataTransform.STATION_ID, record.getLocation().getStationId());
- builder.set(MadisPointDataTransform.TIME_OBS, record.getTimeObs().getTime());
+ builder.set(MadisPointDataTransform.TIME_OBS, record.getTimeObs());
builder.set(MadisPointDataTransform.PROVIDER, record.getProvider());
builder.set(MadisPointDataTransform.SUB_PROVIDER, record.getSubProvider());
builder.set(MadisPointDataTransform.DATASET, record.getDataset());
@@ -155,7 +156,7 @@ public class MadisFeatureFactory implements FeatureFactory {
builder.setDefaultGeometry(LOCATION_KEY);
builder.add(LOCATION_KEY, Point.class);
builder.add(MadisPointDataTransform.STATION_ID, String.class);
- builder.add(MadisPointDataTransform.TIME_OBS, Date.class);
+ builder.add(MadisPointDataTransform.TIME_OBS, Calendar.class);
builder.add(MadisPointDataTransform.PROVIDER, String.class);
builder.add(MadisPointDataTransform.SUB_PROVIDER, String.class);
builder.add(MadisPointDataTransform.DATASET, Integer.class);
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java
index fcb7ad08ac..ce096a1e2c 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/MadisLayerCollector.java
@@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.madis.ogc;
**/
import java.util.Calendar;
-import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.madis.MadisRecord;
import com.raytheon.uf.edex.ogc.common.db.ILayerStore;
@@ -36,6 +35,7 @@ import com.raytheon.uf.edex.ogc.common.db.SingleLayerCollector;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/01/2013 1746 dhladky Initial creation
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
* @author dhladky
@@ -60,9 +60,7 @@ public class MadisLayerCollector extends
*/
@Override
protected Calendar getTime(MadisRecord record) {
- Calendar rval = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- rval.setTime(record.getTimeObs());
- return rval;
+ return record.getTimeObs();
}
}
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java
index 0f8470d055..22d7f79e07 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.ogc/src/com/raytheon/uf/edex/plugin/madis/ogc/feature/Madis.java
@@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.madis.ogc.feature;
**/
import java.util.Calendar;
-import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
@@ -56,6 +55,7 @@ import com.raytheon.uf.edex.ogc.common.feature.ObsLocation;
* Jun 03, 2013 1763 dhladky Altered QCD values map
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sept 19,2013 2388 dhladky Fixed creation of geometry (location assignment)
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
* @author dhladky
@@ -250,10 +250,9 @@ public class Madis extends AbstractFeatureType {
record.setSubProvider(this.getSub_provider());
record.setDataset(this.getDataset());
record.setRestriction(this.getRestriction());
- Date date = new Date(this.getTimeObs().toGregorianCalendar()
- .getTimeInMillis());
- record.setDataTime(new DataTime(date));
- record.setTimeObs(date);
+ Calendar cal = this.getTimeObs().toGregorianCalendar();
+ record.setDataTime(new DataTime(cal.getTime()));
+ record.setTimeObs(cal);
record.setLocation(getSfcObsLocation(this.getObsLocation()));
record.setDewpoint(this.getDewpoint());
record.setDewpoint_qcd(QCD.fromVal(this.getDewpoint_qcd()));
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java
index 237523dc73..00a781a4b0 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis.registry/src/com/raytheon/uf/edex/plugin/madis/registry/MadisRegistryCollectorAddon.java
@@ -44,6 +44,7 @@ import com.raytheon.uf.edex.plugin.madis.ogc.MadisLayer;
* Sept 2, 2013 #2098 dhladky Improved time management.
* Sept 9, 2013 #2351 dhladky Speed improvements
* Jan 13, 2014 #2679 dhladky multiple ingest layers for a single request window.
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
*
@@ -79,7 +80,7 @@ public class MadisRegistryCollectorAddon extends
*/
@Override
protected Date getTime(MadisRecord record) {
- Date time = record.getTimeObs();
+ Date time = record.getTimeObs().getTime();
return time;
}
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java
index 496fd9db79..9a1d3d1c6a 100644
--- a/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java
+++ b/edexOsgi/com.raytheon.uf.edex.plugin.madis/src/com/raytheon/uf/edex/plugin/madis/MadisDecoder.java
@@ -24,6 +24,7 @@ import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
@@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jun 17, 2013 2113 dhladky QPID memory usage alleviation
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Dec 10, 2013 2616 mpduff Set overwrite allowed on MadisRecord.
+ * jan 22, 2014 2713 dhladky Calendar conversion.
*
*
* @author dhladky
@@ -792,9 +794,10 @@ public class MadisDecoder extends AbstractDecoder {
sb.append(":01");
try {
-
Date time = getDateFormatter().get().parse(sb.toString());
- rec.setTimeObs(time);
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ cal.setTime(time);
+ rec.setTimeObs(cal);
} catch (ParseException e) {
statusHandler.handle(Priority.PROBLEM,
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/utility/edex_static/base/roles/userRoles.xml b/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/utility/edex_static/base/roles/userRoles.xml
deleted file mode 100644
index b2ed46352f..0000000000
--- a/edexOsgi/com.raytheon.uf.edex.plugin.nwsauth/utility/edex_static/base/roles/userRoles.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml
index aaf2455f2e..9e734ca8ec 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml
@@ -74,6 +74,7 @@
+
*
@@ -79,14 +91,14 @@ public class AuditableEventTypeDao extends
+ "left outer join action.affectedObjectRefs as AffectedObjectRefs "
+ "left outer join AffectedObjects.registryObject as RegistryObjects "
+ "left outer join AffectedObjectRefs.objectRef as ObjRefs "
- + "where (ObjRefs.id in (:ids) OR RegistryObjects.id in (:ids) OR action.eventType = :eventType) and event.timestamp >= :startTime";
+ + "where (ObjRefs.id in (:ids) OR RegistryObjects.id in (:ids)) and event.timestamp >= :startTime";
/**
* Query to find deleted events
*/
private static final String FIND_DELETED_EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event "
+ "left outer join event.action as action "
- + "where action.eventType = :eventType and event.timestamp >= :startTime";
+ + "where action.eventType = 'urn:oasis:names:tc:ebxml-regrep:ActionType:delete' and event.timestamp > :startTime";
/** Optional end time clause */
private static final String END_TIME_CLAUSE = " and event.timestamp <= :endTime";
@@ -104,6 +116,17 @@ public class AuditableEventTypeDao extends
private static final String GET_EXPIRED_EVENTS_QUERY = "FROM AuditableEventType event where event.timestamp < :"
+ GET_EXPIRED_EVENTS_QUERY_CUTOFF_PARAMETER;
+ /** The registry soap services */
+ private RegistrySOAPServices soapService;
+
+ /** Sorter for sorting events */
+ private static final Comparator EVENT_TIME_COMPARATOR = new Comparator() {
+ @Override
+ public int compare(AuditableEventType o1, AuditableEventType o2) {
+ return o2.getTimestamp().compare(o1.getTimestamp());
+ }
+ };
+
/**
* Constructor.
*
@@ -134,6 +157,100 @@ public class AuditableEventTypeDao extends
.getTimeInMillis()));
}
+ /**
+ * Gets all auditable events which reference the objects of interest.
+ *
+ * @param subscription
+ * The subscription to get the events for
+ * @param serviceAddress
+ * The address to the registry to use to verify deleted objects
+ * @param startTime
+ * The start time boundary of the query
+ * @param endTime
+ * The end time boundary of the query
+ * @param objectsOfInterest
+ * The objects of interest to get events for
+ * @return The list of auditable events referencing the objects of interest
+ * @throws EbxmlRegistryException
+ * @throws MsgRegistryException
+ */
+ public List getEventsOfInterest(
+ SubscriptionType subscription, String serviceAddress,
+ XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
+ List objectsOfInterest)
+ throws EbxmlRegistryException, MsgRegistryException {
+ List events = new ArrayList(0);
+ if (!objectsOfInterest.isEmpty()) {
+ events = getEventsOfInterest(FIND_EVENTS_OF_INTEREST_QUERY,
+ startTime, endTime, objectsOfInterest);
+ }
+ List deleteEvents = getDeleteEventsOfInterest(
+ subscription, serviceAddress, startTime, endTime);
+ if (!deleteEvents.isEmpty()) {
+ events.addAll(deleteEvents);
+ }
+ Collections.sort(events, EVENT_TIME_COMPARATOR);
+ return events;
+ }
+
+ /**
+ * Gets applicable delete events
+ *
+ * @param subscription
+ * The subscription to get the events for
+ * @param serviceAddress
+ * The address to the registry to use to verify deleted objects
+ * @param startTime
+ * The start time boundary of the query
+ * @param endTime
+ * The end time boundary of the query
+ * @return The list of auditable events referencing deleted objects
+ * @throws EbxmlRegistryException
+ * @throws MsgRegistryException
+ */
+ private List getDeleteEventsOfInterest(
+ SubscriptionType subscription, String serviceAddress,
+ XMLGregorianCalendar startTime, XMLGregorianCalendar endTime)
+ throws EbxmlRegistryException, MsgRegistryException {
+
+ List retVal = new LinkedList();
+ List deletedEvents = getEventsOfInterest(
+ FIND_DELETED_EVENTS_OF_INTEREST_QUERY, startTime, endTime, null);
+ try {
+ URL url = new URL(serviceAddress);
+ String baseURL = url.toString().replace(url.getPath(), "");
+ List remoteRefs = soapService
+ .getQueryServiceForHost(baseURL)
+ .executeQuery(
+ new QueryRequest(
+ "Deleted Objects of Interest Query for ["
+ + subscription.getId() + "]",
+ subscription.getSelector(),
+ new ResponseOptionType(
+ QueryReturnTypes.OBJECT_REF, false)))
+ .getObjectRefList().getObjectRef();
+
+ for (AuditableEventType event : deletedEvents) {
+ for (ActionType action : event.getAction()) {
+ if (action.getAffectedObjectRefs() != null
+ && !action.getAffectedObjectRefs().getObjectRef()
+ .isEmpty()) {
+ if (remoteRefs.contains(action.getAffectedObjectRefs()
+ .getObjectRef().get(0))) {
+ retVal.add(event);
+ }
+ }
+ }
+ }
+ } catch (MalformedURLException e) {
+ throw new EbxmlRegistryException(
+ "Error parsing notification address", e);
+ }
+
+ return retVal;
+
+ }
+
/**
* Gets the events of interest based on the start time, end time, and the
* list of objects of interest
@@ -147,13 +264,10 @@ public class AuditableEventTypeDao extends
* @return The list of auditable events of interest within the constrains of
* the start time, end time and including the objects of interest
*/
- public List getEventsOfInterest(
+ private List getEventsOfInterest(String query,
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
List objectsOfInterest) {
- String query = FIND_DELETED_EVENTS_OF_INTEREST_QUERY;
- List queryParams = new ArrayList(4);
- queryParams.add("eventType");
- queryParams.add(ActionTypes.delete);
+ List queryParams = new ArrayList(2);
queryParams.add("startTime");
queryParams.add(startTime);
if (!CollectionUtil.isNullOrEmpty(objectsOfInterest)) {
@@ -241,4 +355,8 @@ public class AuditableEventTypeDao extends
return AuditableEventType.class;
}
+ public void setSoapService(RegistrySOAPServices soapService) {
+ this.soapService = soapService;
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java
index 1f7fcff981..0a47ce8c58 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java
@@ -36,6 +36,7 @@ import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import javax.persistence.Version;
import javax.xml.bind.JAXBException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
@@ -91,6 +92,7 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
* Nov 01, 2013 2361 njensen Use EbxmlJaxbManager instead of SerializationUtil
* Nov 14, 2013 2552 bkowal EbxmlJaxbManager is now accessed via getInstance
* Dec 20, 2013 2636 mpduff Set initialized to true before postInitialized is called.
+ * Dec 04, 2013 2584 dhladky Version based EbxmlJaxbManager
*
*
* @author bphillip
@@ -202,6 +204,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements
*
* @throws EbxmlRegistryException
*/
+ @SuppressWarnings("resource")
private void executeRegistrySql() throws EbxmlRegistryException {
JarFile jar = null;
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java
index 8aca1d5895..4cf7b7eb58 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java
@@ -19,6 +19,7 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services;
+import java.util.ArrayList;
import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
@@ -34,6 +35,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.eventbus.Subscribe;
+import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
@@ -59,6 +61,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent;
* 10/23/2013 1538 bphillip Removed call to subscription manager. Subscriptions will now
* only be run on a quartz timer
* 12/2/2013 1829 bphillip Now uses event bus for triggering auditable event generation
+ * 01/21/2014 2613 bphillip Changed how auditable events are created for deletes
*
*
*
@@ -103,12 +106,27 @@ public class AuditableEventService {
public void createAuditableEventFromObjects(
CreateAuditTrailEvent registryEvent) throws EbxmlRegistryException {
if (!CollectionUtil.isNullOrEmpty(registryEvent.getObjectsAffected())) {
- AuditableEventType event = createEvent(registryEvent.getRequest(),
- TimeUtil.currentTimeMillis());
- addRegistryObjectActionToEvent(event,
- registryEvent.getActionType(),
- registryEvent.getObjectsAffected());
- auditDao.createOrUpdate(event);
+ long currentTime = TimeUtil.currentTimeMillis();
+ if (ActionTypes.delete.equals(registryEvent.getActionType())) {
+ for (RegistryObjectType obj : registryEvent
+ .getObjectsAffected()) {
+ List regObjList = new ArrayList(
+ 1);
+ regObjList.add(obj);
+ AuditableEventType event = createEvent(
+ registryEvent.getRequest(), currentTime);
+ addRegistryObjectActionToEvent(event,
+ registryEvent.getActionType(), regObjList);
+ auditDao.createOrUpdate(event);
+ }
+ } else {
+ AuditableEventType event = createEvent(
+ registryEvent.getRequest(), currentTime);
+ addRegistryObjectActionToEvent(event,
+ registryEvent.getActionType(),
+ registryEvent.getObjectsAffected());
+ auditDao.createOrUpdate(event);
+ }
}
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java
index 5640c0c25b..823260a8a8 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java
@@ -107,6 +107,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent;
* Nov 08, 2013 2506 bgonzale Added RegistryObjectType to RemoveRegistryEvent.
* Separate update from create notifications.
* 12/2/2013 1829 bphillip Auditable events are not genereted via messages on the event bus
+ * 01/21/2014 2613 bphillip Removed verbose log message from removeObjects
*
*
*
@@ -230,8 +231,6 @@ public class LifecycleManagerImpl implements LifecycleManager {
statusHandler
.info("No results returned from remove objects query");
} else {
- statusHandler.info("Remove objects query returned "
- + queryResponse.getRegistryObjects() + " objects");
objectsToRemove.addAll(queryResponse.getRegistryObjects());
}
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java
index d2016cb718..10895c79a8 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java
@@ -92,6 +92,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 10/30/2013 1538 bphillip Changed to use non-static registry soap service client
* 12/2/2013 1829 bphillip Added getIdsFrom action method and changed how slots are added to objects
* 1/15/2014 2613 bphillip Added batching of notification update queries to reduce number of web service calls
+ * 01/21/2014 2613 bphillip Added home slot to remove objects request so delete events are properly handled
*
*
*
@@ -192,6 +193,9 @@ public class NotificationListenerImpl implements NotificationListener {
"Notification delete object submission", null,
null, refList, false, true,
DeletionScope.DELETE_ALL);
+ request.getSlot().add(
+ new SlotType(EbxmlObjectUtil.HOME_SLOT_NAME,
+ new StringValueType(clientBaseURL)));
try {
lcm.removeObjects(request);
} catch (MsgRegistryException e) {
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java
index 5d2fdc042a..8c7cf1e95f 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java
@@ -74,6 +74,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 10/23/2013 1538 bphillip Adding log messages and changed methods to handle DateTime value on
* AuditableEvents instead of integer
* 12/9/2013 2613 bphillip Changed start time boundary of get auditable events to be the last run time of the subscription
+ * 01/21/2014 2613 bphillip Changed start time boundary again and also a few minor cleanup items
*
*
* @author bphillip
@@ -136,12 +137,16 @@ public class RegistryNotificationManager {
* @param objectsOfInterest
* The objects to get events for
* @return The events of interest for the given set of objects
+ * @throws MsgRegistryException
+ * @throws EbxmlRegistryException
*/
public List getEventsOfInterest(
+ SubscriptionType subscription, String serviceAddress,
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
- List objectsOfInterest) {
- return this.auditableEventDao.getEventsOfInterest(startTime, endTime,
- objectsOfInterest);
+ List objectsOfInterest)
+ throws EbxmlRegistryException, MsgRegistryException {
+ return this.auditableEventDao.getEventsOfInterest(subscription,
+ serviceAddress, startTime, endTime, objectsOfInterest);
}
/**
@@ -221,28 +226,26 @@ public class RegistryNotificationManager {
* If errors occur while sending the notifications
* @throws MsgRegistryException
*/
- protected void sendNotifications(
- SubscriptionNotificationListeners notificationListeners)
- throws EbxmlRegistryException, MsgRegistryException {
+ protected XMLGregorianCalendar sendNotifications(
+ SubscriptionNotificationListeners notificationListeners,
+ XMLGregorianCalendar startTime) throws EbxmlRegistryException,
+ MsgRegistryException {
+ // Object to hold the last timestampe of the latest event in order to
+ // update the subscription last run time correctly
+ XMLGregorianCalendar lastTime = null;
final List listeners = notificationListeners.listeners;
final SubscriptionType subscription = notificationListeners.subscription;
List objectsOfInterest = getObjectsOfInterest(subscription);
- XMLGregorianCalendar startTime = subscription
- .getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME);
-
- if (startTime == null) {
- startTime = subscription.getStartTime();
- }
-
- List eventsOfInterest = getEventsOfInterest(
- subscription.getStartTime(), subscription.getEndTime(),
- objectsOfInterest);
-
- if (!eventsOfInterest.isEmpty()) {
- for (NotificationListenerWrapper listener : listeners) {
+ for (NotificationListenerWrapper listener : listeners) {
+ List eventsOfInterest = getEventsOfInterest(
+ subscription, listener.address, startTime,
+ subscription.getEndTime(), objectsOfInterest);
+ if (!eventsOfInterest.isEmpty()) {
+ lastTime = eventsOfInterest.get(eventsOfInterest.size() - 1)
+ .getTimestamp();
int subListCount = eventsOfInterest.size()
/ notificationBatchSize;
int lastListSize = eventsOfInterest.size()
@@ -281,6 +284,7 @@ public class RegistryNotificationManager {
}
}
+ return lastTime;
}
/**
@@ -326,23 +330,28 @@ public class RegistryNotificationManager {
List actionList = event.getAction();
for (ActionType action : actionList) {
objectsToRemove.clear();
+ refsToRemove.clear();
if (action.getAffectedObjectRefs() != null) {
List objRefs = action
.getAffectedObjectRefs().getObjectRef();
for (ObjectRefType obj : objRefs) {
boolean found = objectInList(objectsOfInterest, obj);
- if (!found && !action.equals(ActionTypes.delete)) {
+ if (!found
+ && !action.getEventType().equals(
+ ActionTypes.delete)) {
refsToRemove.add(obj);
}
}
- objRefs.removeAll(objectsToRemove);
+ objRefs.removeAll(refsToRemove);
} else if (action.getAffectedObjects() != null) {
List regObjs = action
.getAffectedObjects().getRegistryObject();
for (RegistryObjectType obj : regObjs) {
boolean found = objectInList(objectsOfInterest, obj);
- if (!found && !action.equals(ActionTypes.delete)) {
+ if (!found
+ && !action.getEventType().equals(
+ ActionTypes.delete)) {
objectsToRemove.add(obj);
}
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java
index 52074c75ac..07c6bc51d8 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java
@@ -81,6 +81,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 11/20/2013 2534 bphillip Moved method to get notification destinations to utility
* 12/9/2013 2613 bphillip Setting last run time of subscription now occurs before notification is sent
* 1/15/2014 2613 bphillip Added Hibernate flush and clear after subscription processing
+ * 01/21/2014 2613 bphillip Changed how last run time is updated for replication subscriptions
*
*
* @author bphillip
@@ -388,9 +389,19 @@ public class RegistrySubscriptionManager implements
}
statusHandler.info("Processing subscription [" + subscriptionName
+ "]...");
- updateLastRunTime(subscription, TimeUtil.currentTimeMillis());
- notificationManager.sendNotifications(listeners
- .get(subscriptionName));
+ XMLGregorianCalendar startTime = subscription
+ .getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME);
+
+ if (startTime == null) {
+ startTime = subscription.getStartTime();
+ }
+ XMLGregorianCalendar lastEventTime = notificationManager
+ .sendNotifications(listeners.get(subscriptionName),
+ startTime);
+ if (lastEventTime != null) {
+ updateLastRunTime(subscription, lastEventTime
+ .toGregorianCalendar().getTimeInMillis());
+ }
} catch (Throwable e) {
statusHandler.error(
"Errors occurred while processing subscription ["
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/adhoc/AdhocQueryExpressionManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/adhoc/AdhocQueryExpressionManager.java
deleted file mode 100644
index 1c61b8873f..0000000000
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/adhoc/AdhocQueryExpressionManager.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-package com.raytheon.uf.edex.registry.ebxml.services.query.adhoc;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.raytheon.uf.common.localization.LocalizationFile;
-import com.raytheon.uf.common.localization.PathManagerFactory;
-import com.raytheon.uf.common.registry.schemas.ebxml.util.EbxmlJaxbManager;
-import com.raytheon.uf.common.status.IUFStatusHandler;
-import com.raytheon.uf.common.status.UFStatus;
-
-/**
- *
- * This class manages the adhoc queries stored under
- * edex_static/base/ebxml/adhocQueries
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Feb 29, 2012 bphillip Initial creation
- * Nov 14, 2013 2552 bkowal EbxmlJaxbManager is now accessed via getInstance
- *
- *
- *
- * @author bphillip
- * @version 1.0
- */
-public class AdhocQueryExpressionManager {
-
- /** The logger */
- private static final transient IUFStatusHandler statusHandler = UFStatus
- .getHandler(AdhocQueryExpressionManager.class);
-
- /** The map of available adhocqueries */
- private Map expressionMap = new HashMap();
-
- /** The singleton instance */
- private static AdhocQueryExpressionManager instance;
-
- /**
- * Creates a new manager and initializes the prepared adhoc queries
- */
- private AdhocQueryExpressionManager() {
- loadQueries();
- }
-
- /**
- * Loads the predefined queries
- */
- private void loadQueries() {
- LocalizationFile[] files = PathManagerFactory.getPathManager()
- .listStaticFiles("ebxml/adhocQueries", new String[] { ".xml" },
- true, true);
- File[] fileList = new File[files.length];
- for (int i = 0; i < fileList.length; i++) {
- fileList[i] = files[i].getFile();
- }
-
- for (int i = 0; i < fileList.length; i++) {
-
- AdhocQueryExpression obj = null;
- try {
- obj = EbxmlJaxbManager
- .getInstance()
- .getJaxbManager()
- .unmarshalFromXmlFile(AdhocQueryExpression.class,
- fileList[i]);
- } catch (Exception e) {
- statusHandler.error("Error getting predefined adhoc queries.",
- e);
- }
- this.expressionMap.put(obj.getQueryName(), obj);
- }
- }
-
- /**
- * Gets the singleton instance
- *
- * @return The singleton instance
- */
- public static AdhocQueryExpressionManager getInstance() {
- if (instance == null) {
- instance = new AdhocQueryExpressionManager();
- }
- return instance;
- }
-
- /**
- * Retrieves the adhoc query with the given name
- *
- * @param name
- * The name of the adhoc query to get
- * @return The adhoc query, null if not present
- */
- public AdhocQueryExpression getAdhocQueryExpression(String name) {
- return expressionMap.get(name);
- }
-}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java
index 29e1716f40..743004d5e5 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java
@@ -64,6 +64,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* Jun 24, 2013 2106 djohnson Requires a transaction to be open, will not create one.
* 10/8/2013 1682 bphillip Refactored querying
* 11/20/2013 2534 bphillip Changed call to getNotificationDestinations which is not in a utility class
+ * 01/21/2014 2613 bphillip Modifications to account for changed method signatures in RegistryNotificationManager
*
*
*
@@ -135,8 +136,15 @@ public class GetNotification extends RegistryQueryPlugin {
List objectsOfInterest = notificationManager
.getObjectsOfInterest(subscription);
- List eventsOfInterest = notificationManager
- .getEventsOfInterest(startTime, null, objectsOfInterest);
+ List eventsOfInterest = null;
+ try {
+ eventsOfInterest = notificationManager.getEventsOfInterest(
+ subscription, destinations.get(0).getDestination(),
+ startTime, null, objectsOfInterest);
+ } catch (EbxmlRegistryException e1) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error getting events!", e1);
+ }
try {
return createResponse(Arrays.asList(notificationManager
.getNotification(subscription, "Test Address",
diff --git a/javaUtilities/com.raytheon.uf.logsrv/META-INF/MANIFEST.MF b/javaUtilities/com.raytheon.uf.logsrv/META-INF/MANIFEST.MF
index b48d5ea02d..1cfe58ea05 100644
--- a/javaUtilities/com.raytheon.uf.logsrv/META-INF/MANIFEST.MF
+++ b/javaUtilities/com.raytheon.uf.logsrv/META-INF/MANIFEST.MF
@@ -1,9 +1,10 @@
Manifest-Version: 1.0
+Main-Class: com.raytheon.uf.logsrv.LogService
+Class-Path: logback-core-1.0.13.jar logback-classic-1.0.13.jar derby.jar mail.jar slf4j-api-1.7.5.jar quartz-1.8.6.jar commons-lang-2.3.jar
Bundle-ManifestVersion: 2
Bundle-Name: Logsrv
Bundle-SymbolicName: com.raytheon.uf.logsrv
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: com.raytheon.uf.logsrv.Activator
+Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/javaUtilities/com.raytheon.uf.logsrv/README.txt b/javaUtilities/com.raytheon.uf.logsrv/README.txt
new file mode 100644
index 0000000000..cc6f03b682
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.logsrv/README.txt
@@ -0,0 +1,149 @@
+##
+# 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.
+##
+
+
+
+Build instructions
+-----------------------
+In Eclipse run the build.xml by right clicking on the build.xml file and
+running it. That will produce a tar.gz with everything you need inside of it.
+
+
+Install instructions
+-----------------------
+Place the tar.gz file where you would like to install it, and run tar -xvf on
+the tar.gz file. Next go into the conf directory and modify config.xml to
+ the best settings for your cluster. Then open receiver.xml and go to the
+ bottom of the file. Edit the address to the name of the machine where
+ you are installing the log service, and pick a port if you are not happy with
+ the default. Once your config settings are right, run the bin/logsrv.sh
+ script to start the log service.
+
+
+ Setup of Client Processes
+ ------------------
+ At this point the log service is running but nothing is reporting to it. You
+ can configure any Java process using logback to report to it, but with the
+ current version that is just EDEX and CAVE. (Note technically you could
+ configure AlertViz to report to the service too, but that is fairly pointless).
+
+ To configure EDEX or CAVE to report to the log service, find the logback
+ config files for those applications. In EDEX they can typically be found at
+ /awips2/edex/conf. If you are not sure which logback file corresponds to
+ which JVM, look at the shell scripts in /awips2/edex/etc. If not explicitly
+ stated in their corresponding shell script, then the JVMs use the logback file
+ specified in default.sh.
+
+ In CAVE the logback config files can typically be found at
+ /awips2/cave/plugins/com.raytheon.uf.viz.core_${VERSION}.
+
+ Once found, use a text editor to open the logback config file corresponding
+ to the process you wish to report to the log service. You need to add two
+ things to the file, an appender and an appender-ref.
+
+ Add an appender like the example below in the appenders section (generally
+ towards the top of the file):
+
+
+ false
+ 5477
+ dev33.oma.us.ray.com
+
+ WARN
+
+
+
+ Replace the remoteHost address with the machine where you installed the
+ log service. Note that you must have a network route between the two machines
+ as it uses a socket to report the errors. Replace the port with the port you chose
+ in receiver.xml. You can alter the threshold if need be.
+
+ Next you must add your new remoteLogSrv appender to a logger. Note that a
+ logger can have multiple appenders, but any logger with additivity="false" will
+ not go through the root log. For EDEX, the recommendation is to add
+ it to the root logger. For example:
+
+
+
+
+
+
+
+ For CAVE, the recommendation is to add it to the CaveLogger. For example:
+
+
+
+
+
+
+
+Once you save the modified logback config file, you're done. Logback will
+automatically pick up a changed configuration within a minute or two, and
+the Java processes you configured will start appending to the socket.
+
+
+How it works
+--------------
+The log service is listening on the socket and will store the messages in a
+derby database on the filesystem, and then at the scheduled time it will
+attempt to analyze and consolidate the errors based on the information it has
+available. Then it will send an email using the configuration, reporting in an order
+of what errors it thinks are most significant.
+
+Note that it does not matter if the Java processes have the socket appender
+configured but the log service is not running. They will try to connect but then
+go back to normal logging. If the log service is running, they will resume sending
+log messages through the socket. Therefore, it does not hurt to have
+everything configured even if the log service or the reporting processes are not
+running.
+
+
+Impacts
+-------------
+The log service has very little overhead. The appenders, as configured, will be just
+another appender so the "normal" logs will continue to function as usual. With the
+threshold configuration, only WARN and ERROR messages are sent to the log
+service. All of this is done asynchronously so the processing threads that logged
+a message will not wait for the message to get sent. Messages sent to the
+service are sent over TCP and are buffered. As long as the network path to
+the log service is not slower than the rate at which the WARN or ERROR messages
+are produced, you should not notice any slowdowns or impacts due to processes
+reporting to the log service.
+
+Of course, the less an application produces WARN or ERROR messages, the less
+overhead. And the reporting can always be disabled by undoing the modifications
+to logback configuration files specified in the setup instructions. Again, if you
+disable reporting to the log service, you do not need to restart the Java process.
+
+
+More information
+--------------
+For more information about the socket appender, please see
+http://logback.qos.ch/manual/appenders.html#SocketAppender
+
+For more information about logback configuration files, please see
+http://logback.qos.ch/manual/configuration.html#syntax
+
+
+Bugs and/or Improvements
+--------------
+If you encounter a bug with the log service or have an idea of how it can be
+improved, send an email to nathan.jensen@raytheon.com.
+
diff --git a/javaUtilities/com.raytheon.uf.logsrv/build.xml b/javaUtilities/com.raytheon.uf.logsrv/build.xml
new file mode 100644
index 0000000000..228ec71040
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.logsrv/build.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javaUtilities/com.raytheon.uf.logsrv/conf/config.xml b/javaUtilities/com.raytheon.uf.logsrv/conf/config.xml
new file mode 100644
index 0000000000..c7f04fdab9
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.logsrv/conf/config.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ ec-oma
+
+
+ /common/njensen/logsrv/
+
+
+ Nathan.Jensen@raytheon.com
+ mk2-msg10.raymail.ray.com
+ 143
+
+
+ awipsctl@list.app.ray.com, awipstest@list.app.ray.com, david_j_hladky@raytheon.com
+
+
+ 00:45
+
+
\ No newline at end of file
diff --git a/javaUtilities/com.raytheon.uf.logsrv/receiver.xml b/javaUtilities/com.raytheon.uf.logsrv/conf/receiver.xml
similarity index 93%
rename from javaUtilities/com.raytheon.uf.logsrv/receiver.xml
rename to javaUtilities/com.raytheon.uf.logsrv/conf/receiver.xml
index 478777db3c..985a8152e9 100644
--- a/javaUtilities/com.raytheon.uf.logsrv/receiver.xml
+++ b/javaUtilities/com.raytheon.uf.logsrv/conf/receiver.xml
@@ -5,8 +5,8 @@
- /home/njensen/logs/logService-internal-%d{yyyyMMdd}.log
- 30
+ ${logSrvLogs}/logs/logService-internal-%d{yyyyMMdd}.log
+ 7
%-5p %d [%t] %c{0}: %m%n
diff --git a/javaUtilities/com.raytheon.uf.logsrv/config.xml b/javaUtilities/com.raytheon.uf.logsrv/config.xml
deleted file mode 100644
index d647afea32..0000000000
--- a/javaUtilities/com.raytheon.uf.logsrv/config.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- ec-oma
- /awips2/edex/data/utility/nate
- Nathan.Jensen@raytheon.com
- mk2-msg10.raymail.ray.com
- 143
- awipsctl@list.app.ray.com, awipstest@list.app.ray.com, david_j_hladky@raytheon.com
-
- 00:45
- shefThreadPool
-
\ No newline at end of file
diff --git a/javaUtilities/com.raytheon.uf.logsrv/logsrv.sh b/javaUtilities/com.raytheon.uf.logsrv/logsrv.sh
new file mode 100644
index 0000000000..6e3cbf4a25
--- /dev/null
+++ b/javaUtilities/com.raytheon.uf.logsrv/logsrv.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+##
+# 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.
+##
+
+
+path_to_script=`readlink -f $0`
+binDir=$(dirname $path_to_script)
+logSrvDir=$(dirname $binDir)
+export logSrvConf=$logSrvDir/conf/
+export logSrvLogs=$logSrvDir/logs/
+
+java -jar ${logSrvDir}/lib/com.raytheon.uf.logsrv.jar
\ No newline at end of file
diff --git a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/LogService.java b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/LogService.java
index d36372a456..b68609bf77 100644
--- a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/LogService.java
+++ b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/LogService.java
@@ -58,6 +58,8 @@ public class LogService {
private static final String SERVICE_CONFIG = "config.xml";
+ private static final String ENV_CONF_DIR = "logSrvConf";
+
private static final Logger logger = LoggerFactory
.getLogger("InternalLogger");
@@ -67,11 +69,17 @@ public class LogService {
*/
public static void main(String[] args) throws Exception {
logger.info("Starting log analytics service");
+ String confDir = System.getenv(ENV_CONF_DIR);
+ if (confDir == null) {
+ throw new LogServiceException("Environment variable "
+ + ENV_CONF_DIR
+ + " is not set! Unable to find configuration!");
+ }
JAXBContext context = JAXBContext.newInstance(LogSrvConfig.class);
Unmarshaller m = context.createUnmarshaller();
- LogSrvConfig config = (LogSrvConfig) m.unmarshal(new File(
- SERVICE_CONFIG));
+ LogSrvConfig config = (LogSrvConfig) m.unmarshal(new File(confDir
+ + SERVICE_CONFIG));
config.validate();
DerbyDao.getInstance().setConfig(config);
logger.info("Logging events from " + config.getClusterName());
@@ -81,7 +89,7 @@ public class LogService {
lc.reset();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
- configurator.doConfigure(LOGBACK_CONFIG);
+ configurator.doConfigure(confDir + LOGBACK_CONFIG);
logger.info("Scheduling report generation");
JobScheduler.scheduleJobs(config);
diff --git a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/config/LogSrvConfig.java b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/config/LogSrvConfig.java
index ed1d540533..3e4bffca58 100644
--- a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/config/LogSrvConfig.java
+++ b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/config/LogSrvConfig.java
@@ -68,9 +68,6 @@ public class LogSrvConfig {
@XmlElement
private String timeToSend;
- @XmlElement
- private String ignoreThreads;
-
public String getFromAddress() {
return fromAddress;
}
@@ -127,14 +124,6 @@ public class LogSrvConfig {
this.databaseDir = databaseDir;
}
- public String getIgnoreThreads() {
- return ignoreThreads;
- }
-
- public void setIgnoreThreads(String ignoreThreads) {
- this.ignoreThreads = ignoreThreads;
- }
-
/**
* Validates that the config has every value set.
*/
diff --git a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/derby/DerbyAppender.java b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/derby/DerbyAppender.java
index 1b955c9b2d..0108340465 100644
--- a/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/derby/DerbyAppender.java
+++ b/javaUtilities/com.raytheon.uf.logsrv/src/com/raytheon/uf/logsrv/derby/DerbyAppender.java
@@ -47,15 +47,9 @@ public class DerbyAppender extends AppenderBase {
private DerbyDao dao;
- private String[] ignoreThreads;
-
public DerbyAppender() {
super();
dao = DerbyDao.getInstance();
- String ignore = dao.getConfig().getIgnoreThreads();
- if (ignore != null) {
- ignoreThreads = ignore.split(",");
- }
}
@Override
@@ -78,13 +72,6 @@ public class DerbyAppender extends AppenderBase {
* @return
*/
private boolean shouldStoreMsg(ILoggingEvent event) {
- if (ignoreThreads != null) {
- for (String ignore : ignoreThreads) {
- if (event.getThreadName().startsWith(ignore)) {
- return false;
- }
- }
- }
return true;
}
}
diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java
index 1792689883..95c1a6ee9f 100644
--- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java
+++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java
@@ -30,7 +30,6 @@ import java.io.File;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
@@ -89,6 +88,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Sept 25, 2013 1797 dhladky separated time from gridded time
* Oct 21, 2013 2292 mpduff Implement multiple data types.
* Dec 02, 2013 2545 mpduff Get data by network.
+ * Jan 23, 2014 2636 mpduff Removed TimeWindow individual bin code.
*
*
* @author djohnson
@@ -583,59 +583,6 @@ public class BandwidthServiceIntTest
assertEquals(
"Expected there to be two time windows for this subscription over 2 days",
2, subscriptionOneTimeWindows.size());
- final TimeWindowData firstTimeWindow = subscriptionOneTimeWindows
- .get(0);
- final TimeWindowData secondTimeWindow = subscriptionOneTimeWindows
- .get(1);
-
- final List firstWindowBinStartTimes = firstTimeWindow
- .getBinStartTimes();
- final List secondWindowBinStartTimes = secondTimeWindow
- .getBinStartTimes();
-
- assertEquals("Incorrect number of bin start times found.", 2,
- firstWindowBinStartTimes.size());
- assertEquals("Incorrect number of bin start times found.", 2,
- secondWindowBinStartTimes.size());
-
- final List subscriptionRetrievals = bandwidthDao
- .getSubscriptionRetrievals(subscription.getProvider(),
- subscription.getDataSetName());
-
- final Iterator iter = subscriptionRetrievals
- .iterator();
-
- // First retrieval window
- long expectedBinStartTime = iter.next().getStartTime()
- .getTimeInMillis();
-
- assertEquals(
- "Incorrect first bin start time in the first time window.",
- expectedBinStartTime, firstWindowBinStartTimes.get(0)
- .longValue());
-
- expectedBinStartTime += (TimeUtil.MILLIS_PER_MINUTE * 3);
- assertEquals(
- "Incorrect second bin start time in the first time window.",
- expectedBinStartTime, firstWindowBinStartTimes.get(1)
- .longValue());
-
- // Second retrieval window
- expectedBinStartTime = iter.next().getStartTime().getTimeInMillis();
-
- assertEquals(
- "Incorrect first bin start time in the second time window.",
- expectedBinStartTime, secondWindowBinStartTimes.get(0)
- .longValue());
-
- // The middle bucket was already reserved, so we went ahead six minutes
- // and used that bucket
- expectedBinStartTime += (TimeUtil.MILLIS_PER_MINUTE * 6);
-
- assertEquals(
- "Incorrect second bin start time in the second time window.",
- expectedBinStartTime, secondWindowBinStartTimes.get(1)
- .longValue());
}
@Test
diff --git a/tests/manual/com/raytheon/uf/common/comm/HttpProxiedValidClientCredentialsTest.java b/tests/manual/com/raytheon/uf/common/comm/HttpProxiedValidClientCredentialsTest.java
index a4ecb9836a..afa38cf84a 100644
--- a/tests/manual/com/raytheon/uf/common/comm/HttpProxiedValidClientCredentialsTest.java
+++ b/tests/manual/com/raytheon/uf/common/comm/HttpProxiedValidClientCredentialsTest.java
@@ -43,13 +43,13 @@ import com.raytheon.uf.common.datadelivery.registry.Connection;
import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.Encryption;
+import com.raytheon.uf.common.datadelivery.registry.Provider;
import com.raytheon.uf.common.datadelivery.registry.Encryption.Algorithim;
import com.raytheon.uf.common.datadelivery.registry.Encryption.Padding;
+import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.EnvelopeUtils;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Projection;
-import com.raytheon.uf.common.datadelivery.registry.Provider;
-import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/harvester/config/HarvesterConfigFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/harvester/config/HarvesterConfigFixture.java
index 394ea6c4d1..d29988a95a 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/harvester/config/HarvesterConfigFixture.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/harvester/config/HarvesterConfigFixture.java
@@ -28,8 +28,8 @@ import com.raytheon.uf.common.datadelivery.harvester.HarvesterConfig;
import com.raytheon.uf.common.datadelivery.registry.Collection;
import com.raytheon.uf.common.datadelivery.registry.Connection;
import com.raytheon.uf.common.datadelivery.registry.Projection;
-import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.datadelivery.registry.Provider;
+import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.AbstractFixture;
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/GriddedDataSetMetaDataTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/GriddedDataSetMetaDataTest.java
index a7dc4d1db9..c4cd889ce7 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/GriddedDataSetMetaDataTest.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/GriddedDataSetMetaDataTest.java
@@ -23,6 +23,7 @@ import org.junit.Ignore;
import org.junit.Test;
+
/**
* Test {@link GriddedDataSetMetaData}.
*
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java
index 9e81e01196..e646c39ad9 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java
@@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry;
import java.util.Random;
+
/**
* Fixture for {@link PendingSharedSubscription} objects.
*
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java
index a89e719e61..4983b4cfd0 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
+
/**
* Test {@link PendingSubscription}.
*
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java
index d39a13f29e..7e8b5954ec 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.common.datadelivery.registry;
+
/**
* Fixture for {@link SharedSubscription} objects.
*
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java
index 4789beefaa..c0a3f8cf3f 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java
@@ -25,8 +25,10 @@ import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
+import java.util.TimeZone;
import javax.xml.bind.JAXBException;
@@ -54,8 +56,9 @@ import com.raytheon.uf.common.time.util.TimeUtilTest;
* Jan 11, 2013 1453 djohnson Add test for active period crossing year boundary.
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
* May 15, 2013 1040 mpduff Office Id now a set.
- * Oct 21, 2013 2292 mpduff Implement multiple data types
- * Jan 14, 2014 2459 mpduff Change Subscription status code
+ * Oct 21, 2013 2292 mpduff Implement multiple data types.
+ * Jan 14, 2014 2459 mpduff Change Subscription status code.
+ * Jan 28, 2014 2636 mpduff Added testInWindow test method.
*
*
*
@@ -268,4 +271,149 @@ public class SiteSubscriptionTest {
System.out.println(new JAXBManager(SiteSubscription.class)
.marshalToXml(subscription));
}
+
+ @Test
+ public void testGetStatusForOneDayWindow() {
+ final Date tomorrow = new Date(TimeUtil.currentTimeMillis()
+ + (TimeUtil.MILLIS_PER_DAY));
+ final Date today = new Date(TimeUtil.currentTimeMillis());
+
+ Subscription subscription = new SubscriptionBuilder()
+ .withActivePeriodStart(today).withActivePeriodEnd(tomorrow)
+ .build();
+
+ assertThat(subscription.getStatus(),
+ is(equalTo(SubscriptionStatus.ACTIVE)));
+
+ }
+
+ @Test
+ public void testInWindowMethod() {
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Calendar startCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ Calendar endCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ Calendar checkCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+
+ startCal.set(Calendar.MONTH, Calendar.DECEMBER);
+ startCal.set(Calendar.DAY_OF_MONTH, 20);
+ endCal.set(Calendar.MONTH, Calendar.JANUARY);
+ endCal.set(Calendar.DAY_OF_MONTH, 10);
+
+ // Active window crosses year boundary
+ // First check Jan 1
+ checkCal.set(Calendar.MONTH, Calendar.JANUARY);
+ checkCal.set(Calendar.DAY_OF_MONTH, 1);
+ startCal = TimeUtil.minCalendarFields(startCal, Calendar.HOUR_OF_DAY,
+ Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND);
+ endCal = TimeUtil.minCalendarFields(endCal, Calendar.HOUR_OF_DAY,
+ Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND);
+ checkCal = TimeUtil.minCalendarFields(checkCal, Calendar.HOUR_OF_DAY,
+ Calendar.MINUTE, Calendar.SECOND, Calendar.MILLISECOND);
+
+ Subscription subscription = new SubscriptionBuilder()
+ .withActivePeriodStart(startCal.getTime())
+ .withActivePeriodEnd(endCal.getTime()).build();
+
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.TRUE)));
+
+ // Next check Starting Day
+ checkCal.set(Calendar.MONTH, Calendar.DECEMBER);
+ checkCal.set(Calendar.DAY_OF_MONTH, 20);
+
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.TRUE)));
+
+ // Next check Ending Day - Should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.JANUARY);
+ checkCal.set(Calendar.DAY_OF_MONTH, 10);
+
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+
+ // Next check before starting Day - Should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.OCTOBER);
+ checkCal.set(Calendar.DAY_OF_MONTH, 10);
+
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+
+ // Next check after ending Day - Should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.MARCH);
+ checkCal.set(Calendar.DAY_OF_MONTH, 10);
+
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+
+ // Change window to not be over year boundary
+ startCal.set(Calendar.MONTH, Calendar.MARCH);
+ startCal.set(Calendar.DAY_OF_MONTH, 1);
+ endCal.set(Calendar.MONTH, Calendar.OCTOBER);
+ endCal.set(Calendar.DAY_OF_MONTH, 1);
+
+ subscription = new SubscriptionBuilder()
+ .withActivePeriodStart(startCal.getTime())
+ .withActivePeriodEnd(endCal.getTime()).build();
+
+ // First check day in the window
+ checkCal.set(Calendar.MONTH, Calendar.JUNE);
+ checkCal.set(Calendar.DAY_OF_MONTH, 10);
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.TRUE)));
+
+ // Check start day
+ checkCal.set(Calendar.MONTH, Calendar.MARCH);
+ checkCal.set(Calendar.DAY_OF_MONTH, 1);
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.TRUE)));
+
+ // Check end day - should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.OCTOBER);
+ checkCal.set(Calendar.DAY_OF_MONTH, 1);
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+
+ // Check before start day - should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.FEBRUARY);
+ checkCal.set(Calendar.DAY_OF_MONTH, 1);
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+
+ // Check after end day - should be outside window
+ checkCal.set(Calendar.MONTH, Calendar.NOVEMBER);
+ checkCal.set(Calendar.DAY_OF_MONTH, 1);
+ System.out.println("\nStartCal: " + sdf.format(startCal.getTime()));
+ System.out.println("EndCal: " + sdf.format(endCal.getTime()));
+ System.out.println("CheckCal: " + sdf.format(checkCal.getTime()));
+ assertThat(subscription.inActivePeriodWindow(checkCal),
+ is(equalTo(Boolean.FALSE)));
+ }
}
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQueryTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQueryTest.java
index e86ad7a532..ae32324151 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQueryTest.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/ebxml/DataSetWithFiltersQueryTest.java
@@ -29,11 +29,11 @@ import org.geotools.geometry.jts.ReferencedEnvelope;
import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
-import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
+import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.gridcoverage.Corner;
import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage;
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryDataSetHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryDataSetHandler.java
index 766e04e140..f660abc1d9 100644
--- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryDataSetHandler.java
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryDataSetHandler.java
@@ -25,8 +25,8 @@ import java.util.Set;
import org.geotools.geometry.jts.ReferencedEnvelope;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetWithFiltersQuery;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
diff --git a/tests/unit/com/raytheon/uf/common/registry/ebxml/FactoryRegistryHandlerTest.java b/tests/unit/com/raytheon/uf/common/registry/ebxml/FactoryRegistryHandlerTest.java
index 0365b3a650..09d977ac3f 100644
--- a/tests/unit/com/raytheon/uf/common/registry/ebxml/FactoryRegistryHandlerTest.java
+++ b/tests/unit/com/raytheon/uf/common/registry/ebxml/FactoryRegistryHandlerTest.java
@@ -79,7 +79,7 @@ public class FactoryRegistryHandlerTest {
RegistryErrorMessage.DATABASE_ERROR_MESSAGE);
private static final IRegistryEncoder encoderStrategy = RegistryEncoders
- .ofType(Type.DYNAMIC_SERIALIZE);
+ .ofType(Type.JAXB);
private static final FactoryRegistryHandler registryHandler = new FactoryRegistryHandler();
diff --git a/tests/unit/com/raytheon/uf/common/registry/ebxml/RegistryUtilTest.java b/tests/unit/com/raytheon/uf/common/registry/ebxml/RegistryUtilTest.java
index d6f8023e5c..3266d32201 100644
--- a/tests/unit/com/raytheon/uf/common/registry/ebxml/RegistryUtilTest.java
+++ b/tests/unit/com/raytheon/uf/common/registry/ebxml/RegistryUtilTest.java
@@ -62,7 +62,7 @@ public class RegistryUtilTest {
RegistryObjectType type = RegistryUtil
.newRegistryObject(registryObject,
- RegistryEncoders.ofType(Type.DYNAMIC_SERIALIZE));
+ RegistryEncoders.ofType(Type.JAXB));
SlotType slotToCheck = null;
for (SlotType slot : type.getSlot()) {
diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapterTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapterTest.java
index bf2d95e777..051f3ef6e6 100644
--- a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapterTest.java
+++ b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthGraphDataAdapterTest.java
@@ -34,7 +34,6 @@ import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
-import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
/**
* Test class for {@link BandwidthGraphdataAdapter}.
@@ -45,7 +44,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Nov 25, 2013 mpduff Initial creation
+ * Nov 25, 2013 mpduff Initial creation.
+ * Jan 25, 2014 2636 mpduff Removed test that has since become invalid.
*
*
*
@@ -59,8 +59,6 @@ public class BandwidthGraphDataAdapterTest {
private static final RetrievalManager retrievalManagerMock = mock(RetrievalManager.class);
- private static final RetrievalPlan retrievalPlan = new RetrievalPlan();
-
private static final SortedSet bucketSet = new TreeSet();
private static final BandwidthGraphDataAdapter adapter = new BandwidthGraphDataAdapter(
@@ -141,33 +139,4 @@ public class BandwidthGraphDataAdapterTest {
}
}
}
-
- @Test
- public void testOverfilledBucketsOverflowToLaterBuckets() {
- Iterator iter = bucketSet.iterator();
-
- // Get the first bucket and fill it 4.5 buckets worth
- BandwidthBucket bucket = iter.next();
- bucket.setCurrentSize((BUCKET_SIZE * 4) + (BUCKET_SIZE / 2));
-
- int idx = 0;
- SortedSet descriptions = adapter
- .toDescriptions(bucketSet);
-
- Iterator it = descriptions.iterator();
- while (it.hasNext()) {
- BandwidthBucketDescription bbd = it.next();
- if (idx <= 3) {
- assertTrue("First four buckets should be full",
- bbd.getUsedBytes() == bucket.getBucketSize());
- idx++;
- } else if (idx == 4) {
- assertTrue("Bucket should be half full",
- bbd.getUsedBytes() == bucket.getBucketSize() / 2);
- idx++;
- } else {
- assertTrue("Bucket should be empty", bbd.getUsedBytes() == 0);
- }
- }
- }
}
diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtilTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtilTest.java
index e06437442c..ad58d3dadf 100644
--- a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtilTest.java
+++ b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtilTest.java
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
@@ -43,6 +44,7 @@ import java.util.TreeSet;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import com.google.common.collect.Maps;
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthMap;
@@ -58,6 +60,7 @@ import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
+import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.time.util.TimeUtilTest;
import com.raytheon.uf.edex.datadelivery.bandwidth.InMemoryBandwidthBucketDao;
@@ -86,6 +89,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
* Sep 25, 2013 1797 dhladky separated time and gridded time
* Jan 07, 2014 2636 mpduff Removed dataset availability offset calculator (not used).
* Jan 08, 2014 2615 bgonzale Updated test.
+ * Jan 26, 2014 2709 bgonzale Added tests for year scheduling boundary.
*
*
*
@@ -97,10 +101,9 @@ public class BandwidthDaoUtilTest {
private final IBandwidthDao mockDao = mock(IBandwidthDao.class);
- private final RetrievalManager retrievalManager = mock(RetrievalManager.class);
+ private RetrievalManager retrievalManager;
- private final BandwidthDaoUtil bandwidthDaoUtil = new BandwidthDaoUtil(
- mockDao, retrievalManager);
+ private BandwidthDaoUtil bandwidthDaoUtil;
private BandwidthMap map;
@@ -133,6 +136,9 @@ public class BandwidthDaoUtilTest {
Map retrievalPlans = Maps
.newEnumMap(Network.class);
retrievalPlans.put(Network.OPSNET, plan);
+ retrievalManager = Mockito.spy(new RetrievalManager(mockDao,
+ new Object()));
+ bandwidthDaoUtil = new BandwidthDaoUtil(mockDao, retrievalManager);
when(retrievalManager.getRetrievalPlans()).thenReturn(retrievalPlans);
// Just used to initialize the retrieval plans that are used on the mock
@@ -147,6 +153,142 @@ public class BandwidthDaoUtilTest {
public void tearDown() {
TimeUtilTest.resumeTime();
}
+
+ private Calendar createCal(int year, int dayOfYear) {
+ Calendar cal = TimeUtil.newCalendar();
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.DAY_OF_YEAR, dayOfYear);
+ return cal;
+ }
+
+ /*
+ *
+ */
+ private Subscription createOverYearBoundary(int planStart,
+ int planStartYear, int subStart, int subStartYear, int subEnd,
+ int subEndYear, int activeStart, int activeStartYear,
+ int activeEnd, int activeEndYear, int planDays) {
+ Calendar planStartDay = createCal(planStartYear, planStart);
+ Calendar subStartDay = createCal(subStartYear, subStart);
+ Calendar subEndDay = createCal(subEndYear, subEnd);
+ Calendar activeStartDay = createCal(activeStartYear, activeStart);
+ Calendar activeEndDay = createCal(activeEndYear, activeEnd);
+
+ // setup plan with specific start time for this test.
+ SimulatedTime.getSystemTime().setTime(planStartDay.getTimeInMillis());
+ map.getRoute(Network.OPSNET).setPlanDays(planDays);
+ retrievalManager.getPlan(Network.OPSNET).setMap(map);
+ // re-init plans with new simulated time
+ retrievalManager.initRetrievalPlans();
+ return new SubscriptionBuilder()
+ .withSubscriptionStart(subStartDay.getTime())
+ .withActivePeriodStart(activeStartDay.getTime())
+ .withActivePeriodEnd(activeEndDay.getTime())
+ .withSubscriptionEnd(subEndDay.getTime()).build();
+ }
+
+ @Test
+ public void testActivePeriodOverYearBoundary() {
+ int y1970 = 1970;
+ int y1971 = 1971;
+ int planStart = 364;
+ int subStart = 364;
+ int activeStart = 365;
+ int activeEnd = 2;
+ int subEnd = 3;
+ int planDays = 5;
+ Subscription subscription = createOverYearBoundary(planStart, y1970,
+ subStart, y1970, subEnd, y1971, activeStart, y1970, activeEnd,
+ y1971, planDays);
+ ((GriddedTime) subscription.getTime()).setCycleTimes(Arrays.asList(
+ Integer.valueOf(9), Integer.valueOf(0)));
+
+ TreeSet cycles = new TreeSet(
+ ((GriddedTime) subscription.getTime()).getCycleTimes());
+
+ SortedSet subscriptionTimes = bandwidthDaoUtil
+ .getRetrievalTimes(subscription, cycles);
+
+ List calendarDaysOfTheYear = createCalendarListForSpecifiedDaysOfTheYear(
+ Arrays.asList(365), y1970);
+ calendarDaysOfTheYear
+ .addAll(createCalendarListForSpecifiedDaysOfTheYear(
+ Arrays.asList(01), y1971));
+
+ verifySubscriptionTimesContainsCyclesForSpecifiedCalendarDays(
+ calendarDaysOfTheYear, cycles, subscriptionTimes);
+ }
+
+ @Test
+ public void testActivePeriodJustBeforeYearBoundary() {
+ int y1970 = 1970;
+ int y1971 = 1971;
+ int planStart = 362;
+ int subStart = 362;
+ int activeStart = 363;
+ int activeEnd = 365;
+ int subEnd = 2;
+ int planDays = 5;
+ Subscription subscription = createOverYearBoundary(planStart, y1970,
+ subStart, y1970, subEnd, y1971, activeStart, y1970, activeEnd,
+ y1971, planDays);
+ ((GriddedTime) subscription.getTime()).setCycleTimes(Arrays.asList(
+ Integer.valueOf(9), Integer.valueOf(0)));
+
+ TreeSet cycles = new TreeSet(
+ ((GriddedTime) subscription.getTime()).getCycleTimes());
+
+ SortedSet subscriptionTimes = bandwidthDaoUtil
+ .getRetrievalTimes(subscription, cycles);
+
+ List calendarDaysOfTheYear = createCalendarListForSpecifiedDaysOfTheYear(
+ Arrays.asList(363, 364), y1970);
+
+ verifySubscriptionTimesContainsCyclesForSpecifiedCalendarDays(
+ calendarDaysOfTheYear, cycles, subscriptionTimes);
+ }
+
+ @Test
+ public void testActivePeriodJustAfterYearBoundary() {
+ int y1970 = 1970;
+ int y1971 = 1971;
+ int planStart = 364;
+ int subStart = 364;
+ int activeStart = 1;
+ int activeEnd = 3;
+ int subEnd = 4;
+ int planDays = 6;
+ Subscription subscription = createOverYearBoundary(planStart, y1970,
+ subStart, y1970, subEnd, y1971, activeStart, y1970, activeEnd,
+ y1971, planDays);
+ ((GriddedTime) subscription.getTime()).setCycleTimes(Arrays.asList(
+ Integer.valueOf(9), Integer.valueOf(0)));
+
+ TreeSet cycles = new TreeSet(
+ ((GriddedTime) subscription.getTime()).getCycleTimes());
+
+ SortedSet subscriptionTimes = bandwidthDaoUtil
+ .getRetrievalTimes(subscription, cycles);
+
+ List calendarDaysOfTheYear = createCalendarListForSpecifiedDaysOfTheYear(
+ Arrays.asList(1, 2), y1971);
+
+ verifySubscriptionTimesContainsCyclesForSpecifiedCalendarDays(
+ calendarDaysOfTheYear, cycles, subscriptionTimes);
+ }
+
+ private List createCalendarListForSpecifiedDaysOfTheYear(
+ Collection daysOfTheYear, int year) {
+ List calendarList = new ArrayList(
+ daysOfTheYear.size());
+ for (int dayOfTheYear : daysOfTheYear) {
+ Calendar cal = TimeUtil.newCalendar();
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.DAY_OF_YEAR, dayOfTheYear);
+ calendarList.add(cal);
+ }
+ return calendarList;
+ }
@Test
public void testGetRetrievalTimesReturnsBaseReferenceTimesInPlanWindow() {
@@ -165,7 +307,7 @@ public class BandwidthDaoUtilTest {
SortedSet subscriptionTimes = bandwidthDaoUtil
.getRetrievalTimes(subscription, cycles);
- final List daysOfTheYear = Arrays.asList(3, 4);
+ final List daysOfTheYear = Arrays.asList(3);
verifySubscriptionTimesContainsCyclesForSpecifiedDays(daysOfTheYear,
cycles, subscriptionTimes);
}
@@ -257,10 +399,15 @@ public class BandwidthDaoUtilTest {
.getRetrievalTimes(subscription, interval);
// Expected size is two per hour (0 and 30 minutes), for every hour,
- // over the retrieval plan days (2), plus 1 because the retrieval plan
- // ends on a 0 minute time
- final int expectedSize = TimeUtil.HOURS_PER_DAY * plan.getPlanDays()
- * 2 + 1;
+ // over the retrieval plan days (2), minus the hours for the last day
+ // because active period is exclusive of the last day (ending hour
+ // constraint for the last day is 00Z)
+ Calendar activeEnd = (Calendar) plan.getPlanEnd().clone();
+ activeEnd = TimeUtil.minCalendarFields(activeEnd, Calendar.MILLISECOND,
+ Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY);
+ long subPeriodInHours = (activeEnd.getTimeInMillis() - plan
+ .getPlanStart().getTimeInMillis()) / TimeUtil.MILLIS_PER_HOUR;
+ final int expectedSize = (int) (subPeriodInHours * 2);
assertThat(subscriptionTimes, hasSize(expectedSize));
// Make sure we have the expected number of 0 and 30 minute scheduled
@@ -277,7 +424,7 @@ public class BandwidthDaoUtilTest {
}
final int halfTheTimes = subscriptionTimes.size() / 2;
- assertThat(numberOfZeroMinuteTimes, is(equalTo(halfTheTimes + 1)));
+ assertThat(numberOfZeroMinuteTimes, is(equalTo(halfTheTimes)));
assertThat(numberOfThirtyMinuteTimes, is(equalTo(halfTheTimes)));
// Would be nice to verify the days and hours, but the cycle based tests
@@ -311,6 +458,44 @@ public class BandwidthDaoUtilTest {
}
}
+ /**
+ * Verifies the subscription times contains the cycles for the specified
+ * days.
+ *
+ * @param daysOfTheYear
+ * @param cycles
+ * @param subscriptionTimes
+ */
+ private void verifySubscriptionTimesContainsCyclesForSpecifiedCalendarDays(
+ Collection daysOfTheYear, Collection cycles,
+ SortedSet subscriptionTimes) {
+ boolean success = true;
+ StringBuilder sb = new StringBuilder(
+ "Expected to find retrieval times: ");
+ int countOfTimes = 0;
+
+ for (Calendar dayOfTheYear : daysOfTheYear) {
+ for (Integer cycle : cycles) {
+ Calendar cal = (Calendar) dayOfTheYear.clone();
+ TimeUtil.minCalendarFields(cal, Calendar.MILLISECOND,
+ Calendar.SECOND, Calendar.MINUTE);
+ cal.set(Calendar.HOUR_OF_DAY, cycle);
+ success = success && subscriptionTimes.contains(cal);
+ ++countOfTimes;
+ sb.append(BandwidthUtil.format(cal)).append(
+ String.format(" %1$tZ ", cal));
+ }
+ }
+ sb.append("\nIn: ");
+ for (Calendar subTime : subscriptionTimes) {
+ sb.append(BandwidthUtil.format(subTime)).append(
+ String.format(" %1$tZ ", subTime));
+ }
+ assertTrue(sb.toString(), success);
+ assertTrue(sb.toString(),
+ countOfTimes == subscriptionTimes.size());
+ }
+
/**
* Verifies the subscription times do not contain the cycles for the
* specified days.
diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserNCOMTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserNCOMTest.java
index d10c149321..f33c9c05cd 100644
--- a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserNCOMTest.java
+++ b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserNCOMTest.java
@@ -41,8 +41,8 @@ import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.Projection;
-import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.datadelivery.registry.Provider;
+import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserRAPTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserRAPTest.java
index ff97e807f7..d6c2831407 100644
--- a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserRAPTest.java
+++ b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParserRAPTest.java
@@ -42,8 +42,8 @@ import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.Projection;
-import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.datadelivery.registry.Provider;
+import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java
index 83631c5501..69907afd65 100644
--- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java
+++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/RuleXMLTest.java
@@ -29,8 +29,8 @@ import org.junit.Before;
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.SiteSubscription;
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.units.DataSizeUnit;
import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions;
import com.raytheon.uf.viz.datadelivery.system.Operator;