r144 - in trunk: . echobase-tools echobase-tools/src echobase-tools/src/main echobase-tools/src/main/java echobase-tools/src/main/java/fr echobase-tools/src/main/java/fr/ifremer echobase-tools/src/main/java/fr/ifremer/echobase echobase-tools/src/main/java/fr/ifremer/echobase/tools echobase-tools/src/site echobase-tools/src/site/rst echobase-tools/src/test echobase-tools/src/test/java echobase-tools/src/test/java/fr echobase-tools/src/test/java/fr/ifremer echobase-tools/src/test/java/fr/if
Author: tchemit Date: 2011-12-05 09:27:59 +0100 (Mon, 05 Dec 2011) New Revision: 144 Url: http://forge.codelutin.com/repositories/revision/echobase/144 Log: introduce tools module to do the legacy import Added: trunk/echobase-tools/ trunk/echobase-tools/LICENSE.txt trunk/echobase-tools/README.txt trunk/echobase-tools/changelog.txt trunk/echobase-tools/pom.xml trunk/echobase-tools/src/ trunk/echobase-tools/src/main/ trunk/echobase-tools/src/main/java/ trunk/echobase-tools/src/main/java/fr/ trunk/echobase-tools/src/main/java/fr/ifremer/ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ReferenceCsvGenerator.java trunk/echobase-tools/src/main/resources/ trunk/echobase-tools/src/site/ trunk/echobase-tools/src/site/rst/ trunk/echobase-tools/src/site/rst/index.rst trunk/echobase-tools/src/site/site_fr.xml trunk/echobase-tools/src/test/ trunk/echobase-tools/src/test/java/ trunk/echobase-tools/src/test/java/fr/ trunk/echobase-tools/src/test/java/fr/ifremer/ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/ trunk/echobase-tools/src/test/java/fr/ifremer/echobase/tools/ trunk/echobase-tools/src/test/resources/ Property changes on: trunk/echobase-tools ___________________________________________________________________ Added: svn:ignore + target *.ipr *.iws *.iml *.log Property changes on: trunk/echobase-tools/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: trunk/echobase-tools/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: trunk/echobase-tools/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-tools/pom.xml =================================================================== --- trunk/echobase-tools/pom.xml (rev 0) +++ trunk/echobase-tools/pom.xml 2011-12-05 08:27:59 UTC (rev 144) @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>fr.ifremer</groupId> + <artifactId>echobase</artifactId> + <version>0.2-SNAPSHOT</version> + </parent> + + <groupId>fr.ifremer.echobase</groupId> + <artifactId>echobase-tools</artifactId> + + <name>EchoBase :: Tools</name> + <description>EchoBase tools module</description> + + <dependencies> + + <!-- sibling dependencies --> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>echobase-entities</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>echobase-services</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>fr.ird</groupId> + <artifactId>msaccess-importer</artifactId> + </dependency> + + <!-- database dependencies --> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- commons dependencies --> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + <!-- logging dependencies --> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jcl</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- transitive dependencies --> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.topia</groupId> + <artifactId>topia-persistence</artifactId> + </dependency> + + <!-- test dependencies --> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + +</project> Property changes on: trunk/echobase-tools/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ReferenceCsvGenerator.java =================================================================== --- trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ReferenceCsvGenerator.java (rev 0) +++ trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ReferenceCsvGenerator.java 2011-12-05 08:27:59 UTC (rev 144) @@ -0,0 +1,180 @@ +/* + * #%L + * EchoBase :: Tools + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.tools; + +import com.google.common.base.Preconditions; +import com.healthmarketscience.jackcess.Database; +import fr.ifremer.echobase.services.EchoBaseServiceContext; + +import java.io.File; +import java.io.IOException; + +/** + * To generate the sql references from a ms-access db. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.2 + */ +public class ReferenceCsvGenerator { + + /* +BIOMETRIE_ECHELLE : [Code_Param_Biometrie_Echelle, Code_echelle, Descriptif, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 44 entries. +BIOMETRIE_PARAMETRE : [Code_Param_Biometrie, Label, Libelle_Param_Biometrie, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 110 entries. +BIOMETRIE_VALEUR : [CODE_PARAM_VALEUR_BIOMETRIE, GENRE_ESP_VALEUR_BIOMETRIE, Gen_OBSERVATIONS, NOSTA_VALEUR_BIOMETRIE, NUMIND_VALEUR_BIOMETRIE, OBSERVATIONS, VALEUR_BIOMETRIE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 251793 entries. +BIOMRES : [Biomasse_NB(Milliers), Biomasse_W(tonnes), CAMPAGNE, CATEGORIE, DHTU_ESDU, ESDU, Energie_esp(sA), GENRE_ESP, ID_EI_ESDU, LAT, LIBELLE_DEVIATION, Long, Numéro, Poids_moy, PrAcoust, STATION, Taille_Moy, Type_AFFECT] with 58044 entries. +BIOMRES_AGE : [AGE, ESDUID, GENR_ESP, LAT, LONG, N, NTOT, Numéro, TC] with 9965 entries. +BIOMRES_REGIONS : [AREA, CAMPAGNE, CodEsp, DEV, GENR_ESP, ID, Nhauls, Numéro, Region, biom, bioms, mXe, mXes, sA, wbiom, wbioms, wmXe, wmXes] with 146 entries. +CAMPAGNES : [CAMPAGNE, CHEF_MISSION, COMMENTAIRE, DATE_ARRIVEE, DATE_DEPART, Gen_COMMENTAIRE, Gen_ROSCOP, LETTRE_AN, LIMITE_EST, LIMITE_NORD, LIMITE_OUEST, LIMITE_SUD, NAVIRE, NOM_CAMPAGNE, PORT_ARRIVEE, PORT_DEPART, ROSCOP, TYPE_CAMPAGNE, ZONE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 42 entries. +CAPTURES : [CATEG, GENRE_ESP, LMOY, MOULE_MENS, NOSTA, NTOT, PESP_MENS, PESP_METRIE, PMOY, PT_ESP, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 9505 entries. +CAPTURES_old : [CATEG, GENRE_ESP, LMOY, MOULE_MENS, NOSTA, NTOT, PESP_MENS, PESP_METRIE, PMOY, PT_ESP, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 7499 entries. +CATEGORIE : [Code_Categorie, Libelle_Categorie, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 10 entries. +CLE_TAILLE_AGE : [AGE, CAMPAGNE, GENRE_ESP, Origine_Data, POURCENTAGE, TAILLE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 1637 entries. +COEFFICIENT_ACOUSTIQUE : [BAC, CAC, Genre_esp, Id_sondeur, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 422 entries. +EIT_DESCRIPT_ECHOS : [ID_DESCRIPTION_DEVIATION, IMAGES, LIBELLE_DESCRIPTION_DEVIATION, TYPE_DEVIATION, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 61 entries. +EIT_DESCRIPT_TRANCHE : [HMAX_TRANCHE, HMIN_TRANCHE, ID_TRANCHE, LIBELLE_TRANCHE, SEUIL_MAX, SEUIL_MIN, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 251 entries. +EIT_ENERGIES_TRANCHES : [DHTU_DEVIATION, ENERGIE, ID_EI_ESDU, ID_TRANCHE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 355238 entries. +EIT_FORMULES_ECHOS : [COEFFICIENT, DTHU_DEVIATION, ID_EI_DEVIATION, ID_TRANCHE, LIBELLE_DEVIATION, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 0 entries. +EIT_VALEUR_ECHOS : [DHTU_DEVIATION, ENERGIE, FORMULE_DEVIATION, ID_DESCRIPTION_DEVIATION, ID_EI_DEVIATION, LIBELLE_DEVIATION, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 170231 entries. +EI_CONFIGURATION : [CAMPAGNE, COMMENTAIRE, CSTSONDEUR, Coeff_conversion_SA, DEVPOISSONFORMULE, DURÉEIMPULSION, ENERG_UNIT_SOURCE, Gen_COMMENTAIRE, ID_EI, ID_REFSONDEUR, LOITVG, PUISSANCE, QUALIF_EI, SEUILEIT, SEUILNUM, SL_VR, SL_VR_MAX, SV_GAIN, TS_GAIN, TYPE_EI, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 29 entries. +EI_ESU : [CODE_IMAGE, DEVPOISSON, DHTU_ESDU, ESDU, ESUCUT, ESUTYPE, Energie_Total_Banc, Energy_Hors_Banc, FLAG, ID_EI_ESDU, LATDMC, LGDMC, Nb_Ecant_Total, Nb_Echant_Hors_Banc, Nb_Echant_Integre, R, Reverb_Total, SEI, SONDE, TOTAL, Troncon, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 34524 entries. +EI_SONDEUR : [10LOGPSI, ALONGSHIP, ALPHA, ATHWARTSHIP, BILLE, CHAMP_PROCHE, FREQ, FREQUENCE, IDENT_SONDEUR, ID_REFSONDEUR, NAVIRE, PUISSANCE_MAX, SONDEUR, TRANSDUCTEUR, TS_BILLE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 20 entries. +ESPECE_ECHOS : [CODE_DESCRIPTION_DEVIATION, GENRE_ESP, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 198 entries. +Feuille1$_ImportErrors : [Champ, Erreur, Ligne] with 57100 entries. +LIEN_ECHO_ESU_STATION : [AC_EI_LIEN_ESDU, DTHU_LIEN_ESDU, ID_STATION, LIBELLE_ECHO, TYPE_AFFECTATION, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 167170 entries. +LIEN_STRATE_ESU : [AC_EI_LIEN_ESDU, DTHU_LIEN_ESDU, ID_STRATE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 2604 entries. +LISTE_NAVIRE : [Nom_navire, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 4 entries. +LISTE_TYPE_CAMPAGNE : [Code_type_campagne, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 13 entries. +MENSURATIONS : [CATEG, GENRE_ESP, NBIND, NOSTA, POIDSTAILLE, TAILLE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 50507 entries. +POST_STRATE : [ID_STRATE, LIBELLE_STRATE, SURFACE, TYPE_AFFECTATION, Type_Image, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 127 entries. +REFERENCE_ESPECE : [CODE_SIH, GENRE_ESP, NIVEAU_ESPECE_ECHO, NODC, NOM_ESP, NOM_SCIENTIFIQUE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 217 entries. +SCENARIO : [COMMENTAIRE_SCENARIO, DHTU_SCENARIO, ID_EI_SCENARIO, LIBELLE_ECHO_SCENARIO, NOSTA_SCENARIO, NOSTA_VALIDATION, POST_STRATE_SCENARIO, Type_Image, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 126113 entries. +STATIONS : [CAMPAGNE, COMMENTAIRE, DHTUDEB, DHTUFIN, ENGIN, ESDU_REF, ETAT, JOUR_NUIT, LATDD, LATDEB, LATFIN, LFUNES, LGDD, LGDEB, LGFIN, NOCHA, NOSTA, POIDS_TOTAL_PRELEVEMENT, SONDE, SONDEDEB, SONDEFIN, STA_IMAGES, VMAX, VMIN, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 1560 entries. +TAILLE_POIDS : [Campagne, Categorie, Coeff_A_RTP, Commentaire, Exposant_N_RTP, Genre_esp, Origine_DATA, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 220 entries. +TYPE_AFFECTATION : [Code_affectation, Libelle_affectation, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 3 entries. +TYPE_IMAGE : [Libelle_image, Type_Image, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 5 entries. +T_Query_User : [ClefPere, Clef_User, Creer, Description, Dist, GB, Gen_Description, Gen_Requete, Ident, Modif, Numordre, Requete, Status, Titre, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 8 entries. +Table des erreurs : [NOM_CAMPAGNE] with 2 entries. +ZONE : [CODE_ZONE, s_ColLineage, s_GUID, s_Generation, s_Lineage] with 5 entries. +*/ + protected final File msAccessFile; + + protected final File exportDirectory; + + protected final EchoBaseServiceContext serviceContext; + + protected Database msAccessDb; + + public ReferenceCsvGenerator(File msAccessFile, + File exportDirectory, + EchoBaseServiceContext serviceContext) { + Preconditions.checkNotNull(serviceContext, "serviceContext parameter can not be null"); + Preconditions.checkNotNull(msAccessFile, "msAccessFile parameter can not be null"); + Preconditions.checkNotNull(exportDirectory, "exportDirectory parameter can not be null"); + Preconditions.checkArgument(msAccessFile.exists(), + "file " + msAccessFile + " does not exist."); + this.msAccessFile = msAccessFile; + this.exportDirectory = exportDirectory; + this.serviceContext = serviceContext; + } + + public void doExport() { + + } + + public void exportSpecies() { + //TODO + } + public void exportCalibration() { + //TODO + } + + public void exportAcousticInstrument() { + //TODO + } + + public void exportTSParameters() { + // require species and acousticInstrument + } + + public void exportVesselType() { + + } + + public void exportVessel() { + // require vesselType + } + + public void exportMission() { + // require vesselType + } + + public void exportDepthStratumType() { + + } + + public void exportDepthStratum() { + // require depthStratumType + } + + public void exportEchotypeCategory() { + + } + + public void exportEchotype() { + // require depthStratum and echotypeCategory + } + + public void exportAreaOfOperation() { + + } + + public void exportReferenceDatumType() { + + } + + public void exportReferenceDatum() { + // require referenceDatumType + + } + + public void exportDataType() { + + } + + public void exportCellMethod() { + + } + + public void exportDataMetadata() { + // require referenceDatum, dataType and cellMethod + } + + protected Database getMsAccessDb() throws IOException { + if (msAccessDb == null) { + msAccessDb = Database.open(msAccessFile); + } + return msAccessDb; + } +} + Property changes on: trunk/echobase-tools/src/main/java/fr/ifremer/echobase/tools/ReferenceCsvGenerator.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-tools/src/site/rst/index.rst =================================================================== --- trunk/echobase-tools/src/site/rst/index.rst (rev 0) +++ trunk/echobase-tools/src/site/rst/index.rst 2011-12-05 08:27:59 UTC (rev 144) @@ -0,0 +1,27 @@ +.. - +.. * #%L +.. * EchoBase :: Tools +.. * +.. * $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 dbbatch +================ + +Ce module définit les outils pour générer le script des données de la base initiale. Property changes on: trunk/echobase-tools/src/site/rst/index.rst ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-tools/src/site/site_fr.xml =================================================================== --- trunk/echobase-tools/src/site/site_fr.xml (rev 0) +++ trunk/echobase-tools/src/site/site_fr.xml 2011-12-05 08:27:59 UTC (rev 144) @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + EchoBase :: Tools + + $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% + --> + + +<project name="${project.name}"> + + <body> + + <menu ref="parent"/> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu name="Utilisateur"> + <item name="Accueil" href="index.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project> Property changes on: trunk/echobase-tools/src/site/site_fr.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
tchemit@users.forge.codelutin.com