Commit 91fc011a authored by SAPONE Alann's avatar SAPONE Alann

unit test init

parent 2ac8b11f
......@@ -17,7 +17,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -17,8 +17,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
......
......@@ -34,18 +34,12 @@
package org.cnrs.lam.dis.etc.calculator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.JOptionPane;
import org.apache.log4j.Logger;
import org.cnrs.lam.cesam.util.calculator.CalculationException;
import org.cnrs.lam.cesam.util.calculator.ConfigurationException;
import org.cnrs.lam.cesam.util.calculator.InitializationException;
import org.cnrs.lam.dis.etc.calculator.exposuretime.ExposureTimeFactory;
import org.cnrs.lam.dis.etc.calculator.filterresponse.FilterTransmissionProfile;
import org.cnrs.lam.dis.etc.calculator.signaltonoise.SignalToNoiseFactory;
import org.cnrs.lam.dis.etc.calculator.util.FunctionToDatasetResultConverter;
import org.cnrs.lam.dis.etc.calculator.wavelengthrange.WavelengthRangeFactory;
......@@ -53,7 +47,6 @@ import org.cnrs.lam.dis.etc.configuration.ConfigFactory;
import org.cnrs.lam.dis.etc.datamodel.CalculationResults;
import org.cnrs.lam.dis.etc.datamodel.Dataset;
import org.cnrs.lam.dis.etc.datamodel.Dataset.Type;
import org.cnrs.lam.dis.etc.datamodel.DatasetInfo;
import org.cnrs.lam.dis.etc.datamodel.DatasetProvider;
import org.cnrs.lam.dis.etc.datamodel.ObsParam.FixedParameter;
import org.cnrs.lam.dis.etc.datamodel.Session;
......@@ -66,9 +59,7 @@ final class CalculatorImpl implements Calculator {
/** The logger of the class.*/
private static Logger logger = Logger.getLogger(CalculatorImpl.class.getName());
private Map<Double, Double> originalFilterTransmissionMap = new HashMap<Double, Double>();
// The following code will set the property to disable the cache if the configuration
// says so. Note that if the user has set the property from the command line
// his option is overriding the one in the configuration. Also note that this
......@@ -87,126 +78,14 @@ final class CalculatorImpl implements Calculator {
return false;
}
}
private Pair<Double, Double> getRange(Type type, DatasetInfo info, String option) {
Pair<Double, Double> lowHigh = null;
if (info != null) {
org.cnrs.lam.dis.etc.datamodel.Dataset dataSet = null;
if (option != null)
dataSet = DatasetProviderHolder.getDatasetProvider().getDataset(type, info, option);
else
dataSet = DatasetProviderHolder.getDatasetProvider().getDataset(type, info);
if (dataSet != null) {
Object[] keys = dataSet.getData().keySet().toArray();
lowHigh = new Pair<Double, Double>((Double) keys[0], (Double) keys[keys.length - 1]);
}
}
return lowHigh;
}
private Double getHighestLowValue(Double currentHighestValue, Double newValue) {
if (currentHighestValue == null) {
currentHighestValue = newValue;
} else {
currentHighestValue = Math.max(currentHighestValue, newValue);
}
return currentHighestValue;
}
private Double getLowestHighValue(Double currentLowestValue, Double newValue) {
if (currentLowestValue == null) {
currentLowestValue = newValue;
} else {
currentLowestValue = Math.min(currentLowestValue, newValue);
}
return currentLowestValue;
}
@Override
public CalculationResults performCalculation(Session session, DatasetProvider datasetProvider) throws CalculationError, ValidationError {
ResultsHolder.resetResults();
PreviousResultsHolder.setResults(ResultsHolder.getResults());
ResultsHolder.resetResults();
DatasetProviderHolder.setDatasetProvider(datasetProvider);
Double lowRange = Double.NEGATIVE_INFINITY;
Double highRange = Double.POSITIVE_INFINITY;
Double highestLowValue = Double.NEGATIVE_INFINITY;
Double lowestHighValue = Double.POSITIVE_INFINITY;
// Checking range...
// Getting instrument range
if (session.getInstrument().getInstrumentType() == InstrumentType.SPECTROGRAPH) {
lowRange = session.getInstrument().getRangeMin();
highRange = session.getInstrument().getRangeMax();
} else if (session.getInstrument().getInstrumentType() == InstrumentType.IMAGING) {
Pair<Double, Double> filterTransmissionRange = getRange(Type.FILTER_TRANSMISSION, session.getInstrument().getFilterTransmission(), null);
if (filterTransmissionRange != null) {
lowRange = filterTransmissionRange.getValue0();
highRange = filterTransmissionRange.getValue1();
}
}
// Getting site sky's ranges
if (session.getSite().getSkyEmission() != null) {
Pair<Double, Double> skyEmissionRange = getRange(Type.SKY_EMISSION, session.getSite().getSkyEmission(), session.getSite().getSkyEmissionSelectedOption());
highestLowValue = getHighestLowValue(highestLowValue, skyEmissionRange.getValue0());
lowestHighValue = getLowestHighValue(lowestHighValue, skyEmissionRange.getValue1());
}
if (session.getSite().getSkyAbsorption() != null) {
Pair<Double, Double> skyAbsorptionRange = getRange(Type.SKY_ABSORPTION, session.getSite().getSkyAbsorption(), null);
highestLowValue = getHighestLowValue(highestLowValue, skyAbsorptionRange.getValue0());
lowestHighValue = getLowestHighValue(lowestHighValue, skyAbsorptionRange.getValue1());
}
if (session.getSite().getSkyExtinction() != null) {
Pair<Double, Double> skyExtinctionRange = getRange(Type.SKY_EXTINCTION, session.getSite().getSkyExtinction(), null);
highestLowValue = getHighestLowValue(highestLowValue, skyExtinctionRange.getValue0());
lowestHighValue = getLowestHighValue(lowestHighValue, skyExtinctionRange.getValue1());
}
// If site's sky data aren't complete enough - Display error and troncate with exploitable data if agreed
if (lowRange < highestLowValue || highRange > lowestHighValue) {
Double highestPossibleLowRange = Math.max(highestLowValue, lowRange);
Double lowestPossibleHighRange = Math.min(lowestHighValue, highRange);
String instrumentType = (session.getInstrument().getInstrumentType() == InstrumentType.SPECTROGRAPH) ? "spectrograph" : "imaging";
String error = "The provided instrument " + instrumentType + " range (" + lowRange + " - " + highRange + ") is surpassing sky data ranges.";
error += "\n\rThe calculation can be made between the two following values : " + highestLowValue + " - " + lowestHighValue;
String question = "Do you wish to start the calculation in the truncated range : " + highestPossibleLowRange + " - " + lowestPossibleHighRange + " ?";
int dialogResult = JOptionPane.showConfirmDialog (null, error + "\n\r" + question, "Warning", JOptionPane.YES_NO_OPTION);
if(dialogResult == JOptionPane.YES_OPTION) {
if (session.getInstrument().getInstrumentType() == InstrumentType.SPECTROGRAPH) {
session.getInstrument().setRangeMin(highestPossibleLowRange);
session.getInstrument().setRangeMax(lowestPossibleHighRange);
} else {
Dataset dataSet = DatasetProviderHolder.getDatasetProvider().getDataset(Type.FILTER_TRANSMISSION, session.getInstrument().getFilterTransmission());
this.originalFilterTransmissionMap.putAll(dataSet.getData());
Iterator<Double> it = dataSet.getData().keySet().iterator();
while (it.hasNext())
{
Double x = it.next();
if (x < highestPossibleLowRange || x > lowestPossibleHighRange) {
it.remove();
}
}
}
} else {
throw new ValidationError(error);
}
}
// Set the range of the calculation
try {
Pair<Double, Double> range = new WavelengthRangeFactory().getCalculator(new Unit<Session>(session)).calculate(null);
......@@ -257,11 +136,6 @@ private Double getLowestHighValue(Double currentLowestValue, Double newValue) {
}
PreviousResultsHolder.setResults(ResultsHolder.getResults());
if (!this.originalFilterTransmissionMap.isEmpty() && session.getInstrument().getInstrumentType() == InstrumentType.IMAGING) {
Dataset dataSet = DatasetProviderHolder.getDatasetProvider().getDataset(Type.FILTER_TRANSMISSION, session.getInstrument().getFilterTransmission());
dataSet.getData().putAll(this.originalFilterTransmissionMap);
}
return ResultsHolder.getResults();
}
}
......@@ -33,15 +33,9 @@
*/
package org.cnrs.lam.dis.etc.calculator;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
......@@ -53,6 +47,7 @@ import org.cnrs.lam.cesam.util.calculator.ConfigurationException;
import org.cnrs.lam.cesam.util.calculator.ConstructionListener;
import org.cnrs.lam.cesam.util.calculator.InitializationException;
import org.cnrs.lam.dis.etc.datamodel.CalculationResults;
import org.cnrs.lam.dis.etc.datamodel.CalculationResults.Result;
import org.javatuples.Tuple;
/**
......@@ -81,7 +76,7 @@ public class EtcCalculatorManager <C extends Tuple, I extends Tuple, O extends T
* See {@link CalculatorManager#getManager(java.lang.Class)}.
*/
public static <C extends Tuple, I extends Tuple, O extends Tuple, T extends AbstractCalculator<C,I,O>> EtcCalculatorManager<C,I,O,T> getManager(Class<T> type) {
EtcCalculatorManager etcManager = new EtcCalculatorManager(CalculatorManager.getManager(type), type);
EtcCalculatorManager<C, I, O, T> etcManager = new EtcCalculatorManager<C, I, O, T>(CalculatorManager.getManager(type), type);
return etcManager;
}
......@@ -90,7 +85,7 @@ public class EtcCalculatorManager <C extends Tuple, I extends Tuple, O extends T
*/
public T getCalculator(C configuration) throws InitializationException, ConfigurationException {
// We create the real calculator and the cglib object
ConstructionSubResultsFix constructionListener = new ConstructionSubResultsFix<C,I,O>();
ConstructionSubResultsFix<C, I, O> constructionListener = new ConstructionSubResultsFix<C,I,O>();
T calculator = manager.getCalculator(configuration, constructionListener);
if (calculator.getCalculationListener() == null) {
calculator.setCalculationListener(new CalculationSubResultsFix<I, O>(constructionListener.getResultNameMap()));
......@@ -187,12 +182,15 @@ public class EtcCalculatorManager <C extends Tuple, I extends Tuple, O extends T
if (copyNeeded) {
for (CalculationResults.Level level : CalculationResults.Level.values()) {
for (String name : resultNameMap.get(level)) {
ResultsHolder.getResults().addResult(PreviousResultsHolder.getResults().getResultByName(name), level);
Result result = PreviousResultsHolder.getResults().getResultByName(name);
//System.out.println("result : " + result + " - input : " + input + " - output : " + output + " - name : " + name + " - level : " + level);
if (result != null) {
ResultsHolder.getResults().addResult(result, level);
}
}
}
}
}
}
private static Map<CalculationResults.Level, Set<String>> getResultNamesMap(CalculationResults results) {
......
......@@ -64,62 +64,57 @@ import org.javatuples.Unit;
/**
*/
public class SimulatedSignalFactory implements Factory<Unit<Session>,
Pair<Double, Double>, Pair<UnivariateRealFunction, UnivariateRealFunction>> {
public class SimulatedSignalFactory
implements Factory<Unit<Session>, Pair<Double, Double>, Pair<UnivariateRealFunction, UnivariateRealFunction>> {
private static final ResourceBundle bundle = ResourceBundle.getBundle("org/cnrs/lam/dis/etc/calculator/ValidationErrors");
private static final ResourceBundle bundle = ResourceBundle
.getBundle("org/cnrs/lam/dis/etc/calculator/ValidationErrors");
@Override
public Calculator<Pair<Double, Double>, Pair<UnivariateRealFunction, UnivariateRealFunction>> getCalculator(
Unit<Session> configuration) throws InitializationException, ConfigurationException {
ObsParam obsParam = configuration.getValue0().getObsParam();
switch (obsParam.getExtraSignalType()) {
case ONLY_EXTRA_SIGNAL:
ResultsHolder.getResults().addResult(
new CalculationResults.StringResult("SIMULATED_SIGNAL_METHOD", "Simulated signal ignored"),
CalculationResults.Level.DEBUG);
// System.out.println(ZeroSignal.class);
return EtcCalculatorManager.getManager(ZeroSignal.class).getCalculator(configuration);
case ONLY_CALCULATED_SIGNAL:
case CALCULATED_AND_EXTRA_SIGNAL:
ResultsHolder.getResults().addResult(
new CalculationResults.StringResult("SIMULATED_SIGNAL_METHOD", "Signal Flux"),
CalculationResults.Level.DEBUG);
// Calculator<Unit<Double>, Unit<Double>> convolutionKernel =
// new ConvolutionKernelSizeFactory().getCalculator(configuration);
Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>> convolutionKernelProducer = new SignalSpectralConvolutionKernelFactory()
.getCalculator(configuration);
Calculator<Tuple, Unit<UnivariateRealFunction>> flux = new FluxFactory().getCalculator(configuration);
Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>> normalizationFactor = new NormalizationFactorFactory()
.getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> atmosphericTransmission = new AtmosphericTransmissionFactory()
.getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> systemEfficiency = new SystemEfficiencyFactory()
.getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> filterResponse = new FilterResponseFactory()
.getCalculator(configuration);
Calculator<Tuple, Unit<Double>> telescopeArea = new TelescopeAreaFactory().getCalculator(configuration);
Septet<Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<UnivariateRealFunction>>, Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<Double>>> signalFluxConfiguration = new Septet<Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<UnivariateRealFunction>>, Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<Double>>>(
convolutionKernelProducer, flux, normalizationFactor, atmosphericTransmission, systemEfficiency,
filterResponse, telescopeArea);
// System.out.println(SignalFlux.class);
EtcCalculatorManager<Septet<Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<UnivariateRealFunction>>, Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<BoundedUnivariateFunction>>, Calculator<Tuple, Unit<Double>>>, Pair<Double, Double>, Pair<UnivariateRealFunction, UnivariateRealFunction>, SignalFlux> manager;manager = EtcCalculatorManager.getManager(SignalFlux.class);
SignalFlux calculator = manager.getCalculator(signalFluxConfiguration);
return calculator;
}
String message = bundle.getString("UNKNOWN_SIMULATED_SIGNAL_METHOD");
throw new ConfigurationException(message);
}
@Override
public Calculator<Pair<Double, Double>, Pair<UnivariateRealFunction, UnivariateRealFunction>>
getCalculator(Unit<Session> configuration) throws InitializationException, ConfigurationException {
ObsParam obsParam = configuration.getValue0().getObsParam();
switch (obsParam.getExtraSignalType()) {
case ONLY_EXTRA_SIGNAL:
ResultsHolder.getResults().addResult(new CalculationResults.StringResult(
"SIMULATED_SIGNAL_METHOD", "Simulated signal ignored"), CalculationResults.Level.DEBUG);
// System.out.println(ZeroSignal.class);
return EtcCalculatorManager.getManager(ZeroSignal.class).getCalculator(configuration);
case ONLY_CALCULATED_SIGNAL:
case CALCULATED_AND_EXTRA_SIGNAL:
ResultsHolder.getResults().addResult(new CalculationResults.StringResult(
"SIMULATED_SIGNAL_METHOD", "Signal Flux"), CalculationResults.Level.DEBUG);
// Calculator<Unit<Double>, Unit<Double>> convolutionKernel =
// new ConvolutionKernelSizeFactory().getCalculator(configuration);
Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>> convolutionKernelProducer =
new SignalSpectralConvolutionKernelFactory().getCalculator(configuration);
Calculator<Tuple, Unit<UnivariateRealFunction>> flux =
new FluxFactory().getCalculator(configuration);
Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>> normalizationFactor =
new NormalizationFactorFactory().getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> atmosphericTransmission =
new AtmosphericTransmissionFactory().getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> systemEfficiency =
new SystemEfficiencyFactory().getCalculator(configuration);
Calculator<Tuple, Unit<BoundedUnivariateFunction>> filterResponse =
new FilterResponseFactory().getCalculator(configuration);
Calculator<Tuple, Unit<Double>> telescopeArea =
new TelescopeAreaFactory().getCalculator(configuration);
Septet<Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<UnivariateRealFunction>>,
Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<Double>>> signalFluxConfiguration =
new Septet<Calculator<Unit<Double>, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<UnivariateRealFunction>>,
Calculator<Tuple, Pair<UnivariateRealFunction, UnivariateRealFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<BoundedUnivariateFunction>>,
Calculator<Tuple, Unit<Double>>>
(convolutionKernelProducer, flux, normalizationFactor, atmosphericTransmission,
systemEfficiency, filterResponse, telescopeArea);
// System.out.println(SignalFlux.class);
return EtcCalculatorManager.getManager(SignalFlux.class).getCalculator(signalFluxConfiguration);
}
String message = bundle.getString("UNKNOWN_SIMULATED_SIGNAL_METHOD");
throw new ConfigurationException(message);
}
}
......@@ -173,7 +173,8 @@ public class LinearFunctionDataset extends Dataset implements
*/
@Override
public Pair<Double, Double> getBounds() {
return super.getBounds();
Pair<Double, Double> bounds = super.getBounds();
return bounds;
}
/**
......
......@@ -165,7 +165,7 @@ public class TemplateFunctionDataset extends Dataset implements
// Check that the integration range is inside the bounds of the function
Pair<Double, Double> bounds = getBounds();
if (x2 > bounds.getValue1() || x1 < bounds.getValue0()) {
CautionMessage.getInstance().addMessage("INTEGRAL_OUT_OF_BOUNDS", bundle.getString("INTEGRAL_OUT_OF_BOUNDS"));
//CautionMessage.getInstance().addMessage("INTEGRAL_OUT_OF_BOUNDS", bundle.getString("INTEGRAL_OUT_OF_BOUNDS"));
//throw new FunctionEvaluationException(x2);
}
......
......@@ -163,8 +163,8 @@ public class Spectroscopy extends AbstractCalculator<Quartet<Double, String, Dou
* with code WAVELENGTH_MIN</li>
* <li>The calculated maximum wavelength in intermediate unimportant results
* with code WAVELENGTH_MAX</li>
* </ul>
* @param input
* </ul>
* @param output
*/
@Override
......
......@@ -17,7 +17,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -26,8 +26,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
......
......@@ -17,7 +17,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -15,8 +15,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
......
......@@ -161,7 +161,7 @@ final class BuisnessListenerImpl implements BuisnessListener {
// the user interface that the action is stoped (to give control
// back to the user) and we present an error message
logger.error("The calculation failed because: " + ex.getMessage(), ex);
messenger.error(ex.getMessage());
messenger.error("Error : " + ex.toString());
// We do not want to present any results, so we return here
} finally {
messenger.actionStoped(this);
......
......@@ -60,6 +60,7 @@ import org.cnrs.lam.dis.etc.dataimportexport.DataImporter;
import org.cnrs.lam.dis.etc.datamodel.FilterBand;
import org.cnrs.lam.dis.etc.persistence.DatasetManager;
import org.cnrs.lam.dis.etc.persistence.PersistenceFactory;
import org.cnrs.lam.dis.etc.ui.swing.SplashScreen;
import org.javatuples.Pair;
/**
......@@ -447,7 +448,11 @@ final class DbUpdater {
logger.info("Database is out of date (" + oldVersion + " instead of " +
DB_VERSION + ")");
// Ask for the user permission to update the database
int selection = JOptionPane.showConfirmDialog(null,
SplashScreen parent = null;
if (SplashScreen.getInstance().isVisible()) {
parent = SplashScreen.getInstance();
}
int selection = JOptionPane.showConfirmDialog(parent,
"Current installed database schema is out of date.\n" +
"Do you want me to update it?\n" +
"WARNING:\n" +
......
......@@ -37,15 +37,22 @@ import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JWindow;
import org.apache.log4j.Logger;
import org.cnrs.lam.dis.etc.configuration.ConfigFactory;
import org.cnrs.lam.dis.etc.ui.swing.SplashScreen;
/**
*
* @author Nikolaos Apostolakos
*/
final class Installer {
private static Logger logger = Logger.getLogger(Installer.class);
private static boolean newDatabase = false;
......@@ -69,13 +76,17 @@ final class Installer {
}
if (missingDatabase()) {
logger.info("Database is missing");
int selection = JOptionPane.showConfirmDialog(null,
SplashScreen parent = null;
if (SplashScreen.getInstance().isVisible()) {
parent = SplashScreen.getInstance();
}
int selection = JOptionPane.showConfirmDialog(parent,
"I cannot find any previous persistence installation. Do you want me to install the default?\n" +
"(If this is the first time you run ETC please select YES)\n" +
"WARNING:\n" +
"This operation will replace any data in the directory\n" +
ConfigFactory.getConfig().getEtcHome(),
null, JOptionPane.YES_NO_OPTION);
"Database needed", JOptionPane.YES_NO_OPTION);
if (selection == JOptionPane.YES_OPTION)
createDatabase();
else {
......
......@@ -12,7 +12,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -35,8 +35,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
......
......@@ -22,7 +22,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -15,8 +15,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
......
......@@ -22,7 +22,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7