r1451 - in topia-service/trunk: . src/site src/site/rst
Author: tchemit Date: 2009-05-11 08:35:52 +0000 (Mon, 11 May 2009) New Revision: 1451 Added: topia-service/trunk/src/site/rst/ topia-service/trunk/src/site/rst/History.rst topia-service/trunk/src/site/rst/Migration.rst topia-service/trunk/src/site/rst/Search.rst topia-service/trunk/src/site/rst/Security.rst topia-service/trunk/src/site/rst/index.rst topia-service/trunk/src/site/site.xml Removed: topia-service/trunk/src/site/site_fr.xml Modified: topia-service/trunk/changelog.txt topia-service/trunk/pom.xml Log: * bump versions (lutinproject, lutinutil, topia, maven-license-switcher-plugin) * use doxia-modules-jrst instead of maven-jrst-plugin * improve download section on site Modified: topia-service/trunk/changelog.txt =================================================================== --- topia-service/trunk/changelog.txt 2009-05-11 08:35:43 UTC (rev 1450) +++ topia-service/trunk/changelog.txt 2009-05-11 08:35:52 UTC (rev 1451) @@ -1,7 +1,15 @@ -1.2 chemit 20090220 +1.1.0 + * migrate to nuiton + +1.0.3 chemit 20090511 + * bump versions (lutinproject, lutinutil, topia, maven-license-switcher-plugin) + * use doxia-modules-jrst instead of maven-jrst-plugin + * improve download section on site + +1.0.2 chemit 20090220 * 20090220 [chemit] - use lutinproject 3.4 -1.1 chemit 20081215 +1.0.1 chemit 20081215 * 20081215 [chemit] - new release for isis-fish :) follow release of topia 1.0 chemit 20081210 Modified: topia-service/trunk/pom.xml =================================================================== --- topia-service/trunk/pom.xml 2009-05-11 08:35:43 UTC (rev 1450) +++ topia-service/trunk/pom.xml 2009-05-11 08:35:52 UTC (rev 1451) @@ -9,7 +9,7 @@ <parent> <groupId>org.codelutin</groupId> <artifactId>lutinproject</artifactId> - <version>3.4</version> + <version>3.5.4</version> </parent> <artifactId>topia-service</artifactId> @@ -80,9 +80,9 @@ <labs.project>topia</labs.project> <!-- libs versions --> - <topia.version>2.1.4</topia.version> + <topia.version>2.1.6</topia.version> <generator.version>0.64</generator.version> - <lutinutil.version>1.0.4</lutinutil.version> + <lutinutil.version>1.0.6</lutinutil.version> </properties> @@ -148,25 +148,22 @@ </execution> </executions> </plugin> - - <!-- Always process jrst files, but only called on pre-site phase --> - <plugin> - <groupId>org.codelutin</groupId> - <artifactId>maven-jrst-plugin</artifactId> - <version>0.8.4</version> - <configuration> - <defaultLocale>fr</defaultLocale> - </configuration> - <executions> - <execution> - <goals> - <goal>jrst</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>1.0.1</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </pluginManagement> </build> <!-- ************************************************************* --> @@ -211,7 +208,7 @@ <plugin> <groupId>org.codelutin</groupId> <artifactId>maven-license-switcher-plugin</artifactId> - <version>0.6</version> + <version>0.8</version> <executions> <execution> <id>attach-licenses</id> Copied: topia-service/trunk/src/site/rst/History.rst (from rev 1443, topia-service/trunk/src/site/fr/rst/History.rst) =================================================================== --- topia-service/trunk/src/site/rst/History.rst (rev 0) +++ topia-service/trunk/src/site/rst/History.rst 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,4 @@ +ToPIA Historique Service +======================== + +Permet de conserver l'ensemble des actions réalisées sur la base de données. \ No newline at end of file Property changes on: topia-service/trunk/src/site/rst/History.rst ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia-service/trunk/src/site/rst/Migration.rst (from rev 1443, topia-service/trunk/src/site/fr/rst/Migration.rst) =================================================================== --- topia-service/trunk/src/site/rst/Migration.rst (rev 0) +++ topia-service/trunk/src/site/rst/Migration.rst 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,205 @@ +ToPIA Migration Service +======================= + +ToPIA Migration Service est un module ToPIA chargé d'effectuer la migration +d'une base de données existante sans perte de données. + +Configuration +------------- +Ce service doit disposer de quelques proprietés de configuration pour effectuer +la migration d'une base de données. + +Ces propriétés sont fournies au service via un TopiaContext et font donc partie +de la configuration de l'application. + + +Configuration de la base de données +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + hibernate.dialect=org.hibernate.dialect.H2Dialect + hibernate.connection.username=sa + hibernate.connection.password= + hibernate.connection.driver_class=org.h2.Driver + + topia.persistence.directories=directory1,directory2 + topia.persistence.classes=classImpl1,classImpl2 + +Ces informations servent à créer une configuration hibernate (qui contient les +informations de connexion et les mappings de l'application). + +Les lignes commencant par "hibernate" sont spécifiques à hibernate et au type de +base de données utilisé. Les lignes suivantes sont spécifiques à ToPIA mais +contiennent les mappings indispensable pour créer le schéma de la base de +données après migration. + + +Configuration des anciens mappings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +La configuration doit contenir ces propriétés : + +:: + + topia.service.migration.mappingsdir=oldmappings + topia.service.migration.modelnames=model1,model2,model3 + +qui spécifie le répertoire de recherche des anciens mappings pour les différents +modèles. + +Ce dossier contient ensuite un sous-dossier par modèle comportant chacun un +sous-dossier par version par version (nommé X, *X* étant la version), avec pour +chaque dossier, l'ensemble des mappings hibernate de cette version. + +Exemple : + +:: + + oldmappings/ + model1/ + 1/ + Class1.hbm.xml + Class2.hbm.xml + Class3.hbm.xml + 2/ + Class1.hbm.xml + Class2New.hbm.xml + Class3.hbm.xml + 2.2/ + Class2.hbm.xml + Class3.hbm.xml + Class4New.hbm.xml + + +Configuration de la version +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +La configuration doit contenir une propriété : + +:: + + topia.service.migration.version=3.5.1 (exemple) + +Cette propriétés renseigne la version *courante* de l'application. + + +Configuration du callback +~~~~~~~~~~~~~~~~~~~~~~~~~ +Il est possible de définir une classe de type MigrationCallbackHandler, pour +interagir, par exemple, avec l'utilisateur et lui demander s'il faut migrer la +base de données. + +Ces *callback* doivent implémenter MigrationCallbackHandler et se trouver dans +la configuration: + +:: + + topia.service.migration.callbackhandlers=org.codelutin.test.SwingCallbackHandler + + +Configuration du service +~~~~~~~~~~~~~~~~~~~~~~~~ +Enfin pour utiliser le service, il faut l'activer. La configuration doit +contenir la propriétés suivante : + +:: + + topia.service.migration=org.codelutin.topia.security.TopiaSecurityServiceImpl + + +Utilisation +----------- +Ce module étant un service ToPIA, il doit être activé pour pouvoir s'exécuter. + +Il commence par se connecter au SGBD, vérifie si les versions diffèrent, et +effectue la migration si besoin. + +Dans le cas où la version ne peut pas être deterninée, il considère que le +schema en base est en version V0 (les mppings de cette version doivent être +fournit). Dans ce cas, il effectue en plus une détection des tables pour +savoir si le schéma existe deja. S'il n'existe pas, il ne tente donc pas +d'effetuer une migration. + +Classes de migration +~~~~~~~~~~~~~~~~~~~~ +Pour savoir comment migrer les données, le développeur utilisant le module de +migration doit produire des classes Java de migration (une par classe +nécéssitant une modification et par version). + +Ces classes doivent : + +- hériter de la classe ``AbstractMigration`` ou de l'interface ``Migration`` +- se trouver dans un sous package des classes d'implémentation référencées + par les mappings. Ce package doit se nommer VnVm où: + + - *n* est la version de départ de migration + - *m* la version d'arrivée + +- respecter une convention de nommage de la forme ``MigrationClass`` où: + + - *Class* est le nom de l'entité devant être migrée + + Exemple, pour migrer une *Personne* d'une version 2 à 2.1 le nom de la classe + sera : ``V2V2_1.MigratePersonne.java`` + + Note: les "." étant interdits dans le nom de fichier, ils sont remplacés par + le caractère "_". + +Ensuite, chaque classe doit : + +- implémenter au moins la méthode ``migrate(MapAdapter, MapHelper)`` + cette méthode prend une MapAdapter en paramètre, pour modifier un tuple et un + MapHelper pouvant servir à retrouver des informations sur le reste des tuples + de la base +- surcharger (si besoin) la méthode ``public ProxyClass migrateFrom()`` dans le + cas où les tuples à modifier proviennent d'une classe différente de la classe + courante. + +Exemple : + +Ici, la modification porte sur la transformation de l'attribut +``timestampNaissance`` de la classe ``domaine.Personne`` en une nouvelle table +``domaine.Naissance``, effectée dans le changement de la version 1 à la version +2 : + +:: + + // migrateFrom() + public ProxyClass migrateFrom() { + return new SimpleProxyClass("domaine.Personne"); + } + + // migrate(MapAdapter, MapHelper) + public void migrate(MapAdapter map, MapHelper helper) { + + // map d'entree vide, conversion du timestamp + // en jour, mois, annee + try { + Long timestamp = (Long) map.getOldValue("timestampNaissance"); + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(timestamp); + map.setValue("jour", c.get(Calendar.DAY_OF_MONTH)); + map.setValue("mois", c.get(Calendar.MONTH)); + map.setValue("annee", c.get(Calendar.YEAR)); + } catch (ExceptionAttributeUndefined e) { + e.printStackTrace(); + } + } + +Donc cette classe : + +- doit se nommer ``MigrateNaissance.java`` et se trouver dans le package + ``domaine.V1V2`` +- redéfinit la methode migrateFrom() pour indiquer que les donnees proviennent de + ``domaine.Personne`` +- implémente ``migrate()`` pour produire des tuples de type ``domaine.Naissance`` + à partir de tuples ``domaine.Personne`` + +Création de schéma +~~~~~~~~~~~~~~~~~~ +Dans le cas où l'application est ammenée à créer un schéma de base de données, +elle doit en informer le module de migration pour que celui-ci renseigne +la version du schéma créé. + +Le module s'enregistre automatiquement aupres de ToPIA pour savoir quand +celui-ci a créé un nouveau schéma. Il renseigne donc automatiquement la version +par la suite. \ No newline at end of file Property changes on: topia-service/trunk/src/site/rst/Migration.rst ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia-service/trunk/src/site/rst/Search.rst (from rev 1443, topia-service/trunk/src/site/fr/rst/Search.rst) =================================================================== --- topia-service/trunk/src/site/rst/Search.rst (rev 0) +++ topia-service/trunk/src/site/rst/Search.rst 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,5 @@ +ToPIA Recherche Service +======================= + +Permet de rechercher un mot clé parmis les entités de l'application. Il repose +sur la librairie lucene d'apache. \ No newline at end of file Property changes on: topia-service/trunk/src/site/rst/Search.rst ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia-service/trunk/src/site/rst/Security.rst (from rev 1443, topia-service/trunk/src/site/fr/rst/Security.rst) =================================================================== --- topia-service/trunk/src/site/rst/Security.rst (rev 0) +++ topia-service/trunk/src/site/rst/Security.rst 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,5 @@ +ToPIA Sécurité Service +====================== + +Permet la gestion des authentifications et des autorisations. Il repose sur le +mécanisme de JAAS. \ No newline at end of file Property changes on: topia-service/trunk/src/site/rst/Security.rst ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia-service/trunk/src/site/rst/index.rst (from rev 1443, topia-service/trunk/src/site/fr/rst/index.rst) =================================================================== --- topia-service/trunk/src/site/rst/index.rst (rev 0) +++ topia-service/trunk/src/site/rst/index.rst 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,24 @@ +ToPIA-service +============= + +.. contents:: + + +Présentation +------------ + +Le framework ToPIA peut être complèté par une multitude de services. Il existe +actuellement trois : + + - service pour la **sécurité** : permet la gestion des authentification et des + autorisations. Il repose sur le mécanisme de JAAS. + - service pour la gestion d'un **historique** : permet de conserver l'ensemble + des actions réalisées sur la base de données. + - service pour la **recherche** : permet de rechercher un mot clé parmis les + entités de l'application. Il repose sur la librairie lucene d'apache. + - service pour la **migration** : permet de rechercher un mot clé parmis les + entités de l'application. Il repose sur la librairie lucene d'apache. + +**Veuillez consulter le site +http://topia.labs.libre-entreprise.org/topia pour de plus amples détails +sur le framework ToPIA.** \ No newline at end of file Property changes on: topia-service/trunk/src/site/rst/index.rst ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia-service/trunk/src/site/site.xml (from rev 1443, topia-service/trunk/src/site/site_fr.xml) =================================================================== --- topia-service/trunk/src/site/site.xml (rev 0) +++ topia-service/trunk/src/site/site.xml 2009-05-11 08:35:52 UTC (rev 1451) @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <publishDate format="dd/MM/yyyy"/> + + <skin> + <groupId>org.codelutin</groupId> + <artifactId>maven-lutin-skin</artifactId> + <version>0.2.3</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + <!--src>http://buix.labs.libre-entreprise.org/lutinjaxx/jaxx.png</src--> + <href>index.html</href> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>${project.organization.url}</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" + img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="ToPIA" href="http://topia.labs.libre-entreprise.org/topia"/> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="${project.organization.name}" href="${project.organization.url}"/> + </links> + + <menu ref="parent"/> + + <menu name="Utilisateur"> + <item href="/index.html" name="Accueil"/> + <!--item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/org/codelutin/topia-ser..." + name="Téléchargement"/--> + </menu> + + <menu name="Téléchargement"> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}/${project.build.finalName}.jar" + name="Librairie (jar)"/> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar" + name="Javadoc (jar)"/> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar" + name="Sources (jar)"/> + </menu> + + <menu name="Developpeur"> + <item name="Historique" href="/History.html"/> + <item name="Sécurité" href="/Security.html"/> + <item name="Recherche" href="/Search.html"/> + <item name="Migration" href="/Migration.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project> Property changes on: topia-service/trunk/src/site/site.xml ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Deleted: topia-service/trunk/src/site/site_fr.xml =================================================================== --- topia-service/trunk/src/site/site_fr.xml 2009-05-11 08:35:43 UTC (rev 1450) +++ topia-service/trunk/src/site/site_fr.xml 2009-05-11 08:35:52 UTC (rev 1451) @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="${project.name}"> - - <publishDate format="dd/MM/yyyy"/> - - <skin> - <groupId>org.codelutin</groupId> - <artifactId>maven-lutin-skin</artifactId> - <version>0.2.3</version> - </skin> - - <bannerLeft> - <name>${project.name}</name> - <!--src>http://buix.labs.libre-entreprise.org/lutinjaxx/jaxx.png</src--> - <href>index.html</href> - </bannerLeft> - - <bannerRight> - <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> - <href>${project.organization.url}</href> - </bannerRight> - - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> - <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> - <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" - img="images/restructuredtext-logo.png"/> - </poweredBy> - - <body> - <links> - <item name="ToPIA" href="http://topia.labs.libre-entreprise.org/topia"/> - <item name="Labs" href="http://labs.libre-entreprise.org/"/> - <item name="${project.organization.name}" href="${project.organization.url}"/> - </links> - - <menu ref="parent"/> - - <menu name="Utilisateur"> - <item href="/index.html" name="Accueil"/> - <!--item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/org/codelutin/topia-ser..." - name="Téléchargement"/--> - </menu> - - <menu name="Téléchargement"> - <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}" - name="Télécharger la dernière version"/> - <item href="${labs.builder.url}/org/codelutin/${project.artifactId}" - name="Voir toutes les versions"/> - </menu> - - <menu name="Developpeur"> - <item name="Historique" href="/History.html"/> - <item name="Sécurité" href="/Security.html"/> - <item name="Recherche" href="/Search.html"/> - <item name="Migration" href="/Migration.html"/> - </menu> - - <menu ref="reports"/> - - </body> -</project>
participants (1)
-
tchemit@users.labs.libre-entreprise.org