Author: tchemit Date: 2010-01-14 20:47:26 +0100 (Thu, 14 Jan 2010) New Revision: 788 Added: trunk/maven-eugene-plugin/src/site/fr/rst/usage.rst trunk/maven-eugene-plugin/src/site/rst/usage.rst Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AvailableDataMojo.java trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/CopyVersionFiles.java trunk/maven-eugene-plugin/src/site/fr/rst/index.rst trunk/maven-eugene-plugin/src/site/rst/index.rst trunk/maven-eugene-plugin/src/site/site_en.xml trunk/maven-eugene-plugin/src/site/site_fr.xml Log: - add maven-eugene-plugin usage documentation - fix imports - improve availabe-data ouput Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AvailableDataMojo.java =================================================================== --- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AvailableDataMojo.java 2010-01-14 10:02:37 UTC (rev 787) +++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AvailableDataMojo.java 2010-01-14 19:47:26 UTC (rev 788) @@ -131,6 +131,7 @@ } for (AvailableData data : safeDataTypes) { + buffer.append("\n"); appendData(data, buffer); } Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/CopyVersionFiles.java =================================================================== --- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/CopyVersionFiles.java 2010-01-14 10:02:37 UTC (rev 787) +++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/CopyVersionFiles.java 2010-01-14 19:47:26 UTC (rev 788) @@ -22,9 +22,6 @@ import java.io.File; import java.io.FileFilter; -import java.io.IOException; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.dom4j.DocumentException; import org.dom4j.Node; import org.dom4j.io.SAXReader; Modified: trunk/maven-eugene-plugin/src/site/fr/rst/index.rst =================================================================== (Binary files differ) Added: trunk/maven-eugene-plugin/src/site/fr/rst/usage.rst =================================================================== --- trunk/maven-eugene-plugin/src/site/fr/rst/usage.rst (rev 0) +++ trunk/maven-eugene-plugin/src/site/fr/rst/usage.rst 2010-01-14 19:47:26 UTC (rev 788) @@ -0,0 +1,17 @@ +Usage +===== + + +:Authors: Tony Chemit +:Contact: chemit@codelutin.com +:Revision: $Revision: 649 $ +:Date: $Date: 2009-10-21 14:21:03 +0200 (Wed, 21 Oct 2009) $ + + +.. contents:: + + +smart-generate +-------------- + +*TODO translate me in french from the english version* Modified: trunk/maven-eugene-plugin/src/site/rst/index.rst =================================================================== (Binary files differ) Added: trunk/maven-eugene-plugin/src/site/rst/usage.rst =================================================================== --- trunk/maven-eugene-plugin/src/site/rst/usage.rst (rev 0) +++ trunk/maven-eugene-plugin/src/site/rst/usage.rst 2010-01-14 19:47:26 UTC (rev 788) @@ -0,0 +1,318 @@ +Usage +===== + + +:Authors: Tony Chemit +:Contact: chemit@codelutin.com +:Revision: $Revision: 649 $ +:Date: $Date: 2009-10-21 14:21:03 +0200 (Wed, 21 Oct 2009) $ + + +.. contents:: + +This page describes the usage of the goals of the eugene plugin. + +smart-generate +-------------- + +This goal permits to launch a smart (understood as intelligent) generation, chaining different generation phases. + +Following the maven spirit of using convention (and then default configuration) you should always try to respect the +plugin convention to avoid big headaches... + +modelType +********* + +An invariant of the goal is the type of model to treate given by the configuration property *modelType*. + +actually there is two types of model : + +- objectmodel +- statemodel + +inputs +****** + +To define what to generate, you must fill the *inputs* configuration. + +Each inputs entry is bind to a phase of generation (see next section to learn more about phases). + +an input entry is defined by : + +- a phase (zargo, xmi or model) +- a input directory +- an include pattern + +Example: + +:: + + <execution> + <configuration> + <inputs>zargo</inputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +If you wants to use more than one entry, you can also write : + + +:: + + <execution> + <configuration> + <inputs> + <input>zargo</input> + <input>xmi</input> + </inputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +An input can have three forms : + +- <input>XXX</input> : use the XXX phase with his default configuration +- <input>dir:includes</input> : use the given directory with the given phase and detects from the includes pattern the phase to use +- <input>XXX:dir:includes</input> : use the XXX phase with the given directory and includes pattern + +Example: + +:: + + <execution> + <configuration> + <inputs>zargo</inputs> + <inputs>src/main/myzargo:**/*.zargo</inputs> + <inputs>zargo:src/main/myzargo2:**/*.zargo2</inputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + + +phases +****** + +A phase (also called a writer) aims to generate something with possibility to fire a *next* chained phase. + +At the moment we have defined several phases of generation : + +- zargo +- xmi +- model + +Each phase has an input protocol and an output protocol, says : + +:: + + zargo --> xmi + xmi --> model + model --> no output protocol (at the moment) + +So if you gives and zargo phase, the plugin will try to chain zargo --> xmi --> model. + +It is possible to skip some phase using the *skipInputs* configuration property. + +Example: + +:: + + <execution> + <configuration> + <inputs>zargo</inputs> + <skipInputs>model</skipInputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +will launch phases zargo then xmi but not the model phase. + +Finally, there is some specific properties that can be filled for each phase. + +zargo phase +~~~~~~~~~~~ + +This phase permits to take some zargo files to extract form them the xmi files. + +Example: + +:: + + <execution> + <configuration> + <inputs>zargo</inputs> + <skipInputs>xmi,model</skipInputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +will detects all zargo files (using the default configuration for zargo phase) and extract xmi files. + +The default configuration for the zargo phase is : + +- input directory : src/main/xmi +- include files : **/*.zargo +- output directory : target/generated-sources/xmi + +This phase has no specific configuration properties. + +xmi phase +~~~~~~~~~ + +This phase permits to take some xmi files to build some objectmoldel (or staemodel) files. + +Example: + +:: + + <execution> + <configuration> + <inputs>xmi</inputs> + <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver> + <skipInputs>model</skipInputs> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +will detects all xmi files (using the default configuration for xmi phase) and create model files. + +The default configuration for the xmi phase is : + +- input directory : src/main/xmi +- include files : **/*.xmi +- output directory : target/generated-sources/modles + +This phase defines some specific configuration properties : + +- *fullPackagePath* +- *resolver* + +model phase +~~~~~~~~~~~ + +This phase permits to take some model files to generate some files (java and others) using the given templates + +Example: + +:: + + <execution> + <configuration> + <inputs>model:target/generated-sources/models:observe.objectmodel</inputs> + <templates> + org.nuiton.topia.generator.TopiaMetaTransformer, + org.nuiton.topia.generator.InterfaceTransformer + </templates> + </configuration> + <goals> + <goal>smart-generate</goal> + </goals> + </execution> + +The default configuration for the model phase is : + +- input directory : src/main/models +- include files : **/*.objectmodel +- output directory : target/generated-sources/java + + +This phase defines some specific configuration properties : + +- *defaultPackage* +- *templates* +- *excludeTemplates* +- *generatedPackages* + +available-data +-------------- + +This goals help users to determine all type of data that can be used with your current configuration of plugin. + +The goal can only be used by direct invocation in console and not in your pom as his purpose is only to display some +stuff in your console. + +Just type + +:: + + mvn eugene:available-data + +to obtain all datas available. + +Example: + +:: + + [INFO] [eugene:available-data {execution: default-cli}] + [INFO] Get datas for data types : [modeltype, writer, modelreader, modeltemplate] + Found 2 modeltypes : + [statemodel] with implementation 'org.nuiton.eugene.models.state.xml.StateModelImpl' + [objectmodel] with implementation 'org.nuiton.eugene.models.object.xml.ObjectModelImpl' + Found 3 writers : + [xmi] with implementation 'org.nuiton.eugene.plugin.writer.XmiChainedFileWriter + inputProtocol : xmi + outputProtocol : model + defaultIncludes : **/*.xmi + defaultInputDirectory : src/main/xmi + defaultTestInputDirectory : src/test/xmi' + [model2Java] with implementation 'org.nuiton.eugene.plugin.writer.ModelChainedFileWriter + inputProtocol : model + outputProtocol : null + defaultIncludes : **/*.*model + defaultInputDirectory : src/main/models + defaultTestInputDirectory : src/test/models' + [zargo2xmi] with implementation 'org.nuiton.eugene.plugin.writer.ZargoChainedFileWriter + inputProtocol : zargo + outputProtocol : xmi + defaultIncludes : **/*.zargo + defaultInputDirectory : src/main/xmi + defaultTestInputDirectory : src/test/xmi' + Found 2 modelreaders : + [statemodel] with implementation 'org.nuiton.eugene.models.state.StateModelReader' + [objectmodel] with implementation 'org.nuiton.eugene.models.object.ObjectModelReader' + Found one modeltemplate : + [org.nuiton.eugene.java.JavaGenerator] with implementation 'org.nuiton.eugene.java.JavaGenerator' + +copyVersionFiles +---------------- + +This goals permits to keep hibernate mappings for each version of model version. + +zargo2xmi +--------- + +'Stupid' generation from zargo to xmi files with no chained stuff. + +Prefer use now the *smart-generate* goal. + +xmi2objectmodel +--------------- + +'Stupid' generation from xmi files to object model files with no chained stuff. + +Prefer use now the *smart-generate* goal. + +xmi2statemodel +-------------- + +'Stupid' generation from xmi files to state model files with no chained stuff. + +Prefer use now the *smart-generate* goal. + +generate +-------- + +'Stupid' generation from model files to java and other files with no chained stuff. + +Prefer use now the *smart-generate* goal. Modified: trunk/maven-eugene-plugin/src/site/site_en.xml =================================================================== --- trunk/maven-eugene-plugin/src/site/site_en.xml 2010-01-14 10:02:37 UTC (rev 787) +++ trunk/maven-eugene-plugin/src/site/site_en.xml 2010-01-14 19:47:26 UTC (rev 788) @@ -20,6 +20,7 @@ <menu name="User"> <item href="index.html" name="Index"/> + <item href="usage.html" name="Usage"/> <item name="Goals" href="plugin-info.html"> <item name="smart-generate" href="smart-generate-mojo.html"/> <item name="available-data" href="available-data-mojo.html"/> Modified: trunk/maven-eugene-plugin/src/site/site_fr.xml =================================================================== --- trunk/maven-eugene-plugin/src/site/site_fr.xml 2010-01-14 10:02:37 UTC (rev 787) +++ trunk/maven-eugene-plugin/src/site/site_fr.xml 2010-01-14 19:47:26 UTC (rev 788) @@ -20,6 +20,7 @@ <menu name="Utilisateur"> <item href="index.html" name="Accueil"/> + <item href="usage.html" name="Utilisation"/> <item name="Goals" href="plugin-info.html"> <item name="smart-generate" href="smart-generate-mojo.html"/> <item name="available-data" href="available-data-mojo.html"/>