Merge "Issue #2491 Use reflections to build Procedure JAXB context. Change-Id: I7fa43fc4d89109cf5b8f5e111c8f98a086c6c03b" into development

Former-commit-id: 3a453d5442 [formerly 002005139f] [formerly 3a453d5442 [formerly 002005139f] [formerly 5a99163569 [formerly 16f9a9ece5743e0e1f2cd71b23287defb277e915]]]
Former-commit-id: 5a99163569
Former-commit-id: b511177fa1 [formerly cf63b37257]
Former-commit-id: c4161d09ba
This commit is contained in:
Nate Jensen 2013-10-24 20:02:18 -05:00 committed by Gerrit Code Review
commit 213478f84b
52 changed files with 1496 additions and 420 deletions

View file

@ -35,7 +35,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -46,6 +45,7 @@ import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale;
import com.raytheon.uf.viz.core.maps.scales.MapScales.PartId;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.procedures.Procedure;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.viz.ui.actions.LoadSerializedXml;
/**
@ -57,8 +57,10 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2013 mschenke Initial creation
* ------------- -------- ----------- --------------------------
* Oct 08, 2013 mschenke Initial creation
* Oct 22, 2013 2491 bsteffen Change from SerializationUtil to
* ProcedureXmlManager
*
* </pre>
*
@ -119,13 +121,8 @@ public class MapScalesManager {
this.displayName = displayName;
this.partIds = new PartId[0];
this.scaleFile = null;
try {
this.bundleXml = SerializationUtil.getJaxbManager()
.marshalToXml(scaleBundle);
} catch (JAXBException e) {
throw new SerializationException(
"Error serializing bundle for scale, " + displayName);
}
this.bundleXml = ProcedureXmlManager.getInstance().marshal(
scaleBundle);
}
private void loadBundleXml() {
@ -146,10 +143,8 @@ public class MapScalesManager {
if (bundleXml != null) {
long t0 = System.currentTimeMillis();
try {
return (Bundle) SerializationUtil.getJaxbManager()
.unmarshalFromXml(bundleXml);
} catch (JAXBException e) {
throw new SerializationException(e);
return ProcedureXmlManager.getInstance().unmarshal(
Bundle.class, bundleXml);
} finally {
System.out.println("Time to create Bundle: "
+ (System.currentTimeMillis() - t0) + "ms");

View file

@ -42,7 +42,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.python;bundle-version="1.12.1174",
com.raytheon.uf.common.velocity;bundle-version="1.0.0",
ch.qos.logback;bundle-version="1.0.13",
com.raytheon.uf.common.style;bundle-version="1.0.0"
com.raytheon.uf.common.style;bundle-version="1.0.0",
org.reflections;bundle-version="0.9.9"
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: ext, registered, global
Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, ch.qos.logback

View file

@ -1,26 +0,0 @@
com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser
com.raytheon.uf.viz.core.drawables.ResourcePair
com.raytheon.uf.viz.core.procedures.Bundle
com.raytheon.uf.viz.core.procedures.Procedure
com.raytheon.uf.viz.core.map.MapDescriptor
com.raytheon.uf.viz.core.rsc.capabilities.BlendableCapability
com.raytheon.uf.viz.core.rsc.capabilities.BlendedCapability
com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability
com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability
com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability
com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability
com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability
com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability
com.raytheon.uf.viz.core.rsc.capabilities.ShadeableCapability
com.raytheon.uf.viz.core.rsc.capabilities.LabelableCapability
com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability
com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability
com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability
com.raytheon.uf.viz.core.rsc.capabilities.PointCapability
com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability
com.raytheon.uf.viz.core.rsc.GenericResourceData
com.raytheon.uf.viz.core.rsc.ResourceList
com.raytheon.uf.viz.core.rsc.ResourceProperties
com.raytheon.uf.viz.core.rsc.ProgressiveDisclosureProperties
com.raytheon.uf.viz.core.rsc.LoadProperties

View file

@ -70,4 +70,6 @@
<property name="arguments" ref="recordFactory" />
</bean>
<bean id="procedureXmlManagerInit" class="com.raytheon.uf.viz.core.procedures.ProcedureXmlManager" factory-method="inititializeAsync"/>
</beans>

View file

@ -24,7 +24,6 @@ import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -40,8 +39,9 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------ -------- ----------- --------------------------
* Feb 10, 2009 chammack Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -49,7 +49,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractTimeMatcher implements ISerializableObject {
public abstract class AbstractTimeMatcher {
/**
* Trigger the time matcher to update time information on this resource the

View file

@ -19,7 +19,9 @@
**/
package com.raytheon.uf.viz.core.alerts;
import com.raytheon.uf.common.serialization.ISerializableObject;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
@ -30,16 +32,17 @@ import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Sep 15, 2009 mschenke Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public abstract class AbstractAlertMessageParser implements ISerializableObject {
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractAlertMessageParser {
/**
* Parse the alert message object into an object expected by the Resource

View file

@ -22,8 +22,6 @@ package com.raytheon.uf.viz.core.comm;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Abstract Base Class for load properties that are specific to a perspective.
* Use as nested properties in LoadProperties.
@ -32,8 +30,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 6, 2009 bgonzale Initial creation
* ------------- -------- ----------- --------------------------
* Jul 06, 2009 bgonzale Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -41,6 +40,5 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class PerspectiveSpecificLoadProperties implements
ISerializableObject {
public abstract class PerspectiveSpecificLoadProperties {
}

View file

@ -26,8 +26,6 @@ import javax.xml.bind.annotation.XmlElement;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* This class is a container for the loop properties
*
@ -37,8 +35,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Aug 30, 2007 randerso Initial Creation.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -47,7 +46,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*
*/
@XmlAccessorType(XmlAccessType.NONE)
public class LoopProperties implements ISerializableObject {
public class LoopProperties {
public enum LoopMode {
Forward, Backward, Cycle

View file

@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@ -33,7 +32,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.serialization.SerializationUtil;
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;
@ -46,6 +45,7 @@ import com.raytheon.uf.viz.core.IView;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.preferences.ColorFactory;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IRefreshListener;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
@ -64,9 +64,10 @@ import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Feb 06, 2009 bgonzale Initial creation
* Jun 24, 2013 2140 randerso Added paintResource method
* Oct 22, 2013 2491 bsteffen Switch clone to ProcedureXmlManager
*
* </pre>
*
@ -502,8 +503,9 @@ public abstract class AbstractRenderableDisplay implements IRenderableDisplay {
@Override
public IRenderableDisplay createNewDisplay() {
try {
AbstractRenderableDisplay clonedDisplay = (AbstractRenderableDisplay) SerializationUtil
.unmarshalFromXml(SerializationUtil.marshalToXml(this));
ProcedureXmlManager jaxb = ProcedureXmlManager.getInstance();
AbstractRenderableDisplay clonedDisplay = jaxb.unmarshal(
AbstractRenderableDisplay.class, jaxb.marshal(this));
List<ResourcePair> rscsToRemove = new ArrayList<ResourcePair>();
for (ResourcePair rp : clonedDisplay.getDescriptor()
.getResourceList()) {
@ -518,21 +520,23 @@ public abstract class AbstractRenderableDisplay implements IRenderableDisplay {
}
clonedDisplay.setExtent(this.getExtent().clone());
return clonedDisplay;
} catch (JAXBException e) {
e.printStackTrace();
} catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to create new display.", e);
}
return null;
}
public AbstractRenderableDisplay cloneDisplay() {
try {
AbstractRenderableDisplay clonedDisplay = (AbstractRenderableDisplay) SerializationUtil
.unmarshalFromXml(SerializationUtil.marshalToXml(this));
ProcedureXmlManager jaxb = ProcedureXmlManager.getInstance();
AbstractRenderableDisplay clonedDisplay = jaxb.unmarshal(
AbstractRenderableDisplay.class, jaxb.marshal(this));
if (getExtent() != null) {
clonedDisplay.setExtent(this.getExtent().clone());
}
return clonedDisplay;
} catch (JAXBException e) {
} catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM,
"Error cloning renderable display", e);
}

View file

@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.Validate;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -44,8 +43,9 @@ import com.raytheon.uf.viz.core.rsc.ResourceProperties;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 5, 2007 chammack Initial Creation.
* ------------- -------- ----------- --------------------------
* Sep 05, 2007 chammack Initial Creation.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -54,7 +54,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceProperties;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "pair")
public class ResourcePair implements ISerializableObject {
public class ResourcePair {
protected AbstractVizResource<?, ?> resource;

View file

@ -42,7 +42,6 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.IExtent;
@ -60,10 +59,12 @@ import com.vividsolutions.jts.geom.Envelope;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation.
* 1/12/09 randerso added getMapManager
* 10/22/09 #3348 bsteffen Moved getter/setters for numberOfFrames down to AbstractDescriptor
* ------------- -------- ----------- --------------------------
* Jul 01, 2006 chammack Initial Creation.
* Jan 12, 2009 randerso added getMapManager
* Dec 22, 2009 3348 bsteffen Moved getter/setters for numberOfFrames down to AbstractDescriptor
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
*
* </pre>
*
@ -73,8 +74,7 @@ import com.vividsolutions.jts.geom.Envelope;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class MapDescriptor extends AbstractDescriptor implements
IMapDescriptor, ISerializableObject {
public class MapDescriptor extends AbstractDescriptor implements IMapDescriptor {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(MapDescriptor.class);

View file

@ -23,7 +23,6 @@ import java.io.File;
import java.io.FileReader;
import java.util.Map;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -31,8 +30,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.viz.core.VariableSubstitutionUtil;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
@ -46,8 +44,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Aug 30, 2007 chammack Initial Creation.
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
*
* </pre>
*
@ -56,7 +56,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Bundle implements ISerializableObject {
public class Bundle {
/** Contains the descriptors */
@XmlElement
@ -161,8 +161,8 @@ public class Bundle implements ISerializableObject {
public String toXML() throws VizException {
try {
return SerializationUtil.marshalToXml(this);
} catch (JAXBException e) {
return ProcedureXmlManager.getInstance().marshal(this);
} catch (SerializationException e) {
throw new VizException(e);
}
}
@ -275,7 +275,8 @@ public class Bundle implements ISerializableObject {
String substStr = VariableSubstitutionUtil.processVariables(
bundleStr, variables);
Bundle b = (Bundle) SerializationUtil.unmarshalFromXml(substStr);
Bundle b = ProcedureXmlManager.getInstance().unmarshal(
Bundle.class, substStr);
return b;
} catch (Exception e) {

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.viz.core.procedures;
import java.io.File;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -32,8 +31,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.eclipse.ui.IMemento;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.viz.core.exception.VizException;
/**
@ -47,8 +45,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 5, 2007 chammack Initial Creation.
* ------------- -------- ----------- --------------------------
* Sep 05, 2007 chammack Initial Creation.
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
*
* </pre>
*
@ -57,7 +57,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Procedure implements ISerializableObject {
public class Procedure {
@XmlAttribute
private String perspective;
@ -110,27 +110,26 @@ public class Procedure implements ISerializableObject {
public String toXML() throws VizException {
try {
return SerializationUtil.marshalToXml(this);
} catch (JAXBException e) {
return ProcedureXmlManager.getInstance().marshal(this);
} catch (SerializationException e) {
throw new VizException(e);
}
}
public static Procedure loadProcedure(File fileName) throws VizException {
try {
return (Procedure) SerializationUtil
.jaxbUnmarshalFromXmlFile(fileName.getAbsolutePath());
} catch (Exception e) {
e.printStackTrace();
return ProcedureXmlManager.getInstance().unmarshal(
Procedure.class, fileName);
} catch (SerializationException e) {
throw new VizException(e);
}
}
public static Procedure loadProcedure(String xml) throws VizException {
try {
return (Procedure) SerializationUtil.unmarshalFromXml(xml);
} catch (Exception e) {
e.printStackTrace();
return ProcedureXmlManager.getInstance().unmarshal(
Procedure.class, xml);
} catch (SerializationException e) {
throw new VizException(e);
}
}

View file

@ -0,0 +1,193 @@
/**
* 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.procedures;
import java.io.File;
import java.util.Collection;
import javax.xml.bind.JAXBException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.jaxb.JAXBClassLocator;
import com.raytheon.uf.common.serialization.jaxb.JaxbDummyObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.reflect.SubClassLocator;
import com.raytheon.uf.viz.core.rsc.ResourceGroup;
/**
* Centralized class for handling xml mapping of {@link Procedure}s,
* {@link Bundle}s, {@link IRenderableDisplay}s, {@link ResourceGroup}s, and
* anything else that might appear in a procedure.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 18, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class ProcedureXmlManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcedureXmlManager.class);
private static ProcedureXmlManager instance;
private final JAXBManager manager;
/**
* Get the singleton instance.
*
* @return singleton ProcedureXmlManager
*/
public static synchronized ProcedureXmlManager getInstance() {
if (instance == null) {
instance = new ProcedureXmlManager();
}
return instance;
}
/**
* Start initializing singleton manager in a background thread.
*
* @return true
*/
public static boolean inititializeAsync() {
new Job("Preparing to parse procedure Xml.") {
@Override
protected IStatus run(IProgressMonitor monitor) {
getInstance();
return Status.OK_STATUS;
}
}.schedule();
return true;
}
private ProcedureXmlManager() {
this.manager = initManager();
}
private JAXBManager initManager() {
SubClassLocator locator = new SubClassLocator();
Collection<Class<?>> classes = JAXBClassLocator.getJAXBClasses(locator,
Procedure.class);
locator.save();
Class<?>[] jaxbClasses = new Class<?>[classes.size() + 1];
classes.toArray(jaxbClasses);
/*
* Add JaxbDummyObject at the begining so properties are loaded
* correctly
*/
jaxbClasses[jaxbClasses.length - 1] = jaxbClasses[0];
jaxbClasses[0] = JaxbDummyObject.class;
try {
return new JAXBManager(jaxbClasses);
} catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM,
ProcedureXmlManager.class.getSimpleName()
+ " Failed to initialize.", e);
}
return null;
}
private JAXBManager getManager() throws SerializationException {
if (manager == null) {
throw new SerializationException(
ProcedureXmlManager.class.getSimpleName()
+ " Failed to initialize.");
}
return manager;
}
/**
* Transform an object to XML using the internal procedure context and all
* its registered classes.
*
* @param obj
* something to marshal
* @return XML in a String
* @throws SerializationException
*/
public String marshal(Object obj) throws SerializationException {
try {
return getManager().marshalToXml(obj);
} catch (JAXBException je) {
throw new SerializationException(je);
}
}
/**
* Transform some xml in a String to an object of the specified class.
*
* @param clazz
* expected type of object
* @param xml
* string containing xml
* @return the object
* @throws SerializationException
*/
public <T> T unmarshal(Class<T> clazz, String xml)
throws SerializationException {
try {
return clazz.cast(getManager().unmarshalFromXml(xml));
} catch (ClassCastException cce) {
throw new SerializationException(cce);
} catch (JAXBException je) {
throw new SerializationException(je);
}
}
/**
* Transform some xml in a File to an object of the specified class.
*
* @param clazz
* expected type of object
* @param file
* file containing xml
* @return the object
* @throws SerializationException
*/
public <T> T unmarshal(Class<T> clazz, File file)
throws SerializationException {
return getManager().unmarshalFromXmlFile(clazz, file);
}
}

View file

@ -0,0 +1,318 @@
/**
* 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.reflect;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Provides a file based cache of all types available for each installed plugin.
* Each type can either be a super class and all sub classes or an annotation
* class and all classes with that annotation.
*
* JAXB/XML was not used because it was 20x slower and every ms counts.
*
* The file format uses space separated fields. Each bundle is described on a
* Bundle line which includes the name, version, bundleId, and mod time. After a
* Bundle line there will be multiple "Type" lines, each describing one base
* class that has been searched within that bundle. When subclasses or annotated
* classes are found they will be appended to the type line, space separated.
* For must types/bundles there will be no subclasses but the type line is
* included so that the bundle is not rescanned and so the set of base classes
* can remain dynamic.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 21, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class BundleClassCache {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(BundleClassCache.class);
private static final String BUNDLE = "Bundle";
private static final String TYPE = "Type";
private static final char SEPERATOR = ' ';
private static final Pattern SEPERATOR_SPLIT = Pattern.compile(" ");
private final File file;
private final Map<PluginKey, SubTypeNameMap> pluginMap = new HashMap<PluginKey, SubTypeNameMap>();
private boolean modified = false;
/**
* Create a new cache using the provided file. If the file exists it is read
* in to prepopulate the cache.
*
* @param file
*/
public BundleClassCache(File file) {
this.file = file;
if (file.exists()) {
try {
BufferedReader r = new BufferedReader(new FileReader(file));
PluginKey key = null;
SubTypeNameMap value = new SubTypeNameMap();
String line = r.readLine();
while (line != null) {
line = line.trim();
if (line.startsWith(BUNDLE)) {
key = new PluginKey(line);
value = new SubTypeNameMap();
pluginMap.put(key, value);
} else if (line.startsWith(TYPE)) {
value.addType(line);
}
line = r.readLine();
}
r.close();
} catch (IOException e) {
statusHandler.handle(Priority.VERBOSE, e.getLocalizedMessage(),
e);
}
}
}
/**
* Get all types in a bundles that extend the provided base class.
*
* @param bundle
* bundle to search
* @param baseClassName
* name of a base class
* @return names of all subclasses(possible empty), or null if the bundle
* does not have a cache entry for the base class.
*/
public String[] getTypes(Bundle bundle, String baseClassName) {
SubTypeNameMap map = pluginMap.get(new PluginKey(bundle));
if (map == null) {
return null;
}
return map.getSubTypes(baseClassName);
}
/**
* Add the type to the cache.
*
* @param bundle
* the bundle that was scanned.
* @param baseClassName
* name of base class
* @param subTypes
* all subtypes, can be length 0 but not null.
*/
public void putTypes(Bundle bundle, String baseClassName, String[] subTypes) {
modified = true;
PluginKey key = new PluginKey(bundle);
SubTypeNameMap map = pluginMap.get(key);
if (map == null) {
map = new SubTypeNameMap();
pluginMap.put(key, map);
}
map.putSubTypes(baseClassName, subTypes);
}
/**
* Peresist the contents of the cache to the file used during construction.
* If any {@link IOException}s occur they will be logged but not returned.
*/
public void save() {
if (modified) {
try {
File tmpFile = File.createTempFile("tmpClassCache", ".txt",
file.getParentFile());
Writer w = new BufferedWriter(new FileWriter(tmpFile));
for (Entry<PluginKey, SubTypeNameMap> e : pluginMap.entrySet()) {
e.getKey().save(w);
e.getValue().save(w);
}
w.close();
tmpFile.renameTo(file);
} catch (IOException e) {
statusHandler.handle(Priority.VERBOSE, e.getLocalizedMessage(),
e);
}
}
}
/**
* Cache entry, containing all base/subtype mappings.
*/
private static class SubTypeNameMap {
private final Map<String, String[]> typeMap = new HashMap<String, String[]>();
public void addType(String line) {
String[] parts = SEPERATOR_SPLIT.split(line);
String base = parts[1];
String[] subTypes = Arrays.copyOfRange(parts, 2, parts.length);
typeMap.put(base, subTypes);
}
public String[] getSubTypes(String className) {
return typeMap.get(className);
}
public void putSubTypes(String className, String[] subTypes) {
typeMap.put(className, subTypes);
}
public void save(Writer w) throws IOException {
for (Entry<String, String[]> e : typeMap.entrySet()) {
w.write(TYPE);
w.write(SEPERATOR);
w.write(e.getKey());
for (String val : e.getValue()) {
w.write(SEPERATOR);
w.write(val);
}
w.write('\n');
}
}
}
/**
* Key for uniquely identifing a plugin.
*/
private static class PluginKey {
/*
* On development boxes the modtime changes every time CAVE is run, so
* it is not used in comparisons by default.
*/
private static final boolean useModTime = false;
/*
* The unique ID is not strictly needed for comparisons since
* name/version should be unique already. It is kept in just in case
* there is an unaccounted for edge case.
*/
private static final boolean useUnique = true;
private final String name;
private final String version;
private final long unique;
private final long modTime;
public PluginKey(String line) {
String[] split = SEPERATOR_SPLIT.split(line);
name = split[1];
version = split[2];
unique = Long.parseLong(split[3]);
modTime = Long.parseLong(split[4]);
}
public PluginKey(Bundle bundle) {
name = bundle.getSymbolicName();
version = bundle.getVersion().toString();
unique = bundle.getBundleId();
modTime = bundle.getLastModified();
}
public void save(Writer w) throws IOException {
w.write(BUNDLE);
w.write(SEPERATOR);
w.write(name);
w.write(SEPERATOR);
w.write(version);
w.write(SEPERATOR);
w.write(Long.toString(unique));
w.write(SEPERATOR);
w.write(Long.toString(modTime));
w.write('\n');
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
if (useModTime)
result = prime * result + (int) (modTime ^ (modTime >>> 32));
if (useUnique)
result = prime * result + (int) (unique ^ (unique >>> 32));
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result
+ ((version == null) ? 0 : version.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;
PluginKey other = (PluginKey) obj;
if (useModTime)
if (modTime != other.modTime)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (useUnique)
if (unique != other.unique)
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}
}

View file

@ -0,0 +1,79 @@
/**
* 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.reflect;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleWiring;
import org.reflections.Reflections;
import org.reflections.scanners.Scanner;
import org.reflections.util.ConfigurationBuilder;
/**
* Provides the capabilities of {@link Reflections} for a single OSGi
* {@link Bundle}. Uses Reflections internally but populates URL and CLassLoader
* from the Bundle.
*
* In the future this can be expanded to expose more of the {@link Reflections}
* capabilities.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 21, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class BundleReflections {
private 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();
}
public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) {
return reflections.getSubTypesOf(type);
}
public Set<Class<?>> getSubTypesOf(Class<?>... types) {
Set<Class<?>> subTypes = new HashSet<Class<?>>();
for (Class<?> type : types) {
subTypes.addAll(getSubTypesOf(type));
}
return subTypes;
}
}

View file

@ -0,0 +1,305 @@
/**
* 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.reflect;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.wiring.BundleWiring;
import org.reflections.scanners.SubTypesScanner;
import com.raytheon.uf.common.serialization.reflect.ISubClassLocator;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.Activator;
/**
* Loads all subclasses of any class using all installed OSGi bundles and the
* Reflections package. Results are cached using a {@link BundleClassCache}. to
* save time on startup.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 18, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class SubClassLocator implements ISubClassLocator {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SubClassLocator.class);
private static final String CACHE_FILENAME = "subclassCache.txt";
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>();
private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>();
private final Map<String, List<Bundle>> requiredBundles = new HashMap<String, List<Bundle>>();
private final BundleClassCache cache;
/**
* Create a new SubClassLocator.
*/
public SubClassLocator() {
Bundle[] bundles = Activator.getDefault().getBundle()
.getBundleContext().getBundles();
for (Bundle b : bundles) {
bundleLookup.put(b.getSymbolicName(), b);
}
File stateDir = Activator.getDefault().getStateLocation().toFile();
cache = new BundleClassCache(new File(stateDir, CACHE_FILENAME));
}
/**
* Locate all subclasses in all bundles of a given class
*
* @param base
* @return
*/
public Collection<Class<?>> locateSubClasses(Class<?> base) {
Map<String, Set<Class<?>>> recursiveClasses = new HashMap<String, Set<Class<?>>>(
bundleLookup.size(), 1.0f);
Set<Class<?>> result = new HashSet<Class<?>>(512);
for (Bundle bundle : bundleLookup.values()) {
result.addAll(lookupRecursiveSubClasses(base, bundle, true,
recursiveClasses));
}
return result;
}
/**
* Store the cache to disk.
*/
public void save() {
cache.save();
}
/**
* The lookup must occur recursively because otherwise sub classes of sub
* classes of base types are not correctly located.
*
* @param base
* base class
* @param bundle
* bundle to search
* @param includeRequiredSubclasses
* when false only subclasses of base found in this bundle are
* returned, when true subclasses found in other bundles required
* by this bundle are also returned.
* @param recursiveClasses
* map of already searched bundles to avoid recursing the same
* bundles multiple time.
* @return the sub classes contained in the bundle.
*/
private Set<Class<?>> lookupRecursiveSubClasses(Class<?> base,
Bundle bundle, boolean includeRequiredSubclasses,
Map<String, Set<Class<?>>> recursiveClasses) {
String bundleName = bundle.getSymbolicName();
if (bundleName.startsWith("org.eclipse")) {
/*
* org.eclipse.osgi has no class loader and must be skipped,
* skipping the rest of org.eclipse just saves time.
*/
return Collections.emptySet();
}
if (includeRequiredSubclasses) {
/* Short circut if we already did this. */
Set<Class<?>> result = recursiveClasses.get(bundleName);
if (result != null) {
return result;
}
}
String[] ownedNames = cache.getTypes(bundle, base.getName());
if (ownedNames == null) {
Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle,
recursiveClasses);
/* Must pass dependencies in so type heirarchy is complete. */
Set<Class<?>> owned = loadSubClassesReflectively(bundle, dependencies);
/* populate the cache */
ownedNames = new String[owned.size()];
int index = 0;
for (Class<?> clazz : owned) {
ownedNames[index++] = clazz.getName();
}
cache.putTypes(bundle, base.getName(), ownedNames);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned);
recursiveClasses.put(bundleName, all);
if (includeRequiredSubclasses) {
return all;
} else {
return owned;
}
} else {
Set<Class<?>> owned = loadClassesFromCache(bundle,
Arrays.asList(ownedNames));
if (includeRequiredSubclasses) {
Set<Class<?>> dependencies = getRequiredSubclasses(base,
bundle,
recursiveClasses);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned);
recursiveClasses.put(bundleName, all);
return all;
} else {
return owned;
}
}
}
/**
* Locate all subclasses of base that are found in the bundles required by
* this bundle.
*
* @param base
* base class
* @param bundle
* bundle to search
* @param recursiveClasses
* map of already searched bundles to avoid recursing the same
* bundles multiple time.
* @return the sub classes contained in required bundles.
*/
private Set<Class<?>> getRequiredSubclasses(Class<?> base, Bundle bundle,
Map<String, Set<Class<?>>> recursiveClasses) {
Set<Class<?>> dependencies = new HashSet<Class<?>>();
dependencies.add(base);
for (Bundle reqBundle : getRequiredBundles(bundle)) {
dependencies.addAll(lookupRecursiveSubClasses(base, reqBundle,
true, recursiveClasses));
}
return dependencies;
}
/**
* Load all subclasses of a set of classes that are found within a bundle.
*
* @param bundle
* bundle to search
* @param baseClasses
* all base classes
* @return
*/
private Set<Class<?>> loadSubClassesReflectively(Bundle bundle,
Collection<Class<?>> baseClasses) {
String bundleName = bundle.getSymbolicName();
try {
BundleReflections reflections = reflectionLookup.get(bundleName);
if (reflections == null) {
reflections = new BundleReflections(bundle,
new SubTypesScanner());
reflectionLookup.put(bundleName, reflections);
}
return reflections.getSubTypesOf(baseClasses
.toArray(new Class<?>[0]));
} catch (Throwable e) {
statusHandler.handle(Priority.PROBLEM,
"Error loading classes in bundle(" + bundleName
+ "), some procedures may not load.", e);
}
return Collections.emptySet();
}
/**
* Load classes by name using a specific bundles class loader
*
* @param bundle
* the bundle to get a class loader from
* @param classNames
* names of classes to load.
* @return
*/
private Set<Class<?>> loadClassesFromCache(Bundle bundle,
Collection<String> classNames) {
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
ClassLoader loader = bundleWiring.getClassLoader();
HashSet<Class<?>> result = new HashSet<Class<?>>(classNames.size(),
1.0f);
for (String className : classNames) {
try {
result.add(Class.forName(className, false, loader));
} catch (ClassNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, "Error loading class("
+ className + "), some procedures may not load.", e);
}
}
return result;
}
/**
* Parse bundle header to get all required bundles
*
* @param bundle
* the bundle
* @return bundles required by bundle.
*/
private List<Bundle> getRequiredBundles(Bundle bundle) {
String bundleName = bundle.getSymbolicName();
List<Bundle> required = requiredBundles.get(bundle);
if (required == null) {
required = new ArrayList<Bundle>();
String requiredBundlesHeader = bundle.getHeaders().get(
Constants.REQUIRE_BUNDLE);
if (requiredBundlesHeader != null) {
String[] requiredBundles = COMMA_SPLIT
.split(requiredBundlesHeader);
for (String requiredBundleName : requiredBundles) {
String[] nameParts = SEMICOLON_SPLIT
.split(requiredBundleName);
Bundle reqBundle = bundleLookup.get(nameParts[0]);
if (reqBundle != null) {
required.add(reqBundle);
}
}
}
requiredBundles.put(bundleName, required);
}
return required;
}
}

View file

@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
@ -41,8 +40,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 2, 2009 chammack Initial creation
* ------------- -------- ----------- --------------------------
* Feb 02, 2009 chammack Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
*
* </pre>
*
@ -50,7 +51,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractResourceData implements ISerializableObject {
public abstract class AbstractResourceData {
/** The generator used to generate names for labels */
protected AbstractNameGenerator nameGenerator = null;

View file

@ -25,7 +25,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.Capabilities;
@ -40,9 +39,10 @@ import com.raytheon.uf.viz.core.rsc.capabilities.Capabilities;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Aug 15, 2007 chammack Initial Creation.
* Feb 26, 2009 2032 jsanchez Added a loadWithoutData.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -51,7 +51,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.Capabilities;
*/
@XmlType(name = "loadProperties")
@XmlAccessorType(XmlAccessType.NONE)
public class LoadProperties implements ISerializableObject {
public class LoadProperties {
private Capabilities capabilities;

View file

@ -24,8 +24,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Defines the progressive disclosure properties
*
@ -34,8 +32,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/30/07 randerso Initial Creation.
* ------------- -------- ----------- --------------------------
* Jul 30, 2007 randerso Initial Creation.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -43,7 +42,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*
*/
@XmlAccessorType(XmlAccessType.NONE)
public class ProgressiveDisclosureProperties implements ISerializableObject {
public class ProgressiveDisclosureProperties {
/**
* Minimum display width in meters for the associated resource to be
* displayed

View file

@ -36,7 +36,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.apache.commons.lang.Validate;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -56,10 +55,12 @@ import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 5, 2007 chammack Initial Creation.
* Apr 9, 2009 1288 rjpeter Added iterator implementation to fix remove.
* ------------- -------- ----------- --------------------------
* Sep 05, 2007 chammack Initial Creation.
* Apr 09, 2009 1288 rjpeter Added iterator implementation to fix
* remove.
* Apr 24, 2013 1950 bsteffen Sort resources before instantiation.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -67,8 +68,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
* @version 1
*/
@XmlAccessorType(XmlAccessType.NONE)
public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
ISerializableObject {
public class ResourceList extends CopyOnWriteArrayList<ResourcePair> {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ResourceList.class);

View file

@ -25,7 +25,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
/**
@ -36,9 +35,10 @@ import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation.
* 3/5/08 2032 jsanchez Initialized pdProps.
* ------------- -------- ----------- --------------------------
* Jul 01, 2006 chammack Initial Creation.
* Mar 05, 2008 2032 jsanchez Initialized pdProps.
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -46,7 +46,7 @@ import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder;
*
*/
@XmlAccessorType(XmlAccessType.NONE)
public class ResourceProperties implements ISerializableObject {
public class ResourceProperties {
/** is the layer isVisible */
@XmlAttribute

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.viz.core.rsc.capabilities;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
@ -39,8 +38,10 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 2, 2009 chammack Initial creation
* ------------- -------- ----------- --------------------------
* Feb 02, 2009 chammack Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
*
* </pre>
*
@ -48,7 +49,7 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractCapability implements ISerializableObject {
public abstract class AbstractCapability {
/**
* The resource pointer. Primarily useful for communication with the

View file

@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
import com.raytheon.uf.common.style.level.Level.LevelType;
@ -40,8 +39,9 @@ import com.raytheon.uf.common.style.level.Level.LevelType;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 6, 2009 mschenke Initial creation
* ------------- -------- ----------- --------------------------
* Nov 06, 2009 mschenke Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -49,7 +49,7 @@ import com.raytheon.uf.common.style.level.Level.LevelType;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class HeightScale implements ISerializableObject {
public class HeightScale {
@XmlAccessorType(XmlAccessType.NONE)
public static enum ScaleType {

View file

@ -33,20 +33,21 @@ import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* TODO Add Description
* Collection of {@link HeightScale} objects used by the volume browser and
* several height displays to scale verticle data.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Nov 24, 2009 mschenke Initial creation
* Oct 22, 2013 2491 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -55,7 +56,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class HeightScales implements ISerializableObject {
public class HeightScales {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(HeightScales.class);

View file

@ -81,10 +81,4 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.reflections"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -308,6 +308,12 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.javassist"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.hibernate"
download-size="0"

View file

@ -24,10 +24,12 @@ import java.io.File;
import org.eclipse.swt.layout.FormData;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.procedures.Bundle;
/**
@ -37,8 +39,10 @@ import com.raytheon.uf.viz.core.procedures.Bundle;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2009 mschenke Initial creation
* ------------- -------- ----------- --------------------------
* Oct 08, 2009 mschenke Initial creation
* Oct 22, 2013 2491 bsteffen Unmarshal with Bundle.unmarshalBundle.
*
*
* </pre>
*
@ -58,22 +62,26 @@ public interface IInsetMapContainer {
/** Utility class for loading the inset map from a bundle */
public static class InsetMapUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(IInsetMapContainer.class);
public static IRenderableDisplay loadInsetMap(
IRenderableDisplay parentDisplay) {
File bundle = PathManagerFactory.getPathManager().getStaticFile(
"insetmap" + File.separator + "inset.xml");
try {
Bundle b = (Bundle) SerializationUtil
.jaxbUnmarshalFromXmlFile(bundle.getAbsolutePath());
Bundle b = Bundle.unmarshalBundle(bundle);
InsetMapRenderableDisplay display = (InsetMapRenderableDisplay) b
.getDisplays()[0];
display.getDescriptor().getResourceList().instantiateResources(
display.getDescriptor(), true);
display.getDescriptor().getResourceList()
.instantiateResources(display.getDescriptor(), true);
display.setExtent(new PixelExtent(0, 1000, 0, 1000));
display.setParentDisplay(parentDisplay);
return display;
} catch (SerializationException e) {
e.printStackTrace();
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
return null;
}

View file

@ -35,7 +35,6 @@ import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.DescriptorMap;
@ -47,6 +46,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.maps.MapManager;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.viz.hydrocommon.actions.SetProjection;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
@ -72,11 +72,13 @@ import com.vividsolutions.jts.geom.Coordinate;
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Aug 21, 2008 randerso Initial creation
* Feb 18, 2010 4111 snaples Updated to support contexts
* Apr 27, 2010 mschenke refactor for common perspective switching
* Jan 29, 2013 1550 mpduff Add ability to preload maps on open.
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
* </pre>
*
* @author randerso
@ -120,14 +122,13 @@ public class MPEPerspectiveManager extends AbstractCAVEPerspectiveManager {
public AbstractEditor openNewEditor() {
try {
// Unmarshal default bundle xml
Object unmarshalled = SerializationUtil.getJaxbManager()
.unmarshalFromXmlFile(
PathManagerFactory.getPathManager().getStaticFile(
Bundle b = ProcedureXmlManager.getInstance().unmarshal(
Bundle.class,
PathManagerFactory.getPathManager()
.getStaticFile(
MPE + IPathManager.SEPARATOR
+ "default-bundle.xml"));
if (unmarshalled instanceof Bundle) {
// Load Bundle to perspective window in new editor
Bundle b = (Bundle) unmarshalled;
String editorId = b.getEditor();
if (editorId != null) {
IRenderableDisplay[] displays = b.getDisplays();
@ -143,8 +144,7 @@ public class MPEPerspectiveManager extends AbstractCAVEPerspectiveManager {
// Get the maps configured for display at startup
String displayMaps = AppsDefaults.getInstance()
.getToken("mpe_display_maps",
"statesCounties");
.getToken("mpe_display_maps", "statesCounties");
if (displayMaps.contains(",")) {
maps = displayMaps.split(",");
@ -157,8 +157,7 @@ public class MPEPerspectiveManager extends AbstractCAVEPerspectiveManager {
.getActiveVizContainer();
MapManager mapMgr = MapManager
.getInstance((IMapDescriptor) currentEditor
.getActiveDisplayPane()
.getDescriptor());
.getActiveDisplayPane().getDescriptor());
// Load the configured maps
for (String map : maps) {
@ -175,14 +174,6 @@ public class MPEPerspectiveManager extends AbstractCAVEPerspectiveManager {
"No displays to load found in MPE default bundle XML");
}
}
} else {
throw new SerializationException(
"Unexpected type deserialied from mpe bundle file. Expected "
+ Bundle.class.getSimpleName()
+ ", got "
+ (unmarshalled != null ? unmarshalled
.getClass().getSimpleName() : null));
}
} catch (Exception e) {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Error opening new MPE editor: " + e.getLocalizedMessage(),

View file

@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
config.xml,\
localization/
localization/,\
res/

View file

@ -19,21 +19,19 @@
**/
package com.raytheon.viz.radar.rsc.mosaic;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.SerializationUtil;
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.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.uf.viz.core.rsc.ResourceGroup;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.viz.radar.Activator;
/**
* Use a base resource, a substitution key and a comma separated list of
@ -50,8 +48,10 @@ import com.raytheon.viz.radar.Activator;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Sep 29, 2010 bsteffen Initial creation
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
*
* </pre>
*
@ -78,20 +78,22 @@ public class RadarMosaicResourceFactory extends AbstractMosaicResourceFactory {
*/
@Override
public ResourceList getResourceList() {
try {
ProcedureXmlManager jaxb = ProcedureXmlManager.getInstance();
ResourceList resourceList = new ResourceList();
// Put the base resource in a group so it can be serialized
ResourceGroup baseGroup = new ResourceGroup();
baseGroup.getResourceList().add(resource);
String baseXml = SerializationUtil.marshalToXml(baseGroup);
try {
String baseXml = jaxb.marshal(baseGroup);
resourceList.clear();
for (String icao : substitutionValues.split(",")) {
String xml = baseXml.replace(substitutionKey, icao);
resourceList.add(((ResourceGroup) SerializationUtil
.unmarshalFromXml(xml)).getResourceList().get(0));
resourceList.add(jaxb
.unmarshal(ResourceGroup.class, xml)
.getResourceList().get(0));
}
return resourceList;
} catch (JAXBException e) {
} catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM, e
.getLocalizedMessage(), e);
}

View file

@ -24,15 +24,13 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.eclipse.ui.IWorkbenchWindow;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.menus.xml.CommonBundleMenuContribution;
import com.raytheon.uf.common.menus.xml.VariableSubstitution;
import com.raytheon.uf.common.serialization.SerializationUtil;
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;
@ -47,6 +45,7 @@ import com.raytheon.uf.viz.core.globals.IGlobalChangedListener;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceGroup;
import com.raytheon.uf.viz.core.rsc.URICatalog;
@ -58,15 +57,19 @@ import com.raytheon.viz.ui.EditorUtil;
/**
*
* TODO Add Description
* Custom bundle contribution item for satellite so it has the ability to
* determine available times differently depending on scale by using a
* {@link SatBestResResourceData} to determine which resources are best to load.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Aug 26, 2011 bsteffen Initial creation
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
*
* </pre>
*
@ -102,8 +105,9 @@ public class SatBundleContributionItem extends BundleContributionItem {
pair.setResourceData(resourceData);
ResourceGroup group = new ResourceGroup();
group.getResourceList().add(pair);
String xml = SerializationUtil.marshalToXml(group);
group = (ResourceGroup) SerializationUtil.unmarshalFromXml(xml);
ProcedureXmlManager jaxb = ProcedureXmlManager.getInstance();
String xml = jaxb.marshal(group);
group = jaxb.unmarshal(ResourceGroup.class, xml);
resourceData = (AbstractRequestableResourceData) group
.getResourceList().get(0).getResourceData();
// get the available times
@ -129,7 +133,7 @@ public class SatBundleContributionItem extends BundleContributionItem {
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} catch (JAXBException e) {
} catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}

View file

@ -36,9 +36,12 @@ import com.raytheon.viz.ui.panes.DrawCoordinatorJob;
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation.
* Oct 27, 2009 #2354 bsteffen Added preferences to ui plugin
* ------------- -------- ----------- --------------------------
* Jul 01, 2006 chammack Initial Creation.
* Oct 27, 2009 2354 bsteffen Added preferences to ui plugin
* Oct 24, 2012 2491 bsteffen Do not start DrawCoordinatorJob during
* activation to allow activation before
* localization is set.
*
*
* </pre>
@ -67,7 +70,6 @@ public class UiPlugin extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
DrawCoordinatorJob.getInstance();
}
/**

View file

@ -38,7 +38,6 @@ import org.eclipse.ui.internal.EditorAreaHelper;
import org.eclipse.ui.internal.EditorReference;
import org.eclipse.ui.internal.WorkbenchPage;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -49,6 +48,7 @@ import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.procedures.Procedure;
import com.raytheon.uf.viz.core.procedures.ProcedureXmlManager;
import com.raytheon.viz.ui.BundleLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.VizWorkbenchManager;
@ -61,9 +61,11 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 6, 2010 mschenke Initial creation
* ------------- -------- ----------- --------------------------
* Apr 06, 2010 mschenke Initial creation
* Mar 21, 2013 1638 mschenke Added method to load procedure to window
* Oct 22, 2013 2491 bsteffen Switch serialization to
* ProcedureXmlManager
*
* </pre>
*
@ -113,7 +115,8 @@ public class LoadSerializedXml extends AbstractHandler {
public static Object deserialize(File fileName) {
Object obj = null;
try {
obj = SerializationUtil.jaxbUnmarshalFromXmlFile(fileName);
obj = ProcedureXmlManager.getInstance().unmarshal(
Object.class, fileName);
} catch (Exception e) {
String errMsg = "Error occurred during xml deserialization";
statusHandler.handle(Priority.CRITICAL, errMsg, e);

View file

@ -3,7 +3,6 @@
<classpathentry exported="true" kind="lib" path="hibernate-spatial-1.0.jar" sourcepath="hibernate-spatial-1.0-source.zip"/>
<classpathentry exported="true" kind="lib" path="hibernate-spatial-postgis-1.0.jar" sourcepath="hibernate-spatial-1.0-source.zip"/>
<classpathentry exported="true" kind="lib" path="hibernate3.5.6-Final.jar" sourcepath="hibernate-3.5.6-Final-source.zip"/>
<classpathentry exported="true" kind="lib" path="javassist-3.9.0.GA.jar"/>
<classpathentry exported="true" kind="lib" path="jta-1.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View file

@ -6,7 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: hibernate-spatial-1.0.jar,
hibernate-spatial-postgis-1.0.jar,
hibernate3.5.6-Final.jar,
javassist-3.9.0.GA.jar,
jta-1.1.jar
Bundle-Vendor: Hibernate
Export-Package: org.hibernate,
@ -184,4 +183,5 @@ Export-Package: org.hibernate,
org.hibernatespatial.postgis,
org.hibernatespatial.readers,
org.hibernatespatial.spi
Require-Bundle: org.slf4j
Require-Bundle: org.slf4j,
org.javassist;bundle-version="3.9.0"

View file

@ -2,5 +2,4 @@ bin.includes = META-INF/,\
hibernate-spatial-1.0.jar,\
hibernate-spatial-postgis-1.0.jar,\
hibernate3.5.6-Final.jar,\
javassist-3.9.0.GA.jar,\
jta-1.1.jar

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry exported="true" kind="lib" path="javassist-3.9.0.GA.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

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

View file

@ -0,0 +1,24 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Javassist
Bundle-SymbolicName: org.javassist
Bundle-Version: 3.9.0.GA
Bundle-ClassPath: javassist-3.9.0.GA.jar
Export-Package: javassist,
javassist.bytecode,
javassist.bytecode.analysis,
javassist.bytecode.annotation,
javassist.bytecode.stackmap,
javassist.compiler,
javassist.compiler.ast,
javassist.convert,
javassist.expr,
javassist.runtime,
javassist.scopedpool,
javassist.tools,
javassist.tools.reflect,
javassist.tools.rmi,
javassist.tools.web,
javassist.util,
javassist.util.proxy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -0,0 +1,2 @@
bin.includes = META-INF/,\
javassist-3.9.0.GA.jar

View file

@ -11,3 +11,5 @@ Export-Package: org.reflections,
org.reflections.util,
org.reflections.vfs
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.google.guava;bundle-version="1.0.0",
org.javassist;bundle-version="3.9.0"

View file

@ -277,6 +277,12 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.javassist"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.hibernate"
download-size="0"
@ -399,4 +405,10 @@
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.reflections"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -16,5 +16,7 @@ Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.adapters,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.serialization.jaxb,
com.raytheon.uf.common.serialization.reflect,
com.raytheon.uf.common.serialization.thrift
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -0,0 +1,193 @@
/**
* 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.serialization.jaxb;
import java.io.File;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.raytheon.uf.common.serialization.reflect.ISubClassLocator;
/**
* Locate all classes that can be used in a JAXB contexts. This class uses an
* {@link ISubClassLocator} to dynamically find all possible subtypes of every
* class used in a JAXB context. For most xml types this would be overkill but
* for some advanced types that allow dynamic class types with the xsi:type
* field this can be useful for building a complete context.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 22, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class JAXBClassLocator {
private ISubClassLocator locator;
private Set<Class<?>> processed = new HashSet<Class<?>>(512);
private List<Class<?>> included = new ArrayList<Class<?>>(512);
private JAXBClassLocator(ISubClassLocator locator, Class<?> rootClass) {
this.locator = locator;
processed.addAll(getBuiltinTypes());
processClass(rootClass);
}
private void processClass(Class<?> clazz) {
if (!processed.add(clazz)) {
return;
}
if (clazz.isPrimitive() || clazz.isEnum() || clazz.isInterface()) {
return;
}
if (clazz.isArray()) {
processClass(clazz.getComponentType());
return;
}
if (clazz.getName().contains("$")
&& !clazz.isAnnotationPresent(XmlType.class)) {
return;
}
included.add(clazz);
Class<?> zuper = clazz.getSuperclass();
if (zuper == Object.class) {
/* Found a "base" class, search for subclasses */
if (!Modifier.isFinal(clazz.getModifiers())) {
for (Class<?> sub : locator.locateSubClasses(clazz)) {
processClass(sub);
}
}
} else {
processClass(zuper);
}
for (Field field : clazz.getDeclaredFields()) {
processField(field);
}
for (Method method : clazz.getDeclaredMethods()) {
processMethod(method);
}
}
private void processField(Field field) {
if (isXmlElement(field)) {
Class<?> type = field.getType();
if (Collection.class.isAssignableFrom(type)) {
handleCollectionType(field.getGenericType());
} else {
processClass(field.getType());
}
}
}
private void processMethod(Method method) {
if (isXmlElement(method)) {
Class<?> returnType = method.getReturnType();
if (returnType != void.class) {
/* Getter */
processClass(returnType);
} else if (Collection.class.isAssignableFrom(returnType)) {
handleCollectionType(method.getGenericReturnType());
} else {
Class<?>[] tp = method.getParameterTypes();
if (tp.length == 1) {
/* Setter */
if (Collection.class.isAssignableFrom(tp[0])) {
handleCollectionType(method.getGenericParameterTypes()[0]);
} else {
processClass(tp[0]);
}
}
}
}
}
private void handleCollectionType(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;
Type[] args = ptype.getActualTypeArguments();
if (args.length == 1 && args[0] instanceof Class) {
processClass((Class<?>) args[0]);
}
} else if (type instanceof Class) {
handleCollectionType(((Class<?>) type).getGenericSuperclass());
}
}
private Collection<Class<?>> getResults() {
return included;
}
private static boolean isXmlElement(AnnotatedElement element) {
return element.isAnnotationPresent(XmlElement.class)
&& !element.isAnnotationPresent(XmlJavaTypeAdapter.class);
}
/**
* A base set of classes for which we don't need to find subclasses or
* reflect on the fields.
*
* @return
*/
private static Collection<Class<?>> getBuiltinTypes() {
return Arrays.<Class<?>> asList(Boolean.class, Byte.class, Short.class,
Integer.class, Long.class, Float.class, Double.class,
String.class, Object.class, Class.class, File.class);
}
/**
* Dynamically find all classes that can possibly appear in an xml document
* rooted in baseClass.
*
* @param locator
* used for finding subclasses
* @param rootClass
* the root cml object
* @return all classes that are can be in the xml.
*/
public static Collection<Class<?>> getJAXBClasses(ISubClassLocator locator,
Class<?> baseClass) {
return new JAXBClassLocator(locator, baseClass).getResults();
}
}

View file

@ -0,0 +1,53 @@
/**
* 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.serialization.reflect;
import java.util.Collection;
/**
* Interface indicating an object is capable of looking up subclassed based off
* of a known parent class. Generally this must be implemented using advanced
* reflection mechanisms that are heavily dependendant on the type of runtime
* and will ned to be different on edex and cave.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 23, 2013 2491 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public interface ISubClassLocator {
/**
* Determine all subclasses of a given class.
*
* @param base
* a class
* @return all subclasses of base.
*/
public Collection<Class<?>> locateSubClasses(Class<?> base);
}

View file

@ -189,10 +189,4 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.reflections"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.4.1",
gov.noaa.nws.ncep.viz.common,
gov.noaa.nws.ncep.viz.localization,
gov.noaa.nws.ncep.viz.rsc.pgen;bundle-version="1.0.0",
com.raytheon.uf.common.sounding
com.raytheon.uf.common.sounding,
com.raytheon.viz.core.graphing
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.edex.plugin.modelsounding.common,
@ -35,7 +36,6 @@ Import-Package: com.raytheon.edex.plugin.modelsounding.common,
com.raytheon.uf.viz.d2d.core.time,
com.raytheon.uf.viz.d2d.ui.perspectives,
com.raytheon.uf.viz.sounding,
com.raytheon.viz.core.graphing,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.common.dataplugin.ncuair,
gov.noaa.nws.ncep.edex.common.ncinventory,

View file

@ -12,6 +12,8 @@
* ------- ------- -------- -----------
* 05/02/2012 229 Chin Chen Initial coding for multiple display panes implementation
* 03/11/2013 972 Greg Hull rm paneNumber
* 03/11/2013 2491 bsteffen extend IDescriptor derictly for better serialization detection.
*
* </pre>
*
@ -32,10 +34,12 @@ import org.geotools.referencing.crs.DefaultEngineeringCRS;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.graphing.GraphDescriptor;
@XmlAccessorType(XmlAccessType.NONE)
public class NsharpAbstractPaneDescriptor extends GraphDescriptor {
public class NsharpAbstractPaneDescriptor extends GraphDescriptor implements
IDescriptor {
// @XmlElement
// protected int paneNumber;

View file

@ -1,125 +0,0 @@
/*****************************************************************************************
* COPYRIGHT (c), 2008, RAYTHEON COMPANY
* ALL RIGHTS RESERVED, An Unpublished Work
*
* RAYTHEON PROPRIETARY
* If the end user is not the U.S. Government or any agency thereof, use
* or disclosure of data contained in this source code file is subject to
* the proprietary restrictions set forth in the Master Rights File.
*
* U.S. GOVERNMENT PURPOSE RIGHTS NOTICE
* If the end user is the U.S. Government or any agency thereof, this source
* code is provided to the U.S. Government with Government Purpose Rights.
* Use or disclosure of data contained in this source code file is subject to
* the "Government Purpose Rights" restriction in the Master Rights File.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* Use or disclosure of data contained in this source code file is subject to
* the export restrictions set forth in the Master Rights File.
******************************************************************************************/
package gov.noaa.nws.ncep.viz.rsc.ncgrid.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
/**
* Loads properties to have different display types (Image, Contour etc..) for
* grid data.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* July 18, 2008 #1280 S. Manoj Initial creation
*
* </pre>
*
* @author smanoj
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class GridLoadProperties extends LoadProperties {
/**
* Display type for a grid data(Image, Contour etc...)
*/
@XmlAttribute
private DisplayType displayType;
public GridLoadProperties() {
this.displayType = DisplayType.CONTOUR;
}
/**
* Constructor
*
* @param displayType
*/
public GridLoadProperties(DisplayType displayType) {
this.displayType = displayType;
}
/**
* Returns the display type.
*
* @return displayType
*/
public DisplayType getDisplayType() {
return displayType;
}
/**
* Sets the display type.
*
* @param displayType
*/
public void setDisplayType(DisplayType displayType) {
this.displayType = displayType;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result
+ ((displayType == null) ? 0 : displayType.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
GridLoadProperties other = (GridLoadProperties) obj;
if (displayType == null) {
if (other.displayType != null) {
return false;
}
} else if (!displayType.equals(other.displayType)) {
return false;
}
return true;
}
}

View file

@ -14,15 +14,14 @@ Require-Bundle: org.eclipse.ui,
gov.noaa.nws.ncep.viz.common;bundle-version="1.0.0",
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
gov.noaa.nws.ncep.viz.localization;bundle-version="1.0.0",
com.raytheon.uf.common.style;bundle-version="1.0.0"
com.raytheon.uf.common.style;bundle-version="1.0.0",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: gov.noaa.nws.ncep.viz.ui.display
Import-Package: com.raytheon.uf.common.topo,
com.raytheon.uf.viz.core.maps,
com.raytheon.uf.viz.core.maps.display,
com.raytheon.uf.viz.core.rsc.legend,
com.raytheon.viz.core.graphing,
gov.noaa.nws.ncep.gempak.parameters.colorbar,
javax.measure.unit,
javax.vecmath