#At https://bazaar.launchpad.net/~ndb-bindings/ndb-bindings/trunk
471 Monty Taylor 2008-12-30
Added apiviz to the javadoc generation rule.
added:
java/apiviz-1.2.5.GA/
java/apiviz-1.2.5.GA/COPYRIGHT.txt
java/apiviz-1.2.5.GA/LICENSE.jdepend.txt
java/apiviz-1.2.5.GA/LICENSE.txt
java/apiviz-1.2.5.GA/NOTICE.txt
java/apiviz-1.2.5.GA/jar/
java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA-sources.jar
java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA.jar
java/apiviz-1.2.5.GA/pom.xml
java/apiviz-1.2.5.GA/src/
java/apiviz-1.2.5.GA/src/assembly/
java/apiviz-1.2.5.GA/src/assembly/default.xml
java/apiviz-1.2.5.GA/src/main/
java/apiviz-1.2.5.GA/src/main/java/
java/apiviz-1.2.5.GA/src/main/java/net/
java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/
java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz/
java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz/APIviz.java
java/apiviz-1.2.5.GA/src/main/java/org/
java/apiviz-1.2.5.GA/src/main/java/org/jboss/
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIviz.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIvizRootDoc.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocComparator.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocGraph.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Constant.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Edge.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/EdgeType.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/FileUtil.java
java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Graphviz.java
java/apiviz-1.2.5.GA/src/test/
java/apiviz-1.2.5.GA/src/test/java/
java/apiviz-1.2.5.GA/src/test/java/net/
java/apiviz-1.2.5.GA/src/test/java/net/gleamynode/
java/apiviz-1.2.5.GA/src/test/java/net/gleamynode/apiviz/
modified:
java/build.xml
=== added directory 'java/apiviz-1.2.5.GA'
=== added file 'java/apiviz-1.2.5.GA/COPYRIGHT.txt'
--- a/java/apiviz-1.2.5.GA/COPYRIGHT.txt 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/COPYRIGHT.txt 2008-12-30 20:05:50 +0000
@@ -0,0 +1,13 @@
+The APIviz Project - Copyright (C) 2008, Red Hat Middleware LLC, and individual
+contributors, and is licensed under the GNU LGPL.
+
+A summary of the individual contributors is given below. Any omission should be
+sent to Trustin Lee <tlee@stripped>.
+
+SVN Login(s) Name
+-------------------------------------------------------------------------------
+trustin Trustin Heuiseung Lee
+-------------------------------------------------------------------------------
+
+* JBoss is a registered trademark of Red Hat Middleware LLC.
+
=== added file 'java/apiviz-1.2.5.GA/LICENSE.jdepend.txt'
--- a/java/apiviz-1.2.5.GA/LICENSE.jdepend.txt 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/LICENSE.jdepend.txt 2008-12-30 20:05:50 +0000
@@ -0,0 +1,29 @@
+Copyright (C) 2001 Clarkware Consulting, Inc.
+All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of Clarkware Consulting, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without prior written permission. For written
+ permission, please contact clarkware@stripped.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+CLARKWARE CONSULTING OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=== added file 'java/apiviz-1.2.5.GA/LICENSE.txt'
--- a/java/apiviz-1.2.5.GA/LICENSE.txt 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/LICENSE.txt 2008-12-30 20:05:50 +0000
@@ -0,0 +1,504 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, 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.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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, 5th Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
=== added file 'java/apiviz-1.2.5.GA/NOTICE.txt'
--- a/java/apiviz-1.2.5.GA/NOTICE.txt 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/NOTICE.txt 2008-12-30 20:05:50 +0000
@@ -0,0 +1,33 @@
+
+ The APIviz Project
+ ==================
+
+Please visit the APIviz web site for more information:
+
+ * http://www.jboss.org/apiviz/
+
+Copyright (C) 2008, Red Hat Middleware LLC, and individual contributors
+by the @author tags. See the COPYRIGHT.txt in the distribution for a
+full listing of individual contributors.
+
+This product 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 product 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, 5th Floor, Boston, MA 02110-1301 USA
+
+Also, please refer to each LICENSE.<component>.txt file for the license
+terms of the components that this product depends on.
+
+This product depends on 'JDepend', a Java package dependency analyzer,
+which can be obtained at:
+
+ * http://clarkware.com/software/JDepend.html
=== added directory 'java/apiviz-1.2.5.GA/jar'
=== added file 'java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA-sources.jar'
Binary files a/java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA-sources.jar 1970-01-01 00:00:00
+0000 and b/java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA-sources.jar 2008-12-30 20:05:50
+0000 differ
=== added file 'java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA.jar'
Binary files a/java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA.jar 1970-01-01 00:00:00 +0000 and
b/java/apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA.jar 2008-12-30 20:05:50 +0000 differ
=== added file 'java/apiviz-1.2.5.GA/pom.xml'
--- a/java/apiviz-1.2.5.GA/pom.xml 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/pom.xml 2008-12-30 20:05:50 +0000
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ <packaging>jar</packaging>
+
+ <name>APIviz</name>
+ <description>
+ APIviz is a JavaDoc doclet which extends the Java standard doclet.
+ It generates comprehensive UML-like class and package diagrams
+ that help the quick understanding of the overall API structure.
+ </description>
+
+ <url>http://www.jboss.org/apiviz/</url>
+ <organization>
+ <name>JBoss - a division of Red Hat</name>
+ <url>http://www.jboss.org/</url>
+ </organization>
+
+ <inceptionYear>2008</inceptionYear>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl.html</url>
+ </license>
+ </licenses>
+
+ <scm>
+
<connection>scm:svn:http://anonsvn.jboss.org/repos/apiviz/tags/apiviz-1.2.5.GA</connection>
+
<developerConnection>scm:svn:https://svn.jboss.org/repos/apiviz/tags/apiviz-1.2.5.GA</developerConnection>
+ </scm>
+
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss.org Release Distribution Repository</name>
+ <url>https://svn.jboss.org/repos/repository.jboss.org/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss.org Development Snapshot Repository</name>
+ <url>https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <properties>
+ <jdepend-version>2.9.1</jdepend-version>
+ </properties>
+
+ <profiles>
+ <!-- SUN Standard Doclet -->
+ <profile>
+ <id>default-tools.jar</id>
+ <activation>
+ <property>
+ <name>java.vendor</name>
+ <value>Sun Microsystems Inc.</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.5.0</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <updateReleaseInfo>true</updateReleaseInfo>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <!-- JDepend for package dependency analysis -->
+ <dependency>
+ <groupId>jdepend</groupId>
+ <artifactId>jdepend</artifactId>
+ <version>${jdepend-version}</version>
+ <scope>compile</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- Testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <source>1.5</source>
+ <target>1.5</target>
+ <debug>true</debug>
+ <optimize>true</optimize>
+ <showDeprecations>true</showDeprecations>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/Abstract*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ <breakiterator>true</breakiterator>
+ <charset>UTF-8</charset>
+ <docencoding>UTF-8</docencoding>
+ <encoding>UTF-8</encoding>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ </links>
+ <locale>en_US</locale>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <configuration>
+ <inputEncoding>UTF-8</inputEncoding>
+ <outputEncoding>UTF-8</outputEncoding>
+ <linkJavadoc>false</linkJavadoc>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-license</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <taskdef resource="net/sf/antcontrib/antlib.xml" />
+ <if>
+ <or>
+ <equals arg1="${project.packaging}" arg2="jar" />
+ <equals arg1="${project.packaging}" arg2="bundle" />
+ </or>
+ <then>
+ <move
file="${project.build.directory}/${project.build.finalName}.jar"
tofile="${project.build.directory}/${project.build.finalName}.orig.jar" />
+ <zip
destfile="${project.build.directory}/${project.build.finalName}.jar">
+ <zipfileset dir="${basedir}" prefix="META-INF/">
+ <include name="LICENSE.*" />
+ <include name="NOTICE.*" />
+ <include name="COPYRIGHT.*" />
+ </zipfileset>
+ <zipfileset
src="${settings.localRepository}/jdepend/jdepend/${jdepend-version}/jdepend-${jdepend-version}.jar"
filemode="644" dirmode="755">
+ <exclude name="META-INF/**" />
+ </zipfileset>
+ <zipfileset
src="${project.build.directory}/${project.build.finalName}.orig.jar" filemode="644"
dirmode="755">
+ <exclude name="*/*/*/example/**" />
+ <exclude name="jdepend/**" />
+ </zipfileset>
+ </zip>
+ <delete
file="${project.build.directory}/${project.build.finalName}.orig.jar" />
+ <move
file="${project.build.directory}/${project.build.finalName}-sources.jar"
tofile="${project.build.directory}/${project.build.finalName}-sources.orig.jar" />
+ <zip
destfile="${project.build.directory}/${project.build.finalName}-sources.jar">
+ <zipfileset dir="${basedir}" prefix="META-INF/">
+ <include name="LICENSE.*" />
+ <include name="NOTICE.*" />
+ <include name="COPYRIGHT.*" />
+ </zipfileset>
+ <zipfileset
src="${project.build.directory}/${project.build.finalName}-sources.orig.jar"
filemode="644" dirmode="755">
+ <exclude name="*/*/*/example/**" />
+ </zipfileset>
+ </zip>
+ <delete
file="${project.build.directory}/${project.build.finalName}-sources.orig.jar" />
+ </then>
+ </if>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/assembly/default.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ <appendAssemblyId>true</appendAssemblyId>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/apiviz/tags</tagBase>
+ <!-- We don't want to use the default release profile because it
+ causes the JavaDoc and source jars to be deployed twice. -->
+ <useReleaseProfile>false</useReleaseProfile>
+ <!-- Activate a custom profile called "release" -->
+ <arguments>-Prelease</arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
=== added directory 'java/apiviz-1.2.5.GA/src'
=== added directory 'java/apiviz-1.2.5.GA/src/assembly'
=== added file 'java/apiviz-1.2.5.GA/src/assembly/default.xml'
--- a/java/apiviz-1.2.5.GA/src/assembly/default.xml 1970-01-01 00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/assembly/default.xml 2008-12-30 20:05:50 +0000
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+ <id>dist</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <includeSiteDirectory>false</includeSiteDirectory>
+ <fileSets>
+ <!-- Source Code -->
+ <fileSet>
+ <includes>
+ <include>**/README*</include>
+ <include>**/LICENSE*</include>
+ <include>**/NOTICE*</include>
+ <include>**/*.txt</include>
+ <include>**/*.xml</include>
+ <include>**/src/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/target/**</exclude>
+ <exclude>**/.*/**</exclude>
+ </excludes>
+ </fileSet>
+
+ <!-- JAR -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>jar</outputDirectory>
+ <includes>
+ <include>${project.build.finalName}*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
+
=== added directory 'java/apiviz-1.2.5.GA/src/main'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/net'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/net/gleamynode'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz'
=== added file 'java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz/APIviz.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz/APIviz.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/net/gleamynode/apiviz/APIviz.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package net.gleamynode.apiviz;
+
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
+import com.sun.javadoc.RootDoc;
+
+/**
+ * @author The APIviz Project (netty@stripped)
+ * @author Trustin Lee (trustin@stripped)
+ *
+ * @version $Rev: 4 $, $Date: 2008-09-05 15:45:47 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public class APIviz {
+
+ public static boolean start(RootDoc root) {
+ return org.jboss.apiviz.APIviz.start(root);
+ }
+
+ public static boolean validOptions(String[][] options, DocErrorReporter
errorReporter) {
+ return org.jboss.apiviz.APIviz.validOptions(options, errorReporter);
+ }
+
+ public static int optionLength(String option) {
+ return org.jboss.apiviz.APIviz.optionLength(option);
+ }
+
+ public static LanguageVersion languageVersion() {
+ return org.jboss.apiviz.APIviz.languageVersion();
+ }
+}
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/org'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/org/jboss'
=== added directory 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz'
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIviz.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIviz.java 1970-01-01 00:00:00
+0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIviz.java 2008-12-30 20:05:50
+0000
@@ -0,0 +1,385 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import static org.jboss.apiviz.Constant.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jdepend.framework.JDepend;
+import jdepend.framework.JavaClass;
+import jdepend.framework.JavaPackage;
+import jdepend.framework.PackageFilter;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.RootDoc;
+import com.sun.tools.doclets.standard.Standard;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 50 $, $Date: 2008-12-03 18:36:18 +0900 (Wed, 03 Dec 2008) $
+ *
+ */
+public class APIviz {
+
+ private static final Pattern INSERTION_POINT_PATTERN = Pattern.compile(
+ "((<\\/PRE>)(?=\\s*<P>)|(?=<TABLE BORDER=\"1\"))");
+
+ public static boolean start(RootDoc root) {
+ root = new APIvizRootDoc(root);
+ if (!Standard.start(root)) {
+ return false;
+ }
+
+ if (!Graphviz.isAvailable()) {
+ root.printWarning("Graphviz is not found in the system path.");
+ root.printWarning("Skipping diagram generation.");
+ return true;
+ }
+
+ try {
+ File outputDirectory = getOutputDirectory(root.options());
+ ClassDocGraph graph = new ClassDocGraph(root);
+ if (shouldGeneratePackageDiagram(root.options())) {
+ generateOverviewSummary(root, graph, outputDirectory);
+ }
+ generatePackageSummaries(root, graph, outputDirectory);
+ generateClassDiagrams(root, graph, outputDirectory);
+ } catch(Throwable t) {
+ root.printError(
+ "An error occurred during diagram generation: " +
+ t.toString());
+ t.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean validOptions(String[][] options, DocErrorReporter
errorReporter) {
+ for (String[] o: options) {
+ if (OPTION_SOURCE_CLASS_PATH.equals(o[0])) {
+ File[] cp = getClassPath(options);
+ if (cp.length == 0) {
+ errorReporter.printError(
+ OPTION_SOURCE_CLASS_PATH +
+ " requires at least one valid class path.");
+ return false;
+ }
+ for (File f: cp) {
+ if (!f.exists() || !f.canRead()) {
+ errorReporter.printError(
+ f.toString() +
+ " doesn't exist or is not readable.");
+ return false;
+ }
+ }
+ }
+ }
+
+ List<String[]> newOptions = new ArrayList<String[]>();
+ for (String[] o: options) {
+ if (OPTION_SOURCE_CLASS_PATH.equals(o[0])) {
+ continue;
+ }
+ if (OPTION_NO_PACKAGE_DIAGRAM.equals(o[0])) {
+ continue;
+ }
+
+ newOptions.add(o);
+ }
+
+ return Standard.validOptions(
+ newOptions.toArray(new String[newOptions.size()][]),
+ errorReporter);
+ }
+
+ public static int optionLength(String option) {
+ if (OPTION_SOURCE_CLASS_PATH.equals(option)) {
+ return 2;
+ }
+
+ if (OPTION_NO_PACKAGE_DIAGRAM.equals(option)) {
+ return 1;
+ }
+
+ int answer = Standard.optionLength(option);
+
+ if (option.equals("-help")) {
+ // Print the options provided by APIviz.
+ System.out.println();
+ System.out.println("Provided by APIviz doclet:");
+ System.out.println("-sourceclasspath <pathlist> Specify where to
find source class files");
+ System.out.println("-nopackagediagram Do not generate the
package diagram in the overview summary");
+ }
+
+ return answer;
+ }
+
+ public static LanguageVersion languageVersion() {
+ return Standard.languageVersion();
+ }
+
+ private static void generateOverviewSummary(RootDoc root, ClassDocGraph graph, File
outputDirectory) throws IOException {
+ final Map<String, PackageDoc> packages = getPackages(root);
+ PackageFilter packageFilter = new PackageFilter() {
+ @Override
+ public boolean accept(String packageName) {
+ PackageDoc p = packages.get(packageName);
+ if (p == null) {
+ return false;
+ }
+
+ if (ClassDocGraph.isHidden(p)) {
+ return false;
+ }
+
+ return true;
+ }
+ };
+
+ JDepend jdepend = new JDepend(packageFilter);
+
+ File[] classPath = getClassPath(root.options());
+ for (File e: classPath) {
+ if (e.isDirectory()) {
+ root.printNotice(
+ "Included into dependency analysis: " + e);
+ jdepend.addDirectory(e.toString());
+ } else {
+ root.printNotice(
+ "Excluded from dependency analysis: " + e);
+ }
+ }
+
+ jdepend.analyze();
+
+ if (checkClasspathOption(root, jdepend)) {
+ instrumentDiagram(
+ root, outputDirectory, "overview-summary",
+ graph.getOverviewSummaryDiagram(jdepend));
+ } else {
+ root.printWarning(
+ "Please make sure that the '" +
+ OPTION_SOURCE_CLASS_PATH +
+ "' option was specified correctly.");
+ root.printWarning(
+ "Package dependency diagram will not be generated " +
+ "to avoid the inaccurate result.");
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static boolean checkClasspathOption(RootDoc root, JDepend jdepend) {
+ // Sanity check
+ boolean correctClasspath = true;
+ if (jdepend.countClasses() == 0) {
+ root.printWarning(
+ "JDepend was not able to locate any compiled class files.");
+ correctClasspath = false;
+ } else {
+ for (ClassDoc c: root.classes()) {
+ if (c.containingPackage() == null ||
+ c.containingPackage().name() == null ||
+ ClassDocGraph.isHidden(c.containingPackage())) {
+ continue;
+ }
+
+ boolean found = false;
+ String fqcn = c.containingPackage().name() + '.' + c.name().replace('.',
'$');
+ JavaPackage jpkg = jdepend.getPackage(c.containingPackage().name());
+ if (jpkg != null) {
+ Collection<JavaClass> jclasses = jpkg.getClasses();
+ if (jclasses != null) {
+ for (JavaClass jcls: jclasses) {
+ if (fqcn.equals(jcls.getName())) {
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!found) {
+ root.printWarning(
+ "JDepend was not able to locate some compiled class files: "
+ fqcn);
+ correctClasspath = false;
+ break;
+ }
+ }
+ }
+ return correctClasspath;
+ }
+
+ private static void generatePackageSummaries(RootDoc root, ClassDocGraph graph, File
outputDirectory) throws IOException {
+ for (PackageDoc p: getPackages(root).values()) {
+ instrumentDiagram(
+ root, outputDirectory,
+ p.name().replace('.', File.separatorChar) +
+ File.separatorChar + "package-summary",
+ graph.getPackageSummaryDiagram(p));
+ }
+ }
+
+ private static void generateClassDiagrams(RootDoc root, ClassDocGraph graph, File
outputDirectory) throws IOException {
+ for (ClassDoc c: root.classes()) {
+ if (c.containingPackage() == null) {
+ instrumentDiagram(
+ root, outputDirectory,
+ c.name(),
+ graph.getClassDiagram(c));
+ } else {
+ instrumentDiagram(
+ root, outputDirectory,
+ c.containingPackage().name().replace('.', File.separatorChar) +
+ File.separatorChar + c.name(),
+ graph.getClassDiagram(c));
+ }
+ }
+ }
+
+ static Map<String, PackageDoc> getPackages(RootDoc root) {
+ Map<String, PackageDoc> packages = new TreeMap<String, PackageDoc>();
+ for (ClassDoc c: root.classes()) {
+ PackageDoc p = c.containingPackage();
+ if(!packages.containsKey(p.name())) {
+ packages.put(p.name(), p);
+ }
+ }
+
+ return packages;
+ }
+
+ private static void instrumentDiagram(RootDoc root, File outputDirectory, String
filename, String diagram) throws IOException {
+ boolean needsBottomMargin = filename.contains("overview-summary") ||
filename.contains("package-summary");
+
+ File htmlFile = new File(outputDirectory, filename + ".html");
+ File pngFile = new File(outputDirectory, filename + ".png");
+ File mapFile = new File(outputDirectory, filename + ".map");
+
+ if (!htmlFile.exists()) {
+ // Shouldn't reach here anymore.
+ // I'm retaining the code just in case.
+ for (;;) {
+ int idx = filename.lastIndexOf(File.separatorChar);
+ if (idx > 0) {
+ filename = filename.substring(0, idx) + '.' +
+ filename.substring(idx + 1);
+ } else {
+ // Give up (maybe missing)
+ return;
+ }
+ htmlFile = new File(outputDirectory, filename + ".html");
+ if (htmlFile.exists()) {
+ pngFile = new File(outputDirectory, filename + ".png");
+ mapFile = new File(outputDirectory, filename + ".map");
+ break;
+ }
+ }
+ }
+
+ root.printNotice("Generating " + pngFile + "...");
+ Graphviz.writeImageAndMap(diagram, outputDirectory, filename);
+
+ try {
+ String oldContent = FileUtil.readFile(htmlFile);
+ String mapContent = FileUtil.readFile(mapFile);
+
+ Matcher matcher = INSERTION_POINT_PATTERN.matcher(oldContent);
+ if (!matcher.find()) {
+ throw new IllegalStateException(
+ "Failed to find an insertion point.");
+ }
+ String newContent =
+ oldContent.substring(0, matcher.end()) +
+ mapContent + NEWLINE +
+ "<CENTER><IMG SRC=\"" + pngFile.getName() +
+ "\" USEMAP=\"#APIVIZ\" BORDER=\"0\"></CENTER>" +
+ NEWLINE +
+ (needsBottomMargin? "<BR>" : "") +
+ NEWLINE +
+ oldContent.substring(matcher.end());
+ FileUtil.writeFile(htmlFile, newContent);
+ } finally {
+ mapFile.delete();
+ }
+ }
+
+ private static File getOutputDirectory(String[][] options) {
+ for (String[] o: options) {
+ if (o[0].equals("-d")) {
+ return new File(o[1]);
+ }
+ }
+
+ // Fall back to the current working directory.
+ return new File(System.getProperty("user.dir", "."));
+ }
+
+ private static boolean shouldGeneratePackageDiagram(String[][] options) {
+ for (String[] o: options) {
+ if (o[0].equals(OPTION_NO_PACKAGE_DIAGRAM)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static File[] getClassPath(String[][] options) {
+ Set<File> cp = new LinkedHashSet<File>();
+
+ for (String[] o: options) {
+ if (o[0].equals(OPTION_SOURCE_CLASS_PATH)) {
+ String[] cps = o[1].split(File.pathSeparator);
+ for (String p : cps) {
+ cp.add(new File(p));
+ }
+ }
+ }
+
+ for (String[] o: options) {
+ if (o[0].equals("-classpath")) {
+ String[] cps = o[1].split(File.pathSeparator);
+ for (String p : cps) {
+ cp.add(new File(p));
+ }
+ }
+ }
+
+ return cp.toArray(new File[cp.size()]);
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIvizRootDoc.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIvizRootDoc.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/APIvizRootDoc.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import static org.jboss.apiviz.Constant.*;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.SeeTag;
+import com.sun.javadoc.SourcePosition;
+import com.sun.javadoc.Tag;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 18 $, $Date: 2008-09-05 21:02:39 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public class APIvizRootDoc implements RootDoc {
+
+ private final RootDoc root;
+
+ public APIvizRootDoc(RootDoc root) {
+ this.root = root;
+ }
+
+ private static boolean isAboutApiVizTag(String msg) {
+ return msg.indexOf(TAG_COMPOSED_OF + ' ') >= 0 ||
+ msg.indexOf(TAG_HAS + ' ') >= 0 ||
+ msg.indexOf(TAG_HIDDEN + ' ') >= 0 ||
+ msg.indexOf(TAG_LANDMARK + ' ') >= 0 ||
+ msg.indexOf(TAG_OWNS + ' ') >= 0 ||
+ msg.indexOf(TAG_STEREOTYPE + ' ') >= 0 ||
+ msg.indexOf(TAG_USES + ' ') >= 0 ||
+ msg.indexOf(TAG_INHERIT + ' ') >= 0 ||
+ msg.indexOf(TAG_EXCLUDE + ' ') >= 0 ||
+ msg.indexOf(TAG_EXCLUDE_SUBTYPES + ' ') >= 0;
+ }
+
+ public void printWarning(SourcePosition arg0, String arg1) {
+ if (!isAboutApiVizTag(arg1)) {
+ root.printWarning(arg0, arg1);
+ }
+ }
+
+ public void printWarning(String arg0) {
+ if (!isAboutApiVizTag(arg0)) {
+ root.printWarning(arg0);
+ }
+ }
+
+ public ClassDoc[] classes() {
+ return root.classes();
+ }
+
+ public ClassDoc classNamed(String arg0) {
+ return root.classNamed(arg0);
+ }
+
+ public String commentText() {
+ return root.commentText();
+ }
+
+ public int compareTo(Object arg0) {
+ return root.compareTo(arg0);
+ }
+
+ public Tag[] firstSentenceTags() {
+ return root.firstSentenceTags();
+ }
+
+ public String getRawCommentText() {
+ return root.getRawCommentText();
+ }
+
+ public Tag[] inlineTags() {
+ return root.inlineTags();
+ }
+
+ public boolean isAnnotationType() {
+ return root.isAnnotationType();
+ }
+
+ public boolean isAnnotationTypeElement() {
+ return root.isAnnotationTypeElement();
+ }
+
+ public boolean isClass() {
+ return root.isClass();
+ }
+
+ public boolean isConstructor() {
+ return root.isConstructor();
+ }
+
+ public boolean isEnum() {
+ return root.isEnum();
+ }
+
+ public boolean isEnumConstant() {
+ return root.isEnumConstant();
+ }
+
+ public boolean isError() {
+ return root.isError();
+ }
+
+ public boolean isException() {
+ return root.isException();
+ }
+
+ public boolean isField() {
+ return root.isField();
+ }
+
+ public boolean isIncluded() {
+ return root.isIncluded();
+ }
+
+ public boolean isInterface() {
+ return root.isInterface();
+ }
+
+ public boolean isMethod() {
+ return root.isMethod();
+ }
+
+ public boolean isOrdinaryClass() {
+ return root.isOrdinaryClass();
+ }
+
+ public String name() {
+ return root.name();
+ }
+
+ public String[][] options() {
+ return root.options();
+ }
+
+ public PackageDoc packageNamed(String arg0) {
+ return root.packageNamed(arg0);
+ }
+
+ public SourcePosition position() {
+ return root.position();
+ }
+
+ public void printError(SourcePosition arg0, String arg1) {
+ root.printError(arg0, arg1);
+ }
+
+ public void printError(String arg0) {
+ root.printError(arg0);
+ }
+
+ public void printNotice(SourcePosition arg0, String arg1) {
+ root.printNotice(arg0, arg1);
+ }
+
+ public void printNotice(String arg0) {
+ root.printNotice(arg0);
+ }
+
+ public SeeTag[] seeTags() {
+ return root.seeTags();
+ }
+
+ public void setRawCommentText(String arg0) {
+ root.setRawCommentText(arg0);
+ }
+
+ public ClassDoc[] specifiedClasses() {
+ return root.specifiedClasses();
+ }
+
+ public PackageDoc[] specifiedPackages() {
+ return root.specifiedPackages();
+ }
+
+ public Tag[] tags() {
+ return root.tags();
+ }
+
+ public Tag[] tags(String arg0) {
+ return root.tags(arg0);
+ }
+}
=== added file
'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocComparator.java'
---
a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocComparator.java 1970-01-01
00:00:00 +0000
+++
b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocComparator.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import java.util.Comparator;
+
+import com.sun.javadoc.ClassDoc;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 24 $, $Date: 2008-09-06 09:23:03 +0900 (Sat, 06 Sep 2008) $
+ *
+ */
+class ClassDocComparator implements Comparator<ClassDoc> {
+
+ private final boolean portrait;
+
+ ClassDocComparator(boolean portrait) {
+ this.portrait = portrait;
+ }
+
+ public int compare(ClassDoc a, ClassDoc b) {
+ int precedenceDiff = getPrecedence(a) - getPrecedence(b);
+ if (precedenceDiff != 0) {
+ if (portrait) {
+ return -precedenceDiff;
+ } else {
+ return precedenceDiff;
+ }
+ }
+
+ if (portrait) {
+ return a.name().compareTo(b.name());
+ } else {
+ return b.name().compareTo(a.name());
+ }
+ }
+
+ private static int getPrecedence(ClassDoc c) {
+ if (c.isAnnotationType()) {
+ return 0;
+ }
+
+ if (c.isEnum()) {
+ return 1;
+ }
+
+ if (ClassDocGraph.isStaticType(c)) {
+ return 2;
+ }
+
+ if (c.isInterface()) {
+ return 3;
+ }
+
+ if (c.isAbstract()) {
+ return 4;
+ }
+
+ if (c.isError() || c.isException()) {
+ return 100;
+ }
+
+ return 50;
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocGraph.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocGraph.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/ClassDocGraph.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,904 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import static org.jboss.apiviz.Constant.*;
+import static org.jboss.apiviz.EdgeType.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+
+import jdepend.framework.JDepend;
+import jdepend.framework.JavaPackage;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.MethodDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.SeeTag;
+import com.sun.javadoc.Tag;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 37 $, $Date: 2008-09-09 23:29:17 +0900 (Tue, 09 Sep 2008) $
+ *
+ */
+public class ClassDocGraph {
+
+ private final RootDoc root;
+ private final Map<String, ClassDoc> nodes = new TreeMap<String,
ClassDoc>();
+ private final Map<ClassDoc, Set<Edge>> edges = new HashMap<ClassDoc,
Set<Edge>>();
+ private final Map<ClassDoc, Set<Edge>> reversedEdges = new
HashMap<ClassDoc, Set<Edge>>();
+
+ public ClassDocGraph(RootDoc root) {
+ this.root = root;
+
+ root.printNotice("Building graph for all classes...");
+ for (ClassDoc node: root.classes()) {
+ addNode(node, true);
+ }
+ }
+
+ private void addNode(ClassDoc node, boolean addRelatedClasses) {
+ String key = node.qualifiedName();
+ if (!nodes.containsKey(key)) {
+ nodes.put(key, node);
+ edges.put(node, new TreeSet<Edge>());
+ }
+
+ if (addRelatedClasses) {
+ addRelatedClasses(node);
+ }
+ }
+
+ private void addRelatedClasses(ClassDoc type) {
+ // Generalization
+ ClassDoc superType = type.superclass();
+ if (superType != null &&
+ !superType.qualifiedName().equals("java.lang.Object") &&
+ !superType.qualifiedName().equals("java.lang.Annotation") &&
+ !superType.qualifiedName().equals("java.lang.Enum")) {
+ addNode(superType, false);
+ addEdge(new Edge(GENERALIZATION, type, superType));
+ }
+
+ // Realization
+ for (ClassDoc i: type.interfaces()) {
+ if (i.qualifiedName().equals("java.lang.annotation.Annotation")) {
+ continue;
+ }
+
+ addNode(i, false);
+ addEdge(new Edge(REALIZATION, type, i));
+ }
+
+ // Apply custom doclet tags.
+ for (Tag t: type.tags()) {
+ if (t.name().equals(TAG_USES)) {
+ addEdge(new Edge(root, DEPENDENCY, type, t.text()));
+ } else if (t.name().equals(TAG_HAS)) {
+ addEdge(new Edge(root, NAVIGABILITY, type, t.text()));
+ } else if (t.name().equals(TAG_OWNS)) {
+ addEdge(new Edge(root, AGGREGATION, type, t.text()));
+ } else if (t.name().equals(TAG_COMPOSED_OF)) {
+ addEdge(new Edge(root, COMPOSITION, type, t.text()));
+ }
+ }
+
+ // Add an edge with '<<see also>>' label for the classes with @see
+ // tags, but avoid duplication.
+ for (SeeTag t: type.seeTags()) {
+ try {
+ if (t.referencedClass() == null) {
+ continue;
+ }
+ } catch (Exception e) {
+ continue;
+ }
+
+ String a = type.qualifiedName();
+ String b = t.referencedClass().qualifiedName();
+ addNode(t.referencedClass(), false);
+ if (a.compareTo(b) != 0) {
+ if (a.compareTo(b) < 0) {
+ addEdge(new Edge(
+ root, SEE_ALSO, type,
+ b + " - - «see also»"));
+ } else {
+ addEdge(new Edge(
+ root, SEE_ALSO, t.referencedClass(),
+ a + " - - «see also»"));
+ }
+ }
+ }
+ }
+
+ private void addEdge(Edge edge) {
+ edges.get(edge.getSource()).add(edge);
+
+ Set<Edge> reversedEdgeSubset = reversedEdges.get(edge.getTarget());
+ if (reversedEdgeSubset == null) {
+ reversedEdgeSubset = new TreeSet<Edge>();
+ reversedEdges.put((ClassDoc) edge.getTarget(), reversedEdgeSubset);
+ }
+ reversedEdgeSubset.add(edge);
+ }
+
+ public String getOverviewSummaryDiagram(JDepend jdepend) {
+ Map<String, PackageDoc> packages = new TreeMap<String,
PackageDoc>(new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return o2.compareTo(o1);
+ }
+ });
+
+ Set<Edge> edgesToRender = new TreeSet<Edge>();
+
+ addPackageDependencies(jdepend, packages, edgesToRender);
+
+ // Replace direct dependencies with transitive dependencies
+ // if possible to simplify the diagram.
+
+ //// Build the matrix first.
+ Map<Doc, Set<Doc>> dependencies = new HashMap<Doc,
Set<Doc>>();
+ for (Edge edge: edgesToRender) {
+ Set<Doc> nextDependencies = dependencies.get(edge.getSource());
+ if (nextDependencies == null) {
+ nextDependencies = new HashSet<Doc>();
+ dependencies.put(edge.getSource(), nextDependencies);
+ }
+ nextDependencies.add(edge.getTarget());
+ }
+
+ //// Remove the edges which doesn't change the effective relationship
+ //// which can be calculated by indirect (transitive) dependency resolution.
+ for (int i = edgesToRender.size(); i > 0 ; i --) {
+ for (Edge edge: edgesToRender) {
+ if (isIndirectlyReachable(dependencies, edge.getSource(),
edge.getTarget())) {
+ edgesToRender.remove(edge);
+ Set<Doc> targets = dependencies.get(edge.getSource());
+ if (targets != null) {
+ targets.remove(edge.getTarget());
+ }
+ break;
+ }
+ }
+ }
+
+ // Get the least common prefix to compact the diagram even further.
+ int minPackageNameLen = Integer.MAX_VALUE;
+ int maxPackageNameLen = Integer.MIN_VALUE;
+ for (String pname: packages.keySet()) {
+ if (pname.length() > maxPackageNameLen) {
+ maxPackageNameLen = pname.length();
+ }
+ if (pname.length() < minPackageNameLen) {
+ minPackageNameLen = pname.length();
+ }
+ }
+
+ if (minPackageNameLen == 0) {
+ throw new IllegalStateException("Unexpected empty package name");
+ }
+
+ int prefixLen = 0;
+ if (!packages.keySet().isEmpty()) {
+ String firstPackageName = packages.keySet().iterator().next();
+ for (prefixLen = minPackageNameLen; prefixLen > 0; prefixLen --) {
+ if (firstPackageName.charAt(prefixLen - 1) != '.') {
+ continue;
+ }
+
+ String candidatePrefix = firstPackageName.substring(0, prefixLen);
+ boolean found = true;
+ for (String pname: packages.keySet()) {
+ if (!pname.startsWith(candidatePrefix)) {
+ found = false;
+ break;
+ }
+ }
+
+ if (found) {
+ break;
+ }
+ }
+ }
+
+ StringBuilder buf = new StringBuilder(16384);
+ buf.append(
+ "digraph APIVIZ {" + NEWLINE +
+ "rankdir=LR;" + NEWLINE +
+ "ranksep=0.3;" + NEWLINE +
+ "nodesep=0.3;" + NEWLINE +
+ "mclimit=128;" + NEWLINE +
+ "outputorder=edgesfirst;" + NEWLINE +
+ "center=1;" + NEWLINE +
+ "remincross=true;" + NEWLINE +
+ "searchsize=65536;" + NEWLINE +
+ "edge [fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "style=\"setlinewidth(0.6)\"]; " + NEWLINE +
+ "node [shape=box, fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "width=0.1, height=0.1, style=\"setlinewidth(0.6)\"]; " + NEWLINE);
+
+ for (PackageDoc pkg: packages.values()) {
+ renderPackage(buf, pkg, prefixLen);
+ }
+
+ for (Edge edge: edgesToRender) {
+ renderEdge(null, buf, edge);
+ }
+
+ buf.append("}" + NEWLINE);
+
+ return buf.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void addPackageDependencies(
+ JDepend jdepend, Map<String, PackageDoc> packages, Set<Edge>
edgesToRender) {
+
+ Map<String, PackageDoc> allPackages = APIviz.getPackages(root);
+ for (String pname: allPackages.keySet()) {
+ if (isHidden(allPackages.get(pname))) {
+ continue;
+ }
+
+ JavaPackage pkg = jdepend.getPackage(pname);
+ if (pkg == null) {
+ continue;
+ }
+
+ packages.put(pname, allPackages.get(pname));
+
+ Collection<JavaPackage> epkgs = pkg.getEfferents();
+ if (epkgs == null) {
+ continue;
+ }
+
+ for (JavaPackage epkg: epkgs) {
+ if (isHidden(allPackages.get(epkg.getName()))) {
+ continue;
+ }
+ addPackageDependency(edgesToRender, allPackages.get(pname),
allPackages.get(epkg.getName()));
+ }
+ }
+ }
+
+ static boolean isHidden(Doc node) {
+ if (node.tags(TAG_HIDDEN).length > 0) {
+ return true;
+ }
+
+ Tag[] tags = node.tags(TAG_EXCLUDE);
+ if (tags == null) {
+ return false;
+ }
+
+ for (Tag t: tags) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static void addPackageDependency(
+ Set<Edge> edgesToRender, PackageDoc source, PackageDoc target) {
+ if (source != target && source.isIncluded() &&
target.isIncluded()) {
+ edgesToRender.add(
+ new Edge(EdgeType.DEPENDENCY, source, target));
+ }
+ }
+
+ private static boolean isIndirectlyReachable(Map<Doc, Set<Doc>>
dependencyGraph, Doc source, Doc target) {
+ Set<Doc> intermediaryTargets = dependencyGraph.get(source);
+ if (intermediaryTargets == null || intermediaryTargets.isEmpty()) {
+ return false;
+ }
+
+ Set<Doc> visited = new HashSet<Doc>();
+ visited.add(source);
+
+ for (Doc t: intermediaryTargets) {
+ if (t == target) {
+ continue;
+ }
+ if (isIndirectlyReachable(dependencyGraph, t, target, visited)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean isIndirectlyReachable(Map<Doc, Set<Doc>>
dependencyGraph, Doc source, Doc target, Set<Doc> visited) {
+ if (visited.contains(source)) {
+ // Evade cyclic dependency.
+ return false;
+ }
+ visited.add(source);
+
+ Set<Doc> intermediaryTargets = dependencyGraph.get(source);
+ if (intermediaryTargets == null || intermediaryTargets.isEmpty()) {
+ return false;
+ }
+
+ for (Doc t: intermediaryTargets) {
+ if (t == target) {
+ return true;
+ }
+
+ if (isIndirectlyReachable(dependencyGraph, t, target, visited)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String getPackageSummaryDiagram(PackageDoc pkg) {
+ StringBuilder buf = new StringBuilder(16384);
+ buf.append(
+ "digraph APIVIZ {" + NEWLINE +
+ "rankdir=LR;" + NEWLINE +
+ "ranksep=0.3;" + NEWLINE +
+ "nodesep=0.3;" + NEWLINE +
+ "mclimit=1024;" + NEWLINE +
+ "outputorder=edgesfirst;" + NEWLINE +
+ "center=1;" + NEWLINE +
+ "remincross=true;" + NEWLINE +
+ "searchsize=65536;" + NEWLINE +
+ "edge [fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "style=\"setlinewidth(0.6)\"]; " + NEWLINE +
+ "node [shape=box, fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "width=0.1, height=0.1, style=\"setlinewidth(0.6)\"]; " + NEWLINE);
+
+ Map<String, ClassDoc> nodesToRender = new TreeMap<String,
ClassDoc>();
+
+ Set<Edge> edgesToRender = new TreeSet<Edge>();
+
+ for (ClassDoc node: nodes.values()) {
+ fetchSubgraph(pkg, node, nodesToRender, edgesToRender, true, false, true);
+ }
+
+ renderSubgraph(pkg, null, buf, nodesToRender, edgesToRender, true);
+
+ buf.append("}" + NEWLINE);
+
+ return buf.toString();
+ }
+
+ private void fetchSubgraph(
+ PackageDoc pkg, ClassDoc cls,
+ Map<String, ClassDoc> nodesToRender, Set<Edge> edgesToRender,
+ boolean useHidden, boolean useSee, boolean forceInherit) {
+
+ if (useHidden && isHidden(cls)) {
+ return;
+ }
+
+ if (forceInherit) {
+ for (Tag t: pkg.tags(TAG_EXCLUDE)) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ continue;
+ }
+
+ if (Pattern.compile(t.text().trim()).matcher(cls.qualifiedName()).find())
{
+ return;
+ }
+ }
+ }
+
+ if (cls.containingPackage() == pkg) {
+ Set<Edge> directEdges = edges.get(cls);
+ nodesToRender.put(cls.qualifiedName(), cls);
+ for (Edge edge: directEdges) {
+ if (!useSee && edge.getType() == SEE_ALSO) {
+ continue;
+ }
+
+ ClassDoc source = (ClassDoc) edge.getSource();
+ ClassDoc target = (ClassDoc) edge.getTarget();
+
+ boolean excluded = false;
+ if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
+ for (Tag t: pkg.tags(TAG_EXCLUDE)) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ continue;
+ }
+
+ Pattern p = Pattern.compile(t.text().trim());
+
+ if (p.matcher(source.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ if (p.matcher(target.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ }
+ if (excluded) {
+ continue;
+ }
+ }
+
+ for (Tag t: cls.tags(TAG_EXCLUDE)) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ continue;
+ }
+
+ Pattern p = Pattern.compile(t.text().trim());
+
+ if (p.matcher(source.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ if (p.matcher(target.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ }
+ if (excluded) {
+ continue;
+ }
+
+ if (!useHidden || !isHidden(source) && !isHidden(target)) {
+ edgesToRender.add(edge);
+ }
+ if (!useHidden || !isHidden(source)) {
+ nodesToRender.put(source.qualifiedName(), source);
+ }
+ if (!useHidden || !isHidden(target)) {
+ nodesToRender.put(target.qualifiedName(), target);
+ }
+ }
+
+ Set<Edge> reversedDirectEdges = reversedEdges.get(cls);
+ if (reversedDirectEdges != null) {
+ for (Edge edge: reversedDirectEdges) {
+ if (!useSee && edge.getType() == SEE_ALSO) {
+ continue;
+ }
+
+ if (cls.tags(TAG_EXCLUDE_SUBTYPES).length > 0 &&
+ (edge.getType() == EdgeType.GENERALIZATION ||
+ edge.getType() == EdgeType.REALIZATION)) {
+ continue;
+ }
+
+ ClassDoc source = (ClassDoc) edge.getSource();
+ ClassDoc target = (ClassDoc) edge.getTarget();
+
+ boolean excluded = false;
+ if (forceInherit || cls.tags(TAG_INHERIT).length > 0) {
+ for (Tag t: pkg.tags(TAG_EXCLUDE)) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ continue;
+ }
+
+ Pattern p = Pattern.compile(t.text().trim());
+
+ if (p.matcher(source.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ if (p.matcher(target.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ }
+ if (excluded) {
+ continue;
+ }
+ }
+
+ for (Tag t: cls.tags(TAG_EXCLUDE)) {
+ if (t.text() == null || t.text().trim().length() == 0) {
+ continue;
+ }
+
+ Pattern p = Pattern.compile(t.text().trim());
+
+ if (p.matcher(source.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ if (p.matcher(target.qualifiedName()).find()) {
+ excluded = true;
+ break;
+ }
+ }
+ if (excluded) {
+ continue;
+ }
+
+ if (!useHidden || !isHidden(source) && !isHidden(target)) {
+ edgesToRender.add(edge);
+ }
+ if (!useHidden || !isHidden(source)) {
+ nodesToRender.put(source.qualifiedName(), source);
+ }
+ if (!useHidden || !isHidden(target)) {
+ nodesToRender.put(target.qualifiedName(), target);
+ }
+ }
+ }
+ }
+ }
+
+ public String getClassDiagram(ClassDoc cls) {
+ PackageDoc pkg = cls.containingPackage();
+
+ StringBuilder buf = new StringBuilder(16384);
+ Map<String, ClassDoc> nodesToRender = new TreeMap<String,
ClassDoc>();
+ Set<Edge> edgesToRender = new TreeSet<Edge>();
+
+ fetchSubgraph(pkg, cls, nodesToRender, edgesToRender, false, true, false);
+
+ buf.append("digraph APIVIZ {" + NEWLINE);
+
+ // Determine the graph orientation automatically.
+ int nodesAbove = 0;
+ int nodesBelow = 0;
+ for (Edge e: edgesToRender) {
+ if (e.getType().isReversed()) {
+ if (e.getSource() == cls) {
+ nodesAbove ++;
+ } else {
+ nodesBelow ++;
+ }
+ } else {
+ if (e.getSource() == cls) {
+ nodesBelow ++;
+ } else {
+ nodesAbove ++;
+ }
+ }
+ }
+
+ boolean portrait;
+ if (Math.max(nodesAbove, nodesBelow) <= 5) {
+ // Landscape looks better usually up to 5.
+ // There are just a few subtypes and supertypes.
+ buf.append(
+ "rankdir=TB;" + NEWLINE +
+ "ranksep=0.4;" + NEWLINE +
+ "nodesep=0.3;" + NEWLINE);
+ portrait = false;
+ } else {
+ // Portrait looks better.
+ // There are too many subtypes or supertypes.
+ buf.append(
+ "rankdir=LR;" + NEWLINE +
+ "ranksep=1.0;" + NEWLINE +
+ "nodesep=0.2;" + NEWLINE);
+ portrait = true;
+ }
+
+ buf.append(
+ "mclimit=128;" + NEWLINE +
+ "outputorder=edgesfirst;" + NEWLINE +
+ "center=1;" + NEWLINE +
+ "remincross=true;" + NEWLINE +
+ "searchsize=65536;" + NEWLINE +
+ "edge [fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "style=\"setlinewidth(0.6)\"]; " + NEWLINE +
+ "node [shape=box, fontsize=10, fontname=\"" + NORMAL_FONT + "\", " +
+ "width=0.1, height=0.1, style=\"setlinewidth(0.6)\"]; " + NEWLINE);
+
+ renderSubgraph(pkg, cls, buf, nodesToRender, edgesToRender, portrait);
+
+ buf.append("}" + NEWLINE);
+
+ return buf.toString();
+ }
+
+ private void renderSubgraph(PackageDoc pkg, ClassDoc cls,
+ StringBuilder buf, Map<String, ClassDoc> nodesToRender,
+ Set<Edge> edgesToRender, boolean portrait) {
+
+ List<ClassDoc> nodesToRenderCopy = new
ArrayList<ClassDoc>(nodesToRender.values());
+ Collections.sort(nodesToRenderCopy, new ClassDocComparator(portrait));
+
+ for (ClassDoc node: nodesToRenderCopy) {
+ renderClass(pkg, cls, buf, node);
+ }
+
+ for (Edge edge: edgesToRender) {
+ renderEdge(pkg, buf, edge);
+ }
+ }
+
+ private static void renderPackage(
+ StringBuilder buf, PackageDoc pkg, int prefixLen) {
+
+ String href = pkg.name().replace('.', '/') + "/package-summary.html";
+ buf.append(getNodeId(pkg));
+ buf.append(" [label=\"");
+ buf.append(pkg.name().substring(prefixLen));
+ buf.append("\", style=\"filled");
+ if (pkg.tags("@deprecated").length > 0) {
+ buf.append(",dotted");
+ }
+ buf.append("\", fillcolor=\"");
+ buf.append(getFillColor(pkg));
+ buf.append("\", href=\"");
+ buf.append(href);
+ buf.append("\"];");
+ buf.append(NEWLINE);
+ }
+
+ private static void renderClass(PackageDoc pkg, ClassDoc cls, StringBuilder buf,
ClassDoc node) {
+ String fillColor = getFillColor(pkg, cls, node);
+ String lineColor = getLineColor(pkg, node);
+ String fontColor = getFontColor(pkg, node);
+ String href = getPath(pkg, node);
+
+ buf.append(getNodeId(node));
+ buf.append(" [label=\"");
+ buf.append(getNodeLabel(pkg, node));
+ buf.append("\", tooltip=\"");
+ buf.append(escape(getNodeLabel(pkg, node)));
+ buf.append("\"");
+ if (node.isAbstract() && !node.isInterface()) {
+ buf.append(", fontname=\"");
+ buf.append(ITALIC_FONT);
+ buf.append("\"");
+ }
+ buf.append(", style=\"filled");
+ if (node.tags("@deprecated").length > 0) {
+ buf.append(",dotted");
+ }
+ buf.append("\", color=\"");
+ buf.append(lineColor);
+ buf.append("\", fontcolor=\"");
+ buf.append(fontColor);
+ buf.append("\", fillcolor=\"");
+ buf.append(fillColor);
+
+ if (href != null) {
+ buf.append("\", href=\"");
+ buf.append(href);
+ }
+
+ buf.append("\"];");
+ buf.append(NEWLINE);
+ }
+
+ private void renderEdge(PackageDoc pkg, StringBuilder buf, Edge edge) {
+ EdgeType type = edge.getType();
+ String lineColor = getLineColor(pkg, edge);
+ String fontColor = getFontColor(pkg, edge);
+
+ // Graphviz lays out nodes upside down - adjust for
+ // important relationships.
+ boolean reverse = edge.getType().isReversed();
+
+ if (reverse) {
+ buf.append(getNodeId(edge.getTarget()));
+ buf.append(" -> ");
+ buf.append(getNodeId(edge.getSource()));
+ buf.append(" [arrowhead=\"");
+ buf.append(type.getArrowTail());
+ buf.append("\", arrowtail=\"");
+ buf.append(type.getArrowHead() == null? (edge.isOneway()? "open" : "none") :
type.getArrowHead());
+ } else {
+ buf.append(getNodeId(edge.getSource()));
+ buf.append(" -> ");
+ buf.append(getNodeId(edge.getTarget()));
+ buf.append(" [arrowhead=\"");
+ buf.append(type.getArrowHead() == null? (edge.isOneway()? "open" : "none") :
type.getArrowHead());
+ buf.append("\", arrowtail=\"");
+ buf.append(type.getArrowTail());
+ }
+
+ buf.append("\", style=\"" + type.getStyle());
+ buf.append("\", color=\"");
+ buf.append(lineColor);
+ buf.append("\", fontcolor=\"");
+ buf.append(fontColor);
+ buf.append("\", label=\"");
+ buf.append(escape(edge.getEdgeLabel()));
+ buf.append("\", headlabel=\"");
+ buf.append(escape(edge.getTargetLabel()));
+ buf.append("\", taillabel=\"");
+ buf.append(escape(edge.getSourceLabel()));
+ buf.append("\" ];");
+ buf.append(NEWLINE);
+ }
+
+ private static String getStereotype(ClassDoc node) {
+ String stereotype = node.isInterface()? "interface" : null;
+ if (node.isException() || node.isError()) {
+ stereotype = "exception";
+ } else if (node.isAnnotationType()) {
+ stereotype = "annotation";
+ } else if (node.isEnum()) {
+ stereotype = "enum";
+ } else if (isStaticType(node)) {
+ stereotype = "static";
+ }
+
+ if (node.tags(TAG_STEREOTYPE).length > 0) {
+ stereotype = node.tags(TAG_STEREOTYPE)[0].text();
+ }
+
+ return escape(stereotype);
+ }
+
+ static boolean isStaticType(ClassDoc node) {
+ boolean staticType = true;
+ int methods = 0;
+ for (MethodDoc m: node.methods()) {
+ if (m.isConstructor()) {
+ continue;
+ }
+ methods ++;
+ if (!m.isStatic()) {
+ staticType = false;
+ break;
+ }
+ }
+
+ return staticType && methods > 0;
+ }
+
+ private static String getFillColor(PackageDoc pkg) {
+ String color = "white";
+ if (pkg.tags(TAG_LANDMARK).length > 0) {
+ color = "khaki1";
+ }
+ return color;
+ }
+
+ private static String getFillColor(PackageDoc pkg, ClassDoc cls, ClassDoc node) {
+ String color = "white";
+ if (cls == null) {
+ if (node.containingPackage() == pkg && node.tags(TAG_LANDMARK).length
> 0) {
+ color = "khaki1";
+ }
+ } else if (cls == node) {
+ color = "khaki1";
+ }
+ return color;
+ }
+
+ private static String getLineColor(PackageDoc pkg, ClassDoc doc) {
+ String color = "black";
+ if (!(doc.containingPackage() == pkg)) {
+ color = "gray";
+ }
+ return color;
+ }
+
+ private static String getLineColor(PackageDoc pkg, Edge edge) {
+ if (edge.getTarget() instanceof ClassDoc) {
+ return getLineColor(pkg, (ClassDoc) edge.getTarget());
+ } else {
+ return "black";
+ }
+ }
+
+ private static String getFontColor(PackageDoc pkg, ClassDoc doc) {
+ String color = "black";
+ if (!(doc.containingPackage() == pkg)) {
+ color = "gray30";
+ }
+ return color;
+ }
+
+ private static String getFontColor(PackageDoc pkg, Edge edge) {
+ if (edge.getTarget() instanceof ClassDoc) {
+ return getFontColor(pkg, (ClassDoc) edge.getTarget());
+ } else {
+ return "black";
+ }
+ }
+
+ private static String getNodeId(Doc node) {
+ String name;
+ if (node instanceof ClassDoc) {
+ name = ((ClassDoc) node).qualifiedName();
+ } else {
+ name = node.name();
+ }
+ return name.replace('.', '_');
+ }
+
+ private static String getNodeLabel(PackageDoc pkg, ClassDoc node) {
+ StringBuilder buf = new StringBuilder(256);
+ String stereotype = getStereotype(node);
+ if (stereotype != null) {
+ buf.append("«");
+ buf.append(stereotype);
+ buf.append("»\\n");
+ }
+
+ if (node.containingPackage() == pkg) {
+ buf.append(node.name());
+ } else {
+ if (node.containingPackage() == null) {
+ buf.append(node.name());
+ } else {
+ buf.append(node.name());
+ buf.append("\\n(");
+ buf.append(node.containingPackage().name());
+ buf.append(')');
+ }
+ }
+ return buf.toString();
+ }
+
+ private static String escape(String text) {
+ // Escape some characters to prevent syntax errors.
+ if (text != null) {
+ text = text.replaceAll("" +
+ "(\"|'|\\\\.?|\\s)+", " ");
+ }
+ return text;
+ }
+
+ private static String getPath(PackageDoc pkg, ClassDoc node) {
+ if (!node.isIncluded()) {
+ return null;
+ }
+
+ String sourcePath = pkg.name().replace('.', '/');
+ String targetPath =
+ node.containingPackage().name().replace('.', '/') + '/' +
+ node.name() + ".html";
+ String[] sourcePathElements = sourcePath.split("[\\/\\\\]+");
+ String[] targetPathElements = targetPath.split("[\\/\\\\]+");
+
+ int maxCommonLength = Math.min(sourcePathElements.length,
targetPathElements.length);
+ int commonLength;
+ for (commonLength = 0; commonLength < maxCommonLength; commonLength ++) {
+ if
(!sourcePathElements[commonLength].equals(targetPathElements[commonLength])) {
+ break;
+ }
+ }
+
+ StringBuilder buf = new StringBuilder();
+ for (int i = 0; i < sourcePathElements.length - commonLength; i ++) {
+ buf.append("/..");
+ }
+
+ for (int i = commonLength; i < targetPathElements.length; i ++) {
+ buf.append('/');
+ buf.append(targetPathElements[i]);
+ }
+ return buf.substring(1);
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Constant.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Constant.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Constant.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 50 $, $Date: 2008-12-03 18:36:18 +0900 (Wed, 03 Dec 2008) $
+ *
+ */
+public class Constant {
+
+ public static final String NEWLINE = System.getProperty("line.separator", "\n");
+ public static final String NORMAL_FONT = "Helvetica";
+ public static final String ITALIC_FONT = "Helvetica-Oblique";
+
+ public static final String TAG_PREFIX = "@apiviz.";
+
+ // TODO change relationship spec to edgelabel sourcelabel targetlabel
+ // TODO Split apiviz.has into two tags
+
+ /* apiviz.stereotype <name> */
+ public static final String TAG_STEREOTYPE = TAG_PREFIX + "stereotype";
+ /* apiviz.uses <FQCN> [<sourceLabel> <targetLabel>
[<edgeLabel>]] */
+ public static final String TAG_USES = TAG_PREFIX + "uses";
+ /* apiviz.has <FQCN> [oneway] [<sourceLabel> <targetLabel>
[<edgeLabel>]] */
+ public static final String TAG_HAS = TAG_PREFIX + "has";
+ /* apiviz.owns <FQCN> [<sourceLabel> <targetLabel>
[<edgeLabel>]] */
+ public static final String TAG_OWNS = TAG_PREFIX + "owns";
+ /* apiviz.composedOf <FQCN> [<sourceLabel> <targetLabel>
[<edgeLabel>]] */
+ public static final String TAG_COMPOSED_OF = TAG_PREFIX + "composedOf";
+ /* apiviz.landmark */
+ public static final String TAG_LANDMARK = TAG_PREFIX + "landmark";
+ /* apiviz.hidden */
+ public static final String TAG_HIDDEN = TAG_PREFIX + "hidden";
+ /* apiviz.exclude <regex> */
+ public static final String TAG_EXCLUDE = TAG_PREFIX + "exclude";
+ /* apiviz.excludeSubtypes */
+ public static final String TAG_EXCLUDE_SUBTYPES = TAG_PREFIX + "excludeSubtypes";
+ /* apiviz.inherit */
+ public static final String TAG_INHERIT = TAG_PREFIX + "inherit";
+
+ // Options
+
+ public static final String OPTION_NO_PACKAGE_DIAGRAM = "-nopackagediagram";
+ public static final String OPTION_SOURCE_CLASS_PATH = "-sourceclasspath";
+
+ private Constant() {
+ // Unused
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Edge.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Edge.java 1970-01-01 00:00:00
+0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Edge.java 2008-12-30 20:05:50
+0000
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.RootDoc;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 3 $, $Date: 2008-09-05 15:44:05 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public class Edge implements Comparable<Edge> {
+ private final EdgeType type;
+ private final Doc source;
+ private final Doc target;
+ private final String sourceLabel;
+ private final String targetLabel;
+ private final String edgeLabel;
+ private final boolean oneway;
+ private final int hashCode;
+
+ public Edge(EdgeType type, Doc source, Doc target) {
+ this.type = type;
+ this.source = source;
+ this.target = target;
+ sourceLabel = "";
+ targetLabel = "";
+ edgeLabel = "";
+ oneway = true;
+ hashCode = calculateHashCode();
+ }
+
+ private int calculateHashCode(){
+ return ((((((oneway ? 31 : 0) + type.hashCode()) * 31 +
getSourceName().hashCode()) * 31 + getTargetName().hashCode()) * 31 +
sourceLabel.hashCode()) * 31 + targetLabel.hashCode()) * 31 + edgeLabel.hashCode();
+ }
+
+ private String getSourceName() {
+ if (source instanceof ClassDoc) {
+ return ((ClassDoc) source).qualifiedName();
+ } else {
+ return source.name();
+ }
+ }
+
+ private String getTargetName() {
+ if (target instanceof ClassDoc) {
+ return ((ClassDoc) target).qualifiedName();
+ } else {
+ return target.name();
+ }
+ }
+
+ public Edge(RootDoc rootDoc, EdgeType type, Doc source, String spec) {
+ if (spec == null) {
+ spec = "";
+ }
+
+ this.type = type;
+ this.source = source;
+
+ String[] args = spec.replaceAll("\\s+", " ").trim().split(" ");
+ for (int i = 1; i < Math.min(4, args.length); i ++) {
+ if (args[i].equals("-")) {
+ args[i] = "";
+ }
+ }
+
+ if (args.length == 1) {
+ target = rootDoc.classNamed(args[0]);
+ sourceLabel = "";
+ targetLabel = "";
+ edgeLabel = "";
+ oneway = true;
+ } else if (args.length >= 3) {
+ target = rootDoc.classNamed(args[0]);
+ if (args.length > 3) {
+ int startIndex;
+ if (args[1].equalsIgnoreCase("oneway")) {
+ oneway = true;
+ sourceLabel = args[2];
+ targetLabel = args[3];
+ startIndex = 4;
+ } else {
+ oneway = false;
+ sourceLabel = args[1];
+ targetLabel = args[2];
+ startIndex = 3;
+ }
+
+ StringBuilder buf = new StringBuilder();
+ for (int i = startIndex; i < args.length; i ++) {
+ buf.append(' ');
+ buf.append(args[i]);
+ }
+ if (buf.length() == 0) {
+ edgeLabel = "";
+ } else {
+ edgeLabel = buf.substring(1);
+ }
+ } else {
+ oneway = false;
+ sourceLabel = args[1];
+ targetLabel = args[2];
+ edgeLabel = "";
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid relationship syntax: " + spec);
+ }
+
+ if (target == null) {
+ throw new IllegalArgumentException(
+ "Invalid relationship syntax: " + spec +
+ " (Unknown package or class name)");
+ }
+
+ hashCode = calculateHashCode();
+ }
+
+ public EdgeType getType() {
+ return type;
+ }
+
+ public Doc getSource() {
+ return source;
+ }
+
+ public Doc getTarget() {
+ return target;
+ }
+
+ public String getSourceLabel() {
+ return sourceLabel;
+ }
+
+ public String getTargetLabel() {
+ return targetLabel;
+ }
+
+ public String getEdgeLabel() {
+ return edgeLabel;
+ }
+
+ public boolean isOneway() {
+ return oneway;
+ }
+
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof Edge)) {
+ return false;
+ }
+
+ Edge that = (Edge) o;
+ return type == that.type && oneway == that.oneway &&
+ source == that.source && target == that.target &&
+ edgeLabel.equals(that.edgeLabel) &&
+ sourceLabel.equals(that.sourceLabel) &&
+ targetLabel.equals(that.targetLabel);
+ }
+
+ public int compareTo(Edge that) {
+ int v;
+
+ v = type.compareTo(that.type);
+ if (v != 0) {
+ return v;
+ }
+
+ v = getSourceName().compareTo(that.getSourceName());
+ if (v != 0) {
+ return v;
+ }
+
+ v = getTargetName().compareTo(that.getTargetName());
+ if (v != 0) {
+ return v;
+ }
+
+ v = Boolean.valueOf(oneway).compareTo(Boolean.valueOf(that.oneway));
+ if (v != 0) {
+ return v;
+ }
+
+ v = edgeLabel.compareTo(that.edgeLabel);
+ if (v != 0) {
+ return v;
+ }
+
+ v = sourceLabel.compareTo(that.sourceLabel);
+ if (v != 0) {
+ return v;
+ }
+
+ v = targetLabel.compareTo(that.targetLabel);
+ return v;
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/EdgeType.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/EdgeType.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/EdgeType.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 12 $, $Date: 2008-09-05 19:51:20 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public enum EdgeType {
+ GENERALIZATION("enormal", "solid", true),
+ REALIZATION("enormal", "dashed", true),
+ DEPENDENCY("open", "dashed", true),
+ AGGREGATION("open", "solid", "ediamond", false),
+ COMPOSITION("open", "solid", "diamond", false),
+ NAVIGABILITY(null, "solid", false),
+ SEE_ALSO("none", "solid", false);
+
+ private final String arrowHead;
+ private final String style;
+ private final String arrowTail;
+ private final boolean reversed;
+
+ private EdgeType(String arrowHead, String style, boolean reversed) {
+ this(arrowHead, style, "none", reversed);
+ }
+
+ private EdgeType(String arrowHead, String style, String arrowTail, boolean reversed)
{
+ this.arrowHead = arrowHead;
+ this.style = style;
+ this.arrowTail = arrowTail;
+ this.reversed = reversed;
+ }
+
+ public String getArrowHead() {
+ return arrowHead;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public String getArrowTail() {
+ return arrowTail;
+ }
+
+ public boolean isReversed() {
+ return reversed;
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/FileUtil.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/FileUtil.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/FileUtil.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 3 $, $Date: 2008-09-05 15:44:05 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public class FileUtil {
+
+ public static String readFile(File file) throws IOException {
+ byte[] byteContent;
+ RandomAccessFile in = new RandomAccessFile(file, "r");
+ try {
+ byteContent = new byte[(int) in.length()];
+ in.readFully(byteContent);
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Ignore.
+ }
+ }
+
+ return new String(byteContent, "ISO-8859-1");
+ }
+
+ public static void writeFile(File file, String content) throws IOException {
+ FileOutputStream out = new FileOutputStream(file);
+ try {
+ out.write(content.getBytes("ISO-8859-1"));
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Ignore.
+ }
+ }
+ }
+
+ private FileUtil() {
+ // Unused
+ }
+}
=== added file 'java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Graphviz.java'
--- a/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Graphviz.java 1970-01-01
00:00:00 +0000
+++ b/java/apiviz-1.2.5.GA/src/main/java/org/jboss/apiviz/Graphviz.java 2008-12-30
20:05:50 +0000
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @author tags. See the COPYRIGHT.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.apiviz;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+/**
+ * @author The APIviz Project (apiviz-dev@stripped)
+ * @author Trustin Lee (tlee@stripped)
+ *
+ * @version $Rev: 3 $, $Date: 2008-09-05 15:44:05 +0900 (Fri, 05 Sep 2008) $
+ *
+ */
+public class Graphviz {
+
+ public static boolean isAvailable() {
+ String executable = Graphviz.getExecutable();
+ File home = Graphviz.getHome();
+
+ ProcessBuilder pb = new ProcessBuilder(executable, "-V");
+ pb.redirectErrorStream(true);
+ if (home != null) {
+ System.out.println("Graphviz Home: " + home);
+ pb.directory(home);
+ }
+ System.out.println("Graphviz Executable: " + executable);
+
+ Process p;
+ try {
+ p = pb.start();
+ } catch (IOException e) {
+ return false;
+ }
+
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(p.getInputStream()));
+ OutputStream out = p.getOutputStream();
+ try {
+ out.close();
+
+ String line = null;
+ while((line = in.readLine()) != null) {
+ if (line.indexOf("Graphviz") >= 0) {
+ return true;
+ }
+ }
+ return false;
+ } catch (IOException e) {
+ return false;
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Shouldn't happen.
+ }
+
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Shouldn't happen.
+ }
+
+ for (;;) {
+ try {
+ p.waitFor();
+ break;
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ public static void writeImageAndMap(
+ String diagram, File outputDirectory, String filename) throws IOException {
+
+ File pngFile = new File(outputDirectory, filename + ".png");
+ File mapFile = new File(outputDirectory, filename + ".map");
+
+ pngFile.delete();
+ mapFile.delete();
+
+ ProcessBuilder pb = new ProcessBuilder(
+ Graphviz.getExecutable(),
+ "-Tcmapx", "-o", mapFile.getAbsolutePath(),
+ "-Tpng", "-o", pngFile.getAbsolutePath());
+ pb.redirectErrorStream(true);
+ File home = Graphviz.getHome();
+ if (home != null) {
+ pb.directory(home);
+ }
+
+ Process p = pb.start();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(p.getInputStream()));
+ Writer out = new OutputStreamWriter(p.getOutputStream(), "UTF-8");
+ try {
+ out.write(diagram);
+ out.close();
+
+ String line = null;
+ while((line = in.readLine()) != null) {
+ System.err.println(line);
+ }
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Shouldn't happen.
+ }
+
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Shouldn't happen.
+ }
+
+ for (;;) {
+ try {
+ int result = p.waitFor();
+ if (result != 0) {
+ throw new IllegalStateException("Graphviz exited with a non-zero
return value: " + result);
+ }
+ break;
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ private static String getExecutable() {
+ String command = "dot";
+
+ try {
+ String osName = System.getProperty("os.name");
+ if (osName != null && osName.indexOf("Windows") >= 0) {
+ File path = Graphviz.getHome();
+ if (path != null) {
+ command = path.getAbsolutePath() + File.separator
+ + "dot.exe";
+ } else {
+ command = "dot.exe";
+ }
+ }
+ } catch (Exception e) {
+ // ignore me!
+ }
+ return command;
+ }
+
+ private static File getHome() {
+ File graphvizDir = null;
+ try {
+ String graphvizHome = System.getProperty("graphviz.home");
+ if (graphvizHome != null) {
+ graphvizDir = new File(graphvizHome);
+ if (!graphvizDir.exists() || !graphvizDir.isDirectory()) {
+ return null;
+ }
+ }
+ } catch (Exception e) {
+ // ignore...
+ }
+ return graphvizDir;
+ }
+
+ private Graphviz() {
+ // Unused
+ }
+}
=== added directory 'java/apiviz-1.2.5.GA/src/test'
=== added directory 'java/apiviz-1.2.5.GA/src/test/java'
=== added directory 'java/apiviz-1.2.5.GA/src/test/java/net'
=== added directory 'java/apiviz-1.2.5.GA/src/test/java/net/gleamynode'
=== added directory 'java/apiviz-1.2.5.GA/src/test/java/net/gleamynode/apiviz'
=== modified file 'java/build.xml'
--- a/java/build.xml 2008-12-13 18:10:05 +0000
+++ b/java/build.xml 2008-12-30 20:05:50 +0000
@@ -99,6 +99,8 @@
!-->
<target name="javadoc">
<javadoc packagenames="com.mysql.cluster.*"
+ doclet="org.jboss.apiviz.APIviz"
+ docletpath="apiviz-1.2.5.GA/jar/apiviz-1.2.5.GA.jar"
destdir="javadoc" windowtitle="NDB/J API"
classpathref="project.cp">
<fileset dir="src/java" defaultexcludes="true">
| Thread |
|---|
| • bzr commit into NDB/Bindings:trunk branch (mordred:471) | Monty Taylor | 30 Dec |