diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
index c095712702..a6a8222e56 100644
--- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
@@ -39,6 +39,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.MapUtil;
@@ -52,7 +53,6 @@ import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.objectiveanalysis.rsc.OAGridTransformer;
import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/build.properties b/cave/com.raytheon.uf.viz.derivparam.python/build.properties
index 15f66d39dc..2bf56c0a7b 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/build.properties
+++ b/cave/com.raytheon.uf.viz.derivparam.python/build.properties
@@ -3,4 +3,4 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
localization/,\
- plugin.xml
+ res/
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/plugin.xml b/cave/com.raytheon.uf.viz.derivparam.python/plugin.xml
deleted file mode 100644
index 1e0c7dd789..0000000000
--- a/cave/com.raytheon.uf.viz.derivparam.python/plugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/res/spring/derived-parameters-python-spring.xml b/cave/com.raytheon.uf.viz.derivparam.python/res/spring/derived-parameters-python-spring.xml
new file mode 100644
index 0000000000..af077688c7
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/res/spring/derived-parameters-python-spring.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
index 70b1ca3caf..3913565791 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
@@ -49,6 +49,8 @@ import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
* Dec 16, 2010 mschenke Initial creation
* Jun 04, 2013 2041 bsteffen Switch derived parameters to use
* concurrent python for threading.
+ * Jan 30, 2014 #2725 ekladstrup Add name and extention get methods
+ * after removing RCP extention point
*
*
*
@@ -158,4 +160,25 @@ public class DerivParamPythonFunctionAdapter implements
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#getName()
+ */
+ @Override
+ public String getName() {
+ return "Python";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#getExtension()
+ */
+ @Override
+ public String getExtension() {
+ return "py";
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
index 6c835bd384..8f5b850e84 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
@@ -37,7 +37,8 @@ import com.raytheon.uf.viz.derivparam.DerivParamFunctionType.FunctionArgument;
* Dec 16, 2010 mschenke Initial creation
* Jun 04, 2013 2041 bsteffen Switch derived parameters to use
* concurrent python for threading.
- *
+ * Jan 30, 2014 #2725 ekladstrup Add name and extention get methods
+ * after removing RCP extention point
*
*
* @author mschenke
@@ -86,4 +87,18 @@ public interface IDerivParamFunctionAdapter {
* Stop the adapter and any child threads.
*/
public void shutdown();
+
+ /**
+ * Return the name of the function type
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Return the file extension of the function type
+ *
+ * @return
+ */
+ public String getExtension();
}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java
index a74326d05a..629e97a791 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java
@@ -37,11 +37,11 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
+import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.datastructure.DefaultDataCubeAdapter;
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.inv.AvailabilityContainer;
import com.raytheon.uf.viz.derivparam.inv.MetadataContainer;
import com.raytheon.uf.viz.derivparam.inv.TimeAndSpace;
@@ -60,6 +60,7 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode;
* Jan 30, 2012 mschenke Initial creation
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
* empty requests for cached times
+ * Jan 30, 2014 #2725 ekladstrup Remove usage of ThriftClient
*
*
*
@@ -125,8 +126,13 @@ public abstract class AbstractDataCubeAdapter extends DefaultDataCubeAdapter {
if (!fullList.isEmpty()) {
DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(fullList.toArray(new DbQueryRequest[0]));
- DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
- .sendRequest(requestSet);
+ DbQueryResponseSet responseSet;
+ try {
+ responseSet = (DbQueryResponseSet) RequestRouter
+ .route(requestSet);
+ } catch (Exception e) {
+ throw new VizException(e);
+ }
responses = responseSet.getResults();
}
int responseIndex = 0;
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
index 8b71752e20..03e6a3ff20 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AbstractInventory.java
@@ -36,6 +36,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.LevelFactory;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.derivparam.tree.DataTree;
@@ -48,7 +49,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.data.FloatRequestableData;
import com.raytheon.uf.viz.derivparam.library.DerivParamConstantField;
@@ -84,6 +84,8 @@ import com.raytheon.uf.viz.derivparam.tree.UnionLevelNode;
* ------------- -------- ----------- --------------------------
* Mar 17, 2010 bsteffen Initial creation
* Jan 23, 2014 2711 bsteffen Get all levels from LevelFactory.
+ * Jan 30, 2014 #2725 ekladstrup handle different exceptions for moving
+ * derived parameters to common
*
*
*
@@ -933,10 +935,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
endCount += 1;
nodes.add(target);
}
- SortedSet levels = LevelUtilities
- .getOrderedSetOfStandardLevels(
- level.getMasterLevel().getName()).subSet(
- lowerLevel, false, upperLevel, false);
+ SortedSet levels = null;
+ try {
+ levels = LevelUtilities.getOrderedSetOfStandardLevels(
+ level.getMasterLevel().getName()).subSet(
+ lowerLevel, false, upperLevel, false);
+ } catch ( CommunicationException e ) {
+ throw new VizCommunicationException(e);
+ }
for (Level fieldLevel : levels) {
target = resolveNode(sourceNode, param, fieldLevel, stack,
nodata);
@@ -1070,15 +1076,19 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
}
} else {
SortedSet levels = null;
- if (type == LevelType.Upper) {
- levels = LevelUtilities.getOrderedSetOfStandardLevels(
- level.getMasterLevel().getName()).tailSet(level,
- false);
- } else {
- levels = LevelUtilities
- .getOrderedSetOfStandardLevels(
- level.getMasterLevel().getName())
- .headSet(level, false).descendingSet();
+ try {
+ if (type == LevelType.Upper) {
+ levels = LevelUtilities.getOrderedSetOfStandardLevels(
+ level.getMasterLevel().getName()).tailSet(
+ level, false);
+ } else {
+ levels = LevelUtilities
+ .getOrderedSetOfStandardLevels(
+ level.getMasterLevel().getName())
+ .headSet(level, false).descendingSet();
+ }
+ } catch ( CommunicationException e ) {
+ throw new VizCommunicationException(e);
}
for (Level l : levels) {
target = resolveNode(fieldSourceNode, fieldParamAbbrev, l,
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AvailabilityContainer.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AvailabilityContainer.java
index 345a4bd8f8..7725c986f4 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AvailabilityContainer.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/AvailabilityContainer.java
@@ -34,8 +34,8 @@ import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
+import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.tree.AbstractBaseDataNode;
import com.raytheon.uf.viz.derivparam.tree.AbstractDerivedDataNode;
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode;
@@ -56,6 +56,7 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode.Dependency;
* Apr 11, 2012 bsteffen Initial creation
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
* empty requests for cached times
+ * Jan 30, 2014 #2725 ekladstrup remove usage of ThriftClient
*
*
*
@@ -178,8 +179,13 @@ public class AvailabilityContainer {
if (!requests.isEmpty()) {
DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(requests.toArray(new DbQueryRequest[0]));
- DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
- .sendRequest(requestSet);
+ DbQueryResponseSet responseSet;
+ try {
+ responseSet = (DbQueryResponseSet) RequestRouter
+ .route(requestSet);
+ } catch (Exception e) {
+ throw new VizException(e);
+ }
DbQueryResponse[] responses = responseSet.getResults();
for (int i = 0; i < responses.length; i++) {
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/MetadataContainer.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/MetadataContainer.java
index b2833f77a0..c74eed296b 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/MetadataContainer.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/inv/MetadataContainer.java
@@ -32,8 +32,8 @@ import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
+import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.tree.AbstractBaseDataNode;
import com.raytheon.uf.viz.derivparam.tree.AbstractDerivedDataNode;
@@ -52,6 +52,7 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode.Dependency;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2012 bsteffen Initial creation
+ * Jan 30, 2014 #2725 ekladstrup remove usage of ThriftClient
*
*
*
@@ -223,8 +224,12 @@ public class MetadataContainer {
}
DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(requests.toArray(new DbQueryRequest[0]));
- DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
- .sendRequest(requestSet);
+ DbQueryResponseSet responseSet;
+ try {
+ responseSet = (DbQueryResponseSet) RequestRouter.route(requestSet);
+ } catch (Exception e) {
+ throw new VizException(e);
+ }
for (int i = 0; i < nodes.size(); i++) {
AbstractBaseDataNode node = nodes.get(i);
dataCache.put(node, node.getData(originalConstraints,
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
index 7e3d1cd01e..8f1e88cb4e 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
@@ -29,21 +29,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import javax.measure.unit.Unit;
import javax.xml.bind.JAXBException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.ui.services.IDisposable;
-
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
@@ -56,7 +47,6 @@ import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
-import com.raytheon.uf.viz.core.Activator;
import com.raytheon.uf.viz.derivparam.DerivParamFunctionType;
import com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter;
import com.raytheon.uf.viz.derivparam.library.DerivParamMethod.MethodType;
@@ -80,6 +70,9 @@ import com.raytheon.uf.viz.derivparam.library.DerivParamMethod.MethodType;
* concurrent python for threading.
* Nov 19, 2013 2361 njensen Only shutdown if initialized
* Jan 14, 2014 2661 bsteffen Shutdown using uf.viz.core.Activator
+ * Jan 30, 2014 #2725 ekladstrup Refactor to remove dependencies on
+ * eclipse runtime and support some configuration
+ * through spring
*
*
*
@@ -102,8 +95,6 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
public static final String XML_DIR = DERIV_PARAM_DIR + File.separator
+ DEFINITIONS;
- private static final String EXTENSION = "com.raytheon.uf.viz.derivparam.functionType";
-
public static interface DerivParamUpdateListener {
public void updateDerParLibrary(
Map derParLibrary);
@@ -123,21 +114,10 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
private String extension = null;
- private Job notifyJob = new Job("Notify Derived Parameter Listeners") {
+ protected static List functionTypes = new ArrayList(
+ 1);
- @Override
- protected IStatus run(IProgressMonitor arg0) {
- Collection l = null;
- synchronized (listeners) {
- l = new ArrayList(listeners);
- }
- for (DerivParamUpdateListener listener : l) {
- listener.updateDerParLibrary(derParLibrary);
- }
- return Status.OK_STATUS;
- }
-
- };
+ protected ExecutorService execService = null;
public static synchronized DerivedParameterGenerator getInstance() {
if (instance == null) {
@@ -146,34 +126,24 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
return instance;
}
+ /**
+ * Create a function type from the adapter and add it to the function type
+ * list
+ *
+ * @param adapter
+ * @return the adapter
+ */
+ public static IDerivParamFunctionAdapter addFunctionAdapter(
+ IDerivParamFunctionAdapter adapter) {
+ DerivParamFunctionType functionType = new DerivParamFunctionType();
+ functionType.setName(adapter.getName());
+ functionType.setExtension(adapter.getExtension());
+ functionType.setAdapter(adapter);
+ functionTypes.add(functionType);
+ return adapter;
+ }
+
public static DerivParamFunctionType[] getFunctionTypes() {
- List functionTypes = new ArrayList();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- if (registry != null) {
- IExtensionPoint point = registry.getExtensionPoint(EXTENSION);
-
- IExtension[] extensions = point.getExtensions();
-
- for (IExtension ext : extensions) {
- IConfigurationElement[] config = ext.getConfigurationElements();
-
- for (IConfigurationElement cfg : config) {
- try {
- DerivParamFunctionType functionType = new DerivParamFunctionType();
- functionType.setName(cfg.getAttribute("name"));
- functionType
- .setExtension(cfg.getAttribute("extension"));
- functionType
- .setAdapter((IDerivParamFunctionAdapter) cfg
- .createExecutableExtension("adapter"));
- functionTypes.add(functionType);
- } catch (Throwable t) {
- statusHandler.handle(Priority.DEBUG,
- t.getLocalizedMessage(), t);
- }
- }
- }
- }
return functionTypes.toArray(new DerivParamFunctionType[0]);
}
@@ -189,6 +159,10 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
}
private DerivedParameterGenerator() {
+ // We shouldn't every be running more than one job at a time anyway, but
+ // use an executor service just in case we want to tweak things later.
+ execService = Executors.newSingleThreadExecutor();
+
DerivParamFunctionType[] functionTypes = getFunctionTypes();
if (functionTypes == null || functionTypes.length == 0) {
@@ -196,16 +170,9 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
"Error creating derived parameter function type,"
+ " derived paramters will not be available");
}
- Activator.getDefault().registerDisposable(new IDisposable() {
- @Override
- public void dispose() {
- shutdown();
- }
- });
this.adapter = functionTypes[0].getAdapter();
this.extension = functionTypes[0].getExtension();
- notifyJob.setSystem(true);
LocalizationFile dir = PathManagerFactory.getPathManager()
.getStaticLocalizationFile(DERIV_PARAM_DIR);
if (dir != null) {
@@ -306,7 +273,7 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
this.derParLibrary = derParLibrary;
adapter.init();
- notifyJob.schedule();
+ scheduleNotifyJob(listeners, derParLibrary);
System.out.println("time to init derived parameters: "
+ (System.currentTimeMillis() - start) + "ms");
@@ -314,6 +281,33 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
}
}
+ /**
+ * Run the notification thread in the executor service.
+ *
+ * @param theListeners
+ * @param theDerParLibrary
+ */
+ protected void scheduleNotifyJob(
+ final Set theListeners,
+ final Map theDerParLibrary) {
+ Thread notifyJob = new Thread() {
+
+ @Override
+ public void run() {
+ Collection l = null;
+ synchronized (listeners) {
+ l = new ArrayList(listeners);
+ }
+ for (DerivParamUpdateListener listener : l) {
+ listener.updateDerParLibrary(derParLibrary);
+ }
+ }
+
+ };
+
+ execService.submit(notifyJob);
+ }
+
public Map getLibrary() {
initLibrary();
return derParLibrary;
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
index 50bf8419f4..f282178ca1 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GridInventory.java
@@ -33,6 +33,7 @@ import java.util.Map.Entry;
import java.util.NavigableSet;
import java.util.Set;
+import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.grid.GridInfoConstants;
import com.raytheon.uf.common.dataplugin.grid.GridInfoRecord;
@@ -41,6 +42,7 @@ import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup;
import com.raytheon.uf.common.dataplugin.grid.request.GetGridTreeRequest;
import com.raytheon.uf.common.dataplugin.grid.util.StaticGridDataType;
import com.raytheon.uf.common.dataplugin.level.Level;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
@@ -58,7 +60,6 @@ import com.raytheon.uf.viz.core.catalog.CatalogQuery;
import com.raytheon.uf.viz.core.catalog.DbQuery;
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.uf.viz.derivparam.inv.AbstractInventory;
@@ -91,6 +92,8 @@ import com.raytheon.viz.grid.util.RadarAdapter;
* Nov 21, 2009 #3576 rjpeter Refactored use of DerivParamDesc.
* Feb 26, 2013 1659 bsteffen Add time agnostic caching to grid derived
* parameters.
+ * Jan 30, 2014 #2725 ekladstrup updated exception handling during move of derived
+ * parameters to common
*
*
*
@@ -697,8 +700,13 @@ public class GridInventory extends AbstractInventory implements
String masterLevelName = get3DMasterLevel(sNode.getValue());
boolean isRadar = sNode.getValue().equals(RadarAdapter.RADAR_SOURCE);
- NavigableSet levels = LevelUtilities
- .getOrderedSetOfStandardLevels(masterLevelName);
+ NavigableSet levels;
+ try {
+ levels = LevelUtilities
+ .getOrderedSetOfStandardLevels(masterLevelName);
+ } catch (CommunicationException e) {
+ throw new VizCommunicationException(e);
+ }
List> cubeLevels = new ArrayList>(
levels.size());
diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java
index 8910499faf..5f398dab2a 100644
--- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java
+++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java
@@ -34,6 +34,7 @@ import com.raytheon.uf.common.dataplugin.grid.util.GridLevelTranslator;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -44,8 +45,6 @@ import com.raytheon.uf.common.style.StyleException;
import com.raytheon.uf.common.style.StyleManager;
import com.raytheon.uf.common.style.StyleRule;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
-import com.raytheon.uf.viz.core.exception.VizCommunicationException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@@ -83,6 +82,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Aug 20, 2013 2259 bsteffen Delete old skewt plugin.
* Sep 06, 2013 2251 mnash Move graph prefs style type to
* graph plugin
+ * Jan 30, 2014 #2725 ekladstrup updated exception handling during move of derived
+ * parameters to common
*
*
*
@@ -361,7 +362,7 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
try {
levels = LevelUtilities.getOrderedSetOfStandardLevels(planesKey
.replace("spatial-", ""));
- } catch (VizCommunicationException e) {
+ } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java
index 5aec51b76d..2c7831ab82 100644
--- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java
+++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractInventoryDataCatalog.java
@@ -40,12 +40,11 @@ import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapping;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
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.datastructure.DataCubeContainer;
-import com.raytheon.uf.viz.core.exception.VizCommunicationException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.derivparam.inv.AbstractInventory;
import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection;
import com.raytheon.viz.volumebrowser.vbui.MenuItemManager;
@@ -63,6 +62,8 @@ import com.raytheon.viz.volumebrowser.vbui.VolumeBrowserAction;
* ------------ ---------- ----------- --------------------------
* Apr 14, 2010 bsteffen Initial creation
* Jul 25, 2013 2112 bsteffen Fix volume browser sounding errors.
+ * Jan 30, 2014 #2725 ekladstrup updated exception handling during move of derived
+ * parameters to common
*
*
*
@@ -291,7 +292,7 @@ public abstract class AbstractInventoryDataCatalog extends AbstractDataCatalog {
levels = LevelUtilities
.getOrderedSetOfStandardLevels(plane.replace(
"spatial-", ""));
- } catch (VizCommunicationException e) {
+ } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GridDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GridDataCatalog.java
index 04fce05ce6..a18dab0e6f 100644
--- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GridDataCatalog.java
+++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/GridDataCatalog.java
@@ -39,6 +39,7 @@ import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
+import com.raytheon.uf.common.dataplugin.level.util.LevelUtilities;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.MapUtil;
@@ -47,9 +48,7 @@ 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.exception.VizCommunicationException;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.level.LevelUtilities;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceType;
@@ -85,6 +84,8 @@ import com.vividsolutions.jts.geom.LineString;
* Jul 31, 2012 875 rferrel Now uses points.
* May 30, 2013 2055 bsteffen Remove modelName from sounding pointName.
* Dec 06, 2013 2271 mpduff Added check for null coordinate.
+ * Jan 30, 2014 #2725 ekladstrup updated exception handling during move of derived
+ * parameters to common
*
*
*
@@ -349,7 +350,7 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
if (tilts != null) {
all.addAll(tilts);
}
- } catch (VizCommunicationException e) {
+ } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
try {
@@ -358,7 +359,7 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
if (pres != null) {
all.addAll(pres);
}
- } catch (VizCommunicationException e) {
+ } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
try {
@@ -367,7 +368,7 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
if (theta != null) {
all.addAll(theta);
}
- } catch (VizCommunicationException e) {
+ } catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF
index 98c92d655c..855a3e38aa 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/META-INF/MANIFEST.MF
@@ -19,4 +19,6 @@ Require-Bundle: com.raytheon.uf.common.dataplugin,
javax.measure
Export-Package: com.raytheon.uf.common.dataplugin.level,
com.raytheon.uf.common.dataplugin.level.mapping,
- com.raytheon.uf.common.dataplugin.level.request
+ com.raytheon.uf.common.dataplugin.level.request,
+ com.raytheon.uf.common.dataplugin.level.util
+Import-Package: com.raytheon.uf.common.comm
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/util/LevelUtilities.java
similarity index 75%
rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java
rename to edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/util/LevelUtilities.java
index ee065cd1cf..ce500e27f1 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/level/LevelUtilities.java
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/src/com/raytheon/uf/common/dataplugin/level/util/LevelUtilities.java
@@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
-package com.raytheon.uf.viz.core.level;
+package com.raytheon.uf.common.dataplugin.level.util;
import java.text.ParsePosition;
import java.util.Comparator;
@@ -36,7 +36,6 @@ import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
-import com.raytheon.uf.viz.core.exception.VizCommunicationException;
/**
* Level utilities
@@ -49,6 +48,8 @@ import com.raytheon.uf.viz.core.exception.VizCommunicationException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/21/2009 #3576 rjpeter Initial version
+ * 01/30/2014 #2725 ekladstrup Moved to common and removed
+ * usage of VizCommunicationException
*
*
* @author rjpeter
@@ -67,23 +68,15 @@ public class LevelUtilities {
}
public static boolean isPressureLevel(long levelId)
- throws VizCommunicationException {
- try {
- return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
- .getMasterLevel());
- } catch (CommunicationException e) {
- throw new VizCommunicationException(e);
- }
+ throws CommunicationException {
+ return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
+ .getMasterLevel());
}
public static boolean isPressureLevel(String masterLevelName)
- throws VizCommunicationException {
- try {
- return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
- masterLevelName));
- } catch (CommunicationException e) {
- throw new VizCommunicationException(e);
- }
+ throws CommunicationException {
+ return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
+ masterLevelName));
}
public static boolean isPressureLevel(Level level) {
@@ -106,7 +99,7 @@ public class LevelUtilities {
* @throws CommunicationException
*/
public synchronized static NavigableSet getOrderedSetOfStandardLevels(
- String masterLevelName) throws VizCommunicationException {
+ String masterLevelName) throws CommunicationException {
if (masterLevelToOrderedSet == null) {
Comparator levelComparator = new Comparator() {
@@ -125,13 +118,9 @@ public class LevelUtilities {
};
Map> masterLevelToOrderedSet = new HashMap>();
Set allLevels;
- try {
- allLevels = LevelMappingFactory.getInstance(
- LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
- .getAllLevels();
- } catch (CommunicationException e) {
- throw new VizCommunicationException(e);
- }
+ allLevels = LevelMappingFactory.getInstance(
+ LevelMappingFactory.VOLUMEBROWSER_LEVEL_MAPPING_FILE)
+ .getAllLevels();
for (Level level : allLevels) {
NavigableSet levels = masterLevelToOrderedSet.get(level
.getMasterLevel().getName());
@@ -142,12 +131,8 @@ public class LevelUtilities {
}
if (level.isRangeLevel()) {
- try {
- levels.add(level.getUpperLevel());
- levels.add(level.getLowerLevel());
- } catch (CommunicationException e) {
- throw new VizCommunicationException(e);
- }
+ levels.add(level.getUpperLevel());
+ levels.add(level.getLowerLevel());
} else {
levels.add(level);
}