Merge branch 'omaha_14.2.1' into development
Conflicts: cave/com.raytheon.uf.viz.application/src/com/raytheon/uf/viz/application/VizApplication.java Former-commit-id:14ba3b29f4
[formerly1738185503
] [formerly1aea63a1f6
[formerly d1fb8bcf1780b94bf23ce60dc4a6e0a10b37fe45]] Former-commit-id:1aea63a1f6
Former-commit-id:1fd5b2255f
This commit is contained in:
commit
d9cd003a5a
117 changed files with 2302 additions and 1096 deletions
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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");
|
||||
}
|
||||
}) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,5 +106,8 @@
|
|||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.core.drawables.ext.GeneralCanvasRenderingExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.uf.viz.core.drawables.ext.colormap.GeneralColormapShadedShapeExtension">
|
||||
</graphicsExtension>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 23, 2014 2363 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GeneralColormapShadedShapeExtension extends
|
||||
GraphicsExtension<IGraphicsTarget> implements
|
||||
IColormapShadedShapeExtension {
|
||||
|
||||
@Override
|
||||
public GeneralColormapShadedShape createColormapShadedShape(
|
||||
GeneralGridGeometry targetGeometry, boolean tesselate) {
|
||||
return new GeneralColormapShadedShape(targetGeometry, tesselate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadedShape createShadedShape(IColormapShadedShape baseShape,
|
||||
Map<Object, RGB> colors) {
|
||||
GeneralColormapShadedShape generalShape = (GeneralColormapShadedShape) baseShape;
|
||||
return generalShape.generateShape(target, colors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawColormapShadedShape(IColormapShadedShape shape,
|
||||
Map<Object, RGB> 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<AddPair> addPairs = new ArrayList<AddPair>();
|
||||
|
||||
private Map<Object, RGB> 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<Object, RGB> colors) {
|
||||
if (!colors.equals(lastColors)) {
|
||||
if (lastShape != null) {
|
||||
lastShape.dispose();
|
||||
}
|
||||
lastShape = generateShape(target, colors);
|
||||
lastColors = new HashMap<Object, RGB>(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<Object, RGB> 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<AddPair>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
lastShape.reset();
|
||||
lastColors.clear();
|
||||
addPairs = new ArrayList<AddPair>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Object> getColorKeys() {
|
||||
Set<Object> keys = new HashSet<Object>(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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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 <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) {
|
||||
return reflections.getSubTypesOf(type);
|
||||
if (reflections == null) {
|
||||
return Collections.emptySet();
|
||||
} else {
|
||||
return reflections.getSubTypesOf(type);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Class<?>> getSubTypesOf(Class<?>... types) {
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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");
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -200,8 +200,9 @@
|
|||
<logger name="com.raytheon">
|
||||
<level value="INFO"/>
|
||||
</logger>
|
||||
<logger name="com.raytheon.edex.plugin.shef">
|
||||
<logger name="com.raytheon.edex.plugin.shef" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="ShefLog" />
|
||||
</logger>
|
||||
<logger name="com.raytheon.edex.services.ArchiveSrv">
|
||||
<level value="WARN"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -436,7 +438,7 @@ public class MapManager {
|
|||
List<Coordinate> values = new ArrayList<Coordinate>();
|
||||
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<String, ReferenceData> tempData = new HashMap<String, ReferenceData>();
|
||||
Map<String, Geometry> tempData = new HashMap<String, Geometry>();
|
||||
while (shapeSource.hasNext()) {
|
||||
SimpleFeature f = shapeSource.next();
|
||||
Map<String, Object> 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<String, Geometry> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
#
|
||||
#
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,14 +59,16 @@ public class TimeWindowData implements Comparable<TimeWindowData> {
|
|||
@DynamicSerializeElement
|
||||
private long timeWindowEndTime = 0L;
|
||||
|
||||
/** Array of bin start times for this time window. */
|
||||
@DynamicSerializeElement
|
||||
private List<Long> 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<TimeWindowData> {
|
|||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
this.timeWindowEndTime = (windowEndTime / TimeUtil.MILLIS_PER_MINUTE)
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
binStartTimes = new ArrayList<Long>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bin times.
|
||||
*
|
||||
* @param binTimesArray
|
||||
*/
|
||||
public void setBinTimes(List<Long> 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<TimeWindowData> {
|
|||
return timeWindowEndTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time window end time.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getBinStartTimes() {
|
||||
return binStartTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeWindowStartTime
|
||||
* the timeWindowStartTime to set
|
||||
|
@ -201,14 +149,6 @@ public class TimeWindowData implements Comparable<TimeWindowData> {
|
|||
this.timeWindowEndTime = timeWindowEndTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param binStartTimes
|
||||
* the binStartTimes to set
|
||||
*/
|
||||
public void setBinStartTimes(List<Long> binStartTimes) {
|
||||
this.binStartTimes = binStartTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the network
|
||||
*/
|
||||
|
@ -224,6 +164,36 @@ public class TimeWindowData implements Comparable<TimeWindowData> {
|
|||
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<TimeWindowData> {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean factory-bean="ebxmlJaxbManager" factory-method="findJaxables"
|
||||
depends-on="ebxmlJaxbManager">
|
||||
|
||||
<bean factory-bean="ebxmlJaxbManager" factory-method="findJaxables"
|
||||
depends-on="ebxmlJaxbManager">
|
||||
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> extends
|
||||
SiteSubscription<T, C> {
|
||||
|
||||
|
@ -74,4 +77,5 @@ public class AdhocSubscription<T extends Time, C extends Coverage> extends
|
|||
super(subscription);
|
||||
setGroupName("Adhoc");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> {
|
||||
|
||||
@RegistryObjectOwner
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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<T extends Time> {
|
||||
public static final String DATE_SLOT = "date";
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
|
||||
/**
|
||||
* Defines a type that can visit {@link DataSetMetaData} instances and perform
|
||||
* some activity.
|
||||
|
|
|
@ -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<Integer, String> cyclesToUrls = new HashMap<Integer, String>();
|
||||
|
@ -162,4 +168,5 @@ public class OpenDapGriddedDataSet extends GriddedDataSet {
|
|||
public ServiceType getServiceType() {
|
||||
return ServiceType.OPENDAP;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> extends InitialPendingSharedSubscription<T, C>
|
||||
implements PendingSubscription<T, C> {
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> extends InitialPendingSiteSubscription<T, C>
|
||||
implements PendingSubscription<T, C> {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
|
||||
/**
|
||||
* Pending Subscription definition.
|
||||
*
|
||||
|
|
|
@ -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<PointTime> {
|
||||
|
||||
public PointDataSetMetaData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(IDataSetMetaDataVisitor visitor) {
|
||||
// TODO: not sure what this does?
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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 **/
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -268,6 +271,17 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
@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<T extends Time, C extends Coverage>
|
|||
@Override
|
||||
public void setActivePeriodStart(Date activePeriodStart) {
|
||||
this.activePeriodStart = activePeriodStart;
|
||||
this.startActivePeriodDayOfYear = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -453,56 +468,55 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
@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<T extends Time, C extends Coverage>
|
|||
|
||||
return expired;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for expiration on date
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
|
@ -929,9 +944,8 @@ public abstract class RecurringSubscription<T extends Time, C extends Coverage>
|
|||
|
||||
// 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<T extends Time, C extends Coverage>
|
|||
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<T extends Time, C extends Coverage>
|
|||
public boolean shouldUpdate() {
|
||||
return shouldUpdate;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> extends
|
||||
RecurringSubscription<T, C> {
|
||||
|
@ -143,4 +146,5 @@ public class SharedSubscription<T extends Time, C extends Coverage> extends
|
|||
this.officeIDs.add(officeId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<T extends Time, C extends Coverage> extends
|
||||
RecurringSubscription<T, C> {
|
||||
private static final long serialVersionUID = -6422673887457060034L;
|
||||
|
@ -180,4 +183,5 @@ public class SiteSubscription<T extends Time, C extends Coverage> extends
|
|||
this.officeIDs.add(officeId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -340,6 +340,17 @@ public interface Subscription<T extends Time, C extends Coverage> {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String>();
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*Dec 08, 2013 2584 dhladky Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IConvert {
|
||||
|
||||
/**
|
||||
* Convert a Registry Object between versions
|
||||
*
|
||||
* @param o
|
||||
*/
|
||||
public void convert(Object o);
|
||||
}
|
||||
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 4, 2013 2584 dhladky Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Documented
|
||||
public @interface RegistryObjectVersion {
|
||||
|
||||
public float value() default 1.0f;
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -79,15 +82,18 @@ abstract class ContentSlotBasedEncoder<SLOT_VALUE_TYPE extends ValueType, CONTEN
|
|||
public final Object decodeObject(RegistryObjectType registryObjectType)
|
||||
throws SerializationException {
|
||||
Object object = null;
|
||||
|
||||
List<SlotType> 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<SLOT_VALUE_TYPE extends ValueType, CONTEN
|
|||
*
|
||||
* @param content
|
||||
* the content
|
||||
* @param the className
|
||||
* @param the version for serialization
|
||||
* @return the decoded object
|
||||
* @throws SerializationException
|
||||
* on error decoding the string into an object
|
||||
*/
|
||||
abstract Object decodeContent(CONTENT_TYPE content)
|
||||
abstract Object decodeContent(CONTENT_TYPE content, String className, String version)
|
||||
throws SerializationException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,75 +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.common.registry.ebxml.encoder;
|
||||
|
||||
import static com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type.DYNAMIC_SERIALIZE;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
* A {@link StringBasedEncoder} implementation that uses
|
||||
* {@link DynamicSerialize} annotations. Package-private as it is not directly
|
||||
* accessibly in the public API.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 07, 2012 1102 djohnson Initial creation
|
||||
* Jun 03, 2013 2038 djohnson Add equals/hashcode.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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)));
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
|
@ -61,21 +62,31 @@ public class EbxmlJaxbManager {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(EbxmlJaxbManager.class);
|
||||
|
||||
private JAXBManager jaxb;
|
||||
|
||||
private Set<Class<?>> jaxables;
|
||||
|
||||
private Map<String, Class<?>> convertables = new HashMap<String, Class<?>>(1);
|
||||
|
||||
private Map<String, String> versions = new HashMap<String, String>(1);
|
||||
|
||||
private static EbxmlJaxbManager instance;
|
||||
|
||||
private static JAXBManager jaxb;
|
||||
|
||||
private static Set<Class<?>> 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<Class<?>> 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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -144,6 +145,31 @@ public class ObjectRefType implements IPersistableDataObject<String> {
|
|||
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();
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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.
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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 extends Annotation>T getAnnotationFromClass(Class<?> clazz,
|
||||
Class<T> annotation) throws ReflectionException {
|
||||
|
||||
T ann = clazz.getAnnotation(annotation);
|
||||
if (ann != null) {
|
||||
return ann;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a class instance from its name.
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()))
|
||||
|
||||
|
|
|
@ -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()))
|
||||
logger.info("Final: wctime: {0:-6.2f}, cputime: {1:-6.2f}".format(endT - startT, time.clock()))
|
|
@ -22,7 +22,6 @@
|
|||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.EmptyAdhocSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -96,9 +97,8 @@ class BandwidthGraphDataAdapter {
|
|||
|
||||
Collection<RetrievalPlan> retrievalPlans = retrievalManager
|
||||
.getRetrievalPlans().values();
|
||||
Map<Long, SubscriptionRetrieval> retrievals = new HashMap<Long, SubscriptionRetrieval>();
|
||||
Map<Long, List<BandwidthReservation>> reservations = new HashMap<Long, List<BandwidthReservation>>();
|
||||
Map<Network, List<SubscriptionWindowData>> networkMap = new HashMap<Network, List<SubscriptionWindowData>>();
|
||||
SubscriptionAllocationMapping subAllocationMapping = new SubscriptionAllocationMapping();
|
||||
|
||||
// One retrieval plan per network
|
||||
for (RetrievalPlan retrievalPlan : retrievalPlans) {
|
||||
|
@ -118,79 +118,71 @@ class BandwidthGraphDataAdapter {
|
|||
SortedSet<BandwidthBucketDescription> buckets = toDescriptions(bandwidthBuckets);
|
||||
bandwidthGraphData.addBucketDescriptions(network, buckets);
|
||||
|
||||
// Latency window data - accumulate all the reservations
|
||||
for (BandwidthBucket bucket : bandwidthBuckets) {
|
||||
final List<BandwidthAllocation> 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<BandwidthAllocation> allocationList = EdexBandwidthContextFactory
|
||||
.getInstance().bandwidthDao
|
||||
.getBandwidthAllocations(network);
|
||||
|
||||
final List<BandwidthReservation> bandwidthReservations = retrievalPlan
|
||||
.getBandwidthReservationsForBucket(bucket);
|
||||
|
||||
if (bandwidthReservations != null) {
|
||||
for (BandwidthReservation reservation : bandwidthReservations) {
|
||||
if (!reservations.containsKey(reservation.getId())) {
|
||||
reservations.put(reservation.getId(),
|
||||
new ArrayList<BandwidthReservation>());
|
||||
}
|
||||
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<String, List<BandwidthAllocation>> subAllocationMap = subAllocationMapping
|
||||
.getSubAllocationMap();
|
||||
for (Map.Entry<String, List<BandwidthAllocation>> 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<SubscriptionWindowData> subList = networkMap
|
||||
.get(network);
|
||||
for (SubscriptionWindowData subData : subList) {
|
||||
if (subData.getRegistryId().equals(registryId)) {
|
||||
windowData = subData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
List<SubscriptionWindowData> 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<Long> binStartTimes = new ArrayList<Long>();
|
||||
binStartTimes.add(retrieval.getStartTime().getTimeInMillis());
|
||||
List<BandwidthReservation> 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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -639,7 +641,6 @@ public abstract class BandwidthManager<T extends Time, C extends Coverage>
|
|||
.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<T extends Time, C extends Coverage>
|
|||
unscheduled = schedule(subscription, Sets.newTreeSet(cycles));
|
||||
}
|
||||
|
||||
unscheduled.addAll(getMostRecent(subscription,
|
||||
useMostRecentDataSetUpdate));
|
||||
return unscheduled;
|
||||
}
|
||||
|
||||
|
@ -679,11 +678,13 @@ public abstract class BandwidthManager<T extends Time, C extends Coverage>
|
|||
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(
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -312,25 +313,19 @@ public abstract class EdexBandwidthManager<T extends Time, C extends Coverage>
|
|||
// TODO Check if we need to set sub to "OFF" state and save to
|
||||
// registry
|
||||
if (((RecurringSubscription<T, C>) 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);
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -244,14 +245,16 @@ public class InMemoryBandwidthBucketDao implements IBandwidthBucketDao {
|
|||
final NavigableMap<Long, BandwidthBucket> 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<Long, BandwidthBucket> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 23, 2014 2636 mpduff Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscriptionAllocationMapping {
|
||||
|
||||
/**
|
||||
* Subscription name to list of BandwidthAllocations for the subscription.
|
||||
*/
|
||||
private final Map<String, List<BandwidthAllocation>> subAllocationMap = new HashMap<String, List<BandwidthAllocation>>();
|
||||
|
||||
/**
|
||||
* BandwidthAllocation id to SubscriptionRetrieval map.
|
||||
*/
|
||||
private final Map<Long, SubscriptionRetrieval> subRetrievalMap = new HashMap<Long, SubscriptionRetrieval>();
|
||||
|
||||
/**
|
||||
* 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<BandwidthAllocation>(8));
|
||||
}
|
||||
|
||||
subAllocationMap.get(subName).add(allocation);
|
||||
subRetrievalMap.put(allocation.getId(),
|
||||
(SubscriptionRetrieval) allocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subAllocationMap
|
||||
*/
|
||||
public Map<String, List<BandwidthAllocation>> getSubAllocationMap() {
|
||||
return subAllocationMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subRetrievalMap
|
||||
*/
|
||||
public Map<Long, SubscriptionRetrieval> getSubRetrievalMap() {
|
||||
return subRetrievalMap;
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -173,19 +176,31 @@ public class BandwidthDaoUtil<T extends Time, C extends Coverage> {
|
|||
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<T extends Time, C extends Coverage> {
|
|||
**/
|
||||
// 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<T extends Time, C extends Coverage> {
|
|||
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<Calendar> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
value="com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager.addObjectTypesToSubscribeTo" />
|
||||
<property name="arguments">
|
||||
<list>
|
||||
<value>Test Object Type</value>
|
||||
<value>urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Federation</value>
|
||||
<value>urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Registry</value>
|
||||
<value>urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association</value>
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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";
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
<!-- A RetrievalTask takes three constructor arguments:
|
||||
1) How to find retrievals, in this case perform the actual retrieval and return it
|
||||
2) What to do with found retrievals, in this case process it and send a notification event
|
||||
3) How to complete retrievals, in this case update the database and send a notification event
|
||||
-->
|
||||
<bean id="opsnetRetrievalTask"
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalTask">
|
||||
<constructor-arg value="OPSNET" />
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.PerformRetrievalsThenReturnFinder">
|
||||
<constructor-arg ref="retrievalQueue" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.StoreRetrievedData">
|
||||
<constructor-arg value="direct-vm:dataDeliveryNotify" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalResponseCompleter">
|
||||
<constructor-arg ref="subNotifyTask" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- Pick up SBN retrievals from the drop-off point -->
|
||||
<bean id="sbnRetrievalTask"
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalTask">
|
||||
<constructor-arg value="SBN" />
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.PerformRetrievalsThenReturnFinder">
|
||||
<constructor-arg ref="retrievalQueue" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.StoreRetrievedData">
|
||||
<constructor-arg value="direct-vm:dataDeliveryNotify" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalResponseCompleter" >
|
||||
<constructor-arg ref="subNotifyTask" />
|
||||
<constructor-arg ref="retrievalDao" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<util:list id="retrievalTaskList"
|
||||
value-type="com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalTask.RetrievalTask">
|
||||
<ref bean="opsnetRetrievalTask" />
|
||||
<ref bean="sbnRetrievalTask" />
|
||||
</util:list>
|
||||
|
||||
</beans>
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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()));
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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,
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<nwsRoleData xmlns:ns2="group">
|
||||
<!-- role is: request context path
|
||||
If two roles apply, the more specific has effect.
|
||||
An empty string in "context" or "path" implies all contexts or paths.
|
||||
The special user, "ALL" gives access to all users and groups.
|
||||
-->
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/purge">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/colormaps">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/ffmp">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/fog">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/fog">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/safeseas">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/safeseas">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/snow">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/snow">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/scan">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/aviation/config">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/aviation/tmp">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/monitorIcons">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/alertViz/AlertVizForced.xml">
|
||||
<!-- delete the ALL user line and uncomment the fxa user line to limit modification rights to AlertVizForced to the fxa user -->
|
||||
<user id="ALL"/>
|
||||
<!--user id="fxa'/-->
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/alertViz">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/hydro">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/gfe">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/gfe/comboData">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/gfe">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/isc">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.user/common_static/gfe">
|
||||
<!--Add user accounts here to allow users to write to other
|
||||
user's GFE files. Each user account must be listed
|
||||
separately.
|
||||
<user id="ifpAdmin"/>
|
||||
<user id="ifpAdmin2"/>
|
||||
-->
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.user/cave_static/gfe">
|
||||
<!--Add user accounts here to allow users to write to other
|
||||
user's GFE files. Each user account must be listed
|
||||
separately.
|
||||
<user id="ifpAdmin"/>
|
||||
<user id="ifpAdmin2"/>
|
||||
-->
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/ffmp">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/scan">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/monitoring">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/scan/config/trendSets/CellTrendSets.xml">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/cave_static/aviation/avnwatch">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/radar/rmr/rmrAvailableRequests.xml">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site/common_static/shef">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<!-- Examples for primary and secondary backup entries (DR14474)
|
||||
<role roleId="com.raytheon.localization.site.eax">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
|
||||
<role roleId="com.raytheon.localization.site.hgx">
|
||||
<user id="ALL"/>
|
||||
</role>
|
||||
-->
|
||||
|
||||
</nwsRoleData>
|
||||
|
|
@ -74,6 +74,7 @@
|
|||
<bean name="AuditableEventTypeDao"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao">
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="soapService" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
<bean name="classificationNodeDao"
|
||||
|
|
|
@ -20,21 +20,32 @@
|
|||
|
||||
package com.raytheon.uf.edex.registry.ebxml.dao;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DateTimeValueType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ActionTypes;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
@ -58,6 +69,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 9/11/2013 2354 bphillip Modified queries to find deleted objects
|
||||
* 10/23/2013 1538 bphillip Changed send time slot to be DateTimeValue instead of integer
|
||||
* 12/2/2013 1829 bphillip Changed to use non generic getter of value type
|
||||
* 01/21/2014 2613 bphillip Modified queries to better handle deletes
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<AuditableEventType> EVENT_TIME_COMPARATOR = new Comparator<AuditableEventType>() {
|
||||
@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<AuditableEventType> getEventsOfInterest(
|
||||
SubscriptionType subscription, String serviceAddress,
|
||||
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
|
||||
List<ObjectRefType> objectsOfInterest)
|
||||
throws EbxmlRegistryException, MsgRegistryException {
|
||||
List<AuditableEventType> events = new ArrayList<AuditableEventType>(0);
|
||||
if (!objectsOfInterest.isEmpty()) {
|
||||
events = getEventsOfInterest(FIND_EVENTS_OF_INTEREST_QUERY,
|
||||
startTime, endTime, objectsOfInterest);
|
||||
}
|
||||
List<AuditableEventType> 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<AuditableEventType> getDeleteEventsOfInterest(
|
||||
SubscriptionType subscription, String serviceAddress,
|
||||
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime)
|
||||
throws EbxmlRegistryException, MsgRegistryException {
|
||||
|
||||
List<AuditableEventType> retVal = new LinkedList<AuditableEventType>();
|
||||
List<AuditableEventType> 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<ObjectRefType> 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<AuditableEventType> getEventsOfInterest(
|
||||
private List<AuditableEventType> getEventsOfInterest(String query,
|
||||
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
|
||||
List<ObjectRefType> objectsOfInterest) {
|
||||
String query = FIND_DELETED_EVENTS_OF_INTEREST_QUERY;
|
||||
List<Object> queryParams = new ArrayList<Object>(4);
|
||||
queryParams.add("eventType");
|
||||
queryParams.add(ActionTypes.delete);
|
||||
List<Object> queryParams = new ArrayList<Object>(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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<RegistryObjectType> regObjList = new ArrayList<RegistryObjectType>(
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<AuditableEventType> getEventsOfInterest(
|
||||
SubscriptionType subscription, String serviceAddress,
|
||||
XMLGregorianCalendar startTime, XMLGregorianCalendar endTime,
|
||||
List<ObjectRefType> objectsOfInterest) {
|
||||
return this.auditableEventDao.getEventsOfInterest(startTime, endTime,
|
||||
objectsOfInterest);
|
||||
List<ObjectRefType> 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<NotificationListenerWrapper> listeners = notificationListeners.listeners;
|
||||
final SubscriptionType subscription = notificationListeners.subscription;
|
||||
|
||||
List<ObjectRefType> objectsOfInterest = getObjectsOfInterest(subscription);
|
||||
|
||||
XMLGregorianCalendar startTime = subscription
|
||||
.getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME);
|
||||
|
||||
if (startTime == null) {
|
||||
startTime = subscription.getStartTime();
|
||||
}
|
||||
|
||||
List<AuditableEventType> eventsOfInterest = getEventsOfInterest(
|
||||
subscription.getStartTime(), subscription.getEndTime(),
|
||||
objectsOfInterest);
|
||||
|
||||
if (!eventsOfInterest.isEmpty()) {
|
||||
for (NotificationListenerWrapper listener : listeners) {
|
||||
for (NotificationListenerWrapper listener : listeners) {
|
||||
List<AuditableEventType> 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<ActionType> actionList = event.getAction();
|
||||
for (ActionType action : actionList) {
|
||||
objectsToRemove.clear();
|
||||
refsToRemove.clear();
|
||||
|
||||
if (action.getAffectedObjectRefs() != null) {
|
||||
List<ObjectRefType> 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<RegistryObjectType> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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 ["
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 29, 2012 bphillip Initial creation
|
||||
* Nov 14, 2013 2552 bkowal EbxmlJaxbManager is now accessed via getInstance
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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<String, AdhocQueryExpression> expressionMap = new HashMap<String, AdhocQueryExpression>();
|
||||
|
||||
/** 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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -135,8 +136,15 @@ public class GetNotification extends RegistryQueryPlugin {
|
|||
|
||||
List<ObjectRefType> objectsOfInterest = notificationManager
|
||||
.getObjectsOfInterest(subscription);
|
||||
List<AuditableEventType> eventsOfInterest = notificationManager
|
||||
.getEventsOfInterest(startTime, null, objectsOfInterest);
|
||||
List<AuditableEventType> 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",
|
||||
|
|
|
@ -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
|
||||
|
|
149
javaUtilities/com.raytheon.uf.logsrv/README.txt
Normal file
149
javaUtilities/com.raytheon.uf.logsrv/README.txt
Normal file
|
@ -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):
|
||||
|
||||
<appender class="ch.qos.logback.classic.net.SocketAppender" name="remoteLogSrv">
|
||||
<includeCallerData>false</includeCallerData>
|
||||
<port>5477</port>
|
||||
<remoteHost>dev33.oma.us.ray.com</remoteHost>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
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:
|
||||
|
||||
<root>
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="asyncConsole"/>
|
||||
<appender-ref ref="remoteLogSrv"/>
|
||||
</root>
|
||||
|
||||
For CAVE, the recommendation is to add it to the CaveLogger. For example:
|
||||
|
||||
<logger name="CaveLogger" additivity="false">
|
||||
<level value="ALL"/>
|
||||
<appender-ref ref="AsyncCaveLogAppender"/>
|
||||
<appender-ref ref="remoteLogSrv"/>
|
||||
</logger>
|
||||
|
||||
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.
|
||||
|
108
javaUtilities/com.raytheon.uf.logsrv/build.xml
Normal file
108
javaUtilities/com.raytheon.uf.logsrv/build.xml
Normal file
|
@ -0,0 +1,108 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
<project name="com.raytheon.uf.logsrv" default="dist">
|
||||
|
||||
<property name="foss" location="../../cots/"/>
|
||||
<property name="src" location="src"/>
|
||||
<property name="bin" location="bin"/>
|
||||
<property name="qualifier" value="${date}"/>
|
||||
<property name="prefix" value="logsrv"/>
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${bin}"/>
|
||||
<tstamp>
|
||||
<format property="date" pattern="yyyyMMdd" />
|
||||
</tstamp>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src}" destdir="${bin}"/>
|
||||
</target>
|
||||
|
||||
<target name="copyManifest" depends="init">
|
||||
<loadproperties srcfile="META-INF/MANIFEST.MF">
|
||||
<filterchain>
|
||||
<linecontainsregexp>
|
||||
<regexp pattern="^Bundle-Version: \d+.\d+.\d+.qualifier$" />
|
||||
</linecontainsregexp>
|
||||
<tokenfilter>
|
||||
<replaceregex pattern="qualifier$" replace="${qualifier}" />
|
||||
</tokenfilter>
|
||||
</filterchain>
|
||||
</loadproperties>
|
||||
<copy file="META-INF/MANIFEST.MF" tofile="${bin}/META-INF/MANIFEST.MF" />
|
||||
<manifest file="${bin}/META-INF/MANIFEST.MF" mode="update">
|
||||
<attribute name="Bundle-Version" value="${Bundle-Version}" />
|
||||
</manifest>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="compile,copyManifest">
|
||||
<jar destfile="${ant.project.name}.jar" basedir="${bin}" manifest="${bin}/META-INF/MANIFEST.MF"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${bin}"/>
|
||||
<delete verbose="true">
|
||||
<fileset dir="." includes="${ant.project.name}-*.jar"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="tar" depends="build">
|
||||
<tar destfile="${ant.project.name}-${Bundle-Version}.tar.gz" compression="gzip">
|
||||
<tarfileset dir="${foss}/org.slf4j" prefix="${prefix}/lib/">
|
||||
<include name="slf4j-api*.jar"/>
|
||||
<exclude name="*sources.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="${foss}/ch.qos.logback" prefix="${prefix}/lib/">
|
||||
<include name="logback*.jar"/>
|
||||
<exclude name="*sources.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="${foss}/org.apache.derby" prefix="${prefix}/lib/">
|
||||
<include name="derby*.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="${foss}/javax.mail" prefix="${prefix}/lib/">
|
||||
<include name="mail.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="${foss}/org.quartz" prefix="${prefix}/lib/">
|
||||
<include name="quartz*.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="${foss}/org.apache.commons.lang" prefix="${prefix}/lib/">
|
||||
<include name="commons-lang*.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="./" prefix="${prefix}/lib/">
|
||||
<include name="${ant.project.name}.jar"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="conf" prefix="${prefix}/conf/">
|
||||
<include name="*.xml"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="./" prefix="${prefix}/bin/" filemode="754">
|
||||
<include name="*.sh"/>
|
||||
</tarfileset>
|
||||
<tarfileset dir="./" prefix="${prefix}/">
|
||||
<include name="README.txt"/>
|
||||
</tarfileset>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="tar">
|
||||
<delete file="${ant.project.name}.jar"/>
|
||||
</target>
|
||||
|
||||
</project>
|
27
javaUtilities/com.raytheon.uf.logsrv/conf/config.xml
Normal file
27
javaUtilities/com.raytheon.uf.logsrv/conf/config.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<logSrvConfig>
|
||||
|
||||
<!-- the cluster name, only used for the report email -->
|
||||
<clusterName>ec-oma</clusterName>
|
||||
|
||||
<!-- where to keep track of the errors
|
||||
how much space you need depends on how many errors the system is throwing
|
||||
-->
|
||||
<databaseDir>/common/njensen/logsrv/</databaseDir>
|
||||
|
||||
<!-- how to send the email report -->
|
||||
<fromAddress>Nathan.Jensen@raytheon.com</fromAddress>
|
||||
<smtpHost>mk2-msg10.raymail.ray.com</smtpHost>
|
||||
<smtpPort>143</smtpPort>
|
||||
|
||||
<!-- where to send the email report, a comma-separated list of addresses -->
|
||||
<toAddress>awipsctl@list.app.ray.com, awipstest@list.app.ray.com, david_j_hladky@raytheon.com</toAddress>
|
||||
|
||||
<!-- the time of day to send the report
|
||||
only really matters if you're installing or auto-deploying at a
|
||||
specific time, as you may want to clear out the databaseDir
|
||||
that contains errors from a previous build
|
||||
-->
|
||||
<timeToSend>00:45</timeToSend>
|
||||
|
||||
</logSrvConfig>
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
<appender name="InternalLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>/home/njensen/logs/logService-internal-%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<fileNamePattern>${logSrvLogs}/logs/logService-internal-%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<maxHistory>7</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<logSrvConfig>
|
||||
<clusterName>ec-oma</clusterName>
|
||||
<databaseDir>/awips2/edex/data/utility/nate</databaseDir>
|
||||
<fromAddress>Nathan.Jensen@raytheon.com</fromAddress>
|
||||
<smtpHost>mk2-msg10.raymail.ray.com</smtpHost>
|
||||
<smtpPort>143</smtpPort>
|
||||
<toAddress>awipsctl@list.app.ray.com, awipstest@list.app.ray.com, david_j_hladky@raytheon.com</toAddress>
|
||||
<!-- >toAddress>Nathan.Jensen@raytheon.com</toAddress-->
|
||||
<timeToSend>00:45</timeToSend>
|
||||
<ignoreThreads>shefThreadPool</ignoreThreads>
|
||||
</logSrvConfig>
|
29
javaUtilities/com.raytheon.uf.logsrv/logsrv.sh
Normal file
29
javaUtilities/com.raytheon.uf.logsrv/logsrv.sh
Normal file
|
@ -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
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -47,15 +47,9 @@ public class DerbyAppender extends AppenderBase<ILoggingEvent> {
|
|||
|
||||
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<ILoggingEvent> {
|
|||
* @return
|
||||
*/
|
||||
private boolean shouldStoreMsg(ILoggingEvent event) {
|
||||
if (ignoreThreads != null) {
|
||||
for (String ignore : ignoreThreads) {
|
||||
if (event.getThreadName().startsWith(ignore)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue