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
October 2013
- 3 participants
- 24 discussions
r857 - in trunk: echobase-domain/src/main/java/fr/ifremer/echobase/config echobase-domain/src/main/resources/i18n echobase-ui echobase-ui/src/main/assembly echobase-ui/src/main/java/fr/ifremer/echobase/ui src/site/en/rst src/site/rst
by tchemit@users.forge.codelutin.com 20 Oct '13
by tchemit@users.forge.codelutin.com 20 Oct '13
20 Oct '13
Author: tchemit
Date: 2013-10-20 17:37:21 +0200 (Sun, 20 Oct 2013)
New Revision: 857
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/857
Log:
fixes #3551: Simplifier la proc?\195?\169dure d'installation de l'application
Added:
trunk/echobase-ui/src/main/assembly/embedded-zip.xml
trunk/echobase-ui/src/main/assembly/full-war.xml
trunk/src/site/en/rst/usage.rst.vm
trunk/src/site/rst/usage.rst.vm
Removed:
trunk/echobase-ui/src/main/assembly/bin.xml
trunk/src/site/en/rst/usage.rst
trunk/src/site/rst/usage.rst
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfigurationOption.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-ui/deploy.sh
trunk/echobase-ui/pom.xml
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java 2013-10-20 15:37:21 UTC (rev 857)
@@ -150,7 +150,8 @@
}
public File getLibDirectory() {
- File file = new File(getDataDirectory(), "lib");
+ File file = applicationConfig.getOptionAsFile(
+ EchoBaseConfigurationOption.LIBRARY_DIRECTORY.key);
Preconditions.checkNotNull(file);
return file;
}
Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfigurationOption.java
===================================================================
--- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfigurationOption.java 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfigurationOption.java 2013-10-20 15:37:21 UTC (rev 857)
@@ -41,8 +41,12 @@
/** Main directory where to put echobase data (logs, and others...). */
DATA_DIRECTORY("echobase.data.directory",
n_("echobase.config.data.directory.description"),
- "/var/local/echobase",
+ "/var/local/echobase/data",
File.class),
+ LIBRARY_DIRECTORY("echobase.lib.directory",
+ n_("echobase.config.lib.directory.description"),
+ "${echobase.data.directory}/lib",
+ File.class),
INTERNAL_DB_DIRECTORY(
"echobase.internal.db.directory",
n_("echobase.config.internal.db.directory.description"),
@@ -64,7 +68,7 @@
";", char.class),
WAR_LOCATION("echobase.war.location",
n_("echobase.config.war.location.description"),
- "${echobase.data.directory}/war/echobase-ui-${echobase.version}-embedded.war",
+ "${echobase.lib.directory}/echobase-embedded-${echobase.version}.war",
File.class),
DOCUMENTATION_URL("echobase.documentationUrl",
n_("echobase.config.documentationUrl.description"),
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 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2013-10-20 15:37:21 UTC (rev 857)
@@ -34,6 +34,7 @@
echobase.config.embedded.description=Flag used for embedded application (will create a h2 working db configuration to access database)
echobase.config.h2Version.description=H2 jdbc driver version
echobase.config.internal.db.directory.description=Directory of the internal database
+echobase.config.lib.directory.description=Directory where to put internal libraries (jdbc drivers, embedded war)
echobase.config.postgresqlVersion.description=Postgresql driver version
echobase.config.version.description=Application version
echobase.config.war.location.description=Location of the war used to create embedded applications
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 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2013-10-20 15:37:21 UTC (rev 857)
@@ -32,6 +32,7 @@
echobase.config.embedded.description=Pour créer au démarrage une configuration vers la base h2 embarquée (uniquement pour les applications embarquées)
echobase.config.h2Version.description=Version du pilote jdbc H2
echobase.config.internal.db.directory.description=Répertoire de la base interne
+echobase.config.lib.directory.description=Chemin où sont stockés les libraires internes (drivers + application embarquée)
echobase.config.postgresqlVersion.description=Version du pilote jdbc Postgresql
echobase.config.version.description=Version de l'application
echobase.config.war.location.description=Chemin d'accèss au war embarqué à utiliser pour créer des applications embarquées
Modified: trunk/echobase-ui/deploy.sh
===================================================================
--- trunk/echobase-ui/deploy.sh 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-ui/deploy.sh 2013-10-20 15:37:21 UTC (rev 857)
@@ -1,6 +1,6 @@
#! /bin/sh
#mvn package
-cp target/*.war /var/local/echobase
+cp target/echobase-full-*.war /var/local/echobase
v=$( mvn help:evaluate -Dexpression=project.version | grep -v "INFO" | grep -v "WARNING" | grep -v "Download" )
echo "version=$v"
(cd /var/local/echobase; ./deploy.sh $v )
\ No newline at end of file
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-ui/pom.xml 2013-10-20 15:37:21 UTC (rev 857)
@@ -24,15 +24,16 @@
<env>dev</env>
+ <embeddedWarName>echobase-embedded-${project.version}</embeddedWarName>
+ <fullWarName>echobase-full-${project.version}</fullWarName>
+
<redmine.releaseFiles>
- ${project.build.directory}/${project.build.finalName}.war,
- ${project.build.directory}/${project.build.finalName}-embedded.war,
- ${project.build.directory}/${project.build.finalName}-embedded.zip
+ ${project.build.directory}/${fullWarName}.war,
+ ${project.build.directory}/${embeddedWarName}.zip
</redmine.releaseFiles>
<deployFiles>
- ${project.build.directory}/${project.build.finalName}.war,
- ${project.build.directory}/${project.build.finalName}-embedded.war
+ ${project.build.directory}/${fullWarName}.war
</deployFiles>
<!-- Post Release configuration -->
@@ -365,7 +366,6 @@
</property>
</activation>
<properties>
- <embeddedWarName>echobase-ui-${project.version}-embedded</embeddedWarName>
<embeddedTmpWarDir>
${project.build.directory}/${embeddedWarName}-temp
</embeddedTmpWarDir>
@@ -492,16 +492,12 @@
</executions>
</plugin>
- <!-- Build embedded zip -->
+ <!-- Build embedded zip + full war -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- </descriptors>
<attach>false</attach>
- <finalName>${embeddedWarName}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
@@ -511,7 +507,26 @@
<goals>
<goal>single</goal>
</goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/embedded-zip.xml</descriptor>
+ </descriptors>
+ <finalName>${embeddedWarName}</finalName>
+ </configuration>
</execution>
+ <execution>
+ <id>create-full-war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/full-war.xml</descriptor>
+ </descriptors>
+ <finalName>${fullWarName}</finalName>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
Deleted: trunk/echobase-ui/src/main/assembly/bin.xml
===================================================================
--- trunk/echobase-ui/src/main/assembly/bin.xml 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-ui/src/main/assembly/bin.xml 2013-10-20 15:37:21 UTC (rev 857)
@@ -1,69 +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%
- -->
-<assembly>
- <id>bin</id>
- <formats>
- <format>zip</format>
- </formats>
-
- <fileSets>
-
- <fileSet>
- <directory>target</directory>
- <outputDirectory>/</outputDirectory>
- <fileMode>0755</fileMode>
- <includes>
- <include>echobase-ui-${project.version}-embedded.war</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>target/classes</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>THIRD-PARTY.txt</include>
- <include>LICENSE.txt</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>src/main/assembly/dist</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>**/*.properties</include>
- <include>**/*.txt</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>src/main/assembly/dist</directory>
- <outputDirectory>/</outputDirectory>
- <fileMode>0755</fileMode>
- <filtered>true</filtered>
- <includes>
- <include>**/*.sh</include>
- <include>**/*.bat</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
Copied: trunk/echobase-ui/src/main/assembly/embedded-zip.xml (from rev 853, trunk/echobase-ui/src/main/assembly/bin.xml)
===================================================================
--- trunk/echobase-ui/src/main/assembly/embedded-zip.xml (rev 0)
+++ trunk/echobase-ui/src/main/assembly/embedded-zip.xml 2013-10-20 15:37:21 UTC (rev 857)
@@ -0,0 +1,72 @@
+<!--
+ #%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%
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>embedded-zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <fileMode>0755</fileMode>
+ <includes>
+ <include>${embeddedWarName}.war</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>THIRD-PARTY.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/assembly/dist</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>src/main/assembly/dist</directory>
+ <outputDirectory>/</outputDirectory>
+ <fileMode>0755</fileMode>
+ <filtered>true</filtered>
+ <includes>
+ <include>**/*.sh</include>
+ <include>**/*.bat</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: trunk/echobase-ui/src/main/assembly/full-war.xml
===================================================================
--- trunk/echobase-ui/src/main/assembly/full-war.xml (rev 0)
+++ trunk/echobase-ui/src/main/assembly/full-war.xml 2013-10-20 15:37:21 UTC (rev 857)
@@ -0,0 +1,54 @@
+<!--
+ #%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%
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>full-war</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+
+ <!-- content of primary war -->
+ <fileSet>
+ <directory>target/${project.build.finalName}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+
+ <!-- copy embedded war in WEB-INF/classes/embedded -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/WEB-INF/classes/embedded</outputDirectory>
+ <fileMode>0755</fileMode>
+ <includes>
+ <include>${embeddedWarName}.war</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Property changes on: trunk/echobase-ui/src/main/assembly/full-war.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2013-10-20 15:37:21 UTC (rev 857)
@@ -200,11 +200,11 @@
// init database (and create minimal admin user if required)
initInternalDatabase(serviceContext);
- // copy drivers if required
+ // extract files to library directory if required
try {
- copyDriverFiles(serviceContext);
+ extractFiles(serviceContext);
} catch (IOException e) {
- throw new TopiaException("Could not install drivers", e);
+ throw new TopiaException("Could not extract files (drivers + embedded war)", e);
}
}
@@ -367,10 +367,12 @@
}
}
- protected void copyDriverFiles(EchoBaseServiceContext serviceContext) throws IOException {
+ protected void extractFiles(EchoBaseServiceContext serviceContext) throws IOException {
EmbeddedApplicationService service =
serviceContext.newService(EmbeddedApplicationService.class);
EchoBaseConfiguration configuration = serviceContext.getConfiguration();
+
+ // copy drivers
File libDirectory = configuration.getLibDirectory();
for (DriverType driverType : DriverType.values()) {
String pilotFileName = driverType.getPilotFileName(configuration);
@@ -385,5 +387,19 @@
service.copyEmbeddedBinaryFile(pilotFileName, libDirectory);
}
}
+
+ // copy embedded war
+ File warLocation = configuration.getWarLocation();
+ File embeddedWarDirectory = warLocation.getParentFile();
+ String embeddedWarFileName = warLocation.getName();
+ if (!warLocation.exists()) {
+
+ // copy it from class-path
+ if (log.isInfoEnabled()) {
+ log.info("Copy embedded war " + embeddedWarFileName +
+ " to directory " + embeddedWarDirectory);
+ }
+ service.copyEmbeddedBinaryFile(embeddedWarFileName, embeddedWarDirectory);
+ }
}
}
Deleted: trunk/src/site/en/rst/usage.rst
===================================================================
--- trunk/src/site/en/rst/usage.rst 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/src/site/en/rst/usage.rst 2013-10-20 15:37:21 UTC (rev 857)
@@ -1,167 +0,0 @@
-.. -
-.. * #%L
-.. * EchoBase
-.. * $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%
-.. -
-
-====================
-Première utilisation
-====================
-
-Comment utiliser EchoBase
--------------------------
-
-*TODO Translate me*
-
-L'application est fournit sous deux modes:
-
-- une version en *mode portable* qui ne nécessite pas de serveur
-- une version en *mode serveur* qui nécessite l'installation d'*EchoBase* dans
- un serveur web de type *tomcat* ou *jetty*.
-
-Utiliser la version mode portable
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-En mode portable, pas besoin de serveur, il faut juste avoir java d'installer
-sur la machine.
-
-Pré-requis pour utilisation sous Windows
-________________________________________
-
-Installer un environnement d'exécution java.
-
-`Page de téléchargement Oracle`_
-
-Pré-requis pour utilisation sous Linux
-______________________________________
-
-Installer un environnement d'execution java .
-
-`Page de téléchargement Oracle`_
-
-Procédure d'installation
-________________________
-
-Une fois les pré-requis remplis, c'est très simple :
-
-- Récupérer l'archive zip `echobase-${project.version}-embedded.zip`_.
-
-- Décompresser l'archive, vous obtenez une arborescence de ce type:
-
-::
-
- echobase-ui-1.1-embedded
- ├── echobase.properties (1) Fichier de configuration de l'application embarquée
- ├── echobase-ui-${project.version}-embedded.war
- ├── LICENSE.txt
- ├── README.txt
- ├── startEchobase.bat (2) Script de démarrage (windows)
- ├── startEchobase.sh (3) Script de démarrage (linux)
- └── THIRD-PARTY.txt
-
-- Lancer le script *startEchobase.sh* (linux) ou *startEchobase.bat* (windows).
-
-L'application va démarrer et est accessible à l'adresse suivante:
-
-::
-
- http://localhost:8888
-
-Procédure détaillée (sous windows)
-__________________________________
-
-- Dézipper l'archive précédemment téléchargée du site central.
-
-- Ouvrir une console (Touche Windows + R , taper *cmd* , Touche Entrée)
-- Se placer dans le répertoire où a été dézippée l'archive
-
-::
-
- cd Chemin vers l'archive dézippée
-
-- Enfin lancer le script
-
-::
-
- startEchobase.bat
-
-- Dans la console on doit voir l'application démarré et produire des logs
-- Lorsque l'application est prête, un navigateur s'ouvre sur la page
- de login.
-
-Procédure détaillée (sous linux)
-________________________________
-
-- Dézipper l'archive précédemment téléchargée du site central.
-- Ouvrir une console
-- Se placer dans le répertoire où a été dézippée l'archive
-
-::
-
- cd Chemin vers l'archive dézippée
-
-- Rendre le script de démarrage exécutable
-
-::
-
- chmod +x startEchobase.sh
-
-- Enfin lancer le script
-
-::
-
- ./startEchobase.sh
-
-- Dans la console on doit voir l'application démarré et produire des logs
-- Lorsque l'application est prête, un navigateur s'ouvre sur la page
- de login.
-
-Utilisateurs
-____________
-
-Par défaut, deux utilisateurs sont fournis dans la base embarquée :
-
-- admin / admin (avec des droits d'administration)
-- user / user (pour la consultation)
-
-Configuration base de travail
-_____________________________
-
-Une configuration de base de travail est aussi crée automatiquement vers une
-base de type *H2* stoquée dans le répertoire *db* avec les identifiants suivants :
-
-- login: *sa*
-- mot de passe: *sa*
-
-Utiliser la version mode serveur
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Il faut que l'application est au préalable installée sur un serveur web.
-
-Demandez à votre administrateur l'url de connexion, et les identifiants.
-
-Si vous voulez installer EchoBase sur un serveur, veuillez consulter la
-`page installation`_.
-
-.. _echobase-${project.version}-embedded.zip: http://forge.codelutin.com/projects/echobase/files
-.. _page installation: ./install.html
-.. _Page de téléchargement Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html
-
-
Copied: trunk/src/site/en/rst/usage.rst.vm (from rev 853, trunk/src/site/en/rst/usage.rst)
===================================================================
--- trunk/src/site/en/rst/usage.rst.vm (rev 0)
+++ trunk/src/site/en/rst/usage.rst.vm 2013-10-20 15:37:21 UTC (rev 857)
@@ -0,0 +1,167 @@
+.. -
+.. * #%L
+.. * EchoBase
+.. * $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%
+.. -
+
+====================
+Première utilisation
+====================
+
+Comment utiliser EchoBase
+-------------------------
+
+*TODO Translate me*
+
+L'application est fournit sous deux modes:
+
+- une version en *mode portable* qui ne nécessite pas de serveur
+- une version en *mode serveur* qui nécessite l'installation d'*EchoBase* dans
+ un serveur web de type *tomcat* ou *jetty*.
+
+Utiliser la version mode portable
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+En mode portable, pas besoin de serveur, il faut juste avoir java d'installer
+sur la machine.
+
+Pré-requis pour utilisation sous Windows
+________________________________________
+
+Installer un environnement d'exécution java.
+
+`Page de téléchargement Oracle`_
+
+Pré-requis pour utilisation sous Linux
+______________________________________
+
+Installer un environnement d'execution java .
+
+`Page de téléchargement Oracle`_
+
+Procédure d'installation
+________________________
+
+Une fois les pré-requis remplis, c'est très simple :
+
+- Récupérer l'archive zip `echobase-embedded-${project.version}.zip`_.
+
+- Décompresser l'archive, vous obtenez une arborescence de ce type:
+
+::
+
+ echobase-embedded-${project.version}
+ ├── echobase.properties (1) Fichier de configuration de l'application embarquée
+ ├── echobase-embedded-${project.version}.war
+ ├── LICENSE.txt
+ ├── README.txt
+ ├── startEchobase.bat (2) Script de démarrage (windows)
+ ├── startEchobase.sh (3) Script de démarrage (linux)
+ └── THIRD-PARTY.txt
+
+- Lancer le script *startEchobase.sh* (linux) ou *startEchobase.bat* (windows).
+
+L'application va démarrer et est accessible à l'adresse suivante:
+
+::
+
+ http://localhost:8888
+
+Procédure détaillée (sous windows)
+__________________________________
+
+- Dézipper l'archive précédemment téléchargée du site central.
+
+- Ouvrir une console (Touche Windows + R , taper *cmd* , Touche Entrée)
+- Se placer dans le répertoire où a été dézippée l'archive
+
+::
+
+ cd Chemin vers l'archive dézippée
+
+- Enfin lancer le script
+
+::
+
+ startEchobase.bat
+
+- Dans la console on doit voir l'application démarré et produire des logs
+- Lorsque l'application est prête, un navigateur s'ouvre sur la page
+ de login.
+
+Procédure détaillée (sous linux)
+________________________________
+
+- Dézipper l'archive précédemment téléchargée du site central.
+- Ouvrir une console
+- Se placer dans le répertoire où a été dézippée l'archive
+
+::
+
+ cd Chemin vers l'archive dézippée
+
+- Rendre le script de démarrage exécutable
+
+::
+
+ chmod +x startEchobase.sh
+
+- Enfin lancer le script
+
+::
+
+ ./startEchobase.sh
+
+- Dans la console on doit voir l'application démarré et produire des logs
+- Lorsque l'application est prête, un navigateur s'ouvre sur la page
+ de login.
+
+Utilisateurs
+____________
+
+Par défaut, deux utilisateurs sont fournis dans la base embarquée :
+
+- admin / admin (avec des droits d'administration)
+- user / user (pour la consultation)
+
+Configuration base de travail
+_____________________________
+
+Une configuration de base de travail est aussi crée automatiquement vers une
+base de type *H2* stoquée dans le répertoire *db* avec les identifiants suivants :
+
+- login: *sa*
+- mot de passe: *sa*
+
+Utiliser la version mode serveur
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Il faut que l'application est au préalable installée sur un serveur web.
+
+Demandez à votre administrateur l'url de connexion, et les identifiants.
+
+Si vous voulez installer EchoBase sur un serveur, veuillez consulter la
+`page installation`_.
+
+.. _echobase-embedded-${project.version}.zip: http://forge.codelutin.com/projects/echobase/files
+.. _page installation: ./install.html
+.. _Page de téléchargement Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html
+
+
Deleted: trunk/src/site/rst/usage.rst
===================================================================
--- trunk/src/site/rst/usage.rst 2013-10-20 15:28:07 UTC (rev 856)
+++ trunk/src/site/rst/usage.rst 2013-10-20 15:37:21 UTC (rev 857)
@@ -1,165 +0,0 @@
-.. -
-.. * #%L
-.. * EchoBase
-.. * $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%
-.. -
-
-====================
-Première utilisation
-====================
-
-Comment utiliser EchoBase
--------------------------
-
-L'application est fournit sous deux modes:
-
-- une version en *mode portable* qui ne nécessite pas de serveur
-- une version en *mode serveur* qui nécessite l'installation d'*EchoBase* dans
- un serveur web de type *tomcat* ou *jetty*.
-
-Utiliser la version mode portable
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-En mode portable, pas besoin de serveur, il faut juste avoir java d'installer
-sur la machine.
-
-Pré-requis pour utilisation sous Windows
-________________________________________
-
-Installer un environnement d'exécution java.
-
-`Page de téléchargement Oracle`_
-
-Pré-requis pour utilisation sous Linux
-______________________________________
-
-Installer un environnement d'execution java .
-
-`Page de téléchargement Oracle`_
-
-Procédure d'installation
-________________________
-
-Une fois les pré-requis remplis, c'est très simple :
-
-- Récupérer l'archive zip `echobase-${project.version}-embedded.zip`_.
-
-- Décompresser l'archive, vous obtenez une arborescence de ce type:
-
-::
-
- echobase-ui-1.1-embedded
- ├── echobase.properties (1) Fichier de configuration de l'application embarquée
- ├── echobase-ui-${project.version}-embedded.war
- ├── LICENSE.txt
- ├── README.txt
- ├── startEchobase.bat (2) Script de démarrage (windows)
- ├── startEchobase.sh (3) Script de démarrage (linux)
- └── THIRD-PARTY.txt
-
-- Lancer le script *startEchobase.sh* (linux) ou *startEchobase.bat* (windows).
-
-L'application va démarrer et est accessible à l'adresse suivante:
-
-::
-
- http://localhost:8888
-
-Procédure détaillée (sous windows)
-__________________________________
-
-- Dézipper l'archive précédemment téléchargée du site central.
-
-- Ouvrir une console (Touche Windows + R , taper *cmd* , Touche Entrée)
-- Se placer dans le répertoire où a été dézippée l'archive
-
-::
-
- cd Chemin vers l'archive dézippée
-
-- Enfin lancer le script
-
-::
-
- startEchobase.bat
-
-- Dans la console on doit voir l'application démarré et produire des logs
-- Lorsque l'application est prête, un navigateur s'ouvre sur la page
- de login.
-
-Procédure détaillée (sous linux)
-________________________________
-
-- Dézipper l'archive précédemment téléchargée du site central.
-- Ouvrir une console
-- Se placer dans le répertoire où a été dézippée l'archive
-
-::
-
- cd Chemin vers l'archive dézippée
-
-- Rendre le script de démarrage exécutable
-
-::
-
- chmod +x startEchobase.sh
-
-- Enfin lancer le script
-
-::
-
- ./startEchobase.sh
-
-- Dans la console on doit voir l'application démarré et produire des logs
-- Lorsque l'application est prête, un navigateur s'ouvre sur la page
- de login.
-
-Utilisateurs
-____________
-
-Par défaut, deux utilisateurs sont fournis dans la base embarquée :
-
-- admin / admin (avec des droits d'administration)
-- user / user (pour la consultation)
-
-Configuration base de travail
-_____________________________
-
-Une configuration de base de travail est aussi crée automatiquement vers une
-base de type *H2* stoquée dans le répertoire *db* avec les identifiants suivants :
-
-- login: *sa*
-- mot de passe: *sa*
-
-Utiliser la version mode serveur
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Il faut que l'application est au préalable installée sur un serveur web.
-
-Demandez à votre administrateur l'url de connexion, et les identifiants.
-
-Si vous voulez installer EchoBase sur un serveur, veuillez consulter la
-`page installation`_.
-
-.. _echobase-${project.version}-embedded.zip: http://forge.codelutin.com/projects/echobase/files
-.. _page installation: ./install.html
-.. _Page de téléchargement Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html
-
-
Copied: trunk/src/site/rst/usage.rst.vm (from rev 853, trunk/src/site/rst/usage.rst)
===================================================================
--- trunk/src/site/rst/usage.rst.vm (rev 0)
+++ trunk/src/site/rst/usage.rst.vm 2013-10-20 15:37:21 UTC (rev 857)
@@ -0,0 +1,165 @@
+.. -
+.. * #%L
+.. * EchoBase
+.. * $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%
+.. -
+
+====================
+Première utilisation
+====================
+
+Comment utiliser EchoBase
+-------------------------
+
+L'application est fournit sous deux modes:
+
+- une version en *mode portable* qui ne nécessite pas de serveur
+- une version en *mode serveur* qui nécessite l'installation d'*EchoBase* dans
+ un serveur web de type *tomcat* ou *jetty*.
+
+Utiliser la version mode portable
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+En mode portable, pas besoin de serveur, il faut juste avoir java d'installer
+sur la machine.
+
+Pré-requis pour utilisation sous Windows
+________________________________________
+
+Installer un environnement d'exécution java.
+
+`Page de téléchargement Oracle`_
+
+Pré-requis pour utilisation sous Linux
+______________________________________
+
+Installer un environnement d'execution java .
+
+`Page de téléchargement Oracle`_
+
+Procédure d'installation
+________________________
+
+Une fois les pré-requis remplis, c'est très simple :
+
+- Récupérer l'archive zip `echobase-embedded-${project.version}.zip`_.
+
+- Décompresser l'archive, vous obtenez une arborescence de ce type:
+
+::
+
+ echobase-embedded-${project.version}
+ ├── echobase.properties (1) Fichier de configuration de l'application embarquée
+ ├── echobase-embedded-${project.version}.war
+ ├── LICENSE.txt
+ ├── README.txt
+ ├── startEchobase.bat (2) Script de démarrage (windows)
+ ├── startEchobase.sh (3) Script de démarrage (linux)
+ └── THIRD-PARTY.txt
+
+- Lancer le script *startEchobase.sh* (linux) ou *startEchobase.bat* (windows).
+
+L'application va démarrer et est accessible à l'adresse suivante:
+
+::
+
+ http://localhost:8888
+
+Procédure détaillée (sous windows)
+__________________________________
+
+- Dézipper l'archive précédemment téléchargée du site central.
+
+- Ouvrir une console (Touche Windows + R , taper *cmd* , Touche Entrée)
+- Se placer dans le répertoire où a été dézippée l'archive
+
+::
+
+ cd Chemin vers l'archive dézippée
+
+- Enfin lancer le script
+
+::
+
+ startEchobase.bat
+
+- Dans la console on doit voir l'application démarré et produire des logs
+- Lorsque l'application est prête, un navigateur s'ouvre sur la page
+ de login.
+
+Procédure détaillée (sous linux)
+________________________________
+
+- Dézipper l'archive précédemment téléchargée du site central.
+- Ouvrir une console
+- Se placer dans le répertoire où a été dézippée l'archive
+
+::
+
+ cd Chemin vers l'archive dézippée
+
+- Rendre le script de démarrage exécutable
+
+::
+
+ chmod +x startEchobase.sh
+
+- Enfin lancer le script
+
+::
+
+ ./startEchobase.sh
+
+- Dans la console on doit voir l'application démarré et produire des logs
+- Lorsque l'application est prête, un navigateur s'ouvre sur la page
+ de login.
+
+Utilisateurs
+____________
+
+Par défaut, deux utilisateurs sont fournis dans la base embarquée :
+
+- admin / admin (avec des droits d'administration)
+- user / user (pour la consultation)
+
+Configuration base de travail
+_____________________________
+
+Une configuration de base de travail est aussi crée automatiquement vers une
+base de type *H2* stoquée dans le répertoire *db* avec les identifiants suivants :
+
+- login: *sa*
+- mot de passe: *sa*
+
+Utiliser la version mode serveur
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Il faut que l'application est au préalable installée sur un serveur web.
+
+Demandez à votre administrateur l'url de connexion, et les identifiants.
+
+Si vous voulez installer EchoBase sur un serveur, veuillez consulter la
+`page installation`_.
+
+.. _echobase-embedded-${project.version}.zip: http://forge.codelutin.com/projects/echobase/files
+.. _page installation: ./install.html
+.. _Page de téléchargement Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html
+
+
1
0
r856 - in trunk: . echobase-ui/src/main/resources echobase-ui/src/main/resources/config
by tchemit@users.forge.codelutin.com 20 Oct '13
by tchemit@users.forge.codelutin.com 20 Oct '13
20 Oct '13
Author: tchemit
Date: 2013-10-20 17:28:07 +0200 (Sun, 20 Oct 2013)
New Revision: 856
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/856
Log:
fixes #3552: Updates struts to 2.3.15.3
Modified:
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/resources/struts.xml
trunk/pom.xml
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2013-10-20 13:45:37 UTC (rev 855)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2013-10-20 15:28:07 UTC (rev 856)
@@ -31,6 +31,14 @@
<package name="user" extends="loggued" namespace="/user">
+ <!-- Login Input -->
+ <action name="loginInput" class="fr.ifremer.echobase.ui.actions.user.Login"
+ method="input">
+ <result name="input">/WEB-INF/jsp/user/login.jsp</result>
+ <result name="redirect" type="redirect">${redirectAction}</result>
+ <interceptor-ref name="echobaseDefaultStack"/>
+ </action>
+
<!-- Login -->
<action name="login" class="fr.ifremer.echobase.ui.actions.user.Login"
method="execute">
@@ -55,8 +63,7 @@
</action>
<!-- CRUD on user -->
- <action name="user-*"
- class="fr.ifremer.echobase.ui.actions.user.{1}">
+ <action name="user-*" class="fr.ifremer.echobase.ui.actions.user.{1}">
<interceptor-ref name="checkUserIsAdmin"/>
<interceptor-ref name="prepareParamsStackLoggued"/>
<result name="input">/WEB-INF/jsp/user/{1}.jsp</result>
Modified: trunk/echobase-ui/src/main/resources/struts.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/struts.xml 2013-10-20 13:45:37 UTC (rev 855)
+++ trunk/echobase-ui/src/main/resources/struts.xml 2013-10-20 15:28:07 UTC (rev 856)
@@ -38,6 +38,9 @@
name="i18nTextProvider"
type="com.opensymphony.xwork2.TextProvider"/>
+ <constant name="struts.enable.DynamicMethodInvocation" value="true"/>
+ <constant name="struts.mapper.action.prefix.enabled" value="true"/>
+
<constant name="struts.xworkTextProvider" value="i18nTextProvider"/>
<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
@@ -81,7 +84,7 @@
<!-- to check if user is loggued -->
<interceptor name="checkUserLoggued"
class="fr.ifremer.echobase.ui.interceptors.CheckLogguedInterceptor">
- <param name="loginAction">user/login!input</param>
+ <param name="loginAction">user/loginInput</param>
<param name="redirectAction">/home</param>
</interceptor>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-20 13:45:37 UTC (rev 855)
+++ trunk/pom.xml 2013-10-20 15:28:07 UTC (rev 856)
@@ -145,7 +145,7 @@
<nuitonI18nVersion>2.5.1</nuitonI18nVersion>
<nuitonWebVersion>1.14</nuitonWebVersion>
<msaccessImporterVersion>1.4.1</msaccessImporterVersion>
- <struts2Version>2.3.15.1</struts2Version>
+ <struts2Version>2.3.15.3</struts2Version>
<jqueryPluginVersion>3.6.0</jqueryPluginVersion>
<h2Version>1.3.173</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
1
0
r855 - trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui
by tchemit@users.forge.codelutin.com 20 Oct '13
by tchemit@users.forge.codelutin.com 20 Oct '13
20 Oct '13
Author: tchemit
Date: 2013-10-20 15:45:37 +0200 (Sun, 20 Oct 2013)
New Revision: 855
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/855
Log:
improve init code
Modified:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
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 2013-10-19 13:06:51 UTC (rev 854)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2013-10-20 13:45:37 UTC (rev 855)
@@ -27,6 +27,8 @@
import com.google.common.collect.Sets;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.config.EchoBaseConfiguration;
+import fr.ifremer.echobase.entities.DriverType;
+import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.TopiaEchoBaseInternalPersistenceContext;
import fr.ifremer.echobase.entities.TopiaEchoBasePersistenceContext;
import fr.ifremer.echobase.entities.spatial.SpatialDataCache;
@@ -35,6 +37,9 @@
import fr.ifremer.echobase.persistence.EchobaseTopiaContexts;
import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
+import fr.ifremer.echobase.services.service.UserService;
+import fr.ifremer.echobase.services.service.embeddedapplication.EmbeddedApplicationService;
+import fr.ifremer.echobase.services.service.workingDb.WorkingDbConfigurationService;
import fr.ird.converter.FloatConverter;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
@@ -44,11 +49,15 @@
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
import org.nuiton.util.converter.ConverterUtil;
import javax.servlet.ServletContext;
import java.beans.Introspector;
+import java.io.File;
+import java.io.IOException;
import java.sql.SQLException;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -179,6 +188,24 @@
setConfiguration(configuration);
setDbMeta(EchoBaseDbMeta.newDbMeta());
setInternalRootContext(internalRootContext);
+
+ // create a service context
+ EchoBaseServiceContext serviceContext =
+ DefaultEchoBaseServiceContext.newContext(
+ Locale.getDefault(),
+ getConfiguration(),
+ getDbMeta(),
+ getSpatialDataCache());
+
+ // init database (and create minimal admin user if required)
+ initInternalDatabase(serviceContext);
+
+ // copy drivers if required
+ try {
+ copyDriverFiles(serviceContext);
+ } catch (IOException e) {
+ throw new TopiaException("Could not install drivers", e);
+ }
}
public EchoBaseConfiguration getConfiguration() {
@@ -276,4 +303,87 @@
this.configuration = configuration;
}
+
+ /**
+ * Init the internal database, says :
+ * <ul>
+ * <li>If no schema found or if asked to updateSchema using the
+ * {@code updateSchema} configuration option is on.</li>
+ * <li>If no user found is db, create a administrator user
+ * {@code admin/admin}</li>
+ * </ul>
+ */
+ protected void initInternalDatabase(EchoBaseServiceContext serviceContext) throws TopiaException {
+
+
+ EchoBaseConfiguration configuration = this.getConfiguration();
+ Preconditions.checkNotNull(configuration);
+
+ EchoBaseDbMeta dbMeta = getDbMeta();
+ Preconditions.checkNotNull(dbMeta);
+
+ TopiaContext rootContext = this.getInternalRootContext();
+ Preconditions.checkNotNull(rootContext);
+
+ if (configuration.isUpdateSchema()) {
+ if (log.isInfoEnabled()) {
+ log.info("Will update schema...");
+ }
+ rootContext.updateSchema();
+ }
+
+ TopiaContext tx = rootContext.beginTransaction();
+ try {
+ serviceContext.setEchoBaseInternalPersistenceContext(new TopiaEchoBaseInternalPersistenceContext(tx));
+
+ UserService service = serviceContext.newService(UserService.class);
+
+ List<EchoBaseUser> users = service.getUsers();
+
+ if (CollectionUtils.isEmpty(users)) {
+
+ // no users in database create the admin user
+ if (log.isInfoEnabled()) {
+ log.info("No user in database, will create default " +
+ "users.");
+ }
+
+ service.createDefaultUsers();
+ }
+
+ if (configuration.isEmbedded()) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will try t create default working db " +
+ "configuration for embedded db.");
+ }
+ // try to create a default embedded working db configuration
+ serviceContext.newService(WorkingDbConfigurationService.class).
+ createEmbeddedWorkingDbConfiguration();
+ }
+ } finally {
+ serviceContext.setEchoBaseInternalPersistenceContext(null);
+ EchoBaseEntityHelper.closeConnection(tx);
+ }
+ }
+
+ protected void copyDriverFiles(EchoBaseServiceContext serviceContext) throws IOException {
+ EmbeddedApplicationService service =
+ serviceContext.newService(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.copyEmbeddedBinaryFile(pilotFileName, libDirectory);
+ }
+ }
+ }
}
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 2013-10-19 13:06:51 UTC (rev 854)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2013-10-20 13:45:37 UTC (rev 855)
@@ -23,32 +23,13 @@
*/
package fr.ifremer.echobase.ui;
-import com.google.common.base.Preconditions;
-import fr.ifremer.echobase.config.EchoBaseConfiguration;
-import fr.ifremer.echobase.entities.DriverType;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.TopiaEchoBaseInternalPersistenceContext;
-import fr.ifremer.echobase.persistence.EchoBaseDbMeta;
-import fr.ifremer.echobase.persistence.EchoBaseEntityHelper;
-import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext;
-import fr.ifremer.echobase.services.EchoBaseServiceContext;
-import fr.ifremer.echobase.services.service.embeddedapplication.EmbeddedApplicationService;
-import fr.ifremer.echobase.services.service.UserService;
-import fr.ifremer.echobase.services.service.workingDb.WorkingDbConfigurationService;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
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;
/**
* To listen start or end of the application.
@@ -99,25 +80,6 @@
sce.getServletContext(), applicationContext);
applicationContext.init();
-
- // create a service context
- EchoBaseServiceContext serviceContext =
- DefaultEchoBaseServiceContext.newContext(
- Locale.getDefault(),
- applicationContext.getConfiguration(),
- applicationContext.getDbMeta(),
- applicationContext.getSpatialDataCache());
-
- // init database (and create minimal admin user if required)
-
- initInternalDatabase(applicationContext, serviceContext);
-
- // copy drivers if required
- try {
- copyDriverFiles(serviceContext);
- } catch (IOException e) {
- throw new TopiaException("Could not install drivers", e);
- }
}
@Override
@@ -136,113 +98,5 @@
EchoBaseApplicationContext.removeApplicationContext(servletContext);
applicationContext.close();
-
-// // release internal db
-// TopiaContext rootContext =
-// applicationContext.getInternalRootContext();
-// EchoBaseEntityHelper.releaseRootContext(rootContext);
-// finally {
-
-// // release all user sessions
-// Set<EchoBaseSession> sessions = applicationContext.getEchoBaseSessions();
-// if (CollectionUtils.isNotEmpty(sessions)) {
-// for (EchoBaseSession session : sessions) {
-// applicationContext.destroyEchoBaseSession(session);
-// }
-// }
-
-// // see http://wiki.apache.org/commons/Logging/FrequentlyAskedQuestions#A_memory_le…
-// ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-// LogFactory.release(contextClassLoader);
-//
-// Introspector.flushCaches();
-// }
}
-
- /**
- * Init the internal database, says :
- * <ul>
- * <li>If no schema found or if asked to updateSchema using the
- * {@code updateSchema} configuration option is on.</li>
- * <li>If no user found is db, create a administrator user
- * {@code admin/admin}</li>
- * </ul>
- *
- * @param context application context where to store global internal db root context
- */
- protected void initInternalDatabase(EchoBaseApplicationContext context,
- EchoBaseServiceContext serviceContext) throws TopiaException {
-
- Preconditions.checkNotNull(context);
-
- EchoBaseConfiguration configuration = context.getConfiguration();
- Preconditions.checkNotNull(configuration);
-
- EchoBaseDbMeta dbMeta = context.getDbMeta();
- Preconditions.checkNotNull(dbMeta);
-
- TopiaContext rootContext = context.getInternalRootContext();
- Preconditions.checkNotNull(rootContext);
-
- if (configuration.isUpdateSchema()) {
- if (log.isInfoEnabled()) {
- log.info("Will update schema...");
- }
- rootContext.updateSchema();
- }
-
- TopiaContext tx = rootContext.beginTransaction();
- try {
- serviceContext.setEchoBaseInternalPersistenceContext(new TopiaEchoBaseInternalPersistenceContext(tx));
-
- UserService service = serviceContext.newService(UserService.class);
-
- List<EchoBaseUser> users = service.getUsers();
-
- if (CollectionUtils.isEmpty(users)) {
-
- // no users in database create the admin user
- if (log.isInfoEnabled()) {
- log.info("No user in database, will create default " +
- "users.");
- }
-
- service.createDefaultUsers();
- }
-
- if (configuration.isEmbedded()) {
-
- if (log.isInfoEnabled()) {
- log.info("Will try t create default working db " +
- "configuration for embedded db.");
- }
- // try to create a default embedded working db configuration
- serviceContext.newService(WorkingDbConfigurationService.class).
- createEmbeddedWorkingDbConfiguration();
- }
- } finally {
- serviceContext.setEchoBaseInternalPersistenceContext(null);
- EchoBaseEntityHelper.closeConnection(tx);
- }
- }
-
- protected void copyDriverFiles(EchoBaseServiceContext serviceContext) throws IOException {
- EmbeddedApplicationService service =
- serviceContext.newService(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.copyEmbeddedBinaryFile(pilotFileName, libDirectory);
- }
- }
- }
}
1
0
r854 - in trunk: echobase-domain/src/main/java/fr/ifremer/echobase/persistence echobase-ui/src/main/java/fr/ifremer/echobase/ui
by tchemit@users.forge.codelutin.com 19 Oct '13
by tchemit@users.forge.codelutin.com 19 Oct '13
19 Oct '13
Author: tchemit
Date: 2013-10-19 15:06:51 +0200 (Sat, 19 Oct 2013)
New Revision: 854
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/854
Log:
fixes #3550: Impossible de red?\195?\169ploy?\195?\169 ?\195?\160 chaud l'application
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
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 2013-09-17 17:31:52 UTC (rev 853)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2013-10-19 13:06:51 UTC (rev 854)
@@ -37,6 +37,7 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.sql.Statement;
/**
* helper about topia context and jdbc connections.
@@ -55,6 +56,28 @@
return tx;
}
+ public static void releaseH2RootContext(TopiaContext context) throws SQLException {
+
+ TopiaContextImplementor rootContext = ((TopiaContextImplementor) context).getRootContext();
+
+ String url = (String) rootContext.getConfig().get(TopiaContextFactory.CONFIG_URL);
+ String login = (String) rootContext.getConfig().get(TopiaContextFactory.CONFIG_USER);
+ String password = (String) rootContext.getConfig().get(TopiaContextFactory.CONFIG_PASS);
+
+ releaseRootContext(context);
+
+ Connection conn = DriverManager.getConnection(url, login, password);
+
+ try {
+ Statement statement = conn.createStatement();
+ statement.execute("SHUTDOWN;");
+ statement.close();
+ conn.close();
+ } finally {
+ conn.close();
+ }
+ }
+
public static void releaseRootContext(TopiaContext context) {
TopiaContext rootContext = ((TopiaContextImplementor) context).getRootContext();
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 2013-09-17 17:31:52 UTC (rev 853)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2013-10-19 13:06:51 UTC (rev 854)
@@ -48,6 +48,7 @@
import javax.servlet.ServletContext;
import java.beans.Introspector;
+import java.sql.SQLException;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -232,7 +233,13 @@
if (internalRootContext != null) {
// release internal db
- EchoBaseEntityHelper.releaseRootContext(internalRootContext);
+ try {
+ EchoBaseEntityHelper.releaseH2RootContext(internalRootContext);
+ } catch (SQLException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not close internal db", e);
+ }
+ }
}
} finally {
@@ -269,27 +276,4 @@
this.configuration = configuration;
}
-// protected final EventListenerList listenerList = new EventListenerList();
-//
-// public void addWorkingDbChangeListener(WorkingDbChangeListener listener) {
-// listenerList.add(WorkingDbChangeListener.class, listener);
-// }
-//
-// public void removeWorkingDbChangeListener(WorkingDbChangeListener listener) {
-// listenerList.remove(WorkingDbChangeListener.class, listener);
-// }
-//
-// public void fireVoyageChangeEvent(String jdbcUrl, String voyageId) {
-// VoyageChangedEvent event = new VoyageChangedEvent(jdbcUrl, voyageId);
-// for (WorkingDbChangeListener listener : listenerList.getListeners(WorkingDbChangeListener.class)) {
-// listener.onVoyageChanged(event);
-// }
-// }
-//
-// public void fireDbChangeEvent(String jdbcUrl) {
-// DbChangedEvent event = new DbChangedEvent(jdbcUrl);
-// for (WorkingDbChangeListener listener : listenerList.getListeners(WorkingDbChangeListener.class)) {
-// listener.onDbChanged(event);
-// }
-// }
}
1
0