Merge "Issue #2711 Get All levels from the database for derived parameters." into development

Former-commit-id: b238a853283cc1b71ce290b233db5f174e486c9f
This commit is contained in:
Richard Peter 2014-01-27 11:36:55 -06:00 committed by Gerrit Code Review
commit 5c1de78c24
7 changed files with 76 additions and 64 deletions

View file

@ -35,7 +35,7 @@ import java.util.concurrent.BlockingQueue;
import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory; import com.raytheon.uf.common.dataplugin.level.LevelFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.derivparam.tree.AbstractNode; import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.derivparam.tree.DataTree; import com.raytheon.uf.common.derivparam.tree.DataTree;
@ -80,9 +80,10 @@ import com.raytheon.uf.viz.derivparam.tree.UnionLevelNode;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Mar 17, 2010 bsteffen Initial creation * Mar 17, 2010 bsteffen Initial creation
* Jan 23, 2014 2711 bsteffen Get all levels from LevelFactory.
* *
* </pre> * </pre>
* *
@ -483,9 +484,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
protected Collection<Level> getAllLevels() { protected Collection<Level> getAllLevels() {
if (allLevels == null) { if (allLevels == null) {
try { try {
return LevelMappingFactory.getInstance( return LevelFactory.getInstance().getAllLevels();
LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
.getAllLevels();
} catch (CommunicationException e) { } catch (CommunicationException e) {
// TODO recover from this. // TODO recover from this.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),

View file

@ -2,22 +2,21 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Level Plug-in Bundle-Name: Level Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.level Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.level
Bundle-Version: 1.12.1174.qualifier Bundle-Version: 1.14.0.qualifier
Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Vendor: Raytheon Bundle-Vendor: Raytheon
Require-Bundle: javax.measure, Bundle-ActivationPolicy: lazy
javax.persistence, Bundle-RequiredExecutionEnvironment: JavaSE-1.6
org.apache.commons.lang, Eclipse-BuddyPolicy: registered
com.raytheon.uf.common.dataplugin, Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
com.raytheon.uf.common.localization, Require-Bundle: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.localization,
com.raytheon.uf.common.status, com.raytheon.uf.common.status,
com.raytheon.uf.common.util;bundle-version="1.12.1174" com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.util,
com.raytheon.uf.common.comm,
org.apache.commons.lang;bundle-version="2.3.0",
javax.measure
Export-Package: com.raytheon.uf.common.dataplugin.level, Export-Package: com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.level.mapping, com.raytheon.uf.common.dataplugin.level.mapping,
com.raytheon.uf.common.dataplugin.level.request com.raytheon.uf.common.dataplugin.level.request
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.comm,
org.hibernate.annotations

View file

@ -22,26 +22,27 @@ package com.raytheon.uf.common.dataplugin.level;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* Level * Container for holding multiple levels during serialization.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Sep 03, 2009 rjpeter Initial creation. * Sep 03, 2009 rjpeter Initial creation.
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
*
* </pre> * </pre>
* *
* @author rjpeter * @author rjpeter
* @version 1.0 * @version 1.0
*/ */
@DynamicSerialize @DynamicSerialize
public class LevelContainer implements ISerializableObject { public class LevelContainer {
@DynamicSerializeElement @DynamicSerializeElement
private List<Level> levels; private List<Level> levels;

View file

@ -21,6 +21,8 @@ package com.raytheon.uf.common.dataplugin.level;
import java.io.File; import java.io.File;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -54,10 +56,13 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Sep 03, 2009 rjpeter Initial creation. * Sep 03, 2009 rjpeter Initial creation.
* Jul 01, 2013 2142 njensen Remove apache.commons.logging * Jul 01, 2013 2142 njensen Remove apache.commons.logging
* Jan 23, 2014 2711 bsteffen Add getAllLevels.
*
*
* </pre> * </pre>
* *
* @author rjpeter * @author rjpeter
@ -107,22 +112,25 @@ public class LevelFactory {
retrievalAdapter = iter.next(); retrievalAdapter = iter.next();
} }
} catch (ServiceConfigurationError e) { } catch (ServiceConfigurationError e) {
// TODO Log error statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
e.printStackTrace();
} }
try { try {
loadAllMasterLevels(); loadAllMasterLevels();
} catch (CommunicationException e) { } catch (CommunicationException e) {
; // This is non-fatal, master levels should still be retrieved /*
// individually * This is non-fatal, master levels should still be retrieved
* individually
*/
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} }
try { try {
loadAllLevels(); loadAllLevels();
} catch (CommunicationException e) { } catch (CommunicationException e) {
; // This is non-fatal, master levels should still be retrieved /*
// individually * This is non-fatal, master levels should still be retrieved
* individually
*/
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} }
} }
@ -198,19 +206,27 @@ public class LevelFactory {
rval = loadLevel(requestedLevel); rval = loadLevel(requestedLevel);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} catch (ConversionException e) { } catch (ConversionException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} }
} else { } else {
statusHandler.warn("Requested level name [" + name statusHandler.warn("Requested level name [" + name
+ "] does not map to a defined level"); + "] does not map to a defined level");
// TODO throw level exception
} }
return rval; return rval;
} }
public Collection<Level> getAllLevels() throws CommunicationException {
if (hasRequestedAllLevels) {
loadAllLevels();
}
return new ArrayList<Level>(levelCacheById.values());
}
private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag) private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag)
throws CommunicationException { throws CommunicationException {
MasterLevel rval = null; MasterLevel rval = null;

View file

@ -27,21 +27,21 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* *
* TODO Add Description * Container for holding multiple master levels during serialization.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Nov 4, 2011 bsteffen Initial creation * Nov 04, 201 bsteffen Initial creation.
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
* *
* </pre> * </pre>
* *
@ -51,7 +51,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize @DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "masterLevelContainer") @XmlRootElement(name = "masterLevelContainer")
public class MasterLevelContainer implements ISerializableObject { public class MasterLevelContainer {
@XmlElement(name = "masterLevel") @XmlElement(name = "masterLevel")
@DynamicSerializeElement @DynamicSerializeElement

View file

@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.serialization.ISerializableObject;
/** /**
* Class defines a mapping from a display level to one or more database levels. * Class defines a mapping from a display level to one or more database levels.
@ -41,19 +40,21 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version * Nov 01, 2007 518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework. * Nov 16, 2009 3120 rjpeter Modifed to better integrate with level
* 11/21/2009 #3576 rjpeter Added group * framework.
* 04/17/2013 #1913 randerso Moved to common * Nov 21, 2009 3576 rjpeter Added group
* Apr 17, 2013 1913 randerso Moved to common
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
* *
* &#064;author smanoj * &#064;author smanoj
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement @XmlRootElement
public class LevelMapping implements ISerializableObject { public class LevelMapping {
@XmlAttribute @XmlAttribute
private String displayName = null; private String displayName = null;

View file

@ -29,8 +29,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/** /**
* *
* Class defines the XML file contains the level mapping information. * Class defines the XML file contains the level mapping information.
@ -40,11 +38,12 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version * Nov 01, 2007 518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Refactored to use factory and level mapping. * Nov 16, 2009 3120 rjpeter Refactored to use factory and level mapping.
* 04/17/2013 #1913 randerso Moved to common * Apr 17, 2013 1913 randerso Moved to common
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
* *
* @author smanoj * @author smanoj
* @version 1.0 * @version 1.0
@ -52,10 +51,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "LevelMappings") @XmlRootElement(name = "LevelMappings")
public class LevelMappingFile implements ISerializableObject { public class LevelMappingFile {
public static enum ParameterLevelType {
STANDARD, COMPOSITE, BINARY, XSECT, TSECT, VRTGPH, DIAGRAM, ALL, SURFACE
};
@XmlElements({ @XmlElement(name = "Level", type = LevelMapping.class) }) @XmlElements({ @XmlElement(name = "Level", type = LevelMapping.class) })
private List<LevelMapping> levelMappingFile; private List<LevelMapping> levelMappingFile;