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
r867 - in trunk: . echobase-domain echobase-services echobase-tools echobase-ui
by maven-release@users.forge.codelutin.com 29 Oct '13
by maven-release@users.forge.codelutin.com 29 Oct '13
29 Oct '13
Author: maven-release
Date: 2013-10-29 03:37:46 +0100 (Tue, 29 Oct 2013)
New Revision: 867
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/867
Log:
[maven-release-plugin] prepare for next development iteration
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-domain/pom.xml 2013-10-29 02:37:38 UTC (rev 866)
+++ trunk/echobase-domain/pom.xml 2013-10-29 02:37:46 UTC (rev 867)
@@ -9,7 +9,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3</version>
+ <version>2.4-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2013-10-29 02:37:38 UTC (rev 866)
+++ trunk/echobase-services/pom.xml 2013-10-29 02:37:46 UTC (rev 867)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3</version>
+ <version>2.4-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-tools/pom.xml
===================================================================
--- trunk/echobase-tools/pom.xml 2013-10-29 02:37:38 UTC (rev 866)
+++ trunk/echobase-tools/pom.xml 2013-10-29 02:37:46 UTC (rev 867)
@@ -11,7 +11,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3</version>
+ <version>2.4-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2013-10-29 02:37:38 UTC (rev 866)
+++ trunk/echobase-ui/pom.xml 2013-10-29 02:37:46 UTC (rev 867)
@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3</version>
+ <version>2.4-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-29 02:37:38 UTC (rev 866)
+++ trunk/pom.xml 2013-10-29 02:37:46 UTC (rev 867)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3</version>
+ <version>2.4-SNAPSHOT</version>
<modules>
<module>echobase-domain</module>
@@ -85,12 +85,12 @@
</developers>
<scm>
- <url>https://forge.codelutin.com/repositories/browse/echobase/tags/echobase-2.3</url>
+ <url>https://forge.codelutin.com/repositories/browse/echobase/trunk</url>
<connection>
- scm:svn:https://forge.codelutin.com/svn/echobase/tags/echobase-2.3
+ scm:svn:https://forge.codelutin.com/svn/echobase/trunk
</connection>
<developerConnection>
- scm:svn:https://forge.codelutin.com/svn/echobase/tags/echobase-2.3
+ scm:svn:https://forge.codelutin.com/svn/echobase/trunk
</developerConnection>
</scm>
1
0
Author: maven-release
Date: 2013-10-29 03:37:38 +0100 (Tue, 29 Oct 2013)
New Revision: 866
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/866
Log:
[maven-release-plugin] copy for tag echobase-2.3
Added:
tags/echobase-2.3/
1
0
r865 - in trunk: . echobase-domain echobase-services echobase-tools echobase-ui
by maven-release@users.forge.codelutin.com 29 Oct '13
by maven-release@users.forge.codelutin.com 29 Oct '13
29 Oct '13
Author: maven-release
Date: 2013-10-29 03:37:27 +0100 (Tue, 29 Oct 2013)
New Revision: 865
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/865
Log:
[maven-release-plugin] prepare release echobase-2.3
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-domain/pom.xml 2013-10-23 10:13:11 UTC (rev 864)
+++ trunk/echobase-domain/pom.xml 2013-10-29 02:37:27 UTC (rev 865)
@@ -9,7 +9,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-services/pom.xml
===================================================================
--- trunk/echobase-services/pom.xml 2013-10-23 10:13:11 UTC (rev 864)
+++ trunk/echobase-services/pom.xml 2013-10-29 02:37:27 UTC (rev 865)
@@ -6,7 +6,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-tools/pom.xml
===================================================================
--- trunk/echobase-tools/pom.xml 2013-10-23 10:13:11 UTC (rev 864)
+++ trunk/echobase-tools/pom.xml 2013-10-29 02:37:27 UTC (rev 865)
@@ -11,7 +11,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2013-10-23 10:13:11 UTC (rev 864)
+++ trunk/echobase-ui/pom.xml 2013-10-29 02:37:27 UTC (rev 865)
@@ -7,7 +7,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
</parent>
<groupId>fr.ifremer.echobase</groupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-23 10:13:11 UTC (rev 864)
+++ trunk/pom.xml 2013-10-29 02:37:27 UTC (rev 865)
@@ -11,7 +11,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>echobase</artifactId>
- <version>2.3-SNAPSHOT</version>
+ <version>2.3</version>
<modules>
<module>echobase-domain</module>
@@ -85,12 +85,12 @@
</developers>
<scm>
- <url>https://forge.codelutin.com/repositories/browse/echobase/trunk</url>
+ <url>https://forge.codelutin.com/repositories/browse/echobase/tags/echobase-2.3</url>
<connection>
- scm:svn:https://forge.codelutin.com/svn/echobase/trunk
+ scm:svn:https://forge.codelutin.com/svn/echobase/tags/echobase-2.3
</connection>
<developerConnection>
- scm:svn:https://forge.codelutin.com/svn/echobase/trunk
+ scm:svn:https://forge.codelutin.com/svn/echobase/tags/echobase-2.3
</developerConnection>
</scm>
1
0
Author: tchemit
Date: 2013-10-23 12:13:11 +0200 (Wed, 23 Oct 2013)
New Revision: 864
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/864
Log:
fix doc typo
Modified:
trunk/src/site/rst/db.rst
trunk/src/site/rst/install.rst.vm
Modified: trunk/src/site/rst/db.rst
===================================================================
--- trunk/src/site/rst/db.rst 2013-10-23 09:45:09 UTC (rev 863)
+++ trunk/src/site/rst/db.rst 2013-10-23 10:13:11 UTC (rev 864)
@@ -127,6 +127,9 @@
Rendre une base postgresql spatiale
-----------------------------------
+Avant de rendre spatiale une base, il faut au moins vous y être connecté via
+l'interface web qui va créé le schéma de la base.
+
Pour pouvoir utiliser postgis sur la base, il faut exécuter le script sql
suivant `postgis-structure.sql`_. Si des données existent, elles seront
spatialisées (le script peut prendre un certain temps à crééer toutes les
Modified: trunk/src/site/rst/install.rst.vm
===================================================================
--- trunk/src/site/rst/install.rst.vm 2013-10-23 09:45:09 UTC (rev 863)
+++ trunk/src/site/rst/install.rst.vm 2013-10-23 10:13:11 UTC (rev 864)
@@ -42,6 +42,9 @@
Installation de postgresql et postgis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Il vous faudra peut-être installer un dépot apt pour postgres
+(voir https://wiki.postgresql.org/wiki/Apt)
+
Pour postgresql 9.0
::
@@ -123,7 +126,7 @@
http://localhost:8080/echobase
-Une fois l'application déployée, vous aurez le répertoire suivante :
+Une fois l'application déployée, vous aurez la structure de répertoires suivante :
::
/var/local/echobase/
1
0
Author: tchemit
Date: 2013-10-23 11:45:09 +0200 (Wed, 23 Oct 2013)
New Revision: 863
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/863
Log:
fixes #3576: Probl?\195?\168me d'import des donn?\195?\169es l?\195?\169gendaires
Modified:
trunk/src/site/postgis-structure.sql
Modified: trunk/src/site/postgis-structure.sql
===================================================================
--- trunk/src/site/postgis-structure.sql 2013-10-22 11:01:44 UTC (rev 862)
+++ trunk/src/site/postgis-structure.sql 2013-10-23 09:45:09 UTC (rev 863)
@@ -114,6 +114,8 @@
WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd'
THEN
doInsert = TRUE;
+ ELSE
+ doInsert = FALSE;
END CASE;
WHEN 'ELEMENTARY'
THEN
@@ -122,6 +124,8 @@
WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd', 'DepthRefSurfaceStart', 'DepthRefSurfaceEnd', 'DepthRefBottomStart', 'DepthRefBottomEnd'
THEN
doInsert = TRUE;
+ ELSE
+ doInsert = FALSE;
END CASE;
WHEN 'REGION', 'REGIONSURF', 'REGIONCLAS'
THEN
@@ -131,6 +135,8 @@
THEN
doInsert = TRUE;
cellType = 'REGION';
+ ELSE
+ doInsert = FALSE;
END CASE;
WHEN 'MAP'
THEN
@@ -139,6 +145,8 @@
WHEN 'GridCellLatitude', 'GridCellLongitude', 'GridLatitudeLag', 'GridLongitudeLag'
THEN
doInsert = TRUE;
+ ELSE
+ doInsert = FALSE;
END CASE;
END CASE;
1
0
r862 - trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config
by tchemit@users.forge.codelutin.com 22 Oct '13
by tchemit@users.forge.codelutin.com 22 Oct '13
22 Oct '13
Author: tchemit
Date: 2013-10-22 13:01:44 +0200 (Tue, 22 Oct 2013)
New Revision: 862
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/862
Log:
fix build
Modified:
trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.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-22 10:56:27 UTC (rev 861)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java 2013-10-22 11:01:44 UTC (rev 862)
@@ -112,7 +112,6 @@
}
createDirectory(EchoBaseConfigurationOption.DATA_DIRECTORY);
- createDirectory(EchoBaseConfigurationOption.LOG_DIRECTORY);
try {
FileUtils.forceMkdir(getLibDirectory());
} catch (IOException e) {
1
0
r861 - in trunk: echobase-domain/src/main/java/fr/ifremer/echobase/config echobase-domain/src/main/resources/i18n echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication echobase-ui echobase-ui/src/main/env echobase-ui/src/main/java/fr/ifremer/echobase/ui echobase-ui/src/main/resources echobase-ui/src/main/resources/embedded src/site/rst
by tchemit@users.forge.codelutin.com 22 Oct '13
by tchemit@users.forge.codelutin.com 22 Oct '13
22 Oct '13
Author: tchemit
Date: 2013-10-22 12:56:27 +0200 (Tue, 22 Oct 2013)
New Revision: 861
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/861
Log:
fixes #3563: Simplify log configuration
refs #3553: Am?\195?\169liorer la documentation d'installation
Added:
trunk/echobase-ui/src/main/resources/embedded/
trunk/echobase-ui/src/main/resources/embedded/echobase-log.config
trunk/echobase-ui/src/main/resources/log4j.properties
Removed:
trunk/echobase-ui/src/main/env/dev/
trunk/echobase-ui/src/main/env/prod/
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-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java
trunk/echobase-ui/pom.xml
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/resources/struts.xml
trunk/src/site/rst/install.rst.vm
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-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfiguration.java 2013-10-22 10:56:27 UTC (rev 861)
@@ -112,8 +112,8 @@
}
createDirectory(EchoBaseConfigurationOption.DATA_DIRECTORY);
+ createDirectory(EchoBaseConfigurationOption.LOG_DIRECTORY);
try {
-// FileUtils.forceMkdir(getWarDirectory());
FileUtils.forceMkdir(getLibDirectory());
} catch (IOException e) {
throw new EchoBaseTechnicalException(e);
@@ -163,6 +163,18 @@
return file;
}
+ public File getLogConfigFile() {
+ File file = applicationConfig.getOptionAsFile(
+ EchoBaseConfigurationOption.LOG_CONFIG_FILE.key);
+ Preconditions.checkNotNull(file);
+ return file;
+ }
+
+ public File getDefaultLogDirectory() {
+ File file = new File(getDataDirectory(), "log");
+ return file;
+ }
+
public char getCsvSeparator() {
char csvSeparator = applicationConfig.getOption(
char.class, EchoBaseConfigurationOption.CSV_SEPARATOR.key);
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-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/config/EchoBaseConfigurationOption.java 2013-10-22 10:56:27 UTC (rev 861)
@@ -70,6 +70,10 @@
n_("echobase.config.war.location.description"),
"${echobase.lib.directory}/echobase-embedded-${echobase.version}.war",
File.class),
+ LOG_CONFIG_FILE("echobase.log.config.file",
+ n_("echobase.config.log.config.file.description"),
+ "${echobase.data.directory}/echobase-log.config",
+ File.class),
DOCUMENTATION_URL("echobase.documentationUrl",
n_("echobase.config.documentationUrl.description"),
"http://maven-site.forge.codelutin.com/echobase",
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-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2013-10-22 10:56:27 UTC (rev 861)
@@ -35,6 +35,7 @@
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.log.config.file.description=Log configuration file
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-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2013-10-22 10:56:27 UTC (rev 861)
@@ -33,6 +33,7 @@
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.log.config.file.description=Fichier de configuration des logs
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-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java 2013-10-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java 2013-10-22 10:56:27 UTC (rev 861)
@@ -363,10 +363,11 @@
}
}
- public void copyEmbeddedBinaryFile(String resourceName,
+ public static void copyEmbeddedBinaryFile(String resourceName,
File targetDirectory) throws IOException {
String resourcePath = EMBEDDED_PATH + resourceName;
- InputStream inputStream = getClass().getResourceAsStream(resourcePath);
+ InputStream inputStream =
+ EmbeddedApplicationService.class.getResourceAsStream(resourcePath);
Preconditions.checkNotNull(inputStream,
"could not find resource " + resourcePath);
try {
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2013-10-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-ui/pom.xml 2013-10-22 10:56:27 UTC (rev 861)
@@ -22,6 +22,8 @@
<!-- i18n configuration -->
<i18n.bundleOutputName>${echobaseI18nBundle}</i18n.bundleOutputName>
+ <devMode>true</devMode>
+
<env>dev</env>
<fullWarName>echobase-full-${project.version}</fullWarName>
@@ -45,26 +47,30 @@
<resources>
<resource>
<directory>src/main/resources</directory>
- <includes>
+ <!--includes>
<include>**/*</include>
- </includes>
+ </includes-->
<excludes>
<exclude>echobase.properties</exclude>
+ <exclude>struts.xml</exclude>
</excludes>
</resource>
+
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>echobase.properties</include>
+ <include>struts.xml</include>
</includes>
</resource>
- <resource>
+
+ <!--resource>
<directory>src/main/env/${env}/resources</directory>
<includes>
<include>*.properties</include>
</includes>
- </resource>
+ </resource-->
</resources>
<plugins>
@@ -303,7 +309,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <scope>runtime</scope>
+ <scope>compile</scope>
</dependency>
<dependency>
@@ -349,7 +355,8 @@
</property>
</activation>
<properties>
- <env>prod</env>
+ <!-- to use prod config in struts.xml config file -->
+ <devMode>false</devMode>
<!-- make sure i18n is fully complete -->
<i18n.failsIfWarning>true</i18n.failsIfWarning>
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-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2013-10-22 10:56:27 UTC (rev 861)
@@ -23,8 +23,10 @@
*/
package fr.ifremer.echobase.ui;
+import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+import com.google.common.io.Files;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.config.EchoBaseConfiguration;
import fr.ifremer.echobase.entities.DriverType;
@@ -44,23 +46,33 @@
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.PropertyConfigurator;
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.RecursiveProperties;
+import org.nuiton.util.SortedProperties;
import org.nuiton.util.converter.ConverterUtil;
import javax.servlet.ServletContext;
import java.beans.Introspector;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
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.Properties;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -69,7 +81,7 @@
public class EchoBaseApplicationContext {
/** Logger. */
- private static final Log log =
+ private static Log log =
LogFactory.getLog(EchoBaseApplicationContext.class);
/** Key to store the single instance of the application context */
@@ -180,6 +192,13 @@
// initialize configuration
EchoBaseConfiguration configuration = new EchoBaseConfiguration();
+ try {
+ initLog(configuration);
+ } catch (IOException e) {
+ Logger.getAnonymousLogger().log(Level.ALL,
+ "Could not init logger.", e);
+ }
+
// initialize internal root context
TopiaContext internalRootContext =
EchobaseTopiaContexts.newInternalDb(
@@ -315,7 +334,6 @@
*/
protected void initInternalDatabase(EchoBaseServiceContext serviceContext) throws TopiaException {
-
EchoBaseConfiguration configuration = this.getConfiguration();
Preconditions.checkNotNull(configuration);
@@ -367,6 +385,57 @@
}
}
+ protected void initLog(EchoBaseConfiguration configuration) throws IOException {
+
+ // get log configuration
+ File logFile = configuration.getLogConfigFile();
+
+ if (!logFile.exists()) {
+ EmbeddedApplicationService.copyEmbeddedBinaryFile(
+ logFile.getName(),
+ logFile.getParentFile());
+
+ RecursiveProperties properties = new RecursiveProperties();
+
+ BufferedReader reader = Files.newReader(logFile, Charsets.UTF_8);
+ try {
+ properties.load(reader);
+ reader.close();
+ } finally {
+ IOUtils.closeQuietly(reader);
+ }
+
+ // set default log directory
+ properties.setProperty(
+ "echobase.log.dir",
+ configuration.getDefaultLogDirectory().getAbsolutePath());
+ // copy configuration (with substitutions)
+ Properties p2 = new SortedProperties();
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ String key = String.valueOf(entry.getKey());
+
+ p2.setProperty(key, properties.getProperty(key));
+ }
+ p2.remove("echobase.log.dir");
+ // write back log configuration file
+ BufferedWriter writer = Files.newWriter(logFile, Charsets.UTF_8);
+ try {
+ p2.store(writer, "Generated by " + getClass().getName());
+ writer.close();
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+ // reste logger configuration
+ LogManager.resetConfiguration();
+ // use generate log config file
+ PropertyConfigurator.configure(logFile.getAbsolutePath());
+ log = LogFactory.getLog(EchoBaseApplicationContext.class);
+ if (log.isInfoEnabled()) {
+ log.info("Use now logFile: " + logFile);
+ }
+ }
+
protected void extractFiles(EchoBaseServiceContext serviceContext) throws IOException {
EmbeddedApplicationService service =
serviceContext.newService(EmbeddedApplicationService.class);
@@ -382,7 +451,7 @@
log.info("Copy embedded resource " + pilotFileName +
" to directory " + libDirectory);
}
- service.copyEmbeddedBinaryFile(pilotFileName, libDirectory);
+ EmbeddedApplicationService.copyEmbeddedBinaryFile(pilotFileName, libDirectory);
}
// copy embedded war
@@ -395,6 +464,6 @@
log.info("Copy embedded war " + embeddedWarFileName +
" to directory " + embeddedWarDirectory);
}
- service.copyEmbeddedBinaryFile(embeddedWarFileName, embeddedWarDirectory);
+ EmbeddedApplicationService.copyEmbeddedBinaryFile(embeddedWarFileName, embeddedWarDirectory);
}
}
Added: trunk/echobase-ui/src/main/resources/embedded/echobase-log.config
===================================================================
--- trunk/echobase-ui/src/main/resources/embedded/echobase-log.config (rev 0)
+++ trunk/echobase-ui/src/main/resources/embedded/echobase-log.config 2013-10-22 10:56:27 UTC (rev 861)
@@ -0,0 +1,20 @@
+# 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=[%t] %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}/echobase.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
+
+
+# package level
+log4j.logger.fr.ifremer=INFO
+log4j.logger.org.nuiton=INFO
\ No newline at end of file
Property changes on: trunk/echobase-ui/src/main/resources/embedded/echobase-log.config
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-ui/src/main/resources/log4j.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/log4j.properties (rev 0)
+++ trunk/echobase-ui/src/main/resources/log4j.properties 2013-10-22 10:56:27 UTC (rev 861)
@@ -0,0 +1,33 @@
+###
+# #%L
+# EchoBase :: UI
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2011 - 2013 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%
+###
+# Log4J config files used at very beginning of application, will be later
+#replaced by the one specified in
+# echobase.log.config.file configuration property
+#
+# Global logging configuration
+log4j.rootLogger=INFO, stdout
+
+# 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
Property changes on: trunk/echobase-ui/src/main/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/struts.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/struts.xml 2013-10-21 15:18:58 UTC (rev 860)
+++ trunk/echobase-ui/src/main/resources/struts.xml 2013-10-22 10:56:27 UTC (rev 861)
@@ -38,6 +38,14 @@
name="i18nTextProvider"
type="com.opensymphony.xwork2.TextProvider"/>
+ <!-- dev mode tuning -->
+ <constant name="struts.devMode" value="${devMode}"/>
+ <constant name="struts.ognl.logMissingProperties" value="${devMode}"/>
+ <constant name="struts.el.throwExceptionOnFailure" value="${devMode}"/>
+ <constant name="struts.i18n.reload" value="${devMode}"/>
+ <constant name="struts.configuration.xml.reload" value="${devMode}"/>
+
+ <!-- security config (need it since 1.15.1) -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
<constant name="struts.mapper.action.prefix.enabled" value="true"/>
@@ -46,8 +54,8 @@
<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
<constant name="struts.action.extension" value=",,"/>
<constant name="struts.locale" value="fr_FR"/>
- <constant name="struts.i18n.reload" value="false"/>
- <constant name="struts.configuration.xml.reload" value="false"/>
+ <!--<constant name="struts.i18n.reload" value="false"/>-->
+ <!--<constant name="struts.configuration.xml.reload" value="false"/>-->
<constant name="struts.ui.theme" value="css_xhtml"/>
<constant name="struts.multipart.maxSize" value="209715200"/>
Modified: trunk/src/site/rst/install.rst.vm
===================================================================
--- trunk/src/site/rst/install.rst.vm 2013-10-21 15:18:58 UTC (rev 860)
+++ trunk/src/site/rst/install.rst.vm 2013-10-22 10:56:27 UTC (rev 861)
@@ -39,11 +39,9 @@
- création de la base de données
- installation de l'application
-Installation de la base de données
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Installation de postgresql et postgis
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Installation de postgresql et postgis (debian's way)
-
Pour postgresql 9.0
::
@@ -79,16 +77,26 @@
Consulter la documentation suivante pour `créer une base travail`_.
+Installation tomcat
+~~~~~~~~~~~~~~~~~~~
+
+::
+
+ sudo apt-get install tomcat7
+
Préparation première installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Il faut être loggué sur une console avec l'utilisateur root.
+Pré-requis:
-On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
+- Avoir installer tomcat 7
+- Etre loggué sur une console avec l'utilisateur root.
-Toutes les données de l'application (et sa configuration) seront placées dans
-le répertoire **/var/local/echobase**
+On suppose que tomcat a été installé via le système de paquets, et donc
+que le répertoire **/var/lib/tomcat7** existe.
+Toutes les données de l'application seront placées dans le répertoire **/var/local/echobase**
+
- Créer les répertoires
::
@@ -97,93 +105,65 @@
mkdir /var/local/echobase/war
- Placer le war à utiliser dans **/var/local/echobase/war**
-
- Ajouter une lien symoblique vers le war à utiliser
::
ln -s /var/local/echobase/war/echobase-full-${project.version}.var /var/local/echobase/echobase.war
-- Ajouter un lien symbolique dans le répertoire **webapps** de tomcat vers ce
- lien symbolique
+- Mettre l'application dans tomcat
::
- ln -s /var/local/echobase/echobase.war /opt/tomcat/webapps/echobase.war
+ cp /var/local/echobase/echobase.war /var/lib/tomcat7/webapps
-- Copier le fichier de configuration echobase.properties_ de l'application
- dans **/var/local/echobase/**
-
-- Editer ce fichier pour adapter le mot de passe de l'utilisateur et peut-être
- aussi l'url de connexion. Voici un exemple fichier modifié
-
-::
-
- hibernate.dialect=org.hibernate.dialect.PostgreSQL82Dialect
- hibernate.connection.driver_class=org.postgresql.Driver
- hibernate.connection.url=jdbc:postgresql://monNomDeMachine/echobase
- hibernate.connection.username=echobase
- hibernate.connection.password=motDePasseModifie
-
-- Ajouter un lien symbolique ver le fichier de configuration dans */etc*
-
-::
-
- ln -s /var/local/echobase/echobase.properties /etc/echobase.properties
-
-Le répertoire au final devrait ressembler à ça :
-
-::
-
- /var/local/echobase/
- ├── echobase.properties (configuration)
- ├── echobase.war -> war/echobase-full-${project.version}.war (war utilisé)
- └── war (répertoire des wars)
- └── echobase-full-${project.version}.war
-
-Une fois le serveur tomcat démarré, vous pouvez accéder à l'application à
+L'application est bien déployée lorsque vous pouvez accéder à l'application à
l'adresse suivante :
-
::
http://localhost:8080/echobase
-Un nouveau répertoire est crée comprenant les données internes de l'application, à savoir :
-
+Une fois l'application déployée, vous aurez le répertoire suivante :
::
- /var/local/echobase/data/
- |-- internaldb (contient la base interne)
- | |-- echobase-user.h2.db
- |-- lib (contient les pilotes jdbc et l'application embarquée)
- | |-- echobase-embedded-${project.version}.war
- | |-- h2-1.3.173.jar
- | `-- postgresql-9.1-901-1.jdbc4.jar
- `-- logs (contient les logs de l'application)
+ /var/local/echobase/
+ |-- data
+ | |-- echobase-log.config
+ | |-- internaldb
+ | | |-- echobase-user.h2.db
+ | |-- lib
+ | | |-- echobase-embedded-2.3-SNAPSHOT.war
+ | | |-- h2-1.3.173.jar
+ | | `-- postgresql-9.1-901-1.jdbc4.jar
+ | `-- logs
+ | `-- echobase.log
+ |-- echobase.war
+ `-- war
+ `-- echobase-full-2.3-SNAPSHOT.war
Mettre à jour le war de l'application
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Il faut être loggué sur une console avec l'utilisateur root.
+Pré-requis :
-On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
+- Avoir installer tomcat 7
+- Etre loggué sur une console avec l'utilisateur root.
-Pour utiliser une nouvelle version de l'application, c'est en 5 étapes :
+On suppose que tomcat a été installé via le système de paquets, et donc
+que le répertoire **/var/lib/tomcat7** existe.
-- Arrêter le serveur tomcat
+Pour utiliser une nouvelle version de l'application, c'est très simple.
-::
-
- service tomcat stop
-
- Supprimer les répertoires suivants :
::
- rm -rf /opt/tomcat/webapps/echobase
- rm -rf /opt/tomcat/work/Catalina/localhost/echobase
+ rm -rf /var/lib/tomcat7/webapps/echobase.war
+ rm -rf /var/lib/tomcat7/Catalina/localhost/echobase
+- Attendre que le répertoire **/var/lib/tomcat7/webapps/echobase** a bien été supprimé.
+
- Copier le nouveau war dans **/var/local/echobase/war**
- Changer le lien symbolique **/var/local/echobase/echobase.war**
@@ -192,28 +172,37 @@
unlink echobase.war
ln -s /var/local/echobasewar/echobase-full-${project.version}.war /var/local/echobase/echobase.war
-- Relancer le serveur tomcat
+- Mettre l'application dans tomcat
::
- service tomcat start
+ cp /var/local/echobase/echobase.war /var/lib/tomcat7/webapps
+Tomcat va redéployer l'application et elle sera disponible d'ici peu à l'adresse
+::
+
+ http://localhost:8080/echobase
+
Divers
------
+Modifier la configuration par défaut
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Si vous voulez modifier la configuration (voir le `détail des options disponibles`_),
+il faut positionner un fichier nommé **echobase.properties** dans
+**/etc/echobase.properties** puis redémarrer tomcat.
+
Gestion des logs de l'application
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Avant de lancer l'application, il faut avoir positionner une variable
-**echobase.log.dir** de jvm qui définit le répertoire où positionner les logs
-de l'application.::
+Par défaut, l'application utilise l'emplacement **/var/local/echobase/data/logs**
+pour y placer ses logs.
- JAVA_OPTS="$JAVA_OPTS -Dechobase.log.dir=/var/local/echobase/data/logs"
+Vous pouvez changer cela en modifiant le fichier
+**/var/local/echobase/data/echobase-log.properties** qui est généré lors de la
+première installation de l'application.
-ou::
-
- CATALINA_OPTS="$CATALINA_OPTS -Dechobase.log.dir=/var/local/echobase/data/logs"
-
Première utilisation
~~~~~~~~~~~~~~~~~~~~
@@ -226,5 +215,5 @@
l'interface de gestion des utilisateurs.
.. _créer une base travail: ./db.html#creation-d-une-base-postgresql
-.. _echobase.properties: echobase.properties
+.. _détail des options disponibles: ./application-config-report.html
1
0
r860 - in trunk: echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication echobase-ui/src/main/java/fr/ifremer/echobase/ui
by tchemit@users.forge.codelutin.com 21 Oct '13
by tchemit@users.forge.codelutin.com 21 Oct '13
21 Oct '13
Author: tchemit
Date: 2013-10-21 17:18:58 +0200 (Mon, 21 Oct 2013)
New Revision: 860
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/860
Log:
fixes #3504: Impossible de cr?\195?\169er une application embarqu?\195?\169e
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java 2013-10-21 15:18:24 UTC (rev 859)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/embeddedapplication/EmbeddedApplicationService.java 2013-10-21 15:18:58 UTC (rev 860)
@@ -149,18 +149,18 @@
File internalDir = new File(dir, "internaldb");
- TopiaContext internalRootContext =
+ TopiaContext newInternalRootContext =
EchobaseTopiaContexts.newInternalDb(internalDir);
- TopiaContext internalTransaction = internalRootContext.beginTransaction();
+ TopiaContext internalTransaction = newInternalRootContext.beginTransaction();
TopiaEchoBaseInternalPersistenceContext newPersistenceContext = new TopiaEchoBaseInternalPersistenceContext(
internalTransaction
);
- newServiceContext.setEchoBaseInternalPersistenceContext(newPersistenceContext);
-// newServiceContext.setInternalTransaction(
-// internalRootContext.beginTransaction());
+ newServiceContext.setEchoBaseInternalPersistenceContext(
+ newPersistenceContext);
-
+ TopiaEchoBaseInternalPersistenceContext internalPersistenceContext =
+ getEchoBaseInternalPersistenceContext();
try {
// get user service from h2 db
UserService userService = newServiceContext.newService(UserService.class);
@@ -175,10 +175,10 @@
model.incrementsProgress();
// get all export queries from application
- List<ExportQuery> queries = getEchoBaseInternalPersistenceContext().getExportQueryDAO().findAll();
+ List<ExportQuery> queries = internalPersistenceContext.getExportQueryDAO().findAll();
// replicate queries
- getEchoBaseInternalPersistenceContext().replicateEntities(
+ internalPersistenceContext.replicateEntities(
internalTransaction, queries);
// create export sql service from h2 db
@@ -198,19 +198,18 @@
// get all working db configuration from application
List<WorkingDbConfiguration> confs =
- getEchoBaseInternalPersistenceContext().getWorkingDbConfigurationDAO().findAll();
+ internalPersistenceContext.getWorkingDbConfigurationDAO().findAll();
// replicate configs
- getEchoBaseInternalPersistenceContext().replicateEntities(
+ internalPersistenceContext.replicateEntities(
internalTransaction, confs);
model.incrementsProgress();
return admin;
-
} finally {
newServiceContext.setEchoBaseInternalPersistenceContext(null);
- EchoBaseEntityHelper.releaseRootContext(internalRootContext);
+ EchoBaseEntityHelper.releaseRootContext(newInternalRootContext);
}
}
@@ -253,34 +252,6 @@
}
}
-// protected void closeContext(TopiaContext tx, String message) {
-// try {
-// tx.closeContext();
-// } catch (TopiaException eee) {
-// throw new EchoBaseTechnicalException(message, eee);
-// }
-// }
-
-// protected TopiaContext beginTransaction(TopiaContext tx, String message) {
-// try {
-// return tx.beginTransaction();
-// } catch (TopiaException eee) {
-// throw new EchoBaseTechnicalException(message, eee);
-// }
-// }
-
-// protected void rollbackTransaction(TopiaContext tx, String message) {
-// try {
-// if (tx != null) {
-// tx.rollbackTransaction();
-// }
-// } catch (TopiaException eee) {
-// if (log.isErrorEnabled()) {
-// log.error(message, eee);
-// }
-// }
-// }
-
protected int computeNbSteps(EmbeddedApplicationConfiguration model) {
int nbSteps = 5;
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-21 15:18:24 UTC (rev 859)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2013-10-21 15:18:58 UTC (rev 860)
@@ -354,8 +354,8 @@
if (configuration.isEmbedded()) {
if (log.isInfoEnabled()) {
- log.info("Will try t create default working db " +
- "configuration for embedded db.");
+ log.info("Will try to create default working db " +
+ "configuration for internal db.");
}
// try to create a default embedded working db configuration
serviceContext.newService(WorkingDbConfigurationService.class).
@@ -376,30 +376,25 @@
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);
+ // copy it from class-path
+ if (log.isInfoEnabled()) {
+ log.info("Copy embedded resource " + pilotFileName +
+ " to directory " + libDirectory);
}
+ 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);
+ // copy it from class-path
+ if (log.isInfoEnabled()) {
+ log.info("Copy embedded war " + embeddedWarFileName +
+ " to directory " + embeddedWarDirectory);
}
+ service.copyEmbeddedBinaryFile(embeddedWarFileName, embeddedWarDirectory);
}
}
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 2013-10-21 15:18:24 UTC (rev 859)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2013-10-21 15:18:58 UTC (rev 860)
@@ -30,6 +30,9 @@
import org.nuiton.topia.TopiaContext;
import org.nuiton.web.filter.TopiaTransactionFilter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
@@ -51,10 +54,20 @@
return TopiaTransactionFilter.getTransaction(request);
}
+ protected ServletContext servletContext;
+
@Override
- protected /*synchronized*/ TopiaContext beginTransaction(ServletRequest request) {
+ public void init(FilterConfig filterConfig) throws ServletException {
+ super.init(filterConfig);
+
+ servletContext = filterConfig.getServletContext();
+ }
+
+ @Override
+ protected TopiaContext beginTransaction(ServletRequest request) {
+
EchoBaseApplicationContext applicationContext =
- EchoBaseApplicationContext.getApplicationContext(request.getServletContext());
+ EchoBaseApplicationContext.getApplicationContext(servletContext);
TopiaContext rootContext = applicationContext.getInternalRootContext();
TopiaContext transaction = rootContext.beginTransaction();
1
0
r859 - in trunk: . echobase-services/src/main/resources/embedded echobase-ui echobase-ui/src/main/assembly/dist
by tchemit@users.forge.codelutin.com 21 Oct '13
by tchemit@users.forge.codelutin.com 21 Oct '13
21 Oct '13
Author: tchemit
Date: 2013-10-21 17:18:24 +0200 (Mon, 21 Oct 2013)
New Revision: 859
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/859
Log:
fixes #3551: Simplifier la proc?\195?\169dure d'installation de l'application
Modified:
trunk/echobase-services/src/main/resources/embedded/README.txt
trunk/echobase-services/src/main/resources/embedded/startEchobase.bat
trunk/echobase-services/src/main/resources/embedded/startEchobase.sh
trunk/echobase-ui/pom.xml
trunk/echobase-ui/src/main/assembly/dist/README.txt
trunk/echobase-ui/src/main/assembly/dist/startEchobase.bat
trunk/echobase-ui/src/main/assembly/dist/startEchobase.sh
trunk/pom.xml
Modified: trunk/echobase-services/src/main/resources/embedded/README.txt
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/README.txt 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-services/src/main/resources/embedded/README.txt 2013-10-21 15:18:24 UTC (rev 859)
@@ -1,2 +1,26 @@
+=============================
+EchoBase - ${project.version}
+=============================
+
+Premier démarrage
+-----------------
+
+Pour démarrer EchoBase :
+
+- Il faut avoir une JDK d'installer sur la machine cible.
+
+- la variable JDK_HOME doit être positionnée dans les variables d'environements.
+
+En suite on lance
+
+./startEchobase.sh (sous linux)
+
+ou
+
+startEchobase.bat (sous windows)
+
+Pilotes jdbc
+------------
+
Le répertoire 'drivers' contient les pilotes jdbc à positionner dans libre-office
-pour pouvoir interroger l'application embarquée.
\ No newline at end of file
+pour pouvoir interroger l'application embarquée.
Modified: trunk/echobase-services/src/main/resources/embedded/startEchobase.bat
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/startEchobase.bat 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-services/src/main/resources/embedded/startEchobase.bat 2013-10-21 15:18:24 UTC (rev 859)
@@ -24,7 +24,7 @@
SET ECHOBASE_OPTS="-Xms512m -Xmx1024m -Dechobase.log.dir=./logs"
ECHO java options used : %ECHOBASE_OPTS%
-%JAVA_COMMAND% "%ECHOBASE_OPTS%" -jar echobase-ui-${project.version}-embedded.war
+%JAVA_COMMAND% "%ECHOBASE_OPTS%" -jar ${embeddedWarName}.war
GOTO end
:end
Modified: trunk/echobase-services/src/main/resources/embedded/startEchobase.sh
===================================================================
--- trunk/echobase-services/src/main/resources/embedded/startEchobase.sh 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-services/src/main/resources/embedded/startEchobase.sh 2013-10-21 15:18:24 UTC (rev 859)
@@ -12,6 +12,6 @@
cd `dirname $0`
CURRENTPWD=`pwd`
ECHOBASE_OPTS="$JAVA_OPTS -Xms512m -Xmx1024m -Dechobase.log.dir=$CURRENTPWD/logs"
-java $ECHOBASE_OPTS -jar echobase-ui-${project.version}-embedded.war $*
+java $ECHOBASE_OPTS -jar ${embeddedWarName}.war $*
cd "$OLDPWD"
Modified: trunk/echobase-ui/pom.xml
===================================================================
--- trunk/echobase-ui/pom.xml 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-ui/pom.xml 2013-10-21 15:18:24 UTC (rev 859)
@@ -24,7 +24,6 @@
<env>dev</env>
- <embeddedWarName>echobase-embedded-${project.version}</embeddedWarName>
<fullWarName>echobase-full-${project.version}</fullWarName>
<redmine.releaseFiles>
Modified: trunk/echobase-ui/src/main/assembly/dist/README.txt
===================================================================
--- trunk/echobase-ui/src/main/assembly/dist/README.txt 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-ui/src/main/assembly/dist/README.txt 2013-10-21 15:18:24 UTC (rev 859)
@@ -18,3 +18,9 @@
ou
startEchobase.bat (sous windows)
+
+Pilotes jdbc
+------------
+
+Le répertoire 'drivers' contient les pilotes jdbc à positionner dans libre-office
+pour pouvoir interroger l'application embarquée.
Modified: trunk/echobase-ui/src/main/assembly/dist/startEchobase.bat
===================================================================
--- trunk/echobase-ui/src/main/assembly/dist/startEchobase.bat 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-ui/src/main/assembly/dist/startEchobase.bat 2013-10-21 15:18:24 UTC (rev 859)
@@ -24,7 +24,7 @@
SET ECHOBASE_OPTS="-Xms512m -Xmx1024m -Dechobase.log.dir=./logs"
ECHO java options used : %ECHOBASE_OPTS%
-%JAVA_COMMAND% "%ECHOBASE_OPTS%" -jar echobase-ui-${project.version}-embedded.war
+%JAVA_COMMAND% "%ECHOBASE_OPTS%" -jar ${embeddedWarName}.war
GOTO end
:end
Modified: trunk/echobase-ui/src/main/assembly/dist/startEchobase.sh
===================================================================
--- trunk/echobase-ui/src/main/assembly/dist/startEchobase.sh 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/echobase-ui/src/main/assembly/dist/startEchobase.sh 2013-10-21 15:18:24 UTC (rev 859)
@@ -11,6 +11,6 @@
OLDPWD=`pwd`
cd `dirname $0`
ECHOBASE_OPTS="$JAVA_OPTS -Xms512m -Xmx10242m -Dechobase.log.dir=./logs"
-java $ECHOBASE_OPTS -jar echobase-ui-${project.version}-embedded.war $*
+java $ECHOBASE_OPTS -jar ${embeddedWarName}.war $*
cd "$OLDPWD"
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-20 16:41:33 UTC (rev 858)
+++ trunk/pom.xml 2013-10-21 15:18:24 UTC (rev 859)
@@ -170,6 +170,9 @@
<!--Site configuration -->
<locales>fr,en</locales>
+ <!-- name of embedded war file basename -->
+ <embeddedWarName>echobase-embedded-${project.version}</embeddedWarName>
+
</properties>
<dependencyManagement>
1
0
r858 - in trunk: . echobase-ui/src/main/assembly/dist src/site 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 18:41:33 +0200 (Sun, 20 Oct 2013)
New Revision: 858
Url: http://forge.codelutin.com/projects/echobase/repository/revisions/858
Log:
fixes #3553: Am?\195?\169liorer la documentation d'installation
Added:
trunk/src/site/postgis-structure.sql
trunk/src/site/rst/install.rst.vm
Removed:
trunk/echobase-ui/src/main/assembly/dist/postgis-structure.sql
trunk/src/site/rst/install.rst
Modified:
trunk/pom.xml
trunk/src/site/rst/db.rst
Deleted: trunk/echobase-ui/src/main/assembly/dist/postgis-structure.sql
===================================================================
--- trunk/echobase-ui/src/main/assembly/dist/postgis-structure.sql 2013-10-20 15:37:21 UTC (rev 857)
+++ trunk/echobase-ui/src/main/assembly/dist/postgis-structure.sql 2013-10-20 16:41:33 UTC (rev 858)
@@ -1,897 +0,0 @@
----
--- #%L
--- EchoBase :: UI
--- $Id$
--- $HeadURL$
--- %%
--- Copyright (C) 2011 - 2013 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%
----
-CREATE EXTENSION postgis;
-
--- creation table de spatialisation
-DROP TABLE IF EXISTS echobase_cell_spatial;
-CREATE TABLE echobase_cell_spatial (
- voyageid VARCHAR(256) NOT NULL,
- voyagename VARCHAR(256),
- transitid VARCHAR(256),
- transitname VARCHAR(256),
- transectid VARCHAR(256),
- transectname VARCHAR(256),
- dataAcquisitionid VARCHAR(256),
- dataAcquisitionname VARCHAR(256),
- dataProcessingid VARCHAR(256),
- dataProcessingname VARCHAR(256),
- celltypeid VARCHAR(256) NOT NULL,
- celltypename VARCHAR(256) NOT NULL,
- cellid VARCHAR(256) PRIMARY KEY,
- cellname VARCHAR(256) NOT NULL,
- lastUpdateDate TIMESTAMP NOT NULL,
- coordinate geography (POINT, 4326),
- coordinate3D geography (POINTZ, 4326),
- shape geography (POLYGON, 4326),
- FOREIGN KEY (cellid) REFERENCES cell (topiaid),
- FOREIGN KEY (celltypeid) REFERENCES celltype (topiaid),
- FOREIGN KEY (dataacquisitionid) REFERENCES dataacquisition (topiaid),
- FOREIGN KEY (dataprocessingid) REFERENCES dataprocessing (topiaid),
- FOREIGN KEY (transectid) REFERENCES transect (topiaid),
- FOREIGN KEY (transitid) REFERENCES transit (topiaid),
- FOREIGN KEY (voyageid) REFERENCES voyage (topiaid)
-);
-CREATE INDEX echobase_cell_spatial_coordinate_gix ON echobase_cell_spatial USING GIST (coordinate);
-CREATE INDEX echobase_cell_spatial_coordinate3D_gix ON echobase_cell_spatial USING GIST (coordinate3D);
-CREATE INDEX echobase_cell_spatial_shape_gix ON echobase_cell_spatial USING GIST (shape);
-
--- creation table des traitements spatiaux a effectuer
-DROP TABLE IF EXISTS echobase_cell_spatial_temp;
-CREATE TABLE echobase_cell_spatial_temp (
- cellid VARCHAR(256) PRIMARY KEY,
- celltype VARCHAR(256) NOT NULL,
- FOREIGN KEY (cellid) REFERENCES cell (topiaid)
-);
-
---
--- Trigger qui met à jour la table des traitements spatiaux à faire
---
-
-CREATE OR REPLACE FUNCTION echobase_fill_spatial_temp_table()
- RETURNS TRIGGER AS $$
-DECLARE
- cell_id VARCHAR;
- data_type_id VARCHAR;
- cellType VARCHAR;
- dataType VARCHAR;
- doInsert BOOLEAN;
- result RECORD;
-BEGIN
-
- IF (TG_OP = 'DELETE')
- THEN
- result = OLD;
- ELSE
- result = NEW;
- END IF;
-
- cell_id = result.cell;
- data_type_id = result.datametadata;
- doInsert = FALSE;
--- recuperation du type de la cellule
- cellType = echobase_get_cell_type(cell_id);
-
- IF (SELECT
- count(*)
- FROM echobase_cell_spatial_temp c
- WHERE c.cellid = cell_id) > 0
- THEN
--- la cellule est deja a traitee
- RETURN result;
- END IF;
--- recuperation du type de la la data
- SELECT
- dt.name
- INTO dataType
- FROM datametadata dt
- WHERE dt.topiaId = data_type_id;
-
- CASE cellType
- WHEN 'ESDU'
- THEN
--- Cell of type Esdu
- CASE dataType
- WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd'
- THEN
- doInsert = TRUE;
- END CASE;
- WHEN 'ELEMENTARY'
- THEN
--- Cell of type Elementary
- CASE dataType
- WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd', 'DepthRefSurfaceStart', 'DepthRefSurfaceEnd', 'DepthRefBottomStart', 'DepthRefBottomEnd'
- THEN
- doInsert = TRUE;
- END CASE;
- WHEN 'REGION', 'REGIONSURF', 'REGIONCLAS'
- THEN
--- Cell of type Region
- CASE dataType
- WHEN 'RegionEnvCoordinates'
- THEN
- doInsert = TRUE;
- cellType = 'REGION';
- END CASE;
- WHEN 'MAP'
- THEN
--- Cell of type Map
- CASE dataType
- WHEN 'GridCellLatitude', 'GridCellLongitude', 'GridLatitudeLag', 'GridLongitudeLag'
- THEN
- doInsert = TRUE;
- END CASE;
- END CASE;
-
- IF doInsert = TRUE
- THEN
---- Ajout de la cellule dans la table des traitements à effectuer
- RAISE NOTICE 'Add cell % [type %] to echobase_cell_spatial_temp', cell_id, cellType;
- INSERT INTO echobase_cell_spatial_temp (cellid, celltype) VALUES (cell_id, cellType);
- END IF;
-
- RETURN result;
-END
-$$
-LANGUAGE 'plpgsql';
-
-DROP TRIGGER IF EXISTS echobase_fill_spatial_work_table_trigger ON data;
-CREATE TRIGGER echobase_fill_spatial_work_table_trigger
-AFTER INSERT OR UPDATE ON data
-FOR EACH ROW WHEN (NEW.cell IS NOT
- NULL) EXECUTE PROCEDURE echobase_fill_spatial_temp_table();
-
---
--- Trigger qui met à jour la table des traitements spatiaux à faire
---
-
-CREATE OR REPLACE FUNCTION echobase_delete_cell()
- RETURNS TRIGGER AS $$
-BEGIN
-
- RAISE NOTICE 'Delete cell % , delete cascade in cell_spatial_table', OLD.topiaid;
-
- DELETE FROM echobase_cell_spatial
- WHERE cellid = OLD.topiaid;
-
- RETURN OLD;
-END
-$$
-LANGUAGE 'plpgsql';
-
-DROP TRIGGER IF EXISTS echobase_delete_cell ON cell;
-
-CREATE TRIGGER echobase_delete_cell
-BEFORE DELETE ON cell
-FOR EACH ROW EXECUTE PROCEDURE echobase_delete_cell();
-
---
--- Mettre a jour toutes les données spatiales
---
-
-CREATE OR REPLACE FUNCTION echobase_compute_all_spatial_data()
- RETURNS VOID AS $$
-DECLARE cell_id VARCHAR;
-BEGIN
- DELETE FROM echobase_cell_spatial;
-
- FOR cell_id IN SELECT
- topiaid
- FROM cell LOOP
- PERFORM echobase_fill_cell_spatial_row(cell_id,
- echobase_get_cell_type(cell_id));
- END LOOP;
-
-END
-$$
-LANGUAGE plpgsql;
-
---
--- Mettre a jour la table echobase_cell_spatial depuis echobase_cell_spatial_temp
---
-
-CREATE OR REPLACE FUNCTION echobase_fill_cell_spatial_table()
- RETURNS VOID AS $$
-DECLARE
- cellRow RECORD;
- depth RECORD;
-BEGIN
- FOR cellRow IN SELECT
- *
- FROM echobase_cell_spatial_temp LOOP
-
- PERFORM echobase_fill_cell_spatial_row(cellRow.cellid, cellRow.celltype);
-
- END LOOP;
-
- DELETE FROM echobase_cell_spatial_temp;
-
-END
-$$
-LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_fill_cell_spatial_row(cell_id VARCHAR,
- cell_type VARCHAR)
- RETURNS VOID AS $$
-BEGIN
-
- RAISE LOG 'Treat spatial cell % [type %] ...', cell_id, cell_type;
- CASE cell_type
- WHEN 'ESDU'
- THEN
- EXECUTE echobase_fill_esdu_cell_spatial_table(cell_id);
- WHEN 'ELEMENTARY'
- THEN
- EXECUTE echobase_fill_elementary_cell_spatial_table(cell_id);
- WHEN 'REGION'
- THEN
- EXECUTE echobase_fill_region_cell_spatial_table(cell_id);
- WHEN 'MAP'
- THEN
- EXECUTE echobase_fill_map_cell_spatial_table(cell_id);
- ELSE
- RAISE LOG 'Can not deal with celltype % (cell %)', cell_type, cell_id;
- END CASE;
-END
-$$
-LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_fill_esdu_cell_spatial_table(
- cell_id VARCHAR)
- RETURNS VOID AS $$
-DECLARE
- latitude VARCHAR;
- longitude VARCHAR;
- depth RECORD;
- spatialText VARCHAR;
- latitudeNumber REAL;
- longitudeNumber REAL;
-BEGIN
- RAISE DEBUG 'Treat esdu cell % ', cell_id;
--- test if start / bary / end event
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeStart';
- IF FOUND
- THEN
--- start data
- RAISE DEBUG 'Treat esdu Start cell % ', cell_id;
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeStart';
- ELSE
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeBary';
- IF FOUND
- THEN
--- bary data
- RAISE DEBUG 'Treat esdu Bary cell %', cell_id;
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeBary';
- ELSE
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeEnd';
- IF FOUND
- THEN
--- end data
- RAISE DEBUG 'Treat End cell %', cell_id;
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeEnd';
- ELSE
--- no spatial data
- RAISE LOG 'Could not find spatial data for cell %', cell_id;
- RETURN;
- END IF;
- END IF;
- END IF;
-
--- convert dms latitude to dd latitude
- SELECT
- echobase_latitudetext_to_dd(latitude)
- INTO latitudeNumber;
-
- IF latitude IS NOT NULL AND latitudeNumber IS NULL
- THEN
- latitudeNumber := latitude :: REAL;
- END IF;
-
--- convert dms longitude to dd longitude
- SELECT
- echobase_longitudetext_to_dd(longitude)
- INTO longitudeNumber;
-
- IF longitude IS NOT NULL AND longitudeNumber IS NULL
- THEN
- longitudeNumber := longitude :: REAL;
- END IF;
-
- SELECT
- 'SRID=4326;POINT(' || longitudeNumber || ' ' || latitudeNumber || ')'
- INTO spatialText;
- RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
-
- PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
- spatialText,
- NULL,
- NULL);
-END
-$$ LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_fill_elementary_cell_spatial_table(
- cell_id VARCHAR)
- RETURNS VOID AS $$
-DECLARE
- latitude VARCHAR;
- longitude VARCHAR;
- depth VARCHAR;
- spatialText VARCHAR;
- latitudeNumber REAL;
- longitudeNumber REAL;
-BEGIN
- RAISE DEBUG 'Treat elementary cell % ', cell_id;
--- try start elementary
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeStart';
- IF FOUND
- THEN
--- this is a start elementary
- RAISE DEBUG 'Treat elementary Start cell % ', cell_id;
--- get longitude
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeStart';
--- get depth (try first surface one)
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceStart';
- IF NOT FOUND
- THEN
--- try then bottom
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomStart';
- END IF;
- ELSE
--- try bary elementary
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeBary';
- IF FOUND
- THEN
--- this is a bary elementary
- RAISE DEBUG 'Treat elementary Bary cell %', cell_id;
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeBary';
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceBary';
- IF NOT FOUND
- THEN
--- use depth bottom
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomBary';
- END IF;
- ELSE
--- try end elementary
- SELECT
- d.datavalue
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LatitudeEnd';
- IF FOUND
- THEN
--- this is a end elementary
- RAISE DEBUG 'Treat elementary End cell %', cell_id;
- SELECT
- d.datavalue
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'LongitudeEnd';
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceEnd';
- IF NOT FOUND
- THEN
--- use depth bottom
- SELECT
- d.datavalue
- INTO depth
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomEnd';
- END IF;
- ELSE
--- no spatial data
- RAISE DEBUG 'Could not find spatial data for cell %', cell_id;
- RETURN;
- END IF;
- END IF;
- END IF;
-
--- convert dms latitude to dd latitude
- SELECT
- echobase_latitudetext_to_dd(latitude)
- INTO latitudeNumber;
-
- IF latitude IS NOT NULL AND latitudeNumber IS NULL
- THEN
- latitudeNumber := latitude :: REAL;
- END IF;
-
--- convert dms longitude to dd longitude
- SELECT
- echobase_longitudetext_to_dd(longitude)
- INTO longitudeNumber;
-
- IF longitude IS NOT NULL AND longitudeNumber IS NULL
- THEN
- longitudeNumber := longitude :: REAL;
- END IF;
-
- SELECT
- 'SRID=4326;POINTZ(' || longitudeNumber || ' ' || latitudeNumber || ' ' ||
- depth || ')'
- INTO spatialText;
- RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
-
- PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
- NULL,
- spatialText,
- NULL);
-END
-$$ LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_fill_region_cell_spatial_table(
- cell_id VARCHAR)
- RETURNS VOID AS $$
-DECLARE
- latitude REAL;
- longitude REAL;
- depth REAL;
- dataMetadataId VARCHAR;
- dataValue VARCHAR;
- spatialText VARCHAR := 'POLYGON((';
-BEGIN
- RAISE DEBUG 'Treat region cell %', cell_id;
- SELECT
- topiaid
- INTO dataMetadataId
- FROM datametadata
- WHERE name = 'RegionEnvCoordinates';
- FOR dataValue IN SELECT
- d.datavalue
- FROM data d
- WHERE d.cell = cell_id AND d.datametadata = dataMetadataId
- ORDER BY d.topiacreatedate LOOP
--- split dataValue in lat - long - depth
- SELECT
- split_part(dataValue, ' ', 1) :: REAL
- INTO latitude;
- SELECT
- split_part(dataValue, ' ', 2) :: REAL
- INTO longitude;
- SELECT
- split_part(dataValue, ' ', 3) :: REAL
- INTO depth;
- SELECT
- spatialText || longitude || ' ' || latitude || ','
- INTO spatialText;
- END LOOP;
- SELECT
- left(spatialText, -1) || '))'
- INTO spatialText;
-
- RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
-
- PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
- NULL,
- NULL,
- spatialText);
-END
-$$ LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_fill_map_cell_spatial_table(
- cell_id VARCHAR)
- RETURNS VOID AS $$
-DECLARE
- latitude REAL;
- longitude REAL;
- deltaLatitude REAL;
- deltaLongitude REAL;
- P0 VARCHAR;
- P1 VARCHAR;
- P2 VARCHAR;
- P3 VARCHAR;
- spatialText VARCHAR;
-BEGIN
- RAISE DEBUG 'Treat map cell % ', cell_id;
--- get GridCellLatitude
- SELECT
- d.datavalue :: REAL
- INTO latitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'GridCellLatitude';
--- get GridCellLatitude
- SELECT
- d.datavalue :: REAL
- INTO longitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'GridCellLongitude';
--- get GridCellLatitude
- SELECT
- d.datavalue :: REAL
- INTO deltaLatitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'GridLatitudeLag';
--- get GridCellLatitude
- SELECT
- d.datavalue :: REAL
- INTO deltaLongitude
- FROM data d LEFT OUTER JOIN datametadata AS dm
- ON d.datametadata = dm.topiaid
- WHERE d.cell = cell_id AND dm.name = 'GridLongitudeLag';
-
- IF
- latitude IS NOT NULL AND longitude IS NOT NULL AND deltaLatitude IS NOT NULL
- AND deltaLongitude IS NOT NULL
- THEN
- SELECT
- longitude || ' ' || latitude
- INTO P0;
- SELECT
- longitude || ' ' || latitude + deltaLatitude
- INTO P1;
- SELECT
- longitude + deltaLongitude || ' ' || latitude + deltaLatitude
- INTO P2;
- SELECT
- longitude + deltaLongitude || ' ' || latitude
- INTO P3;
-
- SELECT
- 'POLYGON((' || p0 || ',' || P1 || ',' || P2 || ',' || P3 || ',' || P0 ||
- '))'
- INTO spatialText;
- RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
-
- PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
- NULL,
- NULL,
- spatialText);
- END IF;
-END
-$$ LANGUAGE plpgsql;
-
--- procedure pour creer (ou mettre à jour) une ligne dans echobase_cell_spatial
-
-CREATE OR REPLACE FUNCTION echobase_create_echobase_cell_spatial_row(
- cell_id VARCHAR,
- coordinateText VARCHAR,
- coordinate3dText VARCHAR,
- shapeText VARCHAR)
- RETURNS VOID AS $$
-DECLARE
- cellSpatialRow RECORD;
- voyageId VARCHAR;
- voyageName VARCHAR;
- transitId VARCHAR;
- transitName VARCHAR;
- transectId VARCHAR;
- transectName VARCHAR;
- dataAcquisitionId VARCHAR;
- dataAcquisitionName VARCHAR;
- dataProcessingId VARCHAR;
- dataProcessingName VARCHAR;
- cellName VARCHAR;
- cellTypeId VARCHAR;
- cellTypeName VARCHAR;
- cellParentId VARCHAR;
- cellRow RECORD;
- coordinateData GEOGRAPHY;
- coordinate3dData GEOGRAPHY;
- shapeData GEOGRAPHY;
-BEGIN
- IF coordinateText IS NULL AND coordinate3dText IS NULL AND
- shapeText IS NULL
- THEN
- RAISE DEBUG 'Could not find spatial data for cell %', cell_id;
- RETURN;
- END IF;
- IF coordinateText IS NOT NULL
- THEN
- BEGIN
- coordinateData = ST_GeographyFromText(coordinateText);
- EXCEPTION WHEN internal_error
- THEN
-
- RAISE LOG 'Could not create coordinate spatial data %', coordinateText;
- RETURN;
- END;
- ELSEIF coordinate3dText IS NOT NULL
- THEN
- BEGIN
- coordinate3dData = ST_GeographyFromText(coordinate3dText);
- EXCEPTION WHEN internal_error
- THEN
-
- RAISE LOG 'Could not create coordinate3D spatial data %', coordinate3dText;
- RETURN;
- END;
- ELSEIF shapeText IS NOT NULL
- THEN
- BEGIN
- shapeData = ST_GeographyFromText(shapeText);
- EXCEPTION WHEN internal_error
- THEN
-
- RAISE LOG 'Could not create shape spatial data %', shapeText;
- RETURN;
- END;
- END IF;
-
- SELECT
- *
- INTO cellSpatialRow
- FROM echobase_cell_spatial cs
- WHERE cs.cellid = cell_id;
- IF NOT FOUND
- THEN
--- create row
- RAISE DEBUG 'Will create spatial cell %', cell_id;
- SELECT
- cell_id
- INTO cellParentId;
- LOOP
- IF dataProcessingId IS NULL
- THEN
--- try to get dataprocessingId from this cell
- SELECT
- dp.topiaid,
- dp.processingdescription
- INTO dataProcessingId
- FROM dataprocessing dp, cell c
- WHERE c.topiaid = cellParentId AND dp.topiaid = c.dataprocessing;
- END IF;
- SELECT
- topiaid,
- cell
- INTO cellRow
- FROM cell
- WHERE topiaid = cellParentId;
- EXIT WHEN cellRow.cell IS NULL;
- SELECT
- cellRow.cell
- INTO cellParentId;
- END LOOP;
- RAISE DEBUG 'use cell parentId %', cellParentId;
--- get cell infos
- SELECT
- c.name,
- ct.name,
- ct.topiaid
- INTO cellName, cellTypeName, cellTypeId
- FROM cell c, celltype ct
- WHERE c.topiaid = cell_id AND c.celltype = ct.topiaid;
-
- IF dataProcessingId IS NULL
- THEN
--- get voyage infos
- SELECT
- v.topiaid,
- v.name
- INTO voyageId, voyageName
- FROM voyage v, cell c
- WHERE c.topiaid = cellParentId AND v.topiaid = c.voyage;
- ELSE
-
--- get dataAcquisition infos
- SELECT
- da.topiaid,
- da.acousticinstrument
- INTO dataAcquisitionId, dataAcquisitionName
- FROM dataacquisition da, dataprocessing dp
- WHERE dp.topiaId = dataProcessingId AND da.topiaid = dp.dataacquisition;
--- get transect infos
- SELECT
- t.topiaid,
- t.vessel
- INTO transectId, transitName
- FROM transect t, dataacquisition da
- WHERE da.topiaid = dataAcquisitionId AND t.topiaid = da.transect;
--- get transit infos
- SELECT
- t.topiaid,
- (t.starttime || ' - ' || t.endtime)
- INTO transitId, transitName
- FROM transit t, transect tt
- WHERE tt.topiaid = transectId AND t.topiaid = tt.transit;
--- get voyage infos
- SELECT
- v.topiaid,
- v.name
- INTO voyageId, voyageName
- FROM voyage v, transit t
- WHERE t.topiaid = transitId AND v.topiaid = t.voyage;
- END IF;
- INSERT INTO echobase_cell_spatial (lastUpdateDate, voyageid, voyagename, transitid, transitname, transectid, transectname, dataacquisitionid, dataacquisitionname, dataprocessingid, dataprocessingname, celltypeid, celltypename, cellid, cellname, coordinate, coordinate3D, shape)
- VALUES (now(), voyageId, voyageName, transitId, transitName, transectId, transectName, dataAcquisitionId, dataAcquisitionName, dataProcessingId, dataProcessingName, cellTypeId, cellTypeName, cell_id, cellName, coordinateData, coordinate3dData, shapeData);
- ELSE
--- update row
- RAISE DEBUG 'Will update spatial cell % ', cell_id;
- UPDATE echobase_cell_spatial
- SET coordinate = coordinateData,
- coordinate3d = coordinate3dData,
- shape = shapeData
- WHERE cellid = cell_id;
- END IF;
-END
-$$ LANGUAGE plpgsql;
-
--- pour obtenir le type d'une cellule sous forme ESDU - ELEMENTARY - REGION ou MAP
-CREATE OR REPLACE FUNCTION echobase_get_cell_type(cell_id VARCHAR)
- RETURNS VARCHAR AS $$
-DECLARE result VARCHAR;
-BEGIN
- SELECT
- UPPER(ct.id)
- INTO result
- FROM celltype ct, cell ce
- WHERE ce.topiaid = cell_id AND ct.topiaId = ce.celltype;
- IF 'REGIONCLAS' = result OR 'REGIONSURF' = result
- THEN
- result = 'REGION';
- END IF;
- RETURN result;
-END
-$$
-LANGUAGE plpgsql;
-
--- pour convertir des latitudes en dms (+ hemi) en dd
-CREATE OR REPLACE FUNCTION echobase_latitudetext_to_dd(latitude VARCHAR)
- RETURNS REAL AS $$
-DECLARE
- degre_ INTEGER;
- minute_ INTEGER;
- second_ INTEGER;
- hemi_ VARCHAR(1);
-BEGIN
- SELECT
- right(latitude, 1),
- left(latitude, 2) :: INTEGER,
- substring(latitude FROM 3 FOR 2) :: INTEGER,
- substring(latitude FROM 6 FOR 3) :: INTEGER
- INTO hemi_, degre_, minute_, second_;
-
- RETURN echobase_dms2dd(degre_, minute_, second_, hemi_);
- EXCEPTION WHEN invalid_text_representation
- THEN
- RETURN NULL;
-END
-$$ LANGUAGE plpgsql;
-
--- pour convertir des longitudes en dms (+ hemi) en dd
-CREATE OR REPLACE FUNCTION echobase_longitudetext_to_dd(longitude VARCHAR)
- RETURNS REAL AS $$
-DECLARE
- degre_ INTEGER;
- minute_ INTEGER;
- second_ INTEGER;
- hemi_ VARCHAR(1);
-BEGIN
- SELECT
- right(longitude, 1),
- left(longitude, 3) :: INTEGER,
- substring(longitude FROM 4 FOR 2) :: INTEGER,
- substring(longitude FROM 7 FOR 3) :: INTEGER
- INTO hemi_, degre_, minute_, second_;
-
- RETURN echobase_dms2dd(degre_, minute_, second_, hemi_);
- EXCEPTION WHEN invalid_text_representation
- THEN
- RETURN NULL;
-END
-$$ LANGUAGE plpgsql;
-
-CREATE OR REPLACE FUNCTION echobase_dms2dd(
- D INTEGER, M INTEGER, S INTEGER, HEMI CHARACTER VARYING(1)
-)
- RETURNS DOUBLE PRECISION AS $$
-DECLARE
- ret DOUBLE PRECISION;
- dir INTEGER;
-BEGIN
- dir := 1;
---init to 1 for default positive return
- ret := 0;
---init to zero.
- --ONLY S or W will trip this. Any other letter or NULL will result in positive return value
- IF UPPER(HEMI) = 'S' OR UPPER(HEMI) = 'W'
- THEN
- dir := -1; --then southern or western hemisphere
- END IF;
---SOME data has negative values in minutes and seconds as well as degrees. Use ABS to standardize all three.
- ret := (ABS(CAST(D AS DOUBLE PRECISION)) + (ABS((CAST(M AS DOUBLE PRECISION) +
- (ABS((CAST(S AS
- DOUBLE PRECISION))
- / 60))) / 60)));
- ret := ret * dir;
- RETURN ret;
-
-END;
-$$ LANGUAGE plpgsql;
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-20 15:37:21 UTC (rev 857)
+++ trunk/pom.xml 2013-10-20 16:41:33 UTC (rev 858)
@@ -531,6 +531,39 @@
</plugins>
</reporting>
+ <build>
+
+ <plugins>
+
+ <plugin>
+
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <!-- on recopie le changelog.txt vers le site pour faire la release note -->
+ <execution>
+ <id>copy sql to site</id>
+ <phase>pre-site</phase>
+ <inherited>false</inherited>
+ <configuration>
+ <!-- TODO chemit 2011-02-24 Change to 'target' when using ant-run 1.6 in mavenpom4labs... -->
+ <tasks>
+ <echo message="Copy sql files to site" />
+ <copy verbose="${maven.verbose}" failonerror="false" overwrite="true" todir="${project.reporting.outputDirectory}/sql">
+ <fileset dir="${basedir}/src/site/">
+ <include name="*.sql" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</profile>
<!-- do not generate site if no src/site is found for module -->
Copied: trunk/src/site/postgis-structure.sql (from rev 853, trunk/echobase-ui/src/main/assembly/dist/postgis-structure.sql)
===================================================================
--- trunk/src/site/postgis-structure.sql (rev 0)
+++ trunk/src/site/postgis-structure.sql 2013-10-20 16:41:33 UTC (rev 858)
@@ -0,0 +1,897 @@
+---
+-- #%L
+-- EchoBase :: UI
+-- $Id$
+-- $HeadURL$
+-- %%
+-- Copyright (C) 2011 - 2013 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%
+---
+CREATE EXTENSION postgis;
+
+-- creation table de spatialisation
+DROP TABLE IF EXISTS echobase_cell_spatial;
+CREATE TABLE echobase_cell_spatial (
+ voyageid VARCHAR(256) NOT NULL,
+ voyagename VARCHAR(256),
+ transitid VARCHAR(256),
+ transitname VARCHAR(256),
+ transectid VARCHAR(256),
+ transectname VARCHAR(256),
+ dataAcquisitionid VARCHAR(256),
+ dataAcquisitionname VARCHAR(256),
+ dataProcessingid VARCHAR(256),
+ dataProcessingname VARCHAR(256),
+ celltypeid VARCHAR(256) NOT NULL,
+ celltypename VARCHAR(256) NOT NULL,
+ cellid VARCHAR(256) PRIMARY KEY,
+ cellname VARCHAR(256) NOT NULL,
+ lastUpdateDate TIMESTAMP NOT NULL,
+ coordinate geography (POINT, 4326),
+ coordinate3D geography (POINTZ, 4326),
+ shape geography (POLYGON, 4326),
+ FOREIGN KEY (cellid) REFERENCES cell (topiaid),
+ FOREIGN KEY (celltypeid) REFERENCES celltype (topiaid),
+ FOREIGN KEY (dataacquisitionid) REFERENCES dataacquisition (topiaid),
+ FOREIGN KEY (dataprocessingid) REFERENCES dataprocessing (topiaid),
+ FOREIGN KEY (transectid) REFERENCES transect (topiaid),
+ FOREIGN KEY (transitid) REFERENCES transit (topiaid),
+ FOREIGN KEY (voyageid) REFERENCES voyage (topiaid)
+);
+CREATE INDEX echobase_cell_spatial_coordinate_gix ON echobase_cell_spatial USING GIST (coordinate);
+CREATE INDEX echobase_cell_spatial_coordinate3D_gix ON echobase_cell_spatial USING GIST (coordinate3D);
+CREATE INDEX echobase_cell_spatial_shape_gix ON echobase_cell_spatial USING GIST (shape);
+
+-- creation table des traitements spatiaux a effectuer
+DROP TABLE IF EXISTS echobase_cell_spatial_temp;
+CREATE TABLE echobase_cell_spatial_temp (
+ cellid VARCHAR(256) PRIMARY KEY,
+ celltype VARCHAR(256) NOT NULL,
+ FOREIGN KEY (cellid) REFERENCES cell (topiaid)
+);
+
+--
+-- Trigger qui met à jour la table des traitements spatiaux à faire
+--
+
+CREATE OR REPLACE FUNCTION echobase_fill_spatial_temp_table()
+ RETURNS TRIGGER AS $$
+DECLARE
+ cell_id VARCHAR;
+ data_type_id VARCHAR;
+ cellType VARCHAR;
+ dataType VARCHAR;
+ doInsert BOOLEAN;
+ result RECORD;
+BEGIN
+
+ IF (TG_OP = 'DELETE')
+ THEN
+ result = OLD;
+ ELSE
+ result = NEW;
+ END IF;
+
+ cell_id = result.cell;
+ data_type_id = result.datametadata;
+ doInsert = FALSE;
+-- recuperation du type de la cellule
+ cellType = echobase_get_cell_type(cell_id);
+
+ IF (SELECT
+ count(*)
+ FROM echobase_cell_spatial_temp c
+ WHERE c.cellid = cell_id) > 0
+ THEN
+-- la cellule est deja a traitee
+ RETURN result;
+ END IF;
+-- recuperation du type de la la data
+ SELECT
+ dt.name
+ INTO dataType
+ FROM datametadata dt
+ WHERE dt.topiaId = data_type_id;
+
+ CASE cellType
+ WHEN 'ESDU'
+ THEN
+-- Cell of type Esdu
+ CASE dataType
+ WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd'
+ THEN
+ doInsert = TRUE;
+ END CASE;
+ WHEN 'ELEMENTARY'
+ THEN
+-- Cell of type Elementary
+ CASE dataType
+ WHEN 'LatitudeStart', 'LatitudeBary', 'LatitudeEnd', 'LongitudeStart', 'LongitudeBary', 'LongitudeEnd', 'DepthRefSurfaceStart', 'DepthRefSurfaceEnd', 'DepthRefBottomStart', 'DepthRefBottomEnd'
+ THEN
+ doInsert = TRUE;
+ END CASE;
+ WHEN 'REGION', 'REGIONSURF', 'REGIONCLAS'
+ THEN
+-- Cell of type Region
+ CASE dataType
+ WHEN 'RegionEnvCoordinates'
+ THEN
+ doInsert = TRUE;
+ cellType = 'REGION';
+ END CASE;
+ WHEN 'MAP'
+ THEN
+-- Cell of type Map
+ CASE dataType
+ WHEN 'GridCellLatitude', 'GridCellLongitude', 'GridLatitudeLag', 'GridLongitudeLag'
+ THEN
+ doInsert = TRUE;
+ END CASE;
+ END CASE;
+
+ IF doInsert = TRUE
+ THEN
+--- Ajout de la cellule dans la table des traitements à effectuer
+ RAISE NOTICE 'Add cell % [type %] to echobase_cell_spatial_temp', cell_id, cellType;
+ INSERT INTO echobase_cell_spatial_temp (cellid, celltype) VALUES (cell_id, cellType);
+ END IF;
+
+ RETURN result;
+END
+$$
+LANGUAGE 'plpgsql';
+
+DROP TRIGGER IF EXISTS echobase_fill_spatial_work_table_trigger ON data;
+CREATE TRIGGER echobase_fill_spatial_work_table_trigger
+AFTER INSERT OR UPDATE ON data
+FOR EACH ROW WHEN (NEW.cell IS NOT
+ NULL) EXECUTE PROCEDURE echobase_fill_spatial_temp_table();
+
+--
+-- Trigger qui met à jour la table des traitements spatiaux à faire
+--
+
+CREATE OR REPLACE FUNCTION echobase_delete_cell()
+ RETURNS TRIGGER AS $$
+BEGIN
+
+ RAISE NOTICE 'Delete cell % , delete cascade in cell_spatial_table', OLD.topiaid;
+
+ DELETE FROM echobase_cell_spatial
+ WHERE cellid = OLD.topiaid;
+
+ RETURN OLD;
+END
+$$
+LANGUAGE 'plpgsql';
+
+DROP TRIGGER IF EXISTS echobase_delete_cell ON cell;
+
+CREATE TRIGGER echobase_delete_cell
+BEFORE DELETE ON cell
+FOR EACH ROW EXECUTE PROCEDURE echobase_delete_cell();
+
+--
+-- Mettre a jour toutes les données spatiales
+--
+
+CREATE OR REPLACE FUNCTION echobase_compute_all_spatial_data()
+ RETURNS VOID AS $$
+DECLARE cell_id VARCHAR;
+BEGIN
+ DELETE FROM echobase_cell_spatial;
+
+ FOR cell_id IN SELECT
+ topiaid
+ FROM cell LOOP
+ PERFORM echobase_fill_cell_spatial_row(cell_id,
+ echobase_get_cell_type(cell_id));
+ END LOOP;
+
+END
+$$
+LANGUAGE plpgsql;
+
+--
+-- Mettre a jour la table echobase_cell_spatial depuis echobase_cell_spatial_temp
+--
+
+CREATE OR REPLACE FUNCTION echobase_fill_cell_spatial_table()
+ RETURNS VOID AS $$
+DECLARE
+ cellRow RECORD;
+ depth RECORD;
+BEGIN
+ FOR cellRow IN SELECT
+ *
+ FROM echobase_cell_spatial_temp LOOP
+
+ PERFORM echobase_fill_cell_spatial_row(cellRow.cellid, cellRow.celltype);
+
+ END LOOP;
+
+ DELETE FROM echobase_cell_spatial_temp;
+
+END
+$$
+LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_fill_cell_spatial_row(cell_id VARCHAR,
+ cell_type VARCHAR)
+ RETURNS VOID AS $$
+BEGIN
+
+ RAISE LOG 'Treat spatial cell % [type %] ...', cell_id, cell_type;
+ CASE cell_type
+ WHEN 'ESDU'
+ THEN
+ EXECUTE echobase_fill_esdu_cell_spatial_table(cell_id);
+ WHEN 'ELEMENTARY'
+ THEN
+ EXECUTE echobase_fill_elementary_cell_spatial_table(cell_id);
+ WHEN 'REGION'
+ THEN
+ EXECUTE echobase_fill_region_cell_spatial_table(cell_id);
+ WHEN 'MAP'
+ THEN
+ EXECUTE echobase_fill_map_cell_spatial_table(cell_id);
+ ELSE
+ RAISE LOG 'Can not deal with celltype % (cell %)', cell_type, cell_id;
+ END CASE;
+END
+$$
+LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_fill_esdu_cell_spatial_table(
+ cell_id VARCHAR)
+ RETURNS VOID AS $$
+DECLARE
+ latitude VARCHAR;
+ longitude VARCHAR;
+ depth RECORD;
+ spatialText VARCHAR;
+ latitudeNumber REAL;
+ longitudeNumber REAL;
+BEGIN
+ RAISE DEBUG 'Treat esdu cell % ', cell_id;
+-- test if start / bary / end event
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeStart';
+ IF FOUND
+ THEN
+-- start data
+ RAISE DEBUG 'Treat esdu Start cell % ', cell_id;
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeStart';
+ ELSE
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeBary';
+ IF FOUND
+ THEN
+-- bary data
+ RAISE DEBUG 'Treat esdu Bary cell %', cell_id;
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeBary';
+ ELSE
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeEnd';
+ IF FOUND
+ THEN
+-- end data
+ RAISE DEBUG 'Treat End cell %', cell_id;
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeEnd';
+ ELSE
+-- no spatial data
+ RAISE LOG 'Could not find spatial data for cell %', cell_id;
+ RETURN;
+ END IF;
+ END IF;
+ END IF;
+
+-- convert dms latitude to dd latitude
+ SELECT
+ echobase_latitudetext_to_dd(latitude)
+ INTO latitudeNumber;
+
+ IF latitude IS NOT NULL AND latitudeNumber IS NULL
+ THEN
+ latitudeNumber := latitude :: REAL;
+ END IF;
+
+-- convert dms longitude to dd longitude
+ SELECT
+ echobase_longitudetext_to_dd(longitude)
+ INTO longitudeNumber;
+
+ IF longitude IS NOT NULL AND longitudeNumber IS NULL
+ THEN
+ longitudeNumber := longitude :: REAL;
+ END IF;
+
+ SELECT
+ 'SRID=4326;POINT(' || longitudeNumber || ' ' || latitudeNumber || ')'
+ INTO spatialText;
+ RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
+
+ PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
+ spatialText,
+ NULL,
+ NULL);
+END
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_fill_elementary_cell_spatial_table(
+ cell_id VARCHAR)
+ RETURNS VOID AS $$
+DECLARE
+ latitude VARCHAR;
+ longitude VARCHAR;
+ depth VARCHAR;
+ spatialText VARCHAR;
+ latitudeNumber REAL;
+ longitudeNumber REAL;
+BEGIN
+ RAISE DEBUG 'Treat elementary cell % ', cell_id;
+-- try start elementary
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeStart';
+ IF FOUND
+ THEN
+-- this is a start elementary
+ RAISE DEBUG 'Treat elementary Start cell % ', cell_id;
+-- get longitude
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeStart';
+-- get depth (try first surface one)
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceStart';
+ IF NOT FOUND
+ THEN
+-- try then bottom
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomStart';
+ END IF;
+ ELSE
+-- try bary elementary
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeBary';
+ IF FOUND
+ THEN
+-- this is a bary elementary
+ RAISE DEBUG 'Treat elementary Bary cell %', cell_id;
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeBary';
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceBary';
+ IF NOT FOUND
+ THEN
+-- use depth bottom
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomBary';
+ END IF;
+ ELSE
+-- try end elementary
+ SELECT
+ d.datavalue
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LatitudeEnd';
+ IF FOUND
+ THEN
+-- this is a end elementary
+ RAISE DEBUG 'Treat elementary End cell %', cell_id;
+ SELECT
+ d.datavalue
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'LongitudeEnd';
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefSurfaceEnd';
+ IF NOT FOUND
+ THEN
+-- use depth bottom
+ SELECT
+ d.datavalue
+ INTO depth
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'DepthRefBottomEnd';
+ END IF;
+ ELSE
+-- no spatial data
+ RAISE DEBUG 'Could not find spatial data for cell %', cell_id;
+ RETURN;
+ END IF;
+ END IF;
+ END IF;
+
+-- convert dms latitude to dd latitude
+ SELECT
+ echobase_latitudetext_to_dd(latitude)
+ INTO latitudeNumber;
+
+ IF latitude IS NOT NULL AND latitudeNumber IS NULL
+ THEN
+ latitudeNumber := latitude :: REAL;
+ END IF;
+
+-- convert dms longitude to dd longitude
+ SELECT
+ echobase_longitudetext_to_dd(longitude)
+ INTO longitudeNumber;
+
+ IF longitude IS NOT NULL AND longitudeNumber IS NULL
+ THEN
+ longitudeNumber := longitude :: REAL;
+ END IF;
+
+ SELECT
+ 'SRID=4326;POINTZ(' || longitudeNumber || ' ' || latitudeNumber || ' ' ||
+ depth || ')'
+ INTO spatialText;
+ RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
+
+ PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
+ NULL,
+ spatialText,
+ NULL);
+END
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_fill_region_cell_spatial_table(
+ cell_id VARCHAR)
+ RETURNS VOID AS $$
+DECLARE
+ latitude REAL;
+ longitude REAL;
+ depth REAL;
+ dataMetadataId VARCHAR;
+ dataValue VARCHAR;
+ spatialText VARCHAR := 'POLYGON((';
+BEGIN
+ RAISE DEBUG 'Treat region cell %', cell_id;
+ SELECT
+ topiaid
+ INTO dataMetadataId
+ FROM datametadata
+ WHERE name = 'RegionEnvCoordinates';
+ FOR dataValue IN SELECT
+ d.datavalue
+ FROM data d
+ WHERE d.cell = cell_id AND d.datametadata = dataMetadataId
+ ORDER BY d.topiacreatedate LOOP
+-- split dataValue in lat - long - depth
+ SELECT
+ split_part(dataValue, ' ', 1) :: REAL
+ INTO latitude;
+ SELECT
+ split_part(dataValue, ' ', 2) :: REAL
+ INTO longitude;
+ SELECT
+ split_part(dataValue, ' ', 3) :: REAL
+ INTO depth;
+ SELECT
+ spatialText || longitude || ' ' || latitude || ','
+ INTO spatialText;
+ END LOOP;
+ SELECT
+ left(spatialText, -1) || '))'
+ INTO spatialText;
+
+ RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
+
+ PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
+ NULL,
+ NULL,
+ spatialText);
+END
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_fill_map_cell_spatial_table(
+ cell_id VARCHAR)
+ RETURNS VOID AS $$
+DECLARE
+ latitude REAL;
+ longitude REAL;
+ deltaLatitude REAL;
+ deltaLongitude REAL;
+ P0 VARCHAR;
+ P1 VARCHAR;
+ P2 VARCHAR;
+ P3 VARCHAR;
+ spatialText VARCHAR;
+BEGIN
+ RAISE DEBUG 'Treat map cell % ', cell_id;
+-- get GridCellLatitude
+ SELECT
+ d.datavalue :: REAL
+ INTO latitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'GridCellLatitude';
+-- get GridCellLatitude
+ SELECT
+ d.datavalue :: REAL
+ INTO longitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'GridCellLongitude';
+-- get GridCellLatitude
+ SELECT
+ d.datavalue :: REAL
+ INTO deltaLatitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'GridLatitudeLag';
+-- get GridCellLatitude
+ SELECT
+ d.datavalue :: REAL
+ INTO deltaLongitude
+ FROM data d LEFT OUTER JOIN datametadata AS dm
+ ON d.datametadata = dm.topiaid
+ WHERE d.cell = cell_id AND dm.name = 'GridLongitudeLag';
+
+ IF
+ latitude IS NOT NULL AND longitude IS NOT NULL AND deltaLatitude IS NOT NULL
+ AND deltaLongitude IS NOT NULL
+ THEN
+ SELECT
+ longitude || ' ' || latitude
+ INTO P0;
+ SELECT
+ longitude || ' ' || latitude + deltaLatitude
+ INTO P1;
+ SELECT
+ longitude + deltaLongitude || ' ' || latitude + deltaLatitude
+ INTO P2;
+ SELECT
+ longitude + deltaLongitude || ' ' || latitude
+ INTO P3;
+
+ SELECT
+ 'POLYGON((' || p0 || ',' || P1 || ',' || P2 || ',' || P3 || ',' || P0 ||
+ '))'
+ INTO spatialText;
+ RAISE DEBUG 'spatial data % for cell %', spatialText, cell_id;
+
+ PERFORM echobase_create_echobase_cell_spatial_row(cell_id,
+ NULL,
+ NULL,
+ spatialText);
+ END IF;
+END
+$$ LANGUAGE plpgsql;
+
+-- procedure pour creer (ou mettre à jour) une ligne dans echobase_cell_spatial
+
+CREATE OR REPLACE FUNCTION echobase_create_echobase_cell_spatial_row(
+ cell_id VARCHAR,
+ coordinateText VARCHAR,
+ coordinate3dText VARCHAR,
+ shapeText VARCHAR)
+ RETURNS VOID AS $$
+DECLARE
+ cellSpatialRow RECORD;
+ voyageId VARCHAR;
+ voyageName VARCHAR;
+ transitId VARCHAR;
+ transitName VARCHAR;
+ transectId VARCHAR;
+ transectName VARCHAR;
+ dataAcquisitionId VARCHAR;
+ dataAcquisitionName VARCHAR;
+ dataProcessingId VARCHAR;
+ dataProcessingName VARCHAR;
+ cellName VARCHAR;
+ cellTypeId VARCHAR;
+ cellTypeName VARCHAR;
+ cellParentId VARCHAR;
+ cellRow RECORD;
+ coordinateData GEOGRAPHY;
+ coordinate3dData GEOGRAPHY;
+ shapeData GEOGRAPHY;
+BEGIN
+ IF coordinateText IS NULL AND coordinate3dText IS NULL AND
+ shapeText IS NULL
+ THEN
+ RAISE DEBUG 'Could not find spatial data for cell %', cell_id;
+ RETURN;
+ END IF;
+ IF coordinateText IS NOT NULL
+ THEN
+ BEGIN
+ coordinateData = ST_GeographyFromText(coordinateText);
+ EXCEPTION WHEN internal_error
+ THEN
+
+ RAISE LOG 'Could not create coordinate spatial data %', coordinateText;
+ RETURN;
+ END;
+ ELSEIF coordinate3dText IS NOT NULL
+ THEN
+ BEGIN
+ coordinate3dData = ST_GeographyFromText(coordinate3dText);
+ EXCEPTION WHEN internal_error
+ THEN
+
+ RAISE LOG 'Could not create coordinate3D spatial data %', coordinate3dText;
+ RETURN;
+ END;
+ ELSEIF shapeText IS NOT NULL
+ THEN
+ BEGIN
+ shapeData = ST_GeographyFromText(shapeText);
+ EXCEPTION WHEN internal_error
+ THEN
+
+ RAISE LOG 'Could not create shape spatial data %', shapeText;
+ RETURN;
+ END;
+ END IF;
+
+ SELECT
+ *
+ INTO cellSpatialRow
+ FROM echobase_cell_spatial cs
+ WHERE cs.cellid = cell_id;
+ IF NOT FOUND
+ THEN
+-- create row
+ RAISE DEBUG 'Will create spatial cell %', cell_id;
+ SELECT
+ cell_id
+ INTO cellParentId;
+ LOOP
+ IF dataProcessingId IS NULL
+ THEN
+-- try to get dataprocessingId from this cell
+ SELECT
+ dp.topiaid,
+ dp.processingdescription
+ INTO dataProcessingId
+ FROM dataprocessing dp, cell c
+ WHERE c.topiaid = cellParentId AND dp.topiaid = c.dataprocessing;
+ END IF;
+ SELECT
+ topiaid,
+ cell
+ INTO cellRow
+ FROM cell
+ WHERE topiaid = cellParentId;
+ EXIT WHEN cellRow.cell IS NULL;
+ SELECT
+ cellRow.cell
+ INTO cellParentId;
+ END LOOP;
+ RAISE DEBUG 'use cell parentId %', cellParentId;
+-- get cell infos
+ SELECT
+ c.name,
+ ct.name,
+ ct.topiaid
+ INTO cellName, cellTypeName, cellTypeId
+ FROM cell c, celltype ct
+ WHERE c.topiaid = cell_id AND c.celltype = ct.topiaid;
+
+ IF dataProcessingId IS NULL
+ THEN
+-- get voyage infos
+ SELECT
+ v.topiaid,
+ v.name
+ INTO voyageId, voyageName
+ FROM voyage v, cell c
+ WHERE c.topiaid = cellParentId AND v.topiaid = c.voyage;
+ ELSE
+
+-- get dataAcquisition infos
+ SELECT
+ da.topiaid,
+ da.acousticinstrument
+ INTO dataAcquisitionId, dataAcquisitionName
+ FROM dataacquisition da, dataprocessing dp
+ WHERE dp.topiaId = dataProcessingId AND da.topiaid = dp.dataacquisition;
+-- get transect infos
+ SELECT
+ t.topiaid,
+ t.vessel
+ INTO transectId, transitName
+ FROM transect t, dataacquisition da
+ WHERE da.topiaid = dataAcquisitionId AND t.topiaid = da.transect;
+-- get transit infos
+ SELECT
+ t.topiaid,
+ (t.starttime || ' - ' || t.endtime)
+ INTO transitId, transitName
+ FROM transit t, transect tt
+ WHERE tt.topiaid = transectId AND t.topiaid = tt.transit;
+-- get voyage infos
+ SELECT
+ v.topiaid,
+ v.name
+ INTO voyageId, voyageName
+ FROM voyage v, transit t
+ WHERE t.topiaid = transitId AND v.topiaid = t.voyage;
+ END IF;
+ INSERT INTO echobase_cell_spatial (lastUpdateDate, voyageid, voyagename, transitid, transitname, transectid, transectname, dataacquisitionid, dataacquisitionname, dataprocessingid, dataprocessingname, celltypeid, celltypename, cellid, cellname, coordinate, coordinate3D, shape)
+ VALUES (now(), voyageId, voyageName, transitId, transitName, transectId, transectName, dataAcquisitionId, dataAcquisitionName, dataProcessingId, dataProcessingName, cellTypeId, cellTypeName, cell_id, cellName, coordinateData, coordinate3dData, shapeData);
+ ELSE
+-- update row
+ RAISE DEBUG 'Will update spatial cell % ', cell_id;
+ UPDATE echobase_cell_spatial
+ SET coordinate = coordinateData,
+ coordinate3d = coordinate3dData,
+ shape = shapeData
+ WHERE cellid = cell_id;
+ END IF;
+END
+$$ LANGUAGE plpgsql;
+
+-- pour obtenir le type d'une cellule sous forme ESDU - ELEMENTARY - REGION ou MAP
+CREATE OR REPLACE FUNCTION echobase_get_cell_type(cell_id VARCHAR)
+ RETURNS VARCHAR AS $$
+DECLARE result VARCHAR;
+BEGIN
+ SELECT
+ UPPER(ct.id)
+ INTO result
+ FROM celltype ct, cell ce
+ WHERE ce.topiaid = cell_id AND ct.topiaId = ce.celltype;
+ IF 'REGIONCLAS' = result OR 'REGIONSURF' = result
+ THEN
+ result = 'REGION';
+ END IF;
+ RETURN result;
+END
+$$
+LANGUAGE plpgsql;
+
+-- pour convertir des latitudes en dms (+ hemi) en dd
+CREATE OR REPLACE FUNCTION echobase_latitudetext_to_dd(latitude VARCHAR)
+ RETURNS REAL AS $$
+DECLARE
+ degre_ INTEGER;
+ minute_ INTEGER;
+ second_ INTEGER;
+ hemi_ VARCHAR(1);
+BEGIN
+ SELECT
+ right(latitude, 1),
+ left(latitude, 2) :: INTEGER,
+ substring(latitude FROM 3 FOR 2) :: INTEGER,
+ substring(latitude FROM 6 FOR 3) :: INTEGER
+ INTO hemi_, degre_, minute_, second_;
+
+ RETURN echobase_dms2dd(degre_, minute_, second_, hemi_);
+ EXCEPTION WHEN invalid_text_representation
+ THEN
+ RETURN NULL;
+END
+$$ LANGUAGE plpgsql;
+
+-- pour convertir des longitudes en dms (+ hemi) en dd
+CREATE OR REPLACE FUNCTION echobase_longitudetext_to_dd(longitude VARCHAR)
+ RETURNS REAL AS $$
+DECLARE
+ degre_ INTEGER;
+ minute_ INTEGER;
+ second_ INTEGER;
+ hemi_ VARCHAR(1);
+BEGIN
+ SELECT
+ right(longitude, 1),
+ left(longitude, 3) :: INTEGER,
+ substring(longitude FROM 4 FOR 2) :: INTEGER,
+ substring(longitude FROM 7 FOR 3) :: INTEGER
+ INTO hemi_, degre_, minute_, second_;
+
+ RETURN echobase_dms2dd(degre_, minute_, second_, hemi_);
+ EXCEPTION WHEN invalid_text_representation
+ THEN
+ RETURN NULL;
+END
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION echobase_dms2dd(
+ D INTEGER, M INTEGER, S INTEGER, HEMI CHARACTER VARYING(1)
+)
+ RETURNS DOUBLE PRECISION AS $$
+DECLARE
+ ret DOUBLE PRECISION;
+ dir INTEGER;
+BEGIN
+ dir := 1;
+--init to 1 for default positive return
+ ret := 0;
+--init to zero.
+ --ONLY S or W will trip this. Any other letter or NULL will result in positive return value
+ IF UPPER(HEMI) = 'S' OR UPPER(HEMI) = 'W'
+ THEN
+ dir := -1; --then southern or western hemisphere
+ END IF;
+--SOME data has negative values in minutes and seconds as well as degrees. Use ABS to standardize all three.
+ ret := (ABS(CAST(D AS DOUBLE PRECISION)) + (ABS((CAST(M AS DOUBLE PRECISION) +
+ (ABS((CAST(S AS
+ DOUBLE PRECISION))
+ / 60))) / 60)));
+ ret := ret * dir;
+ RETURN ret;
+
+END;
+$$ LANGUAGE plpgsql;
\ No newline at end of file
Modified: trunk/src/site/rst/db.rst
===================================================================
--- trunk/src/site/rst/db.rst 2013-10-20 15:37:21 UTC (rev 857)
+++ trunk/src/site/rst/db.rst 2013-10-20 16:41:33 UTC (rev 858)
@@ -68,8 +68,8 @@
login: sa
password: sa
-Utilisation d'une base Postgres
--------------------------------
+Utilisation d'une base Postgresql
+---------------------------------
C'est ce genre de base que l'on doit utiliser sur un serveur pour conserver de
manière perenne les données.
@@ -82,7 +82,7 @@
::
- jdbc:postgresql://adresseDuServeur/nomDeLaBase
+ jdbc:postgresql://serverAddres/dbName
Les identifiants vous sont fournit par l'administrateur qui a installé la base
postgresql sur le serveur.
@@ -92,8 +92,7 @@
Pré-requis :
- - **postgres** doit être installé sur la machine (exemple pour un système
- Debian : **sudo apt-get install postgresql**)
+ - **postgres** doit être installé sur la machine (voir `page d'installation`_)
- être connecté avec l'utilisateur (postgres par défaut) qui a les droits
d'administrer cette base de donnée dans une console shell.
@@ -102,26 +101,42 @@
su postgres
-1. Création de l'utilisateur de la base *nomDeLUtilisateur*
+- Création de l'utilisateur de la base *userName*
::
- createuser -U postgres -sdRP nomUtilisateur
+ createuser -U postgres -sdRP userName
-2. Création de la base de donnée "nomDeLaBase"
+- Création de la base de donnée *dbName*
::
- createdb -U postgres -E UTF-8 -O nomDeLUtilisateur nomDeLaBase
+ createdb -U postgres -E UTF-8 -O userName dbName
-3. Donner les droits d'acces à l'utilisateur echobase (cela varie d'un système
- à l'autre, donc se référer à la documentation du système). Cela fonctionne
- lorsqu'on peut accéder à la base via cette commande :
+- Donner les droits d'acces à l'utilisateur echobase (cela varie d'un système à
+ l'autre, donc se référer à la documentation du système). Cela fonctionne
+ lorsqu'on peut accéder à la base via cette commande :
::
- psql -h localhost -U nomDeLUtilisateur nomDeLaBase
+ psql -h localhost -U userName dbName
-4. Il faut ensuite ne pas oublier de créer une configuration de base de travail
- pour pouvoir accéder à cette base.
+- Il faut ensuite ne pas oublier de créer une configuration de base de travail
+ pour pouvoir accéder à cette base.
+Rendre une base postgresql spatiale
+-----------------------------------
+
+Pour pouvoir utiliser postgis sur la base, il faut exécuter le script sql
+suivant `postgis-structure.sql`_. Si des données existent, elles seront
+spatialisées (le script peut prendre un certain temps à crééer toutes les
+données spatiales).
+
+::
+
+ psql -h localhost -U userName dbName < postgis-structure.sql
+
+
+.. _page d'installation: ./install.html#Installation_de_la_base_de_donnes
+.. _postgis-structure.sql: ./sql/postgis-structure.sql
+
Deleted: trunk/src/site/rst/install.rst
===================================================================
--- trunk/src/site/rst/install.rst 2013-10-20 15:37:21 UTC (rev 857)
+++ trunk/src/site/rst/install.rst 2013-10-20 16:41:33 UTC (rev 858)
@@ -1,200 +0,0 @@
-.. -
-.. * #%L
-.. * EchoBase
-.. *
-.. * $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%
-.. -
-
-========
-Echobase
-========
-
-Installation d'EchoBase sur un serveur
---------------------------------------
-
-Nous préconisons toujours d'utiliser les valeurs par défaut fournies pour une
-meilleur réactivité si un problème d'installation survient.
-
-Nous préconisons aussi l'utilisation d'un serveur linux de type debian :)...
-
-L'installation se déroule en 2 étapes :
-
-- création de la base de données
-- installation de l'application
-
-Installation de la base de données
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Pré-requis :
- - **postgres** doit être installé sur la machine (exemple pour un système
- Debian : **sudo apt-get install postgresql**)
- - être connecté avec l'utilisateur (postgres par défaut) qui a les droits
- d'administrer cette base de donnée dans une console shell.
-
-1. Création de l'utilisateur Postgres
-
-::
-
- createuser -U postgres -sdRP echobase
-
-2. Création de la base de donnée "echobase"
-
-::
-
- createdb -U postgres -E UTF-8 -O echobase echobase
-
-3. Donner les droits d'acces à l'utilisateur echobase (cela varie d'un système
- à l'autre, donc se référer à la documentation du système). Cela fonctionne
- lorsqu'on peut accéder à la base via cette commande :
-
-::
-
- psql -h localhost -U echobase echobase
-
-Installation de la spatialisation pour la base de données
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Depuis la version 2.2, on gère des données spatiales, il faut installer postgis.
-
-Préparation première installation
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Il faut être loggué sur une console avec l'utilisateur root.
-
-On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
-
-Toutes les données de l'application (et sa configuration) seront placées dans
-le répertoire **/var/local/echobase**
-
-- Créer les répertoires
-
-::
-
- mkdir /var/local/echobase
- mkdir /var/local/echobase/war
-
-- Placer le war à utiliser dans **/var/local/echobase/war**
-
-- Ajouter une lien symoblique vers le war à utiliser
-
-::
-
- ln -s /var/local/echobase/war/echobase-ui-XXX.var /var/local/echobase/echobase.war
-
-- Ajouter un lien symbolique dans le répertoire **webapps** de tomcat vers ce
- lien symbolique
-
-::
-
- ln -s /var/local/echobase/echobase.war /opt/tomcat/webapps/echobase.war
-
-- Copier le fichier de configuration echobase.properties_ de l'application
- dans **/var/local/echobase/**
-
-- Editer ce fichier pour adapter le mot de passe de l'utilisateur et peut-être
- aussi l'url de connexion. Voici un exemple fichier modifié
-
-::
-
- hibernate.dialect=org.hibernate.dialect.PostgreSQL82Dialect
- hibernate.connection.driver_class=org.postgresql.Driver
- hibernate.connection.url=jdbc:postgresql://monNomDeMachine/echobase
- hibernate.connection.username=echobase
- hibernate.connection.password=motDePasseModifie
-
-- Ajouter un lien symbolique ver le fichier de configuration dans */etc*
-
-::
-
- ln -s /var/local/echobase/echobase.properties /etc/echobase.properties
-
-Le répertoire au final devrait ressembler à ça :
-
-::
-
- /var/local/echobase/
- ├── echobase.properties (configuration)
- ├── echobase.war -> war/echobase-ui-1.0.war (war actuellement utilisé)
- ├── logs (répertoire des logs)
- └── war (répertoire des wars)
- └── echobase-ui-1.0.war
-
-Une fois le serveur tomcat démarré, vous pouvez accéder à l'application à
-l'adresse suivante :
-
-::
-
- http://localhost:8080/echobase
-
-Mettre à jour le war de l'application
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Il faut être loggué sur une console avec l'utilisateur root.
-
-On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
-
-Pour utiliser une nouvelle version de l'application, c'est en 5 étapes :
-
-1. Arrêter le serveur tomcat
-2. Supprimer les répertoires suivants :
-
-::
-
- rm -rf /opt/tomcat/webapps/echobase
- rm -rf /opt/tomcat/work/Catalina/localhost/echobase
-
-3. Copier le nouveau war dans **/var/local/echobase/war**
-4. Changer le lien symbolique **/var/local/echobase/echobase.war**
-
-::
-
- ln -fvs /var/local/echobasewar/echobase-ui-XXX.war /var/local/echobase/echobase.war
-
-5. Relancer le serveur tomcat
-
-Divers
-------
-
-Gestion des logs de l'application
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Avant de lancer l'application, il faut avoir positionner une variable
-**echobase.log.dir** de jvm qui définit le répertoire où positionner les logs
-de l'application.::
-
- JAVA_OPTS="$JAVA_OPTS -Dechobase.log.dir=/var/local/echobase/logs"
-
-ou::
-
- CATALINA_OPTS="$CATALINA_OPTS -Dechobase.log.dir=/var/local/echobase/logs"
-
-Première utilisation
-~~~~~~~~~~~~~~~~~~~~
-
-Deux utilisateurs sont créés si la base est vide (première utilisation)::
-
- login / password : admin / admin
- login / password : user / user
-
-Pour des raisons de sécurité, il est conseillé de modifier le mot de passe via
-l'interface de gestion des utilisateurs.
-
-.. _echobase.properties: echobase.properties
-
Copied: trunk/src/site/rst/install.rst.vm (from rev 853, trunk/src/site/rst/install.rst)
===================================================================
--- trunk/src/site/rst/install.rst.vm (rev 0)
+++ trunk/src/site/rst/install.rst.vm 2013-10-20 16:41:33 UTC (rev 858)
@@ -0,0 +1,230 @@
+.. -
+.. * #%L
+.. * EchoBase
+.. *
+.. * $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%
+.. -
+
+========
+Echobase
+========
+
+Installation d'EchoBase sur un serveur
+--------------------------------------
+
+Nous préconisons toujours d'utiliser les valeurs par défaut fournies pour une
+meilleur réactivité de notre part si un problème d'installation survient.
+
+Nous préconisons aussi l'utilisation d'un serveur linux de type debian.
+
+L'installation se déroule en 2 étapes :
+
+- création de la base de données
+- installation de l'application
+
+Installation de la base de données
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Installation de postgresql et postgis (debian's way)
+
+Pour postgresql 9.0
+
+::
+
+ sudo apt-get install postgresql-9.0
+ sudo apt-get install postgresql-9.0-postgis-2.1
+ sudo apt-get install postgresql-9.0-postgis-2.1-scripts
+
+Pour postgresql 9.1
+
+::
+
+ sudo apt-get install postgresql-9.1
+ sudo apt-get install postgresql-9.1-postgis-2.1
+ sudo apt-get install postgresql-9.1-postgis-2.1-scripts
+
+
+Pour postgresql 9.2
+
+::
+
+ sudo apt-get install postgresql-9.2
+ sudo apt-get install postgresql-9.2-postgis-2.1
+ sudo apt-get install postgresql-9.2-postgis-2.1-scripts
+
+Pour postgresql 9.3
+
+::
+
+ sudo apt-get install postgresql-9.3
+ sudo apt-get install postgresql-9.3-postgis-2.1
+ sudo apt-get install postgresql-9.3-postgis-2.1-scripts
+
+Consulter la documentation suivante pour `créer une base travail`_.
+
+Préparation première installation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Il faut être loggué sur une console avec l'utilisateur root.
+
+On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
+
+Toutes les données de l'application (et sa configuration) seront placées dans
+le répertoire **/var/local/echobase**
+
+- Créer les répertoires
+
+::
+
+ mkdir /var/local/echobase
+ mkdir /var/local/echobase/war
+
+- Placer le war à utiliser dans **/var/local/echobase/war**
+
+- Ajouter une lien symoblique vers le war à utiliser
+
+::
+
+ ln -s /var/local/echobase/war/echobase-full-${project.version}.var /var/local/echobase/echobase.war
+
+- Ajouter un lien symbolique dans le répertoire **webapps** de tomcat vers ce
+ lien symbolique
+
+::
+
+ ln -s /var/local/echobase/echobase.war /opt/tomcat/webapps/echobase.war
+
+- Copier le fichier de configuration echobase.properties_ de l'application
+ dans **/var/local/echobase/**
+
+- Editer ce fichier pour adapter le mot de passe de l'utilisateur et peut-être
+ aussi l'url de connexion. Voici un exemple fichier modifié
+
+::
+
+ hibernate.dialect=org.hibernate.dialect.PostgreSQL82Dialect
+ hibernate.connection.driver_class=org.postgresql.Driver
+ hibernate.connection.url=jdbc:postgresql://monNomDeMachine/echobase
+ hibernate.connection.username=echobase
+ hibernate.connection.password=motDePasseModifie
+
+- Ajouter un lien symbolique ver le fichier de configuration dans */etc*
+
+::
+
+ ln -s /var/local/echobase/echobase.properties /etc/echobase.properties
+
+Le répertoire au final devrait ressembler à ça :
+
+::
+
+ /var/local/echobase/
+ ├── echobase.properties (configuration)
+ ├── echobase.war -> war/echobase-full-${project.version}.war (war utilisé)
+ └── war (répertoire des wars)
+ └── echobase-full-${project.version}.war
+
+Une fois le serveur tomcat démarré, vous pouvez accéder à l'application à
+l'adresse suivante :
+
+::
+
+ http://localhost:8080/echobase
+
+Un nouveau répertoire est crée comprenant les données internes de l'application, à savoir :
+
+::
+
+ /var/local/echobase/data/
+ |-- internaldb (contient la base interne)
+ | |-- echobase-user.h2.db
+ |-- lib (contient les pilotes jdbc et l'application embarquée)
+ | |-- echobase-embedded-${project.version}.war
+ | |-- h2-1.3.173.jar
+ | `-- postgresql-9.1-901-1.jdbc4.jar
+ `-- logs (contient les logs de l'application)
+
+
+Mettre à jour le war de l'application
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Il faut être loggué sur une console avec l'utilisateur root.
+
+On suppose ici que tomcat a été installé dans le répertoire */opt/tomcat* .
+
+Pour utiliser une nouvelle version de l'application, c'est en 5 étapes :
+
+- Arrêter le serveur tomcat
+
+::
+
+ service tomcat stop
+
+- Supprimer les répertoires suivants :
+
+::
+
+ rm -rf /opt/tomcat/webapps/echobase
+ rm -rf /opt/tomcat/work/Catalina/localhost/echobase
+
+- Copier le nouveau war dans **/var/local/echobase/war**
+- Changer le lien symbolique **/var/local/echobase/echobase.war**
+
+::
+
+ unlink echobase.war
+ ln -s /var/local/echobasewar/echobase-full-${project.version}.war /var/local/echobase/echobase.war
+
+- Relancer le serveur tomcat
+
+::
+
+ service tomcat start
+
+Divers
+------
+
+Gestion des logs de l'application
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Avant de lancer l'application, il faut avoir positionner une variable
+**echobase.log.dir** de jvm qui définit le répertoire où positionner les logs
+de l'application.::
+
+ JAVA_OPTS="$JAVA_OPTS -Dechobase.log.dir=/var/local/echobase/data/logs"
+
+ou::
+
+ CATALINA_OPTS="$CATALINA_OPTS -Dechobase.log.dir=/var/local/echobase/data/logs"
+
+Première utilisation
+~~~~~~~~~~~~~~~~~~~~
+
+Deux utilisateurs sont créés si la base est vide (première utilisation)::
+
+ login / password : admin / admin
+ login / password : user / user
+
+Pour des raisons de sécurité, il est conseillé de modifier le mot de passe via
+l'interface de gestion des utilisateurs.
+
+.. _créer une base travail: ./db.html#creation-d-une-base-postgresql
+.. _echobase.properties: echobase.properties
+
1
0