Processor-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
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
March 2017
- 1 participants
- 21 discussions
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.3 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at e74e72b (tag)
tagging 4743029853d3061dffe5f7e75f8d9a8be9107a12 (commit)
tagged by Tony Chemit
on Fri Nov 16 16:30:20 2012 +0000
- Log -----------------------------------------------------------------
fix mojo goal name
-----------------------------------------------------------------------
No new revisions were added by this update.
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
0
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.2.2 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at c16dc2b (tag)
tagging 7db373bd7ccf09a1080fb2f2fba9693f97688270 (commit)
tagged by Maven Release Manager
on Mon Aug 29 13:18:19 2011 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.2.2
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 7db373b [maven-release-plugin] copy for tag processor-1.2.2
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 7db373bd7ccf09a1080fb2f2fba9693f97688270
Author: Maven Release Manager <???>
Date: Mon Aug 29 13:18:19 2011 +0000
[maven-release-plugin] copy for tag processor-1.2.2
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.2.1 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at c93f50d (tag)
tagging 0d130032192a8e8ec488ca512e04b55b694322f7 (commit)
tagged by Tony Chemit
on Thu Feb 3 15:10:49 2011 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.2.1
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 0d13003 [maven-release-plugin] copy for tag processor-1.2.1
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 0d130032192a8e8ec488ca512e04b55b694322f7
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Thu Feb 3 15:10:49 2011 +0000
[maven-release-plugin] copy for tag processor-1.2.1
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.2 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at f343dab (tag)
tagging 0cf7890f6ab9771af29c5f17053bbd8992a7f909 (commit)
tagged by Tony Chemit
on Thu Feb 3 10:58:23 2011 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.2
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 0cf7890 [maven-release-plugin] copy for tag processor-1.2
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 0cf7890f6ab9771af29c5f17053bbd8992a7f909
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Thu Feb 3 10:58:23 2011 +0000
[maven-release-plugin] copy for tag processor-1.2
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.1 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at 9c8d150 (tag)
tagging c58529f0edbc0d291a2407c24ea211500f4e51be (commit)
tagged by Tony Chemit
on Fri Jan 21 10:30:52 2011 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.1
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new c58529f [maven-release-plugin] copy for tag processor-1.1
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit c58529f0edbc0d291a2407c24ea211500f4e51be
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Fri Jan 21 10:30:52 2011 +0000
[maven-release-plugin] copy for tag processor-1.1
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.0.4 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at ee22389 (tag)
tagging 1b338a9dedb60a9af849f0a4dc7f6d4e706319fb (commit)
tagged by Tony Chemit
on Thu Nov 11 17:08:45 2010 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.0.4
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 1b338a9 [maven-release-plugin] copy for tag processor-1.0.4
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 1b338a9dedb60a9af849f0a4dc7f6d4e706319fb
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Thu Nov 11 17:08:45 2010 +0000
[maven-release-plugin] copy for tag processor-1.0.4
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.0.3 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at b450377 (tag)
tagging 499962fef06b51ecaaaa3ccdbe46c84c8e3099d2 (commit)
tagged by Tony Chemit
on Tue Mar 9 18:24:19 2010 +0000
- Log -----------------------------------------------------------------
[maven-release-plugin] copy for tag processor-1.0.3
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 499962f [maven-release-plugin] copy for tag processor-1.0.3
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 499962fef06b51ecaaaa3ccdbe46c84c8e3099d2
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Tue Mar 9 18:24:19 2010 +0000
[maven-release-plugin] copy for tag processor-1.0.3
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.0.2 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at 7a6a3c9 (tag)
tagging a1f7a99c91b1aa209164c7f1b7dcb2a15e741a71 (commit)
tagged by Florian Desbois
on Mon Dec 7 16:43:20 2009 +0000
- Log -----------------------------------------------------------------
[maven-scm] copy for tag processor-1.0.2
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new a1f7a99 [maven-scm] copy for tag processor-1.0.2
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit a1f7a99c91b1aa209164c7f1b7dcb2a15e741a71
Author: Florian Desbois <???>
Date: Mon Dec 7 16:43:20 2009 +0000
[maven-scm] copy for tag processor-1.0.2
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New change to annotated tag v1.0.1 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
at 1c6662d (tag)
tagging 43a477399e9a095bdaaac13756a7ba9e21cf3e55 (commit)
tagged by Tony Chemit
on Sat Oct 10 14:07:57 2009 +0000
- Log -----------------------------------------------------------------
[maven-scm] copy for tag processor-1.0.1
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 43a4773 [maven-scm] copy for tag processor-1.0.1
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Detailed log of new commits:
commit 43a477399e9a095bdaaac13756a7ba9e21cf3e55
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Sat Oct 10 14:07:57 2009 +0000
[maven-scm] copy for tag processor-1.0.1
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
1
This is an automated email from the git hooks/post-receive script.
New commit to annotated tag v1.0.0 in repository processor.
See https://gitlab.nuiton.org/nuiton/processor.git
commit 8943f20c519c4f76258740ffca93e59d0a75dc1d
Author: Tony Chemit <chemit(a)codelutin.com>
Date: Sat Aug 22 23:01:20 2009 +0000
[maven-scm] copy for tag processor-1.0.0
---
LICENSE.txt | 166 +++++++++++++
README.txt | 2 +
changelog.txt | 55 +++++
maven-processor-plugin/LICENSE.txt | 166 +++++++++++++
maven-processor-plugin/README.txt | 2 +
maven-processor-plugin/changelog.txt | 1 +
maven-processor-plugin/pom.xml | 125 ++++++++++
.../nuiton/processor/ant/I18nExtractorTask.java | 154 ++++++++++++
.../org/nuiton/processor/ant/ProcessorTask.java | 242 ++++++++++++++++++
.../nuiton/processor/plugin/ProcessorPlugin.java | 274 +++++++++++++++++++++
maven-processor-plugin/src/site/apt/index.apt | 51 ++++
maven-processor-plugin/src/site/site.xml | 40 +++
nuiton-processor/LICENSE.txt | 166 +++++++++++++
nuiton-processor/README.txt | 2 +
nuiton-processor/changelog.txt | 1 +
nuiton-processor/pom.xml | 76 ++++++
.../processor/GeneratorTemplatesProcessor.java | 59 +++++
.../java/org/nuiton/processor/I18nExtractor.java | 120 +++++++++
.../org/nuiton/processor/LicenseProcessor.java | 44 ++++
.../java/org/nuiton/processor/LogsProcessor.java | 87 +++++++
.../nuiton/processor/OptimisationProcessor.java | 57 +++++
.../main/java/org/nuiton/processor/Processor.java | 97 ++++++++
.../java/org/nuiton/processor/ProcessorReader.java | 101 ++++++++
.../java/org/nuiton/processor/ProcessorUtil.java | 69 ++++++
.../java/org/nuiton/processor/ProcessorWriter.java | 64 +++++
.../processor/filters/ActiveLogsCodeFilter.java | 64 +++++
.../nuiton/processor/filters/DefaultFilter.java | 140 +++++++++++
.../java/org/nuiton/processor/filters/Filter.java | 41 +++
.../filters/GeneratorTemplatesFilter.java | 139 +++++++++++
.../filters/GeneratorTemplatesFilterIn.java | 100 ++++++++
.../org/nuiton/processor/filters/I18nFilter.java | 142 +++++++++++
.../nuiton/processor/filters/LicenseFilter.java | 71 ++++++
.../org/nuiton/processor/filters/LogsFilter.java | 48 ++++
.../nuiton/processor/filters/NoActionFilter.java | 50 ++++
.../processor/filters/OptimisationFilter.java | 69 ++++++
.../processor/filters/RemoveLogsCodeFilter.java | 59 +++++
nuiton-processor/src/site/apt/Todo.apt | 14 ++
nuiton-processor/src/site/apt/index.apt | 185 ++++++++++++++
nuiton-processor/src/site/site.xml | 41 +++
pom.xml | 122 +++++++++
src/site/site.xml | 36 +++
41 files changed, 3542 insertions(+)
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..3f7b8b1
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..d2e50d3
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..ead72e4
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,55 @@
+1.0.0 tchemit 20090822
+
+ * initial nuiton release
+ * multi-module of org.codelutin:lutinprocessor and
+ org.codelutin:maven-processor-plugin.
+
+----------------------------------------------------------------------------
+from maven-processor-plugin
+
+ver-0-18 chemit (20090511)
+ * bump versions (lutinproject, lutinprocessor, maven-license-switcher-plugin)
+ * improve download section on site
+ * update site
+
+ver-0-17 chemit (20090218)
+ * Parent is org.codelutin:lutinproject:3.4
+ * use same version as maven-processor-plugin
+
+ver-0-16 thimel 20080925
+ * Using lutinpluginutil from this plugin dependencies directly
+
+ver-0-15 thimel 20080922
+ * Added changelog
+ * plugin is now a lutinpluginproject 3.0
+ * groupId is org.codelutin
+ * compatible with maven2 standard structure
+
+
+----------------------------------------------------------------------------
+from lutinprocessor
+
+ver-0-18 chemit (20090218)
+ * bump lutinproject to 3.5.4, maven-license-switcher-plugin to 0.8
+ * use pluginManagment for plugins configuration
+ * use doxia-modules-jrst instead of maven-jrst-plugin
+ * fix issues in assembly descriptor and attach the plugin execution in release profile
+
+ver-0-17 chemit (20090218)
+ * Parent is org.codelutin:lutinproject:3.4
+ * use same version as maven-processor-plugin
+
+ver-0-15 thimel (20080922)
+ * Parent is org.codelutin:lutinproject:3.0
+
+ver-0-14 chemit (2008????)
+ * utilisation super-pom org.codelutin:lutinproject:2.4 (reusingage de directory layout)
+ * passage en licence lgpl v3
+
+ver-0-? poussin (2005????)
+
+ * modification pour que le processor fonctionne avec des StringReader
+
+ver-0-1 poussin (20040405)
+
+ * Utilisation de maven pour la gestion du projet
diff --git a/maven-processor-plugin/LICENSE.txt b/maven-processor-plugin/LICENSE.txt
new file mode 100644
index 0000000..3f7b8b1
--- /dev/null
+++ b/maven-processor-plugin/LICENSE.txt
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/maven-processor-plugin/README.txt b/maven-processor-plugin/README.txt
new file mode 100644
index 0000000..d2e50d3
--- /dev/null
+++ b/maven-processor-plugin/README.txt
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
diff --git a/maven-processor-plugin/changelog.txt b/maven-processor-plugin/changelog.txt
new file mode 100644
index 0000000..21fae5f
--- /dev/null
+++ b/maven-processor-plugin/changelog.txt
@@ -0,0 +1 @@
+No more used, we will soon make optional multi-module childs changelog.txt (mavenpom>1.0.0)
\ No newline at end of file
diff --git a/maven-processor-plugin/pom.xml b/maven-processor-plugin/pom.xml
new file mode 100644
index 0000000..68985af
--- /dev/null
+++ b/maven-processor-plugin/pom.xml
@@ -0,0 +1,125 @@
+<?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>org.nuiton</groupId>
+ <artifactId>processor</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <groupId>org.nuiton.processor</groupId>
+ <artifactId>maven-processor-plugin</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nuiton-processor</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ </dependency>
+
+ <!-- FIXME si on ne le rajoute pas, on se retrouve avec la version 1.1 qui ne convient pas -->
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+
+ <!-- tests dependencies -->
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>nuiton-processor - maven plugin</name>
+ <inceptionYear>2006</inceptionYear>
+
+ <!--who the developers are for the project-->
+ <contributors>
+ <contributor>
+ <name>Julien Ruchaud</name>
+ <email>ruchaud(a)codelutin.com</email>
+ <organization>Code Lutin</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </contributor>
+ </contributors>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>maven-plugin</packaging>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <plugins>
+
+ <!-- plugin plugin -->
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ <!--Site-->
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java b/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
new file mode 100644
index 0000000..7d70d81
--- /dev/null
+++ b/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/I18nExtractorTask.java
@@ -0,0 +1,154 @@
+/* *##% nuiton-processor - maven plugin
+ * Copyright (C) 2006 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+package org.nuiton.processor.ant;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.nuiton.processor.I18nExtractor;
+
+/**
+ * I18nExtractorTask.
+ *
+ * Created: Aug 16, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+public class I18nExtractorTask extends MatchingTask {
+
+ public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
+
+ protected File srcDir;
+
+ protected File destFile;
+
+ protected String[] includes = new String[] {};
+
+ protected String[] excludes = new String[] {};
+
+ protected String[] srcFileNames;
+
+ public I18nExtractorTask() {
+
+ }
+
+ protected void doExecute() throws BuildException {
+ // creation du repertoire pour le fichier destination
+ destFile.getParentFile().mkdirs();
+ List<File> fileList = new ArrayList<File>();
+ for (int i = 0; i < srcFileNames.length; i++) {
+ fileList.add(new File(srcFileNames[i]));
+ }
+ try {
+ new I18nExtractor()
+ .extract(fileList.toArray(new File[0]), destFile);
+ } catch (IOException eee) {
+ throw new BuildException(eee);
+ }
+ }
+
+ public void setSrcdir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public void setDestFile(File destFile) {
+ this.destFile = destFile;
+ }
+
+ @Override
+ public void execute() throws BuildException {
+ // first of all, make sure that we've got a srcdir
+ if (srcDir == null) {
+ throw new BuildException("srcdir attribute must be set!",
+ getLocation());
+ }
+ if (!srcDir.exists()) {
+ throw new BuildException("srcdir \"" + srcDir.getPath()
+ + "\" does not exist!", getLocation());
+ }
+
+ if (destFile == null) {
+ throw new BuildException("destFile attribute must be set!",
+ getLocation());
+ }
+
+ // Build the list of files to compute
+ buildFileList();
+
+ // generate the source files
+ doExecute();
+ }
+
+ protected void buildFileList() {
+
+ // Obtain this list of files within the source directory
+ DirectoryScanner ds = getDirectoryScanner(srcDir);
+
+ String[] includes = getIncludes();
+ if (includes.length > 0) {
+ ds.setIncludes(includes);
+ }
+ String[] excludes = getExcludes();
+ if (excludes.length > 0) {
+ ds.setExcludes(excludes);
+ }
+
+ ds.scan();
+
+ // on met le resultat dans files
+ srcFileNames = ds.getIncludedFiles();
+ }
+
+ protected boolean isNewer(String filein, String fileout) {
+ boolean result = new File(filein).lastModified() > new File(fileout)
+ .lastModified();
+ if (result) {
+ log(filein + " is newer than " + fileout, MSG_VERBOSE);
+ }
+ return result;
+ }
+
+ protected String[] getExcludes() {
+ return excludes;
+ }
+
+ protected String[] getIncludes() {
+ return includes;
+ }
+
+ @Override
+ public void setIncludes(String includes) {
+ this.includes = includes.split(",");
+ }
+
+ @Override
+ public void setExcludes(String excludes) {
+ this.excludes = excludes.split(",");
+ }
+
+}
diff --git a/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java b/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java
new file mode 100644
index 0000000..cd74df6
--- /dev/null
+++ b/maven-processor-plugin/src/main/java/org/nuiton/processor/ant/ProcessorTask.java
@@ -0,0 +1,242 @@
+/*
+ * *##% nuiton-processor - maven plugin
+ * Copyright (C) 2006 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+package org.nuiton.processor.ant;
+
+import java.io.File;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.nuiton.processor.Processor;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.nuiton.processor.ProcessorUtil;
+
+/**
+ * Tache ant pour lutinprocessor.
+ *
+ * To use this task, put this code in ant build file:
+ *
+ * <taskdef name="processor" classname="org.nuiton.processor.ant.ProcessorTask"
+ * classpath="lib/lutinprocessor.jar" />
+ *
+ * and use it with:
+ *
+ * <processor srcdir="${src}" destdir="${targetgen}" filters="org.nuiton.processor.filters.GeneratorTemplatesFilter" />
+ *
+ * Created: 14 janv. 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com> Copyright Code Lutin
+ *
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$ par : $Author$
+ */
+public class ProcessorTask extends MatchingTask { // ProcessorTask
+
+ public static final int MSG_VERBOSE = Project.MSG_VERBOSE;
+ protected File srcDir;
+ protected File destDir;
+ protected String[] includes = new String[]{};
+ protected String[] excludes = new String[]{};
+ protected String[] files;
+ protected String fileInPattern = "";
+ protected String fileOutPattern = "";
+ protected String filters = "org.nuiton.processor.filters.NoActionFilter";
+ protected boolean overwrite = true;
+ protected boolean verbose = false;
+
+ public ProcessorTask() {
+ }
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public void setOverwrite(boolean overwrite) {
+ this.overwrite = overwrite;
+ }
+
+ public void setFileOutPattern(String fileOutPattern) {
+ this.fileOutPattern = fileOutPattern;
+ }
+
+ public void setFileInPattern(String fileInPattern) {
+ this.fileInPattern = fileInPattern;
+ }
+
+ public void setSrcdir(File srcDir) {
+ this.srcDir = srcDir;
+ }
+
+ public void setDestdir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ public void setFilters(String filters) {
+ this.filters = filters;
+ }
+
+ protected String applyTransformationFilename(String filename) {
+ return filename.replaceAll(fileInPattern, fileOutPattern);
+ }
+
+ protected void doExecute() throws BuildException {
+ Processor processor=null;
+ try {
+ processor = ProcessorUtil.newProcessor(this.filters, ",");
+ } catch (Exception ex) {
+ throw new BuildException("Could nto instanciate processor for reason : "+ex.getMessage(), ex);
+ }
+// Processor processor = new Processor(getFilters());
+ int numberFiles;
+ for (numberFiles = 0; numberFiles < files.length; numberFiles++) {
+ String inputFileName = absoluteSourceName(files[numberFiles]);
+ String outputFileName = absoluteDestinationName(applyTransformationFilename(files[numberFiles]));
+ if (verbose) {
+ log("Using " + inputFileName);
+ }
+ if (overwrite || isNewer(inputFileName, outputFileName)) {
+ if (verbose) {
+ log("Generating " + outputFileName);
+ }
+ // creation du repertoire pour le fichier destination
+ new File(outputFileName).getParentFile().mkdirs();
+ try {
+ processor.process(new FileReader(inputFileName),
+ new FileWriter(outputFileName));
+ } catch (IOException eee) {
+ throw new BuildException(eee);
+ }
+ }
+ }
+ log("Generating " + numberFiles + " files to " + destDir);
+ }
+
+// protected Filter[] getFilters() throws BuildException {
+// Filter[] result;
+// try {
+// result = ProcessorUtil.getFilters(filters, ",");
+// } catch (Exception eee) {
+// throw new BuildException(eee.getMessage(), eee);
+// }
+//// String[] filterList = filters.split(",");
+//// Filter[] result = new Filter[filterList.length];
+//// for (int i = 0; i < filterList.length; i++) {
+//// try {
+//// // Class.forName semble fonctionner maintenant
+//// // avant il fallait utiliser getClass().forName
+//// result[i] = (Filter) Class.forName(filterList[i].trim())
+//// .newInstance();
+//// } catch (Exception eee) {
+//// throw new BuildException("Error during looking for '"
+//// + filterList[i].trim() + "' class", eee);
+//// }
+//// }
+// return result;
+// }
+
+ @Override
+ public void execute() throws BuildException {
+ // first of all, make sure that we've got a srcdir
+ if (srcDir == null) {
+ throw new BuildException("srcdir attribute must be set!",
+ getLocation());
+ }
+ if (!srcDir.exists()) {
+ throw new BuildException("srcdir \"" + srcDir.getPath() + "\" does not exist!", getLocation());
+ }
+
+ if (destDir == null) {
+ destDir = srcDir;
+ }
+ if (!destDir.isDirectory()) {
+ throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", getLocation());
+ }
+
+ // Build the list of files to compute
+ buildFileList();
+
+ // generate the source files
+ doExecute();
+ }
+
+ protected void buildFileList() {
+
+ // Obtain this list of files within the source directory
+ DirectoryScanner ds = getDirectoryScanner(srcDir);
+
+ String[] includes = getIncludes();
+ if (includes.length > 0) {
+ ds.setIncludes(includes);
+ }
+ String[] excludes = getExcludes();
+ if (excludes.length > 0) {
+ ds.setExcludes(excludes);
+ }
+
+ ds.scan();
+
+ // on recherche ceux que l'on doit vraiment refaire
+ files = ds.getIncludedFiles();
+ }
+
+ protected boolean isNewer(String filein, String fileout) {
+ boolean result = new File(filein).lastModified() > new File(fileout).lastModified();
+ if (result) {
+ log(filein + " is newer than " + fileout, MSG_VERBOSE);
+ }
+ return result;
+ }
+
+ protected String[] getExcludes() {
+ return excludes;
+ }
+
+ protected String[] getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(String[] includes) {
+ this.includes = includes;
+ }
+
+ @Override
+ public void setIncludes(String includes) {
+ setIncludes(includes.split(","));
+ }
+
+ public void setExcludes(String[] excludes) {
+ this.excludes = excludes;
+ }
+
+ @Override
+ public void setExcludes(String excludes) {
+ setExcludes(excludes.split(","));
+ }
+
+ protected String absoluteDestinationName(String fileName) {
+ return destDir.getPath() + File.separator + fileName;
+ }
+
+ protected String absoluteSourceName(String fileName) {
+ return srcDir.getPath() + File.separator + fileName;
+ }
+} // ProcessorTask
diff --git a/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java b/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java
new file mode 100644
index 0000000..e7e167d
--- /dev/null
+++ b/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java
@@ -0,0 +1,274 @@
+/* *##% nuiton-processor - maven plugin
+ * Copyright (C) 2006 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+package org.nuiton.processor.plugin;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.maven.project.MavenProject;
+import org.nuiton.AbstractPlugin;
+import org.nuiton.processor.Processor;
+import org.nuiton.processor.ProcessorUtil;
+import org.nuiton.util.MirroredFileUpdater;
+
+/**
+ * Maven2 plugin for Nuiton Processor.
+ *
+ * Created: 14 avril 2006
+ *
+ * @author ruchaud
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ *
+ * @goal process
+ * @requiresProject true
+ */
+public class ProcessorPlugin extends AbstractPlugin {
+
+ /**
+ * Dependance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @since 1.0.0
+ */
+ protected MavenProject project;
+ /**
+ * Répertoire source
+ *
+ * @parameter expression="${processor.srcDir}" default-value="${basedir}/src/main/java"
+ * @since 0.10
+ */
+ protected File srcDir;
+ /**
+ * Répertoire cible
+ *
+ * @parameter expression="${processor.destDir}" default-value="${basedir}/target/processed-sources/java"
+ * @since 0.10
+ */
+ protected File destDir;
+ /**
+ * Fichiers à inclure.
+ *
+ * Il s'agit des expressions séparées par des virgules.
+ *
+ * Exemple :
+ *
+ * *.java,*.xml
+ *
+ * @parameter expression="${processor.includes}"
+ * @since 0.10
+ */
+ protected String includes;
+ /**
+ * Fichiers à exclure.
+ *
+ * Il s'agit des expressions spérarées par des virgules.
+ *
+ * Exemple :
+ *
+ * *.java,*.xml
+ *
+ * @parameter expression="${processor.excludes}"
+ * @since 0.10
+ */
+ protected String excludes;
+ /**
+ * ???
+ * @parameter expression="${processor.fileInPattern}" default-value=""
+ * @since 0.10
+ */
+ protected String fileInPattern="";
+ /**
+ * @parameter expression="${processor.fileOutPattern}" default-value=""
+ * @since 0.10
+ */
+ protected String fileOutPattern="";
+ /**
+ * Les filtres a utiliser par le processor, séparés par des virgules
+ *
+ * @parameter expression="${processor.filters}" default-value="org.nuiton.processor.filters.NoActionFilter"
+ * @since 0.10
+ */
+ protected String filters;
+ /**
+ * Ecrase les fichiers générés
+ *
+ * @parameter expression="${processor.overwrite}" default-value="false"
+ * @since 0.10
+ */
+ private boolean overwrite;
+ /**
+ * Permet d'obtenir plus d'information
+ *
+ * @parameter expression="${processor.verbose}" default-value="${maven.verbose}"
+ * @since 0.10
+ */
+ private boolean verbose;
+// /**
+// * Flag pour indiquer si on doit ajouter le repertoire de generation dans les répertoires
+// * de compilation du project Maven Nom par défaut du paquetage généré
+// * <p/>
+// * TODO Ce flag doit disparaitre dans la prochaine release (uniquement utilisée pour compatibilité)
+// *
+// * @parameter expression="${processor.addCompileDirectory}" default-value="false"
+// * @since 0.16
+// */
+// protected boolean addCompileDirectory;
+ protected Map<String, String> filesToTreate;
+
+ public ProcessorPlugin() {
+ super("all files are up-to-date.");
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ @Override
+ protected boolean ensurePackaging() {
+ return false;
+ }
+
+ @Override
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ protected boolean init() throws Exception {
+
+ boolean doGenerate = filters.length() > 0;
+
+ if (doGenerate) {
+
+ MirroredFileUpdater updater = overwrite ? null : new MirroredFileUpdater(fileInPattern, fileOutPattern, srcDir, destDir);
+
+ updater.setDestinationDirectory(destDir);
+ String[] aIncludes = includes.split(",");
+ String[] aExcludes = excludes == null ? null : excludes.split(",");
+
+ filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater);
+
+ doGenerate = !filesToTreate.isEmpty();
+ }
+
+ return doGenerate;
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+
+
+ Processor processor = ProcessorUtil.newProcessor(filters, ",");
+
+ for (Entry<String, String> entry : filesToTreate.entrySet()) {
+ File srcFile = new File(srcDir, entry.getKey());
+ File dstFile = new File(entry.getValue());
+
+ // creation du repertoire pour le fichier destination
+ dstFile.getParentFile().mkdirs();
+
+ processor.process(new FileReader(srcFile), new FileWriter(dstFile));
+ }
+
+ removeCompileSourceRoots(srcDir);
+ addCompileSourceRoots(destDir);
+ }
+// @Override
+// public void execute() throws MojoExecutionException {
+// getLog().info("Génération des fichiers à partir de lutin processor");
+//
+// /* Création d'un projet ant */
+// Project antProject = new Project();
+//
+// BuildLogger logger = new NoBannerLogger();
+// logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
+// logger.setOutputPrintStream(System.out);
+// logger.setErrorPrintStream(System.err);
+//
+// antProject.init();
+// antProject.getBaseDir();
+// antProject.addBuildListener(logger);
+//
+// /* Création de la tâche ant ProcessorTask */
+// ProcessorTask processor = new ProcessorTask();
+// processor.setProject(antProject);
+// processor.setTaskName("Processor");
+//
+// if (verbose) {
+// getLog().info("srcDir is " + srcDir);
+// getLog().info("destDir is " + destDir);
+// }
+//
+// /* Configuration */
+// processor.setVerbose(verbose);
+// processor.setSrcdir(srcDir);
+// destDir.mkdirs();
+// processor.setDestdir(destDir);
+//
+// processor.setFileInPattern(fileInPattern);
+// processor.setFileOutPattern(fileOutPattern);
+//
+// processor.setIncludes(includes);
+// processor.setExcludes(excludes);
+//
+// processor.setFilters(filters);
+//
+// processor.setOverwrite(overwrite);
+//
+// /* Execution */
+// processor.execute();
+//
+// if (addCompileDirectory) {
+// fixCompileSourceRoots();
+// }
+// }
+// /**
+// * permet d'ajout le répertoire de génération des fichiers java dans les répertoires
+// * de compilation du projet Maven.
+// */
+// protected void fixCompileSourceRoots() {
+// if (project.getCompileSourceRoots().contains(srcDir.getPath())) {
+// if (verbose) {
+// getLog().info("srcDir found in compileSourceRoots, removing : " + srcDir.getPath());
+// }
+// project.getCompileSourceRoots().remove(srcDir.getPath());
+// }
+// if (!project.getCompileSourceRoots().contains(destDir.getPath())) {
+// if (verbose) {
+// getLog().info("destDir not found in compileSourceRoots, adding : " + destDir.getPath());
+// }
+// project.addCompileSourceRoot(destDir.getPath());
+// }
+// }
+}
diff --git a/maven-processor-plugin/src/site/apt/index.apt b/maven-processor-plugin/src/site/apt/index.apt
new file mode 100644
index 0000000..74f9030
--- /dev/null
+++ b/maven-processor-plugin/src/site/apt/index.apt
@@ -0,0 +1,51 @@
+----
+Maven-processor-plugin
+----
+----
+2009-08-22
+----
+
+
+Présentation
+
+ Le plugin maven-processor-plugin permet l'utilisation depuis maven de
+ LutinProcessor. Pour plus de détails sur LutinProcessor veuillez consulter
+ {{{http://maven-site.nuiton.org./processor/nuiton-processor}l'adresse suivante}}.
+
+Utilisation dans le pom.xml
+
+ Voici une déclaration d'une utilisation de maven-processor-plugin dans un
+ pom.xml. Il permet dans ce cas utiliser les fitres nécessaires pour
+ {{{http://maven-site.nuiton.org/topia}ToPIA}}.
+
+------------------------------------------------------------
+
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-processor-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <srcDir>${basedir}/src</srcDir>
+ <destDir>${maven.src.dir}</destDir>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <filters>
+ org.nuiton.processor.filters.GeneratorTemplatesFilter,
+ org.nuiton.processor.filters.ActiveLogsCodeFilter
+ </filters>
+ </configuration>
+ </plugin>
+ ...
+ </plugins>
+
+------------------------------------------------------------
diff --git a/maven-processor-plugin/src/site/site.xml b/maven-processor-plugin/src/site/site.xml
new file mode 100644
index 0000000..c8610ad
--- /dev/null
+++ b/maven-processor-plugin/src/site/site.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+ <links>
+ <item name="Nuiton Processor" href="../nuiton-processor"/>
+ </links>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="${project.url}" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur">
+ <item href="index.html" name="Accueil"/>
+ <item name="Goals" href="plugin-info.html">
+ <item name="process" href="process-mojo.html"/>
+ <item name="help" href="help-mojo.html"/>
+ </item>
+ </menu>
+
+ <menu name="Téléchargement">
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Librairie (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ </body>
+</project>
diff --git a/nuiton-processor/LICENSE.txt b/nuiton-processor/LICENSE.txt
new file mode 100644
index 0000000..3f7b8b1
--- /dev/null
+++ b/nuiton-processor/LICENSE.txt
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/nuiton-processor/README.txt b/nuiton-processor/README.txt
new file mode 100644
index 0000000..d2e50d3
--- /dev/null
+++ b/nuiton-processor/README.txt
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
diff --git a/nuiton-processor/changelog.txt b/nuiton-processor/changelog.txt
new file mode 100644
index 0000000..f9a28aa
--- /dev/null
+++ b/nuiton-processor/changelog.txt
@@ -0,0 +1 @@
+No more used, we will soon make optional multi-module childs changelog.txt (mavenpom>1.0.0)
diff --git a/nuiton-processor/pom.xml b/nuiton-processor/pom.xml
new file mode 100644
index 0000000..eec7e67
--- /dev/null
+++ b/nuiton-processor/pom.xml
@@ -0,0 +1,76 @@
+<?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>org.nuiton</groupId>
+ <artifactId>processor</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <groupId>org.nuiton.processor</groupId>
+ <artifactId>nuiton-processor</artifactId>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>nuiton-processor - lib</name>
+ <description>
+ Cette librairie permet la création de filtre sur les fichiers sources.
+ </description>
+ <inceptionYear>2002</inceptionYear>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <!-- perform only on a release stage when using the maven-release-plugin -->
+ <profiles>
+ <profile>
+ <id>release-profile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-assemblies</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>false</attach>
+ <descriptorRefs>
+ <descriptorRef>deps</descriptorRef>
+ <descriptorRef>full</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/GeneratorTemplatesProcessor.java b/nuiton-processor/src/main/java/org/nuiton/processor/GeneratorTemplatesProcessor.java
new file mode 100644
index 0000000..b34e8ed
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/GeneratorTemplatesProcessor.java
@@ -0,0 +1,59 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+ * GeneratorTemplatesProcessor.java
+ *
+ * Created: Wed Sep 4 2002
+ *
+ * @author <pineau(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.processor;
+
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.nuiton.processor.filters.GeneratorTemplatesFilter;
+
+public class GeneratorTemplatesProcessor extends Processor {
+
+ public GeneratorTemplatesProcessor(){
+ setInputFilter(new GeneratorTemplatesFilter());
+ }
+
+ static public void process(String filein, String fileout)
+ throws IOException{
+ Processor processor = new GeneratorTemplatesProcessor();
+ processor.process(new FileReader(filein), new FileWriter(fileout));
+ }
+
+ public static void main(String [] args)throws IOException{
+ if(args.length < 2) {
+ System.out.println("Give source and destination file");
+ System.exit(1);
+ } else {
+ process(args[0], args[1]);
+ }
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/I18nExtractor.java b/nuiton-processor/src/main/java/org/nuiton/processor/I18nExtractor.java
new file mode 100644
index 0000000..f9b0ddf
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/I18nExtractor.java
@@ -0,0 +1,120 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+ * I18nExtractor.java
+ *
+ * Created: Aug 16, 2004
+ *
+ * @author Cédric Pineau <pineau(a)codelutin.com>
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * by : $Author$
+ */
+
+package org.nuiton.processor;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.nuiton.processor.filters.I18nFilter;
+
+/**
+ *
+ */
+public class I18nExtractor {
+
+ protected I18nFilter filter = new I18nFilter();
+
+ protected HashMap<String,List<String>> i18nStringsMap = new HashMap<String,List<String>>();
+
+ public void extract(File[] srcFiles, File outputFile) throws IOException {
+ PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8")));
+ for (int i = 0; i < srcFiles.length; i++) {
+ processFile(srcFiles[i]);
+ }
+ for (Iterator<?> iter = i18nStringsMap.keySet().iterator(); iter.hasNext();) {
+ String i18nString = (String) iter.next();
+ List<?> locations = (List<?>) i18nStringsMap.get(i18nString);
+ for (Iterator<?> iterator = locations.iterator(); iterator.hasNext();) {
+ String location = (String) iterator.next();
+ writer.println("# "+location);
+ }
+ writer.println(i18nString+"=");
+ }
+ writer.close();
+ }
+
+ protected void processFile(File srcFile) throws IOException {
+ LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(srcFile), "UTF-8"));
+ while (lnr.ready()) {
+ String line = lnr.readLine();
+ int lineNumber = lnr.getLineNumber();
+ processLine(line, srcFile, lineNumber);
+ }
+ }
+
+ protected void processLine(String line, File srcFile, int lineNumber) {
+ String i18nStringsSet = filter.parse(line);
+ if (I18nFilter.EMPTY_STRING.equals(i18nStringsSet)) {
+ // Found a set of i18n Strings, split it.
+ String[] i18nStrings = i18nStringsSet.split("=");
+ for (int i = 0; i < i18nStrings.length; i++) {
+ String i18nString = i18nStrings[i];
+
+ List<String> locations = i18nStringsMap.get(i18nString);
+ if (locations == null) {
+ locations = new ArrayList<String>();
+ i18nStringsMap.put(i18nString, locations);
+ }
+ locations.add(srcFile.getPath()+"("+lineNumber+")");
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ if(args.length < 2) {
+ System.out.println("Please give at least sources and destination file");
+ System.exit(0);
+ } else if (args.length > 2) {
+ File[] sources = new File[args.length-1];
+ for (int i = 0; i < args.length-1; i++) {
+ sources[i] =new File(args[i]);
+ }
+ File destination = new File(args[args.length-1]);
+ try {
+ new I18nExtractor().extract(sources, destination);
+ } catch (IOException eee) {
+ java.util.logging.Logger.getLogger("org.nuiton.processor.I18nExtractor.").severe("Error during i18n extraction : "+eee);
+ System.out.println("!!! "+eee); // TODO remove this
+ }
+ }
+
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/LicenseProcessor.java b/nuiton-processor/src/main/java/org/nuiton/processor/LicenseProcessor.java
new file mode 100644
index 0000000..a9e3315
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/LicenseProcessor.java
@@ -0,0 +1,44 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+package org.nuiton.processor;
+
+import org.nuiton.processor.filters.LicenseFilter;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/** @author chemit */
+public class LicenseProcessor extends org.nuiton.processor.Processor {
+
+ protected LicenseFilter licenseFilter;
+
+ public LicenseProcessor(String header) {
+ licenseFilter = new LicenseFilter(header);
+ setInputFilter(licenseFilter);
+ }
+
+ public LicenseFilter getLicenceFilter() {
+ return licenseFilter;
+ }
+
+ public void process(File filein, File fileout) throws IOException {
+ process(new FileReader(filein), new FileWriter(fileout));
+ }
+}
+
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/LogsProcessor.java b/nuiton-processor/src/main/java/org/nuiton/processor/LogsProcessor.java
new file mode 100644
index 0000000..d3adff7
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/LogsProcessor.java
@@ -0,0 +1,87 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* LogsProcessor.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor;
+
+import org.nuiton.processor.filters.*;
+import java.io.*;
+
+/*
+* This class is a processor for source logs
+*/
+public class LogsProcessor extends Processor {
+
+ /** Type of actions */
+ protected static class Action {}
+ /** Do nothing */
+ public final static Action NoAction = new Action();
+
+ /** Active logs in output. This is the default action */
+ public final static Action Logs = new Action();
+ /** Remove logs in output */
+ public final static Action NoLogsCode = new Action();
+
+ public LogsProcessor (Action action) {
+ if (action == NoAction) {
+ // No action is the default filter in Processor
+ } else if (action == NoLogsCode) {
+ setInputFilter(new RemoveLogsCodeFilter());
+ } else {
+ // Go for logs
+ setInputFilter(new ActiveLogsCodeFilter());
+ }
+ }
+
+ public static void main(String [] args) throws Exception {
+ LogsProcessor processor;
+ if(args.length < 2) {
+ System.out.println("Give source and destination file, then action");
+ System.out.println("Action may be remove or active (default is no action)");
+ System.exit(0);
+ } else if (args.length > 2) {
+ if (args[2].equals("remove")) {
+ processor = new LogsProcessor(NoLogsCode);
+ System.out.println("Removing logs code");
+ } else if (args[2].equals("active")) {
+ processor = new LogsProcessor(Logs);
+ System.out.println("Setting logs active");
+ } else {
+ processor = new LogsProcessor(NoAction);
+ System.out.println("No action taken");
+ }
+ try {
+ processor.process(new FileReader(args[0]),
+ new FileWriter(args[1]));
+ } catch (IOException eee) {
+ java.util.logging.Logger.getLogger("org.nuiton.processor.LogsProcessor.").severe("Error during log processing: "+eee);
+ }
+ }
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/OptimisationProcessor.java b/nuiton-processor/src/main/java/org/nuiton/processor/OptimisationProcessor.java
new file mode 100644
index 0000000..e09fc6b
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/OptimisationProcessor.java
@@ -0,0 +1,57 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* OptimisationProcessor.java
+*
+* Created: Wed Sep 4 2002
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor;
+
+import java.io.*;
+import org.nuiton.processor.filters.OptimisationFilter;
+
+public class OptimisationProcessor extends Processor { // OptimisationProcessor
+
+ public OptimisationProcessor(){
+ setInputFilter(new OptimisationFilter());
+ }
+
+ static public void process(String filein, String fileout)
+ throws IOException{
+ Processor processor = new OptimisationProcessor();
+ processor.process(new FileReader(filein), new FileWriter(fileout));
+ }
+
+ public static void main(String [] args)throws IOException{
+ if(args.length < 2) {
+ System.out.println("Give source and destination file");
+ System.exit(1);
+ } else {
+ process(args[0], args[1]);
+ }
+ }
+
+} // OptimisationProcessor
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/Processor.java b/nuiton-processor/src/main/java/org/nuiton/processor/Processor.java
new file mode 100644
index 0000000..6f7ff5e
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/Processor.java
@@ -0,0 +1,97 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+ * Processor.java
+ *
+ * Created: Wed Jan 14 2004
+ *
+ * @author <poussin(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+package org.nuiton.processor;
+
+import org.nuiton.processor.filters.*;
+import org.nuiton.processor.filters.Filter;
+import java.io.*;
+import java.util.logging.Logger;
+
+/*
+ * This class is a generic sources processor
+ * Given a reader class name and a writer class name
+ */
+public class Processor {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Logger log = Logger.getLogger("org.nuiton.processor.Processor");
+ protected Filter[] inputFilter = new Filter[]{new NoActionFilter()};
+ protected Filter outputFilter = new NoActionFilter();
+
+ public Processor() {
+ }
+
+ public Processor(Filter[] filters) {
+ setInputFilter(filters);
+ }
+
+ public void setInputFilter(Filter inFilter) {
+ setInputFilter(new Filter[]{inFilter});
+ }
+
+ public void setInputFilter(Filter[] inFilter) {
+ inputFilter = inFilter;
+ }
+
+ public void setOutputFilter(Filter outFilter) {
+ outputFilter = outFilter;
+ }
+
+ protected BufferedReader getReader(Reader externalInput) {
+ BufferedReader result = new BufferedReader(externalInput);
+ for (int i = 0; i < inputFilter.length; i++) {
+ result = new ProcessorReader(result, inputFilter[i]);
+ }
+ return result;
+ }
+
+ /** Process all available data
+ * @param externalInput
+ * @param externalOutput
+ * @throws IOException if any pb
+ */
+ public void process(Reader externalInput, Writer externalOutput) throws IOException {
+ log.finest("Debug du process");
+ BufferedReader input = getReader(externalInput);
+ ProcessorWriter output =
+ new ProcessorWriter(new BufferedWriter(externalOutput), outputFilter);
+
+ log.finest("input: " + input);
+ log.finest("output: " + output);
+
+ String line = input.readLine();
+ while (line != null) {
+ log.finest("Ligne lu: " + line);
+ output.writeLine(line);
+ line = input.readLine();
+ }
+ output.flush();
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorReader.java b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorReader.java
new file mode 100644
index 0000000..94592c5
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorReader.java
@@ -0,0 +1,101 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* ProcessorReader.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.nuiton.processor.filters.Filter;
+
+public class ProcessorReader extends BufferedReader {
+
+ protected BufferedReader input;
+ protected Filter filter;
+ protected String lineSeparator;
+
+ protected ProcessorReader(){
+ super(new StringReader(""));
+ }
+
+ public ProcessorReader(BufferedReader input, Filter filter) {
+ this();
+ setInput(input);
+ this.filter = filter;
+ lineSeparator = System.getProperty("line.separator");
+ }
+
+ public void setInput(BufferedReader input){
+ this.input = input;
+ }
+
+ @Override
+ public boolean markSupported(){
+ return false;
+ }
+
+ @Override
+ public String readLine() throws IOException {
+ if (input.ready()) {
+ String line = input.readLine();
+ if(line != null){
+ if (!(input instanceof ProcessorReader)){
+ line += lineSeparator;
+ }
+ return filter.parse(line);
+ }
+ }
+ if(filter.hasCachedData()){
+ return filter.flush();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean ready() {
+ try {
+ boolean ready = input.ready();
+ if (ready) {
+ return true;
+ }
+ return filter.hasCachedData();
+ } catch (IOException eee) {
+ return false;
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ input.close();
+ }
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorUtil.java b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorUtil.java
new file mode 100644
index 0000000..80b980a
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorUtil.java
@@ -0,0 +1,69 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+package org.nuiton.processor;
+
+import org.nuiton.processor.filters.Filter;
+
+/**
+ * Utilities methods.
+ *
+ * @author chemit
+ * @since 1.0.0.0
+ */
+public class ProcessorUtil {
+
+ /**
+ * Instanciate a new {@link Processor} given an array of filters given by
+ * their FQN separated by the given separator.
+ *
+ * @param filters the string representionf of the filters
+ * @param separator the separator of filter
+ * @return the instanciated processor
+ * @throws java.lang.Exception if any pb
+ */
+ public static Processor newProcessor(String filters, String separator) throws Exception {
+ Filter[] result = getFilters(filters, separator);
+ Processor processor = new Processor(result);
+ return processor;
+ }
+
+ /**
+ * Instanciate a array of filters given by thier FQN separated by the
+ * given separator.
+ *
+ * @param filters the list of filters separated by the given separator
+ * @param separator filter separator
+ * @return the array of instanciated filters.
+ *
+ * @throws java.lang.Exception if any pb
+ */
+ public static Filter[] getFilters(String filters, String separator) throws Exception {
+ String[] filterList = filters.split(separator);
+ Filter[] result = new Filter[filterList.length];
+ for (int i = 0; i < filterList.length; i++) {
+
+ try {
+ // Class.forName semble fonctionner maintenant
+ // avant il fallait utiliser getClass().forName
+ result[i] = (Filter) Class.forName(filterList[i].trim()).newInstance();
+ } catch (Exception eee) {
+ throw new IllegalArgumentException("Error during looking for '" + filterList[i].trim() + "' class", eee);
+ }
+ }
+ return result;
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorWriter.java b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorWriter.java
new file mode 100644
index 0000000..bcbee02
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/ProcessorWriter.java
@@ -0,0 +1,64 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/**
+* ProcessorWriter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor;
+
+import org.nuiton.processor.filters.*;
+import java.io.*;
+
+public class ProcessorWriter {
+
+ protected BufferedWriter output;
+ protected Filter filter;
+
+ public ProcessorWriter(BufferedWriter output, Filter filter) {
+ this.output = output;
+ this.filter = filter;
+ }
+
+ public void writeLine(String line) throws IOException {
+
+ // TODO Euh on se sert quand du filtre de sortie ???? :-)
+ output.write(line);
+ }
+
+ public void newLine() throws IOException {
+ output.newLine();
+ }
+
+ public void flush() throws IOException {
+ output.flush();
+ }
+
+ public void close() throws IOException {
+ output.close();
+ }
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/ActiveLogsCodeFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/ActiveLogsCodeFilter.java
new file mode 100644
index 0000000..699e5da
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/ActiveLogsCodeFilter.java
@@ -0,0 +1,64 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* x*
+* ActiveLogsCodeFilter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+/*
+* This class deals with the
+*/
+public class ActiveLogsCodeFilter extends LogsFilter {
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header
+ * et le footer.
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ @Override
+ protected String performInFilter(String ch){
+ // Logs must be performed within a try{...}catch{} bloc
+ return
+ "try {" +
+ ch +
+ "} catch (Exception logsE) { System.err.println(\"Error in Logging instructions\"); logsE.printStackTrace(); }";
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ @Override
+ protected String performOutFilter(String ch){
+ return ch;
+ }
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/DefaultFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/DefaultFilter.java
new file mode 100644
index 0000000..44ae5d9
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/DefaultFilter.java
@@ -0,0 +1,140 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+/*******************************************************************************
+ * DefaultFilter.java
+ *
+ * Created: Wed Sep 4 2002
+ *
+ * @author <poussin(a)codelutin.com>Copyright Code Lutin
+ *
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$ par : $Author$
+ */
+package org.nuiton.processor.filters;
+
+public abstract class DefaultFilter implements Filter { // DefaultFilter
+
+ public static int NOT_FOUND = -1;
+ protected StringBuffer cachedContent = new StringBuffer();
+
+ public DefaultFilter() {
+ }
+
+ /** Type of states */
+ protected static class State {
+
+ /** Looking-for-header state */
+ public final static State SEARCH_HEADER = new State();
+ /** Looking-for-footer state */
+ public final static State SEARCH_FOOTER = new State();
+ }
+ protected State currentState = State.SEARCH_HEADER;
+
+ @Override
+ public String parse(String input) {
+ int matchingIndex;
+
+ // add new input to current content
+ cachedContent.append(input);
+ String content = cachedContent.toString();
+
+ if (currentState.equals(State.SEARCH_HEADER)) {
+ // Looking for a header
+ matchingIndex = getMatchIndexFor(content, getHeader());
+ if (matchingIndex != NOT_FOUND) {
+ // Header found, return "out" part of it + recursive process of remaining chars
+ currentState = State.SEARCH_FOOTER;
+ cachedContent.setLength(0);
+ return performOutFilter(content.substring(0, matchingIndex)) + parse(content.substring(matchingIndex));
+ }
+ // No header found !
+ return EMPTY_STRING;
+ }
+
+ if (currentState.equals(State.SEARCH_FOOTER)) {
+ // Looking for a footer
+ matchingIndex = getMatchIndexFor(content, getFooter());
+ if (matchingIndex != NOT_FOUND) {
+ // Footer found, return "in" part of it + recursive process of remaining chars
+ currentState = State.SEARCH_HEADER;
+ cachedContent.setLength(0);
+ int matchingEndIndex = matchingIndex + getMatchLengthFor(getFooter());
+ return performInFilter(performHeaderFooterFilter(content.substring(0, matchingEndIndex))) + parse(content.substring(matchingEndIndex));
+ }
+ // No footer found !
+ return EMPTY_STRING;
+ }
+
+ return "INVALID STATE in DefaultFilter !";
+ }
+
+ public String performHeaderFooterFilter(String ch) {
+ return ch.substring(getHeader().length(), ch.length() - getFooter().length());
+ }
+
+ public int getMatchIndexFor(String input, String sequence) {
+ return input.indexOf(sequence);
+ }
+
+ public int getMatchLengthFor(String sequence) {
+ return sequence.length();
+ }
+
+ @Override
+ public boolean hasCachedData() {
+ return (cachedContent.length() > 0);
+ }
+
+ @Override
+ public String flush() {
+ String line = cachedContent.toString();
+ // Empty the cache,
+ cachedContent.setLength(0);
+ // and returns its content
+ if (currentState.equals(State.SEARCH_HEADER)) {
+ return performOutFilter(line);
+ }
+ return performInFilter(line);
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header et le
+ * footer.
+ *
+ * @param ch
+ * la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ abstract protected String performInFilter(String ch);
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ *
+ * @param ch
+ * la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ abstract protected String performOutFilter(String ch);
+
+ /** @return la chaine du header */
+ abstract protected String getHeader();
+
+ /** @return la chaine du footer */
+ abstract protected String getFooter();
+} // DefaultFilter
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/Filter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/Filter.java
new file mode 100644
index 0000000..ce7db1c
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/Filter.java
@@ -0,0 +1,41 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* Filter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+public interface Filter {
+
+ final static String EMPTY_STRING = "";
+
+ String parse (String input);
+ boolean hasCachedData();
+ String flush ();
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java
new file mode 100644
index 0000000..3619ea1
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilter.java
@@ -0,0 +1,139 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+ * GeneratorTemplatesFilter.java
+ *
+ * Created: Wed Sep 4 2002
+ *
+ * @author <pineau(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+/**
+ * MultilinesLitteralsFilter.java
+ */
+
+package org.nuiton.processor.filters;
+
+/*
+ * Classe principale du filtre de génération. Ce filtre recherche tout ce qu'il
+ * y a entre les tag /*{ et }*/ a l'interieur de ces tags un autre filtre
+ * ({@link org.nuiton.processor.filters.GeneratorTemplatesFilterIn}) est
+ * utilisé pour générer les tags <% %>, <%= %> et *).
+ * <ul>
+ * <li>/*{ et }*/ est remplacer par output.write("..."); pour chaque
+ * ligne et les " sont coté</li>
+ * <li><% %></li>
+ * <li><%= %></li>
+ * <li>*) permet de fermer un commentaire sans le fermer réeellement, cela
+ * permet au éditeur faisant une analyse du code de continuer a fonctionner
+ * ce tag est remplacé par son equivalent */ après génération.</li>
+ * </ul>
+ * Vous pouvez modifier le comportement du processor en mettant des options
+ * Une option est incluse dans le tag et est de la forme
+ * /*{generator option: <optionName> = valeur}*/
+ * les options existantes sont:
+ * <li>passEmptyLine: boolean; cette option permet de supprimer la première
+ * et la dernière ligne si elles sont videx</li>
+ * <li>wtriteString: String, default: output.write</li>
+ */
+public class GeneratorTemplatesFilter extends DefaultFilter {
+
+ protected boolean passEmptyLine = false;
+ protected String writeString = "output.write";
+
+ protected GeneratorTemplatesFilterIn inFilter = new GeneratorTemplatesFilterIn(this);
+
+ public String getWriteString(){
+ return writeString;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header
+ * et le footer.
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performInFilter(String ch){
+ if(ch.matches("generator option: *passEmptyLine *= *(true|false)")){
+ passEmptyLine =
+ "true".equalsIgnoreCase(ch.substring(ch.length()-4));
+ return EMPTY_STRING;
+ }else if(ch.matches("generator option: *writeString *= *.*")){
+ writeString =
+ ch.replaceAll("generator option: *writeString *= *(.*)", "$1");
+ return EMPTY_STRING;
+ }else{
+ if (passEmptyLine && ch.length() > 0){
+ // suppression des premieres et dernieres lignes si elles sont vides
+ String [] all = ch.split("\n");
+ if (all.length > 0){
+ // si la derniere ne match que des blancs
+ if(all[all.length-1].matches("\\s*")){
+ int len = ch.length()-all[all.length-1].length()-1;
+ ch = ch.substring(0, Math.max(len,0));
+ }
+
+ // suppression de la 1er ligne si elle est vide
+ if(all[0].matches("\\s*")){
+ int len = all[0].length()+1;
+ ch = ch.substring(Math.min(ch.length(),len));
+ }
+ }
+ }
+
+ String result = inFilter.parse(ch) + inFilter.flush();
+ return getWriteString()+ "(\"" + result + "\");";
+ }
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performOutFilter(String ch) {
+ return ch;
+ }
+
+
+ /** la chaine du header */
+ protected String getHeader() {
+ return "/*{";
+ }
+
+ /** la chaine du footer */
+ protected String getFooter() {
+ return "}*/";
+ }
+
+ public static void main(String[] args) {
+ Filter filter = new GeneratorTemplatesFilter();
+ String res = filter.parse(" public void generatePackageStatement(Writer output, ObjectModelClassifier clazz) throws IOException {\n/*{\n package <%=clazz.getPackageName()%>.persistence.jdo; \n}*/ }");
+ System.out.println(res);
+ res = filter.flush();
+ System.out.println(res);
+ }
+
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java
new file mode 100644
index 0000000..92c8127
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/GeneratorTemplatesFilterIn.java
@@ -0,0 +1,100 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+ * GeneratorTemplatesFilterIn.java
+ *
+ * Created: 14 janv. 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com>
+ * Copyright Code Lutin
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package org.nuiton.processor.filters;
+
+/**
+ * Le tag *) n'est substitué que s'il est a l'extérieur du tag <%=...%>ou
+ * <%...%>
+ */
+public class GeneratorTemplatesFilterIn extends DefaultFilter { // GeneratorTemplatesFilterIn
+
+ GeneratorTemplatesFilter parent = null;
+
+ public GeneratorTemplatesFilterIn(GeneratorTemplatesFilter parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * méthode appelée lorsqu'on a la chaîne entière entre le header et le
+ * footer.
+ *
+ * @param ch
+ * la chaîne trouvé
+ * @return ce qu'il faut écrire dans le fichier de sortie
+ */
+ @Override
+ protected String performInFilter(String ch) {
+ if (ch.startsWith("=")) {
+ return "\"+" + ch.substring(1) + "+\"";
+ }
+ return "\");" + ch + parent.getWriteString() + "(\"";
+ }
+
+ /**
+ * Converti les fin de commentaire *) en fin normal de commentraire
+ * @param ch la chaine a convertir
+ * @return la chaine convertie
+ */
+ protected String convertEndComment(String ch) {
+ String result = ch.replaceAll("\\*\\)", "*/");
+ return result;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ *
+ * @param ch
+ * la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ @Override
+ protected String performOutFilter(String ch) {
+ String result = convertEndComment(ch).replaceAll("\"", "\\\\\"")
+ .replaceAll("(\r\n|\n|\r)",
+ "\\\\n\");\n" + parent.getWriteString() + "(\"");
+ // it's important that \r\n is first in regexp.
+
+ return result;
+ }
+
+ @Override
+ protected String getHeader() {
+ return "<%";
+ }
+
+ @Override
+ protected String getFooter() {
+ return "%>";
+ }
+
+} // GeneratorTemplatesFilterIn
+
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/I18nFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/I18nFilter.java
new file mode 100644
index 0000000..1c58c4c
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/I18nFilter.java
@@ -0,0 +1,142 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/*******************************************************************************
+ * I18nFilter.java
+ *
+ * Created: Sun Sep 1 2002
+ *
+ * @author <poussin(a)codelutin.com> Copyright Code Lutin
+ *
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$ par : $Author$
+ */
+
+package org.nuiton.processor.filters;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class I18nFilter extends DefaultFilter { // I18nFilter
+
+ private String header = "_\\(\\s*\"";
+ private String footer = "\"\\s*(\\)|,|\\+|$)";
+
+ private Pattern headerPattern = Pattern.compile(getHeader());
+ private Pattern footerPattern = Pattern.compile(getFooter());
+
+ protected void setFooter(String footer) {
+ this.footer = footer;
+ }
+
+ protected void setHeader(String header) {
+ this.header = header;
+ }
+
+ protected String getHeader() {
+ return header;
+ }
+
+ protected String getFooter() {
+ return footer;
+ }
+
+ private Matcher matcher = null;
+ public int getMatchIndexFor(String input, String sequence) {
+ int index = NOT_FOUND;
+
+ setMatcher(null);
+ if (sequence == getHeader()) {
+ setMatcher(getHeaderPattern().matcher(input));
+ } else if (sequence == getFooter()){
+ setMatcher(getFooterPattern().matcher(input));
+ }
+ if (getMatcher() != null) {
+ try {
+ getMatcher().find();
+ index = getMatcher().start();
+ } catch (RuntimeException e) {}
+ }
+
+ return index;
+ }
+
+ public int getMatchLengthFor(String sequence) {
+ int length = NOT_FOUND;
+
+ try {
+ length = getMatcher().end()-getMatcher().start();
+ } catch (RuntimeException e) {}
+
+ return length;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header et le
+ * footer.
+ *
+ * @param ch
+ * la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performInFilter(String ch) {
+ return ch.replaceAll("\"\\s*\\+\\s*\"","") + "=";
+ }
+
+ public String performHeaderFooterFilter(String ch) {
+ return ch.substring(ch.indexOf('"')+1, ch.lastIndexOf('"'));
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ *
+ * @param ch
+ * la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performOutFilter(String ch) {
+ return EMPTY_STRING;
+ }
+
+ /**
+ * @return Returns the footerPattern.
+ */
+ protected Pattern getFooterPattern() {
+ return footerPattern;
+ }
+ /**
+ * @return Returns the headerPattern.
+ */
+ protected Pattern getHeaderPattern() {
+ return headerPattern;
+ }
+ /**
+ * @return Returns the matcher.
+ */
+ protected Matcher getMatcher() {
+ return matcher;
+ }
+ /**
+ * @param matcher The matcher to set.
+ */
+ protected void setMatcher(Matcher matcher) {
+ this.matcher = matcher;
+ }
+} // I18nFilter
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/LicenseFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/LicenseFilter.java
new file mode 100644
index 0000000..97cb2cd
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/LicenseFilter.java
@@ -0,0 +1,71 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+package org.nuiton.processor.filters;
+
+/**
+ * Un filtre pour remplacer la license d'un fichier source java.
+ * <p/>
+ * fixme : il faut ne pas autoriser le process de fichier java qui ne sont pas valide selon le header - footer...
+ *
+ * @author chemit
+ */
+public class LicenseFilter extends DefaultFilter {
+
+ public static final String HEADER = "*" + "#" + "#" + "%";
+ public static final String FOOTER = "#" + "#" + "%" + "*";
+ /**
+ * la licence a insere dans le header du fichier source. Ce header est formatte en commentaire (chaque ligne
+ * commence par un ' * ', sauf pour la premiere et derniere ligne).
+ */
+ protected String licenseHeader;
+
+ /** flag pour indiquer si la licence a ete trouvee entre le header et le footer */
+ protected boolean touched;
+
+ public LicenseFilter(String licenseHeader) {
+ this.licenseHeader = " " + licenseHeader + " ";
+ }
+
+ protected String performInFilter(String ch) {
+ if (touched) {
+ // on autorise pas deux process de la licence dans un fichier java
+ throw new IllegalStateException("has find more than once the license processor tags in a file");
+ }
+ touched = true;
+ return HEADER + licenseHeader + FOOTER;
+ }
+
+ protected String performOutFilter(String ch) {
+ return ch;
+ }
+
+ protected String getHeader() {
+ return HEADER;
+ }
+
+ protected String getFooter() {
+ return FOOTER;
+ }
+
+ public boolean wasTouched() {
+ return touched;
+ }
+
+ public void reset() {
+ touched = false;
+ }
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/LogsFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/LogsFilter.java
new file mode 100644
index 0000000..785bd21
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/LogsFilter.java
@@ -0,0 +1,48 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* LogsFilter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+/*
+* This class deals with the
+*/
+public abstract class LogsFilter extends DefaultFilter {
+
+ private String header = "/*"+"#";
+ private String footer = "#"+"*/";
+
+ protected String getHeader(){
+ return header;
+ }
+ protected String getFooter(){
+ return footer;
+ }
+}
+
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/NoActionFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/NoActionFilter.java
new file mode 100644
index 0000000..432365f
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/NoActionFilter.java
@@ -0,0 +1,50 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* NoActionFilter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+/*
+* This class deals with the
+*/
+public class NoActionFilter implements Filter {
+
+ public String parse (String input) {
+ return input;
+ }
+
+ public boolean hasCachedData(){
+ return false;
+ }
+
+ public String flush (){
+ return EMPTY_STRING;
+ }
+
+}
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/OptimisationFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/OptimisationFilter.java
new file mode 100644
index 0000000..b19fb53
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/OptimisationFilter.java
@@ -0,0 +1,69 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* OptimisationFilter.java
+*
+* Created: Wed Sep 4 2002
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+public class OptimisationFilter extends DefaultFilter { // OptimisationFilter
+
+ public OptimisationFilter() {
+
+ }
+
+ private String header = "/*%";
+ private String footer = "%*/";
+
+ protected String getHeader(){
+ return header;
+ }
+ protected String getFooter(){
+ return footer;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header
+ * et le footer.
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performInFilter(String ch){
+ return ch;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performOutFilter(String ch){
+ return EMPTY_STRING;
+ }
+
+} // OptimisationFilter
diff --git a/nuiton-processor/src/main/java/org/nuiton/processor/filters/RemoveLogsCodeFilter.java b/nuiton-processor/src/main/java/org/nuiton/processor/filters/RemoveLogsCodeFilter.java
new file mode 100644
index 0000000..5640ff3
--- /dev/null
+++ b/nuiton-processor/src/main/java/org/nuiton/processor/filters/RemoveLogsCodeFilter.java
@@ -0,0 +1,59 @@
+/* *##% nuiton-processor - lib
+ * Copyright (C) 2002 - 2009 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
+
+/* *
+* RemoveLogsCodeFilter.java
+*
+* Created: Wed Jan 14 2004
+*
+* @author <poussin(a)codelutin.com>
+* Copyright Code Lutin
+* @version $Revision$
+*
+* Mise a jour: $Date$
+* par : $Author$
+*/
+
+package org.nuiton.processor.filters;
+
+/*
+* This class deals with the
+*/
+public class RemoveLogsCodeFilter extends LogsFilter {
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header
+ * et le footer.
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performInFilter(String ch){
+ return EMPTY_STRING;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ protected String performOutFilter(String ch){
+ return ch;
+ }
+
+}
+
diff --git a/nuiton-processor/src/site/apt/Todo.apt b/nuiton-processor/src/site/apt/Todo.apt
new file mode 100644
index 0000000..04c6975
--- /dev/null
+++ b/nuiton-processor/src/site/apt/Todo.apt
@@ -0,0 +1,14 @@
+----
+Todo
+----
+----
+2009-08-22
+----
+
+ Voici la liste des tâches qui reste à faire. Si quelqu'un souhaite aider, ou
+ a une idée à proposer il ne faut pas hésiter.
+
+ * La documentation utilisateur
+
+ * La documentation développeur
+
diff --git a/nuiton-processor/src/site/apt/index.apt b/nuiton-processor/src/site/apt/index.apt
new file mode 100755
index 0000000..c1341da
--- /dev/null
+++ b/nuiton-processor/src/site/apt/index.apt
@@ -0,0 +1,185 @@
+----
+Nuiton processor
+----
+----
+2009-08-22
+----
+
+
+Présentation
+
+ Cette librairie permet la création de filtre sur les fichiers sources.
+ Des tags de debut et de fin sont recherchés et le filtre permet de traiter
+ la chaïne comprise dans ces tags pour qu'elle soit écrite dans le fichier
+ cible.
+
+Filtres existants
+
+* NoActionFilter
+
+-----------------------------------------------------
+:classe: org.nuiton.processor.filters.NoActionFilter
+-----------------------------------------------------
+
+ Ce filtre ne fait rien
+
+* ActiveLogsCodeFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.ActiveLogsCodeFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ /*# et #*/
+-----------------------------------------------------------
+ et les supprimes, le contenu entre ces deux tags est placé dans un block try.
+
+ Cette règle est surtout utile pour des commentaires de debug ou des tests que
+ l'on veut pouvoir activé ou non.
+
+* RemoveLogsCodeFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.RemoveLogsCodeFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ /*# et #*/
+-----------------------------------------------------------
+ et supprime tout ce qui est contenu a l'intérieur.
+
+
+* OptimisationFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.OptimisationFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ /*% et %*/
+-----------------------------------------------------------
+ tout ce qui n'est pas a l'exterieur de ce tag est supprimé et ce qui est dans
+ le tag est conservé tel quel.
+
+ L'intéret de ce filtre est de permettre la créer des fichiers XML qui permettra
+ la création de classe d'optimisation par la suite. Le XML décrivant les méthodes
+ et permettant de faire une classe fille a la classe qui contient les tags.
+
+-----------------------------------------------------------
+:inputFileName: (.*?).java
+:outputFileName: $1.optxml
+-----------------------------------------------------------
+
+* i18nFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.i18nFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ I18n._(" et ")
+-----------------------------------------------------------
+ tout ce qui n'est pas a l'exterieur de ce tag est supprimé et ce qui est dans
+ le tag est conservé tel quel et ce voit ajouter un signe *=* à la fin.
+
+ L'intéret de ce filtre est de pouvoir extraire les chaînes de texte à traduire
+ des fichiers sources. Les fichiers résultants sont de la forme des fichiers de
+ propriétés Java.
+
+-----------------------------------------------------------
+:inputFileName: (.*?).java
+:outputFileName: $1.i18n
+-----------------------------------------------------------
+
+* licenseFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.LicenseFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ /*##% et ##%*/
+-----------------------------------------------------------
+ tout ce qui n'est pas a l'exterieur de ce tag est conservé et ce qui est dans
+ le tag est replacé par la license donnée.
+
+ L'intéret de ce filtre est de pouvoir changer facilement la licence d'un code source java.
+
+* GeneratorTemplatesFilter
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.GeneratorTemplatesFilter
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ /*{ et }*/
+-----------------------------------------------------------
+ le contenu est alors lui même parsé avec le filtre GeneratorTemplatesFilterIn. Le résultat global est placé dans un::
+
+-----------------------------------------------------------
+ output.write("...<le contenu>...");
+-----------------------------------------------------------
+
+* GeneratorTemplatesFilterIn
+
+-----------------------------------------------------------
+:classe: org.nuiton.processor.filters.GeneratorTemplatesFilterIn
+-----------------------------------------------------------
+
+ Détecte les tags
+
+-----------------------------------------------------------
+ <% et %>
+-----------------------------------------------------------
+ dans le texte externe aux tags les guillemets sont coté ainsi que les retours
+ chariots de façon à ce que le texte puisse aller dans une chaîne de caractères
+ Java. Si le texte à l'intérieur des tags commence par un signe **=**, alors
+ il est remplacé par::
+
+-----------------------------------------------------------
+ "+ ...<contenu du tag sans le =>... +"
+-----------------------------------------------------------
+ Sinon il est remplacé par::
+
+-----------------------------------------------------------
+ ");
+ ...<contenu du tag>...
+ output.write("
+-----------------------------------------------------------
+
+Règle ant
+
+ Voici un exemple d'utilisation de la règle ant.
+
+-----------------------------------------------------------
+ <processor filters="org.nuiton.processor.filters.GeneratorTemplatesFilter,\
+ org.nuiton.processor.filters.GeneratorTemplatesFilter"
+ srcdir="${srcdir}"
+ destdir="${gendir}"
+ includes="**/*.java"
+ fileInPattern="(.*?).javap"
+ fileOutPattern="$1.java"
+ />
+-----------------------------------------------------------
+ Dans cette exemple, deux filtres seront appliqué, les fichiers qui seront
+ processés sont tous les fichiers java du répertoire ${srcdir} et les fichiers
+ résultants se retrouveront dans le répertoire ${gendir} et leur extension aura
+ été modifié de *.javap* en *.java*
+
+Plugin maven
+
+ Un plugin maven est disponnible à l'adresse suivante
+ {{{http://maven-site.nuiton.org/processor/maven-processor-plugin}maven-processor-plugin}} .
+ Il permet l'utilisation depuis maven de NuitonProcessor.
diff --git a/nuiton-processor/src/site/site.xml b/nuiton-processor/src/site/site.xml
new file mode 100644
index 0000000..ed75b0d
--- /dev/null
+++ b/nuiton-processor/src/site/site.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+ <links>
+ <item name="Maven-processor-plugin" href="../maven-processor-plugin/"/>
+ </links>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="${project.url}" />
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur">
+ <item href="/index.html" name="Accueil"/>
+
+ </menu>
+
+ <menu name="Téléchargement">
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Librairie (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
+ <item href="${repository.home.url}/org/nuiton/processor/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
+ </menu>
+
+ <menu name="Developpeur">
+ <item name="Todo" href="Todo.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ </body>
+</project>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..b0c78e4
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,122 @@
+<?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>org.nuiton</groupId>
+ <artifactId>mavenpom</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>processor</artifactId>
+ <version>1.0.0</version>
+
+ <modules>
+ <module>nuiton-processor</module>
+ <module>maven-processor-plugin</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>${helper.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- FIXME si on ne le rajoute pas, on se retrouve avec la version 1.1 qui ne convient pas -->
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.5.15</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- tests dependencies -->
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>${helper.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>${maven.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>nuiton-processor - pom</name>
+ <description>Efficient Universal Processor</description>
+ <inceptionYear>2004</inceptionYear>
+ <url>http://maven-site.nuiton.org/processor</url>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>pom</packaging>
+
+ <properties>
+ <!-- pour un muli module on doit fixer le projectId -->
+ <projectId>processor</projectId>
+
+ </properties>
+
+ <build>
+
+ <defaultGoal>install</defaultGoal>
+
+ </build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <!-- Source control management. -->
+ <scm>
+
+ <connection>scm:svn:http://svn.nuiton.org/svn/processor/tags/processor-1.0.0</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/processor/tags/processor-1.0.0</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/processor/tags/processor-1.0.0</url>
+ </scm>
+
+</project>
+
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100644
index 0000000..491d34e
--- /dev/null
+++ b/src/site/site.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${project.name}">
+
+ <publishDate format="dd/MM/yyyy"/>
+
+ <skin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-nuiton-skin</artifactId>
+ <version>1.0.0</version>
+ </skin>
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <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="${project.url}/images/logos/maven-feather.png"/>
+ </poweredBy>
+
+ <body>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="${project.url}" />
+ </breadcrumbs>
+
+ <menu ref="modules"/>
+
+ <menu ref="reports"/>
+ </body>
+</project>
--
To stop receiving notification emails like this one, please contact
nuiton.org SCM administrator <admin+scm(a)nuiton.org>.
1
0