Nuiton-utils-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
- 3157 discussions
[Lutinutil-commits] r1152 - lutinutil/trunk
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
03 Oct '08
Author: chatellier
Date: 2008-10-03 13:25:23 +0000 (Fri, 03 Oct 2008)
New Revision: 1152
Modified:
lutinutil/trunk/pom.xml
Log:
Correct failed release :(
Modified: lutinutil/trunk/pom.xml
===================================================================
--- lutinutil/trunk/pom.xml 2008-10-03 13:22:14 UTC (rev 1151)
+++ lutinutil/trunk/pom.xml 2008-10-03 13:25:23 UTC (rev 1152)
@@ -53,7 +53,7 @@
<!-- ************************************************************* -->
<name>Lutin utilities library</name>
- <version>0.31</version>
+ <version>0.31-SNAPSHOT</version>
<description>Library of usefull class to be used in any project.</description>
<inceptionYear>2004</inceptionYear>
@@ -77,9 +77,9 @@
<!--Source control management-->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutinutil/lutinutil/tags/lutinutil-0.31</connection>
- <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/lutinutil/lutinutil/tags/lutinutil-0.31</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutinutil/tags/…</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ <url>${maven.scm.url}</url>
</scm>
<build>
1
0
[Lutinutil-commits] r1151 - lutinutil/trunk
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
03 Oct '08
Author: chatellier
Date: 2008-10-03 13:22:14 +0000 (Fri, 03 Oct 2008)
New Revision: 1151
Modified:
lutinutil/trunk/pom.xml
Log:
[maven-release-plugin] prepare release lutinutil-0.31
Modified: lutinutil/trunk/pom.xml
===================================================================
--- lutinutil/trunk/pom.xml 2008-10-03 13:16:42 UTC (rev 1150)
+++ lutinutil/trunk/pom.xml 2008-10-03 13:22:14 UTC (rev 1151)
@@ -1,6 +1,5 @@
<?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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -54,7 +53,7 @@
<!-- ************************************************************* -->
<name>Lutin utilities library</name>
- <version>0.31-SNAPSHOT</version>
+ <version>0.31</version>
<description>Library of usefull class to be used in any project.</description>
<inceptionYear>2004</inceptionYear>
@@ -78,9 +77,9 @@
<!--Source control management-->
<scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutinutil/lutinutil/tags/lutinutil-0.31</connection>
+ <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/lutinutil/lutinutil/tags/lutinutil-0.31</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutinutil/tags/…</url>
</scm>
<build>
1
0
[Lutinutil-commits] r1150 - lutinutil/trunk/src/site
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
03 Oct '08
Author: chatellier
Date: 2008-10-03 13:16:42 +0000 (Fri, 03 Oct 2008)
New Revision: 1150
Modified:
lutinutil/trunk/src/site/site.xml
Log:
Set fr date format
Modified: lutinutil/trunk/src/site/site.xml
===================================================================
--- lutinutil/trunk/src/site/site.xml 2008-10-03 13:11:23 UTC (rev 1149)
+++ lutinutil/trunk/src/site/site.xml 2008-10-03 13:16:42 UTC (rev 1150)
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="${project.name}">
- <skin>
- <groupId>org.codelutin</groupId>
+ <publishDate format="dd/MM/yyyy"/>
+
+ <skin>
+ <groupId>org.codelutin</groupId>
<artifactId>maven-lutin-skin</artifactId>
<version>0.2</version>
</skin>
1
0
[Lutinutil-commits] r1149 - lutinutil/trunk/src/site
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
by chatellier@users.labs.libre-entreprise.org 03 Oct '08
03 Oct '08
Author: chatellier
Date: 2008-10-03 13:11:23 +0000 (Fri, 03 Oct 2008)
New Revision: 1149
Removed:
lutinutil/trunk/src/site/xdoc/
Log:
Remove xdoc
1
0
[Lutinutil-commits] r1148 - in lutinutil/trunk: . src/site src/site/fr src/site/xdoc
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
02 Oct '08
Author: chatellier
Date: 2008-10-02 17:21:19 +0000 (Thu, 02 Oct 2008)
New Revision: 1148
Added:
lutinutil/trunk/src/site/fr/
Removed:
lutinutil/trunk/src/site/xdoc/fr/
Modified:
lutinutil/trunk/
Log:
Move site
Property changes on: lutinutil/trunk
___________________________________________________________________
Name: svn:ignore
- target
velocity.log
maven.log
.eclipse
.classpath
lutinutil.iml
lutinutil.ipr
lutinutil.iws
.project
.settings
+ target
velocity.log
maven.log
.eclipse
.classpath
lutinutil.iml
lutinutil.ipr
lutinutil.iws
.project
.settings
THIRD-PARTY.txt
Copied: lutinutil/trunk/src/site/fr (from rev 1145, lutinutil/trunk/src/site/xdoc/fr)
Property changes on: lutinutil/trunk/src/site/fr
___________________________________________________________________
Name: svn:mergeinfo
+
1
0
[Lutinutil-commits] r1147 - in lutinutilextra/trunk: . src src/main src/main/java src/main/java/org/codelutin/profiling src/site src/site/rst
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
02 Oct '08
Author: chatellier
Date: 2008-10-02 16:38:12 +0000 (Thu, 02 Oct 2008)
New Revision: 1147
Added:
lutinutilextra/trunk/src/main/
lutinutilextra/trunk/src/main/java/
lutinutilextra/trunk/src/site/
lutinutilextra/trunk/src/site/rst/
Removed:
lutinutilextra/trunk/doc/
lutinutilextra/trunk/site/
lutinutilextra/trunk/src/java/
Modified:
lutinutilextra/trunk/LICENSE.txt
lutinutilextra/trunk/changelog
lutinutilextra/trunk/pom.xml
lutinutilextra/trunk/src/main/java/org/codelutin/profiling/LutinTrace.java
lutinutilextra/trunk/src/site/rst/Todo.rst
lutinutilextra/trunk/src/site/site.xml
Log:
LGPLv3
UTF-8
Move SVN structure
maven 2 layout
Modified: lutinutilextra/trunk/LICENSE.txt
===================================================================
--- lutinutilextra/trunk/LICENSE.txt 2008-10-02 16:13:44 UTC (rev 1146)
+++ lutinutilextra/trunk/LICENSE.txt 2008-10-02 16:38:12 UTC (rev 1147)
@@ -1,280 +1,166 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 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.
- Preamble
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
+ 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.
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ 0. Additional Definitions.
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+ 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.
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
+ 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.
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
+ 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".
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+ 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 precise terms and conditions for copying, distribution and
-modification follow.
+ 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.
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ 1. Exception to Section 3 of the GNU GPL.
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
+ 2. Conveying Modified Versions.
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
+ 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:
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
+ 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
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
+ 3. Object Code Incorporating Material from Library Header Files.
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
+ 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:
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
+ 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.
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
+ 4. Combined Works.
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
+ 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:
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one 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.
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
+ 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.
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
+ d) Do one of the following:
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
+ 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.
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
+ 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.
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
+ 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. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
+ 5. Combined Libraries.
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
+ 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:
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
+ 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.
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
+ 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.
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
+ 6. Revised Versions of the GNU Lesser General Public License.
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this 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.
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
+ 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.
- 9. The Free Software Foundation may publish revised and/or new versions
-of the 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.
+ 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.
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
Modified: lutinutilextra/trunk/changelog
===================================================================
--- lutinutilextra/trunk/changelog 2008-10-02 16:13:44 UTC (rev 1146)
+++ lutinutilextra/trunk/changelog 2008-10-02 16:38:12 UTC (rev 1147)
@@ -1,3 +1,8 @@
+ver-0-2
+ * LGPLv3
+ * UTF-8
+ * Move SVN structure
+ * maven 2 layout
+
ver-0-1
-
* premier version contient seulement LutinTrace
Modified: lutinutilextra/trunk/pom.xml
===================================================================
--- lutinutilextra/trunk/pom.xml 2008-10-02 16:13:44 UTC (rev 1146)
+++ lutinutilextra/trunk/pom.xml 2008-10-02 16:38:12 UTC (rev 1147)
@@ -7,9 +7,9 @@
<!--lutinproject.xml-->
<parent>
- <groupId>lutinlib</groupId>
+ <groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>2.0</version>
+ <version>3.0</version>
</parent>
<!--A unique name for this project-->
@@ -20,7 +20,7 @@
<packaging>jar</packaging>
<!--Version-->
- <version>0.1</version>
+ <version>0.2-SNAPSHOT</version>
<!--Description-->
<description>
@@ -28,32 +28,35 @@
</description>
<inceptionYear>2006</inceptionYear>
- <!--Tracking-->
- <issueManagement>
- <url>http://labs.libre-entreprise.org/tracker/?group_id=12</url>
- </issueManagement>
+ <!-- properties -->
+ <properties>
+ <!-- id du projet du labs -->
+ <labs.id>12</labs.id>
+ <!-- nom du projet sur le labs -->
+ <labs.project>lutinutil</labs.project>
+ </properties>
+ <!--Source control management-->
+ <scm>
+ <url>${maven.scm.url}</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ </scm>
+
<!--Librairies-->
<dependencies>
-<!--
+
<dependency>
- <groupId>lutinlib</groupId>
- <artifactId>lutinutil</artifactId>
- <version>[0.23,]</version>
- <scope>compile</scope>
- </dependency>
--->
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>[1.0.3,]</version>
+ <version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>[2.1,]</version>
+ <version>2.4</version>
<scope>compile</scope>
</dependency>
@@ -77,64 +80,6 @@
<version>2.0</version>
<scope>compile</scope>
</dependency>
-<!--
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>[1.6.1,]</version>
- <scope>compile</scope>
- </dependency>
--->
</dependencies>
- <!--
- | surcharge des valeurs par defaut
- +-->
- <mailingLists>
- <mailingList>
- <name>lutinutil-devel</name>
- <subscribe>http://lists.labs.libre-entreprise.org/mailman/listinfo/lutinutil-devel</subscribe>
- <unsubscribe>http://lists.labs.libre-entreprise.org/mailman/listinfo/lutinutil-devel</unsubscribe>
- <archive>http://lists.labs.libre-entreprise.org/pipermail/lutinutil-devel/</archive>
- </mailingList>
- <mailingList>
- <name>lutinutil-user</name>
- <subscribe>http://lists.labs.libre-entreprise.org/mailman/listinfo/lutinutil-user</subscribe>
- <unsubscribe>http://lists.labs.libre-entreprise.org/mailman/listinfo/lutinutil-user</unsubscribe>
- <archive>http://lists.labs.libre-entreprise.org/pipermail/lutinutil-user/</archive>
- </mailingList>
- </mailingLists>
-
- <scm>
- <url>http://cvs.labs.libre-entreprise.org/cgi-bin/cvsweb.cgi/?cvsroot=lutinutil</url>
- <connection>scm:cvs:pserver:anonymous@cvs.labs.libre-entreprise.org:/cvsroot/lutinutil:${pom.artifactId}
- </connection>
- </scm>
-
- <profiles>
- <profile>
- <id>project</id>
-
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
-
- <properties>
- <!--Source base dir-->
- <maven.src.dir>${basedir}/src</maven.src.dir>
-
- <!--Test-->
- <maven.test.skip>true</maven.test.skip>
-
- <!--Compile with ?-->
- <maven.compile.source>1.5</maven.compile.source>
- <maven.compile.target>1.5</maven.compile.target>
-
- <!--Main class in JAR -->
- <maven.jar.main.class>org.codelutin.util.Resource</maven.jar.main.class>
- </properties>
- </profile>
- </profiles>
-
-
</project>
Copied: lutinutilextra/trunk/src/main/java (from rev 1145, lutinutilextra/trunk/src/java)
Property changes on: lutinutilextra/trunk/src/main/java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: lutinutilextra/trunk/src/main/java/org/codelutin/profiling/LutinTrace.java
===================================================================
--- lutinutilextra/trunk/src/java/org/codelutin/profiling/LutinTrace.java 2008-09-29 08:49:13 UTC (rev 1145)
+++ lutinutilextra/trunk/src/main/java/org/codelutin/profiling/LutinTrace.java 2008-10-02 16:38:12 UTC (rev 1147)
@@ -1,33 +1,19 @@
/* *##%
-* Copyright (C) 2006
-* Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*##%*/
-
-/* *
- * Trace.aj
+ * Copyright (C) 2006 - 2008 CodeLutin
*
- * Created: 25 août 06 22:19:21
+ * 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.
*
- * @author poussin
- * @version $Revision$
+ * 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.
*
- * Last update: $Date$
- * by : $Author$
- */
+ * 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.codelutin.profiling;
Copied: lutinutilextra/trunk/src/site (from rev 1145, lutinutilextra/trunk/site)
Property changes on: lutinutilextra/trunk/src/site
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: lutinutilextra/trunk/src/site/rst (from rev 1145, lutinutilextra/trunk/doc)
Property changes on: lutinutilextra/trunk/src/site/rst
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: lutinutilextra/trunk/src/site/rst/Todo.rst
===================================================================
--- lutinutilextra/trunk/doc/Todo.rst 2008-09-29 08:49:13 UTC (rev 1145)
+++ lutinutilextra/trunk/src/site/rst/Todo.rst 2008-10-02 16:38:12 UTC (rev 1147)
@@ -0,0 +1,2 @@
+TODO
+====
\ No newline at end of file
Modified: lutinutilextra/trunk/src/site/site.xml
===================================================================
--- lutinutilextra/trunk/site/site.xml 2008-09-29 08:49:13 UTC (rev 1145)
+++ lutinutilextra/trunk/src/site/site.xml 2008-10-02 16:38:12 UTC (rev 1147)
@@ -17,20 +17,21 @@
</bannerRight>
<body>
+
<links>
<item name="Labs" href="http://labs.libre-entreprise.org/"/>
<item name="Code Lutin" href="http://www.codelutin.com/"/>
</links>
- ${reports}
-
<menu name="Utilisateur">
- <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinlib/lutinutil/" name="T�l�chargement"/>
+ <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/org/codelutin/lutinuti…" name="T�l�chargement"/>
</menu>
- <menu name="Developpeur">
+ <menu name="Developpeur">
<item name="Todo" href="Todo.html"/>
</menu>
+ ${reports}
+
</body>
</project>
1
0
[Lutinutil-commits] r1146 - lutinutilextra/trunk
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
by chatellier@users.labs.libre-entreprise.org 02 Oct '08
02 Oct '08
Author: chatellier
Date: 2008-10-02 16:13:44 +0000 (Thu, 02 Oct 2008)
New Revision: 1146
Modified:
lutinutilextra/trunk/
Log:
svn:ignore
Property changes on: lutinutilextra/trunk
___________________________________________________________________
Name: svn:ignore
- maven.log
target
velocity.log
+ maven.log
target
velocity.log
.settings
.classpath
.project
1
0
[Lutinutil-commits] r1145 - in maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin: . parser parser/event parser/impl
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
29 Sep '08
Author: ruchaud
Date: 2008-09-29 08:49:13 +0000 (Mon, 29 Sep 2008)
New Revision: 1145
Added:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserEvent.java
Removed:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java
Modified:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java
Log:
D?\195?\169placement des fichiers dans la nouvelle arborescence (correction)
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -18,7 +18,7 @@
package org.codelutin.i18n.plugin;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import org.apache.maven.plugin.AbstractMojo;
import org.codelutin.i18n.plugin.PluginHelper;
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -19,7 +19,7 @@
import org.codelutin.i18n.plugin.SourceEntry;
import org.codelutin.i18n.plugin.AbstractI18nPlugin;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codelutin.i18n.plugin.PluginHelper;
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserEvent.java (from rev 1143, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserEvent.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserEvent.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -0,0 +1,59 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser;
+
+import java.io.File;
+
+/**
+ * Permet d'ajouter des évènements sur les parsers
+ *
+ * @author julien
+ */
+public interface ParserEvent {
+
+ /**
+ * M�thode appelée quand on change de fichier parsé
+ *
+ * @param file
+ */
+ public void eventChangeFile(File file);
+
+ /**
+ * Méthode appelée après le parsing du fichier
+ *
+ * @param file
+ */
+ public void eventNextFile(File file);
+
+ /**
+ * M�thode appelée quand on change de clé
+ *
+ * @param keyI18n
+ * @param newKey
+ */
+ public void eventChangeKey(String keyI18n, boolean newKey);
+
+ /**
+ * M�thode appelée pour récupérer la nouvelle valeur de clé
+ *
+ * @return
+ */
+ public String eventGetRealKey();
+
+}
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -18,7 +18,7 @@
package org.codelutin.i18n.plugin.parser.event;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import org.codelutin.i18n.plugin.parser.ParserException;
import org.codelutin.util.FileUtil;
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -1,59 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.event;
-
-import java.io.File;
-
-/**
- * Permet d'ajouter des évènements sur les parsers
- *
- * @author julien
- */
-public interface ParserEvent {
-
- /**
- * M�thode appelée quand on change de fichier parsé
- *
- * @param file
- */
- public void eventChangeFile(File file);
-
- /**
- * Méthode appelée après le parsing du fichier
- *
- * @param file
- */
- public void eventNextFile(File file);
-
- /**
- * M�thode appelée quand on change de clé
- *
- * @param keyI18n
- * @param newKey
- */
- public void eventChangeKey(String keyI18n, boolean newKey);
-
- /**
- * M�thode appelée pour récupérer la nouvelle valeur de clé
- *
- * @return
- */
- public String eventGetRealKey();
-
-}
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -20,7 +20,7 @@
import org.apache.maven.project.MavenProject;
import org.codelutin.i18n.plugin.parser.AbstractI18nParser;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import org.codelutin.i18n.plugin.parser.ParserException;
import org.codelutin.processor.filters.I18nFilter;
import org.codelutin.util.FileUpdaterHelper;
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -17,7 +17,7 @@
* <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */
package org.codelutin.i18n.plugin.parser.impl;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import java.io.File;
import java.util.regex.Matcher;
Modified: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java 2008-09-29 08:47:23 UTC (rev 1144)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java 2008-09-29 08:49:13 UTC (rev 1145)
@@ -19,7 +19,7 @@
package org.codelutin.i18n.plugin.parser.impl;
import org.codelutin.i18n.plugin.parser.AbstractI18nParser;
-import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserEvent;
import org.codelutin.i18n.plugin.parser.ParserException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
1
0
[Lutinutil-commits] r1144 - maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
29 Sep '08
Author: ruchaud
Date: 2008-09-29 08:47:23 +0000 (Mon, 29 Sep 2008)
New Revision: 1144
Removed:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/
Log:
Suppression de l'ancienne arborescence
1
0
[Lutinutil-commits] r1143 - in maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin: . core extension parser parser/event parser/impl ui
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
by ruchaud@users.labs.libre-entreprise.org 29 Sep '08
29 Sep '08
Author: ruchaud
Date: 2008-09-29 08:45:36 +0000 (Mon, 29 Sep 2008)
New Revision: 1143
Added:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Generate.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Getter.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/SourceEntry.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/Parser.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserException.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaTabConfig.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJaxx.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserSwixat.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java
Removed:
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Generate.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Getter.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Parser.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java
maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java
Log:
D?\195?\169placement des fichiers dans la nouvelle arborescence
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/AbstractI18nPlugin.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,161 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin;
+
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.apache.maven.plugin.AbstractMojo;
+import org.codelutin.i18n.plugin.PluginHelper;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Classe permettant d'obenir les parametres pendant les différentes phases
+ * du plugin.
+ *
+ * @author julien
+ */
+public abstract class AbstractI18nPlugin extends AbstractMojo {
+
+ /**
+ * Langues des bundles generes.
+ *
+ * @parameter expression="${i18n.bundles}" default-value=""
+ * @required
+ */
+ protected String[] bundles;
+
+ /**
+ * Repertoire sources des fichiers i18n.
+ *
+ * @parameter expression="${i18n.src}" default-value="${basedir}/src/resources/i18n"
+ * @required
+ */
+ protected File src;
+
+ /**
+ * Repertoire des fichiers generes i18n.
+ *
+ * @parameter expression="${i18n.out}" default-value="${basedir}/target/gen/i18n"
+ * @required
+ */
+ protected File out;
+
+ /**
+ * Nom du projet.
+ *
+ * @parameter expression="${i18n.artifactId}" default-value="${project.artifactId}"
+ * @readonly
+ */
+ protected String artifactId;
+
+ /**
+ * encoding a utiliser pour charger et sauver les bundles
+ *
+ * @parameter expression="${i18n.encoding}" default-value="${maven.compile.encoding}"
+ * @required
+ */
+ protected String encoding;
+
+ /**
+ * Met les fichiers generes dans le repertoire des sources i18n.
+ *
+ * @parameter expression="${i18n.genSrc}" default-value="true"
+ */
+ protected boolean genSrc;
+
+ /**
+ * Active la modification de cle
+ *
+ * @parameter expression="${i18n.keysModifier}" default-value="false"
+ */
+ protected boolean keysModifier;
+
+ /**
+ * verbose flag
+ *
+ * @parameter expression="${i18n.verbose}" default-value="false"
+ */
+ protected boolean verbose;
+
+ /**
+ * conserve les anciens fichiers de traduction avec un suffix ~
+ *
+ * @parameter expression="${i18n.keepBackup}" default-value="true"
+ */
+ protected boolean keepBackup;
+
+ /**
+ * ne conserve que les clef scannees (et donc traite tous les fichiers)
+ *
+ * @parameter expression="${i18n.strictMode}" default-value="false"
+ */
+ protected boolean strictMode;
+
+ /**
+ * Répertoire de stockage des fichiers i18n pour la recuperation des fichiers
+ * de traduction entre librairie
+ */
+ protected static String DIRECTORY_INSTALL = "i18n" + File.separatorChar;
+
+ /** Liste des évènements */
+ protected List<ParserEvent> events = new ArrayList<ParserEvent>();
+
+ /**
+ * Ajoute un évènement
+ *
+ * @param parserEvent l'évènement d'ajout
+ */
+ protected void addParserEvent(ParserEvent parserEvent) {
+ this.events.add(parserEvent);
+ }
+
+ /**
+ * Supprime un évènement
+ *
+ * @param parserEvent l'évènement de suppression
+ */
+ protected void removeParserEvent(ParserEvent parserEvent) {
+ this.events.remove(parserEvent);
+ }
+
+ /**
+ * Construit une chaine de log formatée.
+ *
+ * @param msg le prefix du message
+ * @param nbFiles le nombre de fichiers actuellement traités
+ * @param time le time de traitement de ce fichier
+ * @param all le temps de traitement de tous les fichiers
+ * @return la chaine de log formatée
+ */
+ protected String getLogEntry(String msg, int nbFiles, long time, long all) {
+ long now = System.nanoTime();
+ long delta = now - time;
+ String s = "[" + artifactId + "] i18n." + getClass().getSimpleName() + " : " + msg;
+ if (time > 0) {
+ s += " (" + PluginHelper.convertTime(delta) + ")";
+ }
+ if (all > 0 && nbFiles > -1) {
+ s += "(total time:" + PluginHelper.convertTime(now - all) + ") ( ~ " + PluginHelper.convertTime(((now - all) / (nbFiles + 1))) + " / file)";
+ }
+ return s;
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Generate.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Generate.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Generate.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Generate.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,106 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codelutin.i18n.plugin.PluginHelper;
+import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
+import org.codelutin.util.FileUtil;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * Merge des fichiers de propriétés avec les anciens.
+ *
+ * @author julien
+ * @goal gen
+ * @phase generate-resources
+ * @execute goal=get
+ */
+public class Generate extends AbstractI18nPlugin {
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.maven.plugin.AbstractMojo#execute()
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ for (String bundle : bundles) {
+ try {
+ // Merge
+ File bundleSrc = PluginHelper.getI18nFile(src, artifactId, bundle, false);
+ File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false);
+
+ if (bundleSrc.exists()) {
+
+ I18nProperties propertiesSrc = new I18nProperties(encoding).load(bundleSrc);
+
+ I18nProperties propertiesOut = new I18nProperties(encoding);
+
+ if (!strictMode) {
+ // push back in bundle out, all the bundle src keys
+ propertiesOut.putAll(propertiesSrc);
+ }
+ propertiesOut.load(bundleOut);
+
+ // Parcours des clés
+ for (Object key : propertiesOut.keySet()) {
+ Object oldKey = propertiesOut.get(key);
+ Object value = propertiesSrc.get(oldKey);
+
+ // Récupération de la clé si elle a été renommée
+ if (!key.equals(oldKey) && value == null) {
+ value = propertiesSrc.get(key);
+ }
+
+ if (value != null) {
+ propertiesOut.put(key, value);
+ } else {
+ propertiesOut.put(key, "");
+ }
+ }
+
+ //fixme : on devrait laisser le fichier en utf8 ?
+ //propertiesOut.store(bundleOut);
+ propertiesOut.store(new FileOutputStream(bundleOut));
+
+ // Sauvegarde avant copie
+ if (genSrc && keepBackup) {
+ FileUtil.copy(bundleSrc, PluginHelper.getI18nFileBackup(src, artifactId, bundle));
+ }
+
+ getLog().info("Merge bundle " + bundleSrc.getAbsolutePath());
+ }
+
+ if (genSrc) {
+ // Copie des fichiers dans les sources
+ FileUtil.copy(bundleOut, bundleSrc);
+ getLog().info("Copy bundle " + bundleSrc.getAbsolutePath());
+ }
+
+ } catch (IOException e) {
+ getLog().error("File Error I/O ", e);
+ throw new MojoFailureException("File Error I/O ");
+ }
+ }
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Getter.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Getter.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Getter.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/Getter.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,95 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codelutin.i18n.plugin.PluginHelper;
+import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
+import org.codelutin.util.FileUtil;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/**
+ * Recupere les différents fichiers des parsers en un fichier de proprietes.
+ *
+ * @author julien
+ * @goal get
+ * @phase generate-resources
+ */
+public class Getter extends AbstractI18nPlugin {
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.maven.plugin.AbstractMojo#execute()
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ File bundleGetters = new File(out.getAbsolutePath() + File.separatorChar + artifactId + ".properties");
+ bundleGetters.createNewFile();
+
+ DirectoryScanner ds = new DirectoryScanner();
+ ds.setBasedir(out);
+ ds.setIncludes(new String[]{"*.getter"});
+ ds.scan();
+ String[] files = ds.getIncludedFiles();
+
+ // Fusion des fichiers propriétés des différents parsers
+ for (String file : files) {
+ File bundleGetter = PluginHelper.getGetterFile(out, file, false);
+ concactProperties(bundleGetter, bundleGetters);
+ if (genSrc) {
+ bundleGetter.delete();
+ }
+ getLog().info("Create bundle with " + bundleGetter.getAbsolutePath());
+ }
+
+ // Création des bundles
+ for (String bundle : bundles) {
+ File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false);
+ FileUtil.copy(bundleGetters, bundleOut);
+ getLog().info("Generate bundle " + bundleOut.getAbsolutePath());
+ }
+
+ bundleGetters.delete();
+ } catch (IOException e) {
+ getLog().error("File Error I/O ", e);
+ throw new MojoFailureException("File Error I/O");
+ }
+ }
+
+ /**
+ * Concatene deux fichiers de proprietes
+ *
+ * @param in le fichier entrant
+ * @param out le fichier sortant
+ * @throws FileNotFoundException si fichier non trouvé
+ * @throws IOException si problème pendant la sauvegarde
+ */
+ protected void concactProperties(File in, File out) throws IOException {
+ I18nProperties propertiesIn = new I18nProperties(encoding).load(in);
+
+ I18nProperties propertiesOut = new I18nProperties(encoding).load(out);
+ propertiesOut.putAll(propertiesIn);
+ propertiesOut.store(out);
+ }
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/SourceEntry.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/SourceEntry.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/SourceEntry.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,217 @@
+/*
+* *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+import java.io.File;
+import java.lang.annotation.Annotation;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A simple model for a sourceEntry represents by a basedir and includes and/or exlucdes pattern.
+ * <p/>
+ * The class offers the usefull method :
+ * {@link #getIncludedFiles(File, String[], String[])}
+ * <p/>
+ * to obtain the list of files from
+ * the {@link #basedir} directory which respects the {@link #includes} and/or
+ * {@link #excludes} patterns using an internal {@link DirectoryScanner} object.
+ * <p/>
+ * Note : <b>The class does not extends <code>DirectoryScanner</code> since we DO not want
+ * to expose his methods.</b>
+ *
+ * @author tony
+ */
+public class SourceEntry {
+ /**
+ * If you want to restrict use of the entry, set the class name goal to
+ * this property via {@link #setSpecificGoal(String)}.
+ * <p/>
+ * If let to <code>null</code>, all goals can use this entry.
+ */
+ protected String specificGoal = null;
+
+ protected File basedir;
+
+ protected String[] includes;
+
+ protected String[] excludes;
+
+ public String[] getExcludes() {
+ return excludes;
+ }
+
+ public void setExcludes(String[] excludes) {
+ this.excludes = excludes;
+ }
+
+ public String[] getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(String[] includes) {
+ this.includes = includes;
+ }
+
+ public File getBasedir() {
+ return basedir;
+ }
+
+ public void setBasedir(File basedir) {
+ this.basedir = basedir;
+ }
+
+ public String getSpecificGoal() {
+ return specificGoal;
+ }
+
+ public void setSpecificGoal(String specificGoal) {
+ this.specificGoal = specificGoal;
+ }
+
+ public boolean useForGoal(String goal) {
+ return specificGoal == null || specificGoal.equalsIgnoreCase(goal);
+ }
+
+ public boolean hasSrc() {
+ return basedir != null;
+ }
+
+ public boolean hasIncludes() {
+ return includes != null && includes.length > 0;
+ }
+
+ public boolean hasExcludes() {
+ return excludes != null && excludes.length > 0;
+ }
+
+ public String[] getIncludedFiles(File defaultBasedir, String[] defaultIncludes, String[] defaultExcludes) {
+ // normalized entry
+ if (!hasSrc()) {
+ setBasedir(defaultBasedir);
+ }
+ if (!hasIncludes()) {
+ setIncludes(defaultIncludes);
+ }
+ if (!hasExcludes()) {
+ setExcludes(defaultExcludes);
+ }
+ // init directory scanner
+ DirectoryScanner ds = new DirectoryScanner();
+ ds.setBasedir(getBasedir());
+ ds.setIncludes(getIncludes());
+ if (hasExcludes()) {
+ ds.setExcludes(getExcludes());
+ }
+ // scan
+ ds.scan();
+ // get found files
+ String[] foundFiles;
+ foundFiles = ds.getIncludedFiles();
+ return foundFiles;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("basedir:").append(basedir);
+ if (includes != null) {
+ sb.append(", includes:").append(Arrays.toString(includes));
+ }
+ if (excludes != null) {
+ sb.append(", excludes:").append(Arrays.toString(excludes));
+ }
+ return sb.toString();
+ }
+
+ public String[] getIncludedFiles(File basedir, String[] defaultIncludes, String[] defaultExcludes, URLClassLoader loader, List<String> annotationClass, Log log) {
+ List<String> result = new ArrayList<String>();
+
+ for (String s : getIncludedFiles(basedir, defaultIncludes, defaultExcludes)) {
+ if (filterByAnnotation(s, loader, annotationClass, log)) {
+ result.add(s);
+ }
+ }
+ return result.toArray(new String[result.size()]);
+ }
+
+ protected boolean filterByAnnotation(String file, URLClassLoader loader, List<String> annotationClass, Log log) {
+
+
+ Annotation annotation = getAnnotation(file, loader, annotationClass, log);
+
+ boolean result = annotation != null;
+
+ if (result && log.isDebugEnabled()) {
+ log.debug("find i18n annotated file : " + file);
+ }
+ return result;
+ }
+
+ protected String getFQN(String file) {
+ String filePath = file;
+ filePath = filePath.substring(0, filePath.length() - ".java".length());
+ String replaceEx = File.separator.equals("\\") ? "\\\\" : File.separator;
+ return filePath.replaceAll(replaceEx, ".");
+ }
+
+ public Class getClass(String file, URLClassLoader loader, Log log) {
+ String fqn = getFQN(file);
+ try {
+ return loader.loadClass(fqn);
+
+ } catch (Throwable e) {
+ log.warn("could not find class " + fqn + " " + e);
+ return null;
+ }
+ }
+
+ public Annotation getAnnotation(String file, URLClassLoader loader, List<String> annotationClass, Log log) {
+
+ Class<?> currentClass = getClass(file, loader, log);
+
+ try {
+ Annotation[] annos = currentClass.getAnnotations();
+ if (annos != null && annos.length > 0) {
+ for (Annotation anno : annos) {
+ if (annotationClass.contains(anno.annotationType().getName())) {
+ return anno;
+ }
+ }
+ }
+ } catch (Throwable e) {
+ log.warn("could not find annotation for " + file + " " + e);
+ }
+ return null;
+
+ }
+
+ public Class getClass(File file, URLClassLoader loader, Log log) {
+ String f = file.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1);
+ return getClass(f, loader, log);
+ }
+
+ public Annotation getAnnotation(File file, URLClassLoader loader, List<String> annotationClass, Log log) {
+ String f = file.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1);
+ return getAnnotation(f, loader, annotationClass, log);
+ }
+
+}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,273 +0,0 @@
-/*
-* *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.codelutin.i18n.plugin.PluginHelper;
-import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
-import org.codelutin.i18n.plugin.ui.KeysModifier;
-import org.codelutin.util.FileUpdater;
-import org.codelutin.util.FileUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Abstract implementation for parsing goal.
- *
- * @author tony
- */
-public abstract class AbstractI18nParser extends AbstractI18nPlugin implements Parser {
-
- /** @return the outGetter to use for the instance (java.getter,...) */
- protected abstract String getOutGetter();
-
- /** @return the starting regex expression to catch keys in key modifier */
- protected abstract String getKeyModifierStart();
-
- /** @return the ending regex expression to catch keys in key modifier */
- protected abstract String getKeyModifierEnd();
-
- /** @return the default includes to add to directory scanner */
- protected abstract String[] getDefaultIncludes();
-
- /** @return the default excludes to add to directory scanner */
- protected abstract String[] getDefaultExcludes();
-
- /** @return the default src directory to use in directory scanner */
- protected abstract File getDefaultBasedir();
-
- /**
- * treate default entry
- *
- * @parameter expression="${i18n.treateDefault}" default-value="true"
- */
- protected boolean treateDefaultEntry;
-
- /**
- * Source entries (src+includes+excludes) .
- *
- * @parameter expression="${i18n.entries}"
- */
- protected SourceEntry[] entries;
-
- protected I18nProperties result;
-
- protected I18nProperties oldParser;
-
- protected I18nProperties oldLanguage;
- protected int fileTreated = 0;
- protected long t0;
-
- protected boolean touchFile;
- protected List<File> treadedFiles;
-
- protected SourceEntry currentEntry;
-
- protected FileUpdater updater;
-
- public void init() {
- t0 = System.nanoTime();
- result = new I18nProperties(encoding);
- oldParser = new I18nProperties(encoding);
- oldLanguage = new I18nProperties(encoding);
- out.mkdirs();
- // evenements
- if (keysModifier) {
- addParserEvent(KeysModifier.getInstance(getKeyModifierStart(), getKeyModifierEnd(), encoding));
- }
- treadedFiles = new ArrayList<File>();
- }
-
- /**
- * Test if a file is up to date and not to be treated.
- * <p/>
- * This method is called on a file only in not {@link #strictMode}.
- * <p/>
- * If {@link #updater} is null, then it considers that file as always to be treated.
- *
- * @param file the file path to test
- * @return <code>true</code> if file is up to date and do not need to be parsed
- * @see FileUpdater
- */
- protected final boolean isFileUptodate(File file) {
- return updater != null && updater.isFileUpToDate(file);
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.maven.plugin.AbstractMojo#execute()
- */
- public void execute() throws MojoExecutionException, MojoFailureException {
-
- init();
- if (entries == null || entries.length == 0 && !treateDefaultEntry) {
- // nothing to do
- return;
- }
- try {
- // Reprise sur un ancien parsing
- File oldParserFile = PluginHelper.getGetterFile(out, getOutGetter(), true);
- File saveFile = PluginHelper.getGetterFileBackup(out, getOutGetter());
-
- oldParser.load(oldParserFile);
- FileUtil.copy(oldParserFile, saveFile);
-
- // Anciennes cles disponnibles
- //fixme : pourquoi on utilise un bundle precis ? le premier ici, je ne comprends pas
- File oldLanguageFile = PluginHelper.getI18nFile(src, artifactId, bundles[0], true);
-
- oldLanguage.load(oldLanguageFile);
-
- // Parsing
- parse();
-
- // Suppression du fichier sauvegarder
- saveFile.delete();
-
- int i = treadedFiles.size();
- getLog().info(getLogEntry(" success <getter:" + getOutGetter() + "> [treated file(s) : " + i + '/' + fileTreated + "]", fileTreated, 0, t0));
-
- } catch (Exception e) {
- getLog().error("Error code parsing ", e);
- throw new MojoFailureException("Error code parsing");
- }
-
- }
-
- /**
- * launch the parse on every given entries.
- *
- * @throws IOException if any io pb
- */
- public void parse() throws IOException {
- if (treateDefaultEntry) {
- addDefaultEntry();
- }
- long t00 = System.nanoTime();
- for (SourceEntry entry : entries) {
- if (!entry.useForGoal(getClass().getSimpleName())) {
- if (verbose) {
- getLog().debug("skip entry " + entry.toString());
- }
- continue;
- }
- currentEntry = entry;
- // get found files
- String[] foundFiles = getFilesForEntry(entry);
- long t000 = System.nanoTime();
- if (verbose) {
- getLog().debug(getLogEntry(" parse <" + entry + "> [incoming file(s) : " + foundFiles.length + "]", 0, 0, 0));
- } else {
- getLog().info(getLogEntry(" parse <" + entry.getBasedir() + "> [incoming file(s) : " + foundFiles.length + "]", 0, 0, 0));
- }
- // launch parser for found files
- parseEntry(entry.getBasedir(), foundFiles);
- fileTreated += foundFiles.length;
- if (verbose) {
- getLog().debug(getLogEntry(" success <" + entry.getBasedir() + "> [treated file(s) : " + foundFiles.length + "]", foundFiles.length - 1, t000, t00));
- }
- t00 = System.nanoTime();
- }
- }
-
- /**
- * Obtain all the relative path of files to treate for a given entry.
- *
- * @param entry the given entry
- * @return the list of relative path of files for the given entry
- */
- protected String[] getFilesForEntry(SourceEntry entry) {
- return entry.getIncludedFiles(getDefaultBasedir(), getDefaultIncludes(), getDefaultExcludes());
- }
-
- /**
- * Add the default entry to entries given in configuration.
- * <p/>
- * This is a convinient method to simplify the configuration of the plugin.
- */
- protected void addDefaultEntry() {
- List<SourceEntry> list;
-
- if (entries == null || entries.length == 0) {
- list = new ArrayList<SourceEntry>();
- } else {
- list = new ArrayList<SourceEntry>(Arrays.asList(entries));
- }
- list.add(new SourceEntry());
- entries = list.toArray(new SourceEntry[list.size()]);
- }
-
- /**
- * launch parsing on a given entry.
- *
- * @param basedir the basedir of the entry
- * @param files the relative path of files to be treated for the entry.
- * @throws IOException if any io pb.
- */
- protected void parseEntry(File basedir, String[] files) throws IOException {
- long t00 = System.nanoTime();
- for (int i = 0; i < files.length; i++) {
- String file1 = files[i];
- long t000 = System.nanoTime();
- String fileName = basedir.getAbsolutePath() + File.separator + file1;
- File file = new File(fileName);
- for (ParserEvent event : events) {
- event.eventChangeFile(file);
- }
- touchFile = false;
- int size = result.size();
- if (strictMode || !isFileUptodate(file)) {
- // on parse toujours en mode strict ou quand le fichier n'est pas à jour
- getLog().info("parseFile " + file);
- parseFile(file);
- }
-
- // Detection de nouvelles cles, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage
- if (size != result.size()) {
- saveGetterFile();
- }
- if (touchFile) {
- if (verbose) {
- getLog().info("touched file " + file);
- }
- treadedFiles.add(file);
- if (verbose) {
- getLog().debug(getLogEntry(fileName, i, t000, t00));
- }
- }
- for (ParserEvent event : events) {
- event.eventNextFile(file);
- }
- }
- }
-
- /**
- * Save the result in the getter file.
- *
- * @throws IOException if any io pb
- */
- protected void saveGetterFile() throws IOException {
- File getterFile = PluginHelper.getGetterFile(out, getOutGetter(), false);
- result.store(getterFile);
- }
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,160 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.codelutin.i18n.plugin.PluginHelper;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Classe permettant d'obenir les parametres pendant les différentes phases
- * du plugin.
- *
- * @author julien
- */
-public abstract class AbstractI18nPlugin extends AbstractMojo {
-
- /**
- * Langues des bundles generes.
- *
- * @parameter expression="${i18n.bundles}" default-value=""
- * @required
- */
- protected String[] bundles;
-
- /**
- * Repertoire sources des fichiers i18n.
- *
- * @parameter expression="${i18n.src}" default-value="${basedir}/src/resources/i18n"
- * @required
- */
- protected File src;
-
- /**
- * Repertoire des fichiers generes i18n.
- *
- * @parameter expression="${i18n.out}" default-value="${basedir}/target/gen/i18n"
- * @required
- */
- protected File out;
-
- /**
- * Nom du projet.
- *
- * @parameter expression="${i18n.artifactId}" default-value="${project.artifactId}"
- * @readonly
- */
- protected String artifactId;
-
- /**
- * encoding a utiliser pour charger et sauver les bundles
- *
- * @parameter expression="${i18n.encoding}" default-value="${maven.compile.encoding}"
- * @required
- */
- protected String encoding;
-
- /**
- * Met les fichiers generes dans le repertoire des sources i18n.
- *
- * @parameter expression="${i18n.genSrc}" default-value="true"
- */
- protected boolean genSrc;
-
- /**
- * Active la modification de cle
- *
- * @parameter expression="${i18n.keysModifier}" default-value="false"
- */
- protected boolean keysModifier;
-
- /**
- * verbose flag
- *
- * @parameter expression="${i18n.verbose}" default-value="false"
- */
- protected boolean verbose;
-
- /**
- * conserve les anciens fichiers de traduction avec un suffix ~
- *
- * @parameter expression="${i18n.keepBackup}" default-value="true"
- */
- protected boolean keepBackup;
-
- /**
- * ne conserve que les clef scannees (et donc traite tous les fichiers)
- *
- * @parameter expression="${i18n.strictMode}" default-value="false"
- */
- protected boolean strictMode;
-
- /**
- * Répertoire de stockage des fichiers i18n pour la recuperation des fichiers
- * de traduction entre librairie
- */
- protected static String DIRECTORY_INSTALL = "i18n" + File.separatorChar;
-
- /** Liste des évènements */
- protected List<ParserEvent> events = new ArrayList<ParserEvent>();
-
- /**
- * Ajoute un évènement
- *
- * @param parserEvent l'évènement d'ajout
- */
- protected void addParserEvent(ParserEvent parserEvent) {
- this.events.add(parserEvent);
- }
-
- /**
- * Supprime un évènement
- *
- * @param parserEvent l'évènement de suppression
- */
- protected void removeParserEvent(ParserEvent parserEvent) {
- this.events.remove(parserEvent);
- }
-
- /**
- * Construit une chaine de log formatée.
- *
- * @param msg le prefix du message
- * @param nbFiles le nombre de fichiers actuellement traités
- * @param time le time de traitement de ce fichier
- * @param all le temps de traitement de tous les fichiers
- * @return la chaine de log formatée
- */
- protected String getLogEntry(String msg, int nbFiles, long time, long all) {
- long now = System.nanoTime();
- long delta = now - time;
- String s = "[" + artifactId + "] i18n." + getClass().getSimpleName() + " : " + msg;
- if (time > 0) {
- s += " (" + PluginHelper.convertTime(delta) + ")";
- }
- if (all > 0 && nbFiles > -1) {
- s += "(total time:" + PluginHelper.convertTime(now - all) + ") ( ~ " + PluginHelper.convertTime(((now - all) / (nbFiles + 1))) + " / file)";
- }
- return s;
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Generate.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Generate.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Generate.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,106 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.codelutin.i18n.plugin.PluginHelper;
-import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
-import org.codelutin.util.FileUtil;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- * Merge des fichiers de propriétés avec les anciens.
- *
- * @author julien
- * @goal gen
- * @phase generate-resources
- * @execute goal=get
- */
-public class Generate extends AbstractI18nPlugin {
-
- /*
- * (non-Javadoc)
- * @see org.apache.maven.plugin.AbstractMojo#execute()
- */
- public void execute() throws MojoExecutionException, MojoFailureException {
- for (String bundle : bundles) {
- try {
- // Merge
- File bundleSrc = PluginHelper.getI18nFile(src, artifactId, bundle, false);
- File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false);
-
- if (bundleSrc.exists()) {
-
- I18nProperties propertiesSrc = new I18nProperties(encoding).load(bundleSrc);
-
- I18nProperties propertiesOut = new I18nProperties(encoding);
-
- if (!strictMode) {
- // push back in bundle out, all the bundle src keys
- propertiesOut.putAll(propertiesSrc);
- }
- propertiesOut.load(bundleOut);
-
- // Parcours des clés
- for (Object key : propertiesOut.keySet()) {
- Object oldKey = propertiesOut.get(key);
- Object value = propertiesSrc.get(oldKey);
-
- // Récupération de la clé si elle a été renommée
- if (!key.equals(oldKey) && value == null) {
- value = propertiesSrc.get(key);
- }
-
- if (value != null) {
- propertiesOut.put(key, value);
- } else {
- propertiesOut.put(key, "");
- }
- }
-
- //fixme : on devrait laisser le fichier en utf8 ?
- //propertiesOut.store(bundleOut);
- propertiesOut.store(new FileOutputStream(bundleOut));
-
- // Sauvegarde avant copie
- if (genSrc && keepBackup) {
- FileUtil.copy(bundleSrc, PluginHelper.getI18nFileBackup(src, artifactId, bundle));
- }
-
- getLog().info("Merge bundle " + bundleSrc.getAbsolutePath());
- }
-
- if (genSrc) {
- // Copie des fichiers dans les sources
- FileUtil.copy(bundleOut, bundleSrc);
- getLog().info("Copy bundle " + bundleSrc.getAbsolutePath());
- }
-
- } catch (IOException e) {
- getLog().error("File Error I/O ", e);
- throw new MojoFailureException("File Error I/O ");
- }
- }
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Getter.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Getter.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Getter.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,95 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codelutin.i18n.plugin.PluginHelper;
-import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
-import org.codelutin.util.FileUtil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * Recupere les différents fichiers des parsers en un fichier de proprietes.
- *
- * @author julien
- * @goal get
- * @phase generate-resources
- */
-public class Getter extends AbstractI18nPlugin {
-
- /*
- * (non-Javadoc)
- * @see org.apache.maven.plugin.AbstractMojo#execute()
- */
- public void execute() throws MojoExecutionException, MojoFailureException {
- try {
- File bundleGetters = new File(out.getAbsolutePath() + File.separatorChar + artifactId + ".properties");
- bundleGetters.createNewFile();
-
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(out);
- ds.setIncludes(new String[]{"*.getter"});
- ds.scan();
- String[] files = ds.getIncludedFiles();
-
- // Fusion des fichiers propriétés des différents parsers
- for (String file : files) {
- File bundleGetter = PluginHelper.getGetterFile(out, file, false);
- concactProperties(bundleGetter, bundleGetters);
- if (genSrc) {
- bundleGetter.delete();
- }
- getLog().info("Create bundle with " + bundleGetter.getAbsolutePath());
- }
-
- // Création des bundles
- for (String bundle : bundles) {
- File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false);
- FileUtil.copy(bundleGetters, bundleOut);
- getLog().info("Generate bundle " + bundleOut.getAbsolutePath());
- }
-
- bundleGetters.delete();
- } catch (IOException e) {
- getLog().error("File Error I/O ", e);
- throw new MojoFailureException("File Error I/O");
- }
- }
-
- /**
- * Concatene deux fichiers de proprietes
- *
- * @param in le fichier entrant
- * @param out le fichier sortant
- * @throws FileNotFoundException si fichier non trouvé
- * @throws IOException si problème pendant la sauvegarde
- */
- protected void concactProperties(File in, File out) throws IOException {
- I18nProperties propertiesIn = new I18nProperties(encoding).load(in);
-
- I18nProperties propertiesOut = new I18nProperties(encoding).load(out);
- propertiesOut.putAll(propertiesIn);
- propertiesOut.store(out);
- }
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Parser.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Parser.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Parser.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,55 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Interface type pour la définition d'un nouveau parser.
- * <p/>
- * Une implantation abstraite est proposée : {@link AbstractI18nParser}.
- *
- * @author julien
- */
-public interface Parser {
-
- /**
- * Lancement du parser
- *
- * @throws java.io.IOException if any io pb
- */
- public void parse() throws IOException;
-
- /**
- * Parse sur un fichier
- *
- * @param file le fichier à parser
- */
- public void parseFile(File file);
-
- /**
- * Parse une partie du fichier
- *
- * @param file le fichier à parser
- * @param args ? TODO
- */
- public void parseLine(File file, String args);
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,59 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import java.io.File;
-
-/**
- * Permet d'ajouter des évènements sur les parsers
- *
- * @author julien
- */
-public interface ParserEvent {
-
- /**
- * M�thode appelée quand on change de fichier parsé
- *
- * @param file
- */
- public void eventChangeFile(File file);
-
- /**
- * Méthode appelée après le parsing du fichier
- *
- * @param file
- */
- public void eventNextFile(File file);
-
- /**
- * M�thode appelée quand on change de clé
- *
- * @param keyI18n
- * @param newKey
- */
- public void eventChangeKey(String keyI18n, boolean newKey);
-
- /**
- * M�thode appelée pour récupérer la nouvelle valeur de clé
- *
- * @return
- */
- public String eventGetRealKey();
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,45 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-/**
- * Permet la gestion des exceptions dans les parsers et dans les évènements
- *
- * @author julien
- */
-public class ParserException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public ParserException() {
- super();
- }
-
- public ParserException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ParserException(String message) {
- super(message);
- }
-
- public ParserException(Throwable cause) {
- super(cause);
- }
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,217 +0,0 @@
-/*
-* *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.core;
-
-import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.DirectoryScanner;
-
-import java.io.File;
-import java.lang.annotation.Annotation;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * A simple model for a sourceEntry represents by a basedir and includes and/or exlucdes pattern.
- * <p/>
- * The class offers the usefull method :
- * {@link #getIncludedFiles(File, String[], String[])}
- * <p/>
- * to obtain the list of files from
- * the {@link #basedir} directory which respects the {@link #includes} and/or
- * {@link #excludes} patterns using an internal {@link DirectoryScanner} object.
- * <p/>
- * Note : <b>The class does not extends <code>DirectoryScanner</code> since we DO not want
- * to expose his methods.</b>
- *
- * @author tony
- */
-public class SourceEntry {
- /**
- * If you want to restrict use of the entry, set the class name goal to
- * this property via {@link #setSpecificGoal(String)}.
- * <p/>
- * If let to <code>null</code>, all goals can use this entry.
- */
- protected String specificGoal = null;
-
- protected File basedir;
-
- protected String[] includes;
-
- protected String[] excludes;
-
- public String[] getExcludes() {
- return excludes;
- }
-
- public void setExcludes(String[] excludes) {
- this.excludes = excludes;
- }
-
- public String[] getIncludes() {
- return includes;
- }
-
- public void setIncludes(String[] includes) {
- this.includes = includes;
- }
-
- public File getBasedir() {
- return basedir;
- }
-
- public void setBasedir(File basedir) {
- this.basedir = basedir;
- }
-
- public String getSpecificGoal() {
- return specificGoal;
- }
-
- public void setSpecificGoal(String specificGoal) {
- this.specificGoal = specificGoal;
- }
-
- public boolean useForGoal(String goal) {
- return specificGoal == null || specificGoal.equalsIgnoreCase(goal);
- }
-
- public boolean hasSrc() {
- return basedir != null;
- }
-
- public boolean hasIncludes() {
- return includes != null && includes.length > 0;
- }
-
- public boolean hasExcludes() {
- return excludes != null && excludes.length > 0;
- }
-
- public String[] getIncludedFiles(File defaultBasedir, String[] defaultIncludes, String[] defaultExcludes) {
- // normalized entry
- if (!hasSrc()) {
- setBasedir(defaultBasedir);
- }
- if (!hasIncludes()) {
- setIncludes(defaultIncludes);
- }
- if (!hasExcludes()) {
- setExcludes(defaultExcludes);
- }
- // init directory scanner
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(getBasedir());
- ds.setIncludes(getIncludes());
- if (hasExcludes()) {
- ds.setExcludes(getExcludes());
- }
- // scan
- ds.scan();
- // get found files
- String[] foundFiles;
- foundFiles = ds.getIncludedFiles();
- return foundFiles;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder("basedir:").append(basedir);
- if (includes != null) {
- sb.append(", includes:").append(Arrays.toString(includes));
- }
- if (excludes != null) {
- sb.append(", excludes:").append(Arrays.toString(excludes));
- }
- return sb.toString();
- }
-
- public String[] getIncludedFiles(File basedir, String[] defaultIncludes, String[] defaultExcludes, URLClassLoader loader, List<String> annotationClass, Log log) {
- List<String> result = new ArrayList<String>();
-
- for (String s : getIncludedFiles(basedir, defaultIncludes, defaultExcludes)) {
- if (filterByAnnotation(s, loader, annotationClass, log)) {
- result.add(s);
- }
- }
- return result.toArray(new String[result.size()]);
- }
-
- protected boolean filterByAnnotation(String file, URLClassLoader loader, List<String> annotationClass, Log log) {
-
-
- Annotation annotation = getAnnotation(file, loader, annotationClass, log);
-
- boolean result = annotation != null;
-
- if (result && log.isDebugEnabled()) {
- log.debug("find i18n annotated file : " + file);
- }
- return result;
- }
-
- protected String getFQN(String file) {
- String filePath = file;
- filePath = filePath.substring(0, filePath.length() - ".java".length());
- String replaceEx = File.separator.equals("\\") ? "\\\\" : File.separator;
- return filePath.replaceAll(replaceEx, ".");
- }
-
- public Class getClass(String file, URLClassLoader loader, Log log) {
- String fqn = getFQN(file);
- try {
- return loader.loadClass(fqn);
-
- } catch (Throwable e) {
- log.warn("could not find class " + fqn + " " + e);
- return null;
- }
- }
-
- public Annotation getAnnotation(String file, URLClassLoader loader, List<String> annotationClass, Log log) {
-
- Class<?> currentClass = getClass(file, loader, log);
-
- try {
- Annotation[] annos = currentClass.getAnnotations();
- if (annos != null && annos.length > 0) {
- for (Annotation anno : annos) {
- if (annotationClass.contains(anno.annotationType().getName())) {
- return anno;
- }
- }
- }
- } catch (Throwable e) {
- log.warn("could not find annotation for " + file + " " + e);
- }
- return null;
-
- }
-
- public Class getClass(File file, URLClassLoader loader, Log log) {
- String f = file.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1);
- return getClass(f, loader, log);
- }
-
- public Annotation getAnnotation(File file, URLClassLoader loader, List<String> annotationClass, Log log) {
- String f = file.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1);
- return getAnnotation(f, loader, annotationClass, log);
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,159 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-import org.apache.maven.project.MavenProject;
-import org.codelutin.i18n.plugin.core.AbstractI18nParser;
-import org.codelutin.i18n.plugin.core.ParserEvent;
-import org.codelutin.i18n.plugin.core.ParserException;
-import org.codelutin.processor.filters.I18nFilter;
-import org.codelutin.util.FileUpdaterHelper;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-
-/**
- * Récupération des chaine a traduire depuis les fichiers java.
- *
- * @author julien
- * @goal parserJava
- * @phase generate-resources
- */
-public class ParserJava extends AbstractI18nParser {
-
- /**
- * Source entries (src+includes+excludes) .
- *
- * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.java"
- */
- protected String defaultIncludes;
-
- /**
- * default src for an entry.
- *
- * @parameter expression="${i18n.defaultBasedir}" default-value="${basedir}/src/java"
- */
- protected File defaultBasedir;
-
- /**
- * Dependance du projet.
- *
- * @parameter default-value="${project}"
- * @readonly
- */
- protected MavenProject project;
-
- /**
- * Repertoire sources des fichiers i18n.
- *
- * @parameter expression="${i18n.cp}" default-value="${basedir}/target/classes"
- * @required
- */
- protected File cp;
-
- @Override
- protected String[] getDefaultIncludes() {
- return new String[]{defaultIncludes};
- }
-
- @Override
- protected String[] getDefaultExcludes() {
- return new String[]{};
- }
-
- @Override
- protected File getDefaultBasedir() {
- return defaultBasedir;
- }
-
- @Override
- protected String getKeyModifierStart() {
- return "_\\(\\s*\"";
- }
-
- @Override
- protected String getKeyModifierEnd() {
- return "\"\\s*(\\)|,|\\+|$)";
- }
-
- @Override
- protected String getOutGetter() {
- return "java.getter";
- }
-
- protected I18nFilter filter;
-
- @Override
- public void init() {
- super.init();
- filter = new I18nFilter();
- }
-
- protected void parseEntry(File basedir, String[] files) throws IOException {
- // prepare new file updater
- updater = FileUpdaterHelper.newJavaFileUpdater(basedir, cp);
- super.parseEntry(basedir, files);
- }
-
- @Override
- public void parseFile(File srcFile) {
- try {
-
- LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(srcFile)));
- while (lnr.ready()) {
- String line = lnr.readLine();
- parseLine(srcFile, line);
- }
-
- } catch (Exception e) {
- throw new ParserException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
- */
- @Override
- public void parseLine(File srcFile, String line) {
- String keysSet = filter.parse(line);
-
- if (!keysSet.equals(I18nFilter.EMPTY_STRING)) {
- touchFile = true;
- // Found a set of i18n Strings, split it.
- String[] keys = keysSet.split("=");
- for (String key : keys) {
- String keyModified = key;
- for (ParserEvent event : events) {
- event.eventChangeKey(key, !oldLanguage.containsKey(key));
- keyModified = event.eventGetRealKey();
- }
- if (oldParser.containsKey(key)) {
- result.put(keyModified, oldParser.get(key));
- } else {
- result.put(keyModified, key);
- }
- }
- }
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,87 +0,0 @@
-/*
-* *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-import org.codelutin.i18n.plugin.core.ParserEvent;
-
-import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Un parseur java pour scanner les annotations ActionConfig
- *
- * @author chemit
- * @goal parserJavaActionConfig
- * @phase generate-resources
- */
-public class ParserJavaActionConfig extends ParserJava {
-
- protected static final Pattern MATCH_PATTERN = Pattern.compile("(name|shortDescription|longDescription|name2|shortDescription2|longDescription2)\\s*=\\s*\"([\\w|\\.]+)\"(|\\s*|\\s*,\\s*$)");
-
- @Override
- protected String getKeyModifierStart() {
- return "[\\w|\\.]+\\s*=\\s*\"";
- }
-
- @Override
- protected String getKeyModifierEnd() {
- return "\"\\s*(\\)|,|\\+|$)";
- }
-
- @Override
- protected String getOutGetter() {
- return "java-action-config.getter";
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
- */
-
- public String extract(String i18nString) {
- Matcher matcher = MATCH_PATTERN.matcher(i18nString.trim());
- if (matcher.matches()) {
- return matcher.group(2);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
- */
- @Override
- public void parseLine(File srcFile, String line) {
- String key = extract(line);
- if (key != null) {
- touchFile = true;
- String keyModified = key;
- for (ParserEvent event : events) {
- event.eventChangeKey(key, !oldLanguage.containsKey(key));
- keyModified = event.eventGetRealKey();
- }
- if (oldParser.containsKey(key)) {
- result.put(keyModified, oldParser.get(key));
- } else {
- result.put(keyModified, key);
- }
- }
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,35 +0,0 @@
-/**
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-/**
- * Un parseur java pour scanner les annotations TabContentConfig.
- *
- * @author chemit
- * @goal parserJavaTabConfig
- * @phase generate-resources
- */
-public class ParserJavaTabConfig extends ParserJavaActionConfig {
-
- @Override
- protected String getOutGetter() {
- return "java-tab-config.getter";
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,110 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-import org.codelutin.util.FileUpdaterHelper;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Récupération des chaine à traduire depuis les fichiers xml Jaxx.
- *
- * @author julien
- * @goal parserJaxx
- * @phase generate-resources
- */
-public class ParserJaxx extends ParserXml {
-
- /**
- * Source entries (src+includes+excludes) .
- *
- * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.jaxx"
- */
- protected String defaultIncludes;
-
- /**
- * Where jaxx files should have been generated.
- *
- * @parameter expression="${i18n.defaultGenerateBasedir}" default-value="${basedir}/target/generated-sources/java"
- */
- protected File defaultGenerateBasedir;
-
- /**
- * Regles xml.
- *
- * @parameter expression="${i18n.rulesJaxx}" default-value="jaxx.rules"
- */
- protected String rulesJaxx;
-
- @Override
- protected String[] getDefaultIncludes() {
- return new String[]{defaultIncludes};
- }
-
- @Override
- protected String[] getDefaultExcludes() {
- return new String[]{};
- }
-
- protected void parseEntry(File basedir, String[] files) throws IOException {
- // prepare new file updater
- updater = FileUpdaterHelper.newJavaFileUpdater(basedir, defaultGenerateBasedir);
- super.parseEntry(basedir, files);
- }
-
- @Override
- protected String getOutGetter() {
- return "jaxx.getter";
- }
-
- @Override
- protected String getKeyModifierStart() {
- return "=\\s*[\"\']";
- }
-
- @Override
- protected String getKeyModifierEnd() {
- return "[\"\']";
- }
-
- @Override
- protected String getFileRules() {
- return rulesJaxx;
- }
-
- @Override
- protected String getCoreFileRules() {
- return "jaxx.rules";
- }
-
- public void setRulesJaxx(String rulesJaxx) {
- this.rulesJaxx = rulesJaxx;
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
- */
- @Override
- public String extract(String i18nString) {
- return i18nString.length() == 0 ? null : i18nString;
- }
-
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,94 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-/**
- * Recuperation des chaines à traduire depuis les fichiers xml Swixat.
- *
- * @author julien
- * @goal parserSwixat
- * @phase generate-resources
- */
-public class ParserSwixat extends ParserXml {
-
- /**
- * Source entries (src+includes) .
- *
- * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.xml"
- */
- protected String defaultIncludes;
-
- /**
- * Source entries (src+excludes) .
- *
- * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/context.xml"
- */
- protected String defaultExcludes;
-
- /**
- * Regles xml.
- *
- * @parameter expression="${i18n.rulesSwixat}" default-value="swixat.rules"
- */
- protected String rulesSwixat;
-
- @Override
- protected String[] getDefaultIncludes() {
- return new String[]{defaultIncludes};
- }
-
- @Override
- protected String[] getDefaultExcludes() {
- return new String[]{defaultExcludes};
- }
-
- @Override
- protected String getKeyModifierStart() {
- return "=\\s*[\"\']";
- }
-
- @Override
- protected String getKeyModifierEnd() {
- return "[\"\']";
- }
-
- @Override
- protected String getOutGetter() {
- return "swixat.getter";
- }
-
- @Override
- protected String getFileRules() {
- return rulesSwixat;
- }
-
- @Override
- protected String getCoreFileRules() {
- return "swixat.rules";
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
- */
- @Override
- public String extract(String i18nString) {
- return i18nString;
- }
-}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,228 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.extension;
-
-import org.codelutin.i18n.plugin.core.AbstractI18nParser;
-import org.codelutin.i18n.plugin.core.ParserEvent;
-import org.codelutin.i18n.plugin.core.ParserException;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathFactory;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Récupération des chaines à traduire depuis les fichiers xml.
- *
- * @author julien
- */
-public abstract class ParserXml extends AbstractI18nParser {
-
- /** Taille du buffer pour les lectures/écritures */
- protected static final int BUFFER_SIZE = 8 * 1024;
-
- /**
- * default src for an entry.
- *
- * @parameter expression="${i18n.defaultBasedir}" default-value="${basedir}/src/uimodel"
- * @required
- */
- protected File defaultBasedir;
-
- protected String rules;
- protected XPathFactory factory;
- protected XPath xpath;
-
- /**
- * Fonction d'extraction de la chaine
- *
- * @param i18nString le clef i18n
- * @return la chaine
- */
- public abstract String extract(String i18nString);
-
- /** @return le fichier des rules */
- protected abstract String getFileRules();
-
- /** @return le fichier des rules de base à toujours charger */
- protected abstract String getCoreFileRules();
-
- @Override
- public void init() {
- super.init();
- this.factory = XPathFactory.newInstance();
- this.rules = getRules(getFileRules());
- this.xpath = factory.newXPath();
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.Parser#parseFile(java.io.File)
- */
- public void parseFile(File file) {
- NodeList list;
- InputSource inputSource = new InputSource(file.getAbsolutePath()); // TODO: A d�placer pour les performances
-
- try {
- int size = result.size();
-
- // Recherche des clés à partir d'un xpath
- XPathExpression expression = xpath.compile(rules);
- list = (NodeList) expression.evaluate(inputSource, XPathConstants.NODESET);
-
- for (int index = 0; index < list.getLength(); index++) {
- Node node = list.item(index);
- parseLine(file, node.getTextContent());
- }
-
- // Détection de nouvelles clés, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage
- if (size != result.size()) {
- saveGetterFile();
- }
- } catch (Exception e) {
- throw new ParserException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
- */
- public void parseLine(File file, String key) {
- key = extract(key);
- if (key != null) {
- touchFile = true;
- String keyModified = key;
- for (ParserEvent event : events) {
- event.eventChangeKey(key, !oldLanguage.containsKey(key));
- keyModified = event.eventGetRealKey();
- }
-
- if (oldParser.containsKey(key)) {
- result.put(keyModified, oldParser.get(key));
- } else {
- result.put(keyModified, key);
- }
- }
- }
-
- protected File getDefaultBasedir() {
- return defaultBasedir;
- }
-
- /**
- * Récupère le xpath à partir d'un fichier
- *
- * @param fileRules le nom du fichier contant les règles
- * @return le xpath à partir d'un fichier
- */
- private String getRules(String fileRules) {
- StringBuilder result = new StringBuilder();
-
- try {
- String readInputStream;
-
- // load core rules
- readInputStream = loadRulesFile(getCoreFileRules());
- if (verbose) {
- getLog().debug("core rules : " + readInputStream);
- }
- result.append(readInputStream);
-
- if (!fileRules.equals(getCoreFileRules())) {
- // add custom rules
- readInputStream = loadRulesFile(fileRules);
- if (verbose) {
- getLog().debug("custom rules : " + readInputStream);
- }
- result.append(" | ").append(readInputStream);
- }
- } catch (IOException e) {
- throw new ParserException(e);
- }
-
- return result.toString();
- }
-
- private String loadRulesFile(String fileRules) throws IOException {
- File f = new File(fileRules);
-
- InputStream inputStream;
- if (f.exists()) {
- // load from a file
- try {
- inputStream = new FileInputStream(f);
- } catch (FileNotFoundException e) {
- throw new ParserException(e);
- }
- } else {
- // load from classpath
- ClassLoader classLoader = getClass().getClassLoader();
- inputStream = classLoader.getResourceAsStream(fileRules);
- }
- if (inputStream == null) {
- throw new ParserException("could not found file of rules : " + fileRules);
- }
-
- inputStream = new BufferedInputStream(inputStream);
-
- try {
- // Lecture
- String readInputStream;
- readInputStream = readInputStream(inputStream);
- return readInputStream;
- } catch (IOException e) {
- throw new ParserException(e);
- } finally {
- inputStream.close();
- }
- }
-
- /**
- * Permet la lecture d'un InputStream et Suppressions.
- *
- * @param in le flux entrant
- * @return le contenu du flux
- * @throws IOException si problème de lecture dans flux entrant
- */
- private String readInputStream(InputStream in) throws IOException {
- StringBuilder sb = new StringBuilder();
- byte[] buffer = new byte[BUFFER_SIZE];
- while (in.read(buffer, 0, BUFFER_SIZE) != -1) {
- String tmp = new String(buffer);
- sb.append(tmp);
- }
- in.close();
- // Suppression
- String result = sb.toString().trim();
- result = result.replaceAll("#.*\n", ""); // suppression des commentaires
- result = result.replaceAll("\\s+", " | "); // contruction du xpath avec des ou
- result = result.replaceAll("(^ \\| )|( \\| $)", ""); // suppression des ou de début ee fin
- return result;
- }
-}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/AbstractI18nParser.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,276 @@
+/*
+* *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser;
+
+import org.codelutin.i18n.plugin.SourceEntry;
+import org.codelutin.i18n.plugin.AbstractI18nPlugin;
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codelutin.i18n.plugin.PluginHelper;
+import org.codelutin.i18n.plugin.PluginHelper.I18nProperties;
+import org.codelutin.i18n.plugin.parser.event.KeysModifier;
+import org.codelutin.util.FileUpdater;
+import org.codelutin.util.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Abstract implementation for parsing goal.
+ *
+ * @author tony
+ */
+public abstract class AbstractI18nParser extends AbstractI18nPlugin implements Parser {
+
+ /** @return the outGetter to use for the instance (java.getter,...) */
+ protected abstract String getOutGetter();
+
+ /** @return the starting regex expression to catch keys in key modifier */
+ protected abstract String getKeyModifierStart();
+
+ /** @return the ending regex expression to catch keys in key modifier */
+ protected abstract String getKeyModifierEnd();
+
+ /** @return the default includes to add to directory scanner */
+ protected abstract String[] getDefaultIncludes();
+
+ /** @return the default excludes to add to directory scanner */
+ protected abstract String[] getDefaultExcludes();
+
+ /** @return the default src directory to use in directory scanner */
+ protected abstract File getDefaultBasedir();
+
+ /**
+ * treate default entry
+ *
+ * @parameter expression="${i18n.treateDefault}" default-value="true"
+ */
+ protected boolean treateDefaultEntry;
+
+ /**
+ * Source entries (src+includes+excludes) .
+ *
+ * @parameter expression="${i18n.entries}"
+ */
+ protected SourceEntry[] entries;
+
+ protected I18nProperties result;
+
+ protected I18nProperties oldParser;
+
+ protected I18nProperties oldLanguage;
+ protected int fileTreated = 0;
+ protected long t0;
+
+ protected boolean touchFile;
+ protected List<File> treadedFiles;
+
+ protected SourceEntry currentEntry;
+
+ protected FileUpdater updater;
+
+ public void init() {
+ t0 = System.nanoTime();
+ result = new I18nProperties(encoding);
+ oldParser = new I18nProperties(encoding);
+ oldLanguage = new I18nProperties(encoding);
+ out.mkdirs();
+ // evenements
+ if (keysModifier) {
+ addParserEvent(KeysModifier.getInstance(getKeyModifierStart(), getKeyModifierEnd(), encoding));
+ }
+ treadedFiles = new ArrayList<File>();
+ }
+
+ /**
+ * Test if a file is up to date and not to be treated.
+ * <p/>
+ * This method is called on a file only in not {@link #strictMode}.
+ * <p/>
+ * If {@link #updater} is null, then it considers that file as always to be treated.
+ *
+ * @param file the file path to test
+ * @return <code>true</code> if file is up to date and do not need to be parsed
+ * @see FileUpdater
+ */
+ protected final boolean isFileUptodate(File file) {
+ return updater != null && updater.isFileUpToDate(file);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.maven.plugin.AbstractMojo#execute()
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ init();
+ if (entries == null || entries.length == 0 && !treateDefaultEntry) {
+ // nothing to do
+ return;
+ }
+ try {
+ // Reprise sur un ancien parsing
+ File oldParserFile = PluginHelper.getGetterFile(out, getOutGetter(), true);
+ File saveFile = PluginHelper.getGetterFileBackup(out, getOutGetter());
+
+ oldParser.load(oldParserFile);
+ FileUtil.copy(oldParserFile, saveFile);
+
+ // Anciennes cles disponnibles
+ //fixme : pourquoi on utilise un bundle precis ? le premier ici, je ne comprends pas
+ File oldLanguageFile = PluginHelper.getI18nFile(src, artifactId, bundles[0], true);
+
+ oldLanguage.load(oldLanguageFile);
+
+ // Parsing
+ parse();
+
+ // Suppression du fichier sauvegarder
+ saveFile.delete();
+
+ int i = treadedFiles.size();
+ getLog().info(getLogEntry(" success <getter:" + getOutGetter() + "> [treated file(s) : " + i + '/' + fileTreated + "]", fileTreated, 0, t0));
+
+ } catch (Exception e) {
+ getLog().error("Error code parsing ", e);
+ throw new MojoFailureException("Error code parsing");
+ }
+
+ }
+
+ /**
+ * launch the parse on every given entries.
+ *
+ * @throws IOException if any io pb
+ */
+ public void parse() throws IOException {
+ if (treateDefaultEntry) {
+ addDefaultEntry();
+ }
+ long t00 = System.nanoTime();
+ for (SourceEntry entry : entries) {
+ if (!entry.useForGoal(getClass().getSimpleName())) {
+ if (verbose) {
+ getLog().debug("skip entry " + entry.toString());
+ }
+ continue;
+ }
+ currentEntry = entry;
+ // get found files
+ String[] foundFiles = getFilesForEntry(entry);
+ long t000 = System.nanoTime();
+ if (verbose) {
+ getLog().debug(getLogEntry(" parse <" + entry + "> [incoming file(s) : " + foundFiles.length + "]", 0, 0, 0));
+ } else {
+ getLog().info(getLogEntry(" parse <" + entry.getBasedir() + "> [incoming file(s) : " + foundFiles.length + "]", 0, 0, 0));
+ }
+ // launch parser for found files
+ parseEntry(entry.getBasedir(), foundFiles);
+ fileTreated += foundFiles.length;
+ if (verbose) {
+ getLog().debug(getLogEntry(" success <" + entry.getBasedir() + "> [treated file(s) : " + foundFiles.length + "]", foundFiles.length - 1, t000, t00));
+ }
+ t00 = System.nanoTime();
+ }
+ }
+
+ /**
+ * Obtain all the relative path of files to treate for a given entry.
+ *
+ * @param entry the given entry
+ * @return the list of relative path of files for the given entry
+ */
+ protected String[] getFilesForEntry(SourceEntry entry) {
+ return entry.getIncludedFiles(getDefaultBasedir(), getDefaultIncludes(), getDefaultExcludes());
+ }
+
+ /**
+ * Add the default entry to entries given in configuration.
+ * <p/>
+ * This is a convinient method to simplify the configuration of the plugin.
+ */
+ protected void addDefaultEntry() {
+ List<SourceEntry> list;
+
+ if (entries == null || entries.length == 0) {
+ list = new ArrayList<SourceEntry>();
+ } else {
+ list = new ArrayList<SourceEntry>(Arrays.asList(entries));
+ }
+ list.add(new SourceEntry());
+ entries = list.toArray(new SourceEntry[list.size()]);
+ }
+
+ /**
+ * launch parsing on a given entry.
+ *
+ * @param basedir the basedir of the entry
+ * @param files the relative path of files to be treated for the entry.
+ * @throws IOException if any io pb.
+ */
+ protected void parseEntry(File basedir, String[] files) throws IOException {
+ long t00 = System.nanoTime();
+ for (int i = 0; i < files.length; i++) {
+ String file1 = files[i];
+ long t000 = System.nanoTime();
+ String fileName = basedir.getAbsolutePath() + File.separator + file1;
+ File file = new File(fileName);
+ for (ParserEvent event : events) {
+ event.eventChangeFile(file);
+ }
+ touchFile = false;
+ int size = result.size();
+ if (strictMode || !isFileUptodate(file)) {
+ // on parse toujours en mode strict ou quand le fichier n'est pas à jour
+ getLog().info("parseFile " + file);
+ parseFile(file);
+ }
+
+ // Detection de nouvelles cles, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage
+ if (size != result.size()) {
+ saveGetterFile();
+ }
+ if (touchFile) {
+ if (verbose) {
+ getLog().info("touched file " + file);
+ }
+ treadedFiles.add(file);
+ if (verbose) {
+ getLog().debug(getLogEntry(fileName, i, t000, t00));
+ }
+ }
+ for (ParserEvent event : events) {
+ event.eventNextFile(file);
+ }
+ }
+ }
+
+ /**
+ * Save the result in the getter file.
+ *
+ * @throws IOException if any io pb
+ */
+ protected void saveGetterFile() throws IOException {
+ File getterFile = PluginHelper.getGetterFile(out, getOutGetter(), false);
+ result.store(getterFile);
+ }
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/Parser.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/Parser.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/Parser.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/Parser.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,55 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Interface type pour la définition d'un nouveau parser.
+ * <p/>
+ * Une implantation abstraite est proposée : {@link AbstractI18nParser}.
+ *
+ * @author julien
+ */
+public interface Parser {
+
+ /**
+ * Lancement du parser
+ *
+ * @throws java.io.IOException if any io pb
+ */
+ public void parse() throws IOException;
+
+ /**
+ * Parse sur un fichier
+ *
+ * @param file le fichier à parser
+ */
+ public void parseFile(File file);
+
+ /**
+ * Parse une partie du fichier
+ *
+ * @param file le fichier à parser
+ * @param args ? TODO
+ */
+ public void parseLine(File file, String args);
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserException.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserException.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/ParserException.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,45 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser;
+
+/**
+ * Permet la gestion des exceptions dans les parsers et dans les évènements
+ *
+ * @author julien
+ */
+public class ParserException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ParserException() {
+ super();
+ }
+
+ public ParserException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ParserException(String message) {
+ super(message);
+ }
+
+ public ParserException(Throwable cause) {
+ super(cause);
+ }
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/KeysModifier.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,230 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.event;
+
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserException;
+import org.codelutin.util.FileUtil;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * IHM permettant de modifier les clés de traduction en direct dans les fichiers
+ * parsés et les fichiers de propriétés.
+ *
+ * @author julien
+ */
+public class KeysModifier extends JFrame implements ParserEvent {
+
+ private static final long serialVersionUID = 1L;
+
+ // Modification des clés dans le fichier
+ protected List<String> newKeys;
+ protected boolean needModifiedFile;
+ protected String patternLeft;
+ protected String patternRight;
+ protected String encoding;
+
+ // Interface
+ protected JLabel name = new JLabel();
+ protected JLabel path = new JLabel();
+ protected JTextField key = new JTextField();
+ protected JTextField pattern = new JTextField(".*");
+ protected JCheckBox onlyNewKey = new JCheckBox();
+
+
+ protected JButton next = new JButton("Next >>");
+ private static KeysModifier keysModifier;
+
+ /**
+ * Récupération d'une instance de l'interface
+ *
+ * @param patternLeft left pattern
+ * @param patternRight right pattern
+ * @param encoding encoding
+ * @return the shared instance with new config
+ */
+ public static KeysModifier getInstance(String patternLeft, String patternRight, String encoding) {
+ if (keysModifier == null) {
+ keysModifier = new KeysModifier();
+ }
+
+
+ keysModifier.encoding = encoding;
+ keysModifier.patternLeft = patternLeft;
+ keysModifier.patternRight = patternRight;
+
+ return keysModifier;
+ }
+
+ /** Contructeur de l'interface */
+ private KeysModifier() {
+ setLayout(new GridLayout(9, 2, 10, 10));
+
+ Container pane = getContentPane();
+ pane.add(new JLabel("--- File information ---"));
+ pane.add(new JLabel());
+
+ pane.add(new JLabel("Name :"));
+ pane.add(name);
+
+ pane.add(new JLabel("Path : "));
+ pane.add(path);
+
+ pane.add(new JLabel("--- Files language ---"));
+ pane.add(new JLabel());
+
+ pane.add(new JLabel("Key :"));
+ pane.add(key);
+
+ pane.add(new JLabel("--- Filters ---"));
+ pane.add(new JLabel());
+
+ pane.add(new JLabel("Pattern :"));
+ pane.add(pattern);
+
+ pane.add(new JLabel("Only new key :"));
+ pane.add(onlyNewKey);
+
+ pane.add(new JLabel());
+ pane.add(next);
+
+ next.addActionListener(new EventNextKey());
+ addWindowListener(new EventWindows());
+
+ setTitle("Keys modifier");
+ setSize(800, 400);
+// pack();
+ setVisible(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.ParserEvent#eventChangeFile(java.io.File)
+ */
+ public void eventChangeFile(File file) {
+ name.setText(file.getName());
+ path.setText(file.getPath());
+ key.setText("");
+ repaint();
+
+ newKeys = new ArrayList<String>();
+ needModifiedFile = false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.ParserEvent#eventNextFile(java.io.File)
+ */
+ public void eventNextFile(File file) {
+ if (needModifiedFile) {
+ String content;
+ int region = 0;
+
+ try {
+ content = FileUtil.readAsString(file, encoding);
+ } catch (IOException e) {
+ throw new ParserException(e);
+ }
+
+ for (Iterator<String> iterator = newKeys.iterator(); iterator.hasNext();) {
+ String oldKey = iterator.next();
+ String realKey = iterator.next();
+ Pattern pattern = Pattern.compile("(" + patternLeft + ")(" + Pattern.quote(oldKey) + ")(" + patternRight + ")");
+ Matcher matcher = pattern.matcher(content);
+ matcher.region(region, content.length());
+ matcher.find();
+ region = matcher.start();
+ content = matcher.replaceFirst("$1" + realKey + "$3");
+ }
+
+ try {
+ FileUtil.writeString(file, content, encoding);
+ } catch (IOException e) {
+ throw new ParserException(e);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.ParserEvent#eventChangeKey(java.lang.String)
+ */
+ public synchronized void eventChangeKey(String keyI18n, boolean newKey) {
+ key.setText(keyI18n);
+ newKeys.add(key.getText());
+ repaint();
+ if (isVisible() && keyI18n.matches(pattern.getText()) && (!onlyNewKey.isSelected() || newKey)) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new ParserException(e);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.ParserEvent#eventGetRealKey()
+ */
+ public String eventGetRealKey() {
+ newKeys.add(key.getText());
+ needModifiedFile |= !newKeys.get(newKeys.size() - 1).equals(newKeys.get(newKeys.size() - 2));
+ return key.getText();
+ }
+
+ /** Action sur le boutton pour passer � la cl� suivante */
+ class EventNextKey implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ eventNextKey();
+ }
+ }
+
+ /** Action sur la fermeture de la frame */
+ class EventWindows extends WindowAdapter {
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ setVisible(false);
+ eventNextKey();
+ }
+ }
+
+ /** Permet de passer à la clé suivante */
+ public synchronized void eventNextKey() {
+ notifyAll();
+ }
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/event/ParserEvent.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,59 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.event;
+
+import java.io.File;
+
+/**
+ * Permet d'ajouter des évènements sur les parsers
+ *
+ * @author julien
+ */
+public interface ParserEvent {
+
+ /**
+ * M�thode appelée quand on change de fichier parsé
+ *
+ * @param file
+ */
+ public void eventChangeFile(File file);
+
+ /**
+ * Méthode appelée après le parsing du fichier
+ *
+ * @param file
+ */
+ public void eventNextFile(File file);
+
+ /**
+ * M�thode appelée quand on change de clé
+ *
+ * @param keyI18n
+ * @param newKey
+ */
+ public void eventChangeKey(String keyI18n, boolean newKey);
+
+ /**
+ * M�thode appelée pour récupérer la nouvelle valeur de clé
+ *
+ * @return
+ */
+ public String eventGetRealKey();
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJava.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,159 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+import org.apache.maven.project.MavenProject;
+import org.codelutin.i18n.plugin.parser.AbstractI18nParser;
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserException;
+import org.codelutin.processor.filters.I18nFilter;
+import org.codelutin.util.FileUpdaterHelper;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+
+/**
+ * Récupération des chaine a traduire depuis les fichiers java.
+ *
+ * @author julien
+ * @goal parserJava
+ * @phase generate-resources
+ */
+public class ParserJava extends AbstractI18nParser {
+
+ /**
+ * Source entries (src+includes+excludes) .
+ *
+ * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.java"
+ */
+ protected String defaultIncludes;
+
+ /**
+ * default src for an entry.
+ *
+ * @parameter expression="${i18n.defaultBasedir}" default-value="${basedir}/src/java"
+ */
+ protected File defaultBasedir;
+
+ /**
+ * Dependance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * Repertoire sources des fichiers i18n.
+ *
+ * @parameter expression="${i18n.cp}" default-value="${basedir}/target/classes"
+ * @required
+ */
+ protected File cp;
+
+ @Override
+ protected String[] getDefaultIncludes() {
+ return new String[]{defaultIncludes};
+ }
+
+ @Override
+ protected String[] getDefaultExcludes() {
+ return new String[]{};
+ }
+
+ @Override
+ protected File getDefaultBasedir() {
+ return defaultBasedir;
+ }
+
+ @Override
+ protected String getKeyModifierStart() {
+ return "_\\(\\s*\"";
+ }
+
+ @Override
+ protected String getKeyModifierEnd() {
+ return "\"\\s*(\\)|,|\\+|$)";
+ }
+
+ @Override
+ protected String getOutGetter() {
+ return "java.getter";
+ }
+
+ protected I18nFilter filter;
+
+ @Override
+ public void init() {
+ super.init();
+ filter = new I18nFilter();
+ }
+
+ protected void parseEntry(File basedir, String[] files) throws IOException {
+ // prepare new file updater
+ updater = FileUpdaterHelper.newJavaFileUpdater(basedir, cp);
+ super.parseEntry(basedir, files);
+ }
+
+ @Override
+ public void parseFile(File srcFile) {
+ try {
+
+ LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(srcFile)));
+ while (lnr.ready()) {
+ String line = lnr.readLine();
+ parseLine(srcFile, line);
+ }
+
+ } catch (Exception e) {
+ throw new ParserException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
+ */
+ @Override
+ public void parseLine(File srcFile, String line) {
+ String keysSet = filter.parse(line);
+
+ if (!keysSet.equals(I18nFilter.EMPTY_STRING)) {
+ touchFile = true;
+ // Found a set of i18n Strings, split it.
+ String[] keys = keysSet.split("=");
+ for (String key : keys) {
+ String keyModified = key;
+ for (ParserEvent event : events) {
+ event.eventChangeKey(key, !oldLanguage.containsKey(key));
+ keyModified = event.eventGetRealKey();
+ }
+ if (oldParser.containsKey(key)) {
+ result.put(keyModified, oldParser.get(key));
+ } else {
+ result.put(keyModified, key);
+ }
+ }
+ }
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaActionConfig.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,87 @@
+/*
+* *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+
+import java.io.File;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Un parseur java pour scanner les annotations ActionConfig
+ *
+ * @author chemit
+ * @goal parserJavaActionConfig
+ * @phase generate-resources
+ */
+public class ParserJavaActionConfig extends ParserJava {
+
+ protected static final Pattern MATCH_PATTERN = Pattern.compile("(name|shortDescription|longDescription|name2|shortDescription2|longDescription2)\\s*=\\s*\"([\\w|\\.]+)\"(|\\s*|\\s*,\\s*$)");
+
+ @Override
+ protected String getKeyModifierStart() {
+ return "[\\w|\\.]+\\s*=\\s*\"";
+ }
+
+ @Override
+ protected String getKeyModifierEnd() {
+ return "\"\\s*(\\)|,|\\+|$)";
+ }
+
+ @Override
+ protected String getOutGetter() {
+ return "java-action-config.getter";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
+ */
+
+ public String extract(String i18nString) {
+ Matcher matcher = MATCH_PATTERN.matcher(i18nString.trim());
+ if (matcher.matches()) {
+ return matcher.group(2);
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
+ */
+ @Override
+ public void parseLine(File srcFile, String line) {
+ String key = extract(line);
+ if (key != null) {
+ touchFile = true;
+ String keyModified = key;
+ for (ParserEvent event : events) {
+ event.eventChangeKey(key, !oldLanguage.containsKey(key));
+ keyModified = event.eventGetRealKey();
+ }
+ if (oldParser.containsKey(key)) {
+ result.put(keyModified, oldParser.get(key));
+ } else {
+ result.put(keyModified, key);
+ }
+ }
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaTabConfig.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaTabConfig.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJavaTabConfig.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,35 @@
+/**
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+/**
+ * Un parseur java pour scanner les annotations TabContentConfig.
+ *
+ * @author chemit
+ * @goal parserJavaTabConfig
+ * @phase generate-resources
+ */
+public class ParserJavaTabConfig extends ParserJavaActionConfig {
+
+ @Override
+ protected String getOutGetter() {
+ return "java-tab-config.getter";
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJaxx.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJaxx.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserJaxx.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,110 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+import org.codelutin.util.FileUpdaterHelper;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Récupération des chaine à traduire depuis les fichiers xml Jaxx.
+ *
+ * @author julien
+ * @goal parserJaxx
+ * @phase generate-resources
+ */
+public class ParserJaxx extends ParserXml {
+
+ /**
+ * Source entries (src+includes+excludes) .
+ *
+ * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.jaxx"
+ */
+ protected String defaultIncludes;
+
+ /**
+ * Where jaxx files should have been generated.
+ *
+ * @parameter expression="${i18n.defaultGenerateBasedir}" default-value="${basedir}/target/generated-sources/java"
+ */
+ protected File defaultGenerateBasedir;
+
+ /**
+ * Regles xml.
+ *
+ * @parameter expression="${i18n.rulesJaxx}" default-value="jaxx.rules"
+ */
+ protected String rulesJaxx;
+
+ @Override
+ protected String[] getDefaultIncludes() {
+ return new String[]{defaultIncludes};
+ }
+
+ @Override
+ protected String[] getDefaultExcludes() {
+ return new String[]{};
+ }
+
+ protected void parseEntry(File basedir, String[] files) throws IOException {
+ // prepare new file updater
+ updater = FileUpdaterHelper.newJavaFileUpdater(basedir, defaultGenerateBasedir);
+ super.parseEntry(basedir, files);
+ }
+
+ @Override
+ protected String getOutGetter() {
+ return "jaxx.getter";
+ }
+
+ @Override
+ protected String getKeyModifierStart() {
+ return "=\\s*[\"\']";
+ }
+
+ @Override
+ protected String getKeyModifierEnd() {
+ return "[\"\']";
+ }
+
+ @Override
+ protected String getFileRules() {
+ return rulesJaxx;
+ }
+
+ @Override
+ protected String getCoreFileRules() {
+ return "jaxx.rules";
+ }
+
+ public void setRulesJaxx(String rulesJaxx) {
+ this.rulesJaxx = rulesJaxx;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
+ */
+ @Override
+ public String extract(String i18nString) {
+ return i18nString.length() == 0 ? null : i18nString;
+ }
+
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserSwixat.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserSwixat.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserSwixat.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,94 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+/**
+ * Recuperation des chaines à traduire depuis les fichiers xml Swixat.
+ *
+ * @author julien
+ * @goal parserSwixat
+ * @phase generate-resources
+ */
+public class ParserSwixat extends ParserXml {
+
+ /**
+ * Source entries (src+includes) .
+ *
+ * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/*.xml"
+ */
+ protected String defaultIncludes;
+
+ /**
+ * Source entries (src+excludes) .
+ *
+ * @parameter expression="${i18n.defaultIncludes}" default-value="**\\/context.xml"
+ */
+ protected String defaultExcludes;
+
+ /**
+ * Regles xml.
+ *
+ * @parameter expression="${i18n.rulesSwixat}" default-value="swixat.rules"
+ */
+ protected String rulesSwixat;
+
+ @Override
+ protected String[] getDefaultIncludes() {
+ return new String[]{defaultIncludes};
+ }
+
+ @Override
+ protected String[] getDefaultExcludes() {
+ return new String[]{defaultExcludes};
+ }
+
+ @Override
+ protected String getKeyModifierStart() {
+ return "=\\s*[\"\']";
+ }
+
+ @Override
+ protected String getKeyModifierEnd() {
+ return "[\"\']";
+ }
+
+ @Override
+ protected String getOutGetter() {
+ return "swixat.getter";
+ }
+
+ @Override
+ protected String getFileRules() {
+ return rulesSwixat;
+ }
+
+ @Override
+ protected String getCoreFileRules() {
+ return "swixat.rules";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String)
+ */
+ @Override
+ public String extract(String i18nString) {
+ return i18nString;
+ }
+}
Copied: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java (from rev 1141, maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java)
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java (rev 0)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/parser/impl/ParserXml.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -0,0 +1,228 @@
+/*
+ * *##% Plugin maven pour lutini18n
+ * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.parser.impl;
+
+import org.codelutin.i18n.plugin.parser.AbstractI18nParser;
+import org.codelutin.i18n.plugin.parser.event.ParserEvent;
+import org.codelutin.i18n.plugin.parser.ParserException;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Récupération des chaines à traduire depuis les fichiers xml.
+ *
+ * @author julien
+ */
+public abstract class ParserXml extends AbstractI18nParser {
+
+ /** Taille du buffer pour les lectures/écritures */
+ protected static final int BUFFER_SIZE = 8 * 1024;
+
+ /**
+ * default src for an entry.
+ *
+ * @parameter expression="${i18n.defaultBasedir}" default-value="${basedir}/src/uimodel"
+ * @required
+ */
+ protected File defaultBasedir;
+
+ protected String rules;
+ protected XPathFactory factory;
+ protected XPath xpath;
+
+ /**
+ * Fonction d'extraction de la chaine
+ *
+ * @param i18nString le clef i18n
+ * @return la chaine
+ */
+ public abstract String extract(String i18nString);
+
+ /** @return le fichier des rules */
+ protected abstract String getFileRules();
+
+ /** @return le fichier des rules de base à toujours charger */
+ protected abstract String getCoreFileRules();
+
+ @Override
+ public void init() {
+ super.init();
+ this.factory = XPathFactory.newInstance();
+ this.rules = getRules(getFileRules());
+ this.xpath = factory.newXPath();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.Parser#parseFile(java.io.File)
+ */
+ public void parseFile(File file) {
+ NodeList list;
+ InputSource inputSource = new InputSource(file.getAbsolutePath()); // TODO: A d�placer pour les performances
+
+ try {
+ int size = result.size();
+
+ // Recherche des clés à partir d'un xpath
+ XPathExpression expression = xpath.compile(rules);
+ list = (NodeList) expression.evaluate(inputSource, XPathConstants.NODESET);
+
+ for (int index = 0; index < list.getLength(); index++) {
+ Node node = list.item(index);
+ parseLine(file, node.getTextContent());
+ }
+
+ // Détection de nouvelles clés, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage
+ if (size != result.size()) {
+ saveGetterFile();
+ }
+ } catch (Exception e) {
+ throw new ParserException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.codelutin.i18n.plugin.core.Parser#parseLine(java.io.File, java.lang.String)
+ */
+ public void parseLine(File file, String key) {
+ key = extract(key);
+ if (key != null) {
+ touchFile = true;
+ String keyModified = key;
+ for (ParserEvent event : events) {
+ event.eventChangeKey(key, !oldLanguage.containsKey(key));
+ keyModified = event.eventGetRealKey();
+ }
+
+ if (oldParser.containsKey(key)) {
+ result.put(keyModified, oldParser.get(key));
+ } else {
+ result.put(keyModified, key);
+ }
+ }
+ }
+
+ protected File getDefaultBasedir() {
+ return defaultBasedir;
+ }
+
+ /**
+ * Récupère le xpath à partir d'un fichier
+ *
+ * @param fileRules le nom du fichier contant les règles
+ * @return le xpath à partir d'un fichier
+ */
+ private String getRules(String fileRules) {
+ StringBuilder result = new StringBuilder();
+
+ try {
+ String readInputStream;
+
+ // load core rules
+ readInputStream = loadRulesFile(getCoreFileRules());
+ if (verbose) {
+ getLog().debug("core rules : " + readInputStream);
+ }
+ result.append(readInputStream);
+
+ if (!fileRules.equals(getCoreFileRules())) {
+ // add custom rules
+ readInputStream = loadRulesFile(fileRules);
+ if (verbose) {
+ getLog().debug("custom rules : " + readInputStream);
+ }
+ result.append(" | ").append(readInputStream);
+ }
+ } catch (IOException e) {
+ throw new ParserException(e);
+ }
+
+ return result.toString();
+ }
+
+ private String loadRulesFile(String fileRules) throws IOException {
+ File f = new File(fileRules);
+
+ InputStream inputStream;
+ if (f.exists()) {
+ // load from a file
+ try {
+ inputStream = new FileInputStream(f);
+ } catch (FileNotFoundException e) {
+ throw new ParserException(e);
+ }
+ } else {
+ // load from classpath
+ ClassLoader classLoader = getClass().getClassLoader();
+ inputStream = classLoader.getResourceAsStream(fileRules);
+ }
+ if (inputStream == null) {
+ throw new ParserException("could not found file of rules : " + fileRules);
+ }
+
+ inputStream = new BufferedInputStream(inputStream);
+
+ try {
+ // Lecture
+ String readInputStream;
+ readInputStream = readInputStream(inputStream);
+ return readInputStream;
+ } catch (IOException e) {
+ throw new ParserException(e);
+ } finally {
+ inputStream.close();
+ }
+ }
+
+ /**
+ * Permet la lecture d'un InputStream et Suppressions.
+ *
+ * @param in le flux entrant
+ * @return le contenu du flux
+ * @throws IOException si problème de lecture dans flux entrant
+ */
+ private String readInputStream(InputStream in) throws IOException {
+ StringBuilder sb = new StringBuilder();
+ byte[] buffer = new byte[BUFFER_SIZE];
+ while (in.read(buffer, 0, BUFFER_SIZE) != -1) {
+ String tmp = new String(buffer);
+ sb.append(tmp);
+ }
+ in.close();
+ // Suppression
+ String result = sb.toString().trim();
+ result = result.replaceAll("#.*\n", ""); // suppression des commentaires
+ result = result.replaceAll("\\s+", " | "); // contruction du xpath avec des ou
+ result = result.replaceAll("(^ \\| )|( \\| $)", ""); // suppression des ou de début ee fin
+ return result;
+ }
+}
Deleted: maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java
===================================================================
--- maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java 2008-09-29 08:42:28 UTC (rev 1142)
+++ maven-i18n-plugin/trunk/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java 2008-09-29 08:45:36 UTC (rev 1143)
@@ -1,230 +0,0 @@
-/*
- * *##% Plugin maven pour lutini18n
- * Copyright (C) 2007 - 2008 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.codelutin.i18n.plugin.ui;
-
-import org.codelutin.i18n.plugin.core.ParserEvent;
-import org.codelutin.i18n.plugin.core.ParserException;
-import org.codelutin.util.FileUtil;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import java.awt.Container;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * IHM permettant de modifier les clés de traduction en direct dans les fichiers
- * parsés et les fichiers de propriétés.
- *
- * @author julien
- */
-public class KeysModifier extends JFrame implements ParserEvent {
-
- private static final long serialVersionUID = 1L;
-
- // Modification des clés dans le fichier
- protected List<String> newKeys;
- protected boolean needModifiedFile;
- protected String patternLeft;
- protected String patternRight;
- protected String encoding;
-
- // Interface
- protected JLabel name = new JLabel();
- protected JLabel path = new JLabel();
- protected JTextField key = new JTextField();
- protected JTextField pattern = new JTextField(".*");
- protected JCheckBox onlyNewKey = new JCheckBox();
-
-
- protected JButton next = new JButton("Next >>");
- private static KeysModifier keysModifier;
-
- /**
- * Récupération d'une instance de l'interface
- *
- * @param patternLeft left pattern
- * @param patternRight right pattern
- * @param encoding encoding
- * @return the shared instance with new config
- */
- public static KeysModifier getInstance(String patternLeft, String patternRight, String encoding) {
- if (keysModifier == null) {
- keysModifier = new KeysModifier();
- }
-
-
- keysModifier.encoding = encoding;
- keysModifier.patternLeft = patternLeft;
- keysModifier.patternRight = patternRight;
-
- return keysModifier;
- }
-
- /** Contructeur de l'interface */
- private KeysModifier() {
- setLayout(new GridLayout(9, 2, 10, 10));
-
- Container pane = getContentPane();
- pane.add(new JLabel("--- File information ---"));
- pane.add(new JLabel());
-
- pane.add(new JLabel("Name :"));
- pane.add(name);
-
- pane.add(new JLabel("Path : "));
- pane.add(path);
-
- pane.add(new JLabel("--- Files language ---"));
- pane.add(new JLabel());
-
- pane.add(new JLabel("Key :"));
- pane.add(key);
-
- pane.add(new JLabel("--- Filters ---"));
- pane.add(new JLabel());
-
- pane.add(new JLabel("Pattern :"));
- pane.add(pattern);
-
- pane.add(new JLabel("Only new key :"));
- pane.add(onlyNewKey);
-
- pane.add(new JLabel());
- pane.add(next);
-
- next.addActionListener(new EventNextKey());
- addWindowListener(new EventWindows());
-
- setTitle("Keys modifier");
- setSize(800, 400);
-// pack();
- setVisible(true);
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.ParserEvent#eventChangeFile(java.io.File)
- */
- public void eventChangeFile(File file) {
- name.setText(file.getName());
- path.setText(file.getPath());
- key.setText("");
- repaint();
-
- newKeys = new ArrayList<String>();
- needModifiedFile = false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.ParserEvent#eventNextFile(java.io.File)
- */
- public void eventNextFile(File file) {
- if (needModifiedFile) {
- String content;
- int region = 0;
-
- try {
- content = FileUtil.readAsString(file, encoding);
- } catch (IOException e) {
- throw new ParserException(e);
- }
-
- for (Iterator<String> iterator = newKeys.iterator(); iterator.hasNext();) {
- String oldKey = iterator.next();
- String realKey = iterator.next();
- Pattern pattern = Pattern.compile("(" + patternLeft + ")(" + Pattern.quote(oldKey) + ")(" + patternRight + ")");
- Matcher matcher = pattern.matcher(content);
- matcher.region(region, content.length());
- matcher.find();
- region = matcher.start();
- content = matcher.replaceFirst("$1" + realKey + "$3");
- }
-
- try {
- FileUtil.writeString(file, content, encoding);
- } catch (IOException e) {
- throw new ParserException(e);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.ParserEvent#eventChangeKey(java.lang.String)
- */
- public synchronized void eventChangeKey(String keyI18n, boolean newKey) {
- key.setText(keyI18n);
- newKeys.add(key.getText());
- repaint();
- if (isVisible() && keyI18n.matches(pattern.getText()) && (!onlyNewKey.isSelected() || newKey)) {
- try {
- wait();
- } catch (InterruptedException e) {
- throw new ParserException(e);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.codelutin.i18n.plugin.core.ParserEvent#eventGetRealKey()
- */
- public String eventGetRealKey() {
- newKeys.add(key.getText());
- needModifiedFile |= !newKeys.get(newKeys.size() - 1).equals(newKeys.get(newKeys.size() - 2));
- return key.getText();
- }
-
- /** Action sur le boutton pour passer � la cl� suivante */
- class EventNextKey implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- eventNextKey();
- }
- }
-
- /** Action sur la fermeture de la frame */
- class EventWindows extends WindowAdapter {
-
- @Override
- public void windowClosing(WindowEvent e) {
- setVisible(false);
- eventNextKey();
- }
- }
-
- /** Permet de passer à la clé suivante */
- public synchronized void eventNextKey() {
- notifyAll();
- }
-}
1
0