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

View file

@ -2,22 +2,21 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Level Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.level
Bundle-Version: 1.12.1174.qualifier
Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: Raytheon
Require-Bundle: javax.measure,
javax.persistence,
org.apache.commons.lang,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.localization,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-BuddyPolicy: registered
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: com.raytheon.uf.common.dataplugin,
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.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,
com.raytheon.uf.common.dataplugin.level.mapping,
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.List;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Level
* Container for holding multiple levels during serialization.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Sep 03, 2009 rjpeter Initial creation.
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
@DynamicSerialize
public class LevelContainer implements ISerializableObject {
public class LevelContainer {
@DynamicSerializeElement
private List<Level> levels;

View file

@ -21,6 +21,8 @@ package com.raytheon.uf.common.dataplugin.level;
import java.io.File;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -55,9 +57,12 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Sep 03, 2009 rjpeter Initial creation.
* Jul 01, 2013 2142 njensen Remove apache.commons.logging
* Jan 23, 2014 2711 bsteffen Add getAllLevels.
*
*
* </pre>
*
* @author rjpeter
@ -107,22 +112,25 @@ public class LevelFactory {
retrievalAdapter = iter.next();
}
} catch (ServiceConfigurationError e) {
// TODO Log error
e.printStackTrace();
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
try {
loadAllMasterLevels();
} 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);
}
try {
loadAllLevels();
} 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);
}
}
@ -198,19 +206,27 @@ public class LevelFactory {
rval = loadLevel(requestedLevel);
} catch (ParseException e) {
e.printStackTrace();
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
} catch (ConversionException e) {
e.printStackTrace();
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
} else {
statusHandler.warn("Requested level name [" + name
+ "] does not map to a defined level");
// TODO throw level exception
}
return rval;
}
public Collection<Level> getAllLevels() throws CommunicationException {
if (hasRequestedAllLevels) {
loadAllLevels();
}
return new ArrayList<Level>(levelCacheById.values());
}
private MasterLevel loadMasterLevel(MasterLevel level, boolean createFlag)
throws CommunicationException {
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.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
* TODO Add Description
* Container for holding multiple master levels during serialization.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 4, 2011 bsteffen Initial creation
* ------------- -------- ----------- --------------------------
* Nov 04, 201 bsteffen Initial creation.
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
*
* </pre>
*
@ -51,7 +51,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "masterLevelContainer")
public class MasterLevelContainer implements ISerializableObject {
public class MasterLevelContainer {
@XmlElement(name = "masterLevel")
@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.dataplugin.level.Level;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Class defines a mapping from a display level to one or more database levels.
@ -42,18 +41,20 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework.
* 11/21/2009 #3576 rjpeter Added group
* 04/17/2013 #1913 randerso Moved to common
* ------------- -------- ----------- --------------------------
* Nov 01, 2007 518 S.Manoj Initial version
* Nov 16, 2009 3120 rjpeter Modifed to better integrate with level
* framework.
* 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
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class LevelMapping implements ISerializableObject {
public class LevelMapping {
@XmlAttribute
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.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
*
* Class defines the XML file contains the level mapping information.
@ -41,10 +39,11 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/01/2007 #518 S.Manoj Initial version
* 11/16/2009 #3120 rjpeter Refactored to use factory and level mapping.
* 04/17/2013 #1913 randerso Moved to common
* ------------- -------- ----------- --------------------------
* Nov 01, 2007 518 S.Manoj Initial version
* Nov 16, 2009 3120 rjpeter Refactored to use factory and level mapping.
* Apr 17, 2013 1913 randerso Moved to common
* Jan 23, 2014 2711 bsteffen Remove ISerializableObject
*
* @author smanoj
* @version 1.0
@ -52,10 +51,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "LevelMappings")
public class LevelMappingFile implements ISerializableObject {
public static enum ParameterLevelType {
STANDARD, COMPOSITE, BINARY, XSECT, TSECT, VRTGPH, DIAGRAM, ALL, SURFACE
};
public class LevelMappingFile {
@XmlElements({ @XmlElement(name = "Level", type = LevelMapping.class) })
private List<LevelMapping> levelMappingFile;