Echobase-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
September 2012
- 3 participants
- 127 discussions
r593 - trunk/echobase-services/src/main/resources/embedded
by tchemit@users.forge.codelutin.com 03 Sep '12
by tchemit@users.forge.codelutin.com 03 Sep '12
03 Sep '12
Author: tchemit
Date: 2012-09-03 12:42:07 +0200 (Mon, 03 Sep 2012)
New Revision: 593
Url: http://forge.codelutin.com/repositories/revision/echobase/593
Log:
fixes #1452: Embedded application does not work under linux
Modified:
trunk/echobase-services/src/main/resources/embedded/startEchobase.sh
Modified: trunk/echobase-services/src/main/resources/embedded/startEchobase.sh
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/startEchobase.sh 2012-09-02 23:42:15 UTC (rev 592)
+++ trunk/echobase-services/src/main/resources/embedded/startEchobase.sh 2012-09-03 10:42:07 UTC (rev 593)
@@ -5,10 +5,12 @@
exit 1
fi
+JAVA_EXEC=$JDK_HOME/bin/java
+
OLDPWD=`pwd`
cd `dirname $0`
CURRENTPWD=`pwd`
ECHOBASE_OPTS="$JAVA_OPTS -Xms512m -Xmx10242m -Dechobase.log.dir=$CURRENTPWD/logs"
-java $ECHOBASE_OPTS -jar echobase-ui-${project.version}.war $*
+$JAVA_EXEC $ECHOBASE_OPTS -jar echobase-ui-${project.version}.war $*
cd "$OLDPWD"
1
0
02 Sep '12
Author: tchemit
Date: 2012-09-03 01:42:15 +0200 (Mon, 03 Sep 2012)
New Revision: 592
Url: http://forge.codelutin.com/repositories/revision/echobase/592
Log:
improve jdbc drivers accessibility (was not possible before only for embedded applications)
finish embedded application creation with new internal db (need some tests)
Added:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseApplicationConfigProvider.java
Removed:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
trunk/echobase-services/src/main/resources/embedded/echobase.properties
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
trunk/echobase-ui/src/main/resources/echobase.properties
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
Copied: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseApplicationConfigProvider.java (from rev 591, trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java)
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseApplicationConfigProvider.java (rev 0)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseApplicationConfigProvider.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -0,0 +1,60 @@
+package fr.ifremer.echobase;
+
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ApplicationConfigProvider;
+
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.l_;
+
+/**
+ * To generate configuration report.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchoBaseApplicationConfigProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "echobase";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l_(locale, "echobase.configuration.description");
+ }
+
+ @Override
+ public ApplicationConfig.OptionDef[] getOptions() {
+ return EchoBaseConfigurationOption.values();
+ }
+
+ @Override
+ public ApplicationConfig.ActionDef[] getActions() {
+ return new ApplicationConfig.ActionDef[0];
+ }
+}
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseApplicationConfigProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -23,6 +23,7 @@
package fr.ifremer.echobase;
import com.google.common.base.Preconditions;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,7 +35,6 @@
import java.io.File;
import java.io.IOException;
-import java.net.URL;
import java.util.Map;
import java.util.Properties;
@@ -110,6 +110,12 @@
}
createDirectory(EchoBaseConfigurationOption.DATA_DIRECTORY);
+ try {
+ FileUtils.forceMkdir(getWarDirectory());
+ FileUtils.forceMkdir(getLibDirectory());
+ } catch (IOException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
if (log.isDebugEnabled()) {
log.debug("parsed options in config file" +
@@ -135,11 +141,18 @@
}
public File getInternalDbDirectory() {
- File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.key);
+ File file = applicationConfig.getOptionAsFile(
+ EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.key);
Preconditions.checkNotNull(file);
return file;
}
+ public File getLibDirectory() {
+ File file = new File(getDataDirectory(), "lib");
+ Preconditions.checkNotNull(file);
+ return file;
+ }
+
public File getWarDirectory() {
File file = applicationConfig.getOptionAsFile(
EchoBaseConfigurationOption.WAR_DIRECTORY.key);
@@ -168,6 +181,20 @@
return v;
}
+ public String getH2Version() {
+ String v = applicationConfig.getOption(
+ EchoBaseConfigurationOption.H2_VERSION.key);
+ Preconditions.checkNotNull(v);
+ return v;
+ }
+
+ public String getPostgresqlVersion() {
+ String v = applicationConfig.getOption(
+ EchoBaseConfigurationOption.POSTGRESQL_VERSION.key);
+ Preconditions.checkNotNull(v);
+ return v;
+ }
+
public Class<?> getDriverClass() {
Class<?> klass = applicationConfig.getOptionAsClass(
TopiaContextFactory.CONFIG_DRIVER);
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -26,7 +26,6 @@
import org.nuiton.util.Version;
import java.io.File;
-import java.net.URL;
import static org.nuiton.i18n.I18n.n_;
@@ -53,6 +52,12 @@
VERSION("echobase.version",
n_("echobase.config.version.description"),
"", Version.class),
+ H2_VERSION("echobase.h2Version",
+ n_("echobase.config.h2Version.description"),
+ "", String.class),
+ POSTGRESQL_VERSION("echobase.postgresqlVersion",
+ n_("echobase.config.postgresqlVersion.description"),
+ "", String.class),
CSV_SEPARATOR("echobase.csv.separator",
n_("echobase.config.csv.separator.description"),
";", char.class),
Deleted: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -1,60 +0,0 @@
-package fr.ifremer.echobase;
-
-/*
- * #%L
- * EchoBase :: Domain
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import org.nuiton.util.ApplicationConfig;
-import org.nuiton.util.ApplicationConfigProvider;
-
-import java.util.Locale;
-
-import static org.nuiton.i18n.I18n.l_;
-
-/**
- * To generate configuration report.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class EchobaseApplicationConfigProvider implements ApplicationConfigProvider {
-
- @Override
- public String getName() {
- return "echobase";
- }
-
- @Override
- public String getDescription(Locale locale) {
- return l_(locale, "echobase.configuration.description");
- }
-
- @Override
- public ApplicationConfig.OptionDef[] getOptions() {
- return EchoBaseConfigurationOption.values();
- }
-
- @Override
- public ApplicationConfig.ActionDef[] getActions() {
- return new ApplicationConfig.ActionDef[0];
- }
-}
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -23,12 +23,11 @@
* #L%
*/
+import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.I18nAble;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
-import java.util.Properties;
-
import static org.nuiton.i18n.I18n.n_;
/**
@@ -43,17 +42,17 @@
H2Dialect.class,
n_("echobase.common.driverType.h2")) {
@Override
- public String getPilotFileName(Properties config) {
- String h2Version = config.getProperty("h2Version");
- return h2Version == null ? null : "h2-" + h2Version + ".jar";
+ public String getPilotFileName(EchoBaseConfiguration config) {
+ String version = config.getH2Version();
+ return version == null ? null : "h2-" + version + ".jar";
}
},
POSTGRESQL(org.postgresql.Driver.class,
PostgreSQLDialect.class,
n_("echobase.common.driverType.postgres")) {
@Override
- public String getPilotFileName(Properties config) {
- String pgVersion = config.getProperty("postgresqlVersion");
+ public String getPilotFileName(EchoBaseConfiguration config) {
+ String pgVersion = config.getPostgresqlVersion();
return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar";
}
};
@@ -80,7 +79,7 @@
return dialectClass;
}
- public abstract String getPilotFileName(Properties config);
+ public abstract String getPilotFileName(EchoBaseConfiguration config);
@Override
public String getI18nKey() {
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -24,7 +24,6 @@
*/
import com.google.common.base.Charsets;
-import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseConfigurationOption;
import fr.ifremer.echobase.entities.DriverType;
import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
@@ -66,16 +65,14 @@
// should not be instanciated
}
- public static Properties loadWorkingDbConfiguration(JdbcConfiguration jdbcConfiguration) {
+ public static Properties loadWorkingDbConfiguration(JdbcConfiguration conf) {
Properties result = new RecursiveProperties();
- DriverType driverType =
- jdbcConfiguration.getDriverType();
+ DriverType driverType = conf.getDriverType();
- result.setProperty("configuration.url", jdbcConfiguration.getUrl());
- result.setProperty("configuration.login", jdbcConfiguration.getLogin());
- result.setProperty("configuration.password",
- jdbcConfiguration.getPassword());
+ result.setProperty("configuration.url", conf.getUrl());
+ result.setProperty("configuration.login", conf.getLogin());
+ result.setProperty("configuration.password", conf.getPassword());
result.setProperty("configuration.driver",
driverType.getDriverClass().getName());
result.setProperty("configuration.dialect",
@@ -93,12 +90,10 @@
return result;
}
- public static Properties loadInternalDbconfiguration(EchoBaseConfiguration configuration) {
- File internalDbDirectory = configuration.getInternalDbDirectory();
+ public static Properties loadInternalDbconfiguration(File internalDbDirectory) {
Properties result = new RecursiveProperties();
- String key =
- EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.getKey();
+ String key = EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.getKey();
result.setProperty(key, internalDbDirectory.getAbsolutePath());
@@ -117,7 +112,6 @@
public static TopiaContext newWorkingDb(JdbcConfiguration jdbcConfiguration) {
Properties result = loadWorkingDbConfiguration(jdbcConfiguration);
-
return newDb(result);
}
@@ -125,16 +119,18 @@
* Open a new topia root context for the internal db of t3 (this should be
* a h2 db used only for security).
*
- * @param configuration application configuration where to find db directory
+ * @param internalDbDirectory directory of the internal db
* @return the new fresh root context of the internal db
*/
- public static TopiaContext newInternalDb(EchoBaseConfiguration configuration) {
+ public static TopiaContext newInternalDb(File internalDbDirectory) {
- Properties result = loadInternalDbconfiguration(configuration);
+ Properties result = loadInternalDbconfiguration(internalDbDirectory);
return newDb(result);
}
- protected static void loadProperties(Properties result, String path, String entities) {
+ protected static void loadProperties(Properties result,
+ String path,
+ String entities) {
URL dbConfigFile =
EchobaseTopiaContexts.class.getResource(path);
Modified: trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider
===================================================================
--- trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider 2012-09-02 23:42:15 UTC (rev 592)
@@ -1 +1 @@
-fr.ifremer.echobase.EchobaseApplicationConfigProvider
\ No newline at end of file
+fr.ifremer.echobase.EchoBaseApplicationConfigProvider
\ No newline at end of file
Modified: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 23:42:15 UTC (rev 592)
@@ -53,7 +53,9 @@
echobase.config.csv.separator.description=
echobase.config.data.directory.description=
echobase.config.embedded.description=
+echobase.config.h2Version.description=
echobase.config.internal.db.directory.description=
+echobase.config.postgresqlVersion.description=
echobase.config.version.description=
echobase.config.war.directory.description=
echobase.config.war.location.description=
Modified: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 23:42:15 UTC (rev 592)
@@ -53,7 +53,9 @@
echobase.config.csv.separator.description=
echobase.config.data.directory.description=Répertoire des données de l'application
echobase.config.embedded.description=
-echobase.config.internal.db.directory.description=Répertoire de la base interna
+echobase.config.h2Version.description=Version du pilote jdbc H2
+echobase.config.internal.db.directory.description=Répertoire de la base interne
+echobase.config.postgresqlVersion.description=Version du pilote jdbc Postgresql
echobase.config.version.description=Version de l'application
echobase.config.war.directory.description=Répertoire où sont accessibles les wars
echobase.config.war.location.description=chemin d'accèss au war embarqué à utiliser pour créer des applications embarquées
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -26,10 +26,12 @@
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.DriverType;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
import fr.ifremer.echobase.io.EchoBaseIOUtil;
-import fr.ifremer.echobase.entities.DriverType;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
import fr.ifremer.echobase.persistence.JdbcConfiguration;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
@@ -42,6 +44,8 @@
import fr.ifremer.echobase.services.exportquery.ExportQueryService;
import fr.ifremer.echobase.services.importdb.ImportDbConfiguration;
import fr.ifremer.echobase.services.importdb.ImportDbService;
+import fr.ifremer.echobase.services.workingDb.WorkingDbConfigurationAlreadyExistException;
+import fr.ifremer.echobase.services.workingDb.WorkingDbConfigurationService;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -101,44 +105,38 @@
model.incrementsProgression();
- //FIXME Review this to works with internal and working db...
- // create h2 db in /db
- JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(dir);
- TopiaContext rootContext =
- EchobaseTopiaContexts.newWorkingDb(dbConf);
+ // create new service context
+ EchoBaseServiceContext newServiceContext =
+ DefaultEchoBaseServiceContext.newContext(serviceContext,
+ null,
+ null);
- TopiaContext topiaContext = null;
+ EchoBaseUser admin;
try {
+ admin = importInternalDb(model, dir, newServiceContext);
+ } catch (Exception e) {
+ throw new EchoBaseTechnicalException(
+ "Could not create internal db", e);
+ }
- topiaContext = rootContext.beginTransaction();
+ // create working db in /db
+ JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(dir);
+ TopiaContext rootContext = EchobaseTopiaContexts.newWorkingDb(dbConf);
+ try {
+ newServiceContext.setTransaction(rootContext.beginTransaction());
model.incrementsProgression();
- // create new service context (with new transaction)
- EchoBaseServiceContext newServiceContext =
- DefaultEchoBaseServiceContext.newContext(serviceContext,
- null,
- topiaContext);
-
- EchoBaseUser admin = createUsers(newServiceContext);
-
- model.incrementsProgression();
-
- copyExportQueries(newServiceContext, admin);
-
- model.incrementsProgression();
-
importDb(model, newServiceContext, exportZipFile, admin);
} catch (Exception eee) {
rollbackTransaction(
- topiaContext,
+ newServiceContext.getTransaction(),
"Could not rollback h2 embedded database at " + dir);
throw new EchoBaseTechnicalException(
"Could not create h2 embedded database at " + dir, eee);
} finally {
- closeContext(rootContext,
- "Could not close h2 embedded database at " + dir);
+ EchoBaseEntityHelper.releaseRootContext(rootContext);
}
try {
@@ -151,6 +149,86 @@
return zipFile;
}
+ protected EchoBaseUser importInternalDb(EmbeddedApplicationConfiguration model,
+ File dir,
+ EchoBaseServiceContext newServiceContext) throws TopiaException, ExportQueryNameAlreadyExistException, WorkingDbConfigurationAlreadyExistException {
+
+ File internalDir = new File(dir, "internaldb");
+
+ TopiaContext internalRootContext =
+ EchobaseTopiaContexts.newInternalDb(internalDir);
+
+ newServiceContext.setInternalTransaction(
+ internalRootContext.beginTransaction());
+
+
+ try {
+ // get user service from h2 db
+ UserService userService = newServiceContext.getService(UserService.class);
+
+ // create admin user
+ userService.createDefaultUsers();
+
+ // get admin from h2 db
+ EchoBaseUser admin = userService.getUserByEmail(
+ UserService.DEFAULT_ADMIN_EMAIL);
+
+ model.incrementsProgression();
+
+ // get all export queries from application
+ List<ExportQuery> queries = getEntities(ExportQuery.class);
+
+ // replicate queries
+ getInternalTransaction().replicateEntities(
+ newServiceContext.getInternalTransaction(), queries);
+
+ // create export sql service from h2 db
+ ExportQueryService exportQueryService =
+ newServiceContext.getService(ExportQueryService.class);
+
+ // get all queries from h2 db
+ queries = exportQueryService.getEntities(ExportQuery.class);
+
+ // attach them to default created admin user in the db
+ for (ExportQuery query : queries) {
+ exportQueryService.createOrUpdate(query, admin);
+ }
+
+ model.incrementsProgression();
+
+ // get all working db configuration from application
+ WorkingDbConfigurationService workingDbConfigurationService =
+ newServiceContext.getService(WorkingDbConfigurationService.class);
+
+ List<WorkingDbConfiguration> confs =
+ getEntities(WorkingDbConfiguration.class);
+
+ // replicate configs
+ getInternalTransaction().replicateEntities(
+ newServiceContext.getInternalTransaction(), confs);
+
+ // add a new configuration to the embedded working db
+ WorkingDbConfiguration conf =
+ workingDbConfigurationService.newConfiguration();
+ conf.setDriverType(DriverType.H2);
+ conf.setLogin("sa");
+ conf.setDescription("Embedded working db");
+ conf.setUrl("jdbc:h2:file:${echobase.data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE");
+
+ workingDbConfigurationService.create(conf);
+
+ model.incrementsProgression();
+
+ return admin;
+
+ } finally {
+ newServiceContext.setInternalTransaction(null);
+ EchoBaseEntityHelper.releaseRootContext(internalRootContext);
+ }
+
+
+ }
+
protected void closeContext(TopiaContext tx, String message) {
try {
tx.closeContext();
@@ -180,7 +258,7 @@
}
protected int computeNbSteps(EmbeddedApplicationConfiguration model) {
- int nbSteps = 4;
+ int nbSteps = 5;
// export db steps
@@ -206,21 +284,22 @@
copyEmbeddedFiles(dir);
// copy war to /
- FileUtils.copyFile(warLocation, new File(dir, warLocation.getName()));
+ FileUtils.copyFile(warLocation,
+ new File(dir, warLocation.getName()));
} catch (Exception eee) {
- throw new EchoBaseTechnicalException("Could not create embedded zip structure at " + dir, eee);
+ throw new EchoBaseTechnicalException(
+ "Could not create embedded zip structure at " + dir, eee);
}
}
- protected File exportDb(EmbeddedApplicationConfiguration model,
- File tempDirectory) {
+ protected File exportDb(EmbeddedApplicationConfiguration model, File dir) {
try {
// create export zip file
ExportDbConfiguration exportconfiguration =
new ExportDbConfiguration(model);
exportconfiguration.setFileName("echobase-export");
- File exportTempDir = new File(tempDirectory, "exportDb");
+ File exportTempDir = new File(dir, "exportDb");
exportconfiguration.setWorkingDirectory(exportTempDir);
exportconfiguration.setVoyageIds(model.getVoyageIds());
TopiaContext transaction = serviceContext.getTransaction();
@@ -257,21 +336,11 @@
}
}
- public File getPilotsDirectory(File dataDirectory) {
- File driverDir = new File(dataDirectory, "drivers");
- return driverDir;
- }
-
-// public String getH2PilotFilename(Properties config) {
-// String h2Version = config.getProperty("h2Version");
-// return h2Version == null ? null : "h2-" + h2Version + ".jar";
+// public File getPilotsDirectory(File dataDirectory) {
+// File driverDir = new File(dataDirectory, "drivers");
+// return driverDir;
// }
-// public String getPostgresqlPilotFilename(Properties config) {
-// String pgVersion = config.getProperty("postgresqlVersion");
-// return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar";
-// }
-
protected void copyEmbeddedFiles(File zipDirectory) throws IOException, URISyntaxException {
// config to keep the echobase-embedded values (contains h2 and pg versions)
@@ -282,15 +351,15 @@
copyEmbeddedFiles("startEchobase.sh", zipDirectory, null);
copyEmbeddedFiles("README.txt", zipDirectory, null);
- File driverDir = getPilotsDirectory(zipDirectory);
- FileUtil.createDirectoryIfNecessary(driverDir);
- copyEmbeddedFiles(DriverType.H2.getPilotFileName(config), driverDir, null);
- copyEmbeddedFiles(DriverType.POSTGRESQL.getPilotFileName(config), driverDir, null);
+// File driverDir = getPilotsDirectory(zipDirectory);
+// FileUtil.createDirectoryIfNecessary(driverDir);
+// copyEmbeddedFiles(DriverType.H2.getPilotFileName(getConfiguration()), driverDir, null);
+// copyEmbeddedFiles(DriverType.POSTGRESQL.getPilotFileName(getConfiguration()), driverDir, null);
}
- protected void copyEmbeddedFiles(String resourceName,
- File zipDirectory,
- Properties config) throws IOException {
+ public void copyEmbeddedFiles(String resourceName,
+ File targetDirectory,
+ Properties config) throws IOException {
String resourcePath = EMBEDDED_PATH + resourceName;
InputStream inputStream = getClass().getResourceAsStream(resourcePath);
Preconditions.checkNotNull(inputStream,
@@ -299,7 +368,7 @@
if (config != null) {
config.load(inputStream);
}
- File outputFile = new File(zipDirectory, resourceName);
+ File outputFile = new File(targetDirectory, resourceName);
if (log.isInfoEnabled()) {
log.info("Copy configuration to " + resourceName + " to " + outputFile);
}
@@ -319,44 +388,6 @@
}
}
- protected EchoBaseUser createUsers(EchoBaseServiceContext newServiceContext) {
-
- // get user service from h2 db
- UserService userService =
- newServiceContext.getService(UserService.class);
-
- // create admin user
- userService.createDefaultUsers();
-
- // get admin from h2 db
- EchoBaseUser admin = userService.getUserByEmail(
- UserService.DEFAULT_ADMIN_EMAIL);
- return admin;
- }
-
- protected void copyExportQueries(EchoBaseServiceContext newServiceContext,
- EchoBaseUser admin) throws TopiaException, ExportQueryNameAlreadyExistException {
-
- // get all export queries from application
- List<ExportQuery> queries = getEntities(ExportQuery.class);
-
- // replicate queries
- getTransaction().replicateEntities(
- newServiceContext.getTransaction(), queries);
-
- // create export sql service from h2 db
- ExportQueryService exportQueryService =
- newServiceContext.getService(ExportQueryService.class);
-
- // get all queries from h2 db
- queries = exportQueryService.getEntities(ExportQuery.class);
-
- // attach them to default created admin user in the db
- for (ExportQuery query : queries) {
- exportQueryService.createOrUpdate(query, admin);
- }
- }
-
protected void importDb(EmbeddedApplicationConfiguration model,
EchoBaseServiceContext newServiceContext,
File exportZipFile,
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -23,13 +23,13 @@
* #L%
*/
-import com.google.common.base.Preconditions;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.WorkingDbConfiguration;
import fr.ifremer.echobase.entities.WorkingDbConfigurationDAO;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import org.nuiton.topia.TopiaException;
+import java.io.File;
import java.util.List;
/**
@@ -49,16 +49,6 @@
}
}
- public WorkingDbConfiguration getConfigurationByUrl(String url) {
- Preconditions.checkNotNull(url);
- try {
- WorkingDbConfiguration result = getDAO().findByUrl(url);
- return result;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(eee);
- }
- }
-
public WorkingDbConfiguration getEditableConf(String id) throws WorkingDbConfigurationNotFoundException {
WorkingDbConfiguration entity = getExistingConf(id);
WorkingDbConfiguration result = newConfiguration();
@@ -66,7 +56,14 @@
result.setDescription(entity.getDescription());
result.setDriverType(entity.getDriverType());
result.setLogin(entity.getLogin());
- result.setUrl(entity.getUrl());
+ String url = entity.getUrl();
+
+ if (url.contains("${echobase.data.directory}")) {
+ File dataDirectory = getConfiguration().getDataDirectory();
+ url = url.replace("${echobase.data.directory}",
+ dataDirectory.getAbsolutePath());
+ }
+ result.setUrl(url);
return result;
}
@@ -98,7 +95,6 @@
}
}
-
public WorkingDbConfiguration newConfiguration() {
try {
return getDAO().newInstance();
Modified: trunk/echobase-services/src/main/resources/embedded/echobase.properties
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-02 23:42:15 UTC (rev 592)
@@ -22,22 +22,8 @@
# #L%
###
-# Postgresql pilot version
-postgresqlVersion=${postgresqlVersion}
-
-# H2 pilot version
-h2Version=${h2Version}
-
# Where to find data
-data.directory=.
+echobase.data.directory=.
# where to find war
-war.directory=${echobase.data.directory}
-
-#FIXME use instead an working db configuration
-# Database configuration
-#hibernate.dialect=org.hibernate.dialect.H2Dialect
-#hibernate.connection.driver_class=org.h2.Driver
-#hibernate.connection.username=sa
-#hibernate.connection.password=sa
-#hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE
+echobase.war.directory=${echobase.data.directory}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -25,6 +25,7 @@
import com.google.common.base.Preconditions;
import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.entities.DriverType;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
@@ -32,6 +33,7 @@
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.UserService;
+import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService;
import fr.ird.converter.FloatConverter;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
@@ -48,6 +50,8 @@
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import java.io.File;
+import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@@ -95,7 +99,8 @@
// initialize internal root context
TopiaContext internalRootContext =
- EchobaseTopiaContexts.newInternalDb(configuration);
+ EchobaseTopiaContexts.newInternalDb(
+ configuration.getInternalDbDirectory());
// initialize application context
EchoBaseApplicationContext applicationContext =
@@ -107,12 +112,28 @@
applicationContext.setDbMeta(EchoBaseDbMeta.newDbMeta());
applicationContext.setInternalRootContext(internalRootContext);
+ EchoBaseServiceContext serviceContext =
+ DefaultEchoBaseServiceContext.newContext(
+ Locale.getDefault(),
+ null,
+ null,
+ configuration,
+ applicationContext.getDbMeta()
+ );
+
// init database (and create minimal admin user if required)
try {
- initInternalDatabase(applicationContext);
+ initInternalDatabase(applicationContext, serviceContext);
} catch (TopiaException e) {
throw new TopiaRuntimeException("Could not init internal db", e);
}
+
+ // copy drivers if required
+ try {
+ copyDriverFiles(serviceContext);
+ } catch (IOException e) {
+ throw new TopiaRuntimeException("Could not install drivers", e);
+ }
}
@Override
@@ -158,7 +179,8 @@
*
* @param context application context where to store global internal db root context
*/
- protected void initInternalDatabase(EchoBaseApplicationContext context) throws TopiaException {
+ protected void initInternalDatabase(EchoBaseApplicationContext context,
+ EchoBaseServiceContext serviceContext) throws TopiaException {
Preconditions.checkNotNull(context);
@@ -190,14 +212,8 @@
TopiaContext tx = rootContext.beginTransaction();
try {
- EchoBaseServiceContext serviceContext =
- DefaultEchoBaseServiceContext.newContext(
- Locale.getDefault(),
- tx,
- null,
- configuration,
- dbMeta
- );
+ serviceContext.setInternalTransaction(tx);
+
UserService service = serviceContext.getService(UserService.class);
List<EchoBaseUser> users = service.getUsers();
@@ -213,7 +229,29 @@
service.createDefaultUsers();
}
} finally {
+ serviceContext.setInternalTransaction(null);
EchoBaseEntityHelper.closeConnection(tx);
}
}
+
+ protected void copyDriverFiles(EchoBaseServiceContext serviceContext) throws IOException {
+ EmbeddedApplicationService service =
+ serviceContext.getService(EmbeddedApplicationService.class);
+ EchoBaseConfiguration configuration = serviceContext.getConfiguration();
+ File libDirectory = configuration.getLibDirectory();
+ for (DriverType driverType : DriverType.values()) {
+ String pilotFileName = driverType.getPilotFileName(configuration);
+ File pilotFile = new File(libDirectory, pilotFileName);
+ if (!pilotFile.exists()) {
+
+ // copy it from class-path
+ if (log.isInfoEnabled()) {
+ log.info("Copy driver " + pilotFileName +
+ " to directory " + libDirectory);
+ }
+ service.copyEmbeddedFiles(
+ pilotFileName, libDirectory, null);
+ }
+ }
+ }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 23:42:15 UTC (rev 592)
@@ -25,12 +25,9 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.persistence.JdbcConfiguration;
-import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.lang3.StringUtils;
import java.io.File;
-import java.util.Properties;
/**
* Display a page to show connection details.
@@ -62,18 +59,11 @@
dbConfiguration = getEchoBaseSession().getWorkingDbConfiguration();
- Properties properties = configuration.getProperties();
-
String pilotName =
- dbConfiguration.getDriverType().getPilotFileName(properties);
+ dbConfiguration.getDriverType().getPilotFileName(configuration);
- if (StringUtils.isNotEmpty(pilotName)) {
- EmbeddedApplicationService service =
- getService(EmbeddedApplicationService.class);
- File driverDirectory = service.getPilotsDirectory(
- configuration.getDataDirectory());
- jdbcPilot = new File(driverDirectory, pilotName);
- }
+ jdbcPilot = new File(configuration.getLibDirectory(), pilotName);
+
return SUCCESS;
}
}
Modified: trunk/echobase-ui/src/main/resources/echobase.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-02 23:42:15 UTC (rev 592)
@@ -22,5 +22,11 @@
# #L%
###
+#Project version
echobase.version=${project.version}
-echobase.site.url=${project.url}
+
+# Postgresql pilot version
+echobase.postgresqlVersion=${postgresqlVersion}
+
+# H2 pilot version
+echobase.h2Version=${h2Version}
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 16:38:43 UTC (rev 591)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 23:42:15 UTC (rev 592)
@@ -36,12 +36,10 @@
label='%{getText("echobase.common.jdbcLogin")}'/>
<s:label key="dbConfiguration.password"
label='%{getText("echobase.common.jdbcPassword")}'/>
- <s:label key="dbConfiguration.driver.name"
+ <s:label key="dbConfiguration.driverType.driverClass.name"
label='%{getText("echobase.common.jdbcDriver")}'/>
- <s:if test="jdbcPilot != null">
- <s:label key="jdbcPilot"
- label='%{getText("echobase.common.jdbcPilotPath")}'/>
- </s:if>
+ <s:label key="jdbcPilot"
+ label='%{getText("echobase.common.jdbcPilotPath")}'/>
</fieldset>
1
0
02 Sep '12
Author: tchemit
Date: 2012-09-02 18:38:43 +0200 (Sun, 02 Sep 2012)
New Revision: 591
Url: http://forge.codelutin.com/repositories/revision/echobase/591
Log:
- add missing svn properties and license header
- improve site (adding ApplicationConfig report)
Added:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java
trunk/echobase-domain/src/main/resources/META-INF/
trunk/echobase-domain/src/main/resources/META-INF/services/
trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
trunk/echobase-ui/src/license/THIRD-PARTY.properties
trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
trunk/echobase-ui/src/main/env/jetty-context.xml
trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
trunk/echobase-ui/src/main/webapp/images/connect.png
trunk/echobase-ui/src/main/webapp/images/disconnect.png
trunk/pom.xml
Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java (rev 0)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -0,0 +1,60 @@
+package fr.ifremer.echobase;
+
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ApplicationConfigProvider;
+
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.l_;
+
+/**
+ * To generate configuration report.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchobaseApplicationConfigProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "echobase";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l_(locale, "echobase.configuration.description");
+ }
+
+ @Override
+ public ApplicationConfig.OptionDef[] getOptions() {
+ return EchoBaseConfigurationOption.values();
+ }
+
+ @Override
+ public ApplicationConfig.ActionDef[] getActions() {
+ return new ApplicationConfig.ActionDef[0];
+ }
+}
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchobaseApplicationConfigProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: Domain
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: Domain
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Added: trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider
===================================================================
--- trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider (rev 0)
+++ trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider 2012-09-02 16:38:43 UTC (rev 591)
@@ -0,0 +1 @@
+fr.ifremer.echobase.EchobaseApplicationConfigProvider
\ No newline at end of file
Property changes on: trunk/echobase-domain/src/main/resources/META-INF/services/org.nuiton.util.ApplicationConfigProvider
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 16:38:43 UTC (rev 591)
@@ -57,3 +57,4 @@
echobase.config.version.description=
echobase.config.war.directory.description=
echobase.config.war.location.description=
+echobase.configuration.description=Configuration d'EchoBase
Modified: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 16:38:43 UTC (rev 591)
@@ -57,3 +57,4 @@
echobase.config.version.description=Version de l'application
echobase.config.war.directory.description=Répertoire où sont accessibles les wars
echobase.config.war.location.description=chemin d'accèss au war embarqué à utiliser pour créer des applications embarquées
+echobase.configuration.description=Configuration d'EchoBase
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: Services
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: Services
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: Services
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/echobase-ui/src/license/THIRD-PARTY.properties 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/license/THIRD-PARTY.properties 2012-09-02 16:38:43 UTC (rev 591)
@@ -2,7 +2,6 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - Affero General Public License (AGPL)
-# - Apache License
# - Apache Software License - Version 2.0
# - BSD License
# - BSD style
@@ -13,26 +12,21 @@
# - GNU Library or Lesser General Public License
# - General Public License (GPL)
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
-# - LGPL, version 2.1
# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
# - MPL 1.1
-# - Mozilla Public License version 1.1
# - The Apache Software License, Version 1.1
# - The Apache Software License, Version 2.0
# - The H2 License, Version 1.0
-# - The W3C Software License
# - license.txt
-# - provided without support or warranty
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Thu Mar 22 22:11:23 CET 2012
+#Sun Sep 02 17:21:28 CEST 2012
antlr--antlr--2.7.6=BSD License
-cglib--cglib-nodep--2.1_3=The Apache Software License, Version 2.0
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
javax.servlet--servlet-api--2.5=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
Modified: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/env/dev/resources/log4j.properties 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/env/dev/resources/log4j.properties 2012-09-02 16:38:43 UTC (rev 591)
@@ -3,7 +3,7 @@
# T3 :: Web
#
# $Id$
-# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/dev/resources/lo… $
+# $HeadURL$
# %%
# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
# %%
Property changes on: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/env/jetty-context.xml
===================================================================
--- trunk/echobase-ui/src/main/env/jetty-context.xml 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/env/jetty-context.xml 2012-09-02 16:38:43 UTC (rev 591)
@@ -3,7 +3,7 @@
#%L
Pollen :: UI (struts2)
$Id$
- $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/jetty/jetty-co… $
+ $HeadURL$
%%
Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
%%
Property changes on: trunk/echobase-ui/src/main/env/jetty-context.xml
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-02 16:38:43 UTC (rev 591)
@@ -3,7 +3,7 @@
# T3 :: Web
#
# $Id$
-# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/prod/resources/l… $
+# $HeadURL$
# %%
# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
# %%
Property changes on: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -3,7 +3,7 @@
* T3 :: Web
*
* $Id$
- * $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/java/fr/ird/t3/web/T… $
+ * $HeadURL$
* %%
* Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java 2012-09-02 16:38:43 UTC (rev 591)
@@ -4,7 +4,7 @@
* #%L
* EchoBase :: UI
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2012-09-02 16:38:43 UTC (rev 591)
@@ -2,7 +2,7 @@
#%L
EchoBase :: UI
$Id$
- $HeadURL:$
+ $HeadURL$
%%
Copyright (C) 2011 - 2012 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp 2012-09-02 16:38:43 UTC (rev 591)
@@ -2,7 +2,7 @@
#%L
EchoBase :: UI
$Id$
- $HeadURL:$
+ $HeadURL$
%%
Copyright (C) 2011 - 2012 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 16:38:43 UTC (rev 591)
@@ -2,7 +2,7 @@
#%L
EchoBase :: UI
$Id$
- $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/weba… $
+ $HeadURL$
%%
Copyright (C) 2011 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp 2012-09-02 16:38:43 UTC (rev 591)
@@ -2,7 +2,7 @@
#%L
EchoBase :: UI
$Id$
- $HeadURL:$
+ $HeadURL$
%%
Copyright (C) 2011 - 2012 Ifremer, Codelutin
%%
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: trunk/echobase-ui/src/main/webapp/images/connect.png
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/echobase-ui/src/main/webapp/images/disconnect.png
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-09-02 15:19:06 UTC (rev 590)
+++ trunk/pom.xml 2012-09-02 16:38:43 UTC (rev 591)
@@ -122,7 +122,7 @@
<eugenePluginVersion>2.5</eugenePluginVersion>
<topiaVersion>2.6.13</topiaVersion>
- <nuitonUtilsVersion>2.6</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.7-SNAPSHOT</nuitonUtilsVersion>
<nuitonI18nVersion>2.5-SNAPSHOT</nuitonI18nVersion>
<nuitonWebVersion>1.11</nuitonWebVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
1
0
r590 - in trunk: echobase-domain echobase-services echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb echobase-ui/src/main/resources/i18n
by tchemit@users.forge.codelutin.com 02 Sep '12
by tchemit@users.forge.codelutin.com 02 Sep '12
02 Sep '12
Author: tchemit
Date: 2012-09-02 17:19:06 +0200 (Sun, 02 Sep 2012)
New Revision: 590
Url: http://forge.codelutin.com/repositories/revision/echobase/590
Log:
optimize dependencies, i18n
Modified:
trunk/echobase-domain/pom.xml
trunk/echobase-services/pom.xml
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
Modified: trunk/echobase-domain/pom.xml
===================================================================
--- trunk/echobase-domain/pom.xml 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-domain/pom.xml 2012-09-02 15:19:06 UTC (rev 590)
@@ -174,6 +174,11 @@
</dependency>
<dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-services/pom.xml 2012-09-02 15:19:06 UTC (rev 590)
@@ -154,11 +154,6 @@
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- </dependency>
<!-- test dependencies -->
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 15:19:06 UTC (rev 590)
@@ -28,7 +28,7 @@
import fr.ifremer.echobase.entities.WorkingDbConfiguration;
import fr.ifremer.echobase.services.workingDb.WorkingDbConfigurationService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ParameterAware;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 15:19:06 UTC (rev 590)
@@ -25,7 +25,7 @@
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import fr.ifremer.echobase.entities.WorkingDbConfiguration;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* To create a new {@link WorkingDbConfiguration}.
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-02 15:19:06 UTC (rev 590)
@@ -1,8 +1,6 @@
echobase.action.backToUserList=
echobase.action.cancel=Cancel
echobase.action.clone=
-echobase.action.cloneSqlQuery=
-echobase.action.cloneWorkingDbConfiguration=
echobase.action.configureImport=
echobase.action.connectToWorkingDb=
echobase.action.create=
@@ -12,8 +10,6 @@
echobase.action.createSqlQuery=
echobase.action.createWorkingDbConfiguration=
echobase.action.delete=
-echobase.action.deleteSqlQuery=
-echobase.action.deleteWorkingDbConfiguration=
echobase.action.downloadEmbeddedApplicationFile=
echobase.action.downloadExportDbFile=
echobase.action.export=
@@ -32,7 +28,6 @@
echobase.action.return=
echobase.action.save=
echobase.action.saveSqlQuery=Update query
-echobase.action.saveWorkingDbConfiguration=
echobase.action.show.embedded.documentation=Show embedded application documentation
echobase.action.show.import.documentation=Show import documentation
echobase.action.toEnglish=Use english version
@@ -151,12 +146,10 @@
echobase.error.query.name.already.exists=Query name already used
echobase.error.required.email=Email is required
echobase.error.required.password=Password is required
-echobase.error.url.already.exists=
echobase.error.warlocation.notFound=War not found at location %s
echobase.error.workingDbConfiguration.couldNotConnect=
echobase.error.workingDbConfiguration.description.required=
echobase.error.workingDbConfiguration.login.required=
-echobase.error.workingDbConfiguration.password.required=
echobase.error.workingDbConfiguration.url.already.exists=
echobase.error.workingDbConfiguration.url.required=
echobase.header.request.result=
@@ -180,7 +173,6 @@
echobase.info.user.create=
echobase.info.user.delete=
echobase.info.user.update=
-echobase.info.workingDbConfiguration.not.modifiable=
echobase.info.workingDbconfiguration.connected=
echobase.info.workingDbconfiguration.created=
echobase.info.workingDbconfiguration.deleted=
@@ -226,7 +218,6 @@
echobase.legend.libreOfficeQuery=Requète "libre office"
echobase.legend.sqlQuery.configuration=
echobase.legend.sqlQuery.result=
-echobase.legend.workingDbConfiguration.configuration=
echobase.legend.workingDbConfiguration.create=
echobase.legend.workingDbConfiguration.use=
echobase.menu.connectToDbInformations=
@@ -239,7 +230,6 @@
echobase.menu.logs=
echobase.menu.users=
echobase.menu.viewData=view datas
-echobase.message.askAdministratorPassword=
echobase.message.no.row.selected=
echobase.message.noEntrySelection=
echobase.message.warnEmbeddedApplicationInProgress=
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-02 15:19:06 UTC (rev 590)
@@ -1,8 +1,6 @@
echobase.action.backToUserList=Retour à la liste des utilisateurs
echobase.action.cancel=Annuler
echobase.action.clone=Cloner
-echobase.action.cloneSqlQuery=Cloner
-echobase.action.cloneWorkingDbConfiguration=Cloner
echobase.action.configureImport=Configurer l'import
echobase.action.connectToWorkingDb=Se connecter
echobase.action.create=Créer
@@ -12,8 +10,6 @@
echobase.action.createSqlQuery=Enregistrer
echobase.action.createWorkingDbConfiguration=Enregistrer
echobase.action.delete=Supprimer
-echobase.action.deleteSqlQuery=Supprimer
-echobase.action.deleteWorkingDbConfiguration=Supprimer
echobase.action.downloadEmbeddedApplicationFile=Télécharger l'application embarquée
echobase.action.downloadExportDbFile=Télécharger le fichier d'export de la base complête
echobase.action.export=Exporter
@@ -32,7 +28,6 @@
echobase.action.return=Retour
echobase.action.save=Sauvegarder
echobase.action.saveSqlQuery=Mettre à jour
-echobase.action.saveWorkingDbConfiguration=Mettre à jour
echobase.action.show.embedded.documentation=Accéder à la documentation d'utilisation d'une application emabrquée
echobase.action.show.import.documentation=Accéder à la documentation de l'import
echobase.action.toEnglish=Utiliser la version anglaise
@@ -151,12 +146,10 @@
echobase.error.query.name.already.exists=Nom de requète déjà utilisé
echobase.error.required.email=L'email est obligatoire
echobase.error.required.password=Le mot de passe est obligatoire
-echobase.error.url.already.exists=Il existe déjà une configuration avec cette url
echobase.error.warlocation.notFound=L'application n'a pas été trouvé à l'emplacement suivant %s
echobase.error.workingDbConfiguration.couldNotConnect=Impossible de se connecter (%s)
echobase.error.workingDbConfiguration.description.required=Description obligatoire
echobase.error.workingDbConfiguration.login.required=Login obligatoire
-echobase.error.workingDbConfiguration.password.required=Mot de passe obligatoire
echobase.error.workingDbConfiguration.url.already.exists=Une connexion existe déjà avec cette url
echobase.error.workingDbConfiguration.url.required=Url obligatoire
echobase.header.request.result=Résultat de la requète sql
@@ -180,7 +173,6 @@
echobase.info.user.create=L'utilisateur '%s' a été créée
echobase.info.user.delete=L'utilisateur '%s' a été supprimé
echobase.info.user.update=L'utilisateur '%s' a été mis à jour
-echobase.info.workingDbConfiguration.not.modifiable=Configuration de base de travail non modifiable
echobase.info.workingDbconfiguration.connected=Connexion à la base de travail '%s' réussie
echobase.info.workingDbconfiguration.created=Configuration à la base de travail '%s' créée
echobase.info.workingDbconfiguration.deleted=Configuration à la base de travail '%s' supprimée
@@ -226,7 +218,6 @@
echobase.legend.libreOfficeQuery=Requète "libre office"
echobase.legend.sqlQuery.configuration=Configuration de la requète
echobase.legend.sqlQuery.result=Résultats de la requète
-echobase.legend.workingDbConfiguration.configuration=Configuration de la base de travail
echobase.legend.workingDbConfiguration.create=Création d'une configuration de base de travail
echobase.legend.workingDbConfiguration.use=Configuration de base de travail
echobase.menu.connectToDbInformations=Informations de connection à la base de travail
@@ -239,7 +230,6 @@
echobase.menu.logs=Journal des modifications
echobase.menu.users=Gérer les utilisateurs
echobase.menu.viewData=Visualiser les données
-echobase.message.askAdministratorPassword=Demander à un administrateur le mot de passe pour l'utilisateur donné
echobase.message.no.row.selected=Aucune donnée sélectionnée
echobase.message.noEntrySelection=Aucune entrée sélectionnée
echobase.message.warnEmbeddedApplicationInProgress=Merci de ne pas fermer la fenêtre pour pouvoir accéder aux résultats de la création de l'application embarquée.
1
0
02 Sep '12
Author: tchemit
Date: 2012-09-02 17:11:02 +0200 (Sun, 02 Sep 2012)
New Revision: 589
Url: http://forge.codelutin.com/repositories/revision/echobase/589
Log:
refs #1438: Choix d'une base de travail (admin ok, still need to review the embedded application creation (with internal db))
- fix users hql request
- improve code
- clean actions and much much more :)
Added:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
trunk/echobase-ui/src/main/env/jetty-context.xml
trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp
trunk/echobase-ui/src/main/webapp/images/connect.png
trunk/echobase-ui/src/main/webapp/images/disconnect.png
Removed:
trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties
trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties
trunk/echobase-ui/src/main/env/dev/resources/log4j.xml
trunk/echobase-ui/src/main/env/prod/resources/log4j.xml
trunk/echobase-ui/src/main/filters/
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
trunk/echobase-domain/src/main/resources/echobase-internaldb.properties
trunk/echobase-domain/src/main/resources/echobase-workingdb.properties
trunk/echobase-domain/src/main/xmi/echobase-internal.properties
trunk/echobase-domain/src/main/xmi/echobase-internal.zargo
trunk/echobase-domain/src/main/xmi/echobase.properties
trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java
trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java
trunk/echobase-domain/src/test/resources/log4j.properties
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java
trunk/echobase-services/src/main/resources/embedded/echobase.properties
trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
trunk/echobase-ui/pom.xml
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java
trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml
trunk/echobase-ui/src/main/resources/config/struts-importData.xml
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/resources/echobase.properties
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
trunk/echobase-ui/src/main/resources/struts.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp
trunk/echobase-ui/src/main/webapp/css/screen.css
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -73,7 +72,8 @@
log.info(this + " is initializing...");
}
try {
- applicationConfig.loadDefaultOptions(EchoBaseConfigurationOption.values());
+ applicationConfig.loadDefaultOptions(
+ EchoBaseConfigurationOption.values());
if (propos != null) {
for (Map.Entry<Object, Object> entry : propos.entrySet()) {
@@ -133,6 +133,7 @@
Preconditions.checkNotNull(file);
return file;
}
+
public File getInternalDbDirectory() {
File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.key);
Preconditions.checkNotNull(file);
@@ -167,13 +168,6 @@
return v;
}
- public URL getApplicationSite() {
- URL url = applicationConfig.getOptionAsURL(
- EchoBaseConfigurationOption.SITE_URL.key);
- Preconditions.checkNotNull(url);
- return url;
- }
-
public Class<?> getDriverClass() {
Class<?> klass = applicationConfig.getOptionAsClass(
TopiaContextFactory.CONFIG_DRIVER);
@@ -181,13 +175,6 @@
return klass;
}
- public String getJdbcUrl() {
- String jdbcUrl = applicationConfig.getOption(
- TopiaContextFactory.CONFIG_URL);
- Preconditions.checkNotNull(jdbcUrl);
- return jdbcUrl;
- }
-
public boolean isEmbedded() {
Class<?> driverClass = getDriverClass();
return driverClass.getName().toLowerCase().contains("h2");
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -40,33 +39,31 @@
public enum EchoBaseConfigurationOption implements ApplicationConfig.OptionDef {
/** Main directory where to put echobase data (logs, and others...). */
- DATA_DIRECTORY("data.directory",
+ DATA_DIRECTORY("echobase.data.directory",
n_("echobase.config.data.directory.description"),
"/var/local/echobase",
File.class),
INTERNAL_DB_DIRECTORY(
- "internal.db.directory",
+ "echobase.internal.db.directory",
n_("echobase.config.internal.db.directory.description"),
- "${data.directory}/internaldb",
- File.class),
- VERSION("project.version",
- "Version de l'application",
+ "${echobase.data.directory}/internaldb", File.class),
+ EMBEDDED("echobase.embedded",
+ n_("echobase.config.embedded.description"),
+ "false", boolean.class),
+ VERSION("echobase.version",
+ n_("echobase.config.version.description"),
"", Version.class),
- SITE_URL("project.siteUrl",
- "URL du site de l'application",
- "", URL.class),
- CSV_SEPARATOR("csv.separator",
- "Caractère de séparation pour les fichiers csv",
+ CSV_SEPARATOR("echobase.csv.separator",
+ n_("echobase.config.csv.separator.description"),
";", char.class),
- WAR_DIRECTORY("war.directory",
- "Répertoire où est stoqué le war",
- "${data.directory}/war", File.class),
- WAR_LOCATION("war.location",
- "Chemin complêt d'accès au war",
- "${war.directory}/echobase-ui-${project.version}.war",
+ WAR_DIRECTORY("echobase.war.directory",
+ n_("echobase.config.war.directory.description"),
+ "${echobase.data.directory}/war", File.class),
+ WAR_LOCATION("echobase.war.location",
+ n_("echobase.config.war.location.description"),
+ "${echobase.war.directory}/echobase-ui-${echobase.version}.war",
File.class);
-
/** Configuration key. */
protected final String key;
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -126,4 +125,4 @@
}
return result;
}
-}
\ No newline at end of file
+}
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java (rev 0)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,90 @@
+package fr.ifremer.echobase.entities;
+
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.I18nAble;
+import org.hibernate.dialect.H2Dialect;
+import org.hibernate.dialect.PostgreSQLDialect;
+
+import java.util.Properties;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * To define a type of driver (h2 or postgres for the moment).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public enum DriverType implements I18nAble {
+
+ H2(org.h2.Driver.class,
+ H2Dialect.class,
+ n_("echobase.common.driverType.h2")) {
+ @Override
+ public String getPilotFileName(Properties config) {
+ String h2Version = config.getProperty("h2Version");
+ return h2Version == null ? null : "h2-" + h2Version + ".jar";
+ }
+ },
+ POSTGRESQL(org.postgresql.Driver.class,
+ PostgreSQLDialect.class,
+ n_("echobase.common.driverType.postgres")) {
+ @Override
+ public String getPilotFileName(Properties config) {
+ String pgVersion = config.getProperty("postgresqlVersion");
+ return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar";
+ }
+ };
+
+ private final Class<?> driverClass;
+
+ private final Class<?> dialectClass;
+
+ private final String i18nKey;
+
+ DriverType(Class<?> driverClass,
+ Class<?> dialectClass,
+ String i18nKey) {
+ this.driverClass = driverClass;
+ this.dialectClass = dialectClass;
+ this.i18nKey = i18nKey;
+ }
+
+ public Class<?> getDriverClass() {
+ return driverClass;
+ }
+
+ public Class<?> getDialectClass() {
+ return dialectClass;
+ }
+
+ public abstract String getPilotFileName(Properties config);
+
+ @Override
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
+}
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -38,10 +37,9 @@
users = findAll();
} else {
- String fqn = getTopiaEntityEnum().getImplementationFQN();
-
- computeAndAddRecordsToPager("SELECT COUNT()* FROM " + fqn, pager);
- users = findAllByQuery("FROM " + fqn, pager);
+ String hql = "FROM " + getTopiaEntityEnum().getImplementationFQN();
+ computeAndAddRecordsToPager("SELECT COUNT(*) " + hql, pager);
+ users = findAllByQuery(hql);
}
return users;
}
Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java (rev 0)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,51 @@
+package fr.ifremer.echobase.entities;
+
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.topia.TopiaException;
+
+import java.util.List;
+
+public class ExportQueryDAOImpl<E extends ExportQuery> extends ExportQueryDAOAbstract<E> {
+
+ public boolean isQueryExists(String id, String queryName) throws TopiaException {
+
+ String hql = "SELECT COUNT(*)" +
+ " FROM " + getTopiaEntityEnum().getImplementationFQN() +
+ " WHERE " + ExportQuery.PROPERTY_NAME + " = :name";
+
+ List<Object> params = Lists.<Object>newArrayList("name", queryName);
+
+ if (StringUtils.isNotBlank(id)) {
+ hql += " AND " + ExportQuery.TOPIA_ID + " = :id";
+ params.add("id");
+ params.add(id);
+ }
+
+ boolean result = existsByQuery(hql, params.toArray());
+ return result;
+ }
+}
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,7 @@
package fr.ifremer.echobase.persistence;
/*
* #%L
- * EchoBase :: Entities
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -2,7 +2,7 @@
/*
* #%L
- * EchoBase :: Entities
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -47,22 +47,6 @@
/** Logger. */
private static final Log log = LogFactory.getLog(EchoBaseEntityHelper.class);
- public static Connection newJDBCConnection(JdbcConfiguration configuration) throws SQLException {
-
- String jdbcUrl = configuration.getUrl();
- String login = configuration.getLogin();
- String password = configuration.getPassword();
-
- Connection conn = DriverManager.getConnection(jdbcUrl, login, password);
-
- if (log.isDebugEnabled()) {
- log.debug("connexion reussie pour l'utilisateur " + login +
- " at [" + jdbcUrl + ']');
- }
-
- return conn;
- }
-
public static TopiaContext newTransactionFromRootContext(TopiaContext otherTx) throws TopiaException {
TopiaContext tx = ((TopiaContextImplementor) otherTx).getRootContext().beginTransaction();
return tx;
@@ -98,8 +82,17 @@
Connection conn = null;
try {
- conn = newJDBCConnection(configuration);
+ String jdbcUrl = configuration.getUrl();
+ String login = configuration.getLogin();
+ String password = configuration.getPassword();
+ conn = DriverManager.getConnection(jdbcUrl, login, password);
+
+ if (log.isDebugEnabled()) {
+ log.debug("connexion reussie pour l'utilisateur " + login +
+ " at [" + jdbcUrl + ']');
+ }
+
} finally {
if (conn != null) {
try {
@@ -114,15 +107,6 @@
}
}
-// public static JdbcConfiguration newJdbcConfiguration(Properties dbConf) {
-//
-// JdbcConfiguration result = new JdbcConfiguration();
-// result.setUrl(dbConf.getProperty(TopiaContextFactory.CONFIG_URL));
-// result.setLogin(dbConf.getProperty(TopiaContextFactory.CONFIG_USER));
-// result.setPassword(dbConf.getProperty(TopiaContextFactory.CONFIG_PASS));
-// return result;
-// }
-
public static void closeConnection(TopiaContext transaction) {
if (transaction == null) {
if (log.isTraceEnabled()) {
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -2,7 +2,7 @@
/*
* #%L
- * EchoBase :: Entities
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -25,9 +25,11 @@
import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import fr.ifremer.echobase.entities.EchoBaseUserImpl;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaPersistenceHelper;
@@ -58,4 +60,20 @@
public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, EchoBaseEntityEnum type) {
return (TopiaDAO<E>) getDAO(tx, type.getContract());
}
+
+ /**
+ * Tests if the internal database schema created.
+ *
+ * @param tx transaction
+ * @return {@code true} if the schema is already created, {@code false}
+ * otherwise
+ * @throws TopiaException if something was wrong while requesting database
+ */
+ public boolean isInternalSchemaCreated(TopiaContext tx) throws TopiaException {
+
+ boolean schemaFound =
+ ((TopiaContextImplementor) tx).isSchemaExist(EchoBaseUserImpl.class);
+
+ return schemaFound;
+ }
}
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,8 +1,32 @@
package fr.ifremer.echobase.persistence;
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
import com.google.common.base.Charsets;
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseConfigurationOption;
+import fr.ifremer.echobase.entities.DriverType;
import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
import fr.ifremer.echobase.entities.EchoBaseInternalDAOHelper;
import org.apache.commons.logging.Log;
@@ -45,26 +69,17 @@
public static Properties loadWorkingDbConfiguration(JdbcConfiguration jdbcConfiguration) {
Properties result = new RecursiveProperties();
- Class<?> driverType;
- Class<?> dialectType;
- switch (jdbcConfiguration.getDriverType()) {
- case H2:
- driverType = org.h2.Driver.class;
- dialectType = org.hibernate.dialect.H2Dialect.class;
- break;
- case POSTGRESQL:
- driverType = org.postgresql.Driver.class;
- dialectType = org.hibernate.dialect.PostgreSQLDialect.class;
- break;
- default:
- throw new IllegalStateException("Could not find driver...");
- }
+ DriverType driverType =
+ jdbcConfiguration.getDriverType();
result.setProperty("configuration.url", jdbcConfiguration.getUrl());
result.setProperty("configuration.login", jdbcConfiguration.getLogin());
- result.setProperty("configuration.password", jdbcConfiguration.getPassword());
- result.setProperty("configuration.driver", driverType.getName());
- result.setProperty("configuration.dialect", dialectType.getName());
+ result.setProperty("configuration.password",
+ jdbcConfiguration.getPassword());
+ result.setProperty("configuration.driver",
+ driverType.getDriverClass().getName());
+ result.setProperty("configuration.dialect",
+ driverType.getDialectClass().getName());
loadProperties(result, USER_DB_PROPERTIES,
EchoBaseDAOHelper.getImplementationClassesAsString());
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,6 +1,6 @@
/*
* #%L
- * T3 :: Domain
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
@@ -22,16 +22,13 @@
*/
package fr.ifremer.echobase.persistence;
+import fr.ifremer.echobase.entities.DriverType;
+
import java.io.File;
import java.io.Serializable;
public class JdbcConfiguration implements Serializable {
- public enum DriverType {
- H2,
- POSTGRESQL
- }
-
public static JdbcConfiguration newConfig(String url,
String login,
String password,
@@ -75,7 +72,7 @@
/** Jdbc driver. */
protected DriverType driverType;
- private JdbcConfiguration() {
+ protected JdbcConfiguration() {
// avoid constructor (use the static factory methods)
}
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Services
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,5 +1,28 @@
package fr.ifremer.echobase.services;
+/*
+ * #%L
+ * EchoBase :: Domain
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
/**
* Contract to provide some services.
*
Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: trunk/echobase-domain/src/main/resources/echobase-internaldb.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/echobase-internaldb.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/resources/echobase-internaldb.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,6 +1,6 @@
###
# #%L
-# T3 :: Domain
+# EchoBase :: Domain
# $Id$
# $HeadURL$
# %%
@@ -28,5 +28,5 @@
hibernate.connection.username=sa
hibernate.connection.password=sa
hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:${internal.db.directory}/echobase-user
+hibernate.connection.url=jdbc:h2:file:${echobase.internal.db.directory}/echobase-user
Modified: trunk/echobase-domain/src/main/resources/echobase-workingdb.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/echobase-workingdb.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/resources/echobase-workingdb.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,6 +1,6 @@
###
# #%L
-# T3 :: Domain
+# EchoBase :: Domain
# $Id$
# $HeadURL$
# %%
Copied: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties (from rev 588, trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties)
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties (rev 0)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,59 @@
+echobase.common.admin=
+echobase.common.areaOfOperation=
+echobase.common.author=
+echobase.common.authorEmail=
+echobase.common.calibration=
+echobase.common.cell=
+echobase.common.data=
+echobase.common.dataAcquisition=
+echobase.common.dataCentre=
+echobase.common.dataCentreEmail=
+echobase.common.dataProcessing=
+echobase.common.dataQuality=
+echobase.common.datum=
+echobase.common.depthStratum=
+echobase.common.description=
+echobase.common.distributionStatement=
+echobase.common.driverType.h2=
+echobase.common.driverType.postgres=
+echobase.common.echoBaseUser=
+echobase.common.email=
+echobase.common.entityId=
+echobase.common.entityModificationLog=
+echobase.common.entityType=
+echobase.common.exportQuery=
+echobase.common.id=
+echobase.common.institution=
+echobase.common.keywords=
+echobase.common.lastModifiedDate=
+echobase.common.lastModifiedUser=
+echobase.common.litteratureReferences=
+echobase.common.metadata=
+echobase.common.mission=
+echobase.common.missionAbstract=
+echobase.common.modificationDate=
+echobase.common.modificationText=
+echobase.common.modificationUser=
+echobase.common.name=
+echobase.common.organisationLevelAcknowledgements=
+echobase.common.organisationReferences=
+echobase.common.password=
+echobase.common.platform=
+echobase.common.principalInvestigator=
+echobase.common.principalInvestigatorEmail=
+echobase.common.project=
+echobase.common.referenceDatum=
+echobase.common.source=
+echobase.common.species=
+echobase.common.sqlQuery=
+echobase.common.transect=
+echobase.common.transit=
+echobase.common.vessel=
+echobase.common.voyage=
+echobase.config.csv.separator.description=
+echobase.config.data.directory.description=
+echobase.config.embedded.description=
+echobase.config.internal.db.directory.description=
+echobase.config.version.description=
+echobase.config.war.directory.description=
+echobase.config.war.location.description=
Property changes on: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties (from rev 588, trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties)
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties (rev 0)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,59 @@
+echobase.common.admin=Administrateur
+echobase.common.areaOfOperation=AreaOfOperation
+echobase.common.author=Auteur
+echobase.common.authorEmail=Courriel de l'auteur
+echobase.common.calibration=Calibration
+echobase.common.cell=Cell
+echobase.common.data=Data
+echobase.common.dataAcquisition=DataAcquisition
+echobase.common.dataCentre=Centre de données
+echobase.common.dataCentreEmail=Courriel du centre de données
+echobase.common.dataProcessing=DataProcessing
+echobase.common.dataQuality=DataQuality
+echobase.common.datum=Datum
+echobase.common.depthStratum=DepthStratum
+echobase.common.description=Description
+echobase.common.distributionStatement=distributionStatement
+echobase.common.driverType.h2=Base H2
+echobase.common.driverType.postgres=Base Postgresql
+echobase.common.echoBaseUser=Utilisateur
+echobase.common.email=Courriel
+echobase.common.entityId=Identifiant de l'entité
+echobase.common.entityModificationLog=Journal des modifications
+echobase.common.entityType=Type de l'entité
+echobase.common.exportQuery=Requête d'export
+echobase.common.id=Identifiant
+echobase.common.institution=Institution
+echobase.common.keywords=Môts clefs
+echobase.common.lastModifiedDate=Date de dernière modification
+echobase.common.lastModifiedUser=Utilisateur de dernière modification
+echobase.common.litteratureReferences=Références
+echobase.common.metadata=Metadata
+echobase.common.mission=Mission
+echobase.common.missionAbstract=Résumé de la mission
+echobase.common.modificationDate=Date de modification
+echobase.common.modificationText=Modification
+echobase.common.modificationUser=Utilisateur
+echobase.common.name=Nom
+echobase.common.organisationLevelAcknowledgements=organisationLevelAcknowledgements
+echobase.common.organisationReferences=Références organisation
+echobase.common.password=Mot de passe
+echobase.common.platform=Platform
+echobase.common.principalInvestigator=Chercheur
+echobase.common.principalInvestigatorEmail=Courriel du chercheur
+echobase.common.project=Projet
+echobase.common.referenceDatum=ReferenceDatum
+echobase.common.source=Source
+echobase.common.species=Espèce
+echobase.common.sqlQuery=Requête SQL
+echobase.common.transect=Transect
+echobase.common.transit=Transit
+echobase.common.vessel=Navire
+echobase.common.voyage=Campagne
+echobase.config.csv.separator.description=
+echobase.config.data.directory.description=Répertoire des données de l'application
+echobase.config.embedded.description=
+echobase.config.internal.db.directory.description=Répertoire de la base interna
+echobase.config.version.description=Version de l'application
+echobase.config.war.directory.description=Répertoire où sont accessibles les wars
+echobase.config.war.location.description=chemin d'accèss au war embarqué à utiliser pour créer des applications embarquées
Property changes on: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,52 +0,0 @@
-echobase.common.admin=
-echobase.common.areaOfOperation=
-echobase.common.author=
-echobase.common.authorEmail=
-echobase.common.calibration=
-echobase.common.cell=
-echobase.common.data=
-echobase.common.dataAcquisition=
-echobase.common.dataCentre=
-echobase.common.dataCentreEmail=
-echobase.common.dataProcessing=
-echobase.common.dataQuality=
-echobase.common.datum=
-echobase.common.depthStratum=
-echobase.common.description=
-echobase.common.distributionStatement=
-echobase.common.echoBaseUser=
-echobase.common.email=
-echobase.common.entityId=
-echobase.common.entityModificationLog=
-echobase.common.entityType=
-echobase.common.exportQuery=
-echobase.common.id=
-echobase.common.institution=
-echobase.common.keywords=
-echobase.common.lastModifiedDate=
-echobase.common.lastModifiedUser=
-echobase.common.litteratureReferences=
-echobase.common.metadata=
-echobase.common.mission=
-echobase.common.missionAbstract=
-echobase.common.modificationDate=
-echobase.common.modificationText=
-echobase.common.modificationUser=
-echobase.common.name=
-echobase.common.organisationLevelAcknowledgements=
-echobase.common.organisationReferences=
-echobase.common.password=
-echobase.common.platform=
-echobase.common.principalInvestigator=
-echobase.common.principalInvestigatorEmail=
-echobase.common.project=
-echobase.common.referenceDatum=
-echobase.common.source=
-echobase.common.species=
-echobase.common.sqlQuery=
-echobase.common.transect=
-echobase.common.transit=
-echobase.common.vessel=
-echobase.common.voyage=
-echobase.config.data.directory.description=
-echobase.config.internal.db.directory.description=
Deleted: trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties
===================================================================
--- trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,52 +0,0 @@
-echobase.common.admin=Administrateur
-echobase.common.areaOfOperation=AreaOfOperation
-echobase.common.author=Auteur
-echobase.common.authorEmail=Courriel de l'auteur
-echobase.common.calibration=Calibration
-echobase.common.cell=Cell
-echobase.common.data=Data
-echobase.common.dataAcquisition=DataAcquisition
-echobase.common.dataCentre=Centre de données
-echobase.common.dataCentreEmail=Courriel du centre de données
-echobase.common.dataProcessing=DataProcessing
-echobase.common.dataQuality=DataQuality
-echobase.common.datum=Datum
-echobase.common.depthStratum=DepthStratum
-echobase.common.description=Description
-echobase.common.distributionStatement=distributionStatement
-echobase.common.echoBaseUser=Utilisateur
-echobase.common.email=Courriel
-echobase.common.entityId=Identifiant de l'entité
-echobase.common.entityModificationLog=Journal des modifications
-echobase.common.entityType=Type de l'entité
-echobase.common.exportQuery=Requête d'export
-echobase.common.id=Identifiant
-echobase.common.institution=Institution
-echobase.common.keywords=Môts clefs
-echobase.common.lastModifiedDate=Date de dernière modification
-echobase.common.lastModifiedUser=Utilisateur de dernière modification
-echobase.common.litteratureReferences=Références
-echobase.common.metadata=Metadata
-echobase.common.mission=Mission
-echobase.common.missionAbstract=Résumé de la mission
-echobase.common.modificationDate=Date de modification
-echobase.common.modificationText=Modification
-echobase.common.modificationUser=Utilisateur
-echobase.common.name=Nom
-echobase.common.organisationLevelAcknowledgements=organisationLevelAcknowledgements
-echobase.common.organisationReferences=Références organisation
-echobase.common.password=Mot de passe
-echobase.common.platform=Platform
-echobase.common.principalInvestigator=Chercheur
-echobase.common.principalInvestigatorEmail=Courriel du chercheur
-echobase.common.project=Projet
-echobase.common.referenceDatum=ReferenceDatum
-echobase.common.source=Source
-echobase.common.species=Espèce
-echobase.common.sqlQuery=Requête SQL
-echobase.common.transect=Transect
-echobase.common.transit=Transit
-echobase.common.vessel=Navire
-echobase.common.voyage=Campagne
-echobase.config.data.directory.description=Chemin de l'application
-echobase.config.internal.db.directory.description=
Modified: trunk/echobase-domain/src/main/xmi/echobase-internal.properties
===================================================================
--- trunk/echobase-domain/src/main/xmi/echobase-internal.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/xmi/echobase-internal.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
###
# #%L
-# EchoBase :: Entities
-#
+# EchoBase :: Domain
# $Id$
# $HeadURL$
# %%
@@ -51,18 +50,27 @@
fr.ifremer.echobase.entities.EchoBaseUser.class.tagValue.naturalIdMutable=true
fr.ifremer.echobase.entities.EchoBaseUser.attribute.email.tagValue.naturalId=true
+
+fr.ifremer.echobase.entities.ExportQuery.class.tagValue.naturalIdMutable=true
+fr.ifremer.echobase.entities.ExportQuery.attribute.name.tagValue.naturalId=true
+
+fr.ifremer.echobase.entities.WorkingDbConfiguration.class.tagValue.naturalIdMutable=true
+fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.naturalId=true
+fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.driverType.tagValue.naturalId=true
+
+###############################################################################
+### Not Null ##################################################################
+###############################################################################
+
fr.ifremer.echobase.entities.EchoBaseUser.attribute.email.tagValue.notNull=true
fr.ifremer.echobase.entities.EchoBaseUser.attribute.password.tagValue.notNull=true
-fr.ifremer.echobase.entities.ExportQuery.class.tagValue.naturalIdMutable=true
-fr.ifremer.echobase.entities.ExportQuery.attribute.name.tagValue.naturalId=true
fr.ifremer.echobase.entities.ExportQuery.attribute.description.tagValue.notNull=true
fr.ifremer.echobase.entities.ExportQuery.attribute.sqlQuery.tagValue.notNull=true
fr.ifremer.echobase.entities.ExportQuery.attribute.lastModifiedDate.tagValue.notNull=true
fr.ifremer.echobase.entities.ExportQuery.attribute.lastModifiedUser.tagValue.notNull=true
-fr.ifremer.echobase.entities.WorkingDbConfiguration.class.tagValue.naturalIdMutable=true
-fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.naturalId=true
fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.notNull=true
-fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.naturalId=true
-fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.notNull=true
\ No newline at end of file
+fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.notNull=true
+fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.description.tagValue.notNull=true
+fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.driverType.tagValue.notNull=true
Modified: trunk/echobase-domain/src/main/xmi/echobase-internal.zargo
===================================================================
(Binary files differ)
Modified: trunk/echobase-domain/src/main/xmi/echobase.properties
===================================================================
--- trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
###
# #%L
-# EchoBase :: Entities
-#
+# EchoBase :: Domain
# $Id$
# $HeadURL$
# %%
Modified: trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java
===================================================================
--- trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java
===================================================================
--- trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
/*
* #%L
- * EchoBase :: Entities
- *
+ * EchoBase :: Domain
* $Id$
* $HeadURL$
* %%
Modified: trunk/echobase-domain/src/test/resources/log4j.properties
===================================================================
--- trunk/echobase-domain/src/test/resources/log4j.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-domain/src/test/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,7 +1,6 @@
###
# #%L
-# EchoBase :: Entities
-#
+# EchoBase :: Domain
# $Id$
# $HeadURL$
# %%
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -27,7 +27,6 @@
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserDAO;
-import fr.ifremer.echobase.entities.EchoBaseUserImpl;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
@@ -55,7 +54,7 @@
public List<EchoBaseUser> getUsers(TopiaFilterPagerUtil.FilterPagerBean pager) {
try {
- EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class);
+ EchoBaseUserDAO dao = getDAO();
List<EchoBaseUser> users = dao.findAll(pager);
return users;
} catch (TopiaException eee) {
@@ -66,7 +65,7 @@
public EchoBaseUser getUserByEmail(String email) {
Preconditions.checkNotNull(email);
try {
- EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class);
+ EchoBaseUserDAO dao = getDAO();
EchoBaseUser user = dao.findByEmail(email);
return user;
} catch (TopiaException eee) {
@@ -77,8 +76,7 @@
public EchoBaseUser getUserById(String userId) {
Preconditions.checkNotNull(userId);
try {
- EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class);
- EchoBaseUser user = dao.findByTopiaId(userId);
+ EchoBaseUser user = getDAO().findByTopiaId(userId);
EchoBaseUser result = newUser();
result.setEmail(user.getEmail());
result.setPassword(user.getPassword());
@@ -91,14 +89,13 @@
public void createOrUpdate(EchoBaseUser user) {
try {
- EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class);
EchoBaseUser userToCreateOrUpdate;
// No id, creating new one entity
String id = user.getTopiaId();
String password = user.getPassword();
if (StringUtils.isEmpty(id)) {
- userToCreateOrUpdate = dao.create(
+ userToCreateOrUpdate = getDAO().create(
EchoBaseUser.PROPERTY_EMAIL, user.getEmail(),
EchoBaseUser.PROPERTY_PASSWORD, encodePassword(password)
);
@@ -121,7 +118,7 @@
try {
EchoBaseUser userToDelete = getEntityById(EchoBaseUser.class,
user.getTopiaId());
- getDAO(EchoBaseUser.class).delete(userToDelete);
+ getDAO().delete(userToDelete);
commitInternalTransaction("Could not delete user");
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -137,13 +134,13 @@
public void createDefaultUsers() {
EchoBaseUser user;
- user = new EchoBaseUserImpl();
+ user = newUser();
user.setEmail(DEFAULT_ADMIN_EMAIL);
user.setPassword(DEFAULT_ADMIN_PASSWORD);
user.setAdmin(true);
createOrUpdate(user);
- user = new EchoBaseUserImpl();
+ user = newUser();
user.setEmail(DEFAULT_USER_EMAIL);
user.setPassword(DEFAULT_USER_PASSWORD);
user.setAdmin(false);
@@ -156,6 +153,14 @@
}
public EchoBaseUser newUser() {
- return new EchoBaseUserImpl();
+ try {
+ return getDAO().newInstance();
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
}
+
+ protected EchoBaseUserDAO getDAO() {
+ return getDAO(EchoBaseUser.class, EchoBaseUserDAO.class);
+ }
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -25,19 +25,20 @@
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.ExportQuery;
import fr.ifremer.echobase.io.EchoBaseIOUtil;
-import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.DriverType;
import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
import fr.ifremer.echobase.persistence.JdbcConfiguration;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.ExportQuery;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.UserService;
-import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException;
import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration;
import fr.ifremer.echobase.services.exportdb.ExportDbService;
+import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException;
import fr.ifremer.echobase.services.exportquery.ExportQueryService;
import fr.ifremer.echobase.services.importdb.ImportDbConfiguration;
import fr.ifremer.echobase.services.importdb.ImportDbService;
@@ -261,15 +262,15 @@
return driverDir;
}
- public String getH2PilotFilename(Properties config) {
- String h2Version = config.getProperty("h2Version");
- return h2Version == null ? null : "h2-" + h2Version + ".jar";
- }
+// public String getH2PilotFilename(Properties config) {
+// String h2Version = config.getProperty("h2Version");
+// return h2Version == null ? null : "h2-" + h2Version + ".jar";
+// }
- public String getPostgresqlPilotFilename(Properties config) {
- String pgVersion = config.getProperty("postgresqlVersion");
- return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar";
- }
+// public String getPostgresqlPilotFilename(Properties config) {
+// String pgVersion = config.getProperty("postgresqlVersion");
+// return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar";
+// }
protected void copyEmbeddedFiles(File zipDirectory) throws IOException, URISyntaxException {
@@ -283,8 +284,8 @@
File driverDir = getPilotsDirectory(zipDirectory);
FileUtil.createDirectoryIfNecessary(driverDir);
- copyEmbeddedFiles(getH2PilotFilename(config), driverDir, null);
- copyEmbeddedFiles(getPostgresqlPilotFilename(config), driverDir, null);
+ copyEmbeddedFiles(DriverType.H2.getPilotFileName(config), driverDir, null);
+ copyEmbeddedFiles(DriverType.POSTGRESQL.getPilotFileName(config), driverDir, null);
}
protected void copyEmbeddedFiles(String resourceName,
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,18 +24,13 @@
package fr.ifremer.echobase.services.exportquery;
import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
import fr.ifremer.echobase.entities.ExportQueryDAO;
-import fr.ifremer.echobase.entities.ExportQueryImpl;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.util.PagerUtil;
import org.nuiton.util.csv.Export;
@@ -50,9 +45,6 @@
*/
public class ExportQueryService extends EchoBaseServiceSupport {
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExportQueryService.class);
-
public ExportQuery getExportQuery(String topiaId) {
ExportQuery exportQuery = getEntityById(ExportQuery.class, topiaId);
ExportQuery entityToSave = newExportQuery();
@@ -69,8 +61,7 @@
EchoBaseUser user) throws ExportQueryNameAlreadyExistException {
try {
- ExportQueryDAO dao = getDAO(ExportQuery.class,
- ExportQueryDAO.class);
+ ExportQueryDAO dao = getDAO();
// No id, creating new one entity
String id = exportQuery.getTopiaId();
@@ -79,28 +70,9 @@
String queryName = exportQuery.getName();
-
- String hql = "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() +
- " WHERE " + ExportQuery.PROPERTY_NAME + " = :queryName";
- List<Object> params = Lists.<Object>newArrayList("queryName", queryName);
-
- if (!mustCreate) {
- hql += " AND " + ExportQuery.TOPIA_ID + " = :id";
- params.add("id");
- params.add(id);
- }
-// TopiaQuery query = dao.createQuery();
-// query.addWhere(ExportQuery.PROPERTY_NAME, TopiaQuery.Op.EQ, queryName);
-//
-// if (!mustCreate) {
-// query.addWhere(ExportQuery.TOPIA_ID, TopiaQuery.Op.NEQ, id);
-// }
-
// check query does not already exists with this name
- boolean queryExists = dao.existsByQuery("SELECT COUNT(*) " + hql, params.toArray());
+ boolean queryExists = dao.isQueryExists(id, queryName);
-// boolean queryExists = dao.existByQuery(query);
-
if (queryExists) {
throw new ExportQueryNameAlreadyExistException();
}
@@ -131,7 +103,8 @@
public void delete(String topiaId) {
try {
- TopiaDAO<ExportQuery> dao = getDAO(ExportQuery.class);
+ ExportQueryDAO dao = getDAO();
+
ExportQuery entityToDelete = dao.findByTopiaId(topiaId);
dao.delete(entityToDelete);
@@ -206,7 +179,11 @@
}
public ExportQuery newExportQuery() {
- return new ExportQueryImpl();
+ try {
+ return getDAO().newInstance();
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
}
public String processLibreOfficeSqlQuery(String libreOfficeQuery) {
@@ -215,4 +192,9 @@
return result;
}
+ protected ExportQueryDAO getDAO() {
+ return getDAO(ExportQuery.class,
+ ExportQueryDAO.class);
+ }
+
}
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,35 @@
+package fr.ifremer.echobase.services.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class WorkingDbConfigurationAlreadyExistException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,35 @@
+package fr.ifremer.echobase.services.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class WorkingDbConfigurationNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,132 @@
+package fr.ifremer.echobase.services.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: Services
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import fr.ifremer.echobase.entities.WorkingDbConfigurationDAO;
+import fr.ifremer.echobase.services.EchoBaseServiceSupport;
+import org.nuiton.topia.TopiaException;
+
+import java.util.List;
+
+/**
+ * To manager {@link WorkingDbConfiguration}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class WorkingDbConfigurationService extends EchoBaseServiceSupport {
+
+ public List<WorkingDbConfiguration> getWorkingDbConfigurations() {
+ try {
+ List<WorkingDbConfiguration> result = getDAO().findAll();
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(eee);
+ }
+ }
+
+ public WorkingDbConfiguration getConfigurationByUrl(String url) {
+ Preconditions.checkNotNull(url);
+ try {
+ WorkingDbConfiguration result = getDAO().findByUrl(url);
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(eee);
+ }
+ }
+
+ public WorkingDbConfiguration getEditableConf(String id) throws WorkingDbConfigurationNotFoundException {
+ WorkingDbConfiguration entity = getExistingConf(id);
+ WorkingDbConfiguration result = newConfiguration();
+ result.setTopiaId(entity.getTopiaId());
+ result.setDescription(entity.getDescription());
+ result.setDriverType(entity.getDriverType());
+ result.setLogin(entity.getLogin());
+ result.setUrl(entity.getUrl());
+ return result;
+ }
+
+ public WorkingDbConfiguration create(WorkingDbConfiguration conf) throws WorkingDbConfigurationAlreadyExistException {
+ try {
+
+ // check not already exists ?
+ boolean exists = isUrlAlreadyUsed(conf.getUrl());
+ if (exists) {
+ throw new WorkingDbConfigurationAlreadyExistException();
+ }
+
+ WorkingDbConfiguration result = getDAO().create(conf);
+
+ commitInternalTransaction("Could not create working db configuration");
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(eee);
+ }
+ }
+
+ public void delete(String id) throws WorkingDbConfigurationNotFoundException {
+ try {
+ WorkingDbConfiguration entity = getExistingConf(id);
+ getDAO().delete(entity);
+ commitInternalTransaction("Could not delete working db configuration");
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(eee);
+ }
+ }
+
+
+ public WorkingDbConfiguration newConfiguration() {
+ try {
+ return getDAO().newInstance();
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
+ }
+
+ public boolean isUrlAlreadyUsed(String url) {
+ try {
+ return getDAO().existByProperties(
+ WorkingDbConfiguration.PROPERTY_URL, url);
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
+ }
+
+ protected WorkingDbConfiguration getExistingConf(String id) throws WorkingDbConfigurationNotFoundException {
+ WorkingDbConfiguration entity =
+ getEntityById(WorkingDbConfiguration.class, id);
+ if (entity == null) {
+ throw new WorkingDbConfigurationNotFoundException();
+ }
+ return entity;
+ }
+
+ protected WorkingDbConfigurationDAO getDAO() {
+ return getDAO(WorkingDbConfiguration.class,
+ WorkingDbConfigurationDAO.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/resources/embedded/echobase.properties
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -32,11 +32,12 @@
data.directory=.
# where to find war
-war.directory=${data.directory}
+war.directory=${echobase.data.directory}
+#FIXME use instead an working db configuration
# Database configuration
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.username=sa
-hibernate.connection.password=sa
-hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE
+#hibernate.dialect=org.hibernate.dialect.H2Dialect
+#hibernate.connection.driver_class=org.h2.Driver
+#hibernate.connection.username=sa
+#hibernate.connection.password=sa
+#hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE
Modified: trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
===================================================================
--- trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -45,6 +45,6 @@
echobase.importError.transit.notfound=Transit non trouvé pour la campagne %s et la date %s (ligne %s)
echobase.importLabel.withFile=%s avec le fichier %s
echobase.info.modifiedProperty=Propriété '%s', ancienne valeur \: '%s', nouvelle valeur \: '%s'
-echobase.info.newEntityCreated=
+echobase.info.newEntityCreated=Une nouvelle entité à été créée (%s)
echobase.info.onePropertyModified=Une propriété a été modifiée \:
echobase.info.somePropertiesModified=%s propriétés ont été modifiées \:
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/pom.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -96,16 +98,24 @@
<pluginManagement>
<plugins>
+
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<stopKey>A</stopKey>
<stopPort>1269</stopPort>
+ <contextXml>${basedir}/src/main/env/jetty-context.xml</contextXml>
<webAppConfig>
<contextPath>/echobase</contextPath>
</webAppConfig>
<jvmArgs>-Xms512m -Xmx1512m</jvmArgs>
+ <systemProperties>
+ <systemProperty>
+ <name>echobase.log.dir</name>
+ <value>${project.build.directory}/echobase.log</value>
+ </systemProperty>
+ </systemProperties>
</configuration>
</plugin>
@@ -114,10 +124,30 @@
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<path>/echobase</path>
+ <uriEncoding>UTF-8</uriEncoding>
+ <systemProperties>
+ <echobase.log.dir>
+ ${project.build.directory}/echobase.log
+ </echobase.log.dir>
+ </systemProperties>
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat6-maven-plugin</artifactId>
+ <configuration>
+ <path>/echobase</path>
+ <uriEncoding>UTF-8</uriEncoding>
+ <systemProperties>
+ <echobase.log.dir>
+ ${project.build.directory}/echobase.log
+ </echobase.log.dir>
+ </systemProperties>
+ </configuration>
+ </plugin>
+
+ <plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
Added: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/env/dev/resources/log4j.properties (rev 0)
+++ trunk/echobase-ui/src/main/env/dev/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,33 @@
+###
+# #%L
+# T3 :: Web
+#
+# $Id$
+# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/dev/resources/lo… $
+# %%
+# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# #L%
+###
+# Global logging configuration
+log4j.rootLogger=WARN, stdout
+
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%t] %d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n
+
+# package level
+log4j.logger.fr.ifremer=INFO
Property changes on: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/env/dev/resources/log4j.xml
===================================================================
--- trunk/echobase-ui/src/main/env/dev/resources/log4j.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/env/dev/resources/log4j.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- #%L
- EchoBase :: UI
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 - 2012 Ifremer, Codelutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-
-<!DOCTYPE log4j:configuration SYSTEM
- "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/…">
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="${echobase.log.dir}/echobase.log"/>
- <param name="Append" value="false"/>
- <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
- </layout>
- </appender>
-
- <!-- ============================== -->
- <!-- Append messages to the console -->
- <!-- ============================== -->
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c] %m%n"/>
- </layout>
- </appender>
-
- <logger name="org.nuiton">
- <level value="WARN"/>
- </logger>
-
- <root>
- <priority value="INFO"/>
- <appender-ref ref="FILE"/>
- <appender-ref ref="CONSOLE"/>
- </root>
-
-</log4j:configuration>
Added: trunk/echobase-ui/src/main/env/jetty-context.xml
===================================================================
--- trunk/echobase-ui/src/main/env/jetty-context.xml (rev 0)
+++ trunk/echobase-ui/src/main/env/jetty-context.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ #%L
+ Pollen :: UI (struts2)
+ $Id$
+ $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/jetty/jetty-co… $
+ %%
+ Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Call name="setAttribute">
+ <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
+ <Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
+ </Call>
+</Configure>
\ No newline at end of file
Property changes on: trunk/echobase-ui/src/main/env/jetty-context.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/env/prod/resources/log4j.properties (rev 0)
+++ trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,42 @@
+###
+# #%L
+# T3 :: Web
+#
+# $Id$
+# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/prod/resources/l… $
+# %%
+# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# #L%
+###
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout, file
+
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n
+
+# file output...
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=${echobase.log.dir}/t3.log
+log4j.appender.file.MaxFileSize=10MB
+log4j.appender.file.MaxBackupIndex=4
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n
+
+log4j.logger.fr.ifremer=INFO
+log4j.logger.org.nuiton=WARN
+log4j.logger.org.nuiton.topia.migration=INFO
Property changes on: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/env/prod/resources/log4j.xml
===================================================================
--- trunk/echobase-ui/src/main/env/prod/resources/log4j.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/env/prod/resources/log4j.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- #%L
- EchoBase :: UI
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 - 2012 Ifremer, Codelutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-
-<!DOCTYPE log4j:configuration SYSTEM
- "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/…">
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jakarta.apache.org/log4j/ ">
-
- <!-- ================================= -->
- <!-- Preserve messages in a local file -->
- <!-- ================================= -->
-
- <!-- A time/date based rolling appender -->
- <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
- <param name="File" value="${echobase.log.dir}/echobase.log"/>
- <param name="Append" value="false"/>
- <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
- </layout>
- </appender>
-
- <logger name="org">
- <level value="WARN"/>
- </logger>
-
- <logger name="fr.ifremer">
- <level value="INFO"/>
- </logger>
-
- <root>
- <priority value="ERROR"/>
- <appender-ref ref="FILE"/>
- </root>
-
-</log4j:configuration>
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -46,22 +46,28 @@
private static final Log log =
LogFactory.getLog(EchoBaseApplicationContext.class);
+ /** Key to store the single instance of the application context */
+ private static final String APPLICATION_CONTEXT_PARAMETER =
+ "echobaseApplicationContext";
+
protected EchoBaseConfiguration configuration;
protected EchoBaseDbMeta dbMeta;
- protected TopiaContext rootContext;
-
- /** Key to store the single instance of the application context */
- private static final String APPLICATION_CONTEXT_PARAMETER =
- "t3ApplicationContext";
-
/** Root context for the internal database. */
protected TopiaContext internalRootContext;
/** Set of all loggued user sessions to be close at shutdown time. */
- protected Set<EchoBaseSession> t3Sessions;
+ protected Set<EchoBaseSession> sessions;
+ /**
+ * Flag setted to true when internal db was just created (should then
+ * display in ui created user password).
+ *
+ * @since 1.1
+ */
+ protected boolean defaultUsersCreated;
+
public static EchoBaseApplicationContext getApplicationContext(ActionContext actionContext) {
Map<String, Object> application = actionContext.getApplication();
EchoBaseApplicationContext result =
@@ -88,34 +94,34 @@
}
public Set<EchoBaseSession> getEchoBaseSessions() {
- return t3Sessions;
+ return sessions;
}
- public synchronized void registerEchoBaseSession(EchoBaseSession t3Session) {
- Preconditions.checkNotNull(t3Session);
- Preconditions.checkNotNull(t3Session.getUser());
- if (t3Sessions == null) {
- t3Sessions = Sets.newHashSet();
+ public synchronized void registerEchoBaseSession(EchoBaseSession session) {
+ Preconditions.checkNotNull(session);
+ Preconditions.checkNotNull(session.getUser());
+ if (sessions == null) {
+ sessions = Sets.newHashSet();
}
if (log.isInfoEnabled()) {
log.info("Register user session for [" +
- t3Session.getUser().getEmail() + "]");
+ session.getUser().getEmail() + "]");
}
- t3Sessions.add(t3Session);
+ sessions.add(session);
}
- public synchronized void destroyEchoBaseSession(EchoBaseSession t3Session) {
- Preconditions.checkNotNull(t3Session);
- Preconditions.checkNotNull(t3Session.getUser());
- Preconditions.checkNotNull(t3Sessions);
+ public synchronized void destroyEchoBaseSession(EchoBaseSession session) {
+ Preconditions.checkNotNull(session);
+ Preconditions.checkNotNull(session.getUser());
+ Preconditions.checkNotNull(sessions);
if (log.isInfoEnabled()) {
log.info("Destroy user session for [" +
- t3Session.getUser().getEmail() + "]");
+ session.getUser().getEmail() + "]");
}
// remove session from active ones
- t3Sessions.remove(t3Session);
+ sessions.remove(session);
// close session
- t3Session.close();
+ session.close();
}
public EchoBaseConfiguration getConfiguration() {
@@ -126,12 +132,12 @@
this.configuration = configuration;
}
- public TopiaContext getRootContext() {
- return rootContext;
+ public TopiaContext getInternalRootContext() {
+ return internalRootContext;
}
- public void setRootContext(TopiaContext rootContext) {
- this.rootContext = rootContext;
+ public void setInternalRootContext(TopiaContext internalRootContext) {
+ this.internalRootContext = internalRootContext;
}
public EchoBaseDbMeta getDbMeta() {
@@ -141,4 +147,12 @@
public void setDbMeta(EchoBaseDbMeta dbMeta) {
this.dbMeta = dbMeta;
}
+
+ public boolean isDefaultUsersCreated() {
+ return defaultUsersCreated;
+ }
+
+ public void setDefaultUsersCreated(boolean defaultUsersCreated) {
+ this.defaultUsersCreated = defaultUsersCreated;
+ }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,12 +23,12 @@
*/
package fr.ifremer.echobase.ui;
+import com.google.common.base.Preconditions;
import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
-import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.EchoBaseUserImpl;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.UserService;
@@ -42,7 +42,7 @@
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.TopiaRuntimeException;
import org.nuiton.util.converter.ConverterUtil;
import javax.servlet.ServletContext;
@@ -98,16 +98,21 @@
EchobaseTopiaContexts.newInternalDb(configuration);
// initialize application context
- EchoBaseApplicationContext applicationContext = new EchoBaseApplicationContext();
+ EchoBaseApplicationContext applicationContext =
+ new EchoBaseApplicationContext();
EchoBaseApplicationContext.setApplicationContext(
sce.getServletContext(), applicationContext);
applicationContext.setConfiguration(configuration);
applicationContext.setDbMeta(EchoBaseDbMeta.newDbMeta());
- applicationContext.setRootContext(internalRootContext);
+ applicationContext.setInternalRootContext(internalRootContext);
// init database (and create minimal admin user if required)
- initInternalDatabase(applicationContext);
+ try {
+ initInternalDatabase(applicationContext);
+ } catch (TopiaException e) {
+ throw new TopiaRuntimeException("Could not init internal db", e);
+ }
}
@Override
@@ -128,7 +133,7 @@
try {
// release internal db
TopiaContext rootContext =
- applicationContext.getRootContext();
+ applicationContext.getInternalRootContext();
EchoBaseEntityHelper.releaseRootContext(rootContext);
} finally {
@@ -151,67 +156,48 @@
* {@code admin/admin}</li>
* </ul>
*
- * @param applicationContext application context where to store global internal db root context
+ * @param context application context where to store global internal db root context
*/
- protected void initInternalDatabase(EchoBaseApplicationContext applicationContext) {
+ protected void initInternalDatabase(EchoBaseApplicationContext context) throws TopiaException {
- EchoBaseConfiguration configuration =
- applicationContext.getConfiguration();
+ Preconditions.checkNotNull(context);
- TopiaContext internalRootContext = applicationContext.getRootContext();
+ EchoBaseConfiguration configuration = context.getConfiguration();
+ Preconditions.checkNotNull(configuration);
- EchoBaseServiceContext serviceContext = DefaultEchoBaseServiceContext.newContext(
- Locale.getDefault(),
- null,
- null,
- configuration,
- applicationContext.getDbMeta()
- );
+ EchoBaseDbMeta dbMeta = context.getDbMeta();
+ Preconditions.checkNotNull(dbMeta);
- try {
+ TopiaContext rootContext = context.getInternalRootContext();
+ Preconditions.checkNotNull(rootContext);
- boolean schemaExist = isInternalSchemaCreated(internalRootContext);
+ boolean schemaExist = dbMeta.getPersistenceHelper().isInternalSchemaCreated(rootContext);
- if (schemaExist) {
+ if (schemaExist) {
- if (configuration.isUpdateSchema()) {
- if (log.isInfoEnabled()) {
- log.info("Will update schema...");
- }
- internalRootContext.updateSchema();
- }
- } else {
+ if (configuration.isUpdateSchema()) {
if (log.isInfoEnabled()) {
- log.info("Will create schema...");
+ log.info("Will update schema...");
}
- internalRootContext.createSchema();
+ rootContext.updateSchema();
}
-
- } catch (Exception e) {
- throw new IllegalStateException("could not start db", e);
+ } else {
+ if (log.isInfoEnabled()) {
+ log.info("Will create schema...");
+ }
+ rootContext.createSchema();
}
+ TopiaContext tx = rootContext.beginTransaction();
try {
- createAdminUser(serviceContext);
-
- } catch (Exception e) {
- throw new IllegalStateException(
- "could not create default admin user", e);
- }
- }
-
- /**
- * Creates the adminsitrator ({@code admin/admin}) on the database.
- *
- * @param serviceContext service context
- * @throws TopiaException if could not create the user.
- */
- protected void createAdminUser(EchoBaseServiceContext serviceContext) throws TopiaException {
-
- TopiaContext transaction = serviceContext.getInternalTransaction().beginTransaction();
- serviceContext.setInternalTransaction(transaction);
- try {
-
+ EchoBaseServiceContext serviceContext =
+ DefaultEchoBaseServiceContext.newContext(
+ Locale.getDefault(),
+ tx,
+ null,
+ configuration,
+ dbMeta
+ );
UserService service = serviceContext.getService(UserService.class);
List<EchoBaseUser> users = service.getUsers();
@@ -221,42 +207,13 @@
// no users in database create the admin user
if (log.isInfoEnabled()) {
log.info("No user in database, will create default " +
- "admin user (password admin).");
+ "users.");
}
service.createDefaultUsers();
}
} finally {
- transaction.closeContext();
+ EchoBaseEntityHelper.closeConnection(tx);
}
}
-
- /**
- * Tests if the internal database schema created.
- *
- * @param rootContext internal root context
- * @return {@code true} if the schema is already created, {@code false}
- * otherwise
- * @throws TopiaException if something was wrong while requesting database
- */
- protected boolean isInternalSchemaCreated(TopiaContext rootContext) throws TopiaException {
-
- boolean schemaFound =
- ((TopiaContextImplementor) rootContext).isSchemaExist(EchoBaseUserImpl.class);
-
- return schemaFound;
- }
-
- /**
- * Try to close the given transaction.
- *
- * @param tx the transaction to close
- * @throws TopiaException if could not close the transaction
- */
- protected void closeTransaction(TopiaContext tx) throws TopiaException {
- if (tx != null && !tx.isClosed()) {
- tx.closeContext();
- }
- }
-
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -60,7 +60,7 @@
EchoBaseApplicationContext applicationContext =
EchoBaseActionSupport.getEchoBaseApplicationContext();
- TopiaContext rootContext = applicationContext.getRootContext();
+ TopiaContext rootContext = applicationContext.getInternalRootContext();
try {
TopiaContext transaction = rootContext.beginTransaction();
if (log.isDebugEnabled()) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,16 +23,14 @@
*/
package fr.ifremer.echobase.ui;
+import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.opensymphony.xwork2.ActionContext;
+import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
import fr.ifremer.echobase.persistence.JdbcConfiguration;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationConfiguration;
-import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration;
-import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration;
-import fr.ifremer.echobase.services.importdb.ImportDbConfiguration;
+import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
@@ -40,6 +38,7 @@
import javax.servlet.http.HttpSession;
import java.io.Closeable;
+import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -55,24 +54,27 @@
/** Logger. */
private static final Log log = LogFactory.getLog(EchoBaseSession.class);
+ /** Key to store the {@link EchoBaseSession} instance in the session's map. */
+ private static final String SESSION_PARAMETER = "echoBaseSession";
+
/** Key to set User connected in this session. */
- protected static final String PROPERTY_USER = "echobaseUser";
+ private static final String PROPERTY_USER = "echobaseUser";
- /** Key to keep import db configuration in this session. */
- protected static final String PROPERTY_IMPORT_DB_CONFIGURATION = "importDbConfiguration";
+ /** Key to set root context of working db selected by user (if any). */
+ private static final String PROPERTY_WORKING_DB_CONFIGURATION = "workingDbConfiguration";
- /** Key to keep export db configuration in this session. */
- protected static final String PROPERTY_EXPORT_DB_CONFIGURATION = "exportDbConfiguration";
+ /** Key to set root context of working db selected by user (if any). */
+ private static final String PROPERTY_WORKING_DB_ROOT_CONTEXT = "workingDbRootContext";
- /** Key to keep embedded application configuration in this session. */
- protected static final String PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION = "embeddedApplicationConfiguration";
+ public static final String SESSION_TOKEN_MESSAGES = "messages";
- /** Key to store the {@link EchoBaseSession} instance in the session's map. */
- private static final String SESSION_PARAMETER = "echoBaseSession";
+ public static final String SESSION_TOKEN_ERRORS = "errors";
- /** Key to set root context of working db selected by user (if any). */
- private static final String PROPERTY_ROOT_CONTEXT = "rootContext";
+ public static final String SESSION_TOKEN_WARNINGS = "warnings";
+ /** To store all properties in this session. */
+ protected Map<String, Object> store;
+
/**
* Obtain the user T3 session.
* <p/>
@@ -86,25 +88,25 @@
*/
public static EchoBaseSession getEchoBaseSession(ActionContext actionContext) {
Map<String, Object> session = actionContext.getSession();
- EchoBaseSession t3Session = (EchoBaseSession)
+ EchoBaseSession userSession = (EchoBaseSession)
session.get(SESSION_PARAMETER);
- if (t3Session == null) {
+ if (userSession == null) {
// let's create it
- t3Session = new EchoBaseSession();
- session.put(SESSION_PARAMETER, t3Session);
+ userSession = new EchoBaseSession();
+ session.put(SESSION_PARAMETER, userSession);
}
- return t3Session;
+ return userSession;
}
public static EchoBaseSession getEchoBaseSession(HttpSession session) {
- EchoBaseSession t3Session = (EchoBaseSession)
+ EchoBaseSession userSession = (EchoBaseSession)
session.getAttribute(EchoBaseSession.SESSION_PARAMETER);
- if (t3Session == null) {
+ if (userSession == null) {
// let's create it
- t3Session = new EchoBaseSession();
- session.setAttribute(SESSION_PARAMETER, t3Session);
+ userSession = new EchoBaseSession();
+ session.setAttribute(SESSION_PARAMETER, userSession);
}
- return t3Session;
+ return userSession;
}
public static void removeEchoBaseSession(ActionContext actionContext) {
@@ -112,10 +114,6 @@
session.remove(EchoBaseSession.SESSION_PARAMETER);
}
-
- /** To store all properties in this session. */
- protected Map<String, Object> store;
-
/**
* Gets the informations of user as soon as the user is loggued.
*
@@ -125,14 +123,9 @@
return get(PROPERTY_USER, EchoBaseUser.class);
}
- /**
- * Tests if user is loggued (means the {@link #getUser} is not null).
- *
- * @return {@code true} if user is loggued, {@code false} otherwise
- */
- public boolean isUserInSession() {
- boolean result = getUser() != null;
- return result;
+ public boolean isAdmin() {
+ EchoBaseUser user = getUser();
+ return user != null && user.isAdmin();
}
/**
@@ -144,61 +137,19 @@
set(PROPERTY_USER, user);
}
- public ImportDbConfiguration getImportDbConfiguration() {
- return get(PROPERTY_IMPORT_DB_CONFIGURATION, ImportDbConfiguration.class);
+ public JdbcConfiguration getWorkingDbConfiguration() {
+ return get(PROPERTY_WORKING_DB_CONFIGURATION, JdbcConfiguration.class);
}
- public void setImportDbConfiguration(ImportDbConfiguration configuration) {
- set(PROPERTY_IMPORT_DB_CONFIGURATION, configuration);
+ public TopiaContext getWorkingDbRootContext() {
+ return get(PROPERTY_WORKING_DB_ROOT_CONTEXT, TopiaContext.class);
}
- public ExportDbConfiguration getExportDbConfiguration() {
- return get(PROPERTY_EXPORT_DB_CONFIGURATION, ExportDbConfiguration.class);
+ public boolean isWorkingDbSelected() {
+ return contains(PROPERTY_WORKING_DB_CONFIGURATION);
}
- public void setExportDbConfiguration(ExportDbConfiguration configuration) {
- set(PROPERTY_EXPORT_DB_CONFIGURATION, configuration);
- }
-
- public EmbeddedApplicationConfiguration getEmbeddedApplicationConfiguration() {
- return get(PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION, EmbeddedApplicationConfiguration.class);
- }
-
- public void setEmbeddedApplicationConfiguration(EmbeddedApplicationConfiguration configuration) {
- set(PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION, configuration);
- }
-
- public <M extends AbstractImportConfiguration> M getImportDataConfiguration(Class<M> configurationType) {
- return get(configurationType.getSimpleName(), configurationType);
- }
-
- public <M extends AbstractImportConfiguration> void setImportDataConfiguration(M configuration) {
- set(configuration.getClass().getSimpleName(), configuration);
- }
-
- public <M extends AbstractImportConfiguration> void removeImportDataConfiguration(Class<M> configurationType) {
- set(configurationType.getSimpleName(), null);
- }
-
/**
- * Gets the t3 database url selected by user.
- *
- * @return the t3 database url selected by user or {@code null} if not in session
- */
- public String getWorkingDatabaseUrl() {
- TopiaContext rootContext = getRootContext();
- String result = null;
- if (rootContext != null) {
- result = EchobaseTopiaContexts.getDbUrl(rootContext);
- }
- return result;
- }
-
- public TopiaContext getRootContext() {
- return get(PROPERTY_ROOT_CONTEXT, TopiaContext.class);
- }
-
- /**
* Initialize the t3 database configuration from the given connection
* configuration.
* <p/>
@@ -218,34 +169,128 @@
TopiaContext rootContext =
EchobaseTopiaContexts.newWorkingDb(jdbcConfiguration);
+ // keep configuration is session
+ set(PROPERTY_WORKING_DB_CONFIGURATION, jdbcConfiguration);
+
// store it in session
- set(PROPERTY_ROOT_CONTEXT, rootContext);
+ set(PROPERTY_WORKING_DB_ROOT_CONTEXT, rootContext);
if (log.isInfoEnabled()) {
log.info("User database initialized at " +
jdbcConfiguration.getUrl());
}
+ }
+ public <C extends AbstractEchobaseActionConfiguration> C getActionConfiguration(Class<C> configurationType) {
+ return get(configurationType.getName(), configurationType);
}
+ public <C extends AbstractEchobaseActionConfiguration> void setActionConfiguration(C configurationType) {
+ set(configurationType.getClass().getName(), configurationType);
+ }
+
+ public <C extends AbstractEchobaseActionConfiguration> void removeActionConfiguration(Class<C> configurationType) {
+ remove(configurationType.getName());
+ }
+
public void releaseWorkingDb() {
- TopiaContext rootContext = getRootContext();
+ if (isWorkingDbSelected()) {
- if (rootContext != null) {
+ try {
+ TopiaContext rootContext = getWorkingDbRootContext();
+ EchoBaseEntityHelper.releaseRootContext(rootContext);
+ } finally {
+ remove(PROPERTY_WORKING_DB_CONFIGURATION);
+ remove(PROPERTY_WORKING_DB_ROOT_CONTEXT);
+ }
+ }
+ }
- remove(PROPERTY_ROOT_CONTEXT);
+ public <T extends Serializable> T getDynamicData(String token) {
+ Object result = getDynamicData().get(token);
+ return (T) result;
+ }
- EchoBaseEntityHelper.releaseRootContext(rootContext);
+ public <T extends Serializable> Set<T> getDynamicSetData(String token) {
+ Object result = getDynamicData().get(token);
+ return (Set<T>) result;
+ }
+
+ public <T extends Serializable> T consumeDynamicData(String token) {
+ T result = getDynamicData(token);
+ if (result != null) {
+ removeDynamicData(token);
}
+ return result;
}
+ public <T extends Serializable> Set<T> consumeDynamicSetData(String token) {
+ Set<T> result = getDynamicSetData(token);
+ if (result != null) {
+ removeDynamicData(token);
+ }
+ return result;
+ }
+
+ public <T extends Serializable> void putDynamicSetData(String token, Set<T> data) {
+ getDynamicData().put(token, data);
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + getDynamicData().size());
+ }
+ }
+
+ public void putDynamicData(String token, Serializable data) {
+ getDynamicData().put(token, data);
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + getDynamicData().size());
+ }
+ }
+
+ public void removeDynamicData(String token) {
+ getDynamicData().remove(token);
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + getDynamicData().size());
+ }
+ }
+
+ public void clearDynamicData() {
+ if (store != null) {
+ store.clear();
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + store.size());
+ }
+ }
+ }
+
+ protected Map<String, Object> getDynamicData() {
+ if (store == null) {
+ store = Maps.newHashMap();
+ }
+ return store;
+ }
+
+ public void addMessage(String messageScope, String message) {
+ Set<String> messages = getDynamicSetData(messageScope);
+ if (messages == null) {
+ messages = Sets.newHashSet(message);
+ putDynamicSetData(messageScope, messages);
+ } else {
+ messages.add(message);
+ }
+ }
+
+ /** Protect session constructor. */
+ protected EchoBaseSession() {
+ store = new TreeMap<String, Object>();
+ }
+
/**
* Remove form this session, the object from his given key and returns it.
*
* @param key the key of object to remove from this session
* @return the removed object from session, or {@code null} if not found
*/
- public Object remove(String key) {
+ protected Object remove(String key) {
Object remove = store.remove(key);
if (log.isInfoEnabled()) {
log.info("Remove from user session data [" + key + "] = " + remove);
@@ -260,16 +305,11 @@
* @return {@code true} if an object was found in this session,
* {@code false} otherwise
*/
- public boolean contains(String key) {
+ protected boolean contains(String key) {
boolean result = store.containsKey(key);
return result;
}
- /** Protect session constructor. */
- public EchoBaseSession() {
- store = new TreeMap<String, Object>();
- }
-
/**
* Gets from this session an object given his key and his type.
*
@@ -305,11 +345,6 @@
}
}
- public boolean isAdmin() {
- EchoBaseUser user = getUser();
- return user != null && user.isAdmin();
- }
-
/**
* Release any resources contained in the user session.
* <p/>
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,6 +23,8 @@
*/
package fr.ifremer.echobase.ui;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
@@ -45,7 +47,8 @@
@Override
public void sessionDestroyed(HttpSessionEvent se) {
EchoBaseSession session = EchoBaseSession.getEchoBaseSession(se.getSession());
- if (session.isUserInSession()) {
+ EchoBaseUser user = session.getUser();
+ if (user != null) {
// only destroy the session if a user is loggued (otherwise there
// is nothing to clear)
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,6 +23,7 @@
* #L%
*/
+import com.google.common.base.Preconditions;
import com.opensymphony.xwork2.ActionContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,12 +61,6 @@
return (TopiaContext) request.getAttribute(USER_TRANSACTION);
}
-// public static TopiaContext getTransaction(ServletRequest request) {
-// TopiaContext topiaContext = (TopiaContext)
-// request.getAttribute(USER_TRANSACTION);
-// return topiaContext;
-// }
-
@Override
public void init(FilterConfig filterConfig) throws ServletException {
super.init(filterConfig);
@@ -76,8 +71,11 @@
public TopiaContext beginTransaction(ServletRequest request) {
HttpSession session = ((HttpServletRequest) request).getSession();
+ Preconditions.checkNotNull(session);
EchoBaseSession userSession = EchoBaseSession.getEchoBaseSession(session);
- TopiaContext rootContext = userSession.getRootContext();
+ Preconditions.checkNotNull(userSession);
+ TopiaContext rootContext = userSession.getWorkingDbRootContext();
+ Preconditions.checkNotNull(rootContext);
try {
TopiaContext transaction = rootContext.beginTransaction();
if (log.isDebugEnabled()) {
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,102 @@
+package fr.ifremer.echobase.ui.actions;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
+import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+
+/**
+ * BAse action for long action configuration.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public abstract class AbstractConfigureAction<M extends AbstractEchobaseActionConfiguration> extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractConfigureAction.class);
+
+ private final Class<M> modelType;
+
+ private M model;
+
+ protected abstract M createModel();
+
+ protected abstract void prepareExecuteAction(M model) throws IOException;
+
+ protected AbstractConfigureAction(Class<M> modelType) {
+ this.modelType = modelType;
+ }
+
+ @Override
+ public final String input() throws Exception {
+
+ // always remove configuration from session anytime coming here
+ getEchoBaseSession().removeActionConfiguration(modelType);
+
+ prepareInputAction(getModel());
+
+ return INPUT;
+ }
+
+ @InputConfig(methodName = "input")
+ @Override
+ public final String execute() throws Exception {
+
+ prepareExecuteAction(getModel());
+
+ setInSession(getModel());
+ return SUCCESS;
+ }
+
+ public final M getModel() {
+ if (model == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Will create model " + modelType.getName());
+ }
+ model = createModel();
+ }
+ return model;
+ }
+
+ protected void prepareInputAction(M model) {
+ // by default nothing to prepare
+ }
+
+ protected final void setInSession(M model) {
+ getEchoBaseSession().setActionConfiguration(model);
+ }
+
+ protected final M getFromSession() {
+ return getEchoBaseSession().getActionConfiguration(modelType);
+ }
+
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -27,24 +27,49 @@
import com.opensymphony.xwork2.Preparable;
import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
+import fr.ifremer.echobase.services.EchoBaseService;
import org.nuiton.topia.TopiaContext;
+import java.io.IOException;
+
/**
* Abstract long action using the exec and wait interceptor.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public abstract class AbstractWaitAndExecAction<M extends AbstractEchobaseActionConfiguration> extends EchoBaseActionSupport implements Preparable {
+public abstract class AbstractWaitAndExecAction<M extends AbstractEchobaseActionConfiguration, S extends EchoBaseService> extends EchoBaseActionSupport implements Preparable {
private static final long serialVersionUID = 1L;
- /** Configuration of the export action. */
+ /**
+ * Model type ot use.
+ *
+ * @since 1.1
+ */
+ private final Class<M> modelType;
+
+ /**
+ * Service type to use in this action.
+ *
+ * @since 1.1
+ */
+ private final Class<S> serviceType;
+
+ /** Configuration of the action. */
private M model;
/** Shared actionContext to reuse all invocation of this same action. */
private ActionContext actionContext;
+ protected AbstractWaitAndExecAction(Class<M> modelType,
+ Class<S> serviceType) {
+ this.modelType = modelType;
+ this.serviceType = serviceType;
+ }
+
+ protected abstract void startAction(S service, M model) throws Exception;
+
public final M getModel() {
return model;
}
@@ -62,13 +87,9 @@
// now we need to propagate it
ActionContext.setContext(actionContext);
}
- model = initModel();
+ model = getEchoBaseSession().getActionConfiguration(modelType);
}
- protected abstract M initModel();
-
- protected abstract void startAction(M model) throws Exception;
-
@Override
public final String execute() throws Exception {
@@ -81,30 +102,42 @@
// we must use a standalone transaction since it will pass through
// in more than one request
- TopiaContext topiaContext =
- EchoBaseEntityHelper.newTransactionFromRootContext(getServiceContext().getTransaction());
+ TopiaContext tx = EchoBaseEntityHelper.newTransactionFromRootContext(
+ getServiceContext().getTransaction());
try {
- serviceContext.setTransaction(topiaContext);
+ getServiceContext().setTransaction(tx);
- startAction(model);
+ S service = getService(serviceType);
+ startAction(service, model);
+
model.endAction();
return SUCCESS;
} finally {
try {
- EchoBaseEntityHelper.closeConnection(topiaContext);
+ EchoBaseEntityHelper.closeConnection(tx);
} finally {
closeAction(model);
}
-
-
}
}
protected void closeAction(M model) throws Exception {
// by default do nothing
}
+
+ protected void destroyModel(M model) throws IOException {
+
+ try {
+ // clean configuration
+ model.destroy();
+ } finally {
+
+ // remove configuration from session
+ getEchoBaseSession().removeActionConfiguration(modelType);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,6 +23,7 @@
*/
package fr.ifremer.echobase.ui.actions;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.EchoBaseConfiguration;
@@ -31,17 +32,22 @@
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseService;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
+import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.ServiceFactoryAware;
import fr.ifremer.echobase.ui.EchoBaseApplicationContext;
import fr.ifremer.echobase.ui.EchoBaseInternalDbTransactionFilter;
import fr.ifremer.echobase.ui.EchoBaseSession;
import fr.ifremer.echobase.ui.EchoBaseWorkingDbTransactionFilter;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.struts2.interceptor.ParameterAware;
+import org.apache.struts2.interceptor.SessionAware;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.web.struts2.BaseAction;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
+import java.util.List;
import java.util.Map;
/**
@@ -81,8 +87,30 @@
/** EchoBase User session. */
private transient EchoBaseSession echoBaseSession;
- protected transient EchoBaseServiceContext serviceContext;
+ /**
+ * Service context used to access and create services.
+ *
+ * @since 1.0
+ */
+ private transient EchoBaseServiceContext serviceContext;
+ /**
+ * Parameters injected if you put {@link ParameterAware} contract on your
+ * action.
+ *
+ * @see ParameterAware
+ * @since 1.1
+ */
+ private transient Map<String, String[]> parameters;
+
+ /**
+ * Session injected if you put {@link SessionAware} contract on your action.
+ *
+ * @see SessionAware
+ * @since 1.1
+ */
+ private transient Map<String, Object> session;
+
public EchoBaseSession getEchoBaseSession() {
if (echoBaseSession == null) {
@@ -92,13 +120,7 @@
return echoBaseSession;
}
- /**
- * Fabrique pour récupérer le ServiceContext tel qu'il devrait être fourni
- * à la fabrication d'un service.
- *
- * @return service context
- */
- protected EchoBaseServiceContext getServiceContext() {
+ public EchoBaseServiceContext getServiceContext() {
if (serviceContext == null) {
serviceContext = DefaultEchoBaseServiceContext.newContext(
getLocale(),
@@ -124,11 +146,15 @@
}
public boolean isAdmin() {
- EchoBaseSession session = getEchoBaseSession();
- boolean result = session.isAdmin();
+ boolean result = getEchoBaseSession().isAdmin();
return result;
}
+ public boolean isWorkingDbSelected() {
+ boolean result = getEchoBaseSession().isWorkingDbSelected();
+ return result;
+ }
+
public String formatDate(Date date) {
String result = dateFormat.format(date);
return result;
@@ -139,20 +165,110 @@
return result;
}
- public <E extends TopiaEntity> Map<String, String> sortAndDecorate(Collection<E> beans, String context) {
- DecoratorService decoratorService = getService(DecoratorService.class);
- return decoratorService.sortAndDecorate(getLocale(), beans, context);
+ public void setParameters(Map<String, String[]> parameters) {
+ this.parameters = parameters;
}
+ public void setSession(Map<String, Object> session) {
+ this.session = session;
+ }
+
+ public void addFlashMessage(String message) {
+ getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_MESSAGES, message);
+ }
+
+ public void addFlashError(String message) {
+ getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_ERRORS, message);
+ }
+
+ public void addFlashWarning(String message) {
+ getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_WARNINGS, message);
+ }
+
+ public Collection<String> getFlashMessages() {
+ Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES);
+ return result;
+ }
+
+ public Collection<String> getFlashErrors() {
+ Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS);
+ return result;
+ }
+
+ public Collection<String> getFlashWarnings() {
+ Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_WARNINGS);
+ return result;
+ }
+
+ public boolean hasFlashMessages() {
+ Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES);
+ return CollectionUtils.isNotEmpty(result);
+ }
+
+ public boolean hasFlashErrors() {
+ Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS);
+ return CollectionUtils.isNotEmpty(result);
+ }
+
+ public boolean hasFlashWarnings() {
+ Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_WARNINGS);
+ return CollectionUtils.isNotEmpty(result);
+ }
+
+ public void clearFlashMessages() {
+ Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES);
+ if (result != null) {
+ result.clear();
+ }
+ }
+
+ public void clearFlashErrors() {
+ Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS);
+ if (result != null) {
+ result.clear();
+ }
+ }
+
+ public boolean hasAnyErrors() {
+ boolean result = super.hasErrors();
+ return result || hasFlashErrors();
+ }
+
protected static ActionContext getActionContext() {
return ActionContext.getContext();
}
- protected <E extends Enum<E> & I18nAble> Map<String, String> decorateEnums(E... enumValues) {
+ protected final <E extends Enum<E> & I18nAble> Map<String, String> decorateEnums(E... enumValues) {
Map<String, String> result = Maps.newLinkedHashMap();
for (E enumValue : enumValues) {
result.put(enumValue.name(), _(enumValue.getI18nKey()));
}
return result;
}
+
+ protected final <E extends TopiaEntity> Map<String, String> loadSortAndDecorate(Class<E> beanType) {
+
+ EchoBaseServiceSupport service = getService(EchoBaseServiceSupport.class);
+ List<E> beans = service.getEntities(beanType);
+
+ DecoratorService decoratorService = getService(DecoratorService.class);
+ return decoratorService.sortAndDecorate(getLocale(), beans, null);
+ }
+
+
+ protected Map<String, String[]> getParameters() {
+ Preconditions.checkNotNull(
+ parameters,
+ "You must put ParameterAware contract on your action " +
+ getClass().getName());
+ return parameters;
+ }
+
+ protected Map<String, Object> getSession() {
+ Preconditions.checkNotNull(
+ session,
+ "You must put SessionAware contract on your action " +
+ getClass().getName());
+ return session;
+ }
}
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,44 @@
+package fr.ifremer.echobase.ui.actions;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+/**
+ * Go to home.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Home extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+
+ if (!isWorkingDbSelected()) {
+ addFlashMessage(_("echobase.label.noWorkingDbSelected"));
+ }
+ return SUCCESS;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -84,7 +84,7 @@
if (entityType == null) {
// no table selected
- addActionMessage(_("echobase.info.no.table.selected"));
+ addFlashMessage(_("echobase.info.no.table.selected"));
} else {
// load table metas
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -95,11 +95,10 @@
@Override
public String execute() throws Exception {
- ExportService exportService = getService(ExportService.class);
+ TableMeta<EchoBaseEntityEnum> table = getServiceContext().getDbMeta().getTable(entityType);
+ String content = getService(ExportService.class).exportData(table,
+ exportAsSeen);
- TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType);
- String content = exportService.exportData(table, exportAsSeen);
-
if (log.isDebugEnabled()) {
log.debug("file to export " + content);
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -92,9 +92,7 @@
log.debug("sord = " + ascendantOrder);
}
- DbEditorService service = getService(DbEditorService.class);
-
- datas = service.getDatas(
+ datas = getService(DbEditorService.class).getDatas(
entityType,
pager,
sortColumn,
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -74,12 +74,11 @@
@Override
public String execute() throws Exception {
- DbEditorService service = getService(DbEditorService.class);
+ TableMeta<EchoBaseEntityEnum> table =
+ getServiceContext().getDbMeta().getTable(entityType);
- TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType);
+ datas = getService(DbEditorService.class).getData(table, id);
- datas = service.getData(table, id);
-
Object length = datas.remove("length");
if (length != null) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,11 +24,8 @@
package fr.ifremer.echobase.ui.actions.dbeditor;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
-import fr.ifremer.echobase.services.DbEditorService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.nuiton.topia.persistence.TopiaEntity;
-import java.util.List;
import java.util.Map;
/**
@@ -58,10 +55,7 @@
@Override
public String execute() throws Exception {
- DbEditorService service = getService(DbEditorService.class);
- List<? extends TopiaEntity> foreignEntities =
- service.getForeignDatas(entityType.getContract());
- entities = sortAndDecorate(foreignEntities, null);
+ entities = loadSortAndDecorate(entityType.getContract());
return SUCCESS;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -127,14 +127,13 @@
@InputConfig(methodName = "input")
public String execute() throws Exception {
- ImportService importService = getService(ImportService.class);
-
try {
- result = importService.importDatas(getEntityType(),
- importFileFileName,
- importFile,
- createIfNotFound,
- getEchoBaseSession().getUser());
+ result = getService(ImportService.class).importDatas(
+ getEntityType(),
+ importFileFileName,
+ importFile,
+ createIfNotFound,
+ getEchoBaseSession().getUser());
} catch (Exception eee) {
@@ -143,7 +142,7 @@
false);
error = eee;
- addActionError(_("echobase.info.import.failed"));
+ addFlashError(_("echobase.info.import.failed"));
if (log.isErrorEnabled()) {
log.error("Error while import ", eee);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -50,11 +50,6 @@
/** id of entity to save. */
protected String topiaId;
-// /** Metas of the table */
-// protected TableMeta<EchoBaseEntityEnum> tableMeta;
-
- protected Map<String, String[]> params;
-
public EchoBaseEntityEnum getEntityType() {
return entityType;
}
@@ -71,14 +66,16 @@
public String execute() throws Exception {
DbEditorService service = getService(DbEditorService.class);
+
TableMeta<EchoBaseEntityEnum> tableMeta = service.getTableMeta(entityType);
Map<String, String> properties = Maps.newHashMap();
List<String> columnNames = tableMeta.getColumnNames();
+ Map<String, String[]> parameters = getParameters();
for (String columnName : columnNames) {
- if (params.containsKey(columnName)) {
+ if (parameters.containsKey(columnName)) {
// there is a such property to edit
- String[] values = params.get(columnName);
+ String[] values = parameters.get(columnName);
if (values.length > 0) {
@@ -96,15 +93,7 @@
properties,
getEchoBaseSession().getUser());
-
return SUCCESS;
}
-
- @Override
- public void setParameters(Map<String, String[]> parameters) {
- params = Maps.newHashMap();
- params.putAll(parameters);
- }
-
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -35,29 +35,21 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Build extends AbstractWaitAndExecAction<EmbeddedApplicationConfiguration> {
+public class Build extends AbstractWaitAndExecAction<EmbeddedApplicationConfiguration, EmbeddedApplicationService> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Build.class);
- /** Service to build the embedded application archive. */
- protected transient EmbeddedApplicationService service;
-
- @Override
- protected EmbeddedApplicationConfiguration initModel() {
- return getEchoBaseSession().getEmbeddedApplicationConfiguration();
+ public Build() {
+ super(EmbeddedApplicationConfiguration.class,
+ EmbeddedApplicationService.class);
}
@Override
- public void prepare() throws Exception {
- super.prepare();
- service = getService(EmbeddedApplicationService.class);
- }
-
- @Override
- protected void startAction(EmbeddedApplicationConfiguration model) throws Exception {
+ protected void startAction(EmbeddedApplicationService service,
+ EmbeddedApplicationConfiguration model) throws Exception {
if (log.isInfoEnabled()) {
log.info("Start build of embedded application to file " +
model.getFileName());
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -25,10 +25,9 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationConfiguration;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.collections.CollectionUtils;
+import fr.ifremer.echobase.ui.actions.AbstractConfigureAction;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,7 +35,7 @@
import org.nuiton.util.Version;
import java.io.File;
-import java.util.List;
+import java.io.IOException;
import java.util.Map;
/**
@@ -45,24 +44,18 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Configure extends EchoBaseActionSupport {
+public class Configure extends AbstractConfigureAction<EmbeddedApplicationConfiguration> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Configure.class);
- /** action model. */
- protected EmbeddedApplicationConfiguration model;
-
/** Universe of voyages to export in db. */
protected Map<String, String> voyages;
- public EmbeddedApplicationConfiguration getModel() {
- if (model == null) {
- model = new EmbeddedApplicationConfiguration();
- }
- return model;
+ public Configure() {
+ super(EmbeddedApplicationConfiguration.class);
}
public Map<String, String> getVoyages() {
@@ -70,61 +63,49 @@
}
@Override
- public String input() throws Exception {
+ protected EmbeddedApplicationConfiguration createModel() {
+ return new EmbeddedApplicationConfiguration();
+ }
- // always remove configuration from session anytime coming here
- getEchoBaseSession().setExportDbConfiguration(null);
+ @Override
+ protected void prepareInputAction(EmbeddedApplicationConfiguration model) {
- // creates the action model
- EmbeddedApplicationConfiguration actionModel = getModel();
-
// give default embedded application archive file name
EchoBaseConfiguration configuration = getConfiguration();
Version version = configuration.getApplicationVersion();
String fileName = "echobase-embedded-" + version.toString();
- actionModel.setFileName(fileName);
+ model.setFileName(fileName);
// gets war location
File warLocation = configuration.getWarLocation();
if (!warLocation.exists()) {
- addActionError(_("echobase.error.warlocation.notFound",
- warLocation));
+ addFlashError(_("echobase.error.warlocation.notFound",
+ warLocation));
}
- actionModel.setWarLocation(warLocation);
+ model.setWarLocation(warLocation);
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
- List<Voyage> allVoyages = service.getEntities(Voyage.class);
+ voyages = loadSortAndDecorate(Voyage.class);
- if (CollectionUtils.isEmpty(allVoyages)) {
- addActionMessage(_("echobase.info.no.voyagee.found"));
+ if (MapUtils.isEmpty(voyages)) {
+ addFlashMessage(_("echobase.info.no.voyagee.found"));
}
- voyages = sortAndDecorate(allVoyages, null);
-
- return INPUT;
}
@Override
- public String execute() throws Exception {
+ protected void prepareExecuteAction(EmbeddedApplicationConfiguration model) throws IOException {
- EmbeddedApplicationConfiguration configuration = getModel();
-
// creates a new temporary working directory
File tempDirectory = FileUtils.getTempDirectory();
File dataDirectory = new File(
tempDirectory,
"echobase-embeddedApplication-" + System.currentTimeMillis());
FileUtil.createDirectoryIfNecessary(dataDirectory);
- configuration.setWorkingDirectory(dataDirectory);
+ model.setWorkingDirectory(dataDirectory);
if (log.isInfoEnabled()) {
log.info("Temporary directory to use : " + dataDirectory);
}
File warLocation = getConfiguration().getWarLocation();
- configuration.setWarLocation(warLocation);
-
- // store configuration in session
- getEchoBaseSession().setEmbeddedApplicationConfiguration(configuration);
- return SUCCESS;
+ model.setWarLocation(warLocation);
}
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -77,16 +77,16 @@
public String execute() throws Exception {
EmbeddedApplicationConfiguration model =
- getEchoBaseSession().getEmbeddedApplicationConfiguration();
+ getEchoBaseSession().getActionConfiguration(EmbeddedApplicationConfiguration.class);
if (model == null) {
- addActionError(_("echobase.error.no.embeddedApplication.configurationFound"));
+ addFlashError(_("echobase.error.no.embeddedApplication.configurationFound"));
return ERROR;
}
File file = model.getEmbeddedApplicationFile();
if (file == null) {
- addActionError(_("echobase.error.no.embeddedApplication.exportFileFound"));
+ addFlashError(_("echobase.error.no.embeddedApplication.exportFileFound"));
return ERROR;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,13 +24,14 @@
package fr.ifremer.echobase.ui.actions.exportDb;
import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import fr.ifremer.echobase.ui.actions.AbstractConfigureAction;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.FileUtil;
import java.io.File;
+import java.io.IOException;
/**
* Configure the complete db export.
@@ -38,21 +39,22 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Configure extends EchoBaseActionSupport {
+public class Configure extends AbstractConfigureAction<ExportDbConfiguration> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Configure.class);
- protected ExportDbConfiguration model;
+ public Configure() {
+ super(ExportDbConfiguration.class);
+ }
- public ExportDbConfiguration getModel() {
- if (model == null) {
- model = new ExportDbConfiguration();
- model.setFileName("echobase");
- }
- return model;
+ @Override
+ protected ExportDbConfiguration createModel() {
+ ExportDbConfiguration result = new ExportDbConfiguration();
+ result.setFileName("echobase");
+ return result;
}
public void setFileName(String fileName) {
@@ -60,30 +62,16 @@
}
@Override
- public String input() throws Exception {
+ protected void prepareExecuteAction(ExportDbConfiguration model) throws IOException {
- // always remove configuration from session anytime coming here
- getEchoBaseSession().setExportDbConfiguration(null);
- return INPUT;
- }
-
- @Override
- public String execute() throws Exception {
-
- ExportDbConfiguration configuration = getModel();
-
File tempDirectory = FileUtils.getTempDirectory();
- File dataDirectory = new File(
- tempDirectory,
- "echobase-exportDb-" + System.currentTimeMillis());
+ File dataDirectory = new File(tempDirectory,
+ "echobase-exportDb-" +
+ System.currentTimeMillis());
FileUtil.createDirectoryIfNecessary(dataDirectory);
- configuration.setWorkingDirectory(dataDirectory);
+ model.setWorkingDirectory(dataDirectory);
if (log.isInfoEnabled()) {
log.info("Temporary directory to use : " + dataDirectory);
}
-
- // store configuration in session
- getEchoBaseSession().setExportDbConfiguration(configuration);
- return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -73,16 +73,16 @@
public String execute() throws Exception {
ExportDbConfiguration model =
- getEchoBaseSession().getExportDbConfiguration();
+ getEchoBaseSession().getActionConfiguration(ExportDbConfiguration.class);
if (model == null) {
- addActionError(_("echobase.error.no.exportDb.configurationFound"));
+ addFlashError(_("echobase.error.no.exportDb.configurationFound"));
return ERROR;
}
File exportFile = model.getExportFile();
if (exportFile == null) {
- addActionError(_("echobase.error.no.exportDb.exportFileFound"));
+ addFlashError(_("echobase.error.no.exportDb.exportFileFound"));
return ERROR;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -35,29 +35,20 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Export extends AbstractWaitAndExecAction<ExportDbConfiguration> {
+public class Export extends AbstractWaitAndExecAction<ExportDbConfiguration, ExportDbService> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Export.class);
- /** service to execute the export. */
- protected transient ExportDbService service;
-
- @Override
- protected ExportDbConfiguration initModel() {
- return getEchoBaseSession().getExportDbConfiguration();
+ public Export() {
+ super(ExportDbConfiguration.class, ExportDbService.class);
}
@Override
- public void prepare() throws Exception {
- super.prepare();
- service = getService(ExportDbService.class);
- }
-
- @Override
- protected void startAction(ExportDbConfiguration model) throws Exception {
+ protected void startAction(ExportDbService service,
+ ExportDbConfiguration model) throws Exception {
if (log.isInfoEnabled()) {
log.info("Start export to file " + model.getFileName());
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -77,7 +77,7 @@
columnNames = service.getColumnNames(sql);
} catch (EchoBaseTechnicalException e) {
//TODO add a real nice message
- addActionError(e.getMessage());
+ addFlashError(e.getMessage());
if (log.isErrorEnabled()) {
log.error("coudl not execute query " + sql, e);
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -26,14 +26,13 @@
import com.opensymphony.xwork2.Preparable;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
-import fr.ifremer.echobase.services.exportquery.ExportQueryService;
import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException;
+import fr.ifremer.echobase.services.exportquery.ExportQueryService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.Collection;
import java.util.Map;
/**
@@ -167,35 +166,15 @@
return SUCCESS;
}
- private boolean checkQuery(String sql) {
- boolean result;
- try {
- getService().testSql(sql);
- result = true;
- } catch (Exception e) {
- Throwable cause = e.getCause();
- if (log.isWarnEnabled()) {
- log.warn("Invalid sql ", cause);
- }
- addFieldError("query.sqlQuery",
- _("echobase.error.invalid.sql", cause.getMessage()));
- result = false;
- }
- return result;
- }
-
@Override
public void prepare() throws Exception {
- Collection<ExportQuery> sqlQueries =
- getService().getEntities(ExportQuery.class);
+ queries = loadSortAndDecorate(ExportQuery.class);
- queries = sortAndDecorate(sqlQueries, null);
+ if (queries.isEmpty()) {
- if (sqlQueries.isEmpty()) {
-
// no query saved
- addActionMessage(_("echobase.info.no.sqlQuery.saved"));
+ addFlashMessage(_("echobase.info.no.sqlQuery.saved"));
} else {
String selectedQueryId = getQuery().getTopiaId();
@@ -205,11 +184,11 @@
if (isNewQuery() || isNewLibreOfficeQuery()) {
// new query in progress
- addActionMessage(_("echobase.info.new.sqlQuery.inprogress"));
+ addFlashMessage(_("echobase.info.new.sqlQuery.inprogress"));
} else {
// no query selected
- addActionMessage(_("echobase.info.no.sqlQuery.selected"));
+ addFlashMessage(_("echobase.info.no.sqlQuery.selected"));
}
} else {
@@ -225,10 +204,27 @@
if (!canUpdateQuery) {
// this user can not update selected query
- addActionMessage(
+ addFlashMessage(
_("echobase.info.sqlQuery.not.modifiable"));
}
}
}
}
+
+ private boolean checkQuery(String sql) {
+ boolean result;
+ try {
+ getService().testSql(sql);
+ result = true;
+ } catch (Exception e) {
+ Throwable cause = e.getCause();
+ if (log.isWarnEnabled()) {
+ log.warn("Invalid sql ", cause);
+ }
+ addFieldError("query.sqlQuery",
+ _("echobase.error.invalid.sql", cause.getMessage()));
+ result = false;
+ }
+ return result;
+ }
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,22 +23,17 @@
*/
package fr.ifremer.echobase.ui.actions.importData;
-import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import fr.ifremer.echobase.io.EchoBaseIOUtil;
import fr.ifremer.echobase.io.InputFile;
-import fr.ifremer.echobase.services.DecoratorService;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import fr.ifremer.echobase.ui.actions.AbstractConfigureAction;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.util.FileUtil;
import java.io.File;
-import java.util.List;
-import java.util.Map;
+import java.io.IOException;
/**
* Configure a accoustic data import.
@@ -46,7 +41,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public abstract class AbstractConfigureImport<M extends AbstractImportConfiguration> extends EchoBaseActionSupport {
+public abstract class AbstractConfigureImport<M extends AbstractImportConfiguration> extends AbstractConfigureAction<M> {
private static final long serialVersionUID = 1L;
@@ -54,75 +49,28 @@
private static final Log log =
LogFactory.getLog(AbstractConfigureImport.class);
- protected final Class<M> modelType;
-
- protected M model;
-
protected AbstractConfigureImport(Class<M> modelType) {
- this.modelType = modelType;
+ super(modelType);
}
- public final M getModel() {
- if (model == null) {
- model = createModel();
- }
- return model;
- }
-
- protected abstract M createModel();
-
@Override
- public String input() throws Exception {
-
- // always remove configuration from session anytime coming here
- getEchoBaseSession().removeImportDataConfiguration(modelType);
-
- return INPUT;
- }
-
- @InputConfig(methodName = "input")
- @Override
- public String execute() throws Exception {
-
- M importModel = getModel();
+ protected void prepareExecuteAction(M model) throws IOException {
File tempDirectory = FileUtils.getTempDirectory();
File dataDirectory = new File(
tempDirectory,
"echobase-importData-" + System.currentTimeMillis());
FileUtil.createDirectoryIfNecessary(dataDirectory);
- importModel.setWorkingDirectory(dataDirectory);
+ model.setWorkingDirectory(dataDirectory);
if (log.isInfoEnabled()) {
log.info("Temporary directory to use : " + dataDirectory);
}
- for (InputFile inputFile : importModel.getInputFiles()) {
+ for (InputFile inputFile : model.getInputFiles()) {
if (inputFile.hasFile()) {
EchoBaseIOUtil.copyFile(inputFile, dataDirectory);
}
}
- setInSession(importModel);
- return SUCCESS;
}
- protected final void setInSession(M model) {
- getEchoBaseSession().setImportDataConfiguration(model);
- }
-
- protected final M getFromSession() {
- return getEchoBaseSession().getImportDataConfiguration(modelType);
- }
-
- public final void setModel(M model) {
- this.model = model;
- }
-
- protected <E extends TopiaEntity> Map<String, String> loadSortAndDecorate(EchoBaseServiceSupport service, Class<E> beanType) {
-
- DecoratorService decoratorService =
- service.getService(DecoratorService.class);
-
- List<E> beans = service.getEntities(beanType);
- return decoratorService.sortAndDecorate(getLocale(), beans, null);
- }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -23,9 +23,9 @@
*/
package fr.ifremer.echobase.ui.actions.importData;
-import fr.ifremer.echobase.services.importdata.ImportException;
import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration;
import fr.ifremer.echobase.services.importdata.AbstractImportDataService;
+import fr.ifremer.echobase.services.importdata.ImportException;
import fr.ifremer.echobase.ui.actions.AbstractWaitAndExecAction;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.logging.Log;
@@ -37,33 +37,21 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class AbstractLaunchImport<M extends AbstractImportConfiguration, S extends AbstractImportDataService<M>> extends AbstractWaitAndExecAction<M> {
+public class AbstractLaunchImport<M extends AbstractImportConfiguration, S extends AbstractImportDataService<M>> extends AbstractWaitAndExecAction<M, S> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(AbstractLaunchImport.class);
- protected final Class<M> modelType;
-
- protected final Class<S> serviceType;
-
- protected transient S service;
-
protected transient Exception error;
protected String result;
protected AbstractLaunchImport(Class<M> modelType, Class<S> serviceType) {
- this.modelType = modelType;
- this.serviceType = serviceType;
+ super(modelType, serviceType);
}
- @Override
- protected M initModel() {
- return getEchoBaseSession().getImportDataConfiguration(modelType);
- }
-
public String getResult() {
return result;
}
@@ -84,28 +72,19 @@
}
@Override
- public void prepare() throws Exception {
-
- super.prepare();
-
- service = getService(serviceType);
- }
-
- @Override
- protected void startAction(M model) throws Exception {
+ protected void startAction(S service, M model) throws Exception {
if (log.isInfoEnabled()) {
log.info("Start imports for " + getModel());
}
try {
- result = service.doImport(model,
- getEchoBaseSession().getUser());
+ result = service.doImport(model, getEchoBaseSession().getUser());
- addActionMessage(_("echobase.info.import.succeded"));
+ addFlashMessage(_("echobase.info.import.succeded"));
} catch (ImportException e) {
- addActionError(_("echobase.info.import.failed"));
+ addFlashError(_("echobase.info.import.failed"));
if (log.isErrorEnabled()) {
log.error("Error while import ", e);
@@ -115,13 +94,4 @@
}
}
- @Override
- protected void closeAction(M model) throws Exception {
-
- // clean configuration
- model.destroy();
-
- // remove configuration from session
- getEchoBaseSession().removeImportDataConfiguration(modelType);
- }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,7 +24,6 @@
package fr.ifremer.echobase.ui.actions.importData;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.AcousticImportConfiguration;
import fr.ifremer.echobase.services.importdata.CellPositionReference;
@@ -56,22 +55,14 @@
}
@Override
- public String input() throws Exception {
-
- super.input();
-
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
-
- voyages = loadSortAndDecorate(service, Voyage.class);
+ protected void prepareInputAction(AcousticImportConfiguration model) {
+ voyages = loadSortAndDecorate(Voyage.class);
cellPositionReferences = decorateEnums(CellPositionReference.values());
- if (getModel().getCellPositionReference() == null) {
+ if (model.getCellPositionReference() == null) {
- getModel().setCellPositionReference(CellPositionReference.START);
+ model.setCellPositionReference(CellPositionReference.START);
}
-
- return INPUT;
}
public Map<String, String> getVoyages() {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,7 +24,6 @@
package fr.ifremer.echobase.ui.actions.importData;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.CatchesImportConfiguration;
import java.io.File;
@@ -53,16 +52,8 @@
}
@Override
- public String input() throws Exception {
-
- super.input();
-
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
-
- voyages = loadSortAndDecorate(service, Voyage.class);
-
- return INPUT;
+ protected void prepareInputAction(CatchesImportConfiguration model) {
+ voyages = loadSortAndDecorate(Voyage.class);
}
public Map<String, String> getVoyages() {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -27,7 +27,6 @@
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.entities.references.AreaOfOperation;
import fr.ifremer.echobase.entities.references.Mission;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.CommonImportConfiguration;
import fr.ifremer.echobase.services.importdata.CommonImportMode;
@@ -66,24 +65,16 @@
}
@Override
- public String input() throws Exception {
-
- super.input();
-
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
-
- missions = loadSortAndDecorate(service, Mission.class);
- voyages = loadSortAndDecorate(service, Voyage.class);
- areaOfOperations = loadSortAndDecorate(service, AreaOfOperation.class);
+ protected void prepareInputAction(CommonImportConfiguration model) {
+ missions = loadSortAndDecorate(Mission.class);
+ voyages = loadSortAndDecorate(Voyage.class);
+ areaOfOperations = loadSortAndDecorate(AreaOfOperation.class);
importModes = decorateEnums(CommonImportMode.values());
- if (getModel().getImportMode() == null) {
+ if (model.getImportMode() == null) {
- getModel().setImportMode(CommonImportMode.ALL);
+ model.setImportMode(CommonImportMode.ALL);
}
-
- return INPUT;
}
@InputConfig(methodName = "input")
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -24,7 +24,6 @@
package fr.ifremer.echobase.ui.actions.importData;
import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.OperationImportConfiguration;
import java.io.File;
@@ -53,15 +52,8 @@
}
@Override
- public String input() throws Exception {
-
- super.input();
-
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
-
- voyages = loadSortAndDecorate(service, Voyage.class);
- return INPUT;
+ protected void prepareInputAction(OperationImportConfiguration model) {
+ voyages = loadSortAndDecorate(Voyage.class);
}
public Map<String, String> getVoyages() {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -26,7 +26,6 @@
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.entities.references.Vessel;
-import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.ResultsImportConfiguration;
import fr.ifremer.echobase.services.importdata.ResultsImportMode;
@@ -64,22 +63,15 @@
}
@Override
- public String input() throws Exception {
-
- super.input();
-
- EchoBaseServiceSupport service =
- getService(EchoBaseServiceSupport.class);
-
- voyages = loadSortAndDecorate(service, Voyage.class);
- vessels = loadSortAndDecorate(service, Vessel.class);
+ protected void prepareInputAction(ResultsImportConfiguration model) {
+ voyages = loadSortAndDecorate(Voyage.class);
+ vessels = loadSortAndDecorate(Vessel.class);
importModes = decorateEnums(ResultsImportMode.values());
- if (getModel().getImportMode() == null) {
+ if (model.getImportMode() == null) {
- getModel().setImportMode(ResultsImportMode.VOYAGE);
+ model.setImportMode(ResultsImportMode.VOYAGE);
}
- return INPUT;
}
@InputConfig(methodName = "input")
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -26,8 +26,8 @@
import com.google.common.base.Preconditions;
import fr.ifremer.echobase.entities.references.Mission;
import fr.ifremer.echobase.entities.references.MissionImpl;
+import fr.ifremer.echobase.services.importdata.CommonImportService;
import fr.ifremer.echobase.services.importdata.MissionNameAlreadyExistException;
-import fr.ifremer.echobase.services.importdata.CommonImportService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -70,7 +70,7 @@
if (log.isInfoEnabled()) {
log.info("Created mission : " + missionSaved.getTopiaId());
}
- addActionMessage(
+ addFlashMessage(
_("echobase.information.mission.created", missionSaved.getName()));
result = SUCCESS;
} catch (MissionNameAlreadyExistException e) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -37,8 +37,7 @@
private static final long serialVersionUID = 1L;
public LaunchOperationImport() {
- super(OperationImportConfiguration.class,
- OperationImportService.class);
+ super(OperationImportConfiguration.class, OperationImportService.class);
}
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -26,13 +26,14 @@
import fr.ifremer.echobase.io.EchoBaseIOUtil;
import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.services.importdb.ImportDbConfiguration;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import fr.ifremer.echobase.ui.actions.AbstractConfigureAction;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.FileUtil;
import java.io.File;
+import java.io.IOException;
/**
* Configure a db import.
@@ -40,62 +41,48 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Configure extends EchoBaseActionSupport {
+public class Configure extends AbstractConfigureAction<ImportDbConfiguration> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Configure.class);
- protected ImportDbConfiguration model;
-
- public ImportDbConfiguration getModel() {
- if (model == null) {
- model = new ImportDbConfiguration(getLocale());
- }
- return model;
+ public Configure() {
+ super(ImportDbConfiguration.class);
}
- public void setInputFileName(String fileName) {
- getModel().getInput().setFileName(fileName);
- }
-
- public void setInput(File file) {
- getModel().getInput().setFile(file);
- }
-
- public void setInputContentType(String contentType) {
- getModel().getInput().setContentType(contentType);
- }
-
@Override
- public String input() throws Exception {
-
- // always remove configuration from session anytime coming here
- getEchoBaseSession().setImportDbConfiguration(null);
- return INPUT;
+ protected ImportDbConfiguration createModel() {
+ return new ImportDbConfiguration(getLocale());
}
@Override
- public String execute() throws Exception {
+ protected void prepareExecuteAction(ImportDbConfiguration model) throws IOException {
- ImportDbConfiguration configuration = getModel();
-
File tempDirectory = FileUtils.getTempDirectory();
File dataDirectory = new File(
tempDirectory,
"echobase-importDb-" + System.currentTimeMillis());
FileUtil.createDirectoryIfNecessary(dataDirectory);
- configuration.setWorkingDirectory(dataDirectory);
+ model.setWorkingDirectory(dataDirectory);
if (log.isInfoEnabled()) {
log.info("Temporary directory to use : " + dataDirectory);
}
- InputFile input = configuration.getInput();
+ InputFile input = model.getInput();
EchoBaseIOUtil.copyFile(input, dataDirectory);
+ }
- // store configuration in session
- getEchoBaseSession().setImportDbConfiguration(configuration);
- return SUCCESS;
+ public void setInputFileName(String fileName) {
+ getModel().getInput().setFileName(fileName);
}
+
+ public void setInput(File file) {
+ getModel().getInput().setFile(file);
+ }
+
+ public void setInputContentType(String contentType) {
+ getModel().getInput().setContentType(contentType);
+ }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -35,31 +35,20 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class Import extends AbstractWaitAndExecAction<ImportDbConfiguration> {
+public class Import extends AbstractWaitAndExecAction<ImportDbConfiguration, ImportDbService> {
private static final long serialVersionUID = 1L;
/** Logger. */
private static final Log log = LogFactory.getLog(Import.class);
- /** service to execute the import. */
- protected transient ImportDbService service;
-
- @Override
- protected ImportDbConfiguration initModel() {
- return getEchoBaseSession().getImportDbConfiguration();
+ public Import() {
+ super(ImportDbConfiguration.class, ImportDbService.class);
}
@Override
- public void prepare() throws Exception {
-
- super.prepare();
-
- service = getService(ImportDbService.class);
- }
-
- @Override
- protected void startAction(ImportDbConfiguration model) throws Exception {
+ protected void startAction(ImportDbService service,
+ ImportDbConfiguration model) throws Exception {
if (log.isInfoEnabled()) {
log.info("Start imports with file " +
model.getInput().getFileName());
@@ -71,12 +60,6 @@
@Override
protected void closeAction(ImportDbConfiguration model) throws Exception {
- // clean configuration
- model.destroy();
-
- // remove configuration from session
- getEchoBaseSession().setImportDbConfiguration(null);
+ destroyModel(model);
}
-
-
}
\ No newline at end of file
Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,114 +0,0 @@
-/*
- * #%L
- * EchoBase :: UI
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.ui.actions.user;
-
-import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.lang3.StringUtils;
-import org.nuiton.topia.TopiaContextFactory;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * Display a page to show connection details.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class ConnectToDbInformations extends EchoBaseActionSupport {
-
- private static final long serialVersionUID = 1L;
-
- protected String jdbcUrl;
-
- protected String jdbcLogin;
-
- protected String jdbcPassword;
-
- protected String jdbcDriver;
-
- protected File jdbcPilot;
-
- protected boolean askPassword;
-
- public String getJdbcUrl() {
- return jdbcUrl;
- }
-
- public String getJdbcLogin() {
- return jdbcLogin;
- }
-
- public String getJdbcPassword() {
- return jdbcPassword;
- }
-
- public String getJdbcDriver() {
- return jdbcDriver;
- }
-
- public File getJdbcPilot() {
- return jdbcPilot;
- }
-
- public boolean isAskPassword() {
- return askPassword;
- }
-
- @Override
- public String execute() throws Exception {
- EchoBaseConfiguration configuration =
- getEchoBaseApplicationContext().getConfiguration();
- Properties properties = configuration.getProperties();
- if (configuration.isEmbedded()) {
- jdbcPassword = properties.getProperty(TopiaContextFactory.CONFIG_PASS);
- } else {
- askPassword = true;
- jdbcPassword = "***";
- }
- jdbcUrl = properties.getProperty(TopiaContextFactory.CONFIG_URL);
- jdbcLogin = properties.getProperty(TopiaContextFactory.CONFIG_USER);
- jdbcDriver = properties.getProperty(TopiaContextFactory.CONFIG_DRIVER);
-
- EmbeddedApplicationService service =
- getService(EmbeddedApplicationService.class);
-
- String pilotName;
-
- if ("org.h2.Driver".equals(jdbcDriver)) {
- pilotName = service.getH2PilotFilename(properties);
- } else {
- pilotName = service.getPostgresqlPilotFilename(properties);
- }
-
- if (StringUtils.isNotEmpty(pilotName)) {
- File driverDirectory = service.getPilotsDirectory(
- configuration.getDataDirectory());
- jdbcPilot = new File(driverDirectory, pilotName);
- }
- return SUCCESS;
- }
-}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -42,17 +42,16 @@
private static final long serialVersionUID = 1L;
- protected transient UserService userService;
-
protected EchoBaseUser user;
- public UserService getUserService() {
- if (userService == null) {
- userService = getService(UserService.class);
+ public EchoBaseUser getUser() {
+ if (user == null) {
+ user = getService(UserService.class).newUser();
}
- return userService;
+ return user;
}
+ @Override
public String execute() throws Exception {
EchoBaseUser userToCreate = getUser();
String userEmail = userToCreate.getEmail();
@@ -62,10 +61,10 @@
}
// create user
- getUserService().createOrUpdate(userToCreate);
+ getService(UserService.class).createOrUpdate(userToCreate);
// add info message
- addActionMessage(_("echobase.info.user.create", userEmail));
+ addFlashMessage(_("echobase.info.user.create", userEmail));
return SUCCESS;
}
@@ -86,7 +85,7 @@
// check login not already used
EchoBaseUser login;
try {
- login = getUserService().getUserByEmail(userEmail);
+ login = getService(UserService.class).getUserByEmail(userEmail);
} catch (Exception e) {
// could not get user
@@ -108,12 +107,4 @@
}
}
-
- public EchoBaseUser getUser() {
- if (user == null) {
- user = getUserService().newUser();
- }
- return user;
- }
-
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -32,8 +32,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ParameterAware;
-import java.util.Map;
-
/**
* To delete a user.
*
@@ -46,50 +44,22 @@
private static final long serialVersionUID = 1L;
- protected transient UserService userService;
-
protected EchoBaseUser user;
- private Map<String, String[]> parameters;
-
- public UserService getUserService() {
- if (userService == null) {
- userService = getService(UserService.class);
- }
- return userService;
- }
-
- public String execute() throws Exception {
-
- EchoBaseUser userToDelete = getUser();
- String userEmail = userToDelete.getEmail();
-
- if (log.isInfoEnabled()) {
- log.info("will delete user " + userEmail);
- }
-
- // delete user
- getUserService().delete(userToDelete);
-
- // add info message
- addActionMessage(_("echobase.info.user.delete", userEmail));
- return SUCCESS;
- }
-
public EchoBaseUser getUser() {
if (user == null) {
- user = getUserService().newUser();
+ user = getService(UserService.class).newUser();
}
return user;
}
@Override
public void prepare() throws Exception {
- String userId = parameters.get("user.topiaId")[0];
+ String userId = getParameters().get("user.topiaId")[0];
if (!StringUtils.isEmpty(userId)) {
// load user
- user = getUserService().getUserById(userId);
+ user = getService(UserService.class).getUserById(userId);
// do not want to have the password
user.setPassword("");
if (log.isInfoEnabled()) {
@@ -99,7 +69,20 @@
}
@Override
- public void setParameters(Map<String, String[]> parameters) {
- this.parameters = parameters;
+ public String execute() throws Exception {
+
+ EchoBaseUser userToDelete = getUser();
+ String userEmail = userToDelete.getEmail();
+
+ if (log.isInfoEnabled()) {
+ log.info("will delete user " + userEmail);
+ }
+
+ // delete user
+ getService(UserService.class).delete(userToDelete);
+
+ // add info message
+ addFlashMessage(_("echobase.info.user.delete", userEmail));
+ return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -87,5 +87,4 @@
return SUCCESS;
}
-
}
Copied: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java (from rev 588, trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java)
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,112 @@
+/*
+ * #%L
+ * EchoBase :: UI
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.ui.actions.user;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.interceptor.I18nInterceptor;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.services.UserService;
+import fr.ifremer.echobase.ui.EchoBaseSession;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.interceptor.SessionAware;
+
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Login and Logout action.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Login extends EchoBaseActionSupport implements SessionAware {
+
+ protected static final Log log = LogFactory.getLog(Login.class);
+
+ private static final long serialVersionUID = 1L;
+
+ protected String email;
+
+ protected String password;
+
+ protected String redirectAction;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getRedirectAction() {
+ return redirectAction;
+ }
+
+ public void setRedirectAction(String redirectAction) {
+ this.redirectAction = redirectAction;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ EchoBaseUser user = getService(UserService.class).getUserByEmail(email);
+
+ EchoBaseSession userSession = getEchoBaseSession();
+
+ // user is authorized, keep it in his echoBaseSession
+ userSession.setUser(user);
+
+ // let's register
+ getEchoBaseApplicationContext().registerEchoBaseSession(userSession);
+
+ Map<String,Object> session = getSession();
+
+ // add locale in echoBaseSession if required
+ Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
+ if (o == null) {
+
+ // push the locale in echoBaseSession to be able to use it everywhere
+ Locale locale = ActionContext.getContext().getLocale();
+ session.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE, locale);
+ }
+
+ // redecode parameters
+ if (log.isInfoEnabled()) {
+ log.info("success login for user " + email +
+ ", will redirect to " + redirectAction);
+ }
+ return "redirect";
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,135 +0,0 @@
-/*
- * #%L
- * EchoBase :: UI
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.ui.actions.user;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.interceptor.I18nInterceptor;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.services.UserService;
-import fr.ifremer.echobase.ui.EchoBaseSession;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts2.interceptor.SessionAware;
-
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * Login and Logout action.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class LoginAction extends EchoBaseActionSupport implements SessionAware {
-
- protected static final Log log = LogFactory.getLog(LoginAction.class);
-
- private static final long serialVersionUID = 1L;
-
- protected String email;
-
- protected String password;
-
- protected String redirectAction;
-
- private transient Map<String, Object> session;
-
- protected transient UserService userService;
-
- public UserService getUserService() {
- if (userService == null) {
- userService = getService(UserService.class);
- }
- return userService;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getRedirectAction() {
- return redirectAction;
- }
-
- public void setRedirectAction(String redirectAction) {
- this.redirectAction = redirectAction;
- }
-
- public String doLogin() throws Exception {
-
- EchoBaseUser user = getUserService().getUserByEmail(email);
-
- EchoBaseSession userSession = getEchoBaseSession();
-
- // user is authorized, keep it in his echoBaseSession
- userSession.setUser(user);
-
- // add locale in echoBaseSession if required
- Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
- if (o == null) {
-
- // push the locale in echoBaseSession to be able to use it everywhere
- Locale locale = ActionContext.getContext().getLocale();
- session.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE, locale);
- }
-
- // redecode parameters
- if (log.isInfoEnabled()) {
- log.info("success login for user " + email +
- ", will redirect to " + redirectAction);
- }
- return "redirect";
- }
-
- public String doLogout() {
-
- EchoBaseSession userSession = getEchoBaseSession();
-
- // remove echoBaseSession from application session
- getEchoBaseApplicationContext().destroyEchoBaseSession(userSession);
-
- // clean it from ActionContext (we never know...)
- EchoBaseSession.removeEchoBaseSession(getActionContext());
-
- return SUCCESS;
- }
-
- @Override
- public void setSession(Map<String, Object> session) {
- this.session = session;
- }
-}
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,52 @@
+package fr.ifremer.echobase.ui.actions.user;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.ui.EchoBaseSession;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+
+/**
+ * Log out from EchoBase.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Logout extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+
+ EchoBaseSession userSession = getEchoBaseSession();
+
+ // remove echoBaseSession from application session
+ getEchoBaseApplicationContext().destroyEchoBaseSession(userSession);
+
+ // clean it from ActionContext (we never know...)
+ EchoBaseSession.removeEchoBaseSession(getActionContext());
+
+ return SUCCESS;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -32,8 +32,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ParameterAware;
-import java.util.Map;
-
/**
* To update a user.
*
@@ -46,17 +44,13 @@
private static final long serialVersionUID = 1L;
- protected transient UserService userService;
-
protected EchoBaseUser user;
- private Map<String, String[]> parameters;
-
- public UserService getUserService() {
- if (userService == null) {
- userService = getService(UserService.class);
+ public EchoBaseUser getUser() {
+ if (user == null) {
+ user = getService(UserService.class).newUser();
}
- return userService;
+ return user;
}
@Override
@@ -69,20 +63,20 @@
}
// update user
- getUserService().createOrUpdate(userToUpdate);
+ getService(UserService.class).createOrUpdate(userToUpdate);
// add info message
- addActionMessage(_("echobase.info.user.update", userEmail));
+ addFlashMessage(_("echobase.info.user.update", userEmail));
return SUCCESS;
}
@Override
public void prepare() throws Exception {
- String userId = parameters.get("user.topiaId")[0];
+ String userId = getParameters().get("user.topiaId")[0];
if (!StringUtils.isEmpty(userId)) {
// load user
- user = getUserService().getUserById(userId);
+ user = getService(UserService.class).getUserById(userId);
// do not want to update password
user.setPassword("");
if (log.isInfoEnabled()) {
@@ -91,15 +85,4 @@
}
}
- public EchoBaseUser getUser() {
- if (user == null) {
- user = getUserService().newUser();
- }
- return user;
- }
-
- @Override
- public void setParameters(Map<String, String[]> parameters) {
- this.parameters = parameters;
- }
}
\ No newline at end of file
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,114 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.opensymphony.xwork2.Preparable;
+import fr.ifremer.echobase.entities.DriverType;
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import fr.ifremer.echobase.services.workingDb.WorkingDbConfigurationService;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.interceptor.ParameterAware;
+
+import java.util.Map;
+
+/**
+ * Connects to an existing working db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public abstract class AbstractWorkingDbAction extends EchoBaseActionSupport implements Preparable, ParameterAware {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(AbstractWorkingDbAction.class);
+
+ /** All available working db configuration from database. */
+ protected Map<String, String> confs;
+
+ /** All available driver types. */
+ protected Map<String, String> driverTypes;
+
+ /** Current working db configuration. */
+ protected WorkingDbConfiguration conf;
+
+ public boolean isNewConf() {
+ return false;
+ }
+
+ public final Map<String, String> getConfs() {
+ return confs;
+ }
+
+ public final WorkingDbConfiguration getConf() {
+ if (conf == null) {
+ conf = getService().newConfiguration();
+ }
+ return conf;
+ }
+
+ public Map<String, String> getDriverTypes() {
+ return driverTypes;
+ }
+
+ public final boolean isConfExists() {
+ return StringUtils.isNotBlank(getConf().getTopiaId());
+ }
+
+ @Override
+ public void prepare() throws Exception {
+
+ driverTypes = decorateEnums(DriverType.values());
+
+ confs = loadSortAndDecorate(WorkingDbConfiguration.class);
+
+ if (confs.isEmpty()) {
+
+ // no conf saved
+ addFlashMessage(
+ _("echobase.info.no.workingDbConfiguration.saved"));
+ }
+
+ String[] ids = getParameters().get("conf.topiaId");
+ String id = ids == null || ids.length == 0 ? null : ids[0];
+ if (!StringUtils.isEmpty(id)) {
+
+ // load conf
+ conf = getService().getEditableConf(id);
+ if (log.isInfoEnabled()) {
+ log.info("Selected conf " + conf.getUrl());
+ }
+ }
+ }
+
+ protected final WorkingDbConfigurationService getService() {
+ return getService(WorkingDbConfigurationService.class);
+ }
+
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,100 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
+
+import java.sql.SQLException;
+
+/**
+ * Connects to an existing working db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Connect extends AbstractWorkingDbAction {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String password;
+
+ protected JdbcConfiguration jdbcConf;
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @InputConfig(methodName = INPUT)
+ @Override
+ public String execute() throws Exception {
+
+ String result = INPUT;
+
+ try {
+ EchoBaseEntityHelper.checkJDBCConnection(jdbcConf);
+ getEchoBaseSession().initWorkingDb(jdbcConf);
+ addFlashMessage(_("echobase.info.workingDbconfiguration.connected",
+ conf.getUrl()));
+ result = SUCCESS;
+
+ } catch (SQLException e) {
+ jdbcConf = null;
+ addFieldError(
+ "password",
+ _("echobase.error.workingDbConfiguration.couldNotConnect",
+ e.getMessage()));
+ }
+
+ return result;
+ }
+
+ @Override
+ public void validate() {
+
+ jdbcConf = JdbcConfiguration.newConfig(
+ getConf().getUrl(),
+ getConf().getLogin(),
+ password,
+ getConf().getDriverType()
+ );
+
+ // check connexion is ok
+ try {
+ EchoBaseEntityHelper.checkJDBCConnection(jdbcConf);
+ } catch (SQLException e) {
+ jdbcConf = null;
+ addFieldError(
+ "password",
+ _("echobase.error.workingDbConfiguration.couldNotConnect",
+ e.getMessage()));
+ }
+
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,110 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * To create a new {@link WorkingDbConfiguration}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Create extends AbstractWorkingDbAction {
+
+ private static final long serialVersionUID = 1L;
+
+ public boolean isNewConf() {
+ return true;
+ }
+
+ public String createConf() throws Exception {
+
+ // new workingDbConfiguration in progress
+ addFlashMessage(
+ _("echobase.info.new.workingDbConfiguration.inprogress"));
+
+ return INPUT;
+ }
+
+ public String cloneConf() throws Exception {
+
+ getConf().setTopiaId(null);
+
+ // new workingDbConfiguration in progress
+ addFlashMessage(
+ _("echobase.info.new.workingDbConfiguration.inprogress"));
+
+ return INPUT;
+ }
+
+ @InputConfig(methodName = INPUT)
+ @Override
+ public String execute() throws Exception {
+
+ conf = getService().create(getConf());
+
+ addFlashMessage(_("echobase.info.workingDbconfiguration.created",
+ conf.getUrl()));
+
+ return SUCCESS;
+ }
+
+ @Override
+ public void validate() {
+
+ if (StringUtils.isBlank(getConf().getUrl())) {
+ addFieldError(
+ "conf.url",
+ _("echobase.error.workingDbConfiguration.url.required"));
+ } else {
+
+ if (!isConfExists()) {
+
+ // when creating a request
+ // check this url does not exists
+
+ boolean urlUsed = getService().isUrlAlreadyUsed(getConf().getUrl());
+ if (urlUsed) {
+ addFieldError("conf.url",
+ _("echobase.error.workingDbConfiguration.url.already.exists"));
+ }
+ }
+ }
+
+ if (StringUtils.isBlank(getConf().getLogin())) {
+ addFieldError(
+ "conf.login",
+ _("echobase.error.workingDbConfiguration.login.required"));
+ }
+
+ if (StringUtils.isBlank(getConf().getDescription())) {
+ addFieldError(
+ "conf.description",
+ _("echobase.error.workingDbConfiguration.description.required"));
+ }
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,67 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * To delete a selected {@link WorkingDbConfiguration}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Delete extends AbstractWorkingDbAction {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(Delete.class);
+
+ public String confirmDelete() {
+
+ return SUCCESS;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ String result = INPUT;
+ try {
+ getService().delete(getConf().getTopiaId());
+ addFlashMessage(_("echobase.info.workingDbconfiguration.deleted",
+ conf.getUrl()));
+
+ conf = null;
+ result = SUCCESS;
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not delete workgingDbconfiguration", e);
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,48 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
+
+/**
+ * Disconnects from a {@link WorkingDbConfiguration}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class Disconnect extends AbstractWorkingDbAction {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+ JdbcConfiguration sessionConf =
+ getEchoBaseSession().getWorkingDbConfiguration();
+ getEchoBaseSession().releaseWorkingDb();
+ addFlashMessage(_("echobase.info.workingDbconfiguration.disconnected",
+ sessionConf.getUrl()));
+ return SUCCESS;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,79 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
+import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Display a page to show connection details.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class Information extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected JdbcConfiguration dbConfiguration;
+
+ protected File jdbcPilot;
+
+ public JdbcConfiguration getDbConfiguration() {
+ return dbConfiguration;
+ }
+
+ public File getJdbcPilot() {
+ return jdbcPilot;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ EchoBaseConfiguration configuration =
+ getEchoBaseApplicationContext().getConfiguration();
+
+ dbConfiguration = getEchoBaseSession().getWorkingDbConfiguration();
+
+ Properties properties = configuration.getProperties();
+
+ String pilotName =
+ dbConfiguration.getDriverType().getPilotFileName(properties);
+
+ if (StringUtils.isNotEmpty(pilotName)) {
+ EmbeddedApplicationService service =
+ getService(EmbeddedApplicationService.class);
+ File driverDirectory = service.getPilotsDirectory(
+ configuration.getDataDirectory());
+ jdbcPilot = new File(driverDirectory, pilotName);
+ }
+ return SUCCESS;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,50 @@
+package fr.ifremer.echobase.ui.actions.workingDb;
+
+/*
+ * #%L
+ * EchoBase :: UI
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+
+/**
+ * Display the page to manage and use {@link WorkingDbConfiguration}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class ShowList extends AbstractWorkingDbAction {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+
+ if (!isConfExists()) {
+
+ // no workingDbConfiguration selected
+ addFlashMessage(
+ _("echobase.info.no.workingDbConfiguration.selected"));
+ }
+
+ return SUCCESS;
+ }
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,92 +0,0 @@
-/*
- * #%L
- * EchoBase :: UI
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.ui.interceptors;
-
-import com.google.common.collect.Sets;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.util.TextParseUtil;
-import fr.ifremer.echobase.ui.EchoBaseSession;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * To check if some data are in the user session.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @see EchoBaseSession
- * @since 0.1
- */
-public class CheckInUserSessionInterceptor extends AbstractCheckInterceptor {
-
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- protected static final Log log =
- LogFactory.getLog(CheckInUserSessionInterceptor.class);
-
- private Set<String> parameters = Collections.emptySet();
-
- /**
- * Allows <code>sessionParametersToClean</code> attribute to be set as comma-separated-values (csv).
- *
- * @param parameters the sessionParametersToClean to set
- */
- public void setParameters(String parameters) {
- this.parameters =
- TextParseUtil.commaDelimitedStringToSet(parameters);
- }
-
- @Override
- protected boolean doCheck(ActionInvocation invocation) {
- EchoBaseActionSupport action = (EchoBaseActionSupport) invocation.getAction();
-
- EchoBaseSession echoBaseSession = action.getEchoBaseSession();
- Set<String> missingKeys = null;
- for (String parameter : parameters) {
- boolean ok = echoBaseSession.contains(parameter);
- if (!ok) {
- if (missingKeys == null) {
- missingKeys = Sets.newHashSet();
- }
- missingKeys.add(parameter);
- }
- }
- if (CollectionUtils.isNotEmpty(missingKeys)) {
- // there is something missing in the user session
- String message = "Some objects were not found in session : " +
- missingKeys + ", " + "redirect to " + redirectAction;
- if (log.isInfoEnabled()) {
- log.info(message);
- }
- return false;
- }
- return true;
- }
-
-}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -27,7 +27,7 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.ui.EchoBaseSession;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import fr.ifremer.echobase.ui.actions.user.LoginAction;
+import fr.ifremer.echobase.ui.actions.user.Login;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -74,12 +74,12 @@
if (log.isInfoEnabled()) {
log.info("AutotLogin with admin/admin user");
}
- LoginAction logAction = new LoginAction();
+ Login logAction = new Login();
logAction.setSession(invocation.getInvocationContext().getSession());
logAction.setEmail("admin");
logAction.setPassword("admin");
try {
- logAction.doLogin();
+ logAction.execute();
} catch (Exception eee) {
if (log.isErrorEnabled()) {
log.error("Could not auto-login", eee);
Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,79 +0,0 @@
-/*
- * #%L
- * EchoBase :: UI
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.ui.interceptors;
-
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import com.opensymphony.xwork2.util.TextParseUtil;
-import fr.ifremer.echobase.ui.EchoBaseSession;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * Interceptor to remove some stuff from user session.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @see EchoBaseSession
- * @since 0.1
- */
-public class CleanEchoBaseSessionInterceptor extends AbstractInterceptor {
- private static final long serialVersionUID = 1L;
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(CleanEchoBaseSessionInterceptor.class);
-
- private Set<String> parameters = Collections.emptySet();
-
- /**
- * <code>parameters</code> to remove from session as comma-separated-values (csv).
- *
- * @param parameters the parameters to set
- */
- public void setParameters(String parameters) {
- this.parameters =
- TextParseUtil.commaDelimitedStringToSet(parameters);
- }
-
- @Override
- public String intercept(ActionInvocation invocation) throws Exception {
-
- EchoBaseActionSupport action = (EchoBaseActionSupport) invocation.getAction();
-
- EchoBaseSession echoBaseSession = action.getEchoBaseSession();
-
- for (String paramName : parameters) {
- Object value = echoBaseSession.remove(paramName);
- if (log.isDebugEnabled()) {
- log.debug("Removed [" + paramName + "] : " + value);
- }
- }
-
- return invocation.invoke();
- }
-}
Modified: trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -38,6 +38,11 @@
<param name="namespace">export</param>
<param name="query.topiaId">${query.topiaId}</param>
</result-type>
+ <result-type name="showList"
+ class="org.apache.struts2.dispatcher.ServletDispatcherResult">
+ <param name="location">/WEB-INF/jsp/exportQuery/exportQuery.jsp</param>
+ <param name="query.topiaId">${query.topiaId}</param>
+ </result-type>
</result-types>
@@ -54,7 +59,7 @@
<action name="manageExportQuery"
class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery">
<interceptor-ref name="paramsPrepareParamsStackLoggued"/>
- <result>/WEB-INF/jsp/exportQuery/exportQuery.jsp</result>
+ <result type="showList"/>
</action>
<!-- Display the result of the export query execution -->
@@ -81,7 +86,7 @@
<action name="clone" method="cloneQuery"
class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery">
<interceptor-ref name="paramsPrepareParamsStackLoggued"/>
- <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result>
+ <result name="input" type="showList"/>
<result type="redirectExportQuery"/>
</action>
@@ -89,7 +94,7 @@
<action name="save" method="saveQuery"
class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery">
<interceptor-ref name="paramsPrepareParamsStackLoggued"/>
- <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result>
+ <result name="input" type="showList"/>
<result type="redirectExportQuery"/>
</action>
@@ -97,14 +102,14 @@
<action name="confirmDelete" method="confirmDeleteQuery"
class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery">
<interceptor-ref name="paramsPrepareParamsStackLoggued"/>
- <result>/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp</result>
+ <result>/WEB-INF/jsp/exportQuery/confirmDelete.jsp</result>
</action>
<!-- Delete the export query -->
<action name="delete" method="deleteQuery"
class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery">
<interceptor-ref name="paramsPrepareParamsStackLoggued"/>
- <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result>
+ <result name="input" type="showList"/>
<result type="redirectExportQuery"/>
</action>
Modified: trunk/echobase-ui/src/main/resources/config/struts-importData.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-importData.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/config/struts-importData.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -74,7 +74,7 @@
<result type="json"/>
</action>
- <!-- Create a new mission -->
+ <!-- CreateOrUpdate a new mission -->
<action name="createMission"
class="fr.ifremer.echobase.ui.actions.importData.CreateMission">
<interceptor-ref name="prepareParamsStackLoggued"/>
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -34,21 +34,16 @@
<default-interceptor-ref name="basicStackLoggued"/>
<!-- Login -->
- <action name="login" class="fr.ifremer.echobase.ui.actions.user.LoginAction"
- method="doLogin">
+ <action name="login" class="fr.ifremer.echobase.ui.actions.user.Login"
+ method="execute">
<result name="input">/WEB-INF/jsp/user/login.jsp</result>
<result name="redirect" type="redirect">${redirectAction}</result>
<interceptor-ref name="paramsPrepareParamsStack"/>
</action>
<!-- Logout -->
- <action name="logout"
- class="fr.ifremer.echobase.ui.actions.user.LoginAction"
- method="doLogout">
- <result type="redirectAction">
- <param name="namespace">/</param>
- <param name="actionName">home</param>
- </result>
+ <action name="logout" class="fr.ifremer.echobase.ui.actions.user.Logout">
+ <result type="redirectToHome"/>
<interceptor-ref name="checkUserLoggued"/>
<interceptor-ref name="basicStack"/>
</action>
@@ -76,12 +71,6 @@
<result>/WEB-INF/jsp/modificationLogs.jsp</result>
</action>
- <!-- Get db connexion informations -->
- <action name="connectToDbInformations"
- class="fr.ifremer.echobase.ui.actions.user.ConnectToDbInformations">
- <result>/WEB-INF/jsp/connectToDbInformations.jsp</result>
- </action>
-
<!-- Get list of users in database -->
<action name="getUsers"
class="fr.ifremer.echobase.ui.actions.user.GetUsers">
Added: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml (rev 0)
+++ trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,113 @@
+<!--
+ #%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+ "http://struts.apache.org/dtds/struts-2.3.dtd">
+
+<struts>
+
+ <package name="workingDb" extends="loggued" namespace="/workingDb">
+
+ <result-types>
+
+ <result-type name="redirectWorkingDbConfiguration"
+ class="org.apache.struts2.dispatcher.ServletActionRedirectResult">
+ <param name="actionName">showList</param>
+ <param name="namespace">workingDbConfiguration</param>
+ <param name="conf.topiaId">${conf.topiaId}</param>
+ </result-type>
+
+ <result-type name="showList"
+ class="org.apache.struts2.dispatcher.ServletDispatcherResult">
+ <param name="location">/WEB-INF/jsp/workingDb/manage.jsp</param>
+ <param name="conf.topiaId">${conf.topiaId}</param>
+ </result-type>
+ </result-types>
+
+ <!-- Get db connexion informations -->
+ <action name="information"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Information">
+ <result>/WEB-INF/jsp/workingDb/information.jsp</result>
+ </action>
+
+ <!-- Display workingDbConfiguration main page -->
+ <action name="showList"
+ class="fr.ifremer.echobase.ui.actions.workingDb.ShowList">
+ <result type="showList"/>
+ </action>
+
+ <!-- Create a new workingDbConfiguration -->
+ <action name="create" method="createConf"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Create">
+ <result name="input" type="showList"/>
+ <result type="redirectWorkingDbConfiguration"/>
+ </action>
+
+ <!-- Clone the workingDbConfiguration -->
+ <action name="clone" method="cloneConf"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Create">
+ <interceptor-ref name="prepareParamsStackLoggued"/>
+ <result name="input" type="showList"/>
+ <result type="redirectWorkingDbConfiguration"/>
+ </action>
+
+ <!-- Save the workingDbConfiguration -->
+ <action name="save" method="execute"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Create">
+ <interceptor-ref name="prepareParamsStackLoggued"/>
+ <result name="input" type="showList"/>
+ <result type="redirectWorkingDbConfiguration"/>
+ </action>
+
+ <!-- Confirm to delete the workingDbConfiguration -->
+ <action name="confirmDelete" method="confirmDelete"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Delete">
+ <interceptor-ref name="prepareParamsStackLoggued"/>
+ <result>/WEB-INF/jsp/workingDb/confirmDelete.jsp</result>
+ </action>
+
+ <!-- Delete the workingDbConfiguration -->
+ <action name="delete" method="execute"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Delete">
+ <interceptor-ref name="prepareParamsStackLoggued"/>
+ <result name="input" type="showList"/>
+ <result type="redirectWorkingDbConfiguration"/>
+ </action>
+
+ <!-- Connect to selected workingDbConfiguration -->
+ <action name="connect" method="execute"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Connect">
+ <interceptor-ref name="prepareParamsStackLoggued"/>
+ <result name="input" type="showList"/>
+ <result type="redirectToHome"/>
+ </action>
+
+ <!-- Disconnect from current workingDbConfiguration -->
+ <action name="disconnect"
+ class="fr.ifremer.echobase.ui.actions.workingDb.Disconnect">
+ <result type="showList"/>
+ </action>
+
+ </package>
+
+</struts>
Property changes on: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/echobase.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -22,15 +22,5 @@
# #L%
###
-project.version=${project.version}
-project.site.url=${project.url}
-
-hibernate.hbm2ddl.auto=none
-hibernate.show_sql=false
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider
-
-hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase
-hibernate.connection.username=sa
-hibernate.connection.password=sa
\ No newline at end of file
+echobase.version=${project.version}
+echobase.site.url=${project.url}
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,14 +1,19 @@
echobase.action.backToUserList=
echobase.action.cancel=Cancel
+echobase.action.clone=
echobase.action.cloneSqlQuery=
+echobase.action.cloneWorkingDbConfiguration=
echobase.action.configureImport=
+echobase.action.connectToWorkingDb=
echobase.action.create=
echobase.action.createEmbeddedApplication=
echobase.action.createMission=
echobase.action.createNewMission=Create a new mission
echobase.action.createSqlQuery=
+echobase.action.createWorkingDbConfiguration=
echobase.action.delete=
echobase.action.deleteSqlQuery=
+echobase.action.deleteWorkingDbConfiguration=
echobase.action.downloadEmbeddedApplicationFile=
echobase.action.downloadExportDbFile=
echobase.action.export=
@@ -21,17 +26,21 @@
echobase.action.logout=
echobase.action.newLibreOfficeQuery=New Libre office request
echobase.action.newQuery=New request
+echobase.action.newWorkingDbContiguration=
echobase.action.reloadSqlQuery=
echobase.action.reset=
echobase.action.return=
echobase.action.save=
echobase.action.saveSqlQuery=Update query
+echobase.action.saveWorkingDbConfiguration=
echobase.action.show.embedded.documentation=Show embedded application documentation
echobase.action.show.import.documentation=Show import documentation
echobase.action.toEnglish=Use english version
echobase.action.toFrench=Use the french version
echobase.action.usingEnglish=English version used
echobase.action.usingFrench=French version used
+echobase.action.workingDbconfiguration.connect=
+echobase.action.workingDbconfiguration.disconnect=
echobase.common.acousticDensityUnit=
echobase.common.acquisitionSoftwareVersionER60=
echobase.common.acquisitionSoftwareVersionME70=
@@ -129,6 +138,7 @@
echobase.common.voyageDescription=
echobase.common.voyageFile=
echobase.confirm.delete.query=Confirm to delete export query
+echobase.confirm.delete.workingDbConfiguration=
echobase.error.bad.password=Bad password
echobase.error.email.already.used=Email already used
echobase.error.invalid.sql=Invalid request \: %s
@@ -141,26 +151,47 @@
echobase.error.query.name.already.exists=Query name already used
echobase.error.required.email=Email is required
echobase.error.required.password=Password is required
+echobase.error.url.already.exists=
echobase.error.warlocation.notFound=War not found at location %s
+echobase.error.workingDbConfiguration.couldNotConnect=
+echobase.error.workingDbConfiguration.description.required=
+echobase.error.workingDbConfiguration.login.required=
+echobase.error.workingDbConfiguration.password.required=
+echobase.error.workingDbConfiguration.url.already.exists=
+echobase.error.workingDbConfiguration.url.required=
echobase.header.request.result=
echobase.info.dbeditor.propertyDiffsResult=
+echobase.info.downloadEchoBase=Téléchargement de l'application et des fichiers d'import
+echobase.info.echoBaseForge=Gestion du projet
echobase.info.import.failed=L'import a échoué.
echobase.info.import.succeded=
+echobase.info.lastDevDocumentation=Documentation en cours (disponible dans la prochaine version stable)
+echobase.info.lastStableDocumentation=Documentation de la dernière version stable
echobase.info.new.sqlQuery.inprogress=New query creation in progress
+echobase.info.new.workingDbConfiguration.inprogress=
echobase.info.no.sqlQuery.saved=
echobase.info.no.sqlQuery.selected=
echobase.info.no.table.selected=
echobase.info.no.voyagee.found=
+echobase.info.no.workingDbConfiguration.saved=
+echobase.info.no.workingDbConfiguration.selected=
echobase.info.sqlQuery.not.modifiable=Current user can not udate the selected query
+echobase.info.usefulLinks=Quelques liens utiles
echobase.info.user.create=
echobase.info.user.delete=
echobase.info.user.update=
+echobase.info.workingDbConfiguration.not.modifiable=
+echobase.info.workingDbconfiguration.connected=
+echobase.info.workingDbconfiguration.created=
+echobase.info.workingDbconfiguration.deleted=
+echobase.info.workingDbconfiguration.disconnected=
echobase.information.mission.created=
echobase.information.one.file.required=
echobase.label.admin.user.create=
echobase.label.admin.user.delete=
echobase.label.admin.user.edit=
echobase.label.createIfNotFound=
+echobase.label.driverType=
echobase.label.embeddedApplicationFileName=
echobase.label.embeddedWarFileName=
echobase.label.exportAsSeen=Export as seen on screen
@@ -168,6 +199,7 @@
echobase.label.exportFileName=
echobase.label.importFile=
echobase.label.login=
+echobase.label.noWorkingDbSelected=
echobase.label.numberOfCreatedEntities=
echobase.label.numberOfUpdatedEntities=
echobase.label.query.description=
@@ -176,6 +208,12 @@
echobase.label.sqlQueries=
echobase.label.user.login=
echobase.label.voyageToSelect=
+echobase.label.workingDbConfiguration.description=
+echobase.label.workingDbConfiguration.login=
+echobase.label.workingDbConfiguration.password=
+echobase.label.workingDbConfiguration.url=
+echobase.label.workingDbConfigurations=
+echobase.label.workingDbSelected=
echobase.legend.connectionToDb.detail=
echobase.legend.dbeditor.edit=
echobase.legend.dbeditor.show=Detail of '%s'
@@ -188,6 +226,9 @@
echobase.legend.libreOfficeQuery=Requète "libre office"
echobase.legend.sqlQuery.configuration=
echobase.legend.sqlQuery.result=
+echobase.legend.workingDbConfiguration.configuration=
+echobase.legend.workingDbConfiguration.create=
+echobase.legend.workingDbConfiguration.use=
echobase.menu.connectToDbInformations=
echobase.menu.createEmbeddedApplication=
echobase.menu.editData=Modify datas
@@ -205,6 +246,7 @@
echobase.message.warnExportInProgress=
echobase.message.warnImportInProgress=
echobase.title.confirm.deleteQuery=Delete a export query
+echobase.title.confirm.deleteWorkingDbConfiguration=
echobase.title.connectToDbInformations=
echobase.title.createEmbeddedApplication=
echobase.title.createMission=
@@ -228,3 +270,7 @@
echobase.title.newLibreOfficeQuery=Import a new "Libre-Office" request
echobase.title.users=
echobase.title.welcome=
+echobase.title.workingDbConfiguration=
+echobase.tooltip.disconnectWorkingDb=
+echobase.tooltip.logout=
+echobase.tooltip.selectWorkingDb=
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,14 +1,19 @@
echobase.action.backToUserList=Retour à la liste des utilisateurs
echobase.action.cancel=Annuler
+echobase.action.clone=Cloner
echobase.action.cloneSqlQuery=Cloner
+echobase.action.cloneWorkingDbConfiguration=Cloner
echobase.action.configureImport=Configurer l'import
+echobase.action.connectToWorkingDb=Se connecter
echobase.action.create=Créer
echobase.action.createEmbeddedApplication=Créer l'application
echobase.action.createMission=Créer la mission
echobase.action.createNewMission=Créer une nouvelle mission
echobase.action.createSqlQuery=Enregistrer
-echobase.action.delete=Suppression
+echobase.action.createWorkingDbConfiguration=Enregistrer
+echobase.action.delete=Supprimer
echobase.action.deleteSqlQuery=Supprimer
+echobase.action.deleteWorkingDbConfiguration=Supprimer
echobase.action.downloadEmbeddedApplicationFile=Télécharger l'application embarquée
echobase.action.downloadExportDbFile=Télécharger le fichier d'export de la base complête
echobase.action.export=Exporter
@@ -21,17 +26,21 @@
echobase.action.logout=Déconnexion
echobase.action.newLibreOfficeQuery=Nouvelle requète Libre office
echobase.action.newQuery=Nouvelle requète
+echobase.action.newWorkingDbContiguration=Nouvelle configuration de base de travail
echobase.action.reloadSqlQuery=Recharger
echobase.action.reset=Annuler
echobase.action.return=Retour
echobase.action.save=Sauvegarder
echobase.action.saveSqlQuery=Mettre à jour
+echobase.action.saveWorkingDbConfiguration=Mettre à jour
echobase.action.show.embedded.documentation=Accéder à la documentation d'utilisation d'une application emabrquée
echobase.action.show.import.documentation=Accéder à la documentation de l'import
echobase.action.toEnglish=Utiliser la version anglaise
echobase.action.toFrench=Utiliser la version française
echobase.action.usingEnglish=Version anglaise utilisé
echobase.action.usingFrench=Version française utilisé
+echobase.action.workingDbconfiguration.connect=Sélectionner une base de travail
+echobase.action.workingDbconfiguration.disconnect=Se déconnecter
echobase.common.acousticDensityUnit=acousticDensityUnit
echobase.common.acquisitionSoftwareVersionER60=acquisitionSoftwareVersion (ER60 instrument)
echobase.common.acquisitionSoftwareVersionME70=acquisitionSoftwareVersion (ME70 instrument)
@@ -129,6 +138,7 @@
echobase.common.voyageDescription=Description
echobase.common.voyageFile=
echobase.confirm.delete.query=Confirmer la suppression de la requète suivante
+echobase.confirm.delete.workingDbConfiguration=Confirmer la suppression de la configuration suivante
echobase.error.bad.password=Mot de passe incorrrect
echobase.error.email.already.used=Nom d'utilisateur déjà pris
echobase.error.invalid.sql=Requète non valide \: %s
@@ -141,26 +151,47 @@
echobase.error.query.name.already.exists=Nom de requète déjà utilisé
echobase.error.required.email=L'email est obligatoire
echobase.error.required.password=Le mot de passe est obligatoire
+echobase.error.url.already.exists=Il existe déjà une configuration avec cette url
echobase.error.warlocation.notFound=L'application n'a pas été trouvé à l'emplacement suivant %s
+echobase.error.workingDbConfiguration.couldNotConnect=Impossible de se connecter (%s)
+echobase.error.workingDbConfiguration.description.required=Description obligatoire
+echobase.error.workingDbConfiguration.login.required=Login obligatoire
+echobase.error.workingDbConfiguration.password.required=Mot de passe obligatoire
+echobase.error.workingDbConfiguration.url.already.exists=Une connexion existe déjà avec cette url
+echobase.error.workingDbConfiguration.url.required=Url obligatoire
echobase.header.request.result=Résultat de la requète sql
echobase.info.dbeditor.propertyDiffsResult=Résultat d'import de données
+echobase.info.downloadEchoBase=Téléchargement de l'application et des fichiers d'import
+echobase.info.echoBaseForge=Gestion du projet
echobase.info.import.failed=L'import a échoué.
echobase.info.import.succeded=L'import a réussi.
+echobase.info.lastDevDocumentation=Documentation en cours (disponible dans la prochaine version stable)
+echobase.info.lastStableDocumentation=Documentation de la dernière version stable
echobase.info.new.sqlQuery.inprogress=Nouvelle requète en cours de création
+echobase.info.new.workingDbConfiguration.inprogress=Nouvelle configuration de base de travail en cours de création
echobase.info.no.sqlQuery.saved=Aucune requète d'export sql enregistrée
echobase.info.no.sqlQuery.selected=Aucune requète d'export sql sélectionnée
echobase.info.no.table.selected=Aucune table sélectionnée
echobase.info.no.voyagee.found=Aucune campagne à exporter
+echobase.info.no.workingDbConfiguration.saved=Aucune configuration de base de travail enregistrée
+echobase.info.no.workingDbConfiguration.selected=Sélectionner une configuration pour ensuite vous y connecter
echobase.info.sqlQuery.not.modifiable=Vous ne pouvez pas modifier la requète sélectionnée
+echobase.info.usefulLinks=Quelques liens utiles
echobase.info.user.create=L'utilisateur '%s' a été créée
echobase.info.user.delete=L'utilisateur '%s' a été supprimé
echobase.info.user.update=L'utilisateur '%s' a été mis à jour
+echobase.info.workingDbConfiguration.not.modifiable=Configuration de base de travail non modifiable
+echobase.info.workingDbconfiguration.connected=Connexion à la base de travail '%s' réussie
+echobase.info.workingDbconfiguration.created=Configuration à la base de travail '%s' créée
+echobase.info.workingDbconfiguration.deleted=Configuration à la base de travail '%s' supprimée
+echobase.info.workingDbconfiguration.disconnected=Déconnexion de la base de travail '%s'
echobase.information.mission.created=La mission %s a été créée
echobase.information.one.file.required=Veuillez renseigner l'un des fichiers à importer
echobase.label.admin.user.create=Création d'un utilisateur
echobase.label.admin.user.delete=Suppression d'un utilisateur
echobase.label.admin.user.edit=Mise à jour d'un utilisateur
echobase.label.createIfNotFound=Créer les entités non trouvées en base
+echobase.label.driverType=Type de base
echobase.label.embeddedApplicationFileName=Nom de l'archive à télécharger
echobase.label.embeddedWarFileName=Nom du war à utiliser
echobase.label.exportAsSeen=Exporter "comme à l'écran"
@@ -168,6 +199,7 @@
echobase.label.exportFileName=Nom du fichier d'export
echobase.label.importFile=Fichier à importer
echobase.label.login=Connexion
+echobase.label.noWorkingDbSelected=Aucune base de travail sélectionnée
echobase.label.numberOfCreatedEntities=Nombre d'entitiés créées
echobase.label.numberOfUpdatedEntities=Nombre d'entitiés mises à jour
echobase.label.query.description=Description
@@ -176,6 +208,12 @@
echobase.label.sqlQueries=Requêtes enregistrées
echobase.label.user.login=Utilisateur \: %s
echobase.label.voyageToSelect=Voyage à exporter
+echobase.label.workingDbConfiguration.description=Description
+echobase.label.workingDbConfiguration.login=Login
+echobase.label.workingDbConfiguration.password=Mot de passe
+echobase.label.workingDbConfiguration.url=Url de connexion
+echobase.label.workingDbConfigurations=Bases de travail enregistrées
+echobase.label.workingDbSelected=Base de travail sélectionnée <strong>%s</strong>
echobase.legend.connectionToDb.detail=Détail de la connection à la base de données
echobase.legend.dbeditor.edit=Edition de '%s'
echobase.legend.dbeditor.show=Visualisation de '%s'
@@ -188,7 +226,10 @@
echobase.legend.libreOfficeQuery=Requète "libre office"
echobase.legend.sqlQuery.configuration=Configuration de la requète
echobase.legend.sqlQuery.result=Résultats de la requète
-echobase.menu.connectToDbInformations=Informations de connection à la base de données
+echobase.legend.workingDbConfiguration.configuration=Configuration de la base de travail
+echobase.legend.workingDbConfiguration.create=Création d'une configuration de base de travail
+echobase.legend.workingDbConfiguration.use=Configuration de base de travail
+echobase.menu.connectToDbInformations=Informations de connection à la base de travail
echobase.menu.createEmbeddedApplication=Créer une application embarquée
echobase.menu.editData=Modifier les données
echobase.menu.export=Exporter des données
@@ -205,6 +246,7 @@
echobase.message.warnExportInProgress=Merci de ne pas fermer la fenêtre pour pouvoir accéder aux résultats de l'export.
echobase.message.warnImportInProgress=Merci de ne pas fermer la fenêtre pour pouvoir accéder aux résultats de l'import.
echobase.title.confirm.deleteQuery=Supprimer une requète
+echobase.title.confirm.deleteWorkingDbConfiguration=Supprimer la connexion
echobase.title.connectToDbInformations=Informations de connection à la base de données
echobase.title.createEmbeddedApplication=Création de l'application embarquée
echobase.title.createMission=Créer une mission
@@ -228,3 +270,7 @@
echobase.title.newLibreOfficeQuery=Importer une requète Libre-office
echobase.title.users=Adminitration des utilisateurs
echobase.title.welcome=Bienvenue dans EchoBase
+echobase.title.workingDbConfiguration=Administration des bases de travail
+echobase.tooltip.disconnectWorkingDb=Changer de base de travail
+echobase.tooltip.logout=Se déconnecter
+echobase.tooltip.selectWorkingDb=Sélectionner une base de travail
Modified: trunk/echobase-ui/src/main/resources/struts.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/struts.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/resources/struts.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -51,16 +51,20 @@
<package name="default" extends="json-default" abstract="true"
namespace="/">
+ <result-types>
+ <result-type name="redirectToHome"
+ class="org.apache.struts2.dispatcher.ServletActionRedirectResult">
+ <param name="actionName">home</param>
+ <param name="namespace">/</param>
+ </result-type>
+ </result-types>
+
<interceptors>
<!-- to remove parameter from context -->
<interceptor name="paramRemover"
class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/>
- <!-- to clean some properties from the echobase session -->
- <interceptor name="cleanEchoBaseSession"
- class="fr.ifremer.echobase.ui.interceptors.CleanEchoBaseSessionInterceptor"/>
-
<!-- to check if user is loggued -->
<interceptor name="checkUserLoggued"
class="fr.ifremer.echobase.ui.interceptors.CheckLogguedInterceptor">
@@ -73,9 +77,6 @@
<param name="redirectAction">/home</param>
</interceptor>
- <interceptor name="checkEchobaseSession"
- class="fr.ifremer.echobase.ui.interceptors.CheckInUserSessionInterceptor"/>
-
</interceptors>
<!-- default action to use everywhere (fix i18n when not translated) -->
@@ -125,8 +126,7 @@
<default-action-ref name="home"/>
<!-- go to home -->
- <action name="home"
- class="fr.ifremer.echobase.ui.actions.EchoBaseActionSupport">
+ <action name="home" class="fr.ifremer.echobase.ui.actions.Home">
<result>/WEB-INF/jsp/home.jsp</result>
@@ -135,13 +135,9 @@
</action>
<!-- go to home -->
- <action name="changeLang"
- class="fr.ifremer.echobase.ui.actions.EchoBaseActionSupport">
+ <action name="changeLang" class="fr.ifremer.echobase.ui.actions.Home">
- <result type="redirectAction">
- <param name="namespace">/</param>
- <param name="actionName">home</param>
- </result>
+ <result type="redirectToHome"/>
<interceptor-ref name="i18nStack"/>
<!-- remove the request_locale parameter from request -->
@@ -155,6 +151,7 @@
<include file="config/struts-dbeditor.xml"/>
<include file="config/struts-user.xml"/>
+ <include file="config/struts-workingDb.xml"/>
<include file="config/struts-importData.xml"/>
<include file="config/struts-embeddedApplication.xml"/>
<include file="config/struts-exportQuery.xml"/>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -49,28 +49,60 @@
<%-- body --%>
<div>
-<div class="containerSize">
-<div id="body" class="ui-corner-all">
+ <div class="containerSize">
+ <div id="body" class="ui-corner-all">
- <h2><d:title default="EchoBase"/></h2>
+ <h2><d:title default="EchoBase"/></h2>
- <s:if test="hasActionMessages()">
- <div class="info_success">
- <s:actionmessage/>
- </div>
- </s:if>
+ <s:if test="hasFlashMessages()">
+ <div class="info_success clearfix">
+ <ul class="actionMessages fleft">
+ <s:iterator value="flashMessages" var="message">
+ <li><span><s:property value="#message" escapeHtml="false"/></span>
+ </li>
+ </s:iterator>
+ </ul>
+ </div>
+ </s:if>
- <s:if test="hasActionErrors()">
- <div class="info_error">
- <s:actionerror/>
+ <s:if test="hasFlashWarnings()">
+ <div class="info_warning clearfix">
+ <ul class="actionWarnings fleft">
+ <s:iterator value="flashWarnings" var="message">
+ <li><span><s:property value="#message" escapeHtml="false"/></span>
+ </li>
+ </s:iterator>
+ </ul>
+ </div>
+ </s:if>
+ <s:if test="hasFlashErrors()">
+ <div class="info_error clearfix">
+ <ul class="actionErrors fleft">
+ <s:iterator value="flashErrors" var="message">
+ <li><span><s:property value="#message" escapeHtml="false"/></span>
+ </li>
+ </s:iterator>
+ </ul>
+ </div>
+ </s:if>
+
+ <%--<s:if test="hasActionMessages()">--%>
+ <%--<div class="info_success">--%>
+ <%--<s:actionmessage/>--%>
+ <%--</div>--%>
+ <%--</s:if>--%>
+
+ <%--<s:if test="hasActionErrors()">--%>
+ <%--<div class="info_error">--%>
+ <%--<s:actionerror/>--%>
+ <%--</div>--%>
+ <%--</s:if>--%>
+
+ <d:body/>
</div>
- </s:if>
- <d:body/>
+ <%@ include file="/WEB-INF/includes/footer.jsp" %>
+ </div>
</div>
-
-<%@ include file="/WEB-INF/includes/footer.jsp" %>
-</div>
-</div>
</body>
</html>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2012-09-02 15:11:02 UTC (rev 589)
@@ -35,6 +35,7 @@
<pattern>/exportQuery/newLibreOfficeQuery*</pattern>
<pattern>/exportQuery/confirmDelete*</pattern>
<pattern>/importData/get*</pattern>
+ <pattern>/workingDb/confirmDelete*</pattern>
</excludes>
<decorator name="layout-default" page="layout-default.jsp">
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -34,51 +34,100 @@
<div id='headerRight'>
<div>
- <s:text name="echobase.label.user.login">
- <s:param>
- <s:property value="#session.echoBaseSession.echoBaseUser.email"/>
- </s:param>
- </s:text>
<ul>
<li>
- <s:a action="logout" namespace="/user">
+ <s:a action="logout" namespace="/user" id='logout'
+ alt='%{getText("echobase.tooltip.logout")}'
+ title='%{getText("echobase.tooltip.logout")}'>
<s:text name="echobase.action.logout"/>
</s:a>
</li>
<li>
+ <s:text name="echobase.label.user.login">
+ <s:param>
+ <s:property value="#session.echoBaseSession.user.email"/>
+ </s:param>
+ </s:text>
</li>
+ <li>|</li>
+ <s:if test="workingDbSelected">
+ <li>
+ <s:a action="disconnect" namespace="/workingDb" id='disconnect'
+ title='%{getText("echobase.tooltip.disconnectWorkingDb")}'
+ alt='%{getText("echobase.tooltip.disconnectWorkingDb")}'>
+ <s:text name="echobase.action.workingDbconfiguration.disconnect"/>
+ </s:a>
+ </li>
+ <li>
+ <s:text name="echobase.label.workingDbSelected">
+ <s:param>
+ <s:property
+ value="#session.echoBaseSession.workingDbConfiguration.url"/>
+ </s:param>
+ </s:text>
+ </li>
+ </s:if>
+ <s:else>
+ <li>
+ <s:a action="showList" namespace="/workingDb" id='connect'
+ title='%{getText("echobase.tooltip.selectWorkingDb")}'
+ alt='%{getText("echobase.tooltip.selectWorkingDb")}'>
+ <s:text name="echobase.action.workingDbconfiguration.connect"/>
+ </s:a>
+ </li>
+ <li>
+ <s:text name="echobase.label.noWorkingDbSelected"/>
+ </li>
+ </s:else>
</ul>
</div>
<br/>
-
<br/>
</div>
<div class="cleanBoth menu">
<ul>
<s:if test="%{admin}">
- <li>
- <s:a action="configure" namespace="/importDb" method="input" cssClass="impBase">
+ <s:if test="%{workingDbSelected}">
+ <li>
+ <s:a action="configure" namespace="/importDb" method="input"
+ cssClass="impBase">
<span><s:text name="echobase.menu.importDb"/></s:a></span>
- </li>
- <li>
- <s:a action="configure" namespace="/exportDb" method="input" cssClass="expBase">
+ </li>
+ <li>
+ <s:a action="configure" namespace="/exportDb" method="input"
+ cssClass="expBase">
<span><s:text name="echobase.menu.exportDb"/></s:a></span>
- </li>
+ </li>
+ <li>
+ <s:a action="selectImportType" namespace="/importData"
+ method="input" cssClass="impDonnee">
+ <span><s:text name="echobase.menu.importData"/></s:a></span>
+ </li>
+ <li>
+ <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif">
+ <span><s:text name="echobase.menu.editData"/></span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="logs" namespace="/user" cssClass="journal">
+ <span><s:text name="echobase.menu.logs"/></span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="information" namespace="/workingDb" cssClass="info">
+ <span>
+ <s:text name="echobase.menu.connectToDbInformations"/>
+ </span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="manageExportQuery" namespace="/exportQuery"
+ cssClass="expDonnee">
+ <span><s:text name="echobase.menu.export"/></span>
+ </s:a>
+ </li>
+ </s:if>
<li>
- <s:a action="selectImportType" namespace="/importData" method="input" cssClass="impDonnee">
- <span><s:text name="echobase.menu.importData"/></s:a></span>
- </li>
- <li>
- <s:a action="manageExportQuery" namespace="/exportQuery" cssClass="expDonnee">
- <span><s:text name="echobase.menu.export"/></span>
- </s:a>
- </li>
- <li>
- <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif">
- <span><s:text name="echobase.menu.editData"/></span>
- </s:a>
- </li>
- <li>
<s:a action="userList" namespace="/user" cssClass="user">
<span><s:text name="echobase.menu.users"/></span>
</s:a>
@@ -86,41 +135,38 @@
<li>
<s:a action="configure" namespace="/embeddedApplication"
method="input" cssClass="appli">
- <span><s:text name="echobase.menu.createEmbeddedApplication"/></span>
+ <span>
+ <s:text name="echobase.menu.createEmbeddedApplication"/>
+ </span>
</s:a>
</li>
- <li>
- <s:a action="logs" namespace="/user" cssClass="journal">
- <span><s:text name="echobase.menu.logs"/></span>
- </s:a>
- </li>
- <li>
- <s:a action="connectToDbInformations" namespace="/user" cssClass="info">
- <span><s:text name="echobase.menu.connectToDbInformations"/></span>
- </s:a>
- </li>
</s:if>
<s:else>
- <li>
- <s:a action="manageExportQuery" namespace="/exportQuery" cssClass="expDonnee">
- <span><s:text name="echobase.menu.export"/></span>
- </s:a>
- </li>
- <li>
- <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif">
- <span><s:text name="echobase.menu.viewData"/></span>
- </s:a>
- </li>
- <li>
- <s:a action="logs" namespace="/user" cssClass="journal">
- <span><s:text name="echobase.menu.logs"/></span>
- </s:a>
- </li>
- <li>
- <s:a action="connectToDbInformations" namespace="/user" cssClass="info">
- <span><s:text name="echobase.menu.connectToDbInformations"/></span>
- </s:a>
- </li>
+ <s:if test="%{workingDbSelected}">
+ <li>
+ <s:a action="manageExportQuery" namespace="/exportQuery"
+ cssClass="expDonnee">
+ <span><s:text name="echobase.menu.export"/></span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif">
+ <span><s:text name="echobase.menu.viewData"/></span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="logs" namespace="/user" cssClass="journal">
+ <span><s:text name="echobase.menu.logs"/></span>
+ </s:a>
+ </li>
+ <li>
+ <s:a action="information" namespace="/workingDb" cssClass="info">
+ <span>
+ <s:text name="echobase.menu.connectToDbInformations"/>
+ </span>
+ </s:a>
+ </li>
+ </s:if>
</s:else>
</ul>
</div>
Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,52 +0,0 @@
-<%--
-#%L
- EchoBase :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 Ifremer, Codelutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
---%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
-<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-
-<title><s:text name="echobase.title.connectToDbInformations"/></title>
-
-<br/>
-<fieldset>
- <legend><s:text name="echobase.legend.connectionToDb.detail"/></legend>
- <s:label key="jdbcUrl" label='%{getText("echobase.common.jdbcUrl")}'/>
- <s:label key="jdbcLogin" label='%{getText("echobase.common.jdbcLogin")}'/>
- <s:label key="jdbcPassword" label='%{getText("echobase.common.jdbcPassword")} (*)'/>
- <s:label key="jdbcDriver" label='%{getText("echobase.common.jdbcDriver")}'/>
- <s:if test="jdbcPilot != null">
- <s:label key="jdbcPilot" label='%{getText("echobase.common.jdbcPilotPath")}'/>
- </s:if>
-</fieldset>
-
-<br/>
-<s:if test="askPassword">
- <div>
- (*) <s:text name="echobase.message.askAdministratorPassword"/>.
- </div>
-</s:if>
-
-</div>
-
-
-
Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp (from rev 588, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp)
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,75 @@
+<%--
+ #%L
+ EchoBase :: UI
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+
+<script type="text/javascript">
+
+ function cancel() {
+ $('#confirmDeleteDialog').dialog('close');
+ return false;
+ }
+</script>
+
+<div class="dialogContainer ui-corner-all">
+
+ <s:label key="echobase.confirm.delete.query" theme="simple"/>
+
+ <fieldset class="ui-corner-all">
+
+
+
+ <s:textarea name="query.name" required="true" cols="160" rows="1"
+ readonly="true"
+ label="%{getText('echobase.label.query.name')}"/>
+
+ <s:textarea name="query.description" required="true" cols="160" rows="2"
+ readonly="true"
+ label="%{getText('echobase.label.query.description')}"/>
+
+ <s:textarea name="query.sqlQuery" required="true" cols="160" rows="4"
+ label="%{getText('echobase.label.query.sql')}"/>
+
+ <br/>
+
+ <s:form namespace="/exportQuery">
+
+ <s:hidden key="query.topiaId" label=''/>
+
+ <ul class="toolbar floatRight">
+ <li>
+ <s:submit onclick="return cancel();" theme="simple"
+ key="echobase.action.cancel"/>
+ </li>
+ <li>
+ <s:submit action="delete" theme="simple"
+ key="echobase.action.delete"/>
+ </li>
+ </ul>
+ </s:form>
+ </fieldset>
+
+</div>
\ No newline at end of file
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,75 +0,0 @@
-<%--
- #%L
- EchoBase :: UI
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 - 2012 Ifremer, Codelutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- --%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
-
-
-<script type="text/javascript">
-
- function cancel() {
- $('#confirDeleteDialog').dialog('close');
- return false;
- }
-</script>
-
-<div class="dialogContainer ui-corner-all">
-
- <s:label key="echobase.confirm.delete.query" theme="simple"/>
-
- <fieldset class="ui-corner-all">
-
-
-
- <s:textarea name="query.name" required="true" cols="160" rows="1"
- readonly="true"
- label="%{getText('echobase.label.query.name')}"/>
-
- <s:textarea name="query.description" required="true" cols="160" rows="2"
- readonly="true"
- label="%{getText('echobase.label.query.description')}"/>
-
- <s:textarea name="query.sqlQuery" required="true" cols="160" rows="4"
- label="%{getText('echobase.label.query.sql')}"/>
-
- <br/>
-
- <s:form namespace="/exportQuery">
-
- <s:hidden key="query.topiaId" label=''/>
-
- <ul class="toolbar floatRight">
- <li>
- <s:submit onclick="return cancel();" theme="simple"
- key="echobase.action.cancel"/>
- </li>
- <li>
- <s:submit action="delete" theme="simple"
- key="echobase.action.deleteSqlQuery"/>
- </li>
- </ul>
- </s:form>
- </fieldset>
-
-</div>
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -27,10 +27,6 @@
<s:set var="noError" value="!hasErrors()"/>
-<%--s:set var="queryExists" value="query.topiaId != null && query.topiaId != ''"/--%>
-<%--s:set var="canUpdateQuery"
- value="%{admin or query.lastModifiedUser == echoBaseSession.echoBaseUser.email}"/--%>
-
<script type="text/javascript">
function reloadPage(params) {
@@ -83,7 +79,7 @@
function confirmDeleteQuery() {
var url = "<s:url action='confirmDelete' namespace='/exportQuery'/>?" +
$.param({ 'query.topiaId':'<s:property value="query.topiaId"/>'});
- var dialog = $("#confirDeleteDialog");
+ var dialog = $("#confirmDeleteDialog");
dialog.load(url);
dialog.dialog('open');
return false;
@@ -144,12 +140,12 @@
</li>
<li>
<s:submit action="clone" theme="simple"
- key="echobase.action.cloneSqlQuery"/>
+ key="echobase.action.clone"/>
</li>
<s:if test="canUpdateQuery">
<li>
<s:submit onclick="return confirmDeleteQuery();" theme="simple"
- key="echobase.action.deleteSqlQuery"/>
+ key="echobase.action.delete"/>
</li>
<li>
<s:submit action="save" theme="simple"
@@ -176,7 +172,7 @@
title="%{getText('echobase.title.newLibreOfficeQuery')}"
autoOpen="false" modal="true" width="780"/>
-<sj:dialog id="confirDeleteDialog" resizable="false"
+<sj:dialog id="confirmDeleteDialog" resizable="false"
title="%{getText('echobase.title.confirm.deleteQuery')}"
autoOpen="false" modal="true" width="780"/>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -67,7 +67,6 @@
<title><s:text name="echobase.title.export"/></title>
<div class="dialogContainer ui-corner-all">
- <%--s:form--%>
<fieldset class="ui-corner-all">
<legend><s:text name="echobase.legend.libreOfficeQuery"/></legend>
@@ -86,5 +85,4 @@
</li>
</ul>
</fieldset>
- <%--/s:form--%>
</div>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -28,30 +28,33 @@
<div class="fontsize11">
<fieldset>
<legend>
- Quelques liens utiles
+ <s:text name="echobase.info.usefulLinks"/>
</legend>
<ul>
<li>
- <s:a href="http://maven-site.forge.codelutin.com/echobase">
- Documentation de la dernière version stable
+ <s:a href="http://maven-site.forge.codelutin.com/echobase"
+ target='#stableDoc'>
+ <s:text name="echobase.info.lastStableDocumentation"/>
</s:a>
</li>
<li>
- <s:a href="http://maven-site.forge.codelutin.com/echobase/SNAPSHOT">
- Documentation en cours (disponible dans la prochaine version stable)
+ <s:a href="http://maven-site.forge.codelutin.com/echobase/SNAPSHOT"
+ target='#devDoc'>
+ <s:text name="echobase.info.lastDevDocumentation"/>
</s:a>
</li>
<li>
- <s:a href="http://forge.codelutin.com/projects/echobase/files">
- Téléchargement de l'application et des fichiers d'import
+ <s:a href="http://forge.codelutin.com/projects/echobase/files"
+ target='#forge'>
+ <s:text name="echobase.info.downloadEchoBase"/>
</s:a>
</li>
<li>
- <s:a href="http://forge.codelutin.com/projects/echobase">
- Gestion du projet
+ <s:a href="http://forge.codelutin.com/projects/echobase"
+ target='#forge'>
+ <s:text name="echobase.info.echoBaseForge"/>
</s:a>
</li>
</ul>
</fieldset>
-
</div>
\ No newline at end of file
Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -1,93 +0,0 @@
-<%--
-#%L
- EchoBase :: UI
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2011 Ifremer, Codelutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
---%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
-<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-<script type="text/javascript"
- src="<s:url value='/js/gridHelper.js' />"></script>
-<s:set var="emptySelection">
- <s:text name="echobase.message.noEntrySelection"/>
-</s:set>
-<script type="text/javascript">
-
- jQuery(document).ready(function () {
- $.addRowSelectTopic('datas', function (event) {
- $('#extraInfos').show();
- var id = $("tr[aria-selected=true] td[aria-describedby='datas_entityId']").text();
- $('#modificationEntityId').html(id);
-
- var text = $("tr[aria-selected=true] td[aria-describedby='datas_modificationText']").text();
- $('#modificationTextContainter').html(text);
- });
- $.addClearSelectTopic('datas', function (event) {
- $('#extraInfos').hide();
- $('#modificationTextContainter').html("${emptySelection}");
- });
- $.addEvenAndOddClasses('datas');
- });
-</script>
-
-<title><s:text name="echobase.title.entityModificationLogs"/></title>
-<s:url id="loadUrl" action="getEntityModificationLogs" namespace="/user"
- escapeAmp="false"/>
-
-<sjg:grid id="datas" dataType="json" href="%{loadUrl}" gridModel="datas"
- pager="true" pagerButtons="true" pagerInput="true" navigator="true"
- autowidth="true" rownumbers="false" viewrecords="true"
- navigatorEdit="false" navigatorSearch="true"
- navigatorDelete="false" navigatorAdd="false"
- rowList="10,15,20,50,100,250,500" rowNum="10"
- onSelectRowTopics='datas-rowSelect'
- onCompleteTopics="datas-clearSelect,datas-CompleteTopics"
- navigatorSearchOptions="{multipleGroup:false,multipleSearch:false,sopt:['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn']}">
-
- <sjg:gridColumn name="entityType" sortable="true"
- title="%{getText('echobase.common.entityType')}"/>
- <sjg:gridColumn name="entityId" sortable="true"
- title="%{getText('echobase.common.entityId')}"/>
- <sjg:gridColumn name="modificationDate" sortable="true"
- title="%{getText('echobase.common.modificationDate')}"/>
- <sjg:gridColumn name="modificationText" sortable="true"
- title="%{getText('echobase.common.modificationText')}"/>
- <sjg:gridColumn name="modificationUser" sortable="true"
- title="%{getText('echobase.common.modificationUser')}"/>
-
-</sjg:grid>
-<br/>
-<fieldset>
- <legend><s:text name="echobase.title.modification.detail"/></legend>
- <div id="extraInfos">
- <s:label key='echobase.common.entityId' value=''/>
- <div class="clearBoth"/>
- <pre id='modificationEntityId' style="font-weight: bold;"></pre>
- <br/>
- </div>
- <s:label key='echobase.common.modificationText' value=''/>
- <div class="clearBoth"/>
- <br/>
- <pre id='modificationTextContainter' style="font-weight: bold;"></pre>
-</fieldset>
-
-
-
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -40,10 +40,14 @@
<s:checkbox key="user.admin" label="%{getText('echobase.common.admin')}"/>
</fieldset>
<ul class="toolbar floatRight">
- <li><s:submit action="user-Create" key="echobase.action.create"
- theme="simple"/></li>
- <li><s:submit action="userList" key="echobase.action.backToUserList"
- theme="simple"/></li>
+ <li>
+ <s:submit action="user-Create" key="echobase.action.create"
+ theme="simple"/>
+ </li>
+ <li>
+ <s:submit action="userList" key="echobase.action.backToUserList"
+ theme="simple"/>
+ </li>
</ul>
</s:form>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -39,10 +39,14 @@
disabled="true"/>
</fieldset>
<ul class="toolbar floatRight">
- <li><s:submit action="user-Delete"
- key="echobase.action.delete" theme="simple"/></li>
- <li><s:submit action="userList" key="echobase.action.backToUserList"
- theme="simple"/></li>
+ <li>
+ <s:submit action="user-Delete" key="echobase.action.delete"
+ theme="simple"/>
+ </li>
+ <li>
+ <s:submit action="userList" key="echobase.action.backToUserList"
+ theme="simple"/>
+ </li>
</ul>
</s:form>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -46,10 +46,14 @@
</div>
</fieldset>
<ul class="toolbar floatRight">
- <li><s:submit action="user-Update"
- key="echobase.action.save" theme="simple"/></li>
- <li><s:submit action="userList" key="echobase.action.backToUserList"
- theme="simple"/></li>
+ <li>
+ <s:submit action="user-Update"
+ key="echobase.action.save" theme="simple"/>
+ </li>
+ <li>
+ <s:submit action="userList" key="echobase.action.backToUserList"
+ theme="simple"/>
+ </li>
</ul>
</s:form>
Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,73 @@
+<%--
+ #%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<script type="text/javascript">
+
+ function cancel() {
+ $('#confirmDeleteDialog').dialog('close');
+ return false;
+ }
+</script>
+
+<div class="dialogContainer ui-corner-all">
+
+ <s:label key="echobase.confirm.delete.workingDbConfiguration" theme="simple"/>
+
+ <fieldset class="ui-corner-all">
+
+ <s:select key="conf.driverType" cssStyle="font-size: 140%"
+ disabled="true" label="%{getText('echobase.label.driverType')}"
+ list="driverTypes"/>
+
+ <s:textarea name="conf.url" cols="160" rows="1" readonly="true"
+ label="%{getText('echobase.label.workingDbConfiguration.url')}"/>
+
+ <s:textarea name="conf.description" cols="160" rows="2" readonly="true"
+ label="%{getText('echobase.label.workingDbConfiguration.description')}"/>
+
+ <s:textarea name="conf.login" readonly="true" cols="160" rows="4"
+ label="%{getText('echobase.label.workingDbConfiguration.login')}"/>
+
+ <br/>
+
+ <s:form namespace="/workingDb">
+
+ <s:hidden key="conf.topiaId" label=''/>
+
+ <ul class="toolbar floatRight">
+ <li>
+ <s:submit onclick="return cancel();" theme="simple"
+ key="echobase.action.cancel"/>
+ </li>
+ <li>
+ <s:submit action="delete" theme="simple"
+ key="echobase.action.delete"/>
+ </li>
+ </ul>
+ </s:form>
+ </fieldset>
+
+</div>
\ No newline at end of file
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,48 @@
+<%--
+#%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/weba… $
+ %%
+ Copyright (C) 2011 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+--%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+
+<title><s:text name="echobase.title.connectToDbInformations"/></title>
+
+<br/>
+<fieldset>
+ <legend><s:text name="echobase.legend.connectionToDb.detail"/></legend>
+ <s:label key="dbConfiguration.url"
+ label='%{getText("echobase.common.jdbcUrl")}'/>
+ <s:label key="dbConfiguration.login"
+ label='%{getText("echobase.common.jdbcLogin")}'/>
+ <s:label key="dbConfiguration.password"
+ label='%{getText("echobase.common.jdbcPassword")}'/>
+ <s:label key="dbConfiguration.driver.name"
+ label='%{getText("echobase.common.jdbcDriver")}'/>
+ <s:if test="jdbcPilot != null">
+ <s:label key="jdbcPilot"
+ label='%{getText("echobase.common.jdbcPilotPath")}'/>
+ </s:if>
+</fieldset>
+
+
+
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,151 @@
+<%--
+ #%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<s:set var="noError" value="!hasErrors()"/>
+
+<script type="text/javascript">
+
+ function confirmDelete() {
+ var url = "<s:url action='confirmDelete' namespace='/workingDb'/>?" +
+ $.param({ 'conf.topiaId':'<s:property value="conf.topiaId"/>'});
+ var dialog = $("#confirmDeleteDialog");
+ dialog.load(url);
+ dialog.dialog('open');
+ return false;
+ }
+
+ function reloadPage(params) {
+ var url = "<s:url action='showList' namespace='/workingDb'/>?";
+ window.location = url + $.param(params);
+ return false;
+ }
+
+</script>
+
+<title><s:text name="echobase.title.workingDbConfiguration"/></title>
+
+<s:if test="admin">
+ <s:form id="createForm" namespace="/workingDb">
+ <ul class="toolbar floatLeft">
+ <li>
+ <s:submit theme="simple" action="create"
+ key="echobase.action.newWorkingDbContiguration"/>
+ </li>
+ </ul>
+ </s:form>
+</s:if>
+
+<s:form id="workginDbConfigurationForm" namespace="/workingDb">
+ <fieldset>
+ <legend><s:text name="echobase.label.workingDbConfigurations"/></legend>
+ <s:select key="conf.topiaId" cssStyle="font-size: 140%"
+ label="%{getText('echobase.label.workingDbConfigurations')}"
+ list="confs" headerKey="" headerValue="" theme="simple"/>
+ </fieldset>
+
+ <s:if test="confExists or newConf">
+ <fieldset>
+ <legend>
+ <s:if test="confExists">
+ <s:text name="echobase.legend.workingDbConfiguration.use"/>
+ </s:if>
+ <s:else>
+ <s:text name="echobase.legend.workingDbConfiguration.create"/>
+
+ </s:else>
+ </legend>
+
+ <s:select key="conf.driverType" cssStyle="font-size: 140%"
+ label="%{getText('echobase.label.driverType')}" required="true"
+ list="driverTypes" disabled="%{confExists}"/>
+
+ <s:textfield key="conf.url" required="true" size="80"
+ readonly="%{confExists}"
+ label="%{getText('echobase.label.workingDbConfiguration.url')}"/>
+
+ <s:textfield key="conf.login" required="true" size="80"
+ readonly="%{confExists}"
+ label="%{getText('echobase.label.workingDbConfiguration.login')}"/>
+
+ <s:textarea key="conf.description" required="true" cols="160" rows="4"
+ readonly="%{confExists}"
+ label="%{getText('echobase.label.workingDbConfiguration.description')}"/>
+
+ <s:if test="confExists">
+ <s:password key="password" required="true" size="80"
+ label="%{getText('echobase.label.workingDbConfiguration.password')}"/>
+ </s:if>
+
+ <ul id="dbeditorToolbar" class="toolbar floatRight">
+ <s:if test="confExists">
+ <li>
+ <s:submit action="connect" theme="simple"
+ key="echobase.action.connectToWorkingDb"/>
+ </li>
+ <s:if test="admin">
+ <li>
+ <s:submit action="clone" theme="simple"
+ key="echobase.action.clone"/>
+ </li>
+ <li>
+ <s:submit onclick="return confirmDelete();" theme="simple"
+ key="echobase.action.delete"/>
+ </li>
+ </s:if>
+ </s:if>
+ <s:else>
+ <li>
+ <s:submit action="showList" theme="simple"
+ key="echobase.action.cancel"/>
+ </li>
+ <li>
+ <s:submit action="save" theme="simple"
+ key="echobase.action.createWorkingDbConfiguration"/>
+ </li>
+ </s:else>
+ </ul>
+ </fieldset>
+ </s:if>
+</s:form>
+
+<br/>
+
+<sj:dialog id="confirmDeleteDialog" resizable="false" autoOpen="false"
+ title="%{getText('echobase.title.confirm.deleteWorkingDbConfiguration')}"
+ modal="true" width="780"/>
+
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+
+ $('[name="conf.topiaId"]').change(function (event) {
+ reloadPage({'conf.topiaId':this.value});
+ });
+ });
+
+</script>
+
+
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp (from rev 588, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp)
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp 2012-09-02 15:11:02 UTC (rev 589)
@@ -0,0 +1,93 @@
+<%--
+#%L
+ EchoBase :: UI
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+--%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<script type="text/javascript"
+ src="<s:url value='/js/gridHelper.js' />"></script>
+<s:set var="emptySelection">
+ <s:text name="echobase.message.noEntrySelection"/>
+</s:set>
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+ $.addRowSelectTopic('datas', function (event) {
+ $('#extraInfos').show();
+ var id = $("tr[aria-selected=true] td[aria-describedby='datas_entityId']").text();
+ $('#modificationEntityId').html(id);
+
+ var text = $("tr[aria-selected=true] td[aria-describedby='datas_modificationText']").text();
+ $('#modificationTextContainter').html(text);
+ });
+ $.addClearSelectTopic('datas', function (event) {
+ $('#extraInfos').hide();
+ $('#modificationTextContainter').html("${emptySelection}");
+ });
+ $.addEvenAndOddClasses('datas');
+ });
+</script>
+
+<title><s:text name="echobase.title.entityModificationLogs"/></title>
+<s:url id="loadUrl" action="getEntityModificationLogs" namespace="/user"
+ escapeAmp="false"/>
+
+<sjg:grid id="datas" dataType="json" href="%{loadUrl}" gridModel="datas"
+ pager="true" pagerButtons="true" pagerInput="true" navigator="true"
+ autowidth="true" rownumbers="false" viewrecords="true"
+ navigatorEdit="false" navigatorSearch="true"
+ navigatorDelete="false" navigatorAdd="false"
+ rowList="10,15,20,50,100,250,500" rowNum="10"
+ onSelectRowTopics='datas-rowSelect'
+ onCompleteTopics="datas-clearSelect,datas-CompleteTopics"
+ navigatorSearchOptions="{multipleGroup:false,multipleSearch:false,sopt:['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn']}">
+
+ <sjg:gridColumn name="entityType" sortable="true"
+ title="%{getText('echobase.common.entityType')}"/>
+ <sjg:gridColumn name="entityId" sortable="true"
+ title="%{getText('echobase.common.entityId')}"/>
+ <sjg:gridColumn name="modificationDate" sortable="true"
+ title="%{getText('echobase.common.modificationDate')}"/>
+ <sjg:gridColumn name="modificationText" sortable="true"
+ title="%{getText('echobase.common.modificationText')}"/>
+ <sjg:gridColumn name="modificationUser" sortable="true"
+ title="%{getText('echobase.common.modificationUser')}"/>
+
+</sjg:grid>
+<br/>
+<fieldset>
+ <legend><s:text name="echobase.title.modification.detail"/></legend>
+ <div id="extraInfos">
+ <s:label key='echobase.common.entityId' value=''/>
+ <div class="clearBoth"/>
+ <pre id='modificationEntityId' style="font-weight: bold;"></pre>
+ <br/>
+ </div>
+ <s:label key='echobase.common.modificationText' value=''/>
+ <div class="clearBoth"/>
+ <br/>
+ <pre id='modificationTextContainter' style="font-weight: bold;"></pre>
+</fieldset>
+
+
+
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/webapp/css/screen.css
===================================================================
--- trunk/echobase-ui/src/main/webapp/css/screen.css 2012-09-01 11:35:19 UTC (rev 588)
+++ trunk/echobase-ui/src/main/webapp/css/screen.css 2012-09-02 15:11:02 UTC (rev 589)
@@ -672,7 +672,8 @@
#headerRight span{
color:#f9a806;
}
-#headerRight a{
+
+#headerRight a#logout{
display:block;
text-indent:-999999px;
background:url(../images/deconnexion.jpg) no-repeat 0 0;
@@ -683,6 +684,26 @@
background-position:0 -18px;
}
+#headerRight a{
+ display:block;
+ text-indent:-999999px;
+ height:18px;
+ width:18px;
+}
+
+#headerRight li{
+ padding-left:5px;
+}
+
+#headerRight a#connect{
+ background:url(../images/connect.png) no-repeat 0 0;
+}
+
+
+#headerRight a#disconnect{
+ background:url(../images/disconnect.png) no-repeat 0 0;
+}
+
.top a.anglais {
line-height:20px;
display: block;
Added: trunk/echobase-ui/src/main/webapp/images/connect.png
===================================================================
(Binary files differ)
Property changes on: trunk/echobase-ui/src/main/webapp/images/connect.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/echobase-ui/src/main/webapp/images/disconnect.png
===================================================================
(Binary files differ)
Property changes on: trunk/echobase-ui/src/main/webapp/images/disconnect.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
r588 - in trunk: . echobase-domain echobase-services echobase-services/src/main/java/fr/ifremer/echobase/services echobase-tools echobase-ui
by tchemit@users.forge.codelutin.com 01 Sep '12
by tchemit@users.forge.codelutin.com 01 Sep '12
01 Sep '12
Author: tchemit
Date: 2012-09-01 13:35:19 +0200 (Sat, 01 Sep 2012)
New Revision: 588
Url: http://forge.codelutin.com/repositories/revision/echobase/588
Log:
rename to domain module = remove no more used package
Added:
trunk/echobase-domain/
Removed:
trunk/echobase-entities/
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/
Modified:
trunk/echobase-domain/pom.xml
trunk/echobase-services/pom.xml
trunk/echobase-tools/pom.xml
trunk/echobase-ui/pom.xml
trunk/pom.xml
Modified: trunk/echobase-domain/pom.xml
===================================================================
--- trunk/echobase-entities/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
+++ trunk/echobase-domain/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
@@ -15,9 +15,9 @@
</parent>
<groupId>fr.ifremer.echobase</groupId>
- <artifactId>echobase-entities</artifactId>
- <name>EchoBase :: Entities</name>
- <description>EchoBase entities module</description>
+ <artifactId>echobase-domain</artifactId>
+ <name>EchoBase :: Domain</name>
+ <description>EchoBase domain module</description>
<properties>
<!-- no site generation -->
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
+++ trunk/echobase-services/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
@@ -100,7 +100,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>echobase-entities</artifactId>
+ <artifactId>echobase-domain</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/echobase-tools/pom.xml
===================================================================
--- trunk/echobase-tools/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
+++ trunk/echobase-tools/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
@@ -49,7 +49,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>echobase-entities</artifactId>
+ <artifactId>echobase-domain</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
+++ trunk/echobase-ui/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
@@ -153,7 +153,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>echobase-entities</artifactId>
+ <artifactId>echobase-domain</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
+++ trunk/pom.xml 2012-09-01 11:35:19 UTC (rev 588)
@@ -14,7 +14,7 @@
<version>1.1-SNAPSHOT</version>
<modules>
- <module>echobase-entities</module>
+ <module>echobase-domain</module>
<module>echobase-services</module>
<module>echobase-tools</module>
<module>echobase-ui</module>
1
0
01 Sep '12
Author: tchemit
Date: 2012-09-01 13:28:26 +0200 (Sat, 01 Sep 2012)
New Revision: 587
Url: http://forge.codelutin.com/repositories/revision/echobase/587
Log:
review application layout (will use now a domain module) + continue internal db refactor + clean some stuffs (from action and much much more...)
Added:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/InputFile.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
trunk/echobase-entities/src/main/resources/echobase-workingdb.properties
trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/
trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryNameAlreadyExistException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/MissionNameAlreadyExistException.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/DecoratorServiceTest.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
Removed:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseDecoratorProvider.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseEntityHelper.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/JdbcConfiguration.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseDbMeta.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBasePersistenceHelper.java
trunk/echobase-entities/src/main/resources/echobase-datadb.properties
trunk/echobase-entities/src/main/resources/topia-h2.properties
trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDecoratorProviderTest.java
trunk/echobase-entities/src/test/java/fr/ifremer/echobase/entities/EchoBaseDbMetaTest.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseIOUtil.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/InputFile.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/ExportQueryNameAlreadyExistException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/MissionNameAlreadyExistException.java
Modified:
trunk/echobase-entities/pom.xml
trunk/echobase-entities/src/main/xmi/echobase-internal.zargo
trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportdb/ExportDbService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ImportException.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsMapCellImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsRegionCellImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsVoyageImportService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/DefaultImportStrategy.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbConfiguration.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbService.java
trunk/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties
trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseTestServiceSupport.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportDbServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportQueryServiceTest.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/FakeEchoBaseServiceContext.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/AbstractImportDataServiceIT.java
trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportServiceIT.java
trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/EchoBaseDbCreator.java
trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/EntityLoader.java
trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/GearMetadataLoader.java
trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/OperationMetadataLoader.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/EchoBaseDbZipCreatorIT.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/AbstractLoaderIT.java
trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/NewLibreOfficeQuery.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetDataProcessingsForVoyage.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetVesselsForVoyage.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java
trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
Modified: trunk/echobase-entities/pom.xml
===================================================================
--- trunk/echobase-entities/pom.xml 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/pom.xml 2012-09-01 11:28:26 UTC (rev 587)
@@ -200,13 +200,13 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseDecoratorProvider.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseDecoratorProvider.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseDecoratorProvider.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,274 +0,0 @@
-/*
- * #%L
- * EchoBase :: Entities
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.ExportQuery;
-import fr.ifremer.echobase.entities.WorkingDbConfiguration;
-import fr.ifremer.echobase.entities.data.Category;
-import fr.ifremer.echobase.entities.data.Cell;
-import fr.ifremer.echobase.entities.data.Data;
-import fr.ifremer.echobase.entities.data.DataAcquisition;
-import fr.ifremer.echobase.entities.data.DataProcessing;
-import fr.ifremer.echobase.entities.data.Echotype;
-import fr.ifremer.echobase.entities.data.GearMetadataValue;
-import fr.ifremer.echobase.entities.data.LengthAgeKey;
-import fr.ifremer.echobase.entities.data.LengthWeightKey;
-import fr.ifremer.echobase.entities.data.Operation;
-import fr.ifremer.echobase.entities.data.OperationMetadataValue;
-import fr.ifremer.echobase.entities.data.Result;
-import fr.ifremer.echobase.entities.data.Sample;
-import fr.ifremer.echobase.entities.data.SampleData;
-import fr.ifremer.echobase.entities.data.Transect;
-import fr.ifremer.echobase.entities.data.Transit;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.entities.references.AcousticInstrument;
-import fr.ifremer.echobase.entities.references.AgeCategory;
-import fr.ifremer.echobase.entities.references.AreaOfOperation;
-import fr.ifremer.echobase.entities.references.Calibration;
-import fr.ifremer.echobase.entities.references.CategoryMeaning;
-import fr.ifremer.echobase.entities.references.CategoryRef;
-import fr.ifremer.echobase.entities.references.CategoryType;
-import fr.ifremer.echobase.entities.references.CellMethod;
-import fr.ifremer.echobase.entities.references.CellType;
-import fr.ifremer.echobase.entities.references.DataMetadata;
-import fr.ifremer.echobase.entities.references.DataProtocol;
-import fr.ifremer.echobase.entities.references.DataQuality;
-import fr.ifremer.echobase.entities.references.DataType;
-import fr.ifremer.echobase.entities.references.DepthStratum;
-import fr.ifremer.echobase.entities.references.EchotypeCategory;
-import fr.ifremer.echobase.entities.references.Gear;
-import fr.ifremer.echobase.entities.references.GearCharacteristic;
-import fr.ifremer.echobase.entities.references.GearCharacteristicValue;
-import fr.ifremer.echobase.entities.references.GearMetadata;
-import fr.ifremer.echobase.entities.references.Impacte;
-import fr.ifremer.echobase.entities.references.MeasureType;
-import fr.ifremer.echobase.entities.references.MeasurementMetadata;
-import fr.ifremer.echobase.entities.references.Mission;
-import fr.ifremer.echobase.entities.references.OperationEvent;
-import fr.ifremer.echobase.entities.references.OperationMetadata;
-import fr.ifremer.echobase.entities.references.ReferenceDatum;
-import fr.ifremer.echobase.entities.references.ReferenceDatumType;
-import fr.ifremer.echobase.entities.references.ReferencingMethod;
-import fr.ifremer.echobase.entities.references.SampleDataType;
-import fr.ifremer.echobase.entities.references.SampleType;
-import fr.ifremer.echobase.entities.references.SexCategory;
-import fr.ifremer.echobase.entities.references.SizeCategory;
-import fr.ifremer.echobase.entities.references.Species;
-import fr.ifremer.echobase.entities.references.SpeciesCategory;
-import fr.ifremer.echobase.entities.references.Strata;
-import fr.ifremer.echobase.entities.references.TSParameters;
-import fr.ifremer.echobase.entities.references.Vessel;
-import fr.ifremer.echobase.entities.references.VesselType;
-import org.nuiton.util.decorator.DecoratorMulti18nProvider;
-
-import java.util.Locale;
-
-/**
- * Decorator provider.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class EchoBaseDecoratorProvider extends DecoratorMulti18nProvider {
-
- @Override
- protected void loadDecorators(Locale locale) {
-
- // EchoBaseUser decorator
- registerJXPathDecorator(locale, EchoBaseUser.class, "${email}$s");
-
- // ExportQuery decorator
- registerJXPathDecorator(locale, ExportQuery.class, "${name}$s - ${description}$s");
-
- // WorkingDbConfiguration decorator
- registerJXPathDecorator(locale, WorkingDbConfiguration.class, "${url}$s - ${login}$s (${description}$s)");
-
- // AcousticInstrument decorator
- registerJXPathDecorator(locale, AcousticInstrument.class, "${id}$s");
-
- // AgeCategory decorator
- registerJXPathDecorator(locale, AgeCategory.class, "${name}$s");
-
- // AreaOfOperation decorator
- registerJXPathDecorator(locale, AreaOfOperation.class, "${name}$s");
-
- // Calibration decorator
- registerJXPathDecorator(locale, Calibration.class, "${date}$s - acquisition ${aquisitionMethod}$s");
-
- // Category decorator
- registerJXPathDecorator(locale, Category.class, "${echotypeLabel}$s ${speciesLabel}$s ${processedAgeLabel}$s ${processedLengthLabel}$s");
-
- // CategoryMeaning decorator
- registerJXPathDecorator(locale, CategoryMeaning.class, "${name}$s");
-
- // CategoryRef decorator
- registerJXPathDecorator(locale, CategoryRef.class, "${genusSpecies}$s");
-
- // CategoryType decorator
- registerJXPathDecorator(locale, CategoryType.class, "${name}$s");
-
- // CellMethod decorator
- registerJXPathDecorator(locale, CellMethod.class, "${name}$s");
-
- // CellType decorator
- registerJXPathDecorator(locale, CellType.class, "${name}$s");
-
- // DataMetadata decorator
- registerJXPathDecorator(locale, DataMetadata.class, "${name}$s - ${standardName}$s");
-
- // DataProtocol decorator
- registerJXPathDecorator(locale, DataProtocol.class, "${description}$s [ ${validSince}$td/%2$tm/%2$tY - ${invalidSince}$td/%3$tm/%3$tY ]");
-
- // DataQuality decorator
- registerJXPathDecorator(locale, DataQuality.class, "${qualityDataFlagValues}$s - ${flagMeanings}$s");
-
- // DataType decorator
- registerJXPathDecorator(locale, DataType.class, "${name}$s");
-
- // DepthStratum decorator
- registerJXPathDecorator(locale, DepthStratum.class, "${id}$s - ${meaning}$s");
-
- // Echotype decorator
- registerJXPathDecorator(locale, Echotype.class, "${id}$s - ${name}$s");
-
- // EchotypeCategory decorator
- registerJXPathDecorator(locale, EchotypeCategory.class, "${name}$s");
-
- // Gear decorator
- registerJXPathDecorator(locale, Gear.class, "${name}$s [ ${validSince}$td/%2$tm/%2$tY - ${invalidSince}$td/%3$tm/%3$tY ]");
-
- // GearCaracteristic decorator
- registerJXPathDecorator(locale, GearCharacteristic.class, "${name}$s");
-
- // GearMetadata decorator
- registerJXPathDecorator(locale, GearMetadata.class, "${name}$s (${operationEvent/name}$s)");
-
- // GearCharacteristicValue decorator
- registerJXPathDecorator(locale, GearCharacteristicValue.class, "${dataValue}$s");
-
- // GearMetadataValue decorator
- registerJXPathDecorator(locale, GearMetadataValue.class, "${dataValue}$s");
-
- // Impacte decorator
- registerJXPathDecorator(locale, Impacte.class, "${measurementUnit}$s - ${species/genusSpecies}");
-
- // LengthAgeKey decorator
- registerJXPathDecorator(locale, LengthAgeKey.class, "Age ${age}$s - Length ${length}");
-
- // MeasurementMetadata decorator
- registerJXPathDecorator(locale, MeasurementMetadata.class, "${name}$s");
-
- // MeasureType decorator
- registerJXPathDecorator(locale, MeasureType.class, "${name}$s");
-
- // Mission decorator
- registerJXPathDecorator(locale, Mission.class, "${name}$s");
-
- // OperationEvent decorator
- registerJXPathDecorator(locale, OperationEvent.class, "${name}$s");
-
- // OperationMetadata decorator
- registerJXPathDecorator(locale, OperationMetadata.class, "${name}$s");
-
- // ReferenceDatum decorator
- registerJXPathDecorator(locale, ReferenceDatum.class, "${id}$s");
-
- // ReferenceDatumType decorator
- registerJXPathDecorator(locale, ReferenceDatumType.class, "${name}$s");
-
- // ReferencingMethod decorator
- registerJXPathDecorator(locale, ReferencingMethod.class, "${name}$s");
-
- // SampleDataType decorator
- registerJXPathDecorator(locale, SampleDataType.class, "${name}$s");
-
- // SampleType decorator
- registerJXPathDecorator(locale, SampleType.class, "${name}$s - level ${level}$s");
-
- // SexCategory decorator
- registerJXPathDecorator(locale, SexCategory.class, "${name}$s");
-
- // SizeCategory decorator
- registerJXPathDecorator(locale, SizeCategory.class, "${name}$s");
-
- // Species decorator
- registerJXPathDecorator(locale, Species.class, "${genusSpecies}$s (${baracoudaCode}$s)");
-
- // SpeciesCategory decorator
- registerJXPathDecorator(locale, SpeciesCategory.class, "${species/genusSpecies}$s ${sizeCategoryLabel}$s ${ageCategoryLabel}$s ${sexCategoryLabel}$s");
-
- // Strata decorator
- registerJXPathDecorator(locale, Strata.class, "Latitude <${minLatitude}$s - ${maxLatitude}$s>, Longitude <${minLongitude}$s - ${maxLongitude}$s>");
-
- //TODO
- // TSParameters decorator
- registerJXPathDecorator(locale, TSParameters.class, "${}$s");
-
- // Vessel decorator
- registerJXPathDecorator(locale, Vessel.class, "${name}$s");
-
- // VesselType decorator
- registerJXPathDecorator(locale, VesselType.class, "${name}$s");
-
- // LengthWeightKey decorator
- registerJXPathDecorator(locale, LengthWeightKey.class, "Species ${species/genusSpecies}$s - a=${aParameter}$s, b=${bParameter}$s");
-
- // Cell decorator
- registerJXPathDecorator(locale, Cell.class, "${name}$s");
-
- // Data decorator
- registerJXPathDecorator(locale, Data.class, "${dataValue}$s");
-
- // DataAcquisition decorator
- registerJXPathDecorator(locale, DataAcquisition.class, "${acousticInstrument/id}$s ");
-
- // DataProcessing decorator
- registerJXPathDecorator(locale, DataProcessing.class, "${id}$s");
-
- // Operation decorator
- registerJXPathDecorator(locale, Operation.class, "${startDate}$td/%1$tm/%1$tY - ${endDate}$td/%2$tm/%2$tY");
-
- // OperationMetadataValue decorator
- registerJXPathDecorator(locale, OperationMetadataValue.class, "${operationMetadata/name} - ${dataValue}$s");
-
- // Result decorator
- registerJXPathDecorator(locale, Result.class, "${resultvalue}$s");
-
- // Sample decorator
- registerJXPathDecorator(locale, Sample.class, "${resultvalue}$s");
-
- // SampleData decorator
- registerJXPathDecorator(locale, SampleData.class, "${resultvalue}$s");
-
- // Transect decorator
- registerJXPathDecorator(locale, Transect.class, "${title}$s - Vessel ${vessel/name}$s");
-
- // Transit decorator
- registerJXPathDecorator(locale, Transit.class, "${startTime}$td/%1$tm/%1$tY - ${endTime}$td/%2$tm/%2$tY");
-
- // Voyage decorator
- registerJXPathDecorator(locale, Voyage.class, "${name}$s [ ${startDate}$td/%2$tm/%2$tY - ${endDate}$td/%3$tm/%3$tY ]");
- }
-}
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseEntityHelper.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseEntityHelper.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseEntityHelper.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,155 +0,0 @@
-package fr.ifremer.echobase;
-
-/*
- * #%L
- * EchoBase :: Entities
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Transaction;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaRuntimeException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-
-/**
- * helper about topia context and jdbc connections.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class EchoBaseEntityHelper {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EchoBaseEntityHelper.class);
-
- public static Connection newJDBCConnection(JdbcConfiguration configuration) throws SQLException {
-
- String jdbcUrl = configuration.getUrl();
- String login = configuration.getLogin();
- String password = configuration.getPassword();
-
- Connection conn = DriverManager.getConnection(jdbcUrl, login, password);
-
- if (log.isDebugEnabled()) {
- log.debug("connexion reussie pour l'utilisateur " + login +
- " at [" + jdbcUrl + ']');
- }
-
- return conn;
- }
-
- public static TopiaContext newTransactionFromRootContext(TopiaContext otherTx) throws TopiaException {
- TopiaContext tx = ((TopiaContextImplementor) otherTx).getRootContext().beginTransaction();
- return tx;
- }
-
- public static void releaseRootContext(TopiaContext context) {
-
- TopiaContextImplementor rootContext = ((TopiaContextImplementor) context).getRootContext();
-
- if (log.isInfoEnabled()) {
- log.info("release database " +
- rootContext.getConfig().get(TopiaContextFactory.CONFIG_URL));
- }
- try {
- releaseContext(rootContext);
- } catch (TopiaException e) {
- // we don't want this to throw an exception, wants to close
- // all possible opened contexts
- if (log.isErrorEnabled()) {
- log.error("Could not close context " + rootContext, e);
- }
- }
- }
-
- public static void releaseContext(TopiaContext rootContext) throws TopiaException {
- if (rootContext != null && !rootContext.isClosed()) {
- rootContext.closeContext();
- }
- }
-
- public static void checkJDBCConnection(JdbcConfiguration configuration) throws SQLException {
-
- Connection conn = null;
- try {
-
- conn = newJDBCConnection(configuration);
-
- } finally {
- if (conn != null) {
- try {
- conn.close();
- } catch (SQLException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not close properly connection to "
- + configuration.getUrl(), e);
- }
- }
- }
- }
- }
-
- public static JdbcConfiguration newJdbcConfiguration(Properties dbConf) {
-
- JdbcConfiguration result = new JdbcConfiguration();
- result.setUrl(dbConf.getProperty(TopiaContextFactory.CONFIG_URL));
- result.setLogin(dbConf.getProperty(TopiaContextFactory.CONFIG_USER));
- result.setPassword(dbConf.getProperty(TopiaContextFactory.CONFIG_PASS));
- return result;
- }
-
- public static void closeConnection(TopiaContext transaction) {
- if (transaction == null) {
- if (log.isTraceEnabled()) {
- log.trace("no transaction to close");
- }
- } else if (transaction.isClosed()) {
- if (log.isTraceEnabled()) {
- log.trace("transaction " + transaction + " is already closed");
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("closing transaction " + transaction);
- }
-
- try {
- Transaction tx = ((TopiaContextImplementor) transaction).getHibernate().getTransaction();
- if (!tx.wasCommitted() && !tx.wasRolledBack()) {
- if (log.isDebugEnabled()) {
- log.debug("rollback transaction!");
- }
- tx.rollback();
- }
- transaction.closeContext();
- } catch (TopiaException e) {
- throw new TopiaRuntimeException(e);
- }
- }
- }
-}
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextFactory.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,270 +0,0 @@
-/*
- * #%L
- * Extranet NF-Logement :: Entities
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Cerqual
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import com.google.common.io.Closeables;
-import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaNotFoundException;
-import org.nuiton.topia.TopiaRuntimeException;
-import org.nuiton.util.RecursiveProperties;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EchoBaseTopiaRootContextFactory {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EchoBaseTopiaRootContextFactory.class);
-
-
- public static final String T3_EMBEDDED_DB_PROPERTIES =
- "/echobase-TopiaContextImpl.properties";
-
- public static final String USER_DB_PROPERTIES =
- "/echobase-workingdb.properties";
-
- public static final String INTERNAL_DB_PROPERTIES =
- "/echobase-internaldb.properties";
-
-
- public TopiaContext newEmbeddedDatabase(File dir) {
-
- return newEmbeddedDatabase(dir, "/topia-h2.properties");
- }
-
- public TopiaContext newEmbeddedDatabase(File dir, String configPath) {
-
- File databaseFile = new File(dir, "db");
-
- String databaseAbsolutePath = databaseFile.getAbsolutePath();
-
- // prepare call to topia-context factory
- Properties properties = new Properties();
- InputStream input = null;
- try {
- input = getClass().getResourceAsStream(configPath);
- Preconditions.checkNotNull(input, "Could not find resource " +
- configPath);
- properties.load(input);
- input.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- Closeables.closeQuietly(input);
- }
- String dbUrl = "jdbc:h2:file:" + databaseAbsolutePath +
- "/echobase;LOG=0;CACHE_SIZE=65536;LOCK_MODE=0;UNDO_LOG=0";
- properties.setProperty(TopiaContextFactory.CONFIG_URL, dbUrl);
-
- if (log.isInfoEnabled()) {
- log.info("Use embedded db at " + dbUrl);
- }
- // add entities to the context
- properties.setProperty(
- TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
- EchoBaseDAOHelper.getImplementationClassesAsString());
-
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("will output database in " + databaseAbsolutePath);
- }
-
- return rootContext;
- }
-
- public TopiaContext newDatabaseFromConfig(EchoBaseConfiguration config) {
-
- Properties properties = config.getProperties();
-
- return newDatabaseFromProperties(properties);
- }
-
- public TopiaContext newDatabaseFromProperties(Properties properties) {
-
- if (log.isDebugEnabled()) {
- log.debug("Database settings are :");
- Set<String> keysToDisplay = Sets.newHashSet(
- TopiaContextFactory.CONFIG_DRIVER,
- TopiaContextFactory.CONFIG_DIALECT,
- TopiaContextFactory.CONFIG_URL,
- TopiaContextFactory.CONFIG_USER
- );
- for (String key : keysToDisplay) {
- log.debug(String.format("%s=%s", key, properties.getProperty(key)));
- }
- }
-
- // add entities to the context
- String classesKey = TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES;
- String classesValue = EchoBaseDAOHelper.getImplementationClassesAsString();
- properties.setProperty(classesKey, classesValue);
-
- TopiaContext rootContext;
- try {
- rootContext = TopiaContextFactory.getContext(properties);
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException(e);
- }
-
- return rootContext;
- }
-
- /**
- * Open a new topia root context from given configuration.
- *
- * @param configuration topia configuration
- * @return the new fresh root context
- */
- public TopiaContext newDb(Properties configuration) {
- try {
- if (log.isInfoEnabled()) {
- log.info("Starts a db at : " +
- configuration.get(TopiaContextFactory.CONFIG_URL));
- }
- TopiaContext result = TopiaContextFactory.getContext(configuration);
- return result;
- } catch (TopiaNotFoundException e) {
- throw new TopiaRuntimeException("Could not init db", e);
- }
- }
-
- /**
- * Open a new topia root context from the given jdbc configuration.
- *
- * @param jdbcConfiguration jdbc configuration
- * @return the new fresh root context
- */
- public TopiaContext newDb(JdbcConfiguration jdbcConfiguration) {
-
- URL dbConfigFile = getClass().getResource(USER_DB_PROPERTIES);
-
- Properties result = null;
- try {
- InputStreamReader reader =
- new InputStreamReader(dbConfigFile.openStream(),
- Charsets.UTF_8);
- try {
- result = new RecursiveProperties();
-
- result.setProperty("configuration.url", jdbcConfiguration.getUrl());
- result.setProperty("configuration.login", jdbcConfiguration.getLogin());
- result.setProperty("configuration.password", jdbcConfiguration.getPassword());
- result.load(reader);
-
- reloadProperty(result, TopiaContextFactory.CONFIG_URL);
- reloadProperty(result, TopiaContextFactory.CONFIG_USER);
- reloadProperty(result, TopiaContextFactory.CONFIG_PASS);
-
- result.remove("configuration.url");
- result.remove("configuration.login");
- result.remove("configuration.password");
- } finally {
- reader.close();
- }
- } catch (IOException e) {
- throw new IllegalStateException(
- "Could not load database configuration", e);
- }
-
- // add entities mapping
- result.put(
- TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
- EchoBaseDAOHelper.getImplementationClassesAsString()
- );
-
- return newDb(result);
- }
-
- /**
- * Open a new topia root context for the internal db of t3 (this should be
- * a h2 db used only for security).
- *
- * @param configuration application configuration where to find db directory
- * @return the new fresh root context of the internal db
- */
- public TopiaContext newInternalDb(EchoBaseConfiguration configuration) {
-
- URL dbConfigFile = getClass().getResource(INTERNAL_DB_PROPERTIES);
-
- File internalDbDirectory = configuration.getInternalDbDirectory();
- Properties result = null;
-
- try {
- InputStreamReader reader =
- new InputStreamReader(dbConfigFile.openStream(),
- Charsets.UTF_8);
- try {
- result = new RecursiveProperties();
-
- String key =
- EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.getKey();
-
- result.setProperty(key, internalDbDirectory.getAbsolutePath());
- result.load(reader);
- reloadProperty(result, TopiaContextFactory.CONFIG_URL);
- result.remove(key);
- } finally {
- reader.close();
- }
- } catch (IOException e) {
- throw new IllegalStateException(
- "Could not load internal database configuration", e);
- }
-
- // add entities mapping
- result.put(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
- EchoBaseDAOHelper.getImplementationClassesAsString()
- );
- return newDb(result);
- }
-
- public static void reloadProperty(Properties properties, String propertyName) {
- Object o = properties.getProperty(propertyName);
- properties.put(propertyName, o);
- }
-}
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/JdbcConfiguration.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/JdbcConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/JdbcConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,67 +0,0 @@
-/*
- * #%L
- * T3 :: Domain
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import java.io.Serializable;
-
-public class JdbcConfiguration implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_URL = "url";
-
- public static final String PROPERTY_LOGIN = "login";
-
- public static final String PROPERTY_PASSWORD = "password";
-
- protected String url;
-
- protected String login;
-
- protected String password;
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getLogin() {
- return login;
- }
-
- public void setLogin(String login) {
- this.login = login;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
-}
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseDbMeta.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseDbMeta.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseDbMeta.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,284 +0,0 @@
-package fr.ifremer.echobase.entities;
-/*
- * #%L
- * EchoBase :: Entities
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import org.nuiton.topia.persistence.metadata.AssociationMeta;
-import org.nuiton.topia.persistence.metadata.DbMeta;
-import org.nuiton.topia.persistence.metadata.TableMeta;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.n_;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since TODO
- */
-public class EchoBaseDbMeta extends DbMeta<EchoBaseEntityEnum> {
-
- public static EchoBaseDbMeta newDbMeta() {
- return new EchoBaseDbMeta(new EchoBasePersistenceHelper()
- );
- }
-
- private static final List<EchoBaseEntityEnum> REFERENCE_TYPES = ImmutableList.copyOf(Arrays.asList(
-
- // with no dep
- EchoBaseEntityEnum.SexCategory,
- EchoBaseEntityEnum.AgeCategory,
- EchoBaseEntityEnum.SizeCategory,
- EchoBaseEntityEnum.Species,
- EchoBaseEntityEnum.Calibration,
- EchoBaseEntityEnum.VesselType,
- EchoBaseEntityEnum.Mission,
- EchoBaseEntityEnum.DepthStratum,
- EchoBaseEntityEnum.EchotypeCategory,
- EchoBaseEntityEnum.AreaOfOperation,
- EchoBaseEntityEnum.ReferenceDatumType,
- EchoBaseEntityEnum.DataType,
- EchoBaseEntityEnum.DataQuality,
- EchoBaseEntityEnum.CellMethod,
- EchoBaseEntityEnum.CellType,
- EchoBaseEntityEnum.OperationEvent,
- EchoBaseEntityEnum.SampleDataType,
- EchoBaseEntityEnum.SampleType,
- EchoBaseEntityEnum.GearCharacteristic,
- EchoBaseEntityEnum.CategoryMeaning,
- EchoBaseEntityEnum.CategoryType,
- EchoBaseEntityEnum.MeasureType,
- EchoBaseEntityEnum.MeasurementMetadata,
- EchoBaseEntityEnum.ReferencingMethod,
-
- // with deps
- EchoBaseEntityEnum.Strata,
- EchoBaseEntityEnum.AcousticInstrument,
- EchoBaseEntityEnum.Vessel,
- EchoBaseEntityEnum.ReferenceDatum,
- EchoBaseEntityEnum.OperationMetadata,
- EchoBaseEntityEnum.GearMetadata,
- EchoBaseEntityEnum.GearCharacteristicValue,
- EchoBaseEntityEnum.Gear,
-
- EchoBaseEntityEnum.SpeciesCategory,
- EchoBaseEntityEnum.TSParameters,
- EchoBaseEntityEnum.DataMetadata,
- EchoBaseEntityEnum.CategoryRef,
- EchoBaseEntityEnum.Impacte,
- EchoBaseEntityEnum.DataProtocol));
-
- private static final List<EchoBaseEntityEnum> DATA_TYPES = ImmutableList.copyOf(Arrays.asList(
- EchoBaseEntityEnum.SampleData,
- EchoBaseEntityEnum.Sample,
-
- EchoBaseEntityEnum.OperationMetadataValue,
- EchoBaseEntityEnum.GearMetadataValue,
- EchoBaseEntityEnum.Operation,
-
- EchoBaseEntityEnum.Data,
-
- EchoBaseEntityEnum.Echotype,
- EchoBaseEntityEnum.Category,
- EchoBaseEntityEnum.Result,
-
- EchoBaseEntityEnum.Cell,
- EchoBaseEntityEnum.DataProcessing,
- EchoBaseEntityEnum.DataAcquisition,
- EchoBaseEntityEnum.Transect,
- EchoBaseEntityEnum.Transit,
-
- EchoBaseEntityEnum.LengthAgeKey,
- EchoBaseEntityEnum.LengthWeightKey,
-
- EchoBaseEntityEnum.Voyage));
-
-
- private final List<TableMeta<EchoBaseEntityEnum>> referenceTables;
-
- private final List<AssociationMeta<EchoBaseEntityEnum>> referenceAssociations;
-
- private final List<TableMeta<EchoBaseEntityEnum>> dataTables;
-
- private final List<AssociationMeta<EchoBaseEntityEnum>> dataAssociations;
-
- EchoBaseDbMeta(EchoBasePersistenceHelper persistenceHelper) {
- super(persistenceHelper,
- EchoBaseEntityEnum.values(), EchoBaseEntityEnum.EntityModificationLog);
-
-
- {
- // reference tables
- List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
- addTables(result, REFERENCE_TYPES);
- referenceTables = ImmutableList.copyOf(result);
- }
-
- {
- // reference associations
- List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
- addAssociations(result, REFERENCE_TYPES);
- referenceAssociations = ImmutableList.copyOf(result);
- }
-
- {
- // data tables
-
- List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
- addTables(result, DATA_TYPES);
- dataTables = ImmutableList.copyOf(result);
- }
-
- {
- // data associations
- List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
- addAssociations(result, DATA_TYPES);
- dataAssociations = ImmutableList.copyOf(result);
- }
-
- }
-
- public int getEntriesSize() {
- return getAllTables().size() + getAllAssociations().size();
- }
-
- public List<TableMeta<EchoBaseEntityEnum>> getAllTables() {
-
- List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
-
- result.addAll(referenceTables);
- result.addAll(dataTables);
- return ImmutableList.copyOf(result);
- }
-
- public List<AssociationMeta<EchoBaseEntityEnum>> getAllAssociations() {
- List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
- result.addAll(referenceAssociations);
- result.addAll(dataAssociations);
- return ImmutableList.copyOf(result);
- }
-
- public int getReferenceEntriesSize() {
- return getReferenceTables().size() + getReferenceAssociations().size();
- }
-
- public List<TableMeta<EchoBaseEntityEnum>> getReferenceTables() {
- return referenceTables;
- }
-
- public List<AssociationMeta<EchoBaseEntityEnum>> getReferenceAssociations() {
- return referenceAssociations;
- }
-
- public List<TableMeta<EchoBaseEntityEnum>> getDataTables() {
- return dataTables;
- }
-
- public List<AssociationMeta<EchoBaseEntityEnum>> getDataAssociations() {
- return dataAssociations;
- }
-
- /**
- * @return the entity types of data in correct order for replication
- * purpose.
- */
- public List<EchoBaseEntityEnum> getDataTypes() {
- return DATA_TYPES;
- }
-
- /**
- * @return the entity types of reference in correct order for copy
- * purpose (says import / export of all a database.
- */
- public List<EchoBaseEntityEnum> getReferenceTypes() {
- return REFERENCE_TYPES;
- }
-
- @Override
- public EchoBasePersistenceHelper getPersistenceHelper() {
- return (EchoBasePersistenceHelper) super.getPersistenceHelper();
- }
-
- /**
- *
- * I18n definition (we need it for generic dbeditor, but we don't want
- * ToPIA to generate all keys for all property)
- * @since 1.1
- */
- static {
- n_("echobase.common.admin");
- n_("echobase.common.areaOfOperation");
- n_("echobase.common.author");
- n_("echobase.common.authorEmail");
- n_("echobase.common.calibration");
- n_("echobase.common.cell");
- n_("echobase.common.data");
- n_("echobase.common.dataAcquisition");
- n_("echobase.common.dataCentre");
- n_("echobase.common.dataCentreEmail");
- n_("echobase.common.dataProcessing");
- n_("echobase.common.dataQuality");
- n_("echobase.common.datum");
- n_("echobase.common.depthStratum");
- n_("echobase.common.description");
- n_("echobase.common.distributionStatement");
- n_("echobase.common.echoBaseUser");
- n_("echobase.common.email");
- n_("echobase.common.entityId");
- n_("echobase.common.entityModificationLog");
- n_("echobase.common.entityType");
- n_("echobase.common.exportQuery");
- n_("echobase.common.id");
- n_("echobase.common.institution");
- n_("echobase.common.keywords");
- n_("echobase.common.lastModifiedDate");
- n_("echobase.common.lastModifiedUser");
- n_("echobase.common.litteratureReferences");
- n_("echobase.common.metadata");
- n_("echobase.common.mission");
- n_("echobase.common.missionAbstract");
- n_("echobase.common.modificationDate");
- n_("echobase.common.modificationText");
- n_("echobase.common.modificationUser");
- n_("echobase.common.name");
- n_("echobase.common.organisationLevelAcknowledgements");
- n_("echobase.common.organisationReferences");
- n_("echobase.common.password");
- n_("echobase.common.platform");
- n_("echobase.common.principalInvestigator");
- n_("echobase.common.principalInvestigatorEmail");
- n_("echobase.common.project");
- n_("echobase.common.referenceDatum");
- n_("echobase.common.source");
- n_("echobase.common.species");
- n_("echobase.common.sqlQuery");
- n_("echobase.common.transect");
- n_("echobase.common.transit");
- n_("echobase.common.vessel");
- n_("echobase.common.voyage");
- n_("echobase.config.data.directory.description");
- }
-}
Deleted: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBasePersistenceHelper.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBasePersistenceHelper.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBasePersistenceHelper.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,59 +0,0 @@
-package fr.ifremer.echobase.entities;
-
-/*
- * #%L
- * EchoBase :: Entities
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaRuntimeException;
-import org.nuiton.topia.persistence.TopiaDAO;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaPersistenceHelper;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public class EchoBasePersistenceHelper implements TopiaPersistenceHelper<EchoBaseEntityEnum> {
-
- @Override
- public <E extends TopiaEntity> EchoBaseEntityEnum getEntityEnum(Class<E> type) {
- return EchoBaseEntityEnum.valueOf(type);
- }
-
- @Override
- public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, Class<E> type) {
- try {
- return EchoBaseDAOHelper.<E, TopiaDAO<E>>getDAO(tx, type);
- } catch (TopiaException e) {
- throw new TopiaRuntimeException(e);
- }
- }
-
- @Override
- public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, EchoBaseEntityEnum type) {
- return (TopiaDAO<E>) getDAO(tx, type.getContract());
- }
-}
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseIOUtil.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,165 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.io;
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ZipUtil;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.util.Collection;
+
+/**
+ * Usefull methods on io.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class EchoBaseIOUtil {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EchoBaseIOUtil.class);
+
+ public static void compressZipFile(File zipFile, File directory) throws IOException {
+ compressZipFile(zipFile, directory, true);
+ }
+
+ public static void compressZipFile(File zipFile, File directory, boolean delete) throws IOException {
+ try {
+ ZipUtil.compress(zipFile, directory);
+ } catch (IOException eee) {
+ throw new EchoBaseTechnicalException(
+ "Can not create zip file " + zipFile, eee);
+ } finally {
+ if (delete) {
+ FileUtils.deleteDirectory(directory);
+ }
+ }
+ }
+
+ public static void copyFile(File destinationFile,
+ Collection<File> filesToMerge) throws IOException {
+ if (!CollectionUtils.isEmpty(filesToMerge)) {
+
+ if (filesToMerge.size() == 1) {
+
+ // simple copy
+ FileUtils.copyFile(filesToMerge.iterator().next(), destinationFile);
+ } else {
+
+ // must merge all files
+ mergeFiles(destinationFile, filesToMerge);
+ }
+ }
+ }
+
+ public static void mergeFiles(File destination,
+ Iterable<File> fileToMerges) throws IOException {
+
+ BufferedWriter writer = new BufferedWriter(new FileWriter(destination));
+ try {
+ boolean firstLine = false;
+ for (File toMergeFile : fileToMerges) {
+ BufferedReader reader = new BufferedReader(new FileReader(toMergeFile));
+ try {
+ // pass the first line (header)
+ String line = reader.readLine();
+ if (!firstLine) {
+
+ // add the csv header
+ writer.write(line);
+
+ firstLine = true;
+ }
+ while ((line = reader.readLine()) != null) {
+ writer.newLine();
+ writer.write(line);
+ }
+ } finally {
+ reader.close();
+ }
+
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ public static int countLines(File file) {
+ int result = 0;
+
+ LineNumberReader reader = null;
+ try {
+ reader = new LineNumberReader(
+ new InputStreamReader(FileUtils.openInputStream(file))
+ );
+ while (reader.readLine() != null) {
+ }
+ result = reader.getLineNumber();
+ reader.close();
+
+ } catch (IOException e) {
+ throw new EchoBaseTechnicalException(
+ "Could not count lines of file " + file, e);
+ } finally {
+ if (reader != null) {
+ IOUtils.closeQuietly(reader);
+ }
+ }
+ return result;
+ }
+
+ public static void copyFile(InputFile inputFile,
+ File dataDirectory) throws IOException {
+ Preconditions.checkNotNull(inputFile);
+ Preconditions.checkNotNull(dataDirectory);
+ File source = inputFile.getFile();
+ Preconditions.checkNotNull(source);
+
+ File target = new File(dataDirectory, inputFile.getFileName());
+ if (log.isInfoEnabled()) {
+ log.info("Copy file " + source + " to " + target);
+ }
+ FileUtils.copyFile(source, target);
+
+ // keep target (source file will be removed at the end of this action)
+ inputFile.setFile(target);
+ }
+
+ protected EchoBaseIOUtil() {
+ // no instance of helper class
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/InputFile.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/InputFile.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/InputFile.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/InputFile.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,94 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.io;
+
+import java.io.File;
+import java.io.Serializable;
+
+/**
+ * Object to receive a uploaded file.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class InputFile implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Name of the file (from the client side). */
+ protected String fileName;
+
+ /** Location of the uploaded file (from the server side). */
+ protected File file;
+
+ /** Content type of the uploaded file. */
+ protected String contentType;
+
+ /** Label of the import. */
+ protected String label;
+
+ public static InputFile newFile(String label) {
+ return new InputFile(label);
+ }
+
+ protected InputFile(String label) {
+ this.label = label;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public boolean hasFile() {
+ return file != null;
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/io/InputFile.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java (from rev 579, trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseDbMeta.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,285 @@
+package fr.ifremer.echobase.persistence;
+/*
+ * #%L
+ * EchoBase :: Entities
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import org.nuiton.topia.persistence.metadata.AssociationMeta;
+import org.nuiton.topia.persistence.metadata.DbMeta;
+import org.nuiton.topia.persistence.metadata.TableMeta;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */
+public class EchoBaseDbMeta extends DbMeta<EchoBaseEntityEnum> {
+
+ public static EchoBaseDbMeta newDbMeta() {
+ return new EchoBaseDbMeta(new EchoBasePersistenceHelper()
+ );
+ }
+
+ private static final List<EchoBaseEntityEnum> REFERENCE_TYPES = ImmutableList.copyOf(Arrays.asList(
+
+ // with no dep
+ EchoBaseEntityEnum.SexCategory,
+ EchoBaseEntityEnum.AgeCategory,
+ EchoBaseEntityEnum.SizeCategory,
+ EchoBaseEntityEnum.Species,
+ EchoBaseEntityEnum.Calibration,
+ EchoBaseEntityEnum.VesselType,
+ EchoBaseEntityEnum.Mission,
+ EchoBaseEntityEnum.DepthStratum,
+ EchoBaseEntityEnum.EchotypeCategory,
+ EchoBaseEntityEnum.AreaOfOperation,
+ EchoBaseEntityEnum.ReferenceDatumType,
+ EchoBaseEntityEnum.DataType,
+ EchoBaseEntityEnum.DataQuality,
+ EchoBaseEntityEnum.CellMethod,
+ EchoBaseEntityEnum.CellType,
+ EchoBaseEntityEnum.OperationEvent,
+ EchoBaseEntityEnum.SampleDataType,
+ EchoBaseEntityEnum.SampleType,
+ EchoBaseEntityEnum.GearCharacteristic,
+ EchoBaseEntityEnum.CategoryMeaning,
+ EchoBaseEntityEnum.CategoryType,
+ EchoBaseEntityEnum.MeasureType,
+ EchoBaseEntityEnum.MeasurementMetadata,
+ EchoBaseEntityEnum.ReferencingMethod,
+
+ // with deps
+ EchoBaseEntityEnum.Strata,
+ EchoBaseEntityEnum.AcousticInstrument,
+ EchoBaseEntityEnum.Vessel,
+ EchoBaseEntityEnum.ReferenceDatum,
+ EchoBaseEntityEnum.OperationMetadata,
+ EchoBaseEntityEnum.GearMetadata,
+ EchoBaseEntityEnum.GearCharacteristicValue,
+ EchoBaseEntityEnum.Gear,
+
+ EchoBaseEntityEnum.SpeciesCategory,
+ EchoBaseEntityEnum.TSParameters,
+ EchoBaseEntityEnum.DataMetadata,
+ EchoBaseEntityEnum.CategoryRef,
+ EchoBaseEntityEnum.Impacte,
+ EchoBaseEntityEnum.DataProtocol));
+
+ private static final List<EchoBaseEntityEnum> DATA_TYPES = ImmutableList.copyOf(Arrays.asList(
+ EchoBaseEntityEnum.SampleData,
+ EchoBaseEntityEnum.Sample,
+
+ EchoBaseEntityEnum.OperationMetadataValue,
+ EchoBaseEntityEnum.GearMetadataValue,
+ EchoBaseEntityEnum.Operation,
+
+ EchoBaseEntityEnum.Data,
+
+ EchoBaseEntityEnum.Echotype,
+ EchoBaseEntityEnum.Category,
+ EchoBaseEntityEnum.Result,
+
+ EchoBaseEntityEnum.Cell,
+ EchoBaseEntityEnum.DataProcessing,
+ EchoBaseEntityEnum.DataAcquisition,
+ EchoBaseEntityEnum.Transect,
+ EchoBaseEntityEnum.Transit,
+
+ EchoBaseEntityEnum.LengthAgeKey,
+ EchoBaseEntityEnum.LengthWeightKey,
+
+ EchoBaseEntityEnum.Voyage));
+
+
+ private final List<TableMeta<EchoBaseEntityEnum>> referenceTables;
+
+ private final List<AssociationMeta<EchoBaseEntityEnum>> referenceAssociations;
+
+ private final List<TableMeta<EchoBaseEntityEnum>> dataTables;
+
+ private final List<AssociationMeta<EchoBaseEntityEnum>> dataAssociations;
+
+ EchoBaseDbMeta(EchoBasePersistenceHelper persistenceHelper) {
+ super(persistenceHelper,
+ EchoBaseEntityEnum.values(),
+ EchoBaseEntityEnum.EntityModificationLog);
+
+ {
+ // reference tables
+ List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+ addTables(result, REFERENCE_TYPES);
+ referenceTables = ImmutableList.copyOf(result);
+ }
+
+ {
+ // reference associations
+ List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+ addAssociations(result, REFERENCE_TYPES);
+ referenceAssociations = ImmutableList.copyOf(result);
+ }
+
+ {
+ // data tables
+
+ List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+ addTables(result, DATA_TYPES);
+ dataTables = ImmutableList.copyOf(result);
+ }
+
+ {
+ // data associations
+ List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+ addAssociations(result, DATA_TYPES);
+ dataAssociations = ImmutableList.copyOf(result);
+ }
+
+ }
+
+ public int getEntriesSize() {
+ return getAllTables().size() + getAllAssociations().size();
+ }
+
+ public List<TableMeta<EchoBaseEntityEnum>> getAllTables() {
+
+ List<TableMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+
+ result.addAll(referenceTables);
+ result.addAll(dataTables);
+ return ImmutableList.copyOf(result);
+ }
+
+ public List<AssociationMeta<EchoBaseEntityEnum>> getAllAssociations() {
+ List<AssociationMeta<EchoBaseEntityEnum>> result = Lists.newArrayList();
+ result.addAll(referenceAssociations);
+ result.addAll(dataAssociations);
+ return ImmutableList.copyOf(result);
+ }
+
+ public int getReferenceEntriesSize() {
+ return getReferenceTables().size() + getReferenceAssociations().size();
+ }
+
+ public List<TableMeta<EchoBaseEntityEnum>> getReferenceTables() {
+ return referenceTables;
+ }
+
+ public List<AssociationMeta<EchoBaseEntityEnum>> getReferenceAssociations() {
+ return referenceAssociations;
+ }
+
+ public List<TableMeta<EchoBaseEntityEnum>> getDataTables() {
+ return dataTables;
+ }
+
+ public List<AssociationMeta<EchoBaseEntityEnum>> getDataAssociations() {
+ return dataAssociations;
+ }
+
+ /**
+ * @return the entity types of data in correct order for replication
+ * purpose.
+ */
+ public List<EchoBaseEntityEnum> getDataTypes() {
+ return DATA_TYPES;
+ }
+
+ /**
+ * @return the entity types of reference in correct order for copy
+ * purpose (says import / export of all a database.
+ */
+ public List<EchoBaseEntityEnum> getReferenceTypes() {
+ return REFERENCE_TYPES;
+ }
+
+ @Override
+ public EchoBasePersistenceHelper getPersistenceHelper() {
+ return (EchoBasePersistenceHelper) super.getPersistenceHelper();
+ }
+
+ /**
+ *
+ * I18n definition (we need it for generic dbeditor, but we don't want
+ * ToPIA to generate all keys for all property)
+ * @since 1.1
+ */
+ static {
+ n_("echobase.common.admin");
+ n_("echobase.common.areaOfOperation");
+ n_("echobase.common.author");
+ n_("echobase.common.authorEmail");
+ n_("echobase.common.calibration");
+ n_("echobase.common.cell");
+ n_("echobase.common.data");
+ n_("echobase.common.dataAcquisition");
+ n_("echobase.common.dataCentre");
+ n_("echobase.common.dataCentreEmail");
+ n_("echobase.common.dataProcessing");
+ n_("echobase.common.dataQuality");
+ n_("echobase.common.datum");
+ n_("echobase.common.depthStratum");
+ n_("echobase.common.description");
+ n_("echobase.common.distributionStatement");
+ n_("echobase.common.echoBaseUser");
+ n_("echobase.common.email");
+ n_("echobase.common.entityId");
+ n_("echobase.common.entityModificationLog");
+ n_("echobase.common.entityType");
+ n_("echobase.common.exportQuery");
+ n_("echobase.common.id");
+ n_("echobase.common.institution");
+ n_("echobase.common.keywords");
+ n_("echobase.common.lastModifiedDate");
+ n_("echobase.common.lastModifiedUser");
+ n_("echobase.common.litteratureReferences");
+ n_("echobase.common.metadata");
+ n_("echobase.common.mission");
+ n_("echobase.common.missionAbstract");
+ n_("echobase.common.modificationDate");
+ n_("echobase.common.modificationText");
+ n_("echobase.common.modificationUser");
+ n_("echobase.common.name");
+ n_("echobase.common.organisationLevelAcknowledgements");
+ n_("echobase.common.organisationReferences");
+ n_("echobase.common.password");
+ n_("echobase.common.platform");
+ n_("echobase.common.principalInvestigator");
+ n_("echobase.common.principalInvestigatorEmail");
+ n_("echobase.common.project");
+ n_("echobase.common.referenceDatum");
+ n_("echobase.common.source");
+ n_("echobase.common.species");
+ n_("echobase.common.sqlQuery");
+ n_("echobase.common.transect");
+ n_("echobase.common.transit");
+ n_("echobase.common.vessel");
+ n_("echobase.common.voyage");
+ n_("echobase.config.data.directory.description");
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java (from rev 584, trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseEntityHelper.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,154 @@
+package fr.ifremer.echobase.persistence;
+
+/*
+ * #%L
+ * EchoBase :: Entities
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Transaction;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * helper about topia context and jdbc connections.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchoBaseEntityHelper {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(EchoBaseEntityHelper.class);
+
+ public static Connection newJDBCConnection(JdbcConfiguration configuration) throws SQLException {
+
+ String jdbcUrl = configuration.getUrl();
+ String login = configuration.getLogin();
+ String password = configuration.getPassword();
+
+ Connection conn = DriverManager.getConnection(jdbcUrl, login, password);
+
+ if (log.isDebugEnabled()) {
+ log.debug("connexion reussie pour l'utilisateur " + login +
+ " at [" + jdbcUrl + ']');
+ }
+
+ return conn;
+ }
+
+ public static TopiaContext newTransactionFromRootContext(TopiaContext otherTx) throws TopiaException {
+ TopiaContext tx = ((TopiaContextImplementor) otherTx).getRootContext().beginTransaction();
+ return tx;
+ }
+
+ public static void releaseRootContext(TopiaContext context) {
+
+ TopiaContextImplementor rootContext = ((TopiaContextImplementor) context).getRootContext();
+
+ if (log.isInfoEnabled()) {
+ log.info("release database " +
+ rootContext.getConfig().get(TopiaContextFactory.CONFIG_URL));
+ }
+ try {
+ releaseContext(rootContext);
+ } catch (TopiaException e) {
+ // we don't want this to throw an exception, wants to close
+ // all possible opened contexts
+ if (log.isErrorEnabled()) {
+ log.error("Could not close context " + rootContext, e);
+ }
+ }
+ }
+
+ public static void releaseContext(TopiaContext rootContext) throws TopiaException {
+ if (rootContext != null && !rootContext.isClosed()) {
+ rootContext.closeContext();
+ }
+ }
+
+ public static void checkJDBCConnection(JdbcConfiguration configuration) throws SQLException {
+
+ Connection conn = null;
+ try {
+
+ conn = newJDBCConnection(configuration);
+
+ } finally {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not close properly connection to "
+ + configuration.getUrl(), e);
+ }
+ }
+ }
+ }
+ }
+
+// public static JdbcConfiguration newJdbcConfiguration(Properties dbConf) {
+//
+// JdbcConfiguration result = new JdbcConfiguration();
+// result.setUrl(dbConf.getProperty(TopiaContextFactory.CONFIG_URL));
+// result.setLogin(dbConf.getProperty(TopiaContextFactory.CONFIG_USER));
+// result.setPassword(dbConf.getProperty(TopiaContextFactory.CONFIG_PASS));
+// return result;
+// }
+
+ public static void closeConnection(TopiaContext transaction) {
+ if (transaction == null) {
+ if (log.isTraceEnabled()) {
+ log.trace("no transaction to close");
+ }
+ } else if (transaction.isClosed()) {
+ if (log.isTraceEnabled()) {
+ log.trace("transaction " + transaction + " is already closed");
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("closing transaction " + transaction);
+ }
+
+ try {
+ Transaction tx = ((TopiaContextImplementor) transaction).getHibernate().getTransaction();
+ if (!tx.wasCommitted() && !tx.wasRolledBack()) {
+ if (log.isDebugEnabled()) {
+ log.debug("rollback transaction!");
+ }
+ tx.rollback();
+ }
+ transaction.closeContext();
+ } catch (TopiaException e) {
+ throw new TopiaRuntimeException(e);
+ }
+ }
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java (from rev 573, trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBasePersistenceHelper.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,61 @@
+package fr.ifremer.echobase.persistence;
+
+/*
+ * #%L
+ * EchoBase :: Entities
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaPersistenceHelper;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchoBasePersistenceHelper implements TopiaPersistenceHelper<EchoBaseEntityEnum> {
+
+ @Override
+ public <E extends TopiaEntity> EchoBaseEntityEnum getEntityEnum(Class<E> type) {
+ return EchoBaseEntityEnum.valueOf(type);
+ }
+
+ @Override
+ public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, Class<E> type) {
+ try {
+ return EchoBaseDAOHelper.<E, TopiaDAO<E>>getDAO(tx, type);
+ } catch (TopiaException e) {
+ throw new TopiaRuntimeException(e);
+ }
+ }
+
+ @Override
+ public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, EchoBaseEntityEnum type) {
+ return (TopiaDAO<E>) getDAO(tx, type.getContract());
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,174 @@
+package fr.ifremer.echobase.persistence;
+
+import com.google.common.base.Charsets;
+import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.EchoBaseConfigurationOption;
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import fr.ifremer.echobase.entities.EchoBaseInternalDAOHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.util.RecursiveProperties;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * To deal with topia context for echobase application.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchobaseTopiaContexts {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(EchobaseTopiaContexts.class);
+
+ public static final String USER_DB_PROPERTIES =
+ "/echobase-workingdb.properties";
+
+ public static final String INTERNAL_DB_PROPERTIES =
+ "/echobase-internaldb.properties";
+
+ protected EchobaseTopiaContexts() {
+ // should not be instanciated
+ }
+
+ public static Properties loadWorkingDbConfiguration(JdbcConfiguration jdbcConfiguration) {
+ Properties result = new RecursiveProperties();
+
+ Class<?> driverType;
+ Class<?> dialectType;
+ switch (jdbcConfiguration.getDriverType()) {
+ case H2:
+ driverType = org.h2.Driver.class;
+ dialectType = org.hibernate.dialect.H2Dialect.class;
+ break;
+ case POSTGRESQL:
+ driverType = org.postgresql.Driver.class;
+ dialectType = org.hibernate.dialect.PostgreSQLDialect.class;
+ break;
+ default:
+ throw new IllegalStateException("Could not find driver...");
+ }
+
+ result.setProperty("configuration.url", jdbcConfiguration.getUrl());
+ result.setProperty("configuration.login", jdbcConfiguration.getLogin());
+ result.setProperty("configuration.password", jdbcConfiguration.getPassword());
+ result.setProperty("configuration.driver", driverType.getName());
+ result.setProperty("configuration.dialect", dialectType.getName());
+
+ loadProperties(result, USER_DB_PROPERTIES,
+ EchoBaseDAOHelper.getImplementationClassesAsString());
+
+ reloadProperty(result, TopiaContextFactory.CONFIG_URL, "configuration.url");
+ reloadProperty(result, TopiaContextFactory.CONFIG_USER, "configuration.login");
+ reloadProperty(result, TopiaContextFactory.CONFIG_PASS, "configuration.password");
+ reloadProperty(result, TopiaContextFactory.CONFIG_DIALECT, "configuration.dialect");
+ reloadProperty(result, TopiaContextFactory.CONFIG_DRIVER, "configuration.driver");
+
+ return result;
+ }
+
+ public static Properties loadInternalDbconfiguration(EchoBaseConfiguration configuration) {
+ File internalDbDirectory = configuration.getInternalDbDirectory();
+ Properties result = new RecursiveProperties();
+
+ String key =
+ EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.getKey();
+
+ result.setProperty(key, internalDbDirectory.getAbsolutePath());
+
+ loadProperties(result, INTERNAL_DB_PROPERTIES,
+ EchoBaseInternalDAOHelper.getImplementationClassesAsString());
+ reloadProperty(result, TopiaContextFactory.CONFIG_URL, key);
+ return result;
+ }
+
+ /**
+ * Open a new topia root context from the given jdbc configuration.
+ *
+ * @param jdbcConfiguration jdbc configuration
+ * @return the new fresh root context
+ */
+ public static TopiaContext newWorkingDb(JdbcConfiguration jdbcConfiguration) {
+
+ Properties result = loadWorkingDbConfiguration(jdbcConfiguration);
+
+ return newDb(result);
+ }
+
+ /**
+ * Open a new topia root context for the internal db of t3 (this should be
+ * a h2 db used only for security).
+ *
+ * @param configuration application configuration where to find db directory
+ * @return the new fresh root context of the internal db
+ */
+ public static TopiaContext newInternalDb(EchoBaseConfiguration configuration) {
+
+ Properties result = loadInternalDbconfiguration(configuration);
+ return newDb(result);
+ }
+
+ protected static void loadProperties(Properties result, String path, String entities) {
+ URL dbConfigFile =
+ EchobaseTopiaContexts.class.getResource(path);
+
+ try {
+ InputStreamReader reader =
+ new InputStreamReader(dbConfigFile.openStream(),
+ Charsets.UTF_8);
+ try {
+ result.load(reader);
+ // add entities mapping
+ result.put(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
+ entities
+ );
+ } finally {
+ reader.close();
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException(
+ "Could not load database configuration from " + path, e);
+ }
+ }
+
+ /**
+ * Open a new topia root context from given configuration.
+ *
+ * @param configuration topia configuration
+ * @return the new fresh root context
+ */
+ public static TopiaContext newDb(Properties configuration) {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Starts a db at : " +
+ configuration.get(TopiaContextFactory.CONFIG_URL));
+ }
+ TopiaContext result = TopiaContextFactory.getContext(configuration);
+ return result;
+ } catch (TopiaNotFoundException e) {
+ throw new TopiaRuntimeException("Could not init db", e);
+ }
+ }
+
+ public static void reloadProperty(Properties properties, String propertyName, String propertyNameToRemove) {
+ Object o = properties.getProperty(propertyName);
+ properties.put(propertyName, o);
+ properties.remove(propertyNameToRemove);
+ }
+
+ public static String getDbUrl(TopiaContext rootContext) {
+ String result = (String) ((TopiaContextImplementor) rootContext).getConfig().get(TopiaContextFactory.CONFIG_URL);
+ return result;
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java (from rev 584, trunk/echobase-entities/src/main/java/fr/ifremer/echobase/JdbcConfiguration.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,113 @@
+/*
+ * #%L
+ * T3 :: Domain
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.persistence;
+
+import java.io.File;
+import java.io.Serializable;
+
+public class JdbcConfiguration implements Serializable {
+
+ public enum DriverType {
+ H2,
+ POSTGRESQL
+ }
+
+ public static JdbcConfiguration newConfig(String url,
+ String login,
+ String password,
+ DriverType driverType) {
+ JdbcConfiguration result = new JdbcConfiguration();
+ result.setUrl(url);
+ result.setLogin(login);
+ result.setPassword(password);
+ result.setDriverType(driverType);
+ return result;
+ }
+
+ public static JdbcConfiguration newEmbeddedConfig(File directory) {
+
+ File databaseFile = new File(directory, "db");
+
+ String databaseAbsolutePath = databaseFile.getAbsolutePath();
+ String url = "jdbc:h2:file:" + databaseAbsolutePath +
+ "/echobase;LOG=0;CACHE_SIZE=65536;LOCK_MODE=0;UNDO_LOG=0";
+ JdbcConfiguration result = newConfig(url, "sa", "sa", DriverType.H2);
+ return result;
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_URL = "url";
+
+ public static final String PROPERTY_LOGIN = "login";
+
+ public static final String PROPERTY_PASSWORD = "password";
+
+ /** Jdbc url. */
+ protected String url;
+
+ /** Jdbc login */
+ protected String login;
+
+ /** Jdbc password */
+ protected String password;
+
+ /** Jdbc driver. */
+ protected DriverType driverType;
+
+ private JdbcConfiguration() {
+ // avoid constructor (use the static factory methods)
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public DriverType getDriverType() {
+ return driverType;
+ }
+
+ public void setDriverType(DriverType driverType) {
+ this.driverType = driverType;
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,197 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services;
+
+import org.nuiton.util.StringUtil;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * Abstract long action configuration.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public abstract class AbstractEchobaseActionConfiguration implements Serializable, ProgressionModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private final ProgressionModel progressionModel;
+
+ private Exception error;
+
+ protected AbstractEchobaseActionConfiguration() {
+ progressionModel = new DefaultProgressionModel();
+ }
+
+ protected AbstractEchobaseActionConfiguration(ProgressionModel progressionModel) {
+ this.progressionModel = progressionModel;
+ }
+
+ @Override
+ public final long getNbSteps() {
+ return progressionModel.getNbSteps();
+ }
+
+ @Override
+ public final float getProgression() {
+ return progressionModel.getProgression();
+ }
+
+ @Override
+ public final void setProgression(float progression) {
+ progressionModel.setProgression(progression);
+ }
+
+ @Override
+ public final void incrementsProgression() {
+ progressionModel.incrementsProgression();
+ }
+
+ @Override
+ public final void setNbSteps(long nbSteps) {
+ progressionModel.setNbSteps(nbSteps);
+ }
+
+ @Override
+ public final long getStartTime() {
+ return progressionModel.getStartTime();
+ }
+
+ @Override
+ public final void setStartTime(long startTime) {
+ progressionModel.setStartTime(startTime);
+ }
+
+ @Override
+ public final long getEndTime() {
+ return progressionModel.getEndTime();
+ }
+
+ @Override
+ public final void setEndTime(long endTime) {
+ progressionModel.setEndTime(endTime);
+ }
+
+ public Exception getError() {
+ return error;
+ }
+
+ public void setError(Exception error) {
+ this.error = error;
+ }
+
+ @Override
+ public String getActionTime() {
+ return progressionModel.getActionTime();
+ }
+
+ public void beginAction() {
+ setStartTime(System.nanoTime());
+ }
+
+ public void endAction() {
+ setEndTime(System.nanoTime());
+ }
+
+ public void destroy() throws IOException {
+ }
+
+ /**
+ * Default progression model implementation.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+ public static class DefaultProgressionModel implements ProgressionModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private long nbSteps;
+
+ private float stepIncrement;
+
+ private float progression;
+
+ private long startTime;
+
+ private long endTime;
+
+ @Override
+ public long getNbSteps() {
+ return nbSteps;
+ }
+
+ @Override
+ public float getProgression() {
+ return progression;
+ }
+
+ @Override
+ public void setProgression(float progression) {
+ this.progression = progression;
+ }
+
+ @Override
+ public long getStartTime() {
+ return startTime;
+ }
+
+ @Override
+ public void setStartTime(long startTime) {
+ this.startTime = startTime;
+ }
+
+ @Override
+ public long getEndTime() {
+ return endTime;
+ }
+
+
+ @Override
+ public void setEndTime(long endTime) {
+ this.endTime = endTime;
+ }
+
+ @Override
+ public final void incrementsProgression() {
+ setProgression(progression + stepIncrement);
+ }
+
+ @Override
+ public final void setNbSteps(long nbSteps) {
+
+ this.nbSteps = nbSteps;
+ stepIncrement = 100f / nbSteps;
+ }
+
+ @Override
+ public String getActionTime() {
+ long sTime = getStartTime();
+ long eTime = getEndTime();
+ return StringUtil.convertTime(eTime - sTime);
+ }
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java (from rev 574, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,186 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
+import org.apache.commons.lang3.time.DateUtils;
+import org.nuiton.topia.TopiaContext;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Instances of this class will be given to service factory.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class DefaultEchoBaseServiceContext implements EchoBaseServiceContext {
+
+ protected TopiaContext internalTransaction;
+
+ protected TopiaContext transaction;
+
+ protected ServiceFactory serviceFactory;
+
+ protected EchoBaseConfiguration configuration;
+
+ protected Locale locale;
+
+ protected EchoBaseDbMeta dbMeta;
+
+ public static EchoBaseServiceContext newContext(
+ EchoBaseServiceContext serviceContext,
+ TopiaContext internalTransaction,
+ TopiaContext transaction) {
+ return newContext(serviceContext.getLocale(),
+ internalTransaction,
+ transaction,
+ serviceContext.getConfiguration(),
+ serviceContext.getDbMeta()
+ );
+ }
+
+ public static EchoBaseServiceContext newContext(
+ Locale locale,
+ TopiaContext internalTransaction,
+ TopiaContext transaction,
+ EchoBaseConfiguration configuration,
+ EchoBaseDbMeta dbMeta) {
+ return new DefaultEchoBaseServiceContext(locale,
+ internalTransaction,
+ transaction,
+ configuration,
+ dbMeta
+ );
+ }
+
+ protected DefaultEchoBaseServiceContext(Locale locale,
+ TopiaContext internalTransaction,
+ TopiaContext transaction,
+ EchoBaseConfiguration configuration,
+ EchoBaseDbMeta dbMeta) {
+ this.locale = locale;
+ this.internalTransaction = internalTransaction;
+ this.transaction = transaction;
+ this.configuration = configuration;
+ this.dbMeta = dbMeta;
+ this.serviceFactory = new ServiceFactory();
+ }
+
+ @Override
+ public TopiaContext getInternalTransaction() {
+ return internalTransaction;
+ }
+
+ @Override
+ public void setInternalTransaction(TopiaContext internalTransaction) {
+ this.internalTransaction = internalTransaction;
+ }
+
+ @Override
+ public TopiaContext getTransaction() {
+ Preconditions.checkNotNull(transaction);
+ return transaction;
+ }
+
+ @Override
+ public void setTransaction(TopiaContext transaction) {
+ this.transaction = transaction;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public Date newDate() {
+ Date result = new Date();
+ DateUtils.setMilliseconds(result, 0);
+ return result;
+ }
+
+ @Override
+ public EchoBaseConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ @Override
+ public EchoBaseDbMeta getDbMeta() {
+ return dbMeta;
+ }
+
+ @Override
+ public final <E extends EchoBaseService> E getService(Class<E> serviceClass) {
+ return serviceFactory.getService(serviceClass, this);
+ }
+
+ public static class ServiceFactory {
+
+ protected Map<Class<?>, EchoBaseService> services;
+
+ public final <E extends EchoBaseService> E getService(Class<E> serviceClass,
+ EchoBaseServiceContext serviceContext) {
+ if (services == null) {
+ services = Maps.newHashMap();
+ }
+ E service = (E) services.get(serviceClass);
+ if (service == null) {
+ service = newService(serviceClass, serviceContext);
+ services.put(serviceClass, service);
+ }
+ return service;
+ }
+
+ public <E extends EchoBaseService> E newService(Class<E> clazz,
+ EchoBaseServiceContext serviceContext) {
+ // instantiate service using empty constructor
+ E service;
+ try {
+ service = clazz.getConstructor().newInstance();
+ } catch (InstantiationException e) {
+ throw new EchoBaseTechnicalException(e);
+ } catch (IllegalAccessException e) {
+ throw new EchoBaseTechnicalException(e);
+ } catch (InvocationTargetException e) {
+ throw new EchoBaseTechnicalException(e);
+ } catch (NoSuchMethodException e) {
+ throw new EchoBaseTechnicalException(e);
+ }
+
+ service.setServiceContext(serviceContext);
+
+ return service;
+ }
+
+ }
+
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,39 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.echobase.services;
+
+/**
+ * Contract to place on each EchoBase service to push the {@code serviceContext}
+ * inside the service.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @see EchoBaseServiceContext
+ * @since 0.1
+ */
+public interface EchoBaseService {
+
+ void setServiceContext(EchoBaseServiceContext serviceContext);
+
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java (from rev 574, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,88 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.echobase.services;
+
+import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
+import org.nuiton.topia.TopiaContext;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * This contract represents objects you must provide when asking for a service.
+ * Objects provided may be injected in services returned by
+ * {@link ServiceFactoryAware#getService(Class)}
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public interface EchoBaseServiceContext extends ServiceFactoryAware {
+
+ /**
+ * Get the internal db current transaction.
+ * <p/>
+ * Internal db is the db with everything but not any echobase data
+ * (security, db connexion, sql queries ?).
+ *
+ * @return current internal db transaction
+ */
+ TopiaContext getInternalTransaction();
+
+ /**
+ * Set the internal db current transaction.
+ *
+ * @param transaction internal db transaction to set
+ */
+ void setInternalTransaction(TopiaContext transaction);
+
+ /**
+ * Get the working db transaction.
+ * <p/>
+ * Working db contains echobase data, but nothing about technical
+ * stuff (security, connexon,...).
+ * <p/>
+ * This transaction can be {@code null} if no working db is used.
+ *
+ * @return the current working db transaction (or {@code null} if not setted)
+ */
+ TopiaContext getTransaction();
+
+ /**
+ * Set the working db transaction.
+ *
+ * @param transaction working db transaction to set
+ */
+ void setTransaction(TopiaContext transaction);
+
+ Locale getLocale();
+
+ EchoBaseConfiguration getConfiguration();
+
+ EchoBaseDbMeta getDbMeta();
+
+ Date newDate();
+
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java (from rev 574, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,198 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services;
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.echobase.EchoBaseConfiguration;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
+import fr.ifremer.echobase.entities.EchoBaseInternalDAOHelper;
+import fr.ifremer.echobase.entities.EchobaseInternalEntity;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author sletellier <letellier(a)codelutin.com>
+ * @since 0.1
+ */
+public class EchoBaseServiceSupport implements EchoBaseService {
+
+ protected EchoBaseServiceContext serviceContext;
+
+ @Override
+ public void setServiceContext(EchoBaseServiceContext serviceContext) {
+ this.serviceContext = serviceContext;
+ }
+
+ public final <E extends TopiaEntity> List<E> getEntities(Class<E> entityType) {
+ Preconditions.checkNotNull(entityType);
+ try {
+ List<E> result = getDAO(entityType).findAll();
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(
+ "Could not obtain data for type " + entityType, eee);
+ }
+ }
+
+ public final <E extends TopiaEntity> long countEntities(Class<E> entityType) {
+ Preconditions.checkNotNull(entityType);
+ try {
+ long result = getDAO(entityType).count();
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(
+ "Could not count data for type " + entityType, eee);
+ }
+ }
+
+ public final <E extends TopiaEntity> E getEntityById(Class<E> entityType, String id) {
+ Preconditions.checkNotNull(entityType);
+ Preconditions.checkArgument(StringUtils.isNotEmpty(id));
+ try {
+ E result = getDAO(entityType).findByTopiaId(id);
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(
+ "Could not obtain data of id [" + id + "] for type " +
+ entityType, eee);
+ }
+ }
+
+ public final <E extends TopiaEntity> E getEntityByProperty(Class<E> entityType,
+ String propertyId,
+ Object propertyValue) {
+ Preconditions.checkNotNull(entityType);
+ Preconditions.checkArgument(StringUtils.isNotEmpty(propertyId));
+ try {
+ E result = getDAO(entityType).findByProperty(propertyId, propertyValue);
+ return result;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(
+ "Could not obtain data of property [" + propertyId + "] for type " +
+ entityType, eee);
+ }
+ }
+
+ public TopiaContext getInternalTransaction() {
+ return serviceContext.getInternalTransaction();
+ }
+
+ protected final TopiaContext getTransaction() {
+ return serviceContext.getTransaction();
+ }
+
+ protected final Locale getLocale() {
+ return serviceContext.getLocale();
+ }
+
+ protected final EchoBaseDbMeta getDbMeta() {
+ return serviceContext.getDbMeta();
+ }
+
+ protected final EchoBaseConfiguration getConfiguration() {
+ return serviceContext.getConfiguration();
+ }
+
+ protected final Date newDate() {
+ return serviceContext.newDate();
+ }
+
+ protected char getCsvSeparator() {
+ return getConfiguration().getCsvSeparator();
+ }
+
+ public final <E extends EchoBaseService> E getService(Class<E> serviceClass) {
+ E result = serviceContext.getService(serviceClass);
+ return result;
+ }
+
+// protected final <E extends TopiaEntity> TopiaDAO<E> getDAO(EchoBaseEntityEnum entityEnum) {
+// TopiaDAO<E> dao = getDAO((Class<E>) entityEnum.getContract());
+// return dao;
+// }
+
+ protected final <E extends TopiaEntity> TopiaDAO<E> getDAO(Class<E> entityType) {
+ try {
+ TopiaContext tx = getTransaction(entityType);
+ TopiaDAO<E> dao;
+ if (EchobaseInternalEntity.class.isAssignableFrom(entityType)) {
+ dao = EchoBaseInternalDAOHelper.<E, TopiaDAO<E>>getDAO(tx, entityType);
+ } else {
+ dao = EchoBaseDAOHelper.<E, TopiaDAO<E>>getDAO(tx, entityType);
+ }
+
+ return dao;
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException("Could not obtain dao for type " + entityType, e);
+ }
+ }
+
+ protected final <E extends TopiaEntity, D extends TopiaDAO<E>> D getDAO(Class<E> entityType, Class<D> daoType) {
+ TopiaDAO<E> dao = getDAO(entityType);
+ Preconditions.checkState(daoType.isAssignableFrom(dao.getClass()));
+ return (D) dao;
+ }
+
+ public final void commitTransaction(String errorMessage) {
+ try {
+ getTransaction().commitTransaction();
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(errorMessage, eee);
+ }
+ }
+
+ public final void commitInternalTransaction(String errorMessage) {
+ try {
+ getInternalTransaction().commitTransaction();
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(errorMessage, eee);
+ }
+ }
+
+ protected final void flushTransaction() throws TopiaException {
+ TopiaContextImplementor tx = (TopiaContextImplementor) getTransaction();
+ tx.getHibernate().flush();
+ }
+
+ protected <E extends TopiaEntity> TopiaContext getTransaction(Class<E> entitytype) {
+ TopiaContext result;
+ if (EchobaseInternalEntity.class.isAssignableFrom(entitytype)) {
+ result = getInternalTransaction();
+ } else {
+ result = getTransaction();
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java)
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,55 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services;
+
+import java.io.Serializable;
+
+/**
+ * Contract for a progression model while long service actions.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public interface ProgressionModel extends Serializable {
+
+ long getNbSteps();
+
+ float getProgression();
+
+ void setProgression(float progression);
+
+ void incrementsProgression();
+
+ void setNbSteps(long nbSteps);
+
+ long getStartTime();
+
+ void setStartTime(long startTime);
+
+ long getEndTime();
+
+ void setEndTime(long endTime);
+
+ String getActionTime();
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,13 @@
+package fr.ifremer.echobase.services;
+
+/**
+ * Contract to provide some services.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public interface ServiceFactoryAware {
+
+ <S extends EchoBaseService> S getService(Class<S> serviceClass);
+
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/echobase-entities/src/main/resources/echobase-datadb.properties
===================================================================
--- trunk/echobase-entities/src/main/resources/echobase-datadb.properties 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/resources/echobase-datadb.properties 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,39 +0,0 @@
-###
-# #%L
-# T3 :: Domain
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# #L%
-###
-# DB configuration
-hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
-hibernate.connection.driver_class=org.postgresql.Driver
-hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider
-hibernate.show_sql=false
-hibernate.format_sql=false
-hibernate.use_sql_comments=false
-hibernate.hbm2ddl.auto=none
-hibernate.connection.username=${configuration.login}
-hibernate.connection.password=${configuration.password}
-hibernate.connection.url=${configuration.url}
-
-# Migration configuration
-topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
-topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
-topia.service.migration.showSql=true
-
Copied: trunk/echobase-entities/src/main/resources/echobase-workingdb.properties (from rev 584, trunk/echobase-entities/src/main/resources/echobase-datadb.properties)
===================================================================
--- trunk/echobase-entities/src/main/resources/echobase-workingdb.properties (rev 0)
+++ trunk/echobase-entities/src/main/resources/echobase-workingdb.properties 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,39 @@
+###
+# #%L
+# T3 :: Domain
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# #L%
+###
+# DB configuration
+hibernate.show_sql=false
+hibernate.format_sql=false
+hibernate.use_sql_comments=false
+hibernate.hbm2ddl.auto=none
+hibernate.connection.username=${configuration.login}
+hibernate.connection.password=${configuration.password}
+hibernate.connection.url=${configuration.url}
+hibernate.connection.driver_class=${configuration.driver}
+hibernate.dialect=${configuration.dialect}
+hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider
+
+# Migration configuration
+#topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
+#topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
+#topia.service.migration.showSql=true
+
Property changes on: trunk/echobase-entities/src/main/resources/echobase-workingdb.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-entities/src/main/resources/topia-h2.properties
===================================================================
--- trunk/echobase-entities/src/main/resources/topia-h2.properties 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/main/resources/topia-h2.properties 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,31 +0,0 @@
-###
-# #%L
-# EchoBase :: Entities
-#
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2011 Ifremer, Codelutin
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# #L%
-###
-hibernate.hbm2ddl.auto=update
-hibernate.show_sql=false
-
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.connection.driver_class=org.h2.Driver
-hibernate.connection.username=sa
-hibernate.connection.password=sa
-hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider
Modified: trunk/echobase-entities/src/main/xmi/echobase-internal.zargo
===================================================================
(Binary files differ)
Modified: trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java
===================================================================
--- trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -60,10 +60,10 @@
@Test
public void testConvertFromBeanUtilsConverterWithOur() throws Exception {
-
+
EchoBaseDateConverter.initDateConverter();
EntityModificationLog bean = new EntityModificationLogImpl();
- BeanUtils.setProperty(bean,EntityModificationLog.PROPERTY_MODIFICATION_DATE, DATE);
+ BeanUtils.setProperty(bean, EntityModificationLog.PROPERTY_MODIFICATION_DATE, DATE);
Date date = bean.getModificationDate();
assertDate(date);
}
@@ -73,12 +73,12 @@
Assert.assertTrue(date instanceof Date);
Calendar calendar = Calendar.getInstance();
calendar.setTime((Date) date);
- Assert.assertEquals(2011,calendar.get(Calendar.YEAR));
- Assert.assertEquals(10,calendar.get(Calendar.MONTH));
- Assert.assertEquals(8,calendar.get(Calendar.DAY_OF_MONTH));
- Assert.assertEquals(20,calendar.get(Calendar.HOUR_OF_DAY));
- Assert.assertEquals(54,calendar.get(Calendar.MINUTE));
- Assert.assertEquals(59,calendar.get(Calendar.SECOND));
+ Assert.assertEquals(2011, calendar.get(Calendar.YEAR));
+ Assert.assertEquals(10, calendar.get(Calendar.MONTH));
+ Assert.assertEquals(8, calendar.get(Calendar.DAY_OF_MONTH));
+ Assert.assertEquals(20, calendar.get(Calendar.HOUR_OF_DAY));
+ Assert.assertEquals(54, calendar.get(Calendar.MINUTE));
+ Assert.assertEquals(59, calendar.get(Calendar.SECOND));
}
}
Deleted: trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDecoratorProviderTest.java
===================================================================
--- trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDecoratorProviderTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDecoratorProviderTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,78 +0,0 @@
-/*
- * #%L
- * EchoBase :: Entities
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import com.google.common.collect.Lists;
-import fr.ifremer.echobase.entities.EchoBaseDbMetaTest;
-import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.entities.references.Mission;
-import junit.framework.Assert;
-import org.junit.Test;
-import org.nuiton.util.decorator.Decorator;
-
-import java.util.List;
-import java.util.Locale;
-
-/**
- * To test the {@link EchoBaseDecoratorProvider}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class EchoBaseDecoratorProviderTest {
-
- @Test
- public void getDecoratorForReferences() throws Exception {
- Locale locale = Locale.FRANCE;
- EchoBaseDecoratorProvider provider = new EchoBaseDecoratorProvider();
- provider.loadDecorators(locale);
- List<EchoBaseEntityEnum> expectedTypes =
- Lists.newArrayList(EchoBaseDbMetaTest.getContractsOf(
- Mission.class.getPackage()));
-
- for (EchoBaseEntityEnum type : expectedTypes) {
- Decorator<?> decorator =
- provider.getDecoratorByType(locale, type.getContract());
- Assert.assertNotNull("Missing decorator for type : " + type, decorator);
- }
- }
-
- @Test
- public void getDecoratorForData() throws Exception {
- Locale locale = Locale.FRANCE;
- EchoBaseDecoratorProvider provider = new EchoBaseDecoratorProvider();
- provider.loadDecorators(locale);
- List<EchoBaseEntityEnum> expectedTypes =
- Lists.newArrayList(EchoBaseDbMetaTest.getContractsOf(
- Voyage.class.getPackage()));
-
- for (EchoBaseEntityEnum type : expectedTypes) {
- Decorator<?> decorator =
- provider.getDecoratorByType(locale, type.getContract());
- Assert.assertNotNull("Missing decorator for type : " + type, decorator);
- }
- }
-
-}
Deleted: trunk/echobase-entities/src/test/java/fr/ifremer/echobase/entities/EchoBaseDbMetaTest.java
===================================================================
--- trunk/echobase-entities/src/test/java/fr/ifremer/echobase/entities/EchoBaseDbMetaTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-entities/src/test/java/fr/ifremer/echobase/entities/EchoBaseDbMetaTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,107 +0,0 @@
-/*
- * #%L
- * EchoBase :: Entities
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.entities;
-
-import com.google.common.collect.Lists;
-import fr.ifremer.echobase.entities.data.Voyage;
-import fr.ifremer.echobase.entities.references.Mission;
-import junit.framework.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * To test the class {@link EchoBaseDbMeta}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class EchoBaseDbMetaTest {
-
-
- protected EchoBaseDbMeta dbMetas;
-
- @Before
- public void setUp() throws Exception {
- dbMetas = EchoBaseDbMeta.newDbMeta();
- }
-
-
- @Test
- public void getReferenceTypes() {
-
- List<EchoBaseEntityEnum> types =
- dbMetas.getReferenceTypes();
-
- List<EchoBaseEntityEnum> expectedTypes =
- Lists.newArrayList(getContractsOf(Mission.class.getPackage()));
-
- Assert.assertNotNull(types);
-
- for (EchoBaseEntityEnum type : expectedTypes) {
- Assert.assertTrue("Missing type : " + type, types.contains(type));
- }
- Assert.assertEquals(expectedTypes.size(), types.size());
- }
-
- @Test
- public void getDataTypes() {
-
- List<EchoBaseEntityEnum> types =
- dbMetas.getDataTypes();
-
- List<EchoBaseEntityEnum> expectedTypes =
- Lists.newArrayList(getContractsOf(Voyage.class.getPackage()));
-
- Assert.assertNotNull(types);
-
- for (EchoBaseEntityEnum type : expectedTypes) {
- Assert.assertTrue("Missing type : " + type, types.contains(type));
- }
- Assert.assertEquals(expectedTypes.size(), types.size());
- }
-
- /**
- * Used to get all contract of a package
- *
- * @param entitiesPackage package contening desired entities
- * @return contracts contained in entitiesPackage
- */
- public static EchoBaseEntityEnum[] getContractsOf(Package entitiesPackage) {
- EchoBaseEntityEnum[] echoBaseEntityEnums = EchoBaseEntityEnum.values();
- List<EchoBaseEntityEnum> refClasses = new ArrayList<EchoBaseEntityEnum>();
- for (EchoBaseEntityEnum echoBaseEntityEnum : echoBaseEntityEnums) {
-
- // Get all entities in package fr.ifremer.echobase.entities.references
- Class<? extends TopiaEntity> contract = echoBaseEntityEnum.getContract();
- if (entitiesPackage.equals(contract.getPackage())) {
- refClasses.add(echoBaseEntityEnum);
- }
- }
- return refClasses.toArray(new EchoBaseEntityEnum[refClasses.size()]);
- }
-}
Copied: trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java (from rev 573, trunk/echobase-entities/src/test/java/fr/ifremer/echobase/entities/EchoBaseDbMetaTest.java)
===================================================================
--- trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java (rev 0)
+++ trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,108 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.persistence;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.references.Mission;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * To test the class {@link EchoBaseDbMeta}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class EchoBaseDbMetaTest {
+
+
+ protected EchoBaseDbMeta dbMetas;
+
+ @Before
+ public void setUp() throws Exception {
+ dbMetas = EchoBaseDbMeta.newDbMeta();
+ }
+
+
+ @Test
+ public void getReferenceTypes() {
+
+ List<EchoBaseEntityEnum> types =
+ dbMetas.getReferenceTypes();
+
+ List<EchoBaseEntityEnum> expectedTypes =
+ Lists.newArrayList(getContractsOf(Mission.class.getPackage()));
+
+ Assert.assertNotNull(types);
+
+ for (EchoBaseEntityEnum type : expectedTypes) {
+ Assert.assertTrue("Missing type : " + type, types.contains(type));
+ }
+ Assert.assertEquals(expectedTypes.size(), types.size());
+ }
+
+ @Test
+ public void getDataTypes() {
+
+ List<EchoBaseEntityEnum> types =
+ dbMetas.getDataTypes();
+
+ List<EchoBaseEntityEnum> expectedTypes =
+ Lists.newArrayList(getContractsOf(Voyage.class.getPackage()));
+
+ Assert.assertNotNull(types);
+
+ for (EchoBaseEntityEnum type : expectedTypes) {
+ Assert.assertTrue("Missing type : " + type, types.contains(type));
+ }
+ Assert.assertEquals(expectedTypes.size(), types.size());
+ }
+
+ /**
+ * Used to get all contract of a package
+ *
+ * @param entitiesPackage package contening desired entities
+ * @return contracts contained in entitiesPackage
+ */
+ public static EchoBaseEntityEnum[] getContractsOf(Package entitiesPackage) {
+ EchoBaseEntityEnum[] echoBaseEntityEnums = EchoBaseEntityEnum.values();
+ List<EchoBaseEntityEnum> refClasses = new ArrayList<EchoBaseEntityEnum>();
+ for (EchoBaseEntityEnum echoBaseEntityEnum : echoBaseEntityEnums) {
+
+ // Get all entities in package fr.ifremer.echobase.entities.references
+ Class<? extends TopiaEntity> contract = echoBaseEntityEnum.getContract();
+ if (entitiesPackage.equals(contract.getPackage())) {
+ refClasses.add(echoBaseEntityEnum);
+ }
+ }
+ return refClasses.toArray(new EchoBaseEntityEnum[refClasses.size()]);
+ }
+}
Property changes on: trunk/echobase-entities/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseIOUtil.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseIOUtil.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseIOUtil.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,140 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.nuiton.util.ZipUtil;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.util.Collection;
-
-/**
- * Usefull methods on io.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class EchoBaseIOUtil {
-
- public static void compressZipFile(File zipFile, File directory) throws IOException {
- compressZipFile(zipFile, directory, true);
- }
-
- public static void compressZipFile(File zipFile, File directory, boolean delete) throws IOException {
- try {
- ZipUtil.compress(zipFile, directory);
- } catch (IOException eee) {
- throw new EchoBaseTechnicalException(
- "Can not create zip file " + zipFile, eee);
- } finally {
- if (delete) {
- FileUtils.deleteDirectory(directory);
- }
- }
- }
-
- public static void copyFile(File destinationFile,
- Collection<File> filesToMerge) throws IOException {
- if (!CollectionUtils.isEmpty(filesToMerge)) {
-
- if (filesToMerge.size() == 1) {
-
- // simple copy
- FileUtils.copyFile(filesToMerge.iterator().next(), destinationFile);
- } else {
-
- // must merge all files
- mergeFiles(destinationFile, filesToMerge);
- }
- }
- }
-
- public static void mergeFiles(File destination,
- Iterable<File> fileToMerges) throws IOException {
-
- BufferedWriter writer = new BufferedWriter(new FileWriter(destination));
- try {
- boolean firstLine = false;
- for (File toMergeFile : fileToMerges) {
- BufferedReader reader = new BufferedReader(new FileReader(toMergeFile));
- try {
- // pass the first line (header)
- String line = reader.readLine();
- if (!firstLine) {
-
- // add the csv header
- writer.write(line);
-
- firstLine = true;
- }
- while ((line = reader.readLine()) != null) {
- writer.newLine();
- writer.write(line);
- }
- } finally {
- reader.close();
- }
-
- }
- } finally {
- writer.close();
- }
- }
-
- public static int countLines(File file) {
- int result = 0;
-
- LineNumberReader reader = null;
- try {
- reader = new LineNumberReader(
- new InputStreamReader(FileUtils.openInputStream(file))
- );
- while (reader.readLine() != null) {
- }
- result = reader.getLineNumber();
- reader.close();
-
- } catch (IOException e) {
- throw new EchoBaseTechnicalException(
- "Could not count lines of file " + file, e);
- } finally {
- if (reader != null) {
- IOUtils.closeQuietly(reader);
- }
- }
- return result;
- }
-
- protected EchoBaseIOUtil() {
- }
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/InputFile.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/InputFile.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/InputFile.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,94 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase;
-
-import java.io.File;
-import java.io.Serializable;
-
-/**
- * Object to receive a uploaded file.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public class InputFile implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /** Name of the file (from the client side). */
- protected String fileName;
-
- /** Location of the uploaded file (from the server side). */
- protected File file;
-
- /** Content type of the uploaded file. */
- protected String contentType;
-
- /** Label of the import. */
- protected String label;
-
- public static InputFile newFile(String label) {
- return new InputFile(label);
- }
-
- protected InputFile(String label) {
- this.label = label;
- }
-
- public String getFileName() {
- return fileName;
- }
-
- public File getFile() {
- return file;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public boolean hasFile() {
- return file != null;
- }
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,197 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services;
-
-import org.nuiton.util.StringUtil;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * Abstract long action configuration.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.2
- */
-public abstract class AbstractEchobaseActionConfiguration implements Serializable, ProgressionModel {
-
- private static final long serialVersionUID = 1L;
-
- private final ProgressionModel progressionModel;
-
- private Exception error;
-
- protected AbstractEchobaseActionConfiguration() {
- progressionModel = new DefaultProgressionModel();
- }
-
- protected AbstractEchobaseActionConfiguration(ProgressionModel progressionModel) {
- this.progressionModel = progressionModel;
- }
-
- @Override
- public final long getNbSteps() {
- return progressionModel.getNbSteps();
- }
-
- @Override
- public final float getProgression() {
- return progressionModel.getProgression();
- }
-
- @Override
- public final void setProgression(float progression) {
- progressionModel.setProgression(progression);
- }
-
- @Override
- public final void incrementsProgression() {
- progressionModel.incrementsProgression();
- }
-
- @Override
- public final void setNbSteps(long nbSteps) {
- progressionModel.setNbSteps(nbSteps);
- }
-
- @Override
- public final long getStartTime() {
- return progressionModel.getStartTime();
- }
-
- @Override
- public final void setStartTime(long startTime) {
- progressionModel.setStartTime(startTime);
- }
-
- @Override
- public final long getEndTime() {
- return progressionModel.getEndTime();
- }
-
- @Override
- public final void setEndTime(long endTime) {
- progressionModel.setEndTime(endTime);
- }
-
- public Exception getError() {
- return error;
- }
-
- public void setError(Exception error) {
- this.error = error;
- }
-
- @Override
- public String getActionTime() {
- return progressionModel.getActionTime();
- }
-
- public void beginAction() {
- setStartTime(System.nanoTime());
- }
-
- public void endAction() {
- setEndTime(System.nanoTime());
- }
-
- public void destroy() throws IOException {
- }
-
- /**
- * Default progression model implementation.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
- public static class DefaultProgressionModel implements ProgressionModel {
-
- private static final long serialVersionUID = 1L;
-
- private long nbSteps;
-
- private float stepIncrement;
-
- private float progression;
-
- private long startTime;
-
- private long endTime;
-
- @Override
- public long getNbSteps() {
- return nbSteps;
- }
-
- @Override
- public float getProgression() {
- return progression;
- }
-
- @Override
- public void setProgression(float progression) {
- this.progression = progression;
- }
-
- @Override
- public long getStartTime() {
- return startTime;
- }
-
- @Override
- public void setStartTime(long startTime) {
- this.startTime = startTime;
- }
-
- @Override
- public long getEndTime() {
- return endTime;
- }
-
-
- @Override
- public void setEndTime(long endTime) {
- this.endTime = endTime;
- }
-
- @Override
- public final void incrementsProgression() {
- setProgression(progression + stepIncrement);
- }
-
- @Override
- public final void setNbSteps(long nbSteps) {
-
- this.nbSteps = nbSteps;
- stepIncrement = 100f / nbSteps;
- }
-
- @Override
- public String getActionTime() {
- long sTime = getStartTime();
- long eTime = getEndTime();
- return StringUtil.convertTime(eTime - sTime);
- }
- }
-}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -30,6 +30,7 @@
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EntityModificationLog;
+import fr.ifremer.echobase.entities.EntityModificationLogDAO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -131,7 +132,7 @@
List<E> result;
EchoBaseEntityEnum entityEnum = tableMeta.getSource();
try {
- TopiaDAO<E> dao = getDAO(entityEnum);
+ TopiaDAO<E> dao = (TopiaDAO<E>) getDAO(entityEnum.getContract());
// first query to count datas
TopiaQuery countQuery = dao.createQuery("e");
@@ -355,7 +356,7 @@
String id = entity.getTopiaId();
try {
- TopiaDAO<TopiaEntity> dao = getDAO(tableMeta.getSource());
+ TopiaDAO<?> dao = getDAO(tableMeta.getSource().getContract());
TopiaEntity entityToSave;
@@ -436,8 +437,7 @@
if (monitor == null) {
// no monitor, means this is a creation of an object
- buffer.append(l_(
- l, "echobase.info.newEntityCreated", topiaId));
+ buffer.append(l_(l, "echobase.info.newEntityCreated", topiaId));
} else {
PropertyDiff[] propertyDiffs = monitor.getPropertyDiffs();
@@ -483,8 +483,8 @@
}
}
- TopiaDAO<EntityModificationLog> dao =
- getDAO(EntityModificationLog.class);
+ EntityModificationLogDAO dao =
+ getDAO(EntityModificationLog.class, EntityModificationLogDAO.class);
dao.create(
EntityModificationLog.PROPERTY_ENTITY_TYPE, tableMeta.getSource().name(),
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -26,7 +26,64 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import fr.ifremer.echobase.EchoBaseDecoratorProvider;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.ExportQuery;
+import fr.ifremer.echobase.entities.WorkingDbConfiguration;
+import fr.ifremer.echobase.entities.data.Category;
+import fr.ifremer.echobase.entities.data.Cell;
+import fr.ifremer.echobase.entities.data.Data;
+import fr.ifremer.echobase.entities.data.DataAcquisition;
+import fr.ifremer.echobase.entities.data.DataProcessing;
+import fr.ifremer.echobase.entities.data.Echotype;
+import fr.ifremer.echobase.entities.data.GearMetadataValue;
+import fr.ifremer.echobase.entities.data.LengthAgeKey;
+import fr.ifremer.echobase.entities.data.LengthWeightKey;
+import fr.ifremer.echobase.entities.data.Operation;
+import fr.ifremer.echobase.entities.data.OperationMetadataValue;
+import fr.ifremer.echobase.entities.data.Result;
+import fr.ifremer.echobase.entities.data.Sample;
+import fr.ifremer.echobase.entities.data.SampleData;
+import fr.ifremer.echobase.entities.data.Transect;
+import fr.ifremer.echobase.entities.data.Transit;
+import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.references.AcousticInstrument;
+import fr.ifremer.echobase.entities.references.AgeCategory;
+import fr.ifremer.echobase.entities.references.AreaOfOperation;
+import fr.ifremer.echobase.entities.references.Calibration;
+import fr.ifremer.echobase.entities.references.CategoryMeaning;
+import fr.ifremer.echobase.entities.references.CategoryRef;
+import fr.ifremer.echobase.entities.references.CategoryType;
+import fr.ifremer.echobase.entities.references.CellMethod;
+import fr.ifremer.echobase.entities.references.CellType;
+import fr.ifremer.echobase.entities.references.DataMetadata;
+import fr.ifremer.echobase.entities.references.DataProtocol;
+import fr.ifremer.echobase.entities.references.DataQuality;
+import fr.ifremer.echobase.entities.references.DataType;
+import fr.ifremer.echobase.entities.references.DepthStratum;
+import fr.ifremer.echobase.entities.references.EchotypeCategory;
+import fr.ifremer.echobase.entities.references.Gear;
+import fr.ifremer.echobase.entities.references.GearCharacteristic;
+import fr.ifremer.echobase.entities.references.GearCharacteristicValue;
+import fr.ifremer.echobase.entities.references.GearMetadata;
+import fr.ifremer.echobase.entities.references.Impacte;
+import fr.ifremer.echobase.entities.references.MeasureType;
+import fr.ifremer.echobase.entities.references.MeasurementMetadata;
+import fr.ifremer.echobase.entities.references.Mission;
+import fr.ifremer.echobase.entities.references.OperationEvent;
+import fr.ifremer.echobase.entities.references.OperationMetadata;
+import fr.ifremer.echobase.entities.references.ReferenceDatum;
+import fr.ifremer.echobase.entities.references.ReferenceDatumType;
+import fr.ifremer.echobase.entities.references.ReferencingMethod;
+import fr.ifremer.echobase.entities.references.SampleDataType;
+import fr.ifremer.echobase.entities.references.SampleType;
+import fr.ifremer.echobase.entities.references.SexCategory;
+import fr.ifremer.echobase.entities.references.SizeCategory;
+import fr.ifremer.echobase.entities.references.Species;
+import fr.ifremer.echobase.entities.references.SpeciesCategory;
+import fr.ifremer.echobase.entities.references.Strata;
+import fr.ifremer.echobase.entities.references.TSParameters;
+import fr.ifremer.echobase.entities.references.Vessel;
+import fr.ifremer.echobase.entities.references.VesselType;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.util.decorator.Decorator;
@@ -111,4 +168,186 @@
return decorator;
}
+ static class EchoBaseDecoratorProvider extends DecoratorMulti18nProvider {
+
+ @Override
+ protected void loadDecorators(Locale locale) {
+
+ // EchoBaseUser decorator
+ registerJXPathDecorator(locale, EchoBaseUser.class, "${email}$s");
+
+ // ExportQuery decorator
+ registerJXPathDecorator(locale, ExportQuery.class, "${name}$s - ${description}$s");
+
+ // WorkingDbConfiguration decorator
+ registerJXPathDecorator(locale, WorkingDbConfiguration.class, "${url}$s - ${login}$s (${description}$s)");
+
+ // AcousticInstrument decorator
+ registerJXPathDecorator(locale, AcousticInstrument.class, "${id}$s");
+
+ // AgeCategory decorator
+ registerJXPathDecorator(locale, AgeCategory.class, "${name}$s");
+
+ // AreaOfOperation decorator
+ registerJXPathDecorator(locale, AreaOfOperation.class, "${name}$s");
+
+ // Calibration decorator
+ registerJXPathDecorator(locale, Calibration.class, "${date}$s - acquisition ${aquisitionMethod}$s");
+
+ // Category decorator
+ registerJXPathDecorator(locale, Category.class, "${echotypeLabel}$s ${speciesLabel}$s ${processedAgeLabel}$s ${processedLengthLabel}$s");
+
+ // CategoryMeaning decorator
+ registerJXPathDecorator(locale, CategoryMeaning.class, "${name}$s");
+
+ // CategoryRef decorator
+ registerJXPathDecorator(locale, CategoryRef.class, "${genusSpecies}$s");
+
+ // CategoryType decorator
+ registerJXPathDecorator(locale, CategoryType.class, "${name}$s");
+
+ // CellMethod decorator
+ registerJXPathDecorator(locale, CellMethod.class, "${name}$s");
+
+ // CellType decorator
+ registerJXPathDecorator(locale, CellType.class, "${name}$s");
+
+ // DataMetadata decorator
+ registerJXPathDecorator(locale, DataMetadata.class, "${name}$s - ${standardName}$s");
+
+ // DataProtocol decorator
+ registerJXPathDecorator(locale, DataProtocol.class, "${description}$s [ ${validSince}$td/%2$tm/%2$tY - ${invalidSince}$td/%3$tm/%3$tY ]");
+
+ // DataQuality decorator
+ registerJXPathDecorator(locale, DataQuality.class, "${qualityDataFlagValues}$s - ${flagMeanings}$s");
+
+ // DataType decorator
+ registerJXPathDecorator(locale, DataType.class, "${name}$s");
+
+ // DepthStratum decorator
+ registerJXPathDecorator(locale, DepthStratum.class, "${id}$s - ${meaning}$s");
+
+ // Echotype decorator
+ registerJXPathDecorator(locale, Echotype.class, "${id}$s - ${name}$s");
+
+ // EchotypeCategory decorator
+ registerJXPathDecorator(locale, EchotypeCategory.class, "${name}$s");
+
+ // Gear decorator
+ registerJXPathDecorator(locale, Gear.class, "${name}$s [ ${validSince}$td/%2$tm/%2$tY - ${invalidSince}$td/%3$tm/%3$tY ]");
+
+ // GearCaracteristic decorator
+ registerJXPathDecorator(locale, GearCharacteristic.class, "${name}$s");
+
+ // GearMetadata decorator
+ registerJXPathDecorator(locale, GearMetadata.class, "${name}$s (${operationEvent/name}$s)");
+
+ // GearCharacteristicValue decorator
+ registerJXPathDecorator(locale, GearCharacteristicValue.class, "${dataValue}$s");
+
+ // GearMetadataValue decorator
+ registerJXPathDecorator(locale, GearMetadataValue.class, "${dataValue}$s");
+
+ // Impacte decorator
+ registerJXPathDecorator(locale, Impacte.class, "${measurementUnit}$s - ${species/genusSpecies}");
+
+ // LengthAgeKey decorator
+ registerJXPathDecorator(locale, LengthAgeKey.class, "Age ${age}$s - Length ${length}");
+
+ // MeasurementMetadata decorator
+ registerJXPathDecorator(locale, MeasurementMetadata.class, "${name}$s");
+
+ // MeasureType decorator
+ registerJXPathDecorator(locale, MeasureType.class, "${name}$s");
+
+ // Mission decorator
+ registerJXPathDecorator(locale, Mission.class, "${name}$s");
+
+ // OperationEvent decorator
+ registerJXPathDecorator(locale, OperationEvent.class, "${name}$s");
+
+ // OperationMetadata decorator
+ registerJXPathDecorator(locale, OperationMetadata.class, "${name}$s");
+
+ // ReferenceDatum decorator
+ registerJXPathDecorator(locale, ReferenceDatum.class, "${id}$s");
+
+ // ReferenceDatumType decorator
+ registerJXPathDecorator(locale, ReferenceDatumType.class, "${name}$s");
+
+ // ReferencingMethod decorator
+ registerJXPathDecorator(locale, ReferencingMethod.class, "${name}$s");
+
+ // SampleDataType decorator
+ registerJXPathDecorator(locale, SampleDataType.class, "${name}$s");
+
+ // SampleType decorator
+ registerJXPathDecorator(locale, SampleType.class, "${name}$s - level ${level}$s");
+
+ // SexCategory decorator
+ registerJXPathDecorator(locale, SexCategory.class, "${name}$s");
+
+ // SizeCategory decorator
+ registerJXPathDecorator(locale, SizeCategory.class, "${name}$s");
+
+ // Species decorator
+ registerJXPathDecorator(locale, Species.class, "${genusSpecies}$s (${baracoudaCode}$s)");
+
+ // SpeciesCategory decorator
+ registerJXPathDecorator(locale, SpeciesCategory.class, "${species/genusSpecies}$s ${sizeCategoryLabel}$s ${ageCategoryLabel}$s ${sexCategoryLabel}$s");
+
+ // Strata decorator
+ registerJXPathDecorator(locale, Strata.class, "Latitude <${minLatitude}$s - ${maxLatitude}$s>, Longitude <${minLongitude}$s - ${maxLongitude}$s>");
+
+ //TODO
+ // TSParameters decorator
+ registerJXPathDecorator(locale, TSParameters.class, "${}$s");
+
+ // Vessel decorator
+ registerJXPathDecorator(locale, Vessel.class, "${name}$s");
+
+ // VesselType decorator
+ registerJXPathDecorator(locale, VesselType.class, "${name}$s");
+
+ // LengthWeightKey decorator
+ registerJXPathDecorator(locale, LengthWeightKey.class, "Species ${species/genusSpecies}$s - a=${aParameter}$s, b=${bParameter}$s");
+
+ // Cell decorator
+ registerJXPathDecorator(locale, Cell.class, "${name}$s");
+
+ // Data decorator
+ registerJXPathDecorator(locale, Data.class, "${dataValue}$s");
+
+ // DataAcquisition decorator
+ registerJXPathDecorator(locale, DataAcquisition.class, "${acousticInstrument/id}$s ");
+
+ // DataProcessing decorator
+ registerJXPathDecorator(locale, DataProcessing.class, "${id}$s");
+
+ // Operation decorator
+ registerJXPathDecorator(locale, Operation.class, "${startDate}$td/%1$tm/%1$tY - ${endDate}$td/%2$tm/%2$tY");
+
+ // OperationMetadataValue decorator
+ registerJXPathDecorator(locale, OperationMetadataValue.class, "${operationMetadata/name} - ${dataValue}$s");
+
+ // Result decorator
+ registerJXPathDecorator(locale, Result.class, "${resultvalue}$s");
+
+ // Sample decorator
+ registerJXPathDecorator(locale, Sample.class, "${resultvalue}$s");
+
+ // SampleData decorator
+ registerJXPathDecorator(locale, SampleData.class, "${resultvalue}$s");
+
+ // Transect decorator
+ registerJXPathDecorator(locale, Transect.class, "${title}$s - Vessel ${vessel/name}$s");
+
+ // Transit decorator
+ registerJXPathDecorator(locale, Transit.class, "${startTime}$td/%1$tm/%1$tY - ${endTime}$td/%2$tm/%2$tY");
+
+ // Voyage decorator
+ registerJXPathDecorator(locale, Voyage.class, "${name}$s [ ${startDate}$td/%2$tm/%2$tY - ${endDate}$td/%3$tm/%3$tY ]");
+ }
+ }
+
}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,149 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services;
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
-import org.apache.commons.lang3.time.DateUtils;
-import org.nuiton.topia.TopiaContext;
-
-import java.util.Date;
-import java.util.Locale;
-
-/**
- * Instances of this class will be given to service factory.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class DefaultEchoBaseServiceContext implements EchoBaseServiceContext {
-
- protected TopiaContext internalTransaction;
-
- protected TopiaContext transaction;
-
- protected EchoBaseServiceFactory serviceFactory;
-
- protected EchoBaseConfiguration configuration;
-
- protected Locale locale;
-
- protected EchoBaseDbMeta dbMeta;
-
- public static EchoBaseServiceContext newContext(
- EchoBaseServiceContext serviceContext,
- TopiaContext internalTransaction,
- TopiaContext transaction) {
- return newContext(serviceContext.getLocale(),
- internalTransaction,
- transaction,
- serviceContext.getConfiguration(),
- serviceContext.getDbMeta(),
- serviceContext.getServiceFactory()
- );
- }
-
- public static EchoBaseServiceContext newContext(
- Locale locale,
- TopiaContext internalTransaction,
- TopiaContext transaction,
- EchoBaseConfiguration configuration,
- EchoBaseDbMeta dbMeta,
- EchoBaseServiceFactory serviceFactory) {
- return new DefaultEchoBaseServiceContext(locale,
- internalTransaction,
- transaction,
- configuration,
- dbMeta,
- serviceFactory);
- }
-
- protected DefaultEchoBaseServiceContext(Locale locale,
- TopiaContext internalTransaction,
- TopiaContext transaction,
- EchoBaseConfiguration configuration,
- EchoBaseDbMeta dbMeta,
- EchoBaseServiceFactory serviceFactory) {
- this.locale = locale;
- this.internalTransaction = internalTransaction;
- this.transaction = transaction;
- this.configuration = configuration;
- this.dbMeta = dbMeta;
- this.serviceFactory = serviceFactory;
- }
-
- @Override
- public TopiaContext getInternalTransaction() {
- return internalTransaction;
- }
-
- @Override
- public void setInternalTransaction(TopiaContext internalTransaction) {
- this.internalTransaction = internalTransaction;
- }
-
- @Override
- public TopiaContext getTransaction() {
- Preconditions.checkNotNull(transaction);
- return transaction;
- }
-
- @Override
- public void setTransaction(TopiaContext transaction) {
- this.transaction = transaction;
- }
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public <E extends EchoBaseService> E newService(Class<E> clazz) {
- return serviceFactory.newService(clazz, this);
- }
-
- @Override
- public Date newDate() {
- Date result = new Date();
- DateUtils.setMilliseconds(result, 0);
- return result;
- }
-
- @Override
- public EchoBaseConfiguration getConfiguration() {
- return configuration;
- }
-
- @Override
- public EchoBaseDbMeta getDbMeta() {
- return dbMeta;
- }
-
- @Override
- public EchoBaseServiceFactory getServiceFactory() {
- return serviceFactory;
- }
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,39 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.echobase.services;
-
-/**
- * Contract to place on each EchoBase service to push the {@code serviceContext}
- * inside the service.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @see EchoBaseServiceContext
- * @since 0.1
- */
-public interface EchoBaseService {
-
- void setServiceContext(EchoBaseServiceContext serviceContext);
-
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,92 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.echobase.services;
-
-import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
-import org.nuiton.topia.TopiaContext;
-
-import java.util.Date;
-import java.util.Locale;
-
-/**
- * This contract represents objects you must provide when asking for a service.
- * Objects provided may be injected in services returned by
- * {@link EchoBaseServiceFactory#newService(Class, EchoBaseServiceContext)}
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public interface EchoBaseServiceContext {
-
- /**
- * Get the internal db current transaction.
- * <p/>
- * Internal db is the db with everything but not any echobase data
- * (security, db connexion, sql queries ?).
- *
- * @return current internal db transaction
- */
- TopiaContext getInternalTransaction();
-
- /**
- * Set the internal db current transaction.
- *
- * @param transaction internal db transaction to set
- */
- void setInternalTransaction(TopiaContext transaction);
-
- /**
- * Get the working db transaction.
- * <p/>
- * Working db contains echobase data, but nothing about technical
- * stuff (security, connexon,...).
- * <p/>
- * This transaction can be {@code null} if no working db is used.
- *
- * @return the current working db transaction (or {@code null} if not setted)
- */
- TopiaContext getTransaction();
-
- /**
- * Set the working db transaction.
- *
- * @param transaction working db transaction to set
- */
- void setTransaction(TopiaContext transaction);
-
- Locale getLocale();
-
- EchoBaseConfiguration getConfiguration();
-
- EchoBaseDbMeta getDbMeta();
-
- EchoBaseServiceFactory getServiceFactory();
-
- <E extends EchoBaseService> E newService(Class<E> clazz);
-
- Date newDate();
-
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,59 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services;
-
-import fr.ifremer.echobase.EchoBaseTechnicalException;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Factory of services.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EchoBaseServiceFactory {
-
- public <E extends EchoBaseService> E newService(Class<E> clazz,
- EchoBaseServiceContext serviceContext) {
- // instantiate service using empty constructor
- E service;
- try {
- service = clazz.getConstructor().newInstance();
- } catch (InstantiationException e) {
- throw new EchoBaseTechnicalException(e);
- } catch (IllegalAccessException e) {
- throw new EchoBaseTechnicalException(e);
- } catch (InvocationTargetException e) {
- throw new EchoBaseTechnicalException(e);
- } catch (NoSuchMethodException e) {
- throw new EchoBaseTechnicalException(e);
- }
-
- service.setServiceContext(serviceContext);
-
- return service;
- }
-
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,192 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
-import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
-import org.apache.commons.lang3.StringUtils;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.persistence.TopiaDAO;
-import org.nuiton.topia.persistence.TopiaEntity;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author sletellier <letellier(a)codelutin.com>
- * @since 0.1
- */
-public class EchoBaseServiceSupport implements EchoBaseService {
-
- protected EchoBaseServiceContext serviceContext;
-
- protected Map<Class<?>, EchoBaseService> services;
-
- @Override
- public void setServiceContext(EchoBaseServiceContext serviceContext) {
- this.serviceContext = serviceContext;
- }
-
- public final <E extends TopiaEntity> List<E> getEntities(EchoBaseEntityEnum entityType) {
- Class<E> contract = (Class<E>) entityType.getContract();
- return getEntities(contract);
- }
-
- public final <E extends TopiaEntity> List<E> getEntities(Class<E> entityType) {
- Preconditions.checkNotNull(entityType);
- try {
- List<E> result = getDAO(entityType).findAll();
- return result;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(
- "Could not obtain data for type " + entityType, eee);
- }
- }
-
- public final <E extends TopiaEntity> long countEntities(Class<E> entityType) {
- Preconditions.checkNotNull(entityType);
- try {
- long result = getDAO(entityType).count();
- return result;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(
- "Could not count data for type " + entityType, eee);
- }
- }
-
- public final <E extends TopiaEntity> E getEntityById(Class<E> entityType, String id) {
- Preconditions.checkNotNull(entityType);
- Preconditions.checkArgument(StringUtils.isNotEmpty(id));
- try {
- E result = getDAO(entityType).findByTopiaId(id);
- return result;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(
- "Could not obtain data of id [" + id + "] for type " +
- entityType, eee);
- }
- }
-
- public final <E extends TopiaEntity> E getEntityByProperty(Class<E> entityType,
- String propertyId,
- Object propertyValue) {
- Preconditions.checkNotNull(entityType);
- Preconditions.checkArgument(StringUtils.isNotEmpty(propertyId));
- try {
- E result = getDAO(entityType).findByProperty(propertyId, propertyValue);
- return result;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(
- "Could not obtain data of property [" + propertyId + "] for type " +
- entityType, eee);
- }
- }
-
- public TopiaContext getInternalTransaction() {
- return serviceContext.getInternalTransaction();
- }
-
- protected final TopiaContext getTransaction() {
- return serviceContext.getTransaction();
- }
-
- protected final Locale getLocale() {
- return serviceContext.getLocale();
- }
-
- protected final EchoBaseDbMeta getDbMeta() {
- return serviceContext.getDbMeta();
- }
-
- protected final EchoBaseConfiguration getConfiguration() {
- return serviceContext.getConfiguration();
- }
-
- protected final Date newDate() {
- return serviceContext.newDate();
- }
-
- protected char getCsvSeparator() {
- return getConfiguration().getCsvSeparator();
- }
-
- protected final <E extends EchoBaseService> E getService(Class<E> serviceClass) {
- if (services == null) {
- services = Maps.newHashMap();
- }
- E service = (E) services.get(serviceClass);
- if (service == null) {
- service = serviceContext.newService(serviceClass);
- services.put(serviceClass, service);
- }
- return service;
- }
-
- protected final <E extends TopiaEntity> TopiaDAO<E> getDAO(EchoBaseEntityEnum entityEnum) {
- TopiaDAO<E> dao = getDAO((Class<E>) entityEnum.getContract());
- return dao;
- }
-
- protected final <E extends TopiaEntity> TopiaDAO<E> getDAO(Class<E> entityType) {
- try {
- TopiaDAO<E> dao = EchoBaseDAOHelper.<E, TopiaDAO<E>>getDAO(
- getTransaction(),
- entityType);
-
- return dao;
- } catch (TopiaException e) {
- throw new EchoBaseTechnicalException("Could not obtain dao for type " + entityType, e);
- }
- }
-
- protected final <E extends TopiaEntity, D extends TopiaDAO<E>> D getDAO(Class<E> entityType, Class<D> daoType) {
- TopiaDAO<E> dao = getDAO(
- entityType);
- Preconditions.checkState(daoType.isAssignableFrom(dao.getClass()));
- return (D) dao;
- }
-
- public final void commitTransaction(String errorMessage) {
- try {
- getTransaction().commitTransaction();
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(errorMessage, eee);
- }
- }
-
- protected final void flushTransaction() throws TopiaException {
- TopiaContextImplementor tx = (TopiaContextImplementor) getTransaction();
- tx.getHibernate().flush();
- }
-
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,55 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services;
-
-import java.io.Serializable;
-
-/**
- * Contract for a progression model while long service actions.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public interface ProgressionModel extends Serializable {
-
- long getNbSteps();
-
- float getProgression();
-
- void setProgression(float progression);
-
- void incrementsProgression();
-
- void setNbSteps(long nbSteps);
-
- long getStartTime();
-
- void setStartTime(long startTime);
-
- long getEndTime();
-
- void setEndTime(long endTime);
-
- String getActionTime();
-}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -111,7 +111,7 @@
}
}
userToCreateOrUpdate.setAdmin(user.isAdmin());
- commitTransaction("Could not create or update user");
+ commitInternalTransaction("Could not create or update user");
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
@@ -122,7 +122,7 @@
EchoBaseUser userToDelete = getEntityById(EchoBaseUser.class,
user.getTopiaId());
getDAO(EchoBaseUser.class).delete(userToDelete);
- commitTransaction("Could not delete user");
+ commitInternalTransaction("Could not delete user");
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,16 +25,17 @@
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
-import fr.ifremer.echobase.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.UserService;
-import fr.ifremer.echobase.services.exceptions.ExportQueryNameAlreadyExistException;
+import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException;
import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration;
import fr.ifremer.echobase.services.exportdb.ExportDbService;
import fr.ifremer.echobase.services.exportquery.ExportQueryService;
@@ -101,8 +102,9 @@
//FIXME Review this to works with internal and working db...
// create h2 db in /db
+ JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(dir);
TopiaContext rootContext =
- new EchoBaseTopiaRootContextFactory().newEmbeddedDatabase(dir);
+ EchobaseTopiaContexts.newWorkingDb(dbConf);
TopiaContext topiaContext = null;
try {
@@ -227,8 +229,7 @@
"Could not begin transaction on main db");
try {
serviceContext.setTransaction(newTx);
- ExportDbService exportDbService =
- serviceContext.newService(ExportDbService.class);
+ ExportDbService exportDbService = getService(ExportDbService.class);
exportDbService.exportPartialDb(exportconfiguration, false);
} catch (IOException eee) {
rollbackTransaction(
@@ -321,7 +322,7 @@
// get user service from h2 db
UserService userService =
- newServiceContext.newService(UserService.class);
+ newServiceContext.getService(UserService.class);
// create admin user
userService.createDefaultUsers();
@@ -344,7 +345,7 @@
// create export sql service from h2 db
ExportQueryService exportQueryService =
- newServiceContext.newService(ExportQueryService.class);
+ newServiceContext.getService(ExportQueryService.class);
// get all queries from h2 db
queries = exportQueryService.getEntities(ExportQuery.class);
@@ -366,7 +367,7 @@
importConfiguration.setWorkingDirectory(importTempDir);
ImportDbService importDbService =
- newServiceContext.newService(ImportDbService.class);
+ newServiceContext.getService(ImportDbService.class);
importDbService.importDb(importConfiguration, admin, false, true);
}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/ExportQueryNameAlreadyExistException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/ExportQueryNameAlreadyExistException.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/ExportQueryNameAlreadyExistException.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,35 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services.exceptions;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class ExportQueryNameAlreadyExistException extends Exception {
-
- private static final long serialVersionUID = 1L;
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/MissionNameAlreadyExistException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/MissionNameAlreadyExistException.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/MissionNameAlreadyExistException.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -1,34 +0,0 @@
-/*
- * #%L
- * EchoBase :: Services
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2011 - 2012 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.echobase.services.exceptions;
-
-/**
- * TODO
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class MissionNameAlreadyExistException extends Exception {
- private static final long serialVersionUID = 1L;
-}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportdb/ExportDbService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportdb/ExportDbService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportdb/ExportDbService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,8 +25,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.echobase.EchoBaseIOUtil;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.data.Result;
import fr.ifremer.echobase.entities.data.Voyage;
Copied: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryNameAlreadyExistException.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/ExportQueryNameAlreadyExistException.java)
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryNameAlreadyExistException.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryNameAlreadyExistException.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,35 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services.exportquery;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class ExportQueryNameAlreadyExistException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryNameAlreadyExistException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -28,9 +28,9 @@
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
+import fr.ifremer.echobase.entities.ExportQueryDAO;
import fr.ifremer.echobase.entities.ExportQueryImpl;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
-import fr.ifremer.echobase.services.exceptions.ExportQueryNameAlreadyExistException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -68,8 +68,10 @@
public ExportQuery createOrUpdate(ExportQuery exportQuery,
EchoBaseUser user) throws ExportQueryNameAlreadyExistException {
try {
- TopiaDAO<ExportQuery> dao = getDAO(ExportQuery.class);
+ ExportQueryDAO dao = getDAO(ExportQuery.class,
+ ExportQueryDAO.class);
+
// No id, creating new one entity
String id = exportQuery.getTopiaId();
@@ -95,7 +97,7 @@
// }
// check query does not already exists with this name
- boolean queryExists = dao.existsByQuery(hql, params.toArray());
+ boolean queryExists = dao.existsByQuery("SELECT COUNT(*) " + hql, params.toArray());
// boolean queryExists = dao.existByQuery(query);
@@ -120,7 +122,7 @@
}
// dao.update(entityToSave);
- getTransaction().commitTransaction();
+ commitInternalTransaction("Could not create export query");
return entityToSave;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -133,7 +135,7 @@
ExportQuery entityToDelete = dao.findByTopiaId(topiaId);
dao.delete(entityToDelete);
- getTransaction().commitTransaction();
+ commitInternalTransaction("Could not delete export query");
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,8 +24,8 @@
package fr.ifremer.echobase.services.importdata;
import com.google.common.collect.Lists;
-import fr.ifremer.echobase.EchoBaseIOUtil;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AbstractImportDataService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -28,7 +28,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.csv.EchoBaseCsvUtil;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/AcousticImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBasePredicates;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.csv.EchoBaseCsvUtil;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CatchesImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBasePredicates;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Operation;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/CommonImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Transect;
@@ -40,7 +40,6 @@
import fr.ifremer.echobase.entities.references.Mission;
import fr.ifremer.echobase.entities.references.MissionDAO;
import fr.ifremer.echobase.entities.references.Vessel;
-import fr.ifremer.echobase.services.exceptions.MissionNameAlreadyExistException;
import fr.ifremer.echobase.services.importdata.csv.TransectImportModel;
import fr.ifremer.echobase.services.importdata.csv.TransectImportRow;
import fr.ifremer.echobase.services.importdata.csv.TransitImportModel;
@@ -130,8 +129,7 @@
throw new MissionNameAlreadyExistException();
}
Mission result = create(dao, mission);
- commitTransaction("Could not create mission " +
- mission.getName());
+ commitTransaction("Could not create mission " + mission.getName());
return result;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ImportException.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ImportException.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ImportException.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import org.nuiton.util.csv.ImportRuntimeException;
import java.util.Locale;
Copied: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/MissionNameAlreadyExistException.java (from rev 573, trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exceptions/MissionNameAlreadyExistException.java)
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/MissionNameAlreadyExistException.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/MissionNameAlreadyExistException.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,34 @@
+/*
+ * #%L
+ * EchoBase :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2012 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services.importdata;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class MissionNameAlreadyExistException extends Exception {
+ private static final long serialVersionUID = 1L;
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/MissionNameAlreadyExistException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/OperationImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,7 +25,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.GearMetadataValue;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,7 +25,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Category;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsImportConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import java.util.Locale;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsMapCellImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsMapCellImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsMapCellImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Category;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsRegionCellImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsRegionCellImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsRegionCellImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Category;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsVoyageImportService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsVoyageImportService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdata/ResultsVoyageImportService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -28,7 +28,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBasePredicates;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Echotype;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/DefaultImportStrategy.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/DefaultImportStrategy.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/DefaultImportStrategy.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
-import fr.ifremer.echobase.entities.EchoBasePersistenceHelper;
+import fr.ifremer.echobase.persistence.EchoBasePersistenceHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbConfiguration.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbConfiguration.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbConfiguration.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdb;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
import fr.ifremer.echobase.services.ProgressionModel;
import org.apache.commons.io.FileUtils;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbService.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/importdb/ImportDbService.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,7 +24,7 @@
package fr.ifremer.echobase.services.importdb;
import com.google.common.collect.Lists;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EntityModificationLog;
Modified: trunk/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties
===================================================================
--- trunk/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/resources/i18n/echobase-services_en_GB.properties 2012-09-01 11:28:26 UTC (rev 587)
@@ -45,5 +45,6 @@
echobase.importError.transit.notfound=
echobase.importLabel.withFile=%s with file %s
echobase.info.modifiedProperty=Property '%s', old value\: '%s', new value\: '%s'
+echobase.info.newEntityCreated=
echobase.info.onePropertyModified=One property was modified\:
echobase.info.somePropertiesModified=%s properties were modified\:
Modified: trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
===================================================================
--- trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-09-01 11:28:26 UTC (rev 587)
@@ -45,5 +45,6 @@
echobase.importError.transit.notfound=Transit non trouvé pour la campagne %s et la date %s (ligne %s)
echobase.importLabel.withFile=%s avec le fichier %s
echobase.info.modifiedProperty=Propriété '%s', ancienne valeur \: '%s', nouvelle valeur \: '%s'
+echobase.info.newEntityCreated=
echobase.info.onePropertyModified=Une propriété a été modifiée \:
echobase.info.somePropertiesModified=%s propriétés ont été modifiées \:
Copied: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/DecoratorServiceTest.java (from rev 573, trunk/echobase-entities/src/test/java/fr/ifremer/echobase/EchoBaseDecoratorProviderTest.java)
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/DecoratorServiceTest.java (rev 0)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/DecoratorServiceTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,74 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.services;
+
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.nuiton.util.decorator.Decorator;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * To test the {@link DecoratorService}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.2
+ */
+public class DecoratorServiceTest extends EchoBaseTestServiceSupport {
+
+ @Override
+ protected FakeEchoBaseServiceContext initContext() {
+ return new FakeEchoBaseServiceContext(null);
+ }
+
+ @Test
+ public void getDecoratorForReferences() throws Exception {
+ Locale locale = serviceContext.getLocale();
+ DecoratorService service = getService(DecoratorService.class);
+ List<EchoBaseEntityEnum> expectedTypes = serviceContext.getDbMeta().getReferenceTypes();
+
+ for (EchoBaseEntityEnum type : expectedTypes) {
+ Decorator<?> decorator =
+ service.getDecorator(locale, type.getContract(), null);
+ Assert.assertNotNull("Missing decorator for type : " + type, decorator);
+ }
+ }
+
+ @Test
+ public void getDecoratorForData() throws Exception {
+ Locale locale = serviceContext.getLocale();
+ DecoratorService service = getService(DecoratorService.class);
+ List<EchoBaseEntityEnum> expectedTypes =
+ serviceContext.getDbMeta().getDataTypes();
+
+ for (EchoBaseEntityEnum type : expectedTypes) {
+ Decorator<?> decorator =
+ service.getDecorator(locale, type.getContract(), null);
+ Assert.assertNotNull("Missing decorator for type : " + type, decorator);
+ }
+ }
+
+}
Property changes on: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/DecoratorServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseTestServiceSupport.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseTestServiceSupport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/EchoBaseTestServiceSupport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,8 +24,7 @@
package fr.ifremer.echobase.services;
import com.google.common.base.Preconditions;
-import fr.ifremer.echobase.InputFile;
-import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserImpl;
@@ -40,6 +39,7 @@
import org.junit.Rule;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
import org.nuiton.util.StringUtil;
import java.io.File;
@@ -70,7 +70,6 @@
@Before
public void setUp() throws Exception {
- fakeServiceContext.setServiceFactory(new EchoBaseServiceFactory());
setServiceContext(fakeServiceContext);
}
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportDbServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportDbServiceTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportDbServiceTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -48,8 +48,7 @@
@Test
public void exportDb() throws IOException {
- ExportDbService service =
- serviceContext.newService(ExportDbService.class);
+ ExportDbService service = getService(ExportDbService.class);
ExportDbConfiguration conf = new ExportDbConfiguration();
@@ -66,8 +65,7 @@
@Test
public void exportPartialDb() throws IOException {
- ExportDbService service =
- serviceContext.newService(ExportDbService.class);
+ ExportDbService service = getService(ExportDbService.class);
ExportDbConfiguration conf = new ExportDbConfiguration();
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportQueryServiceTest.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportQueryServiceTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/ExportQueryServiceTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -45,7 +45,7 @@
@Before
public void setup() {
- service = serviceContext.newService(ExportQueryService.class);
+ service = getService(ExportQueryService.class);
}
@Ignore
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/FakeEchoBaseServiceContext.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/FakeEchoBaseServiceContext.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/FakeEchoBaseServiceContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,8 +27,9 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseConfigurationOption;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
@@ -66,7 +67,7 @@
protected final String initDb;
- protected EchoBaseServiceFactory serviceFactory;
+ protected final DefaultEchoBaseServiceContext.ServiceFactory serviceFactory;
protected TopiaContext rootContext;
@@ -82,6 +83,8 @@
public FakeEchoBaseServiceContext(String initDb) {
this.initDb = initDb;
+ this.serviceFactory =
+ new DefaultEchoBaseServiceContext.ServiceFactory();
}
protected File getTestSpecificDirectory(Description description) {
@@ -109,8 +112,6 @@
@Override
protected void starting(Description description) {
super.starting(description);
- EchoBaseTopiaRootContextFactory factory =
- new EchoBaseTopiaRootContextFactory();
testDir = getTestSpecificDirectory(description);
if (log.isInfoEnabled()) {
log.info("Test dir = " + testDir);
@@ -147,8 +148,12 @@
defaultProps.put(EchoBaseConfigurationOption.DATA_DIRECTORY.getKey(), testDir);
configuration = new EchoBaseConfiguration(defaultProps);
- rootContext = factory.newEmbeddedDatabase(testDir);
-// rootContext = factory.newEmbeddedDatabase(testDir, "/" + CONFIGURATION_PATH);
+ JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(testDir);
+ Properties properties = EchobaseTopiaContexts.loadWorkingDbConfiguration(dbConf);
+
+ //FIXME should never try to update db, tests db should always be uptodate...
+ properties.put("hibernate.hbm2ddl.auto", "update");
+ rootContext = EchobaseTopiaContexts.newDb(properties);
}
@Override
@@ -208,26 +213,17 @@
}
@Override
- public EchoBaseServiceFactory getServiceFactory() {
- return serviceFactory;
+ public final <E extends EchoBaseService> E getService(Class<E> serviceClass) {
+ return serviceFactory.getService(serviceClass, this);
}
@Override
- public <E extends EchoBaseService> E newService(Class<E> clazz) {
- return serviceFactory.newService(clazz, this);
- }
-
- @Override
public Date newDate() {
Date result = new Date();
DateUtils.setMilliseconds(result, 0);
return result;
}
- public void setServiceFactory(EchoBaseServiceFactory serviceFactory) {
- this.serviceFactory = serviceFactory;
- }
-
public File getTestDir() {
return testDir;
}
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/AbstractImportDataServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/AbstractImportDataServiceIT.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/AbstractImportDataServiceIT.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -28,10 +28,7 @@
import com.google.common.collect.Sets;
import fr.ifremer.echobase.EchoBaseFunctions;
import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.InputFile;
-import org.nuiton.topia.persistence.csv.in.AbstractImportModel;
import fr.ifremer.echobase.csv.EchoBaseCsvUtil;
-import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.data.Cell;
@@ -50,7 +47,9 @@
import fr.ifremer.echobase.entities.data.Transect;
import fr.ifremer.echobase.entities.data.Transit;
import fr.ifremer.echobase.entities.data.Voyage;
+import fr.ifremer.echobase.entities.references.AcousticInstrument;
import fr.ifremer.echobase.entities.references.CellType;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.services.EchoBaseTestServiceSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,6 +57,8 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.csv.in.AbstractImportModel;
+import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
import org.nuiton.util.TimeLog;
import org.nuiton.util.csv.Import;
import org.nuiton.util.csv.ext.CsvReaders;
@@ -176,8 +177,8 @@
protected <M extends AbstractImportConfiguration, S extends AbstractImportDataService<M>>
List<CsvFileImportResult<EchoBaseEntityEnum>> doImport(M conf,
- Class<S> serviceType,
- int nbResults) throws ImportException {
+ Class<S> serviceType,
+ int nbResults) throws ImportException {
S service = getService(serviceType);
@@ -250,7 +251,7 @@
dataAcquisition = create(
getDAO(DataAcquisition.class),
DataAcquisition.PROPERTY_ACOUSTIC_INSTRUMENT,
- getEntities(EchoBaseEntityEnum.AcousticInstrument).get(0));
+ getEntities(AcousticInstrument.class).get(0));
transect.addDataAcquisition(dataAcquisition);
} else {
dataAcquisition = transect.getDataAcquisition().iterator().next();
Modified: trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportServiceIT.java
===================================================================
--- trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportServiceIT.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-services/src/test/java/fr/ifremer/echobase/services/importdata/ResultsEsduCellImportServiceIT.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.services.importdata;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.csv.EchoBaseCsvUtil;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import org.nuiton.topia.persistence.csv.in.CsvFileImportResult;
Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/EchoBaseDbCreator.java
===================================================================
--- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/EchoBaseDbCreator.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/EchoBaseDbCreator.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -31,9 +31,9 @@
import com.healthmarketscience.jackcess.Database;
import com.healthmarketscience.jackcess.Table;
import fr.ifremer.echobase.EchoBaseFunctions;
-import fr.ifremer.echobase.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
import fr.ifremer.echobase.csv.EchoBaseCsvUtil;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/EntityLoader.java
===================================================================
--- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/EntityLoader.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/EntityLoader.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -437,7 +437,7 @@
}
EchoBaseEntityEnum target = associationMeta.getTarget();
- List<TopiaEntity> targetEntities = getEntities(target);
+ List<TopiaEntity> targetEntities = (List<TopiaEntity>) getEntities(target.getContract());
Map<String, TopiaEntity> targetsById =
Maps.uniqueIndex(targetEntities, TopiaId.GET_TOPIA_ID);
@@ -447,7 +447,7 @@
ImportToMap importer = ImportToMap.newImportToMap(model, reader);
- List<E> sourceEntities = getEntities(sourceType);
+ List<E> sourceEntities = (List<E>) getEntities(sourceType.getContract());
Map<String, E> sourcesById =
Maps.uniqueIndex(sourceEntities, TopiaId.GET_TOPIA_ID);
try {
@@ -485,7 +485,7 @@
Import<TopiaEntity> importer = Import.newImport(model, reader);
try {
- TopiaDAO<TopiaEntity> dao = getDAO(tableMeta.getSource());
+ TopiaDAO<?> dao = getDAO(tableMeta.getSource().getContract());
for (TopiaEntity entity : importer) {
Map<String, Object> properties = meta.prepareCreate(
Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/GearMetadataLoader.java
===================================================================
--- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/GearMetadataLoader.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/GearMetadataLoader.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -48,7 +48,7 @@
@Override
protected EntityCsvModel<EchoBaseEntityEnum, GearMetadata> createCsvImportModel(TableMeta<EchoBaseEntityEnum> meta) {
- List<OperationEvent> events = getEntities(EchoBaseEntityEnum.OperationEvent);
+ List<OperationEvent> events = getEntities(OperationEvent.class);
EntityCsvModel<EchoBaseEntityEnum,GearMetadata> model = EntityCsvModel.newModel(
getCsvSeparator(),
Modified: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/OperationMetadataLoader.java
===================================================================
--- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/OperationMetadataLoader.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/loaders/OperationMetadataLoader.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,12 +24,12 @@
package fr.ifremer.echobase.tools.loaders;
import fr.ifremer.echobase.EchoBaseFunctions;
-import org.nuiton.topia.persistence.csv.EntityCsvModel;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.references.GearMetadata;
import fr.ifremer.echobase.entities.references.OperationEvent;
import fr.ifremer.echobase.entities.references.OperationMetadata;
import fr.ifremer.echobase.tools.FileType;
+import org.nuiton.topia.persistence.csv.EntityCsvModel;
import org.nuiton.topia.persistence.metadata.TableMeta;
import java.util.List;
@@ -49,9 +49,9 @@
@Override
protected EntityCsvModel<EchoBaseEntityEnum, OperationMetadata> createCsvImportModel(TableMeta<EchoBaseEntityEnum> meta) {
- List<OperationEvent> events = getEntities(EchoBaseEntityEnum.OperationEvent);
+ List<OperationEvent> events = getEntities(OperationEvent.class);
- EntityCsvModel<EchoBaseEntityEnum,OperationMetadata> model = EntityCsvModel.newModel(
+ EntityCsvModel<EchoBaseEntityEnum, OperationMetadata> model = EntityCsvModel.newModel(
getCsvSeparator(),
meta
);
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/AbstractToolTest.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,12 +25,12 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseConfigurationOption;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseService;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
-import fr.ifremer.echobase.services.EchoBaseServiceFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After;
@@ -92,18 +92,16 @@
configuration = new EchoBaseConfiguration(defaultProps);
- EchoBaseTopiaRootContextFactory factory =
- new EchoBaseTopiaRootContextFactory();
+ JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(testdir);
- topiaContext = factory.newEmbeddedDatabase(testdir);
+ topiaContext = EchobaseTopiaContexts.newWorkingDb(dbConf);
serviceContext = DefaultEchoBaseServiceContext.newContext(
Locale.getDefault(),
null,
topiaContext.beginTransaction(),
configuration,
- EchoBaseDbMeta.newDbMeta(),
- new EchoBaseServiceFactory()
+ EchoBaseDbMeta.newDbMeta()
);
}
@@ -117,8 +115,8 @@
}
}
- public <E extends EchoBaseService> E newService(Class<E> clazz) {
- return serviceContext.newService(clazz);
+ public <E extends EchoBaseService> E getService(Class<E> clazz) {
+ return serviceContext.getService(clazz);
}
protected <E extends TopiaEntity> TopiaDAO<E> getDao(Class<E> entityClass) throws TopiaException {
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/EchoBaseDbZipCreatorIT.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/EchoBaseDbZipCreatorIT.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/EchoBaseDbZipCreatorIT.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,7 @@
*/
package fr.ifremer.echobase.tools;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/TestHelper.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,8 @@
*/
package fr.ifremer.echobase.tools;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
@@ -99,10 +100,9 @@
}
public static TopiaContext getRootContext(File dbDir) {
- EchoBaseTopiaRootContextFactory factory =
- new EchoBaseTopiaRootContextFactory();
- TopiaContext context = factory.newEmbeddedDatabase(dbDir);
+ JdbcConfiguration dbConf = JdbcConfiguration.newEmbeddedConfig(dbDir);
+ TopiaContext context = EchobaseTopiaContexts.newWorkingDb(dbConf);
return context;
}
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/AbstractLoaderIT.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/AbstractLoaderIT.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/AbstractLoaderIT.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -118,7 +118,7 @@
FileUtil.createDirectoryIfNecessary(exportdir);
// get loader
- loader = newService(loaderType);
+ loader = getService(loaderType);
if (loadDependencies) {
loadDependencies();
@@ -292,7 +292,7 @@
if (log.isInfoEnabled()) {
log.info("Import " + inFile);
}
- CsvImportResult<EchoBaseEntityEnum> csvImportResult = newService(ImportService.class).importDatas(
+ CsvImportResult<EchoBaseEntityEnum> csvImportResult = getService(ImportService.class).importDatas(
loader.getEntityType(),
inFile.getAbsolutePath(),
inFile,
@@ -336,43 +336,43 @@
public List<EntityLoader<?>> getEntityLoaders() {
if (entityLoaders == null) {
entityLoaders = Lists.newArrayList();
- entityLoaders.add(newService(SpeciesLoader.class));
- entityLoaders.add(newService(MissionLoader.class));
- entityLoaders.add(newService(AreaOfOperationLoader.class));
- entityLoaders.add(newService(AcousticInstrumentLoader.class));
- entityLoaders.add(newService(DepthStratumLoader.class));
- entityLoaders.add(newService(DataQualityLoader.class));
- entityLoaders.add(newService(ReferenceDatumTypeLoader.class));
- entityLoaders.add(newService(ReferenceDatumLoader.class));
- entityLoaders.add(newService(DataTypeLoader.class));
- entityLoaders.add(newService(CellTypeLoader.class));
- entityLoaders.add(newService(CellMethodLoader.class));
- entityLoaders.add(newService(DataMetadataLoader.class));
- entityLoaders.add(newService(TSParametersLoader.class));
- entityLoaders.add(newService(StrataLoader.class));
- entityLoaders.add(newService(EchotypeCategoryLoader.class));
- entityLoaders.add(newService(VesselTypeLoader.class));
- entityLoaders.add(newService(VesselLoader.class));
- entityLoaders.add(newService(OperationEventLoader.class));
- entityLoaders.add(newService(SampleDataTypeLoader.class));
- entityLoaders.add(newService(SampleTypeLoader.class));
- entityLoaders.add(newService(LengthAgeKeyLoader.class));
- entityLoaders.add(newService(LengthWeightKeyLoader.class));
- entityLoaders.add(newService(SexCategoryLoader.class));
- entityLoaders.add(newService(SizeCategoryLoader.class));
- entityLoaders.add(newService(OperationMetadataLoader.class));
- entityLoaders.add(newService(GearMetadataLoader.class));
- entityLoaders.add(newService(GearLoader.class));
- entityLoaders.add(newService(AgeCategoryLoader.class));
- entityLoaders.add(newService(SpeciesCategoryLoader.class));
+ entityLoaders.add(getService(SpeciesLoader.class));
+ entityLoaders.add(getService(MissionLoader.class));
+ entityLoaders.add(getService(AreaOfOperationLoader.class));
+ entityLoaders.add(getService(AcousticInstrumentLoader.class));
+ entityLoaders.add(getService(DepthStratumLoader.class));
+ entityLoaders.add(getService(DataQualityLoader.class));
+ entityLoaders.add(getService(ReferenceDatumTypeLoader.class));
+ entityLoaders.add(getService(ReferenceDatumLoader.class));
+ entityLoaders.add(getService(DataTypeLoader.class));
+ entityLoaders.add(getService(CellTypeLoader.class));
+ entityLoaders.add(getService(CellMethodLoader.class));
+ entityLoaders.add(getService(DataMetadataLoader.class));
+ entityLoaders.add(getService(TSParametersLoader.class));
+ entityLoaders.add(getService(StrataLoader.class));
+ entityLoaders.add(getService(EchotypeCategoryLoader.class));
+ entityLoaders.add(getService(VesselTypeLoader.class));
+ entityLoaders.add(getService(VesselLoader.class));
+ entityLoaders.add(getService(OperationEventLoader.class));
+ entityLoaders.add(getService(SampleDataTypeLoader.class));
+ entityLoaders.add(getService(SampleTypeLoader.class));
+ entityLoaders.add(getService(LengthAgeKeyLoader.class));
+ entityLoaders.add(getService(LengthWeightKeyLoader.class));
+ entityLoaders.add(getService(SexCategoryLoader.class));
+ entityLoaders.add(getService(SizeCategoryLoader.class));
+ entityLoaders.add(getService(OperationMetadataLoader.class));
+ entityLoaders.add(getService(GearMetadataLoader.class));
+ entityLoaders.add(getService(GearLoader.class));
+ entityLoaders.add(getService(AgeCategoryLoader.class));
+ entityLoaders.add(getService(SpeciesCategoryLoader.class));
- entityLoaders.add(newService(VoyageLoader.class));
- entityLoaders.add(newService(TransitLoader.class));
- entityLoaders.add(newService(TransectLoader.class));
- entityLoaders.add(newService(DataAcquisitionLoader.class));
- entityLoaders.add(newService(DataProcessingLoader.class));
- entityLoaders.add(newService(CellLoader.class));
- entityLoaders.add(newService(OperationLoader.class));
+ entityLoaders.add(getService(VoyageLoader.class));
+ entityLoaders.add(getService(TransitLoader.class));
+ entityLoaders.add(getService(TransectLoader.class));
+ entityLoaders.add(getService(DataAcquisitionLoader.class));
+ entityLoaders.add(getService(DataProcessingLoader.class));
+ entityLoaders.add(getService(CellLoader.class));
+ entityLoaders.add(getService(OperationLoader.class));
}
return entityLoaders;
}
Modified: trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java
===================================================================
--- trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/loaders/CellLoaderIT.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.healthmarketscience.jackcess.Database;
-import fr.ifremer.echobase.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
import fr.ifremer.echobase.entities.data.Cell;
import fr.ifremer.echobase.entities.data.DataProcessing;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import com.google.common.collect.Sets;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
@@ -93,24 +93,24 @@
public synchronized void registerEchoBaseSession(EchoBaseSession t3Session) {
Preconditions.checkNotNull(t3Session);
- Preconditions.checkNotNull(t3Session.getEchoBaseUser());
+ Preconditions.checkNotNull(t3Session.getUser());
if (t3Sessions == null) {
t3Sessions = Sets.newHashSet();
}
if (log.isInfoEnabled()) {
log.info("Register user session for [" +
- t3Session.getEchoBaseUser().getEmail() + "]");
+ t3Session.getUser().getEmail() + "]");
}
t3Sessions.add(t3Session);
}
public synchronized void destroyEchoBaseSession(EchoBaseSession t3Session) {
Preconditions.checkNotNull(t3Session);
- Preconditions.checkNotNull(t3Session.getEchoBaseUser());
+ Preconditions.checkNotNull(t3Session.getUser());
Preconditions.checkNotNull(t3Sessions);
if (log.isInfoEnabled()) {
log.info("Destroy user session for [" +
- t3Session.getEchoBaseUser().getEmail() + "]");
+ t3Session.getUser().getEmail() + "]");
}
// remove session from active ones
t3Sessions.remove(t3Session);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,14 +24,13 @@
package fr.ifremer.echobase.ui;
import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseEntityHelper;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
-import fr.ifremer.echobase.entities.EchoBaseDbMeta;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserImpl;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
-import fr.ifremer.echobase.services.EchoBaseServiceFactory;
import fr.ifremer.echobase.services.UserService;
import fr.ird.converter.FloatConverter;
import org.apache.commons.beanutils.ConvertUtils;
@@ -96,7 +95,7 @@
// initialize internal root context
TopiaContext internalRootContext =
- new EchoBaseTopiaRootContextFactory().newInternalDb(configuration);
+ EchobaseTopiaContexts.newInternalDb(configuration);
// initialize application context
EchoBaseApplicationContext applicationContext = new EchoBaseApplicationContext();
@@ -166,8 +165,7 @@
null,
null,
configuration,
- applicationContext.getDbMeta(),
- new EchoBaseServiceFactory()
+ applicationContext.getDbMeta()
);
try {
@@ -210,14 +208,11 @@
*/
protected void createAdminUser(EchoBaseServiceContext serviceContext) throws TopiaException {
- EchoBaseServiceFactory serviceFactory =
- new EchoBaseServiceFactory();
TopiaContext transaction = serviceContext.getInternalTransaction().beginTransaction();
serviceContext.setInternalTransaction(transaction);
try {
- UserService service =
- serviceFactory.newService(UserService.class, serviceContext);
+ UserService service = serviceContext.getService(UserService.class);
List<EchoBaseUser> users = service.getUsers();
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,16 +23,19 @@
*/
package fr.ifremer.echobase.ui;
-import fr.ifremer.echobase.EchoBaseEntityHelper;
+import com.opensymphony.xwork2.ActionContext;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsStatics;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaRuntimeException;
import org.nuiton.web.filter.TopiaTransactionFilter;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
/**
* Inject in each request a new transaction from the internal db.
@@ -46,6 +49,12 @@
private static final Log log =
LogFactory.getLog(EchoBaseInternalDbTransactionFilter.class);
+ public static TopiaContext getTransaction(ActionContext context) {
+ HttpServletRequest request = (HttpServletRequest)
+ context.get(StrutsStatics.HTTP_REQUEST);
+ return TopiaTransactionFilter.getTransaction(request);
+ }
+
@Override
protected TopiaContext beginTransaction(ServletRequest request) throws TopiaRuntimeException {
EchoBaseApplicationContext applicationContext =
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,9 +25,9 @@
import com.google.common.collect.Sets;
import com.opensymphony.xwork2.ActionContext;
-import fr.ifremer.echobase.EchoBaseEntityHelper;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextFactory;
-import fr.ifremer.echobase.JdbcConfiguration;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
+import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
+import fr.ifremer.echobase.persistence.JdbcConfiguration;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationConfiguration;
import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration;
@@ -36,9 +36,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaNotFoundException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import javax.servlet.http.HttpSession;
import java.io.Closeable;
@@ -58,7 +56,7 @@
private static final Log log = LogFactory.getLog(EchoBaseSession.class);
/** Key to set User connected in this session. */
- protected static final String PROPERTY_ECHO_BASE_USER = "echobaseUser";
+ protected static final String PROPERTY_USER = "echobaseUser";
/** Key to keep import db configuration in this session. */
protected static final String PROPERTY_IMPORT_DB_CONFIGURATION = "importDbConfiguration";
@@ -75,7 +73,6 @@
/** Key to set root context of working db selected by user (if any). */
private static final String PROPERTY_ROOT_CONTEXT = "rootContext";
-
/**
* Obtain the user T3 session.
* <p/>
@@ -124,17 +121,27 @@
*
* @return the informations of loggued user or {@code null} if not in session
*/
- public EchoBaseUser getEchoBaseUser() {
- return get(PROPERTY_ECHO_BASE_USER, EchoBaseUser.class);
+ public EchoBaseUser getUser() {
+ return get(PROPERTY_USER, EchoBaseUser.class);
}
/**
+ * Tests if user is loggued (means the {@link #getUser} is not null).
+ *
+ * @return {@code true} if user is loggued, {@code false} otherwise
+ */
+ public boolean isUserInSession() {
+ boolean result = getUser() != null;
+ return result;
+ }
+
+ /**
* Sets in this session the loggued user.
*
- * @param echoBaseUser the user loggued to use in this session
+ * @param user the user loggued to use in this session
*/
- public void setEchoBaseUser(EchoBaseUser echoBaseUser) {
- set(PROPERTY_ECHO_BASE_USER, echoBaseUser);
+ public void setUser(EchoBaseUser user) {
+ set(PROPERTY_USER, user);
}
public ImportDbConfiguration getImportDbConfiguration() {
@@ -182,7 +189,7 @@
TopiaContext rootContext = getRootContext();
String result = null;
if (rootContext != null) {
- result = (String) ((TopiaContextImplementor) rootContext).getConfig().get(TopiaContextFactory.CONFIG_URL);
+ result = EchobaseTopiaContexts.getDbUrl(rootContext);
}
return result;
}
@@ -202,14 +209,14 @@
* @param jdbcConfiguration the connection configuration to use
* @throws TopiaNotFoundException if could not create root context
*/
- public void initDatabaseConfiguration(JdbcConfiguration jdbcConfiguration) throws TopiaNotFoundException {
+ public void initWorkingDb(JdbcConfiguration jdbcConfiguration) throws TopiaNotFoundException {
// close any previous db
- releaseDatabase();
+ releaseWorkingDb();
// creates a new topia root context from configuration
- EchoBaseTopiaRootContextFactory factory = new EchoBaseTopiaRootContextFactory();
- TopiaContext rootContext = factory.newDb(jdbcConfiguration);
+ TopiaContext rootContext =
+ EchobaseTopiaContexts.newWorkingDb(jdbcConfiguration);
// store it in session
set(PROPERTY_ROOT_CONTEXT, rootContext);
@@ -220,7 +227,7 @@
}
- public void releaseDatabase() {
+ public void releaseWorkingDb() {
TopiaContext rootContext = getRootContext();
@@ -299,7 +306,7 @@
}
public boolean isAdmin() {
- EchoBaseUser user = getEchoBaseUser();
+ EchoBaseUser user = getUser();
return user != null && user.isAdmin();
}
@@ -315,10 +322,10 @@
public void close() {
if (log.isInfoEnabled()) {
- log.info("Close user session for [" + getEchoBaseUser().getEmail() + "]");
+ log.info("Close user session for [" + getUser().getEmail() + "]");
}
try {
- releaseDatabase();
+ releaseWorkingDb();
} finally {
Set<String> keys = Sets.newHashSet(store.keySet());
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -0,0 +1,59 @@
+/*
+ * #%L
+ * T3 :: Web
+ *
+ * $Id$
+ * $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/java/fr/ird/t3/web/T… $
+ * %%
+ * Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.echobase.ui;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+/**
+ * To listen creation or destroying of user session (this is needed to close
+ * nicely any resources attached to this user session such as db connexions).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.1
+ */
+public class EchoBaseSessionListener implements HttpSessionListener {
+
+ @Override
+ public void sessionCreated(HttpSessionEvent se) {
+ // at creation time, nothing to do since we do not use directly
+ // the httpSession but the wrap offers by xworks
+ }
+
+ @Override
+ public void sessionDestroyed(HttpSessionEvent se) {
+ EchoBaseSession session = EchoBaseSession.getEchoBaseSession(se.getSession());
+ if (session.isUserInSession()) {
+
+ // only destroy the session if a user is loggued (otherwise there
+ // is nothing to clear)
+ ServletContext servletContext = se.getSession().getServletContext();
+ EchoBaseApplicationContext applicationContext =
+ EchoBaseApplicationContext.getApplicationContext(servletContext);
+ applicationContext.destroyEchoBaseSession(session);
+ }
+ }
+
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,8 +23,10 @@
* #L%
*/
+import com.opensymphony.xwork2.ActionContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsStatics;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaRuntimeException;
@@ -52,12 +54,18 @@
public static final String USER_TRANSACTION = "userTransaction";
- public static TopiaContext getTransaction(ServletRequest request) {
- TopiaContext topiaContext = (TopiaContext)
- request.getAttribute(USER_TRANSACTION);
- return topiaContext;
+ public static TopiaContext getTransaction(ActionContext context) {
+ HttpServletRequest request = (HttpServletRequest)
+ context.get(StrutsStatics.HTTP_REQUEST);
+ return (TopiaContext) request.getAttribute(USER_TRANSACTION);
}
+// public static TopiaContext getTransaction(ServletRequest request) {
+// TopiaContext topiaContext = (TopiaContext)
+// request.getAttribute(USER_TRANSACTION);
+// return topiaContext;
+// }
+
@Override
public void init(FilterConfig filterConfig) throws ServletException {
super.init(filterConfig);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -25,7 +25,7 @@
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.Preparable;
-import fr.ifremer.echobase.EchoBaseEntityHelper;
+import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration;
import org.nuiton.topia.TopiaContext;
@@ -82,14 +82,10 @@
// in more than one request
TopiaContext topiaContext =
- EchoBaseEntityHelper.newTransactionFromRootContext(getTransaction());
+ EchoBaseEntityHelper.newTransactionFromRootContext(getServiceContext().getTransaction());
-// TopiaContextImplementor tx =
-// (TopiaContextImplementor) serviceContext.getTransaction();
-// TopiaContextImplementor rootContext = tx.getRootContext();
-// TopiaContext topiaContext = rootContext.beginTransaction();
- serviceContext.setTransaction(topiaContext);
try {
+ serviceContext.setTransaction(topiaContext);
startAction(model);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,32 +23,22 @@
*/
package fr.ifremer.echobase.ui.actions;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.I18nAble;
-import fr.ifremer.echobase.InputFile;
import fr.ifremer.echobase.services.DecoratorService;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseService;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
-import fr.ifremer.echobase.services.EchoBaseServiceFactory;
+import fr.ifremer.echobase.services.ServiceFactoryAware;
import fr.ifremer.echobase.ui.EchoBaseApplicationContext;
+import fr.ifremer.echobase.ui.EchoBaseInternalDbTransactionFilter;
import fr.ifremer.echobase.ui.EchoBaseSession;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts2.StrutsStatics;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.framework.TopiaTransactionAware;
+import fr.ifremer.echobase.ui.EchoBaseWorkingDbTransactionFilter;
import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.web.filter.TopiaTransactionFilter;
import org.nuiton.web.struts2.BaseAction;
-import javax.servlet.http.HttpServletRequest;
-import java.io.File;
-import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
@@ -56,29 +46,20 @@
/**
* EchoBase action support.
- * <p/>
- * <b>Note :</b> All actions must implement this class to have a better i18n
- * support, when a i18n key is not translated it has a empty translation and
- * we do NOT want this behaviour in gui, prefer to return the marked
- * untranslated key.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class EchoBaseActionSupport extends BaseAction implements TopiaTransactionAware {
+public class EchoBaseActionSupport extends BaseAction implements ServiceFactoryAware {
private static final long serialVersionUID = 1L;
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(EchoBaseActionSupport.class);
+ private static final SimpleDateFormat dateFormat =
+ new SimpleDateFormat("dd/MM/yyyy");
- private SimpleDateFormat dateFormat;
+ private static final SimpleDateFormat monthFormat =
+ new SimpleDateFormat("mm-yyyy");
- private SimpleDateFormat monthFormat;
-
- private transient DecoratorService decoratorService;
-
private static EchoBaseApplicationContext applicationContext;
public static EchoBaseApplicationContext getEchoBaseApplicationContext() {
@@ -89,6 +70,10 @@
return applicationContext;
}
+ public static String getApplicationVersion() {
+ return getEchoBaseApplicationContext().getConfiguration().getApplicationVersion().toString();
+ }
+
protected EchoBaseConfiguration getConfiguration() {
return getEchoBaseApplicationContext().getConfiguration();
}
@@ -96,30 +81,8 @@
/** EchoBase User session. */
private transient EchoBaseSession echoBaseSession;
- /**
- * Provides a way to get a service.
- * <p/>
- * Actions may <strong>not</strong> call it directly by use
- * {@link #newService(Class)} instead.
- */
- protected transient EchoBaseServiceFactory serviceFactory;
-
protected transient EchoBaseServiceContext serviceContext;
- /**
- * Working db transaction (may be {@code null} if user has not yet select a db).
- *
- * @since 1.1
- */
- protected transient TopiaContext transaction;
-
- /**
- * Internal db transaction (can not be {@code null}).
- *
- * @since 1.1
- */
- protected transient TopiaContext internalTransaction;
-
public EchoBaseSession getEchoBaseSession() {
if (echoBaseSession == null) {
@@ -129,16 +92,6 @@
return echoBaseSession;
}
- public boolean isAdmin() {
- EchoBaseSession session = getEchoBaseSession();
- boolean result = session.isAdmin();
- return result;
- }
-
- public static String getApplicationVersion() {
- return getEchoBaseApplicationContext().getConfiguration().getApplicationVersion().toString();
- }
-
/**
* Fabrique pour récupérer le ServiceContext tel qu'il devrait être fourni
* à la fabrication d'un service.
@@ -149,119 +102,52 @@
if (serviceContext == null) {
serviceContext = DefaultEchoBaseServiceContext.newContext(
getLocale(),
- getInternalTransaction(),
- getTransaction(),
+ EchoBaseInternalDbTransactionFilter.getTransaction(getActionContext()),
+ EchoBaseWorkingDbTransactionFilter.getTransaction(getActionContext()),
getConfiguration(),
- getEchoBaseApplicationContext().getDbMeta(),
- getServiceFactory()
+ getEchoBaseApplicationContext().getDbMeta()
);
}
return serviceContext;
}
- public EchoBaseServiceFactory getServiceFactory() {
- if (serviceFactory == null) {
- serviceFactory = new EchoBaseServiceFactory();
- }
- return serviceFactory;
- }
-
/**
* Sub-classes should use this method to easily get a service instance.
*
* @param serviceClass The type of service to instantiate
* @return A newly created service of the expected type with necessary data set
*/
- public <E extends EchoBaseService> E newService(Class<E> serviceClass) {
- E service = getServiceFactory().newService(serviceClass,
- getServiceContext());
+ @Override
+ public <E extends EchoBaseService> E getService(Class<E> serviceClass) {
+ E service = getServiceContext().getService(serviceClass);
return service;
}
- @Override
- public TopiaContext getTransaction() {
- if (transaction == null) {
- HttpServletRequest request = (HttpServletRequest)
- getActionContext().get(StrutsStatics.HTTP_REQUEST);
- transaction = TopiaTransactionFilter.getTransaction(request);
- }
- return transaction;
+ public boolean isAdmin() {
+ EchoBaseSession session = getEchoBaseSession();
+ boolean result = session.isAdmin();
+ return result;
}
- public TopiaContext getInternalTransaction() {
- if (transaction == null) {
- HttpServletRequest request = (HttpServletRequest)
- getActionContext().get(StrutsStatics.HTTP_REQUEST);
- transaction = TopiaTransactionFilter.getTransaction(request);
- }
- return transaction;
- }
-
- @Override
- public void setTransaction(TopiaContext transaction) {
- this.transaction = transaction;
- }
-
public String formatDate(Date date) {
- String result = getDateFormat().format(date);
+ String result = dateFormat.format(date);
return result;
}
public String formatMonth(Date date) {
- String result = getMonthFormat().format(date);
+ String result = monthFormat.format(date);
return result;
}
public <E extends TopiaEntity> Map<String, String> sortAndDecorate(Collection<E> beans, String context) {
- return getDecoratorService().sortAndDecorate(getLocale(), beans, context);
+ DecoratorService decoratorService = getService(DecoratorService.class);
+ return decoratorService.sortAndDecorate(getLocale(), beans, context);
}
- public String decorate(Object o, String context) {
- return getDecoratorService().decorate(getLocale(), o, context);
- }
-
- protected SimpleDateFormat getDateFormat() {
- if (dateFormat == null) {
- dateFormat = new SimpleDateFormat("dd/MM/yyyy");
- }
- return dateFormat;
- }
-
- protected SimpleDateFormat getMonthFormat() {
- if (monthFormat == null) {
- monthFormat = new SimpleDateFormat("mm-yyyy");
- }
- return monthFormat;
- }
-
- protected DecoratorService getDecoratorService() {
- if (decoratorService == null) {
- decoratorService = newService(DecoratorService.class);
- }
- return decoratorService;
- }
-
protected static ActionContext getActionContext() {
return ActionContext.getContext();
}
- protected void copyFile(InputFile inputFile,
- File dataDirectory) throws IOException {
- Preconditions.checkNotNull(inputFile);
- Preconditions.checkNotNull(dataDirectory);
- File source = inputFile.getFile();
- Preconditions.checkNotNull(source);
-
- File target = new File(dataDirectory, inputFile.getFileName());
- if (log.isInfoEnabled()) {
- log.info("Copy file " + source + " to " + target);
- }
- FileUtils.copyFile(source, target);
-
- // keep target (source file will be removed at the end of this action)
- inputFile.setFile(target);
- }
-
protected <E extends Enum<E> & I18nAble> Map<String, String> decorateEnums(E... enumValues) {
Map<String, String> result = Maps.newLinkedHashMap();
for (E enumValue : enumValues) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -88,7 +88,7 @@
} else {
// load table metas
- DbEditorService dbEditorService = newService(DbEditorService.class);
+ DbEditorService dbEditorService = getService(DbEditorService.class);
tableMeta = dbEditorService.getTableMeta(entityType);
}
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -95,7 +95,7 @@
@Override
public String execute() throws Exception {
- ExportService exportService = newService(ExportService.class);
+ ExportService exportService = getService(ExportService.class);
TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType);
String content = exportService.exportData(table, exportAsSeen);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -92,7 +92,7 @@
log.debug("sord = " + ascendantOrder);
}
- DbEditorService service = newService(DbEditorService.class);
+ DbEditorService service = getService(DbEditorService.class);
datas = service.getDatas(
entityType,
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -74,7 +74,7 @@
@Override
public String execute() throws Exception {
- DbEditorService service = newService(DbEditorService.class);
+ DbEditorService service = getService(DbEditorService.class);
TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -58,7 +58,7 @@
@Override
public String execute() throws Exception {
- DbEditorService service = newService(DbEditorService.class);
+ DbEditorService service = getService(DbEditorService.class);
List<? extends TopiaEntity> foreignEntities =
service.getForeignDatas(entityType.getContract());
entities = sortAndDecorate(foreignEntities, null);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -127,14 +127,14 @@
@InputConfig(methodName = "input")
public String execute() throws Exception {
- ImportService importService = newService(ImportService.class);
+ ImportService importService = getService(ImportService.class);
try {
result = importService.importDatas(getEntityType(),
importFileFileName,
importFile,
createIfNotFound,
- getEchoBaseSession().getEchoBaseUser());
+ getEchoBaseSession().getUser());
} catch (Exception eee) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -70,7 +70,7 @@
@Override
public String execute() throws Exception {
- DbEditorService service = newService(DbEditorService.class);
+ DbEditorService service = getService(DbEditorService.class);
TableMeta<EchoBaseEntityEnum> tableMeta = service.getTableMeta(entityType);
Map<String, String> properties = Maps.newHashMap();
List<String> columnNames = tableMeta.getColumnNames();
@@ -94,7 +94,7 @@
service.saveEntity(tableMeta,
properties,
- getEchoBaseSession().getEchoBaseUser());
+ getEchoBaseSession().getUser());
return SUCCESS;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -53,7 +53,7 @@
@Override
public void prepare() throws Exception {
super.prepare();
- service = newService(EmbeddedApplicationService.class);
+ service = getService(EmbeddedApplicationService.class);
}
@Override
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -93,7 +93,7 @@
actionModel.setWarLocation(warLocation);
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
List<Voyage> allVoyages = service.getEntities(Voyage.class);
if (CollectionUtils.isEmpty(allVoyages)) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -53,7 +53,7 @@
@Override
public void prepare() throws Exception {
super.prepare();
- service = newService(ExportDbService.class);
+ service = getService(ExportDbService.class);
}
@Override
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/DownloadExportQueryResult.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -81,7 +81,7 @@
@Override
public String execute() throws Exception {
- ExportQueryService service = newService(ExportQueryService.class);
+ ExportQueryService service = getService(ExportQueryService.class);
contentType = "text/csv";
String content = service.createCsvFileContent(sql);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -71,7 +71,7 @@
public String execute() throws Exception {
// obtain columNames from the request
- ExportQueryService service = newService(ExportQueryService.class);
+ ExportQueryService service = getService(ExportQueryService.class);
try {
columnNames = service.getColumnNames(sql);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/GetExportQueryResult.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -74,7 +74,7 @@
@Override
public String execute() throws Exception {
- ExportQueryService service = newService(ExportQueryService.class);
+ ExportQueryService service = getService(ExportQueryService.class);
datas = service.executeSql(sql, pager);
return SUCCESS;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,7 +27,7 @@
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.ExportQuery;
import fr.ifremer.echobase.services.exportquery.ExportQueryService;
-import fr.ifremer.echobase.services.exceptions.ExportQueryNameAlreadyExistException;
+import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -67,7 +67,7 @@
public ExportQueryService getService() {
if (service == null) {
- service = newService(ExportQueryService.class);
+ service = getService(ExportQueryService.class);
}
return service;
}
@@ -120,7 +120,7 @@
if (safeSql) {
try {
query = getService().createOrUpdate(getQuery(),
- getEchoBaseSession().getEchoBaseUser()
+ getEchoBaseSession().getUser()
);
result = SUCCESS;
@@ -138,7 +138,7 @@
getQuery().setTopiaId(null);
getQuery().setName(getQuery().getName() + "-clone");
query = getService().createOrUpdate(getQuery(),
- getEchoBaseSession().getEchoBaseUser()
+ getEchoBaseSession().getUser()
);
return SUCCESS;
}
@@ -217,7 +217,7 @@
query = getService().getExportQuery(selectedQueryId);
EchoBaseUser echoBaseUser =
- getEchoBaseSession().getEchoBaseUser();
+ getEchoBaseSession().getUser();
canUpdateQuery = echoBaseUser.isAdmin() ||
echoBaseUser.getEmail().equals(
query.getLastModifiedUser());
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/NewLibreOfficeQuery.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/NewLibreOfficeQuery.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/NewLibreOfficeQuery.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -68,7 +68,7 @@
log.info("Incoming query = " + libreOfficeQuery);
}
- ExportQueryService service = newService(ExportQueryService.class);
+ ExportQueryService service = getService(ExportQueryService.class);
resultQuery = service.processLibreOfficeSqlQuery(libreOfficeQuery);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -24,7 +24,9 @@
package fr.ifremer.echobase.ui.actions.importData;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.InputFile;
+import fr.ifremer.echobase.services.DecoratorService;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
@@ -95,7 +97,7 @@
for (InputFile inputFile : importModel.getInputFiles()) {
if (inputFile.hasFile()) {
- copyFile(inputFile, dataDirectory);
+ EchoBaseIOUtil.copyFile(inputFile, dataDirectory);
}
}
setInSession(importModel);
@@ -117,7 +119,10 @@
protected <E extends TopiaEntity> Map<String, String> loadSortAndDecorate(EchoBaseServiceSupport service, Class<E> beanType) {
+ DecoratorService decoratorService =
+ service.getService(DecoratorService.class);
+
List<E> beans = service.getEntities(beanType);
- return getDecoratorService().sortAndDecorate(getLocale(), beans, null);
+ return decoratorService.sortAndDecorate(getLocale(), beans, null);
}
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -88,7 +88,7 @@
super.prepare();
- service = newService(serviceType);
+ service = getService(serviceType);
}
@Override
@@ -99,7 +99,7 @@
try {
result = service.doImport(model,
- getEchoBaseSession().getEchoBaseUser());
+ getEchoBaseSession().getUser());
addActionMessage(_("echobase.info.import.succeded"));
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -61,7 +61,7 @@
super.input();
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
voyages = loadSortAndDecorate(service, Voyage.class);
cellPositionReferences = decorateEnums(CellPositionReference.values());
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -58,7 +58,7 @@
super.input();
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
voyages = loadSortAndDecorate(service, Voyage.class);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -71,7 +71,7 @@
super.input();
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
missions = loadSortAndDecorate(service, Mission.class);
voyages = loadSortAndDecorate(service, Voyage.class);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -58,7 +58,7 @@
super.input();
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
voyages = loadSortAndDecorate(service, Voyage.class);
return INPUT;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -69,7 +69,7 @@
super.input();
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
voyages = loadSortAndDecorate(service, Voyage.class);
vessels = loadSortAndDecorate(service, Vessel.class);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import fr.ifremer.echobase.entities.references.Mission;
import fr.ifremer.echobase.entities.references.MissionImpl;
-import fr.ifremer.echobase.services.exceptions.MissionNameAlreadyExistException;
+import fr.ifremer.echobase.services.importdata.MissionNameAlreadyExistException;
import fr.ifremer.echobase.services.importdata.CommonImportService;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.logging.Log;
@@ -64,14 +64,14 @@
try {
CommonImportService service =
- newService(CommonImportService.class);
+ getService(CommonImportService.class);
Mission missionSaved = service.createMission(mission);
if (log.isInfoEnabled()) {
log.info("Created mission : " + missionSaved.getTopiaId());
}
- getTransaction().commitTransaction();
- addActionMessage(_("echobase.information.mission.created", missionSaved.getName()));
+ addActionMessage(
+ _("echobase.information.mission.created", missionSaved.getName()));
result = SUCCESS;
} catch (MissionNameAlreadyExistException e) {
addFieldError("mission.name",
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetDataProcessingsForVoyage.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetDataProcessingsForVoyage.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetDataProcessingsForVoyage.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -64,7 +64,7 @@
} else {
ResultsImportService service =
- newService(ResultsImportService.class);
+ getService(ResultsImportService.class);
Voyage voyage = service.getEntityById(Voyage.class, voyageId);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetVesselsForVoyage.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetVesselsForVoyage.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/GetVesselsForVoyage.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -27,6 +27,7 @@
import com.google.common.collect.Maps;
import fr.ifremer.echobase.entities.data.Voyage;
import fr.ifremer.echobase.entities.references.Vessel;
+import fr.ifremer.echobase.services.DecoratorService;
import fr.ifremer.echobase.services.EchoBaseServiceSupport;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.lang3.StringUtils;
@@ -66,7 +67,7 @@
if (StringUtils.isNotEmpty(voyageId)) {
EchoBaseServiceSupport service =
- newService(EchoBaseServiceSupport.class);
+ getService(EchoBaseServiceSupport.class);
Voyage voyage = service.getEntityById(Voyage.class, voyageId);
@@ -74,10 +75,12 @@
"Could not find voyage with id " + voyageId);
if (!voyage.isTransitEmpty()) {
+ DecoratorService decoratorService =
+ service.getService(DecoratorService.class);
Decorator<Vessel> decorator =
- getDecoratorService().getDecorator(getLocale(),
- Vessel.class,
- null);
+ decoratorService.getDecorator(getLocale(),
+ Vessel.class,
+ null);
Set<Vessel> allVessels = voyage.getAllVessels();
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -23,7 +23,8 @@
*/
package fr.ifremer.echobase.ui.actions.importDb;
-import fr.ifremer.echobase.InputFile;
+import fr.ifremer.echobase.io.EchoBaseIOUtil;
+import fr.ifremer.echobase.io.InputFile;
import fr.ifremer.echobase.services.importdb.ImportDbConfiguration;
import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
import org.apache.commons.io.FileUtils;
@@ -91,7 +92,7 @@
}
InputFile input = configuration.getInput();
- copyFile(input, dataDirectory);
+ EchoBaseIOUtil.copyFile(input, dataDirectory);
// store configuration in session
getEchoBaseSession().setImportDbConfiguration(configuration);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -55,7 +55,7 @@
super.prepare();
- service = newService(ImportDbService.class);
+ service = getService(ImportDbService.class);
}
@Override
@@ -65,7 +65,7 @@
model.getInput().getFileName());
}
- service.importDb(model, getEchoBaseSession().getEchoBaseUser(), true, false);
+ service.importDb(model, getEchoBaseSession().getUser(), true, false);
}
@Override
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -94,7 +94,7 @@
jdbcDriver = properties.getProperty(TopiaContextFactory.CONFIG_DRIVER);
EmbeddedApplicationService service =
- newService(EmbeddedApplicationService.class);
+ getService(EmbeddedApplicationService.class);
String pilotName;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -48,7 +48,7 @@
public UserService getUserService() {
if (userService == null) {
- userService = newService(UserService.class);
+ userService = getService(UserService.class);
}
return userService;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -54,7 +54,7 @@
public UserService getUserService() {
if (userService == null) {
- userService = newService(UserService.class);
+ userService = getService(UserService.class);
}
return userService;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -72,7 +72,7 @@
public String execute() throws Exception {
List<EchoBaseUser> allUsers =
- newService(UserService.class).getUsers(pager);
+ getService(UserService.class).getUsers(pager);
users = new Map[allUsers.size()];
Binder<EchoBaseUser, EchoBaseUser> binder =
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -60,7 +60,7 @@
public UserService getUserService() {
if (userService == null) {
- userService = newService(UserService.class);
+ userService = getService(UserService.class);
}
return userService;
}
@@ -96,7 +96,7 @@
EchoBaseSession userSession = getEchoBaseSession();
// user is authorized, keep it in his echoBaseSession
- userSession.setEchoBaseUser(user);
+ userSession.setUser(user);
// add locale in echoBaseSession if required
Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
@@ -119,12 +119,11 @@
EchoBaseSession userSession = getEchoBaseSession();
- // remove user from session
- userSession.setEchoBaseUser(null);
-
// remove echoBaseSession from application session
+ getEchoBaseApplicationContext().destroyEchoBaseSession(userSession);
+
+ // clean it from ActionContext (we never know...)
EchoBaseSession.removeEchoBaseSession(getActionContext());
-// ActionContext.getContext().getSession().remove(EchoBaseSession.SESSION_PARAMETER);
return SUCCESS;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -54,7 +54,7 @@
public UserService getUserService() {
if (userService == null) {
- userService = newService(UserService.class);
+ userService = getService(UserService.class);
}
return userService;
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -59,7 +59,7 @@
EchoBaseActionSupport action = (EchoBaseActionSupport) invocation.getAction();
EchoBaseSession echoBaseSession = action.getEchoBaseSession();
- boolean userLoggued = echoBaseSession.getEchoBaseUser() != null;
+ boolean userLoggued = echoBaseSession.getUser() != null;
if (!userLoggued) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java 2012-09-01 11:28:26 UTC (rev 587)
@@ -45,7 +45,7 @@
EchoBaseSession echoBaseSession = action.getEchoBaseSession();
- EchoBaseUser user = echoBaseSession.getEchoBaseUser();
+ EchoBaseUser user = echoBaseSession.getUser();
Preconditions.checkNotNull(user, "No user found is session");
return user.isAdmin();
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2012-08-31 13:09:10 UTC (rev 586)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2012-09-01 11:28:26 UTC (rev 587)
@@ -31,12 +31,16 @@
<filter>
<filter-name>internalDbTransaction</filter-name>
- <filter-class>fr.ifremer.echobase.ui.EchoBaseInternalDbTransactionFilter</filter-class>
+ <filter-class>
+ fr.ifremer.echobase.ui.EchoBaseInternalDbTransactionFilter
+ </filter-class>
</filter>
<filter>
<filter-name>workingDbTransaction</filter-name>
- <filter-class>fr.ifremer.echobase.ui.EchoBaseWorkingDbTransactionFilter</filter-class>
+ <filter-class>
+ fr.ifremer.echobase.ui.EchoBaseWorkingDbTransactionFilter
+ </filter-class>
</filter>
<filter>
@@ -84,10 +88,19 @@
</filter-mapping>
<listener>
- <description>Init</description>
- <listener-class>fr.ifremer.echobase.ui.EchoBaseApplicationListener</listener-class>
+ <description>Application listener</description>
+ <listener-class>
+ fr.ifremer.echobase.ui.EchoBaseApplicationListener
+ </listener-class>
</listener>
+ <listener>
+ <description>Session listener</description>
+ <listener-class>
+ fr.ifremer.echobase.ui.EchoBaseSessionListener
+ </listener-class>
+ </listener>
+
<welcome-file-list>
<welcome-file>/</welcome-file>
<welcome-file>index.jsp</welcome-file>
1
0