Isis-fish-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
April 2009
- 7 participants
- 108 discussions
r2142 - in isis-fish/trunk: . src/main/java/fr/ifremer/isisfish/ui/input src/main/resources
by sletellier@users.labs.libre-entreprise.org 23 Apr '09
by sletellier@users.labs.libre-entreprise.org 23 Apr '09
23 Apr '09
Author: sletellier
Date: 2009-04-23 16:08:14 +0000 (Thu, 23 Apr 2009)
New Revision: 2142
Removed:
isis-fish/trunk/src/main/resources/log4j.properties
Modified:
isis-fish/trunk/
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
Log:
bug fixed
Property changes on: isis-fish/trunk
___________________________________________________________________
Name: svn:ignore
- maven.log
target
velocity.log
.classpath
.project
isis-fish.ipr
isis-fish.iws
isis-fish.iml
.settings
bin
+ maven.log
target
velocity.log
.classpath
.project
isis-fish.ipr
isis-fish.iws
isis-fish.iml
.settings
bin
nbproject
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-23 15:47:53 UTC (rev 2141)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-23 16:08:14 UTC (rev 2142)
@@ -100,25 +100,23 @@
}
}
- protected void accept(ActionEvent e) {
- JComponent source = (JComponent) e.getSource();
- Class classBean = (Class)source.getClientProperty("bean");
- String beanID = (String)source.getClientProperty("beanID");
- TopiaEntity bean = null;
- if(beanID == null){
- bean = getVerifier().getEntity(classBean);
- }
- else{
- System.out.println(beanID);
- bean = getVerifier().getEntity(classBean, beanID);
- }
- if (bean != null){
- FactorWizard wizard = new FactorWizard(this);
+protected void accept(ActionEvent e) {
+ JComponent source = (JComponent) e.getSource();
+ Class classBean = (Class)source.getClientProperty("bean");
+ String beanID = (String)source.getClientProperty("beanID");
+ TopiaEntity bean = null;
+ if (beanID == null){
+ bean = getVerifier().getEntity(classBean);
+ }
+ else{
+ bean = getVerifier().getEntity(classBean, beanID);
+ }
+ if (bean != null){
+ FactorWizard wizard = new FactorWizard(this);
- wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean));
- wizard.pack();
- wizard.setVisible(true);
- }
+ wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean));
+ wizard.pack();
+ wizard.setVisible(true);
}
}
Deleted: isis-fish/trunk/src/main/resources/log4j.properties
===================================================================
--- isis-fish/trunk/src/main/resources/log4j.properties 2009-04-23 15:47:53 UTC (rev 2141)
+++ isis-fish/trunk/src/main/resources/log4j.properties 2009-04-23 16:08:14 UTC (rev 2142)
@@ -1,17 +0,0 @@
-# Global logging configuration
-log4j.rootLogger=ERROR, stdout
-# Console output...
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
-
-# package level
-log4j.logger.fr.ifremer.isisfish=INFO
-log4j.logger.org.codelutin=INFO
-log4j.logger.analyseplans=INFO
-log4j.logger.exports=INFO
-log4j.logger.formules=INFO
-log4j.logger.rules=INFO
-log4j.logger.scripts=INFO
-log4j.logger.sensitivity=INFO
-log4j.logger.simulators=INFO
1
0
r2141 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input
by sletellier@users.labs.libre-entreprise.org 23 Apr '09
by sletellier@users.labs.libre-entreprise.org 23 Apr '09
23 Apr '09
Author: sletellier
Date: 2009-04-23 15:47:53 +0000 (Thu, 23 Apr 2009)
New Revision: 2141
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
Log:
Bug StrategiesOneMonth factor resolved
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-23 15:34:25 UTC (rev 2140)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-23 15:47:53 UTC (rev 2141)
@@ -100,15 +100,25 @@
}
}
-protected void accept(ActionEvent e) {
- JComponent source = (JComponent) e.getSource();
- Class classBean = (Class)source.getClientProperty("bean");
- TopiaEntity bean = getVerifier().getEntity(classBean);
- if (bean != null) {
- FactorWizard wizard = new FactorWizard(this);
- wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean));
- wizard.pack();
- wizard.setVisible(true);
+ protected void accept(ActionEvent e) {
+ JComponent source = (JComponent) e.getSource();
+ Class classBean = (Class)source.getClientProperty("bean");
+ String beanID = (String)source.getClientProperty("beanID");
+ TopiaEntity bean = null;
+ if(beanID == null){
+ bean = getVerifier().getEntity(classBean);
+ }
+ else{
+ System.out.println(beanID);
+ bean = getVerifier().getEntity(classBean, beanID);
+ }
+ if (bean != null){
+ FactorWizard wizard = new FactorWizard(this);
+
+ wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean));
+ wizard.pack();
+ wizard.setVisible(true);
+ }
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-04-23 15:34:25 UTC (rev 2140)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputSaveVerifier.java 2009-04-23 15:47:53 UTC (rev 2141)
@@ -27,6 +27,8 @@
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import javax.swing.JButton;
@@ -50,6 +52,8 @@
import fr.ifremer.isisfish.ui.SaveVerifier;
import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI;
import fr.ifremer.isisfish.ui.widget.ErrorDialogUI;
+import java.util.Map;
+import java.util.Map.Entry;
/**
* InputSaveVerifier.
@@ -107,8 +111,8 @@
protected String currentOnglet = null;
protected TopiaContext isisContext = null;
- protected List<TopiaEntity> currentEntities = new ArrayList<TopiaEntity>();
- protected List<InputContentUI> currentPanels = new ArrayList<InputContentUI>();
+ protected Map<String, TopiaEntity> currentEntities = new HashMap <String, TopiaEntity>();
+ protected List<InputContentUI> currentPanels = new ArrayList <InputContentUI>();
protected InputUI rootUI;
protected SensitivityTabUI sensUI;
@@ -269,7 +273,7 @@
public void topiaSave() {
try {
noModif();
- for (TopiaEntity t : currentEntities) {
+ for (TopiaEntity t : currentEntities.values()){
t.update();
if (log.isDebugEnabled()) {
log.debug("updating : " + t);
@@ -294,23 +298,24 @@
try {
noModif();
isisContext.rollbackTransaction();
- List<TopiaEntity> canceledEntity = currentEntities;
- currentEntities = new ArrayList<TopiaEntity>();
+ Map<String, TopiaEntity> canceledEntity = new HashMap<String, TopiaEntity>();
+ for (Entry<String, TopiaEntity> currentEntity : currentEntities.entrySet()) {
+ TopiaEntity t = isisContext.findByTopiaId(currentEntity.getValue().getTopiaId());
- // TODO a quoi ca sert de recharger les entités ?
- for (TopiaEntity t : canceledEntity) {
- TopiaEntity t2 = isisContext.findByTopiaId(t.getTopiaId());
-
- // desynchronise la précédente
- // fix : org.hibernate.NonUniqueObjectException: a different object with the
- // same identifier value was already associated with the session
- //((TopiaContextImpl)isisContext).getHibernate().evict(t2);
- //t.setTopiaId(null);
-
- rootUI.repaintNode(currentNode.getContextPath());
- rootUI.setTreeSelection(currentNode.getContextPath());
- addCurrentEntity(t2);
- }
+ // TODO a quoi ca sert de recharger les entités ?
+ // desynchronise la précédente
+ // fix : org.hibernate.NonUniqueObjectException: a different object with the
+ // same identifier value was already associated with the session
+ //((TopiaContextImpl)isisContext).getHibernate().evict(t2);
+ //t.setTopiaId(null);
+
+ rootUI.repaintNode(currentNode.getContextPath());
+ rootUI.setTreeSelection(currentNode.getContextPath());
+
+ String key = currentEntity.getKey();
+ canceledEntity.put(key, t);
+ addCurrentEntity(t);
+ }
rootUI.setInfoText(_("isisfish.message.cancel.finished"));
} catch (Exception eee) {
if (log.isErrorEnabled()) {
@@ -339,7 +344,7 @@
}
}
- public void addCurrentEntity(TopiaEntity currentEntity) {
+ public void addCurrentEntity(TopiaEntity currentEntity, String key) {
if (currentEntity != null) {
editable = true;
isisContext = currentEntity.getTopiaContext();
@@ -358,12 +363,17 @@
if (entity != null) {
currentEntities.remove(entity);
}
- this.currentEntities.add(currentEntity);
+ this.currentEntities.put(key, currentEntity);
setPanelsActifs();
}
}
- public void removeAllEntity() {
+ public void addCurrentEntity(TopiaEntity currentEntity) {
+ if (currentEntity != null){
+ addCurrentEntity(currentEntity, currentEntity.getTopiaId());
+ }
+ }
+ public void removeAllEntity(){
currentEntities.clear();
editable = false;
noModif();
@@ -446,13 +456,17 @@
return isisContext;
}
- public List<TopiaEntity> getCurrentEntities() {
- return currentEntities;
+ public Collection<TopiaEntity> getCurrentEntities() {
+ return currentEntities.values();
}
- public <E extends TopiaEntity> E getEntity(Class<E> clazz) {
- for (TopiaEntity te : currentEntities) {
- if (clazz.isInstance(te)) {
+ public <E extends TopiaEntity> E getEntity(Class<E> clazz, String key){
+ return (E)currentEntities.get(key);
+ }
+
+ public <E extends TopiaEntity> E getEntity(Class<E> clazz){
+ for (TopiaEntity te : currentEntities.values()){
+ if (clazz.isInstance(te)){
return (E) te;
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-04-23 15:34:25 UTC (rev 2140)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-04-23 15:47:53 UTC (rev 2141)
@@ -56,7 +56,7 @@
int month = 0;
PropertyChangeListener listener = null;
-addPropertyChangeListener("bean", new PropertyChangeListener() {
+addPropertyChangeListener("strategyMonthInfo", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getOldValue() != null || evt.getNewValue() == null) {
// remove previous binding on getBean()
@@ -92,6 +92,9 @@
}
}
if (getStrategyMonthInfo() != null){
+ numberOfTrips.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId());
+ fieldStrategyMonthInfoProportion.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId());
+ fieldStrategyMonthInfoMinInactivityDays.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId());
ActionListener[] listeners = fieldStrategyMonthInfoTripType.getActionListeners();
for (ActionListener listener : listeners){
fieldStrategyMonthInfoTripType.removeActionListener(listener);
1
0
r2140 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: . simulator/launcher
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
23 Apr '09
Author: chatellier
Date: 2009-04-23 15:34:25 +0000 (Thu, 23 Apr 2009)
New Revision: 2140
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
Log:
Reformat one method (label error)
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-23 15:27:52 UTC (rev 2139)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-23 15:34:25 UTC (rev 2140)
@@ -371,7 +371,7 @@
*
* @return le nombre de simulations authorisé
*/
- public int getSimulatorSshMaxSimulteaneousSimulation() {
+ public int getSimulatorSshMaxSimultaneousSimulation() {
int result = getOptionAsInt(Option.SIMULATOR_SSH_MAX_SIMULTANEOUS_SIMULATION.key);
return result;
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-23 15:34:25 UTC (rev 2140)
@@ -92,7 +92,7 @@
* Semaphore used to upload only 20 (default) simulations at a time.
*/
protected static Semaphore semaphore = new Semaphore(IsisFish.config
- .getSimulatorSshMaxSimulteaneousSimulation());
+ .getSimulatorSshMaxSimultaneousSimulation());
/**
* Constructor.
1
0
r2139 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: . simulator/launcher
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
23 Apr '09
Author: chatellier
Date: 2009-04-23 15:27:52 +0000 (Thu, 23 Apr 2009)
New Revision: 2139
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
Log:
Comment previous commit.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -364,10 +364,15 @@
}
/**
- * TODO comment
+ * Retourne le nombre simultané de simulations authorisées sur
+ * caparmor.
+ *
+ * Utilisé pour l'envoie des simulations.
+ *
+ * @return le nombre de simulations authorisé
*/
public int getSimulatorSshMaxSimulteaneousSimulation() {
- int result = getOptionAsInt(Option.SIMULATOR_SSH_MAX_SIMULTEANEOUS_SIMULATION.key);
+ int result = getOptionAsInt(Option.SIMULATOR_SSH_MAX_SIMULTANEOUS_SIMULATION.key);
return result;
}
@@ -661,7 +666,10 @@
};
- log.info("Check configuration change");
+ if (log.isInfoEnabled()) {
+ log.info("Check configuration change");
+ }
+
for(int i=0; i<keys.length;) {
String oldKey = keys[i++];
String newKey = keys[i++];
@@ -679,7 +687,9 @@
}
if (mustSave) {
saveForUser();
- log.info("Config file migration done");
+ if (log.isInfoEnabled()) {
+ log.info("Config file migration done");
+ }
}
if (log.isDebugEnabled()) {
printConfig();
@@ -736,7 +746,7 @@
/** Serveur accessible par SSH : interval de check du fichier de control */
SIMULATOR_SSH_CONTROLCHECKINTERVAL("simulation.ssh.control.check.interval", _("isisfish.config.main.simulation.ssh.control.check.interval.description"), "5"),
/** Serveur accessible par SSH : nombre de simulations simultanées sur caparmor */
- SIMULATOR_SSH_MAX_SIMULTEANEOUS_SIMULATION("simulation.ssh.max.simultaneous.simulation", _("isisfish.config.main.simulation.max.simultaneous.simulation.description"), "20"),
+ SIMULATOR_SSH_MAX_SIMULTANEOUS_SIMULATION("simulation.ssh.max.simultaneous.simulation", _("isisfish.config.main.simulation.max.simultaneous.simulation.description"), "20"),
LOCALE("locale", _("isisfish.config.main.locale.description"), "fr_FR"),
// REGION_MAP("regionMap", _("isisfish.config.main.regionMap.description"), "maps"),
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -527,22 +527,24 @@
}
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on inprocess launcher).
*/
@Override
public void simulationEnded() {
- // TODO Auto-generated method stub
-
+
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on inprocess launcher).
*/
@Override
public void simulationStarted() {
- // TODO Auto-generated method stub
-
+
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -233,7 +233,6 @@
public SimulationStorage getSimulationStorage(
SimulationService simulationService, SimulationControl control)
throws RemoteException {
- // TODO Auto-generated method stub
return null;
}
@@ -243,25 +242,26 @@
@Override
public void updateControl(SimulationService simulationService,
SimulationControl control) throws RemoteException {
- // TODO Auto-generated method stub
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on xml rpc launcher).
*/
@Override
public void simulationEnded() {
- // TODO Auto-generated method stub
-
+
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on xml rpc launcher).
*/
@Override
public void simulationStarted() {
- // TODO Auto-generated method stub
-
+
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -82,8 +82,6 @@
protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-qsub.seq";
//protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-cron.seq";
- protected static Semaphore semaphore = new Semaphore(IsisFish.config.getSimulatorSshMaxSimulteaneousSimulation());
-
/**
* Opened session. Stored in static context to not reask passphrase at each
* connection.
@@ -91,6 +89,12 @@
protected static Session sshSession;
/**
+ * Semaphore used to upload only 20 (default) simulations at a time.
+ */
+ protected static Semaphore semaphore = new Semaphore(IsisFish.config
+ .getSimulatorSshMaxSimulteaneousSimulation());
+
+ /**
* Constructor.
*
* Init freemarker.
@@ -99,29 +103,7 @@
initFreemarker();
}
-
/**
- * @return the semaphore
- */
- public static Semaphore getSemaphore() {
- return semaphore;
- }
-
- public void simulationStarted() {
- try {
- semaphore.acquire();
- } catch (InterruptedException e) {
- if (log.isErrorEnabled()) {
- log.error("Semaphore aquiere has been interrupted", e);
- }
- }
- }
-
- public void simulationEnded() {
- semaphore.release();
- }
-
- /**
* Init freemarker configuration.
*/
protected void initFreemarker() {
@@ -195,6 +177,34 @@
/**
* {@inheritDoc}
*
+ * Use semaphore to limit simultaneous simulation number on caparmor.
+ *
+ * @see Semaphore
+ */
+ @Override
+ public void simulationStarted() {
+ try {
+ semaphore.acquire();
+ } catch (InterruptedException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Semaphore aquiere has been interrupted", e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Release one resource onr semaphore.
+ */
+ @Override
+ public void simulationEnded() {
+ semaphore.release();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* Dans le cas de ssh: - upload la simulation - construit le script pour
* qsub - upload le script qsub - ajoute le script a qsub
*
@@ -206,6 +216,7 @@
String simulationPrescript) throws RemoteException {
// ask for available resources on caparmor
+ // bloquin until available
simulationStarted();
// start ssh session
@@ -243,7 +254,7 @@
/**
* {@inheritDoc}
*
- * Se connecte au serveur distance et tétécharge les résultats de la
+ * Se connecte au serveur distant et télécharge les résultats de la
* simulation.
*/
@Override
@@ -273,7 +284,7 @@
/**
* {@inheritDoc}
*
- * Se connecte au serveur distance et télécharge le fichier de control.
+ * Se connecte au serveur distant et télécharge le fichier de control.
* Injecte ensuite ce fichier dans le {@link SimulationControl}.
*/
@Override
@@ -455,8 +466,7 @@
*
* Just connect and do an "echo xx >> .ssh/authorized_keys"
*
- * @param session
- * opened session
+ * @param session opened session
* @param sshKey
* @throws JSchException
*/
@@ -469,8 +479,10 @@
// command to :
// - make ssh directory
// - add key to authorized_keys
- String command = "if [ ! -d .ssh ] ; then mkdir .ssh; fi ; echo \"%s\" >> .ssh/authorized_keys";
+ // tested on bash/csh
+ String command = "test -d .ssh||mkdir .ssh;echo \"%s\" >> .ssh/authorized_keys";
+
try {
// use usefull readLines from commons-io
@SuppressWarnings("unchecked")
@@ -491,16 +503,12 @@
}
} catch (IOException e) {
if (log.isErrorEnabled()) {
- log
- .error(
- _("Error while uploading public key to remote serveur authorized_keys"),
+ log.error(_("Error while uploading public key to remote serveur authorized_keys"),
e);
}
} catch (SSHException e) {
if (log.isErrorEnabled()) {
- log
- .error(
- _("Error while uploading public key to remote serveur authorized_keys"),
+ log.error(_("Error while uploading public key to remote serveur authorized_keys"),
e);
}
}
@@ -509,14 +517,11 @@
/**
* Upload simulation file to server.
*
- * @param session
- * already open valid ssh session
- * @param simulationFile
- * simulation file to upload
+ * @param session already open valid ssh session
+ * @param simulationFile simulation file to upload
*
* @return remote file path or <tt>null</tt> if errors
- * @throws SSHException
- * if upload fail
+ * @throws SSHException if upload fail
*/
protected String uploadSimulation(Session session, File simulationFile)
throws SSHException {
@@ -526,12 +531,10 @@
// first check that remote directory exists
String remotePath = IsisFish.config.getSimulatorSshTmpPath();
- // FIXME This is a workaround to make the simulations work on caparmor
- // FIXME We need to find a way to make it work the old way.
-
- String command = "test -d \"" + remotePath + "\"||mkdir \"" + remotePath + "\"";
- //String command = "if ( ! -d \"" + remotePath + "\" ) mkdir \""
- // + remotePath + "\"";
+ // following command work on bash and csh
+ String command = "test -d \"" + remotePath + "\"||mkdir \""
+ + remotePath + "\"";
+
if (log.isInfoEnabled()) {
log.info("Creating remote temp directory (if not exists) "
+ remotePath);
@@ -610,14 +613,11 @@
* Download remote simulation control file and store its content into temp
* file.
*
- * @param simulationId
- * id de la simulation
- * @param fileName
- * nom du fichier a telecharger
+ * @param simulationId id de la simulation
+ * @param fileName nom du fichier a telecharger
* @return downloaded temp file (file have to be manually deleted)
* @throws IOException
- * @throws SSHException
- * if remote file doesn't exists
+ * @throws SSHException if remote file doesn't exists
*/
protected File downloadSimulationFile(String simulationId, String fileName)
throws IOException, SSHException {
@@ -647,13 +647,10 @@
/**
* Upload script on remote server.
*
- * @param session
- * valid opened ssh session
- * @param simulationScript
- * file to upload
+ * @param session valid opened ssh session
+ * @param simulationScript file to upload
*
- * @throws SSHException
- * if upload fail
+ * @throws SSHException if upload fail
*/
protected String uploadSimulationScript(Session session,
File simulationScript) throws SSHException {
@@ -687,15 +684,11 @@
*
* Return path if uploaded or null if no upload needed.
*
- * @param session
- * valid opened ssh session
- * @param simulationPreScript
- * script content
+ * @param session valid opened ssh session
+ * @param simulationPreScript script content
*
- * @throws SSHException
- * if upload fail
- * @throws IOException
- * if upload fail
+ * @throws SSHException if upload fail
+ * @throws IOException if upload fail
*/
protected String uploadPreScriptIfNecessary(Session session,
String simulationId, String simulationPreScript)
@@ -739,17 +732,13 @@
*
* Le fichier temporaire est configuré pour se supprimer tout seul.
*
- * @param simuationId
- * id de la simulation
- * @param simulationZip
- * zip de la simulation
- * @param preScriptPath
- * simulation pre script path (can be null)
+ * @param simuationId id de la simulation
+ * @param simulationZip zip de la simulation
+ * @param preScriptPath simulation pre script path (can be null)
*
* @return un Fichier temporaire ou <tt>null</tt> en cas d'exception
*
- * @throws IOException
- * if can't build script
+ * @throws IOException if can't build script
*/
protected File getSimulationScriptFile(String simuationId,
String simulationZip, String preScriptPath) throws IOException {
@@ -769,17 +758,12 @@
*
* Remplace aussi la variable $simulation du template.
*
- * @param templateName
- * url du template
- * @param simuationId
- * id de la simulation
- * @param simulationZip
- * zip de la simulation
- * @param preScriptPath
- * simulation pre script path (can be null)
+ * @param templateName url du template
+ * @param simuationId id de la simulation
+ * @param simulationZip zip de la simulation
+ * @param preScriptPath simulation pre script path (can be null)
*
- * @throws IOException
- * if can't get script content
+ * @throws IOException if can't get script content
*/
protected String getSimulationScriptLaunchContent(String templateName,
String simuationId, String simulationZip, String preScriptPath)
@@ -825,13 +809,10 @@
/**
* Add script in remote qsub queue.
*
- * @param session
- * valid opened session
- * @param scriptRemotePath
- * remote script path
+ * @param session valid opened session
+ * @param scriptRemotePath remote script path
*
- * @throws SSHException
- * if call fail
+ * @throws SSHException if call fail
*/
protected void addScriptToQsubQueue(Session session, String scriptRemotePath)
throws SSHException {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -453,7 +453,7 @@
SimulationService service = SimulationService.getService();
SimulationControl control = job.getItem().getControl();
- // TODO comment
+ // Release one available resource on launcher
launcher.simulationEnded();
if (log.isInfoEnabled()) {
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -107,7 +107,17 @@
SimulationControl control) throws RemoteException;
+ /**
+ * Call it before starting a simulation.
+ *
+ * This call is bloquing until available resources.
+ */
public void simulationStarted();
+ /**
+ * Call it after simulation end.
+ *
+ * Release one resources.
+ */
public void simulationEnded();
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2009-04-23 15:27:52 UTC (rev 2139)
@@ -309,21 +309,23 @@
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on subprocess launcher).
*/
@Override
public void simulationEnded() {
- // TODO Auto-generated method stub
-
+
}
- /*
- * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ /**
+ * {@inheritDoc}
+ *
+ * Do nothing (no restriction on subprocess launcher).
*/
@Override
public void simulationStarted() {
- // TODO Auto-generated method stub
-
+
}
}
1
0
r2138 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: . simulator/launcher
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
by chatellier@users.labs.libre-entreprise.org 23 Apr '09
23 Apr '09
Author: chatellier
Date: 2009-04-23 14:08:36 +0000 (Thu, 23 Apr 2009)
New Revision: 2138
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
Log:
Add semaphore to control simulteaneous thread on caparmor
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -362,6 +362,14 @@
int result = getOptionAsInt(Option.SIMULATOR_SSH_CONTROLCHECKINTERVAL.key);
return result;
}
+
+ /**
+ * TODO comment
+ */
+ public int getSimulatorSshMaxSimulteaneousSimulation() {
+ int result = getOptionAsInt(Option.SIMULATOR_SSH_MAX_SIMULTEANEOUS_SIMULATION.key);
+ return result;
+ }
/**
* Retourne la clé privée de l'utilisteur courant.
@@ -727,6 +735,8 @@
SIMULATOR_SSH_ADDSCRIPTTOQUEUECOMMAND("simulation.ssh.addscripttoqueuecommand", _("isisfish.config.main.simulation.ssh.addscripttoqueuecommand.description"), "/usr/pbs/bin/qsub"),
/** Serveur accessible par SSH : interval de check du fichier de control */
SIMULATOR_SSH_CONTROLCHECKINTERVAL("simulation.ssh.control.check.interval", _("isisfish.config.main.simulation.ssh.control.check.interval.description"), "5"),
+ /** Serveur accessible par SSH : nombre de simulations simultanées sur caparmor */
+ SIMULATOR_SSH_MAX_SIMULTEANEOUS_SIMULATION("simulation.ssh.max.simultaneous.simulation", _("isisfish.config.main.simulation.max.simultaneous.simulation.description"), "20"),
LOCALE("locale", _("isisfish.config.main.locale.description"), "fr_FR"),
// REGION_MAP("regionMap", _("isisfish.config.main.regionMap.description"), "maps"),
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/InProcessSimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -527,4 +527,22 @@
}
}
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ */
+ @Override
+ public void simulationEnded() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ */
+ @Override
+ public void simulationStarted() {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/IsisFishServerSimulationLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -246,4 +246,22 @@
// TODO Auto-generated method stub
}
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ */
+ @Override
+ public void simulationEnded() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ */
+ @Override
+ public void simulationStarted() {
+ // TODO Auto-generated method stub
+
+ }
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -30,6 +30,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.Semaphore;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
@@ -81,6 +82,8 @@
protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-qsub.seq";
//protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-cron.seq";
+ protected static Semaphore semaphore = new Semaphore(IsisFish.config.getSimulatorSshMaxSimulteaneousSimulation());
+
/**
* Opened session. Stored in static context to not reask passphrase at each
* connection.
@@ -96,7 +99,29 @@
initFreemarker();
}
+
/**
+ * @return the semaphore
+ */
+ public static Semaphore getSemaphore() {
+ return semaphore;
+ }
+
+ public void simulationStarted() {
+ try {
+ semaphore.acquire();
+ } catch (InterruptedException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Semaphore aquiere has been interrupted", e);
+ }
+ }
+ }
+
+ public void simulationEnded() {
+ semaphore.release();
+ }
+
+ /**
* Init freemarker configuration.
*/
protected void initFreemarker() {
@@ -180,6 +205,9 @@
SimulationControl control, File simulationZip,
String simulationPrescript) throws RemoteException {
+ // ask for available resources on caparmor
+ simulationStarted();
+
// start ssh session
try {
// connection
@@ -501,10 +529,9 @@
// FIXME This is a workaround to make the simulations work on caparmor
// FIXME We need to find a way to make it work the old way.
- //String command = "if [ ! -d \"" + remotePath + "\" ] ; then mkdir \""
- // + remotePath + "\"; fi";
- String command = "if ( ! -d \"" + remotePath + "\" ) mkdir \""
- + remotePath + "\"";
+ String command = "test -d \"" + remotePath + "\"||mkdir \"" + remotePath + "\"";
+ //String command = "if ( ! -d \"" + remotePath + "\" ) mkdir \""
+ // + remotePath + "\"";
if (log.isInfoEnabled()) {
log.info("Creating remote temp directory (if not exists) "
+ remotePath);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationMonitor.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -453,6 +453,9 @@
SimulationService service = SimulationService.getService();
SimulationControl control = job.getItem().getControl();
+ // TODO comment
+ launcher.simulationEnded();
+
if (log.isInfoEnabled()) {
log.info("Do post simulation operation for " + control.getId());
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulatorLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -105,4 +105,9 @@
*/
public void updateControl(SimulationService simulationService,
SimulationControl control) throws RemoteException;
+
+
+ public void simulationStarted();
+
+ public void simulationEnded();
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2009-04-22 17:03:14 UTC (rev 2137)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2009-04-23 14:08:36 UTC (rev 2138)
@@ -308,4 +308,22 @@
SimulationStorage.readControl(simulationId, control, "stop");
}
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationEnded()
+ */
+ @Override
+ public void simulationEnded() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * @see fr.ifremer.isisfish.simulator.launcher.SimulatorLauncher#simulationStarted()
+ */
+ @Override
+ public void simulationStarted() {
+ // TODO Auto-generated method stub
+
+ }
}
1
0
r2137 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish java/fr/ifremer/isisfish/datastore resources/i18n
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
22 Apr '09
Author: chatellier
Date: 2009-04-22 17:03:14 +0000 (Wed, 22 Apr 2009)
New Revision: 2137
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Add database lock mode parameter
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-22 10:30:56 UTC (rev 2136)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2009-04-22 17:03:14 UTC (rev 2137)
@@ -155,6 +155,25 @@
File result = getOptionAsFile(Option.DATABASE_DIRECTORY.key);
return result;
}
+
+ /**
+ * Retourne le lock a utiliser pour la base h2.
+ *
+ * Par defaut la base utilise 'file'.
+ *
+ * Les valeur acceptées sont :
+ * - file
+ * - socket
+ * - no
+ *
+ * http://www.h2database.com/html/features.html#database_file_locking
+ *
+ * @return h2 db lock mode
+ */
+ public String getDatabaseLockMode() {
+ String result = getOption(Option.DATABASE_LOCK_MODE.key);
+ return result;
+ }
/**
* Retourne le repertoire ou sont stockes les scripts compiles.
@@ -720,6 +739,8 @@
DATABASE_DIRECTORY("database.directory", _("isisfish.config.vcs.localDatabasePath.description"), getUserHome() + File.separator + "isis-database-3"),
+ DATABASE_LOCK_MODE("database.lockmode", _("isisfish.config.database.lockmode.description"), "file"),
+
// TODO remove duplicated ssh key configuration
SSH_KEY_FILE("ssh.key.file", _("isisfish.config.vcs.keyFile.description"), getUserHome() + File.separator + ".ssh" + File.separator + "isis_rsa"),
SSH_PASSPHRASE_ENABLED("ssh.passphrase.enabled", _("isisfish.config.vcs.noPassPhrase.description"), "false"),
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java 2009-04-22 10:30:56 UTC (rev 2136)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/IsisH2Config.java 2009-04-22 17:03:14 UTC (rev 2137)
@@ -17,6 +17,7 @@
package fr.ifremer.isisfish.datastore;
import fr.ifremer.isisfish.IsisConfig;
+import fr.ifremer.isisfish.IsisFish;
import fr.ifremer.isisfish.IsisFishDAOHelper;
import fr.ifremer.isisfish.datastore.migration.SwingMigrationCallbackHandler;
import org.codelutin.topia.migration.TopiaMigrationServiceImpl;
@@ -65,7 +66,7 @@
protected static final String H2_URL =
"jdbc:h2:file:%s;" +
// on peut aussi utiliser file, socket
- "FILE_LOCK=file;" +
+ "FILE_LOCK=%s;" +
//1 or 2 is needed to restore avec crash
// 0: logging is disabled (faster),
// 1: logging of the data is enabled, but logging of the index
@@ -143,10 +144,10 @@
// pour h2 on remet STORAGE_DATA car il ne cree pas de repertoire
String url;
if (tryRecover) {
- url = String.format(H2_RECOVER_URL, getStorageDataDirectory(databasePath).getPath());
+ url = String.format(H2_RECOVER_URL, getStorageDataDirectory(databasePath).getPath(), IsisFish.config.getDatabaseLockMode());
}
else {
- url = String.format(H2_URL, getStorageDataDirectory(databasePath).getPath());
+ url = String.format(H2_URL, getStorageDataDirectory(databasePath).getPath(), IsisFish.config.getDatabaseLockMode());
}
config.setProperty(Environment.URL, url);
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-22 10:30:56 UTC (rev 2136)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-22 17:03:14 UTC (rev 2137)
@@ -144,6 +144,7 @@
isisfish.common.warn=warn
isisfish.common.year=annee
isisfish.common.zone=zone
+isisfish.config.database.lockmode.description=
isisfish.config.main.compileDirectory.description=
isisfish.config.main.configFileName.description=
isisfish.config.main.defaultBackupDirectory.description=
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-22 10:30:56 UTC (rev 2136)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-22 17:03:14 UTC (rev 2137)
@@ -144,6 +144,7 @@
isisfish.common.warn=Warning
isisfish.common.year=ann\u00E9e
isisfish.common.zone=Zone
+isisfish.config.database.lockmode.description=
isisfish.config.main.compileDirectory.description=le r\u00E9pertoire o\u00F9 sont compil\u00E9s les scripts
isisfish.config.main.configFileName.description=le fichier de configuration \u00E0 utiliser
isisfish.config.main.defaultBackupDirectory.description=le r\u00E9pertoire o\u00F9 stocker les backups des donn\u00E9es
1
0
r2136 - in isis-fish/trunk/src/main/java/fr/ifremer/isisfish: datastore ui/sensitivity ui/simulator
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
22 Apr '09
Author: chatellier
Date: 2009-04-22 10:30:56 +0000 (Wed, 22 Apr 2009)
New Revision: 2136
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
Log:
Reload sensivity calculator when reloading simulation.
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2009-04-22 09:38:44 UTC (rev 2135)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/datastore/SensitivityStorage.java 2009-04-22 10:30:56 UTC (rev 2136)
@@ -96,13 +96,13 @@
}
/**
- * Retourne le nom de tous les calculateurs de sensibilité existans.
+ * Retourne le nom de tous les calculateurs de sensibilité existant.
*
* @return le nom de tous les calculateurs de sensibilité existans en local
*/
public static List<String> getSensitivityNames() {
File dir = getSensitivityDirectory();
- return SensitivityStorage.getStorageNames(dir);
+ return getStorageNames(dir);
}
/**
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-22 09:38:44 UTC (rev 2135)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-22 10:30:56 UTC (rev 2136)
@@ -59,14 +59,21 @@
public void refreshSelectedSensitivityCalculator() {
SensitivityCalculator calculator = getSimulAction().getSensitivityCalculator();
if (calculator != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Refreshing calculator list");
+ }
// TODO it's not getSimpleName() here !
- String name = calculator.getClass().getSimpleName();
- fieldSensitivityCalculatorSelect.setSelectedItem(
- new Item(name, name, name, false));
+ fieldSensitivityCalculatorSelect.setSelectedItem(calculator.getClass().getSimpleName());
}
}
protected void sensCalculatorChanged() {
+
+ // TODO change combo box content
+ // when calculator is changed by refreshSelectedSensitivityCalculator
+ // this event is thrown by build a new Calculator instance
+ // and parameter are lost
+
if (fieldSensitivityCalculatorSelect.getSelectedIndex() != -1) {
String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem();
getSimulAction().setSensitivity(sensitivityName);
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2009-04-22 09:38:44 UTC (rev 2135)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityUI.jaxx 2009-04-22 10:30:56 UTC (rev 2136)
@@ -43,7 +43,7 @@
<SensitivityTabUI id="sensitivityTabUI" constructorParams='new JAXXInitialContext().add(new InputAction()).add(new InputSaveVerifier()).add(this)'/>
</tab>
<tab title='isisfish.sensitivityChooser.title'>
- <SensitivityChooserUI id="sensitivityChooserUI" constructorParams='new JAXXInitialContext().add(this)'/>
+ <SensitivityChooserUI id="sensitivityChooserUI" constructorParams='this'/>
</tab>
<tab id="exportUITab" title='isisfish.export.title'>
<ExportUI id="exportUI" constructorParams='getContextValue(SimulAction.class)'/>
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-22 09:38:44 UTC (rev 2135)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-22 10:30:56 UTC (rev 2136)
@@ -354,9 +354,17 @@
}
}
+ /**
+ * Return rules name without .java extention.
+ *
+ * @return rule names list
+ */
public List<String> getRuleNames() {
List<String> result = new ArrayList<String>();
for (String r : RuleStorage.getRuleNames()) {
+ // Remove .java extention
+ // TODO find a better way to to that
+ // for example RuleStorage.getRuleName(String)
result.add(r.substring(0, r.length() - 5));
}
return result;
@@ -812,8 +820,20 @@
return result;
}
+ /**
+ * Return sensitivity calculator name without .java extention
+ *
+ * @return sensitivity calculator names list
+ */
public List<String> getSensitivityNames() {
- return SensitivityStorage.getSensitivityNames();
+ List<String> result = new ArrayList<String>();
+ for (String r : SensitivityStorage.getSensitivityNames()) {
+ // Remove .java extention
+ // TODO find a better way to to that
+ // for example SensitivityStorage.getRuleName(String)
+ result.add(r.substring(0, r.length() - 5));
+ }
+ return result;
}
public Map<String, Class<?>> getSensitivityParameterNames(String name) {
1
0
r2135 - in isis-fish/trunk/src/main: java/fr/ifremer/isisfish/ui/input resources/i18n
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
by chatellier@users.labs.libre-entreprise.org 22 Apr '09
22 Apr '09
Author: chatellier
Date: 2009-04-22 09:38:44 +0000 (Wed, 22 Apr 2009)
New Revision: 2135
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
Log:
Improve i18n
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-04-22 08:44:10 UTC (rev 2134)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/PopulationRecruitmentUI.jaxx 2009-04-22 09:38:44 UTC (rev 2135)
@@ -1,7 +1,6 @@
<!--
/* *##%
- * Copyright (C) 2005
- * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin
+ * Copyright (C) 2005 - 2009 Ifremer, Code Lutin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,18 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*##%*/
-
-/* *
- * IsisFish.java
- *
- * Created: 1 aout 2005 18:37:25 CEST
- *
- * @author Benjamin POUSSIN <poussin at codelutin.com>
- * @version $Revision: 1312 $
- *
- * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $
- * by : $Author: sletellier $
- */
-->
<fr.ifremer.isisfish.ui.input.InputContentUI>
@@ -102,7 +89,7 @@
</row>
<row>
<cell anchor='east'>
- <JLabel text="Month Gap BetweenRepro Recruitment" enabled='{isActif()}'/>
+ <JLabel text="isisfish.populationRecruitment.monthgapgetweenreprorecruitment" enabled='{isActif()}'/>
</cell>
<cell fill='horizontal' weightx='1.0'>
<JTextField id="fieldPopulationMonthGapBetweenReproRecrutement" text='{getBean().getMonthGapBetweenReproRecrutement()}' onKeyReleased='getBean().setMonthGapBetweenReproRecrutement(Integer.parseInt(fieldPopulationMonthGapBetweenReproRecrutement.getText()))' enabled='{isActif()}' decorator='boxed' _bean='{PopulationImpl.class}' _method='"MonthGapBetweenReproRecrutement"'/>
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-22 08:44:10 UTC (rev 2134)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-04-22 09:38:44 UTC (rev 2135)
@@ -40,7 +40,6 @@
Local\ repository\ don't\ exist=
Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s=
Master\ plan=
-Month\ Gap\ BetweenRepro\ Recruitment=
Normal\ stop\ thread,\ this\ is\ not\ an\ error=
Not\ start\ simulation\ %s\ because\ user\ ask\ stop=
Paste\ current\ selection\ (Ctrl-v)=
@@ -499,6 +498,7 @@
isisfish.input.tree.cells=Cells
isisfish.input.tree.gears=Gears
isisfish.input.tree.metiers=Metiers
+isisfish.input.tree.populations=Populations
isisfish.input.tree.ports=Ports
isisfish.input.tree.setofvessels=Set of vessels
isisfish.input.tree.species=Species
@@ -719,6 +719,7 @@
isisfish.populationMigrationMigration.departureZone=Departure Zone
isisfish.populationMigrationMigration.title=Population migration
isisfish.populationRecruitment.comments=Comments
+isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Month gap between repro and recruitment
isisfish.populationRecruitment.recruitmentDistribution=Recruitment Distribution
isisfish.populationRecruitment.reproductionEquation=ReproductionEquation
isisfish.populationRecruitment.title=inputPopulationRecruitment
Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties
===================================================================
--- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-22 08:44:10 UTC (rev 2134)
+++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-04-22 09:38:44 UTC (rev 2135)
@@ -40,7 +40,6 @@
Local\ repository\ don't\ exist=
Local\ repository\ exists\ but\ it's\ not\ valide\ for\ current\ vcs\:\ %s=
Master\ plan=
-Month\ Gap\ BetweenRepro\ Recruitment=Nombre de mois entre ponte et recrutement
Normal\ stop\ thread,\ this\ is\ not\ an\ error=
Not\ start\ simulation\ %s\ because\ user\ ask\ stop=
Paste\ current\ selection\ (Ctrl-v)=
@@ -499,6 +498,7 @@
isisfish.input.tree.cells=Mailles
isisfish.input.tree.gears=Engins
isisfish.input.tree.metiers=M\u00E9tiers
+isisfish.input.tree.populations=Populations
isisfish.input.tree.ports=Ports
isisfish.input.tree.setofvessels=Flottilles
isisfish.input.tree.species=Esp\u00E8ces
@@ -719,6 +719,7 @@
isisfish.populationMigrationMigration.departureZone=Zone de d\u00E9part
isisfish.populationMigrationMigration.title=Migration de population
isisfish.populationRecruitment.comments=Commentaires
+isisfish.populationRecruitment.monthgapgetweenreprorecruitment=Nombre de mois entre ponte et recrutement
isisfish.populationRecruitment.recruitmentDistribution=Distribution du recrutement
isisfish.populationRecruitment.reproductionEquation=Equation de reproduction
isisfish.populationRecruitment.title=Saisie des reproductions
1
0
r2134 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher
by jcouteau@users.labs.libre-entreprise.org 22 Apr '09
by jcouteau@users.labs.libre-entreprise.org 22 Apr '09
22 Apr '09
Author: jcouteau
Date: 2009-04-22 08:44:10 +0000 (Wed, 22 Apr 2009)
New Revision: 2134
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
Log:
Temporary bug fix on caparmor simulations
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-21 12:55:06 UTC (rev 2133)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/launcher/SSHSimulatorLauncher.java 2009-04-22 08:44:10 UTC (rev 2134)
@@ -58,18 +58,16 @@
/**
* Use a remote simulation server.
*
- * Upload zip simulation file on server and launch
- * simulation on that file.
+ * Upload zip simulation file on server and launch simulation on that file.
*
* Isis-Fish must be installed on remote server.
- *
+ *
* @see JSch
*
* @author chatellier
* @version $Revision: 1.0 $
*
- * Last update : $Date: 18 nov. 2008 $
- * By : $Author: chatellier $
+ * Last update : $Date: 18 nov. 2008 $ By : $Author: chatellier $
*/
public class SSHSimulatorLauncher implements SimulatorLauncher {
@@ -78,15 +76,14 @@
/** Freemarker configuration */
protected Configuration freemarkerConfiguration;
-
+
/** Freemarker qsub template. */
protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-qsub.seq";
//protected static final String QSUB_SCRIPT_TEMPLATE = "templates/ssh/launch-isis-cron.seq";
-
+
/**
- * Opened session.
- * Stored in static context to not reask passphrase
- * at each connection.
+ * Opened session. Stored in static context to not reask passphrase at each
+ * connection.
*/
protected static Session sshSession;
@@ -121,8 +118,10 @@
/**
* Display message both in commons-logging and control text progress.
*
- * @param control control
- * @param message message to display
+ * @param control
+ * control
+ * @param message
+ * message to display
*/
protected void message(SimulationControl control, String message) {
// log
@@ -171,19 +170,15 @@
/**
* {@inheritDoc}
*
- * Dans le cas de ssh:
- * - upload la simulation
- * - construit le script pour qsub
- * - upload le script qsub
- * - ajoute le script a qsub
+ * Dans le cas de ssh: - upload la simulation - construit le script pour
+ * qsub - upload le script qsub - ajoute le script a qsub
*
- * Et :
- * - lance le thread de control de la simulation
+ * Et : - lance le thread de control de la simulation
*/
@Override
public void simulate(SimulationService simulationService,
- SimulationControl control, File simulationZip, String simulationPrescript)
- throws RemoteException {
+ SimulationControl control, File simulationZip,
+ String simulationPrescript) throws RemoteException {
// start ssh session
try {
@@ -199,13 +194,13 @@
// build du contenu du script
message(control,
_("isisfish.simulation.remote.message.waitingstart"));
- String simulationPreScriptPath = uploadPreScriptIfNecessary(sshSession,
- control.getId(), simulationPrescript);
+ String simulationPreScriptPath = uploadPreScriptIfNecessary(
+ sshSession, control.getId(), simulationPrescript);
File simulationScript = getSimulationScriptFile(control.getId(),
simulationRemotePath, simulationPreScriptPath);
String scriptRemotePath = uploadSimulationScript(sshSession,
simulationScript);
-
+
addScriptToQsubQueue(sshSession, scriptRemotePath);
} catch (Exception e) {
@@ -220,7 +215,8 @@
/**
* {@inheritDoc}
*
- * Se connecte au serveur distance et tétécharge les résultats de la simulation.
+ * Se connecte au serveur distance et tétécharge les résultats de la
+ * simulation.
*/
@Override
public SimulationStorage getSimulationStorage(
@@ -249,8 +245,7 @@
/**
* {@inheritDoc}
*
- * Se connecte au serveur distance et télécharge le
- * fichier de control.
+ * Se connecte au serveur distance et télécharge le fichier de control.
* Injecte ensuite ce fichier dans le {@link SimulationControl}.
*/
@Override
@@ -260,12 +255,13 @@
try {
try {
// download control file
- File controlFile = downloadSimulationFile(control.getId(), SimulationStorage.CONTROL_FILENAME);
+ File controlFile = downloadSimulationFile(control.getId(),
+ SimulationStorage.CONTROL_FILENAME);
if (log.isDebugEnabled()) {
log.debug("Control have been downloaded : "
+ controlFile.getAbsolutePath());
}
-
+
synchronized (control) {
// le thread principal a pu le modifier pendant le sleep
//if (control.isRunning()) {
@@ -274,7 +270,7 @@
SimulationStorage.readControl(controlFile, control, "stop");
//}
}
-
+
// deleteTempFile
controlFile.delete();
} catch (SSHException e) {
@@ -285,10 +281,11 @@
.getMessage()));
}
}
-
+
try {
// download information file
- File infoFile = downloadSimulationFile(control.getId(), SimulationStorage.INFORMATION_FILENAME);
+ File infoFile = downloadSimulationFile(control.getId(),
+ SimulationStorage.INFORMATION_FILENAME);
if (log.isDebugEnabled()) {
log.debug("Information have been downloaded : "
+ infoFile.getAbsolutePath());
@@ -299,13 +296,13 @@
// d'arret pour qu'elle s'arrete dans l'UI
Properties infoProperties = new Properties();
infoProperties.load(new FileInputStream(infoFile));
- if (!StringUtils.isEmpty(infoProperties.getProperty("exception"))) {
+ if (!StringUtils.isEmpty(infoProperties
+ .getProperty("exception"))) {
synchronized (control) {
control.setStopSimulationRequest(true);
}
}
-
-
+
// deleteTempFile
infoFile.delete();
} catch (SSHException e) {
@@ -330,7 +327,7 @@
* This method must synchronized.
*
* @return opened ssh session.
- * @throws JSchException
+ * @throws JSchException
*/
protected synchronized Session getSSHSession() throws JSchException {
@@ -397,8 +394,7 @@
try {
passphrase = SSHAgent.getAgent().getPassphrase(sshKey);
ui.setPassphrase(passphrase);
- }
- catch(InvalidPassphraseException e) {
+ } catch (InvalidPassphraseException e) {
if (log.isWarnEnabled()) {
log.warn("Can't key passphrase for key", e);
}
@@ -417,7 +413,8 @@
/**
* Close ssh session.
*
- * @param session session to close
+ * @param session
+ * session to close
*/
protected void closeSSHSession(Session session) {
if (session != null) {
@@ -429,9 +426,11 @@
* Add ssh key into $HOME/.ssh/authorized_keys file.
*
* Just connect and do an "echo xx >> .ssh/authorized_keys"
- * @param session opened session
+ *
+ * @param session
+ * opened session
* @param sshKey
- * @throws JSchException
+ * @throws JSchException
*/
protected void putSshKeyOnRemoteServer(Session session, File sshKey)
throws JSchException {
@@ -464,12 +463,16 @@
}
} catch (IOException e) {
if (log.isErrorEnabled()) {
- log.error(_("Error while uploading public key to remote serveur authorized_keys"),
+ log
+ .error(
+ _("Error while uploading public key to remote serveur authorized_keys"),
e);
}
} catch (SSHException e) {
if (log.isErrorEnabled()) {
- log.error(_("Error while uploading public key to remote serveur authorized_keys"),
+ log
+ .error(
+ _("Error while uploading public key to remote serveur authorized_keys"),
e);
}
}
@@ -478,11 +481,14 @@
/**
* Upload simulation file to server.
*
- * @param session already open valid ssh session
- * @param simulationFile simulation file to upload
+ * @param session
+ * already open valid ssh session
+ * @param simulationFile
+ * simulation file to upload
*
* @return remote file path or <tt>null</tt> if errors
- * @throws SSHException if upload fail
+ * @throws SSHException
+ * if upload fail
*/
protected String uploadSimulation(Session session, File simulationFile)
throws SSHException {
@@ -491,9 +497,14 @@
// first check that remote directory exists
String remotePath = IsisFish.config.getSimulatorSshTmpPath();
+
+ // FIXME This is a workaround to make the simulations work on caparmor
+ // FIXME We need to find a way to make it work the old way.
- String command = "if [ ! -d \"" + remotePath + "\" ] ; then mkdir \""
- + remotePath + "\"; fi";
+ //String command = "if [ ! -d \"" + remotePath + "\" ] ; then mkdir \""
+ // + remotePath + "\"; fi";
+ String command = "if ( ! -d \"" + remotePath + "\" ) mkdir \""
+ + remotePath + "\"";
if (log.isInfoEnabled()) {
log.info("Creating remote temp directory (if not exists) "
+ remotePath);
@@ -511,7 +522,7 @@
if (!remotePath.endsWith("/")) {
remotePath += "/";
}
-
+
if (localPath.lastIndexOf("/") > 0) {
remotePath += localPath.substring(localPath.lastIndexOf("/") + 1);
} else if (localPath.lastIndexOf("\\") > 0) { // windows
@@ -530,7 +541,8 @@
*
* Simulation result is save in {@link SimulationStorage#SIMULATION_PATH}.
*
- * @throws SSHException if download fail (can happen if remote file doesn't exist
+ * @throws SSHException
+ * if download fail (can happen if remote file doesn't exist
*/
protected void downloadResults(Session session, String simulationId)
throws SSHException {
@@ -542,43 +554,46 @@
if (log.isDebugEnabled()) {
log.debug("Downloading results in " + localFile.getAbsolutePath());
}
-
+
// Cant happen if result have already been downloded
// Or try to, but has been interrupted
// delete and download again
File simulationBaseDirectory = new File(localFile, simulationId);
if (simulationBaseDirectory.exists()) {
if (log.isWarnEnabled()) {
- log.warn("Warning, simulation results " + simulationBaseDirectory.getAbsolutePath() + " already exists");
+ log.warn("Warning, simulation results "
+ + simulationBaseDirectory.getAbsolutePath()
+ + " already exists");
log.warn("Delete it, and download again");
}
-
+
FileUtil.deleteRecursively(simulationBaseDirectory);
}
-
+
// build remote file path
// FIXME this path should be given by remote IsisFish app
String remoteFile = IsisFish.config.getSimulatorSshDataPath();
remoteFile += "/" + SimulationStorage.SIMULATION_PATH;
remoteFile += "/" + simulationId;
-
-
SSHUtils.scpFrom(session, remoteFile, localFile);
}
/**
- * Download remote simulation control file and store
- * its content into temp file.
+ * Download remote simulation control file and store its content into temp
+ * file.
*
- * @param simulationId id de la simulation
- * @param fileName nom du fichier a telecharger
+ * @param simulationId
+ * id de la simulation
+ * @param fileName
+ * nom du fichier a telecharger
* @return downloaded temp file (file have to be manually deleted)
- * @throws IOException
- * @throws SSHException if remote file doesn't exists
+ * @throws IOException
+ * @throws SSHException
+ * if remote file doesn't exists
*/
- protected File downloadSimulationFile(String simulationId, String fileName) throws IOException,
- SSHException {
+ protected File downloadSimulationFile(String simulationId, String fileName)
+ throws IOException, SSHException {
File localFile = null;
@@ -605,10 +620,13 @@
/**
* Upload script on remote server.
*
- * @param session valid opened ssh session
- * @param simulationScript file to upload
+ * @param session
+ * valid opened ssh session
+ * @param simulationScript
+ * file to upload
*
- * @throws SSHException if upload fail
+ * @throws SSHException
+ * if upload fail
*/
protected String uploadSimulationScript(Session session,
File simulationScript) throws SSHException {
@@ -623,7 +641,7 @@
if (!remotePath.endsWith("/")) {
remotePath += "/";
}
-
+
if (localPath.lastIndexOf("/") > 0) {
remotePath += localPath.substring(localPath.lastIndexOf("/") + 1);
} else if (localPath.lastIndexOf("\\") > 0) { // windows
@@ -636,27 +654,33 @@
return remotePath;
}
-
+
/**
* Upload pre script on remote server.
*
* Return path if uploaded or null if no upload needed.
*
- * @param session valid opened ssh session
- * @param simulationPreScript script content
+ * @param session
+ * valid opened ssh session
+ * @param simulationPreScript
+ * script content
*
- * @throws SSHException if upload fail
- * @throws IOException if upload fail
+ * @throws SSHException
+ * if upload fail
+ * @throws IOException
+ * if upload fail
*/
protected String uploadPreScriptIfNecessary(Session session,
- String simulationId, String simulationPreScript) throws SSHException, IOException {
+ String simulationId, String simulationPreScript)
+ throws SSHException, IOException {
// if there is no pre script, do nothings
if (StringUtils.isEmpty(simulationPreScript)) {
return null;
}
-
- File tempPreScriptFile = File.createTempFile("isis-" + simulationId + "-", ".prescript");
+
+ File tempPreScriptFile = File.createTempFile("isis-" + simulationId
+ + "-", ".prescript");
FileUtil.writeString(tempPreScriptFile, simulationPreScript);
String localPath = tempPreScriptFile.getAbsolutePath();
@@ -668,7 +692,7 @@
if (!remotePath.endsWith("/")) {
remotePath += "/";
}
-
+
if (localPath.lastIndexOf("/") > 0) {
remotePath += localPath.substring(localPath.lastIndexOf("/") + 1);
} else if (localPath.lastIndexOf("\\") > 0) { // windows
@@ -683,18 +707,22 @@
}
/**
- * Retourne un fichier temporaire contenant le script de lancement
- * de simulation.
+ * Retourne un fichier temporaire contenant le script de lancement de
+ * simulation.
*
* Le fichier temporaire est configuré pour se supprimer tout seul.
*
- * @param simuationId id de la simulation
- * @param simulationZip zip de la simulation
- * @param preScriptPath simulation pre script path (can be null)
+ * @param simuationId
+ * id de la simulation
+ * @param simulationZip
+ * zip de la simulation
+ * @param preScriptPath
+ * simulation pre script path (can be null)
*
* @return un Fichier temporaire ou <tt>null</tt> en cas d'exception
*
- * @throws IOException if can't build script
+ * @throws IOException
+ * if can't build script
*/
protected File getSimulationScriptFile(String simuationId,
String simulationZip, String preScriptPath) throws IOException {
@@ -710,20 +738,25 @@
}
/**
- * Utilise freemarker pour recuperer le contenu
- * du script.
+ * Utilise freemarker pour recuperer le contenu du script.
*
* Remplace aussi la variable $simulation du template.
*
- * @param templateName url du template
- * @param simuationId id de la simulation
- * @param simulationZip zip de la simulation
- * @param preScriptPath simulation pre script path (can be null)
+ * @param templateName
+ * url du template
+ * @param simuationId
+ * id de la simulation
+ * @param simulationZip
+ * zip de la simulation
+ * @param preScriptPath
+ * simulation pre script path (can be null)
*
- * @throws IOException if can't get script content
+ * @throws IOException
+ * if can't get script content
*/
protected String getSimulationScriptLaunchContent(String templateName,
- String simuationId, String simulationZip, String preScriptPath) throws IOException {
+ String simuationId, String simulationZip, String preScriptPath)
+ throws IOException {
String scriptContent = null;
@@ -732,7 +765,7 @@
if (localPreScript == null) {
localPreScript = "";
}
-
+
try {
// get template
Template template = freemarkerConfiguration
@@ -765,10 +798,13 @@
/**
* Add script in remote qsub queue.
*
- * @param session valid opened session
- * @param scriptRemotePath remote script path
+ * @param session
+ * valid opened session
+ * @param scriptRemotePath
+ * remote script path
*
- * @throws SSHException if call fail
+ * @throws SSHException
+ * if call fail
*/
protected void addScriptToQsubQueue(Session session, String scriptRemotePath)
throws SSHException {
1
0
r2133 - in isis-fish/trunk/src: main/java/fr/ifremer/isisfish/simulator main/java/fr/ifremer/isisfish/ui/sensitivity main/java/fr/ifremer/isisfish/ui/simulator test/java/fr/ifremer/isisfish/simulator/launcher
by chatellier@users.labs.libre-entreprise.org 21 Apr '09
by chatellier@users.labs.libre-entreprise.org 21 Apr '09
21 Apr '09
Author: chatellier
Date: 2009-04-21 12:55:06 +0000 (Tue, 21 Apr 2009)
New Revision: 2133
Modified:
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
Log:
Rechargement des exports et calculateur des simulations
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-04-21 12:54:14 UTC (rev 2132)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameter.java 2009-04-21 12:55:06 UTC (rev 2133)
@@ -293,7 +293,12 @@
if (getSensitivityCalculator() != null) {
String calculatorName = SensitivityStorage.getName(getSensitivityCalculator());
result.setProperty("sensitivitycalculator", calculatorName);
+
+ // calculator parameter
+ Properties calculatorParams = sensitivityCalculatorParametertoProperties(0, getSensitivityCalculator());
+ result.putAll(calculatorParams);
}
+
// number of sensitivity simulation
String sensitivityExportList = "";
// WARN only SENSITIVITY are parametrable for now
@@ -459,6 +464,8 @@
if (!StringUtils.isEmpty(sensitivityCalculator)) {
try {
SensitivityCalculator calculator = SensitivityStorage.getSensitivity(sensitivityCalculator).getNewSensitivityInstance();
+ // 0 = only single sensitivity
+ populateSensitivityCalculator(0, calculator, props);
setSensitivityCalculator(calculator);
} catch (IsisFishException eee) {
if (log.isWarnEnabled()) {
@@ -590,8 +597,7 @@
* @param exportIndex l'index de l'export
* @param export L'export dont on souhaite mettre les parametres dans l'objet
* Properties retourne
- * @return L'objet Properties contenant les valeurs des parametres de la
- * regle
+ * @return L'objet Properties contenant les valeurs des parametres de l'export
*/
protected Properties exportParametertoProperties(int exportIndex, Export export) {
Properties result = new Properties();
@@ -615,7 +621,39 @@
return result;
}
+
+ /**
+ * Permet de mettre les parametres du calculateur sous une forme String pour
+ * pouvoir les relire ensuite.
+ *
+ * @param sensitivityIndex l'index du calculateur de sensitivity
+ * @param calculator Le calculateurdont on souhaite mettre les parametres dans l'objet
+ * Properties retourne
+ * @return L'objet Properties contenant les valeurs des parametres du calculateur de sensibilité
+ */
+ protected Properties sensitivityCalculatorParametertoProperties(int sensitivityIndex, SensitivityCalculator calculator) {
+ Properties result = new Properties();
+ ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage());
+ for (String paramName : SensitivityStorage.getParameterNames(calculator).keySet()) {
+ String paramValueString;
+ try {
+ Object value = SensitivityStorage.getParameterValue(calculator, paramName);
+ paramValueString = beanUtils.convert(value);
+ if (paramValueString != null) {
+ result.setProperty("sensitivity." + sensitivityIndex + ".parameter."
+ + paramName, paramValueString);
+ }
+ } catch (IsisFishException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't convert parameter value to String: "
+ + paramName, eee);
+ }
+ }
+ }
+ return result;
+ }
+
/**
* Permet de mettre les parametres du plan sous une forme String pour
* pouvoir les relire ensuite.
@@ -649,8 +687,8 @@
}
/**
- * Recupere dans prop les valeurs des champs specifique a le plan et met a
- * jour les champs du plan
+ * Recupere dans prop les valeurs des champs specifique au plan et met a
+ * jour les champs du plan.
*
* @param planIndex l'index du plan
* @param plan le plan dont les parametres doivent etre lu depuis les
@@ -679,7 +717,39 @@
}
}
}
+
+ /**
+ * Recupere dans prop les valeurs des champs specifique au calculateur de sensibilité et met a
+ * jour les champs du calculateur.
+ *
+ * @param calculatorIndex l'index du calculateur
+ * @param calculator le calculateur dont les parametres doivent etre lu depuis les
+ * proprietes
+ * @param props les proprietes contenant les parametre du calculateur
+ */
+ protected void populateSensitivityCalculator(int calculatorIndex, SensitivityCalculator calculator, Properties props) {
+ ConvertUtilsBean beanUtils = ConverterUtil.getConverter(getRegion().getStorage());
+ String calculatorName = SensitivityStorage.getName(calculator);
+ String paramTag = "sensitivity." + calculatorIndex + ".parameter.";
+ for (Map.Entry<String, Class<?>> entry : SensitivityStorage.getParameterNames(calculator).entrySet()) {
+ String propName = entry.getKey();
+ Class<?> type = entry.getValue();
+ if (TopiaEntity.class.isAssignableFrom(type)) {
+ type = TopiaEntity.class;
+ }
+ String valueString = props.getProperty(paramTag + propName);
+ Object value = beanUtils.convert(valueString, type);
+ try {
+ SensitivityStorage.setParameterValue(calculator, propName, value);
+ } catch (IsisFishException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't reload field " + propName + " for sensitivity calculator " + calculatorName , eee);
+ }
+ }
+ }
+ }
+
/**
* @return Returns the extraRules.
*/
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-21 12:54:14 UTC (rev 2132)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-21 12:55:06 UTC (rev 2133)
@@ -15,18 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *##%*/
-
-/* *
- * SensitivityChooserUI.
- *
- * @author letellier
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
- -->
+ *##%*/ -->
<Table>
<script><![CDATA[
import javax.swing.table.DefaultTableModel;
@@ -63,6 +52,20 @@
return fieldSensitivityCalculatorSelect.getModel();
}
+ /**
+ * Auto select calculator in JComboBox
+ * with calculator selected in SimulAction.
+ */
+ public void refreshSelectedSensitivityCalculator() {
+ SensitivityCalculator calculator = getSimulAction().getSensitivityCalculator();
+ if (calculator != null) {
+ // TODO it's not getSimpleName() here !
+ String name = calculator.getClass().getSimpleName();
+ fieldSensitivityCalculatorSelect.setSelectedItem(
+ new Item(name, name, name, false));
+ }
+ }
+
protected void sensCalculatorChanged() {
if (fieldSensitivityCalculatorSelect.getSelectedIndex() != -1) {
String sensitivityName = (String)fieldSensitivityCalculatorSelect.getSelectedItem();
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-04-21 12:54:14 UTC (rev 2132)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/ParamsUI.jaxx 2009-04-21 12:55:06 UTC (rev 2133)
@@ -135,8 +135,9 @@
getParentContainer(SensitivityUI.class).getSensitivityChooserUI().setExportListModel();
}
}
-protected void setSensibilities() {
+protected void setSensitivityCalculator() {
if (isSensitivity()){
+ getParentContainer(SensitivityUI.class).getSensitivityChooserUI().refreshSelectedSensitivityCalculator();
}
}
public void setSimulationParameter(SimulAction simulAction){
@@ -154,12 +155,11 @@
refresh();
setFactorRegion();
setExportSens();
- setSensibilities();
+ setSensitivityCalculator();
setFactor();
getParentContainer(WelcomePanelUI.class).setInfoText(_("isisfish.message.old.simulation.loaded"));
}
});
-
}
}
protected void addRules(){
@@ -201,7 +201,7 @@
if (fieldSimulOnlyExport.isSelected()){
getContextValue(SimulAction.class).getSimulationParameter().setOnlyExport(true);
}
- else{
+ else {
getContextValue(SimulAction.class).getSimulationParameter().setOnlyExport(false);
}
}
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java
===================================================================
--- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-21 12:54:14 UTC (rev 2132)
+++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/simulator/SimulAction.java 2009-04-21 12:55:06 UTC (rev 2133)
@@ -307,7 +307,7 @@
// Chargement des facteurs
File f = simulStorage.getMexicoDesignPlan(SimulationStorage.getSimulationDirectory(simulName));
- if (f != null){
+ if (f != null && f.canRead()) {
if (log.isDebugEnabled()) {
log.debug("Import design plan from : " + f.getPath());
}
@@ -320,6 +320,11 @@
factors.put(factor.getPath() + factor.getName(), factor);
}
}
+ else {
+ if (log.isInfoEnabled()) {
+ log.info("No xml design plan file found");
+ }
+ }
} catch (Exception eee) {
if (log.isErrorEnabled()) {
log.error("Can't load old Simulation: " + simulName, eee);
@@ -853,8 +858,12 @@
}
}
- public SensitivityStorage getSensitivity(String name) {
- return SensitivityStorage.getSensitivity(name);
+ /**
+ * Get current sensitivity calculator instance.
+ * @return sensitivity calculator
+ */
+ public SensitivityCalculator getSensitivityCalculator() {
+ return sensitivityCalculator;
}
public void setSensitivity(String name) {
Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java
===================================================================
--- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2009-04-21 12:54:14 UTC (rev 2132)
+++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2009-04-21 12:55:06 UTC (rev 2133)
@@ -46,7 +46,6 @@
/**
* Test for {@link SimulationService}.
*
- *
* @author chatellier
* @version $Revision: 1.0 $
*
1
0