japi-cvs Mailing List for JAPI (Page 37)
Status: Beta
Brought to you by:
christianhujer
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(115) |
May
(11) |
Jun
(5) |
Jul
(2) |
Aug
(10) |
Sep
(35) |
Oct
(14) |
Nov
(49) |
Dec
(27) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(57) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(25) |
Jun
(134) |
Jul
(76) |
Aug
(34) |
Sep
(27) |
Oct
(5) |
Nov
|
Dec
(1) |
2008 |
Jan
(3) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(63) |
Nov
(30) |
Dec
(43) |
2009 |
Jan
(10) |
Feb
(420) |
Mar
(67) |
Apr
(3) |
May
(61) |
Jun
(21) |
Jul
(19) |
Aug
|
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
(7) |
May
(3) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <chr...@us...> - 2007-07-07 09:34:15
|
Revision: 510 http://svn.sourceforge.net/japi/?rev=510&view=rev Author: christianhujer Date: 2007-07-07 02:34:13 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Added IntelliJ IDEA project file. Added Paths: ----------- libs/net/trunk/libs-net.iml Added: libs/net/trunk/libs-net.iml =================================================================== --- libs/net/trunk/libs-net.iml (rev 0) +++ libs/net/trunk/libs-net.iml 2007-07-07 09:34:13 UTC (rev 510) @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module relativePaths="true" type="JAVA_MODULE" version="4"> + <component name="ModuleRootManager" /> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntryProperties /> + </component> + <component name="copyright"> + <Base> + <setting name="state" value="1" /> + </Base> + <LanguageOptions name="$TEMPLATE$"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="4" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="CSS"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="HTML"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="JAVA"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="JSP"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="JavaScript"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="Properties"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + <LanguageOptions name="XML"> + <option name="templateOptions"> + <value> + <option name="block" value="true" /> + <option name="separateBefore" value="false" /> + <option name="separateAfter" value="false" /> + <option name="prefixLines" value="true" /> + <option name="lenBefore" value="80" /> + <option name="lenAfter" value="80" /> + <option name="box" value="false" /> + <option name="filler" value=" " /> + </value> + </option> + <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="keyword" value="Copyright" /> + <option name="fileTypeOverride" value="2" /> + <option name="relativeBefore" value="true" /> + <option name="addBlankAfter" value="true" /> + <option name="fileLocation" value="1" /> + <option name="useAlternate" value="false" /> + </LanguageOptions> + </component> +</module> + Property changes on: libs/net/trunk/libs-net.iml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-07 09:23:09
|
Revision: 509 http://svn.sourceforge.net/japi/?rev=509&view=rev Author: christianhujer Date: 2007-07-07 02:23:06 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Added net library. Added Paths: ----------- libs/net/ libs/net/branches/ libs/net/tags/ libs/net/trunk/ libs/net/trunk/CHANGES libs/net/trunk/COPYING libs/net/trunk/CREDITS libs/net/trunk/INSTALL libs/net/trunk/LICENSE libs/net/trunk/MAINTAINERS libs/net/trunk/NEWS libs/net/trunk/README libs/net/trunk/build.xml libs/net/trunk/module.properties libs/net/trunk/src/ Property changes on: libs/net/trunk ___________________________________________________________________ Name: svn:ignore + classes dest developer.properties dist docs Name: svn:externals + common https://japi.svn.sourceforge.net/svnroot/japi/common/trunk Added: libs/net/trunk/CHANGES =================================================================== --- libs/net/trunk/CHANGES (rev 0) +++ libs/net/trunk/CHANGES 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,6 @@ +JAPI LIB NET CHANGLOG +--------------------- + +2007 + Christian Hujer: + * Creation Property changes on: libs/net/trunk/CHANGES ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/COPYING =================================================================== --- libs/net/trunk/COPYING (rev 0) +++ libs/net/trunk/COPYING 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + 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. + + 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. + + 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. + + 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. + + 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. + + 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. + + 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 precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 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". + +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. + + 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. + +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. + + 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: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + 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. + + 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.) + +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. + +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. + +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. + + 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) 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 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) 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.) + +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. + +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. + + 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. + + 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. + + 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. + + 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. + +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. + +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. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 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. + + 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. + +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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Property changes on: libs/net/trunk/COPYING ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/CREDITS =================================================================== --- libs/net/trunk/CREDITS (rev 0) +++ libs/net/trunk/CREDITS 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,4 @@ +The following people have contributed to JAPI Lib Net: + +* Christian Hujer <ch...@ri...> + Inventor, creator, maintainer Property changes on: libs/net/trunk/CREDITS ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/INSTALL =================================================================== --- libs/net/trunk/INSTALL (rev 0) +++ libs/net/trunk/INSTALL 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,22 @@ +BUILDING / INSTALLING JAPI LIB NET +---------------------------------- + + +Japi Lib Net is a library for Java developers. Because of that, installation +is not applicable. The rest of the file is concerned with building it only. + +To build Japi Lib Net, you need Java 5.0 and Ant 1.6.5. The applications you +build using Japi Lib net will need Java 5.0 or newer and of course Japi +Lib Net. + + +To build Japi Lib Net, just run ant in the project's root directory or +specifying the build.xml in the project's root directory. To find out, what +other options you have for building Japi Lib Net, try "ant -projecthelp". + + +Usually, you'd just want to use Japi Lib Net in your favorite IDE and include +all those Japi Lib Net classes that you used directly or indirectly in your +build. To do so, the easiest way usually is this: +1. Create a .jar file with the Japi Lib Net classes by running "ant dist". +2. Include that .jar file in the classpath of your IDE. Property changes on: libs/net/trunk/INSTALL ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/LICENSE =================================================================== --- libs/net/trunk/LICENSE (rev 0) +++ libs/net/trunk/LICENSE 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,9 @@ +JAPI LIB NET LICENSE INFORMATION +-------------------------------- + +Japi Lib Net is licensed under GPL. See file COPYING. + +Japi Lib Net uses some third part libraries, especially for building. These +libraries are contained in the lib/ directory and have their own licenses. See +the corresponding LICENSE-*-files in the common/lib/ directory for the licenses +of third party libraries. Property changes on: libs/net/trunk/LICENSE ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/MAINTAINERS =================================================================== --- libs/net/trunk/MAINTAINERS (rev 0) +++ libs/net/trunk/MAINTAINERS 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,7 @@ +JAPI LIB NET MAINTAINERS +------------------------ + +2007 + Christian Hujer <ch...@ri...> + * Creation + * Maintenance Property changes on: libs/net/trunk/MAINTAINERS ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/NEWS =================================================================== --- libs/net/trunk/NEWS (rev 0) +++ libs/net/trunk/NEWS 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,4 @@ +JAPI LIB NET NEWS +----------------- + +No news yet. Property changes on: libs/net/trunk/NEWS ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/README =================================================================== --- libs/net/trunk/README (rev 0) +++ libs/net/trunk/README 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,119 @@ +JAPI LIB NET README +=================== + +This file contains some important information about Japi Lib Net. You should +read it first. + + +TABLE OF CONTENTS +----------------- +* project description +* project website +* system requirements +* file structure +* build / installation (see file INSTALL) +* maintainers / credits (see file CREDITS) +* project news (see file NEWS) +* mailing lists +* license information (see file LICENSE) + + +PROJECT DESCRIPTION +------------------- +Japi Lib Net is a subproject of Japi. +Japi Lib Net is an API for networking. +Japi is a set of APIs for various purposes. + + +PROJECT WEBSITE +--------------- +Project homepage: http://japi.sourceforge.net/ +Project website: http://sourceforge.net/projects/japi/ +Project statistics: http://cia.navi.cx/projects/japi +Subproject homepage: http://japi.sourceforge.net/libs/net/ + + +SYSTEM REQUIREMENTS +------------------- +Java 5.0 + Previous versions of Java will not work. Japi uses Generics, autoboxing, + static imports, foreach loops, assertions, covariant return types and varargs + quite a lot. + +Ant 1.6.5 + Previous versions of Ant might work but are not tested. + + +FILE STRUCTURE +-------------- +build.xml + The build file to build the project with Ant. + +common/ + Directory with libraries and other files that are common to all or most + Japi projects / modules. + +CHANGES + Changelog with significant changes. + +COPYING + Japi Lib Net license conditions. Note: applies to Japi Lib Net only, + not third party libraries. + +CREDITS + List of project contributors. See also MAINTAINERS. + +INSTALL + Description of how to build and install Japi Lib Net. + +LICENSE + File with license information. + +MAINTAINERS + List of current project maintainers. See also CREDITS. + +NEWS + Project News. + +module.properties + File with module-specific settings for common/commonBuild.xml. + +README + This file. + +src/ + Source files. + + +BUILD / INSTALLATION +-------------------- +See the file INSTALL. + + +MAINTAINERS / CREDITS +--------------------- +See the file CREDITS. + + +PROJECT NEWS +------------ +See the file NEWS. + + +MAILING LISTS +------------- +Japi mailing lists are the usual sourceforge hosted sourceforge project +mailing lists. The current mailing lists are: +* jap...@li... + News for JAPI users and developers (low traffic) +* jap...@li... + japi developer talk list +* jap...@li... + svn commit digest list (named cvs for historic reasons) +To find out how to subscribe or read the archives, go to: + http://sourceforge.net/mail/?group_id=149894 + + +LICSENSE INFORMATION +-------------------- +See the file LICENSE Property changes on: libs/net/trunk/README ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/net/trunk/build.xml =================================================================== --- libs/net/trunk/build.xml (rev 0) +++ libs/net/trunk/build.xml 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ JAPI libs-net is a library for networking. + ~ Copyright (C) 2007 Christian Hujer. + ~ + ~ This library 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 2.1 of the License, or (at your option) any later version. + ~ + ~ This library 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 + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public + ~ License along with this library; if not, write to the Free Software + ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + --> +<!DOCTYPE project [ + <!ENTITY commonBuild SYSTEM "common/commonBuild.xml"> +]> +<project name="japi lib net" default="compile"> + + &commonBuild; + +</project> Property changes on: libs/net/trunk/build.xml ___________________________________________________________________ Name: svn:mime-type + text/xml Name: svn:eol-style + LF Added: libs/net/trunk/module.properties =================================================================== --- libs/net/trunk/module.properties (rev 0) +++ libs/net/trunk/module.properties 2007-07-07 09:23:06 UTC (rev 509) @@ -0,0 +1,24 @@ +# +# JAPI libs-net is a library for networking. +# Copyright (C) 2007 Christian Hujer. +# +# This library 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 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# + +update.focus=none +module.version=trunk +module.name=japi-lib-net +module.shortname=net +module.title=Net Property changes on: libs/net/trunk/module.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-07 09:14:16
|
Revision: 508 http://svn.sourceforge.net/japi/?rev=508&view=rev Author: christianhujer Date: 2007-07-07 02:14:15 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Removed log from historic. This is all in libs-logging. Removed Paths: ------------- historic/trunk/src/app/net/sf/japi/log/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-07 08:57:46
|
Revision: 507 http://svn.sourceforge.net/japi/?rev=507&view=rev Author: christianhujer Date: 2007-07-07 01:57:44 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Removed SuperClassIterator from historic - it's now in libs-lang. Removed Paths: ------------- historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java Deleted: historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java =================================================================== --- historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java 2007-07-07 08:48:43 UTC (rev 506) +++ historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java 2007-07-07 08:57:44 UTC (rev 507) @@ -1,70 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * 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. - */ - -package net.sf.japi.lang; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.jetbrains.annotations.Nullable; - -/** An Iterator for iterating through the superclasses (subclasses to superclasses) of a class. - * Note: The supplied class is included in iteration. If you want to omit it, you'll have to invoke getSuperclass() once, e.g. use <code>new SuperClassIterator(clazz.getSuperClass())</code> instead of <code>new SuperClassIterator(clazz)</code>. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class SuperClassIterator implements Iterator<Class<?>>, Iterable<Class<?>> { - - /** The current class. */ - @Nullable private Class<?> nextClass; - - /** Create a SuperClassIterator. - * @param clazz Class to create Iterator for - */ - public SuperClassIterator(@Nullable final Class<?> clazz) { - nextClass = clazz; - } - - /** {@inheritDoc} */ - public boolean hasNext() { - return nextClass != null; - } - - /** {@inheritDoc} */ - public Class<?> next() { - if (nextClass == null) { - throw new NoSuchElementException(); - } - try { - return nextClass; - } finally { - nextClass = nextClass.getSuperclass(); - } - } - - /** {@inheritDoc} */ - public void remove() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - public Iterator<Class<?>> iterator() { - return this; - } - -} // class ClassIterator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-07 08:48:50
|
Revision: 506 http://svn.sourceforge.net/japi/?rev=506&view=rev Author: christianhujer Date: 2007-07-07 01:48:43 -0700 (Sat, 07 Jul 2007) Log Message: ----------- [ 1749527 ] checkstyle fails on windows Modified Paths: -------------- common/trunk/sun_checks.xml Modified: common/trunk/sun_checks.xml =================================================================== --- common/trunk/sun_checks.xml 2007-07-06 22:11:47 UTC (rev 505) +++ common/trunk/sun_checks.xml 2007-07-07 08:48:43 UTC (rev 506) @@ -41,7 +41,9 @@ <!-- Checks whether files end with a new line. --> <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> - <module name="NewlineAtEndOfFile"/> + <module name="NewlineAtEndOfFile"> + <property name="lineSeparator" value="lf" /> + </module> <!-- Checks that property files contain the same keys. --> <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-06 22:11:49
|
Revision: 505 http://svn.sourceforge.net/japi/?rev=505&view=rev Author: christianhujer Date: 2007-07-06 15:11:47 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Added missing package documentation. Added Paths: ----------- libs/argparser/trunk/src/doc/examples/package-info.java Added: libs/argparser/trunk/src/doc/examples/package-info.java =================================================================== --- libs/argparser/trunk/src/doc/examples/package-info.java (rev 0) +++ libs/argparser/trunk/src/doc/examples/package-info.java 2007-07-06 22:11:47 UTC (rev 505) @@ -0,0 +1,23 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** This package contains some examples of how to use japi-libs-argparser. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +package examples; Property changes on: libs/argparser/trunk/src/doc/examples/package-info.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-06 21:03:28
|
Revision: 504 http://svn.sourceforge.net/japi/?rev=504&view=rev Author: christianhujer Date: 2007-07-06 14:03:25 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Added test cases for Iterable working and remove() throwing UnsupportedOperationException. Modified Paths: -------------- libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java Modified: libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java =================================================================== --- libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2007-07-06 20:51:32 UTC (rev 503) +++ libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2007-07-06 21:03:25 UTC (rev 504) @@ -19,10 +19,10 @@ package test.net.sf.japi.lang; +import java.util.NoSuchElementException; import net.sf.japi.lang.SuperClassIterator; +import org.junit.Assert; import org.junit.Test; -import org.junit.Assert; -import java.util.NoSuchElementException; /** Test for {@link SuperClassIterator}. * Created by IntelliJ IDEA. @@ -31,8 +31,9 @@ */ public class SuperClassIteratorTest { - /** Tests whether iterating the superclasses works. */ - @Test public void testIteration() { + /** Tests that iterating the superclasses works. */ + @Test + public void testIteration() { final SuperClassIterator it = new SuperClassIterator(String.class); Assert.assertTrue("Must have next.", it.hasNext()); Assert.assertEquals("First class must be String.class.", String.class, it.next()); @@ -41,19 +42,38 @@ Assert.assertFalse("Must not have next now.", it.hasNext()); } - /** Tests whether iterating the superclasses works. */ - @Test public void testException() { + /** Tests that iterating the superclasses works. */ + @Test + public void testException() { final SuperClassIterator it = new SuperClassIterator(String.class); it.next(); it.next(); } - /** Tests whether iterating the superclasses works. */ - @Test(expected = NoSuchElementException.class) public void testException2() { + /** Tests that iterating the superclasses works. */ + @Test(expected = NoSuchElementException.class) + public void testException2() { final SuperClassIterator it = new SuperClassIterator(String.class); it.next(); it.next(); it.next(); } + /** Tests that {@link SuperClassIterator#remove()} throws an exception. */ + @Test(expected = UnsupportedOperationException.class) + public void testRemove() { + final SuperClassIterator it = new SuperClassIterator(String.class); + it.remove(); + } + + /** Tests that using {@link SuperClassIterator} as Iterable works. */ + @Test + public void testIterable() { + for (final Class c : new SuperClassIterator(String.class)) { + if (!c.equals(String.class) && !c.equals(Object.class)) { + Assert.assertTrue("Expected String.class or Object.class.", false); + } + } + } + } // class SuperClassIteratorTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-06 20:51:34
|
Revision: 503 http://svn.sourceforge.net/japi/?rev=503&view=rev Author: christianhujer Date: 2007-07-06 13:51:32 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Added test case for stopping option parsing after "--". Modified Paths: -------------- libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-07-05 21:06:34 UTC (rev 502) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-07-06 20:51:32 UTC (rev 503) @@ -19,18 +19,18 @@ package test.net.sf.japi.io.args; +import java.lang.reflect.Method; import java.util.List; import java.util.Set; -import java.lang.reflect.Method; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.Command; import net.sf.japi.io.args.MissingArgumentException; import net.sf.japi.io.args.Option; import net.sf.japi.io.args.OptionType; import net.sf.japi.io.args.RequiredOptionsMissingException; import net.sf.japi.io.args.TerminalException; import net.sf.japi.io.args.UnknownOptionException; -import net.sf.japi.io.args.Command; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -211,6 +211,22 @@ } /** + * Tests whether stopping option parsing with -- works. + * @throws RequiredOptionsMissingException (unexpected) + * @throws TerminalException (unexpected) + * @throws UnknownOptionException (unexpected) + * @throws MissingArgumentException (unexpected) + */ + @Test + public void testStopOptionParsing() throws RequiredOptionsMissingException, MissingArgumentException, TerminalException, UnknownOptionException { + final MockCommand command = new MockCommand(); + ArgParser.parseAndRun(command, "-i", "foo", "--", "--input"); + final List<String> args = command.getArgs(); + Assert.assertEquals("--input must be stored as argument after --", 1, args.size()); + Assert.assertEquals("--input must be stored as argument after --", "--input", args.get(0)); + } + + /** * This MockCommand serves as a command for performing simple tests. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 21:20:12
|
Revision: 501 http://svn.sourceforge.net/japi/?rev=501&view=rev Author: christianhujer Date: 2007-07-05 13:59:31 -0700 (Thu, 05 Jul 2007) Log Message: ----------- [ 1748269 ] ant dist should run checkstyle first Modified Paths: -------------- common/trunk/commonBuild.xml Modified: common/trunk/commonBuild.xml =================================================================== --- common/trunk/commonBuild.xml 2007-07-05 20:52:11 UTC (rev 500) +++ common/trunk/commonBuild.xml 2007-07-05 20:59:31 UTC (rev 501) @@ -83,7 +83,7 @@ > <fileset dir="src" includes="test/**/*.properties" /> </copy> - <junit printsummary="yes" haltonfailure="no"> + <junit printsummary="yes" haltonfailure="yes"> <classpath refid="class.path" /> <classpath location="classes/production/${module.shortname}" /> <classpath location="classes/test/${module.shortname}" /> @@ -159,7 +159,7 @@ <target name = "dist" description = "Creates and packs distribution archives." - depends = "clean, compile, doc" + depends = "clean, compile, doc, checkstyle, test" > <delete dir="dist" /> <mkdir dir="dist" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 21:14:39
|
Revision: 502 http://svn.sourceforge.net/japi/?rev=502&view=rev Author: christianhujer Date: 2007-07-05 14:06:34 -0700 (Thu, 05 Jul 2007) Log Message: ----------- [ 1748270 ] ant should have a target for creating private documentation Modified Paths: -------------- common/trunk/commonBuild.xml Modified: common/trunk/commonBuild.xml =================================================================== --- common/trunk/commonBuild.xml 2007-07-05 20:59:31 UTC (rev 501) +++ common/trunk/commonBuild.xml 2007-07-05 21:06:34 UTC (rev 502) @@ -157,6 +157,57 @@ </target> <target + name = "privateDoc" + description = "Creates private documentation" +> + <mkdir dir="docs/private" /> + <javadoc + destdir = "docs/private" + access = "private" + author = "yes" + version = "yes" + locale = "en_US" + use = "yes" + splitindex = "yes" + windowtitle = "JAPI Library ${module.title} ${module.version} private documentation" + doctitle = "JAPI<br />Yet another Java API<br />Library ${module.title} ${module.version} private documentation" + header = "JAPI Library ${module.title} ${module.version}<br />private Documentation" + footer = "JAPI<br />Yet another Java API<br />Library ${module.title} ${module.version} private documentation" + bottom = "<div style="text-align:center;">© 2005-2007 Christian Hujer. All rights reserved. See <a href="{@docRoot}/copyright.html">copyright</a></div>" + serialwarn = "yes" + charset = "utf-8" + docencoding = "utf-8" + encoding = "utf-8" + source = "1.5" + linksource = "yes" + link = "${user.javadoc.link}" + > + <!-- + overview = "src/overview.html" + --> + <classpath refid="class.path" /> + <sourcepath> + <pathelement path="${user.javadoc.javasrc}" /> + <pathelement path="src" /> + </sourcepath> + <packageset + dir="src" + defaultexcludes="yes" + > + </packageset> + <taglet name="net.sf.japi.taglets.FixmeTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.InvariantTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.NoteTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.PostconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.PreconditionTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.ReturnValueTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.TodoTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.WarningTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + <taglet name="net.sf.japi.taglets.XxxTaglet" path="${commonPath}/antlib/japi-lib-taglets-trunk.jar" /> + </javadoc> +</target> + +<target name = "dist" description = "Creates and packs distribution archives." depends = "clean, compile, doc, checkstyle, test" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 20:52:13
|
Revision: 500 http://svn.sourceforge.net/japi/?rev=500&view=rev Author: christianhujer Date: 2007-07-05 13:52:11 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Fixed checkstyle issues. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-07-05 20:48:04 UTC (rev 499) +++ libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-07-05 20:52:11 UTC (rev 500) @@ -30,7 +30,7 @@ public abstract class LogCommand extends BasicCommand { /** The Logger to use. */ - protected final Logger log; + private final Logger log; /** Create a LogCommand with the specified log. * @param log Logger to use @@ -52,4 +52,11 @@ log.setLevel(level); } + /** Returns the logger. + * @return The Logger. + */ + public Logger getLog() { + return log; + } + } // class LogCommand Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java 2007-07-05 20:48:04 UTC (rev 499) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java 2007-07-05 20:52:11 UTC (rev 500) @@ -25,8 +25,7 @@ /** * Converter that performs a conversion by - * Created by IntelliJ IDEA. - * + * @param <T> target type to convert to. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class ConstructorConverter<T> extends AbstractConverter<T> { Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java 2007-07-05 20:48:04 UTC (rev 499) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java 2007-07-05 20:52:11 UTC (rev 500) @@ -46,7 +46,7 @@ final Method mBar = cmdClass.getMethod("bar"); final Method mBuzz = cmdClass.getMethod("buzz"); final Method mA = cmdClass.getMethod("a"); - final Method mZ = cmdClass.getMethod("Z"); + final Method mZ = cmdClass.getMethod("z"); Assert.assertTrue("-a must be sorted before -b / --bar.", comparator.compare(mA, mBar) < 0); Assert.assertTrue("-b / --bar must be sorted before --buzz.", comparator.compare(mBar, mBuzz) < 0); Assert.assertTrue("--buzz must be sorted before -f / --foo.", comparator.compare(mBuzz, mFoo) < 0); @@ -61,8 +61,8 @@ public void testCompareCase() throws NoSuchMethodException { final Comparator<Method> comparator = MethodOptionComparator.INSTANCE; final Class<MockCommand> cmdClass = MockCommand.class; - final Method mC1 = cmdClass.getMethod("c"); - final Method mC2 = cmdClass.getMethod("C"); + final Method mC1 = cmdClass.getMethod("c1"); + final Method mC2 = cmdClass.getMethod("c2"); Assert.assertTrue("-c and -C must not be the same.", comparator.compare(mC1, mC2) != 0); } @@ -74,31 +74,31 @@ /** Dummy command method. */ @Option({"f", "foo"}) - public void foo() {} + public void foo() { } /** Dummy command method. */ @Option({"b", "bar"}) - public void bar() {} + public void bar() { } /** Dummy command method. */ @Option({"buzz"}) - public void buzz() {} + public void buzz() { } /** Dummy command method. */ @Option({"Z"}) - public void Z() {} + public void z() { } /** Dummy command method. */ @Option({"a"}) - public void a() {} + public void a() { } /** Dummy command method. */ @Option({"c"}) - public void c() {} + public void c1() { } /** Dummy command method. */ @Option({"C"}) - public void C() {} + public void c2() { } /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 20:48:24
|
Revision: 499 http://svn.sourceforge.net/japi/?rev=499&view=rev Author: christianhujer Date: 2007-07-05 13:48:04 -0700 (Thu, 05 Jul 2007) Log Message: ----------- [ 1748267 ] missing ant target for performing unit tests Modified Paths: -------------- common/trunk/commonBuild.xml Modified: common/trunk/commonBuild.xml =================================================================== --- common/trunk/commonBuild.xml 2007-07-05 20:07:53 UTC (rev 498) +++ common/trunk/commonBuild.xml 2007-07-05 20:48:04 UTC (rev 499) @@ -11,6 +11,7 @@ <property name="distName" value="${module.name}-${module.version}" /> <property name="distPath" value="dist/${distName}" /> <property name="commonPath" value="common" /> +<property name="javaversion" value="1.5" /> <path id="class.path"> <fileset dir="." includes="lib/*.jar" excludes="lib/LICENSE-*.jar" /> @@ -31,9 +32,7 @@ </target> <target name="compile" description="Compiles this module."> - <property name="javaversion" value="1.5" /> <mkdir dir="classes/production/${module.shortname}" /> - <mkdir dir="classes/test/${module.shortname}" /> <javac srcdir="src" destdir="classes/production/${module.shortname}" @@ -44,6 +43,8 @@ > <classpath refid="class.path" /> <exclude name="test/**/*.java" /> + <exclude name="doc/**/*.java" /> + <exclude name="**/package-info.java" /> </javac> <copy todir="classes/production/${module.shortname}" @@ -61,6 +62,48 @@ </checkstyle> </target> +<target name="test" description="Performs JUnit tests." depends="compile"> + <mkdir dir="classes/test/${module.shortname}" /> + <mkdir dir="docs/test" /> + <javac + srcdir="src" + destdir="classes/test/${module.shortname}" + encoding="utf-8" + source="${javaversion}" + target="${javaversion}" + debug="yes" + > + <classpath refid="class.path" /> + <classpath location="classes/production/${module.shortname}" /> + <include name="test/**/*.java" /> + <exclude name="**/package-info.java" /> + </javac> + <copy + todir="classes/production/${module.shortname}" + > + <fileset dir="src" includes="test/**/*.properties" /> + </copy> + <junit printsummary="yes" haltonfailure="no"> + <classpath refid="class.path" /> + <classpath location="classes/production/${module.shortname}" /> + <classpath location="classes/test/${module.shortname}" /> + <formatter type="plain" /> + <formatter type="xml" /> + <batchtest todir="docs/test"> + <fileset dir="src"> + <include name="test/**/*Test.java" /> + <exclude name="test/**/Abstract*Test.java" /> + </fileset> + </batchtest> + </junit> + <junitreport todir="docs/test"> + <fileset dir="docs/test"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="docs/test" /> + </junitreport> +</target> + <target name = "doc" description = "Creates public API documentation" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 20:07:54
|
Revision: 498 http://svn.sourceforge.net/japi/?rev=498&view=rev Author: christianhujer Date: 2007-07-05 13:07:53 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Updated JUnit. Modified Paths: -------------- common/trunk/lib/junit.jar Modified: common/trunk/lib/junit.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 20:06:55
|
Revision: 497 http://svn.sourceforge.net/japi/?rev=497&view=rev Author: christianhujer Date: 2007-07-05 13:06:54 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Fix: [ 1748308 ] Options that only differ in case are not listed in --help Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java 2007-07-05 20:05:05 UTC (rev 496) +++ libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java 2007-07-05 20:06:54 UTC (rev 497) @@ -20,8 +20,8 @@ package net.sf.japi.io.args; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Comparator; -import java.util.Arrays; import org.jetbrains.annotations.NotNull; /** Compares methods by their options. @@ -40,7 +40,11 @@ final String[] names2 = option2.value(); Arrays.sort(names1); Arrays.sort(names2); - return String.CASE_INSENSITIVE_ORDER.compare(names1[0], names2[0]); + int result = String.CASE_INSENSITIVE_ORDER.compare(names1[0], names2[0]); + if (result == 0) { + result = names1[0].compareTo(names2[0]); + } + return result; } } // class MethodOptionComparator Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java 2007-07-05 20:05:05 UTC (rev 496) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java 2007-07-05 20:06:54 UTC (rev 497) @@ -19,15 +19,15 @@ package test.net.sf.japi.io.args; +import java.lang.reflect.Method; +import java.util.Comparator; +import java.util.List; +import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.MethodOptionComparator; -import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.Option; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; import org.junit.Test; -import org.junit.Assert; -import org.jetbrains.annotations.NotNull; -import java.lang.reflect.Method; -import java.util.Comparator; -import java.util.List; /** * Test for {@link MethodOptionComparator}. @@ -53,6 +53,19 @@ Assert.assertTrue("-f / --foo must be sorted before -Z.", comparator.compare(mFoo, mZ) < 0); } + /** Tests whether comparing two methods that only differ in case yields the difference. + * Test for <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1748308&group_id=149894&atid=776737">[ 1748308 ] Options that only differ in case are not listed in --help</a> + * @throws NoSuchMethodException (unexpected) + */ + @Test + public void testCompareCase() throws NoSuchMethodException { + final Comparator<Method> comparator = MethodOptionComparator.INSTANCE; + final Class<MockCommand> cmdClass = MockCommand.class; + final Method mC1 = cmdClass.getMethod("c"); + final Method mC2 = cmdClass.getMethod("C"); + Assert.assertTrue("-c and -C must not be the same.", comparator.compare(mC1, mC2) != 0); + } + /** Mock Command with methods that should be properly sorted. * The sorting should be: * a(), bar(), buzz(), foo(), Z(). @@ -79,6 +92,14 @@ @Option({"a"}) public void a() {} + /** Dummy command method. */ + @Option({"c"}) + public void c() {} + + /** Dummy command method. */ + @Option({"C"}) + public void C() {} + /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) public int run(@NotNull final List<String> args) throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-05 20:05:10
|
Revision: 496 http://svn.sourceforge.net/japi/?rev=496&view=rev Author: christianhujer Date: 2007-07-05 13:05:05 -0700 (Thu, 05 Jul 2007) Log Message: ----------- Fixed bug in package documentation: Package statement was wrong, so the package documentation was not included in the javadoc run. Strange: javadoc (1.5.0_06) did not warn about this. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/converter/package-info.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/package-info.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/package-info.java 2007-07-04 20:05:59 UTC (rev 495) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/package-info.java 2007-07-05 20:05:05 UTC (rev 496) @@ -23,4 +23,4 @@ * The Converter package will convert the String into an InputStream then. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -package net.sf.japi.io.args.conveter; +package net.sf.japi.io.args.converter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-04 20:06:01
|
Revision: 495 http://svn.sourceforge.net/japi/?rev=495&view=rev Author: christianhujer Date: 2007-07-04 13:05:59 -0700 (Wed, 04 Jul 2007) Log Message: ----------- Added LogCommand. Modified Paths: -------------- libs/argparser/trunk/src/META-INF/services/net.sf.japi.io.args.converter.Converter libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter.properties libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter_de.properties libs/argparser/trunk/src/net/sf/japi/io/args/messages.properties libs/argparser/trunk/src/net/sf/japi/io/args/messages_de.properties Added Paths: ----------- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java Modified: libs/argparser/trunk/src/META-INF/services/net.sf.japi.io.args.converter.Converter =================================================================== --- libs/argparser/trunk/src/META-INF/services/net.sf.japi.io.args.converter.Converter 2007-07-04 18:45:20 UTC (rev 494) +++ libs/argparser/trunk/src/META-INF/services/net.sf.japi.io.args.converter.Converter 2007-07-04 20:05:59 UTC (rev 495) @@ -2,3 +2,4 @@ net.sf.japi.io.args.converter.InputStreamConverter net.sf.japi.io.args.converter.IntegerConverter net.sf.japi.io.args.converter.StringConverter +net.sf.japi.io.args.converter.LogLevelConverter Added: libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java (rev 0) +++ libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java 2007-07-04 20:05:59 UTC (rev 495) @@ -0,0 +1,55 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.sf.japi.io.args; + +import org.jetbrains.annotations.NotNull; +import java.util.logging.Logger; +import java.util.logging.Level; + +/** + * Subclass of BasicCommand that provides logging through {@link java.util.logging}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class LogCommand extends BasicCommand { + + /** The Logger to use. */ + protected final Logger log; + + /** Create a LogCommand with the specified log. + * @param log Logger to use + */ + protected LogCommand(@NotNull final Logger log) { + this.log = log; + } + + /** Create a LogCommand which automatically creates a log that matches the class name. */ + protected LogCommand() { + log = Logger.getLogger(getClass().getName(), getClass().getName()); + } + + /** Sets the log level to log. + * @param level LogLevel to log. + */ + @Option({"l", "level"}) + public void setLevel(@NotNull final Level level) { + log.setLevel(level); + } + +} // class LogCommand Property changes on: libs/argparser/trunk/src/net/sf/japi/io/args/LogCommand.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter.properties =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter.properties 2007-07-04 18:45:20 UTC (rev 494) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter.properties 2007-07-04 20:05:59 UTC (rev 495) @@ -29,3 +29,5 @@ java.lang.Integer.description=Integer number (decimal, 0... octal, 0x... 0X... #... hexadecimal) java.lang.String.displayName=string java.lang.String.description=Simple text +java.util.logging.Level.displayName=level +java.util.logging.Level.description=Log Level Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter_de.properties =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter_de.properties 2007-07-04 18:45:20 UTC (rev 494) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/Converter_de.properties 2007-07-04 20:05:59 UTC (rev 495) @@ -29,3 +29,5 @@ java.lang.Integer.description=Ganzzahl (dezimal, 0... oktal, 0x... 0X... #... hexadezimal) java.lang.String.displayName=string java.lang.String.description=Einfacher Text. +java.util.logging.Level.displayName=level +java.util.logging.Level.description=Log Level Added: libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java (rev 0) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java 2007-07-04 20:05:59 UTC (rev 495) @@ -0,0 +1,43 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.sf.japi.io.args.converter; + +import java.util.logging.Level; +import java.util.Locale; +import org.jetbrains.annotations.NotNull; + +/** + * Created by IntelliJ IDEA. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class LogLevelConverter extends AbstractConverter<Level> { + + /** Create a LogLevelConverter. */ + public LogLevelConverter() { + super(Level.class); + } + + /** {@inheritDoc} */ + @NotNull public Level convert(@NotNull final Locale locale, @NotNull final String arg) throws Exception { + return Level.parse(arg); + } + +} // class LogLevelConverter Property changes on: libs/argparser/trunk/src/net/sf/japi/io/args/converter/LogLevelConverter.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: libs/argparser/trunk/src/net/sf/japi/io/args/messages.properties =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/messages.properties 2007-07-04 18:45:20 UTC (rev 494) +++ libs/argparser/trunk/src/net/sf/japi/io/args/messages.properties 2007-07-04 20:05:59 UTC (rev 495) @@ -28,3 +28,4 @@ setNotExiting=Don't quit Java VM (default). helpHeader= helpFooter= +setLevel=Sets the log level. Modified: libs/argparser/trunk/src/net/sf/japi/io/args/messages_de.properties =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/messages_de.properties 2007-07-04 18:45:20 UTC (rev 494) +++ libs/argparser/trunk/src/net/sf/japi/io/args/messages_de.properties 2007-07-04 20:05:59 UTC (rev 495) @@ -28,3 +28,4 @@ setNotExiting=Java VM nicht beenden (Voreinstellung). helpHeader= helpFooter= +setLevel=Legt den Log-Level fest. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-04 18:45:22
|
Revision: 494 http://svn.sourceforge.net/japi/?rev=494&view=rev Author: christianhujer Date: 2007-07-04 11:45:20 -0700 (Wed, 04 Jul 2007) Log Message: ----------- Test and fix for [ 1747898 ] Option list in --help should be sorted case insensitive Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java Added Paths: ----------- libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java 2007-07-04 18:26:50 UTC (rev 493) +++ libs/argparser/trunk/src/net/sf/japi/io/args/MethodOptionComparator.java 2007-07-04 18:45:20 UTC (rev 494) @@ -40,7 +40,7 @@ final String[] names2 = option2.value(); Arrays.sort(names1); Arrays.sort(names2); - return names1[0].compareTo(names2[0]); + return String.CASE_INSENSITIVE_ORDER.compare(names1[0], names2[0]); } } // class MethodOptionComparator Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java 2007-07-04 18:45:20 UTC (rev 494) @@ -0,0 +1,89 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package test.net.sf.japi.io.args; + +import net.sf.japi.io.args.MethodOptionComparator; +import net.sf.japi.io.args.BasicCommand; +import net.sf.japi.io.args.Option; +import org.junit.Test; +import org.junit.Assert; +import org.jetbrains.annotations.NotNull; +import java.lang.reflect.Method; +import java.util.Comparator; +import java.util.List; + +/** + * Test for {@link MethodOptionComparator}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class MethodOptionComparatorTest { + + /** Tests whether comparing two methods yields the expected result. + * @throws NoSuchMethodException (unexpected) + */ + @Test + public void testCompare() throws NoSuchMethodException { + final Comparator<Method> comparator = MethodOptionComparator.INSTANCE; + final Class<MockCommand> cmdClass = MockCommand.class; + final Method mFoo = cmdClass.getMethod("foo"); + final Method mBar = cmdClass.getMethod("bar"); + final Method mBuzz = cmdClass.getMethod("buzz"); + final Method mA = cmdClass.getMethod("a"); + final Method mZ = cmdClass.getMethod("Z"); + Assert.assertTrue("-a must be sorted before -b / --bar.", comparator.compare(mA, mBar) < 0); + Assert.assertTrue("-b / --bar must be sorted before --buzz.", comparator.compare(mBar, mBuzz) < 0); + Assert.assertTrue("--buzz must be sorted before -f / --foo.", comparator.compare(mBuzz, mFoo) < 0); + Assert.assertTrue("-f / --foo must be sorted before -Z.", comparator.compare(mFoo, mZ) < 0); + } + + /** Mock Command with methods that should be properly sorted. + * The sorting should be: + * a(), bar(), buzz(), foo(), Z(). + */ + private static class MockCommand extends BasicCommand { + + /** Dummy command method. */ + @Option({"f", "foo"}) + public void foo() {} + + /** Dummy command method. */ + @Option({"b", "bar"}) + public void bar() {} + + /** Dummy command method. */ + @Option({"buzz"}) + public void buzz() {} + + /** Dummy command method. */ + @Option({"Z"}) + public void Z() {} + + /** Dummy command method. */ + @Option({"a"}) + public void a() {} + + /** {@inheritDoc} */ + @SuppressWarnings({"InstanceMethodNamingConvention"}) + public int run(@NotNull final List<String> args) throws Exception { + return 0; + } + } + +} // class MethodOptionComparatorTest Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/MethodOptionComparatorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-04 18:26:51
|
Revision: 493 http://svn.sourceforge.net/japi/?rev=493&view=rev Author: christianhujer Date: 2007-07-04 11:26:50 -0700 (Wed, 04 Jul 2007) Log Message: ----------- Test and fix for [ 1747891 ] helpHeader and helpFooter not read from classname bundle Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/BasicCommand.java libs/argparser/trunk/src/test/net/sf/japi/io/args/BasicCommandTest.java Added Paths: ----------- libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.properties libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommandMyBundle.properties Modified: libs/argparser/trunk/src/net/sf/japi/io/args/BasicCommand.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/BasicCommand.java 2007-07-01 17:22:38 UTC (rev 492) +++ libs/argparser/trunk/src/net/sf/japi/io/args/BasicCommand.java 2007-07-04 18:26:50 UTC (rev 493) @@ -170,16 +170,20 @@ * @return String from the ResourceBundles. * @throws MissingResourceException In case all tries for retrieving a value for <var>key</var> failed. */ - @NotNull private String getString(@NotNull final String key) throws MissingResourceException { - try { - return getBundle().getString(key); - } catch (final MissingResourceException e) { + @NotNull public String getString(@NotNull final String key) throws MissingResourceException { + final ResourceBundle bundle = getBundle(); + if (bundle != ownBundle) { try { - return ResourceBundle.getBundle(getClass().getName()).getString(key); - } catch (final MissingResourceException e2) { - return ownBundle.getString(key); + return getBundle().getString(key); + } catch (final MissingResourceException ignore) { + // not serious } } + try { + return ResourceBundle.getBundle(getClass().getName()).getString(key); + } catch (final MissingResourceException e2) { + return ownBundle.getString(key); + } } } // class BasicCommand Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/BasicCommandTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/BasicCommandTest.java 2007-07-01 17:22:38 UTC (rev 492) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/BasicCommandTest.java 2007-07-04 18:26:50 UTC (rev 493) @@ -85,4 +85,34 @@ Assert.assertNotNull(bundle); } + /** + * Tests whether {@link BasicCommand#getString(String)} returns the value from the correct bundle. + * testGetString1 must be defined in RBMockCommand.properties with value String1FromDefaultBundle. + * testGetString1 must be defined in RBMockCommandMyBundle.properties with value String1FromMyBundle. + * testGetString2 must be defined in RBMockCommand.properties with value String2FromDefaultBundle. + * testGetString2 must not be defined in RBMockCommandMyBundle.properties. + */ + @Test + public void testGetString() { + final RBMockCommand mock = new RBMockCommand(); + mock.setReturnOwnBundle(false); + Assert.assertEquals("String1FromDefaultBundle", mock.getString("testGetString1")); + Assert.assertEquals("String2FromDefaultBundle", mock.getString("testGetString2")); + mock.setReturnOwnBundle(true); + Assert.assertEquals("String1FromMyBundle", mock.getString("testGetString1")); + Assert.assertEquals("String2FromDefaultBundle", mock.getString("testGetString2")); + } + + /** + * Tests whether {@link BasicCommand#getHelpHeader()} returns the value from the correct bundle. + */ + @Test + public void testGetHelpHeader() { + final RBMockCommand mock = new RBMockCommand(); + mock.setReturnOwnBundle(false); + Assert.assertEquals("HelpHeaderFromDefaultBundle", mock.getString("helpHeader")); + mock.setReturnOwnBundle(true); + Assert.assertEquals("HelpHeaderFromMyBundle", mock.getString("helpHeader")); + } + } // class BasicCommandTest Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java 2007-07-04 18:26:50 UTC (rev 493) @@ -0,0 +1,58 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package test.net.sf.japi.io.args; + +import net.sf.japi.io.args.BasicCommand; +import java.util.ResourceBundle; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +/** + * Mock Command for {@link ResourceBundle} related tests of {@link BasicCommand}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class RBMockCommand extends BasicCommand { + + /** My own ResourceBundle. */ + private ResourceBundle myBundle = ResourceBundle.getBundle("test.net.sf.japi.io.args.RBMockCommandMyBundle"); + + /** Whether to return its own ResourceBundle. */ + private boolean returnOwnBundle; + + /** {@inheritDoc} */ + @SuppressWarnings({"InstanceMethodNamingConvention"}) + public int run(@NotNull final List<String> args) throws Exception { + return 0; + } + + /** {@inheritDoc} */ + @Override @NotNull public ResourceBundle getBundle() { + return returnOwnBundle ? myBundle : super.getBundle(); //To change body of overridden methods use File | Settings | File Templates. + } + + /** + * Sets whether {@link #getBundle()} should return the mock's own bundle or the superclass' bundle. + * @param returnOwnBundle <code>true</code> if {@link #getBundle()} should return the mock's own bundle, otherwise <code>false</code>. + */ + public void setReturnOwnBundle(final boolean returnOwnBundle) { + this.returnOwnBundle = returnOwnBundle; + } + +} // class RBMockCommand Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.properties =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.properties (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.properties 2007-07-04 18:26:50 UTC (rev 493) @@ -0,0 +1,21 @@ +# +# JAPI libs-argparser is a library for parsing command line arguments. +# Copyright (C) 2007 Christian Hujer. +# +# This library 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 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +testGetString1=String1FromDefaultBundle +testGetString2=String2FromDefaultBundle +helpHeader=HelpHeaderFromDefaultBundle Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommand.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommandMyBundle.properties =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommandMyBundle.properties (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommandMyBundle.properties 2007-07-04 18:26:50 UTC (rev 493) @@ -0,0 +1,20 @@ +# +# JAPI libs-argparser is a library for parsing command line arguments. +# Copyright (C) 2007 Christian Hujer. +# +# This library 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 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +testGetString1=String1FromMyBundle +helpHeader=HelpHeaderFromMyBundle Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/RBMockCommandMyBundle.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-01 17:22:39
|
Revision: 492 http://svn.sourceforge.net/japi/?rev=492&view=rev Author: christianhujer Date: 2007-07-01 10:22:38 -0700 (Sun, 01 Jul 2007) Log Message: ----------- Improved javadoc. Modified Paths: -------------- libs/swing-treetable/trunk/src/net/sf/japi/swing/treetable/JTreeTable.java Modified: libs/swing-treetable/trunk/src/net/sf/japi/swing/treetable/JTreeTable.java =================================================================== --- libs/swing-treetable/trunk/src/net/sf/japi/swing/treetable/JTreeTable.java 2007-07-01 17:22:14 UTC (rev 491) +++ libs/swing-treetable/trunk/src/net/sf/japi/swing/treetable/JTreeTable.java 2007-07-01 17:22:38 UTC (rev 492) @@ -45,7 +45,9 @@ /** The TreeTableModel for this JTreeTable. */ private TreeTableModel<R, T> treeTableModel; - /** Create a JTreeTable. */ + /** Create a JTreeTable. + * @param treeTableModel TreeTableModel to create the view/controller for. + */ public JTreeTable(final TreeTableModel<R, T> treeTableModel) { this.treeTableModel = treeTableModel; tree = new TreeTableCellRenderer(new TreeTableModelTreeModelAdapter<R, T>(treeTableModel)); @@ -106,15 +108,18 @@ super(model); } + /** {@inheritDoc} */ @Override public void setBounds(final int x, final int y, final int width, final int height) { super.setBounds(x, 0, width, JTreeTable.this.getHeight()); } + /** {@inheritDoc} */ @Override public void paint(final Graphics g) { g.translate(0, -visibleRow * getRowHeight()); super.paint(g); } + /** {@inheritDoc} */ public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { if (isSelected) { setBackground(table.getSelectionBackground()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-01 17:22:15
|
Revision: 491 http://svn.sourceforge.net/japi/?rev=491&view=rev Author: christianhujer Date: 2007-07-01 10:22:14 -0700 (Sun, 01 Jul 2007) Log Message: ----------- Added another test case. Modified Paths: -------------- libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java Modified: libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java =================================================================== --- libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2007-07-01 17:21:07 UTC (rev 490) +++ libs/lang/trunk/src/test/net/sf/japi/lang/SuperClassIteratorTest.java 2007-07-01 17:22:14 UTC (rev 491) @@ -42,15 +42,18 @@ } /** Tests whether iterating the superclasses works. */ - @Test(expected = NoSuchElementException.class) public void testException() { + @Test public void testException() { final SuperClassIterator it = new SuperClassIterator(String.class); - try { - it.next(); - it.next(); - } catch (final NoSuchElementException e) { - Assert.fail("NoSuchElementException thrown too early."); - } it.next(); + it.next(); } + /** Tests whether iterating the superclasses works. */ + @Test(expected = NoSuchElementException.class) public void testException2() { + final SuperClassIterator it = new SuperClassIterator(String.class); + it.next(); + it.next(); + it.next(); + } + } // class SuperClassIteratorTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-07-01 17:21:09
|
Revision: 490 http://svn.sourceforge.net/japi/?rev=490&view=rev Author: christianhujer Date: 2007-07-01 10:21:07 -0700 (Sun, 01 Jul 2007) Log Message: ----------- Added missing @NotNull annotations. Modified Paths: -------------- libs/xml/trunk/src/net/sf/japi/xml/NodeListIterator.java Modified: libs/xml/trunk/src/net/sf/japi/xml/NodeListIterator.java =================================================================== --- libs/xml/trunk/src/net/sf/japi/xml/NodeListIterator.java 2007-06-30 21:51:23 UTC (rev 489) +++ libs/xml/trunk/src/net/sf/japi/xml/NodeListIterator.java 2007-07-01 17:21:07 UTC (rev 490) @@ -47,7 +47,7 @@ * @param childName name of child element to get * @return child element or <code>null</code> if no such child element */ - @Nullable public static Element getFirstChild(final Element el, final String childName) { + @Nullable public static Element getFirstChild(@NotNull final Element el, @NotNull final String childName) { final NodeList childNodes = el.getChildNodes(); final int count = childNodes.getLength(); for (int i = 0; i < count; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-06-30 21:51:36
|
Revision: 489 http://svn.sourceforge.net/japi/?rev=489&view=rev Author: christianhujer Date: 2007-06-30 14:51:23 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Added missing package documentation. Added Paths: ----------- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/package-info.java libs/argparser/trunk/src/test/net/sf/japi/io/args/package-info.java Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/package-info.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/package-info.java (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/package-info.java 2007-06-30 21:51:23 UTC (rev 489) @@ -0,0 +1,23 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** Tests for classes in {@link net.sf.japi.io.args.converter}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +package test.net.sf.japi.io.args.converter; Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/package-info.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/package-info.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/package-info.java (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/package-info.java 2007-06-30 21:51:23 UTC (rev 489) @@ -0,0 +1,23 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** Tests for classes in {@link net.sf.japi.io.args}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +package test.net.sf.japi.io.args; Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/package-info.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-06-30 21:33:57
|
Revision: 488 http://svn.sourceforge.net/japi/?rev=488&view=rev Author: christianhujer Date: 2007-06-30 14:33:51 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Improved automatic constructor invocation for types that don't have a specific converter configured. Added unit tests to cover that feature. Improved existing unit tests and increased test coverage. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConverterRegistryTest.java Added Paths: ----------- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConstructorConverterTest.java Added: libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java (rev 0) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java 2007-06-30 21:33:51 UTC (rev 488) @@ -0,0 +1,72 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.sf.japi.io.args.converter; + +import java.lang.reflect.Constructor; +import java.util.Locale; +import org.jetbrains.annotations.NotNull; + +/** + * Converter that performs a conversion by + * Created by IntelliJ IDEA. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ConstructorConverter<T> extends AbstractConverter<T> { + + /** The Constructor to invoke. */ + @NotNull private final Constructor<T> constructor; + + /** + * Create an AbstractConverter. + * @param targetClass TargetClass + * @throws NoSuchMethodException in case the target class does not supply a matching constructor. + */ + public ConstructorConverter(@NotNull final Class<T> targetClass) throws NoSuchMethodException { + super(targetClass); + constructor = getConstructor(targetClass); + } + + @NotNull public T convert(@NotNull final Locale locale, @NotNull final String arg) throws Exception { + return constructor.newInstance(arg); + } + + /** Returns a constructor that takes a single String argument for the target type. + * @param targetType type to get constructor for. + * @return Constructor for <var>targetType</var> + * @throws NoSuchMethodException in case the conversion failed. + */ + @NotNull public static <T> Constructor<T> getConstructor(@NotNull final Class<T> targetType) throws NoSuchMethodException { + return targetType.getConstructor(String.class); + } + + /** {@inheritDoc} */ + @Override + public boolean equals(final Object o) { + return o != null && o instanceof ConstructorConverter && constructor.equals(((ConstructorConverter) o).constructor); + } + + /** {@inheritDoc} */ + @Override + public int hashCode() { + return constructor.hashCode(); + } + +} // class ConstructorConverter Property changes on: libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConstructorConverter.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java 2007-06-30 20:34:36 UTC (rev 487) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java 2007-06-30 21:33:51 UTC (rev 488) @@ -21,12 +21,11 @@ import java.util.HashMap; import java.util.Iterator; -import java.util.Map; import java.util.Locale; -import java.lang.reflect.Constructor; -import sun.misc.Service; +import java.util.Map; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import sun.misc.Service; /** * Registry for Converters. @@ -74,11 +73,17 @@ * @param <T> target type of the class to get a converter for. * @param clazz Class to get Converter for. * @return <code>null</code> if no suited converter was found. - * @todo create a constructor converter if this is called from client code. */ @Nullable public <T> Converter<T> getConverter(@NotNull final Class<T> clazz) { //noinspection unchecked - return (Converter<T>) converters.get(clazz); + @Nullable Converter<T> converter = (Converter<T>) converters.get(clazz); + if (converter == null) { + converter = getConstructorConverter(clazz); + if (converter != null) { + register(converter); + } + } + return converter; } /** @@ -110,7 +115,10 @@ */ @NotNull public static <T> T convert(@NotNull final Class<T> targetType, @NotNull final String s) throws Exception { final Converter<T> converter = getInstance().getConverter(targetType); - return converter != null ? converter.convert(s) : construct(targetType, s); + if (converter != null) { + return converter.convert(s); + } + throw new NoConverterFoundException(targetType); } /** @@ -124,31 +132,22 @@ */ @NotNull public static <T> T convert(@NotNull final Class<T> targetType, @NotNull final Locale locale, @NotNull final String s) throws Exception { final Converter<T> converter = getInstance().getConverter(targetType); - return converter != null ? converter.convert(locale, s) : construct(targetType, s); + if (converter != null) { + return converter.convert(locale, s); + } + throw new NoConverterFoundException(targetType); } - /** Returns a constructor that takes a single String argument for the target type. - * @param targetType type to get constructor for. - * @return Constructor for <var>targetType</var> - * @throws NoConverterFoundException in case the conversion failed. - * @todo check whether the constructor is public. + /** Returns a constructor converter for the target type. + * @param targetType target type to convert to. + * @return ConstructorConverter for the target type. */ - @NotNull public static <T> Constructor<T> getConstructor(@NotNull final Class<T> targetType) throws NoConverterFoundException { + @Nullable public static <T> ConstructorConverter<T> getConstructorConverter(@NotNull final Class<T> targetType) { try { - return targetType.getConstructor(String.class); - } catch (final NoSuchMethodException e) { - throw new NoConverterFoundException(targetType); + return new ConstructorConverter<T>(targetType); + } catch (final Exception e) { + return null; } } - /** Performs a conversion by invoking a constructor. - * @param targetType target type to convert to. - * @param s String to convert. - * @return Converted String in the desired target type. - * @throws Exception in case the conversion failed. - */ - @NotNull public static <T> T construct(@NotNull final Class<T> targetType, @NotNull final String s) throws Exception { - return getConstructor(targetType).newInstance(s); - } - } // class ConverterRegistry Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-06-30 20:34:36 UTC (rev 487) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/ArgParserTest.java 2007-06-30 21:33:51 UTC (rev 488) @@ -229,6 +229,8 @@ @SuppressWarnings({"InstanceMethodNamingConvention"}) public int run(@NotNull final List<String> args) { runCalled = true; + // okay, we won't change it. + //noinspection AssignmentToCollectionOrArrayFieldFromParameter this.args = args; return 0; } Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java 2007-06-30 20:34:36 UTC (rev 487) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/BooleanConverterTest.java 2007-06-30 21:33:51 UTC (rev 488) @@ -22,6 +22,7 @@ import net.sf.japi.io.args.converter.BooleanConverter; import org.junit.Test; import org.junit.Assert; +import java.util.Locale; /** * Tests for {@link BooleanConverter}. @@ -38,7 +39,7 @@ } /** - * Tests whether instanciating a BooleanConverter works. + * Tests that instanciating a BooleanConverter works. * @throws Exception (unexpected) */ @Test @@ -47,7 +48,7 @@ } /** - * Tests whether convert works for true. + * Tests that convert works for true. * @throws Exception In case of unexpected errors. */ @Test @@ -59,7 +60,7 @@ } /** - * Tests whether convert works for true. + * Tests that convert works for true. * @throws Exception In case of unexpected errors. */ @Test @@ -71,7 +72,35 @@ } /** - * Tests whether convert works for other Strings (IllegalArgumentException must be thrown). + * Tests that convert works for true. + * @throws Exception In case of unexpected errors. + */ + @Test + public void testLocalizedConvertTrue() throws Exception { + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "true")); + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "TRUE")); + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "True")); + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "1")); + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "wahr")); + Assert.assertTrue(getConverter().convert(Locale.GERMANY, "ja")); + } + + /** + * Tests that convert works for true. + * @throws Exception In case of unexpected errors. + */ + @Test + public void testLocalizedConvertFalse() throws Exception { + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "false")); + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "FALSE")); + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "False")); + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "0")); + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "falsch")); + Assert.assertFalse(getConverter().convert(Locale.GERMANY, "nein")); + } + + /** + * Tests that convert works for other Strings (IllegalArgumentException must be thrown). * @throws IllegalArgumentException Expected exception that's thrown if the test case is successful. * @throws Exception In case of unexpected errors. */ Added: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConstructorConverterTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConstructorConverterTest.java (rev 0) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConstructorConverterTest.java 2007-06-30 21:33:51 UTC (rev 488) @@ -0,0 +1,118 @@ +/* + * JAPI libs-argparser is a library for parsing command line arguments. + * Copyright (C) 2007 Christian Hujer. + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package test.net.sf.japi.io.args.converter; + +import java.io.File; +import java.lang.reflect.Constructor; +import java.util.Locale; +import net.sf.japi.io.args.converter.ConstructorConverter; +import org.junit.Assert; +import org.junit.Test; + +/** + * Test for {@link ConstructorConverter}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ConstructorConverterTest { + + /** Tests that creating a ConstructorConverter works. + * @throws Exception (unexpected) + */ + @Test + public void testConstructorConverter() throws Exception { + final ConstructorConverter<String> conv = new ConstructorConverter<String>(String.class); + Assert.assertEquals("foo", conv.convert("foo")); + Assert.assertEquals("foo", conv.convert(Locale.GERMANY, "foo")); + } + + /** Tests that creating a ConstructorConverter works. + * @throws Exception (unexpected) + */ + @Test + public void testConstructorConverter2() throws Exception { + final ConstructorConverter<File> conv = new ConstructorConverter<File>(File.class); + Assert.assertEquals(new File("foo"), conv.convert("foo")); + Assert.assertEquals(new File("foo"), conv.convert(Locale.GERMANY, "foo")); + } + + /** Tests that creating a ConstructorConverter for non-public constructors fails. + * @throws Exception (unexpected) + */ + @Test(expected = NoSuchMethodException.class) + public void testConstructorConverter3() throws Exception { + new ConstructorConverter<NonPublicConverter>(NonPublicConverter.class); + } + + /** Tests that {@link ConstructorConverter#equals(Object)} works. + * @throws Exception (unexpected) + */ + @Test + public void testEquals() throws Exception { + final ConstructorConverter<String> conv1 = new ConstructorConverter<String>(String.class); + final ConstructorConverter<String> conv2 = new ConstructorConverter<String>(String.class); + final ConstructorConverter<File> conv3 = new ConstructorConverter<File>(File.class); + Assert.assertTrue(conv1.equals(conv2)); + Assert.assertFalse(conv1.equals(new Object())); + //noinspection ObjectEqualsNull + Assert.assertFalse(conv1.equals(null)); + //noinspection EqualsBetweenInconvertibleTypes + Assert.assertFalse(conv1.equals(conv3)); + } + + /** Tests that {@link ConstructorConverter#hashCode()} works. + * @throws Exception (unexpected) + */ + @Test + public void testHashCode() throws Exception { + final ConstructorConverter<File> conv = new ConstructorConverter<File>(File.class); + final Constructor<File> constructor = File.class.getConstructor(String.class); + Assert.assertEquals(conv.hashCode(), constructor.hashCode()); + } + + /** Tests that {@link ConstructorConverter#getConstructor(Class)} works. + * @throws Exception (unexpected) + */ + @Test + public void testGetConstructor() throws Exception { + final Constructor<File> constructor = ConstructorConverter.getConstructor(File.class); + Assert.assertEquals(File.class.getConstructor(String.class), constructor); + } + + /** Tests that {@link ConstructorConverter#getConstructor(Class)} throws an Exception for non-public constructors. + * @throws Exception (unexpected) + */ + @Test(expected = NoSuchMethodException.class) + public void testGetConstructor2() throws Exception { + ConstructorConverter.getConstructor(NonPublicConverter.class); + } + + /** Dummy that represents a converter with a non-public constructor. */ + public static class NonPublicConverter { + + /** Non-public constructor for test. + * @param arg String argument. + */ + @SuppressWarnings({"UnusedDeclaration"}) + NonPublicConverter(final String arg) { + } + + } // class NonPublicConverter + +} // class ConstructorConverterTest Property changes on: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConstructorConverterTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConverterRegistryTest.java =================================================================== --- libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConverterRegistryTest.java 2007-06-30 20:34:36 UTC (rev 487) +++ libs/argparser/trunk/src/test/net/sf/japi/io/args/converter/ConverterRegistryTest.java 2007-06-30 21:33:51 UTC (rev 488) @@ -21,10 +21,13 @@ import net.sf.japi.io.args.converter.ConverterRegistry; import net.sf.japi.io.args.converter.Converter; +import net.sf.japi.io.args.converter.NoConverterFoundException; +import net.sf.japi.io.args.converter.ConstructorConverter; import org.junit.Test; import org.junit.Assert; import org.jetbrains.annotations.NotNull; import java.util.Locale; +import java.io.File; /** * Test for {@link ConverterRegistry}. @@ -84,6 +87,44 @@ } /** + * Tests whether {@link ConverterRegistry#convert(Class, String)} will automatically create a converter with a constructor. + * @throws Exception (unexpected) + */ + @Test + public void testConstruct() throws Exception { + Assert.assertEquals(new File("foo"), ConverterRegistry.convert(File.class, "foo")); + Assert.assertEquals(new File("foo"), ConverterRegistry.convert(File.class, Locale.GERMANY, "foo")); + } + + /** + * Tests whether {@link ConverterRegistry#convert(Class, String)} will throw the appropriate exception if no constructor converter is available. + * @throws Exception (unexpected) + */ + @Test(expected = NoConverterFoundException.class) + public void testConstructException() throws Exception { + ConverterRegistry.convert(System.class, "foo"); + } + + /** + * Tests whether {@link ConverterRegistry#convert(Class, Locale, String)} will throw the appropriate exception if no constructor converter is available. + * @throws Exception (unexpected) + */ + @Test(expected = NoConverterFoundException.class) + public void testConstructException2() throws Exception { + ConverterRegistry.convert(System.class, Locale.GERMANY, "foo"); + } + + /** + * Tests whether {@link ConverterRegistry#getConstructorConverter(Class)} returns appropriate values. + * @throws Exception (unexpected) + */ + @Test + public void testGetConstructorConverter() throws Exception { + Assert.assertEquals(new ConstructorConverter<String>(String.class), ConverterRegistry.getConstructorConverter(String.class)); + Assert.assertEquals(null, ConverterRegistry.getConstructorConverter(System.class)); + } + + /** * Dummy Converter. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-06-30 20:35:31
|
Revision: 487 http://svn.sourceforge.net/japi/?rev=487&view=rev Author: christianhujer Date: 2007-06-30 13:34:36 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Implemented feature of performing a conversion by invoking a target type String constructor in case no explicit Converter is defined. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java 2007-06-30 20:19:16 UTC (rev 486) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/ConverterRegistry.java 2007-06-30 20:34:36 UTC (rev 487) @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Locale; +import java.lang.reflect.Constructor; import sun.misc.Service; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,6 +74,7 @@ * @param <T> target type of the class to get a converter for. * @param clazz Class to get Converter for. * @return <code>null</code> if no suited converter was found. + * @todo create a constructor converter if this is called from client code. */ @Nullable public <T> Converter<T> getConverter(@NotNull final Class<T> clazz) { //noinspection unchecked @@ -108,11 +110,7 @@ */ @NotNull public static <T> T convert(@NotNull final Class<T> targetType, @NotNull final String s) throws Exception { final Converter<T> converter = getInstance().getConverter(targetType); - if (converter != null) { - return converter.convert(s); - } else { - throw new NoConverterFoundException(targetType); - } + return converter != null ? converter.convert(s) : construct(targetType, s); } /** @@ -126,11 +124,31 @@ */ @NotNull public static <T> T convert(@NotNull final Class<T> targetType, @NotNull final Locale locale, @NotNull final String s) throws Exception { final Converter<T> converter = getInstance().getConverter(targetType); - if (converter != null) { - return converter.convert(locale, s); - } else { + return converter != null ? converter.convert(locale, s) : construct(targetType, s); + } + + /** Returns a constructor that takes a single String argument for the target type. + * @param targetType type to get constructor for. + * @return Constructor for <var>targetType</var> + * @throws NoConverterFoundException in case the conversion failed. + * @todo check whether the constructor is public. + */ + @NotNull public static <T> Constructor<T> getConstructor(@NotNull final Class<T> targetType) throws NoConverterFoundException { + try { + return targetType.getConstructor(String.class); + } catch (final NoSuchMethodException e) { throw new NoConverterFoundException(targetType); } } + /** Performs a conversion by invoking a constructor. + * @param targetType target type to convert to. + * @param s String to convert. + * @return Converted String in the desired target type. + * @throws Exception in case the conversion failed. + */ + @NotNull public static <T> T construct(@NotNull final Class<T> targetType, @NotNull final String s) throws Exception { + return getConstructor(targetType).newInstance(s); + } + } // class ConverterRegistry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-06-30 20:19:18
|
Revision: 486 http://svn.sourceforge.net/japi/?rev=486&view=rev Author: christianhujer Date: 2007-06-30 13:19:16 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Minor improvement: Better handling of "-" filename. Modified Paths: -------------- libs/argparser/trunk/src/net/sf/japi/io/args/converter/InputStreamConverter.java Modified: libs/argparser/trunk/src/net/sf/japi/io/args/converter/InputStreamConverter.java =================================================================== --- libs/argparser/trunk/src/net/sf/japi/io/args/converter/InputStreamConverter.java 2007-06-30 20:18:47 UTC (rev 485) +++ libs/argparser/trunk/src/net/sf/japi/io/args/converter/InputStreamConverter.java 2007-06-30 20:19:16 UTC (rev 486) @@ -20,9 +20,9 @@ package net.sf.japi.io.args.converter; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; import org.jetbrains.annotations.NotNull; @@ -43,19 +43,14 @@ } /** {@inheritDoc} */ - @NotNull public InputStream convert(@NotNull final Locale locale, @NotNull final String arg) throws FileNotFoundException { + @NotNull public InputStream convert(@NotNull final Locale locale, @NotNull final String arg) throws IOException { + if ("-".equals(arg)) { + return System.in; + } try { return new URL(arg).openStream(); - } catch (final IOException ignore) { - try { - return new FileInputStream(arg); - } catch (final FileNotFoundException e) { - if ("-".equals(arg)) { - return System.in; - } else { - throw e; - } - } + } catch (final MalformedURLException e) { + return new FileInputStream(arg); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |