Merge "Issue #2725 deriv param to common stage 1" into development
Former-commit-id:12892db76a
[formerlyc3b7ae533e
[formerly 128141724c41850d4ced50efc1edf2c3019604cb]] Former-commit-id:c3b7ae533e
Former-commit-id:4784c24db0
This commit is contained in:
commit
02b4e16810
17 changed files with 205 additions and 166 deletions
|
@ -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;
|
||||
|
|
|
@ -3,4 +3,4 @@ output.. = bin/
|
|||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
localization/,\
|
||||
plugin.xml
|
||||
res/
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.derivparam.functionType">
|
||||
<functionType
|
||||
adapter="com.raytheon.uf.viz.derivparam.python.DerivParamPythonFunctionAdapter"
|
||||
extension="py"
|
||||
name="Python">
|
||||
</functionType>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -0,0 +1,14 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="pythonDerParFunctionAdapter"
|
||||
class="com.raytheon.uf.viz.derivparam.python.DerivParamPythonFunctionAdapter" />
|
||||
|
||||
<bean id="registeredPythonDerParFunctionAdapter"
|
||||
class="com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator"
|
||||
factory-method="addFunctionAdapter">
|
||||
<constructor-arg ref="pythonDerParFunctionAdapter" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -933,10 +935,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
endCount += 1;
|
||||
nodes.add(target);
|
||||
}
|
||||
SortedSet<Level> levels = LevelUtilities
|
||||
.getOrderedSetOfStandardLevels(
|
||||
level.getMasterLevel().getName()).subSet(
|
||||
lowerLevel, false, upperLevel, false);
|
||||
SortedSet<Level> 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<Level> 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,
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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++) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, DerivParamDesc> 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<DerivParamFunctionType> functionTypes = new ArrayList<DerivParamFunctionType>(
|
||||
1);
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor arg0) {
|
||||
Collection<DerivParamUpdateListener> l = null;
|
||||
synchronized (listeners) {
|
||||
l = new ArrayList<DerivParamUpdateListener>(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<DerivParamFunctionType> functionTypes = new ArrayList<DerivParamFunctionType>();
|
||||
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<DerivParamUpdateListener> theListeners,
|
||||
final Map<String, DerivParamDesc> theDerParLibrary) {
|
||||
Thread notifyJob = new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<DerivParamUpdateListener> l = null;
|
||||
synchronized (listeners) {
|
||||
l = new ArrayList<DerivParamUpdateListener>(listeners);
|
||||
}
|
||||
for (DerivParamUpdateListener listener : l) {
|
||||
listener.updateDerParLibrary(derParLibrary);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
execService.submit(notifyJob);
|
||||
}
|
||||
|
||||
public Map<String, DerivParamDesc> getLibrary() {
|
||||
initLibrary();
|
||||
return derParLibrary;
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -697,8 +700,13 @@ public class GridInventory extends AbstractInventory implements
|
|||
String masterLevelName = get3DMasterLevel(sNode.getValue());
|
||||
boolean isRadar = sNode.getValue().equals(RadarAdapter.RADAR_SOURCE);
|
||||
|
||||
NavigableSet<Level> levels = LevelUtilities
|
||||
.getOrderedSetOfStandardLevels(masterLevelName);
|
||||
NavigableSet<Level> levels;
|
||||
try {
|
||||
levels = LevelUtilities
|
||||
.getOrderedSetOfStandardLevels(masterLevelName);
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
List<CubeLevel<AbstractRequestableNode, AbstractRequestableNode>> cubeLevels = new ArrayList<CubeLevel<AbstractRequestableNode, AbstractRequestableNode>>(
|
||||
levels.size());
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<Level> getOrderedSetOfStandardLevels(
|
||||
String masterLevelName) throws VizCommunicationException {
|
||||
String masterLevelName) throws CommunicationException {
|
||||
if (masterLevelToOrderedSet == null) {
|
||||
Comparator<Level> levelComparator = new Comparator<Level>() {
|
||||
|
||||
|
@ -125,13 +118,9 @@ public class LevelUtilities {
|
|||
};
|
||||
Map<String, NavigableSet<Level>> masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
|
||||
Set<Level> 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<Level> 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);
|
||||
}
|
Loading…
Add table
Reference in a new issue