aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eji...@apache.org
Subject svn commit: r1179673 [1/3] - in /aries/trunk/versioning: ./ versioning-checker/ versioning-checker/src/ versioning-checker/src/main/ versioning-checker/src/main/java/ versioning-checker/src/main/java/org/ versioning-checker/src/main/java/org/apache/ ve...
Date Thu, 06 Oct 2011 15:47:52 GMT
Author: ejiang
Date: Thu Oct  6 15:47:50 2011
New Revision: 1179673

URL: http://svn.apache.org/viewvc?rev=1179673&view=rev
Log:
ARIES-757: semantic versioning check tool initial drop

Added:
    aries/trunk/versioning/
    aries/trunk/versioning/LICENSE
    aries/trunk/versioning/NOTICE
    aries/trunk/versioning/pom.xml
    aries/trunk/versioning/versioning-checker/   (with props)
    aries/trunk/versioning/versioning-checker/LICENSE
    aries/trunk/versioning/versioning-checker/NOTICE
    aries/trunk/versioning/versioning-checker/pom.xml
    aries/trunk/versioning/versioning-checker/src/
    aries/trunk/versioning/versioning-checker/src/main/
    aries/trunk/versioning/versioning-checker/src/main/java/
    aries/trunk/versioning/versioning-checker/src/main/java/org/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/ClassDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/FieldDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/GenericDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/MethodDeclaration.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/SemanticVersioningClassVisitor.java
    aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/SemanticVersioningUtils.java
    aries/trunk/versioning/versioning-checker/src/test/
    aries/trunk/versioning/versioning-checker/src/test/java/
    aries/trunk/versioning/versioning-checker/src/test/java/org/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/aries/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/aries/versioning/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/aries/versioning/utils/
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/aries/versioning/utils/BinaryCompatibilityTest.java
    aries/trunk/versioning/versioning-checker/src/test/java/org/apache/aries/versioning/impl/org/apache/aries/versioning/utils/SemanticVersionUtilsTest.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestA.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestB.java
    aries/trunk/versioning/versioning-checker/src/test/java/versioning/java/files/TestC.java

Added: aries/trunk/versioning/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/LICENSE?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/LICENSE (added)
+++ aries/trunk/versioning/LICENSE Thu Oct  6 15:47:50 2011
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: aries/trunk/versioning/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/NOTICE?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/NOTICE (added)
+++ aries/trunk/versioning/NOTICE Thu Oct  6 15:47:50 2011
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2010 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

Added: aries/trunk/versioning/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/pom.xml?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/pom.xml (added)
+++ aries/trunk/versioning/pom.xml Thu Oct  6 15:47:50 2011
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<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>
+    <parent>
+       <groupId>org.apache.aries</groupId>
+       <artifactId>java5-parent</artifactId>
+       <version>0.4-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.aries.versioning</groupId>
+    <artifactId>org.apache.aries.versioning.checker</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Aries Semantic Versioning Checker</name>
+    <version>0.1.0-SNAPSHOT</version>
+    <description>
+      OSGi Semantic Versioning Checker
+    </description>
+
+     <scm>
+         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/versioning/checker</connection>
+         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/versioning/checker</developerConnection>
+         <url>http://svn.apache.org/viewvc/aries/trunk/versioning/checker</url>
+     </scm>
+
+
+    <properties>
+        <aries.osgi.symbolic.name>
+            ${project.artifactId};blueprint.graceperiod:=false
+        </aries.osgi.symbolic.name>
+        <aries.osgi.import>
+            org.objectweb.asm*;version=3.2;resolution:=optional,
+            org.osgi.framework;version="[1.5,2)",
+            org.slf4j;version="[1.5,2)",
+            *
+        </aries.osgi.import>
+        <aries.osgi.export.pkg>
+            org.apache.aries.versioning.check;
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.versioning.utils;
+        </aries.osgi.private.pkg>
+	</properties>
+
+	<dependencies>
+    
+            <!-- Dependency on other Aries module bundles -->
+        <dependency>
+             <groupId>org.apache.aries</groupId>
+             <artifactId>org.apache.aries.util</artifactId>
+             <version>0.4-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+            <version>0.3</version>
+        </dependency>
+
+
+        <!--External dependencies. Versions may be specified in default parent -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-all</artifactId>
+            <optional>true</optional>
+            <version>3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+  </dependencies>
+</project>
+

Propchange: aries/trunk/versioning/versioning-checker/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct  6 15:47:50 2011
@@ -0,0 +1 @@
+.settings

Added: aries/trunk/versioning/versioning-checker/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/LICENSE?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/versioning-checker/LICENSE (added)
+++ aries/trunk/versioning/versioning-checker/LICENSE Thu Oct  6 15:47:50 2011
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: aries/trunk/versioning/versioning-checker/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/NOTICE?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/versioning-checker/NOTICE (added)
+++ aries/trunk/versioning/versioning-checker/NOTICE Thu Oct  6 15:47:50 2011
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

Added: aries/trunk/versioning/versioning-checker/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/pom.xml?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/versioning-checker/pom.xml (added)
+++ aries/trunk/versioning/versioning-checker/pom.xml Thu Oct  6 15:47:50 2011
@@ -0,0 +1,87 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.aries</groupId>
+      <artifactId>java5-parent</artifactId>
+      <version>0.4-SNAPSHOT</version>
+      <relativePath />
+  </parent>
+  <groupId>org.apache.aries.versioning</groupId>
+  <artifactId>org.apache.aries.versioning.checker</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>org.apache.aries.versioning.checker</name>
+  <url>http://maven.apache.org</url>
+
+    <scm>
+         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/versioning/checker</connection>
+         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/versioning/checker</developerConnection>
+         <url>http://svn.apache.org/viewvc/aries/trunk/versioning/checker</url>
+     </scm>
+
+    <properties>
+        <aries.osgi.symbolic.name>
+            ${project.artifactId};blueprint.graceperiod:=false
+        </aries.osgi.symbolic.name>
+        <aries.osgi.import>
+            org.objectweb.asm*;version=3.2;resolution:=optional,
+            org.osgi.framework;version="[1.5,2)",
+            org.slf4j;version="[1.5,2)",
+            *
+        </aries.osgi.import>
+        <aries.osgi.export.pkg>
+            org.apache.aries.versioning.check;
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.versioning.utils;
+        </aries.osgi.private.pkg>
+  </properties>
+
+  <dependencies>
+    
+        <!-- Dependency on other Aries module bundles -->
+        <dependency>
+             <groupId>org.apache.aries</groupId>
+             <artifactId>org.apache.aries.util</artifactId>
+             <version>0.4-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+            <version>0.3</version>
+        </dependency>
+
+
+        <!--External dependencies. Versions may be specified in default parent -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-all</artifactId>
+            <optional>true</optional>
+            <version>3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+  </dependencies>
+</project>

Added: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java (added)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/check/SemanticVersioningChecker.java Thu Oct  6 15:47:50 2011
@@ -0,0 +1,630 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.versioning.check;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+
+import org.apache.aries.util.filesystem.FileSystem;
+import org.apache.aries.util.filesystem.IDirectory;
+import org.apache.aries.util.filesystem.IFile;
+import org.apache.aries.util.io.IOUtils;
+import org.apache.aries.util.manifest.BundleManifest;
+import org.apache.aries.util.manifest.ManifestHeaderProcessor;
+import org.apache.aries.util.manifest.ManifestHeaderProcessor.NameValuePair;
+import org.apache.aries.versioning.utils.BinaryCompatibilityStatus;
+import org.apache.aries.versioning.utils.MethodDeclaration;
+import org.apache.aries.versioning.utils.SemanticVersioningClassVisitor;
+import org.apache.aries.versioning.utils.SemanticVersioningUtils;
+import org.objectweb.asm.ClassReader;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SemanticVersioningChecker {
+
+  private static final Logger _logger = LoggerFactory.getLogger(SemanticVersioningChecker.class);
+  private URLClassLoader newJarsLoader;
+  private URLClassLoader oldJarsLoader;
+  private final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
+  /**
+   * This method is to scan the current location against base and process each individual jars 
+   * in the current location against the jar with the same symbolic names in the base and produce a xml report specified by versioningReport.
+   * @param base baseline jars
+   * @param current current version of jars
+   * @param versioningReport the validation reports
+   */
+  public static void checkSemanticVersioning(URL base, URL current, File versioningReport) {
+    //For each jar under the current location, open the jar and then use ASM to 
+    //work out whether there are binary incompatible changes against the base location.
+    try {
+      File baseDir = new File(base.toURI());
+      File currentDir = new File(current.toExternalForm());
+      if ( baseDir.exists() && currentDir.exists()) {
+        new SemanticVersioningChecker().performVersioningCheck(FileSystem.getFSRoot(baseDir), FileSystem.getFSRoot(currentDir), versioningReport);
+      } else {
+        _logger.debug("No bundles found to process.");
+      }
+    } catch (URISyntaxException use) {
+      _logger.error(use.getMessage());
+    }
+  }
+
+  // for each jar, open its manifest and found the packages
+  private  void  performVersioningCheck(IDirectory  baseDir, IDirectory currentDir, File versionStatusFile)  {
+    
+    FileWriter versionStatusFileWriter = null;
+    try {
+      versionStatusFileWriter = new FileWriter(versionStatusFile, false);
+      Map<String, BundleInfo> baseBundles = new HashMap<String, BundleInfo>();
+      Map<String, BundleInfo> currentBundles = new HashMap<String, BundleInfo>();
+      
+        //scan each individual bundle and find the corresponding bundle in the baseline and verify the version changes
+        currentBundles = getBundles(currentDir);
+        baseBundles = getBundles(baseDir);
+        URL[] newJarURLs = getListURLs(currentBundles.values()).toArray(new URL[0]);
+        newJarsLoader = new URLClassLoader(newJarURLs);
+
+        URL[] oldJarURLs = getListURLs(baseBundles.values()).toArray(new URL[0]);
+
+        oldJarsLoader = new URLClassLoader(oldJarURLs);
+
+        //Write the xml header
+        writeRecordToWriter(versionStatusFileWriter, xmlHeader + "\r\n");
+        
+        // write the comparison base and current level into the file
+        writeRecordToWriter(versionStatusFileWriter, "<semanaticVersioning currentDir= \"" + currentDir + "\" baseDir = \"" + baseDir + "\">");
+        for (Map.Entry<String, BundleInfo> entry : currentBundles.entrySet()) {
+          String bundleSymbolicName = entry.getKey();
+
+          String bundleElement = null;
+          boolean bundleVersionCorrect = true;
+          // find the same bundle in the base and check whether all the versions are correct
+          BundleInfo currentBundle = entry.getValue();
+          BundleInfo baseBundle = baseBundles.get(bundleSymbolicName);
+          StringBuilder pkgElements = new StringBuilder();
+          String reason = null;
+          if (baseBundle == null) {
+            _logger.debug("The bundle " + bundleSymbolicName + " has no counterpart in the base. The semanit version validation does not apply to this bundle.");
+          } else {
+            // open the manifest and scan the export package and find the package name and exported version
+            // The tool assume the one particular package just exports under one version
+            Map<String, PackageContent> currBundleExpPkgContents = getAllExportedPkgContents(currentBundle);
+            Map<String, PackageContent> baseBundleExpPkgContents = new HashMap<String, PackageContent>();
+            boolean pkg_major_change = false;
+            boolean pkg_minor_change = false;
+            String fatal_package = null;
+            if (!!!currBundleExpPkgContents.isEmpty()) {
+              baseBundleExpPkgContents =  getAllExportedPkgContents(baseBundle);
+              // compare each class right now
+              for (Map.Entry<String, PackageContent> pkg : baseBundleExpPkgContents.entrySet()) {
+                String pkgName = pkg.getKey();
+                Map<String, IFile> baseClazz = pkg.getValue().getClasses();
+                Map<String, IFile> baseXsds = pkg.getValue().getXsds();
+                PackageContent currPkgContents = currBundleExpPkgContents.get(pkgName);
+                if (currPkgContents == null) {
+                  // The package is no longer exported any more. This should lead to bundle major version change.
+                  pkg_major_change = true;
+                  fatal_package = pkgName;
+                  _logger.debug("The package " + pkgName + " in the bundle of " + bundleSymbolicName + " is no longer to be exported. Major change.");
+                } else {
+                  Map<String, IFile> curClazz = currPkgContents.getClasses();
+                  Map<String, IFile> curXsds = currPkgContents.getXsds();
+                  //check whether there should be major change/minor change/micro change in this package.
+                  //1. Use ASM to visit all classes in the package 
+                  VersionChange majorChange = new VersionChange();
+                  VersionChange minorChange = new VersionChange();
+                  // check all classes to see whether there are minor or major changes
+                  visitPackage(pkgName, baseClazz, curClazz, majorChange, minorChange);
+                  // If there is no binary compatibility changes, check whether xsd files have been added, changed or deleted
+                  if (!!!majorChange.isChange()) {
+                    checkXsdChangesInPkg(pkgName, baseXsds, curXsds, majorChange);
+                    // If everything is ok with the existing classes. Need to find out whether there are more API (abstract classes) in the current bundle.
+                    // loop through curClazz and visit it and find out whether one of them is abstract.
+                    // check whether there are more xsd or abstract classes added
+                    if (!!!(majorChange.isChange() || minorChange.isChange())){
+                      checkAdditionalClassOrXsds(pkgName, curClazz, curXsds, minorChange);
+                    }
+                  }
+                  // We have scanned the whole packages, report the result
+                  if (majorChange.isChange() || minorChange.isChange()) {
+                    String oldVersion = pkg.getValue().getPackageVersion();
+                    String newVersion = currPkgContents.getPackageVersion();
+                    if (majorChange.isChange()) {
+                      pkg_major_change = true;
+                      fatal_package = pkgName;
+                      if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion)) {                      
+                        pkgElements.append(getPkgStatusText( pkgName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, majorChange.getReason(), majorChange.getChangeClass()));                      
+                      }
+                    } else if (minorChange.isChange()) {
+                      pkg_minor_change = true;
+                      if (fatal_package == null) fatal_package = pkgName;
+                      if (!!!isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion)) {
+                        pkgElements.append(getPkgStatusText( pkgName, VERSION_CHANGE_TYPE.MINOR_CHANGE, pkg.getValue().getPackageVersion(), currPkgContents.getPackageVersion(), minorChange.getReason(), minorChange.getChangeClass()));
+                      }
+                    }
+                    pkgElements.append("\r\n");
+                  }
+                }
+              }
+              // If there is a package version change, the bundle version needs to be updated.
+              // If there is a major change in one of the packages, the bundle major version needs to be increased.
+              // If there is a minor change in one of the packages, the bundle minor version needs to be increased.
+              String oldVersion = baseBundle.getBundleManifest().getVersion().toString();
+              String newVersion = currentBundle.getBundleManifest().getVersion().toString();
+
+
+              if (pkg_major_change || pkg_minor_change) {
+
+                if (pkg_major_change) {
+                  // The bundle version's major value should be increased.
+                  reason = "Some packages have major changes. For an instance, the package " + fatal_package + " has major version changes.";
+                  bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion, reason);
+                  bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MAJOR_CHANGE, oldVersion, newVersion);
+                } else if (pkg_minor_change) {
+                  reason = "Some packages have minor changes. For an instance, the package " + fatal_package + " has minor version changes.";
+                  bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion, reason);
+                  bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.MINOR_CHANGE, oldVersion, newVersion);
+                } 
+              } else {
+                reason = "The bundle has no version changes.";
+                bundleElement = getBundleStatusText(currentBundle.getBundle().getName(), bundleSymbolicName, VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion, reason);
+                bundleVersionCorrect = isVersionCorrect(VERSION_CHANGE_TYPE.NO_CHANGE, oldVersion, newVersion);
+              }
+            }
+          }
+          // Need to write bundle element and then package elements
+          if ((!!!bundleVersionCorrect) || ((pkgElements.length() > 0) )) {
+            writeRecordToWriter(versionStatusFileWriter, bundleElement);
+            writeRecordToWriter(versionStatusFileWriter, pkgElements.toString());
+            writeRecordToWriter(versionStatusFileWriter, "</bundle>");
+          }
+        }
+        writeRecordToWriter(versionStatusFileWriter, "</semanaticVersioning>");
+      
+    } catch (IOException ioe) {
+      ioe.printStackTrace();
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+    finally {
+      IOUtils.close(versionStatusFileWriter);
+    }
+    
+    return ;
+  }
+  /**
+   * Check whether the package has gained additional class or xsd files. If yes, log a minor change.
+   * @param pkgName
+   * @param curClazz
+   * @param curXsds
+   * @param minorChange
+   */
+  private void checkAdditionalClassOrXsds(String pkgName, Map<String, IFile> curClazz,
+      Map<String, IFile> curXsds, VersionChange minorChange)
+  {
+    String reason;
+    Collection<IFile> ifiles = curClazz.values();
+    Iterator<IFile> iterator = ifiles.iterator();
+    while (iterator.hasNext()) {
+      IFile ifile = iterator.next();
+      String changeClass = ifile.getName();
+      SemanticVersioningClassVisitor cv = getVisitor(ifile, newJarsLoader);
+      if (cv.getClassDeclaration() != null) {
+        // If this is a public/protected class, it will need to increase the minor version of the package.
+        minorChange.setChange(true);
+        if (minorChange.isChange()) {
+          reason = "The package " + pkgName + " has gained at least one class : " + getClassName(changeClass)+ ".";
+          minorChange.update(reason, changeClass);
+          break;
+        }
+      }
+    }
+    if (!!!(minorChange.isChange() || curXsds.isEmpty())) {
+      /// a new xsd file was added, it is a minor change
+      IFile firstXsd = null;
+      Iterator<IFile> xsdIterator = curXsds.values().iterator();
+      firstXsd = xsdIterator.next();
+
+      reason = "In the package " + pkgName + ", The schema file(s) are added: " + curXsds.keySet()+ ".";
+      minorChange.update(reason, firstXsd.getName());
+    }
+  }
+
+
+  /**
+   * Check whether the package has xsd file changes or deleted. If yes, log a minor change.
+   * @param pkgName
+   * @param baseXsds
+   * @param curXsds
+   * @param majorChange
+   * @throws IOException
+   */
+
+  private void checkXsdChangesInPkg(String pkgName, Map<String, IFile> baseXsds,
+      Map<String, IFile> curXsds, VersionChange majorChange) throws IOException
+      {
+    String reason;
+    for (Map.Entry<String, IFile> file : baseXsds.entrySet()) {
+      // scan the latest version of the class
+      IFile curXsd = curXsds.get(file.getKey());
+      String changeClass = file.getValue().getName();
+      // check whether the xsd have been deleted or changed or added
+      if (curXsd == null) {  
+        reason = "In the package " + pkgName + ", The schema file has been deleted: " + file.getKey()+ ".";
+        majorChange.update(reason, changeClass);
+        break;                      
+      } else {
+        // check whether it is the same
+        //read the current xsd file
+        curXsds.remove(file.getKey());
+        String curFileContent = readXsdFile(curXsd.open());
+        String oldFileContent = readXsdFile(file.getValue().open());
+        if (!!!(curFileContent.equals(oldFileContent))) {
+
+          reason = "In the package " + pkgName + ", The schema file has been updated: " + file.getKey()+ ".";
+          majorChange.update(reason, changeClass);
+          break;
+        }
+      }
+    }
+      }
+
+  /**
+   * Visit the whole package to scan each class to see whether we need to log minor or major changes.
+   * @param pkgName
+   * @param baseClazz
+   * @param curClazz
+   * @param majorChange
+   * @param minorChange
+   */
+  private void visitPackage(String pkgName, Map<String, IFile> baseClazz,
+      Map<String, IFile> curClazz, VersionChange majorChange, VersionChange minorChange)
+  {
+    String reason;
+    for (Map.Entry<String, IFile> file : baseClazz.entrySet()) {
+      // scan the latest version of the class
+      IFile curFile = curClazz.get(file.getKey());
+      String changeClass = file.getValue().getName();
+      //Scan the base version
+      SemanticVersioningClassVisitor oldcv = getVisitor(file.getValue(), oldJarsLoader);
+      if ((oldcv.getClassDeclaration() != null)) {
+        if (curFile == null) {
+          // the class we are scanning has been deleted from the current version of WAS
+          // This should be a major increase
+          reason = "In the package " + pkgName + ", The class/interface has been deleted: " + getClassName(changeClass) + ".";
+          majorChange.update(reason, changeClass);
+
+          break;
+        } else {
+          // check for binary compatibility
+          // load the class from the current version of WAS
+          // remove it from the curClazz collection as we would like to know whether there are more classes added
+          curClazz.remove(file.getKey());
+          SemanticVersioningClassVisitor newcv = getVisitor(curFile, newJarsLoader);
+          // check for binary compatibility
+          BinaryCompatibilityStatus bcs = newcv.getClassDeclaration().getBinaryCompatibleStatus(oldcv.getClassDeclaration());
+          if (bcs.isCompatible()) {
+            // check to see whether there are extra methods
+            MethodDeclaration extraMethod = newcv.getClassDeclaration().getExtraMethods(oldcv.getClassDeclaration());
+            if (extraMethod != null) {
+              // This should be a minor increase
+              reason = "In the package " + pkgName + ", the " + SemanticVersioningUtils.getReadableMethodSignature(extraMethod.getName(), extraMethod.getDesc()) + " has been added to the class or its super classes/interfaces " + getClassName(changeClass) + ".";
+              minorChange.update(reason, changeClass);
+            }
+          } else {
+            // break binary compatibility 
+            reason = "In the package " + pkgName + ", binary incompatibility occurred in the class " + getClassName(changeClass)+ ". " + bcs.getReason();
+            majorChange.update(reason, changeClass);
+            break; 
+          }
+        }
+      }
+    }
+  }
+
+  private String readXsdFile(InputStream is) {
+    BufferedReader br = new BufferedReader( new InputStreamReader(is));
+    StringBuilder sb = new StringBuilder();
+    String line = null;
+    try {
+      while(( line = br.readLine()) != null) {
+        sb.append(line);
+      }
+    } catch (IOException ioe) {
+      IOUtils.close(br);
+    }
+    return sb.toString();
+  }
+  private void writeRecordToWriter(FileWriter fileWriter, String stringToWrite) throws IOException {
+    if (fileWriter != null) {
+      fileWriter.append(stringToWrite);
+      fileWriter.append("\r\n");
+    }
+  }
+  private Map<String, PackageContent> getAllExportedPkgContents(BundleInfo currentBundle)
+  {
+    String packageExports = currentBundle.getBundleManifest().getRawAttributes().getValue(Constants.EXPORT_PACKAGE);
+    List<NameValuePair> exportPackageLists = ManifestHeaderProcessor.parseExportString(packageExports);
+    // only perform validation if there are some packages exported. Otherwise, not interested.
+    Map<String, PackageContent> exportedPackages = new HashMap<String, PackageContent>();
+    if (!!!exportPackageLists.isEmpty()) {
+      File bundleFile = currentBundle.getBundle();
+      IDirectory bundleDir = FileSystem.getFSRoot(bundleFile);
+      for (NameValuePair exportedPackage : exportPackageLists) {
+        String packageName = exportedPackage.getName();
+        String packageVersion = exportedPackage.getAttributes().get(Constants.VERSION_ATTRIBUTE);
+        // need to go through each package and scan every class
+        exportedPackages.put(packageName, new PackageContent(packageName, packageVersion));
+      }
+      // scan the jar and list all the files under each package
+      List<IFile> allFiles = bundleDir.listAllFiles();
+      for (IFile file : allFiles) {
+        String directoryFullPath = file.getName(); 
+        String directoryName = null;
+        String fileName = null;
+        if (file.isFile() && ((file.getName().endsWith(SemanticVersioningUtils.classExt) ||(file.getName().endsWith(SemanticVersioningUtils.schemaExt))))) {
+          if (directoryFullPath.lastIndexOf("/") != -1) {
+            directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
+            fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
+          }
+        } 
+
+        if (directoryName != null) {
+          String pkgName = directoryName.replaceAll("/", ".") ;
+          PackageContent pkgContent = exportedPackages.get(pkgName);
+          if (pkgContent != null) {
+            if (file.getName().endsWith(SemanticVersioningUtils.classExt)) {
+              pkgContent.addClass(fileName, file);
+            } else {
+              pkgContent.addXsd(fileName, file);
+            }
+            exportedPackages.put(pkgName, pkgContent);
+          }
+        }
+      }
+    }
+    return exportedPackages;
+  }
+
+  private Map<String, BundleInfo> getBundles(IDirectory ds)
+  {
+    Map<String, BundleInfo> bundles = new HashMap<String, BundleInfo>();
+    List<IFile> includedFiles = ds.listAllFiles();
+
+    for (IFile ifile : includedFiles) {
+
+
+      
+      if (ifile.getName().endsWith(SemanticVersioningUtils.jarExt)) {
+        // scan its manifest
+        try {
+        BundleManifest manifest = BundleManifest.fromBundle(ifile.open());
+        // find the bundle symbolic name, store them in a map with bundle symbolic name as key, bundleInfo as value
+        if (manifest.getSymbolicName() != null) {
+          
+          bundles.put(manifest.getSymbolicName(), new BundleInfo(manifest, new File(ifile.toURL().getPath())));
+          
+        }
+        } catch (MalformedURLException mue) {
+          _logger.debug("Exception thrown when processing" + ifile.getName(), mue);
+        } catch (IOException ioe) {
+          _logger.debug("Exception thrown when processing" + ifile.getName(), ioe);
+        }
+      }
+    }
+    return bundles;
+  }
+
+  private String getStatusText( VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
+
+    Version oldVersion = Version.parseVersion(oldVersionStr);
+    Version newVersion = Version.parseVersion(newVersionStr);
+    Version recommendedVersion = Version.parseVersion(oldVersionStr);
+    if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
+      recommendedVersion = new Version(oldVersion.getMajor() + 1, 0, 0);
+    } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE) {
+      recommendedVersion = new Version(oldVersion.getMajor(), oldVersion.getMinor() + 1,  0);
+    } else {
+      recommendedVersion = oldVersion;
+    }
+    return " oldVersion=\"" + oldVersion 
+    + "\" currentVersion=\"" + newVersion +
+    "\" recommendedVersion=\"" + recommendedVersion + "\" correct=\"" + isVersionCorrect(status, oldVersionStr, newVersionStr);
+  }
+
+  private String transformForXml(String str){
+    str = str.replaceAll("<", "&lt;");
+    str = str.replaceAll(">", "&gt;");
+    return str;
+  }
+  private boolean isVersionCorrect(VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
+    boolean versionCorrect = false;
+
+    Version oldVersion = Version.parseVersion(oldVersionStr);
+    Version newVersion = Version.parseVersion(newVersionStr);
+
+    if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
+      if (newVersion.getMajor() > oldVersion.getMajor()) {
+        versionCorrect = true;
+      }
+    } else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE){
+      if ((newVersion.getMajor() > oldVersion.getMajor()) || ( newVersion.getMinor() > oldVersion.getMinor())) {
+        versionCorrect = true;
+      }
+    } else {
+      if ((newVersion.getMajor() == oldVersion.getMajor()) && (newVersion.getMinor() == oldVersion.getMinor())) {
+        versionCorrect = true;
+      }
+    }
+    return versionCorrect;
+  }
+
+  private String getPkgStatusText(String pkgName,  VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr,  String reason, String key_class) {
+
+    String modified_key_class = key_class;
+    if (key_class.endsWith(SemanticVersioningUtils.classExt)) {
+      modified_key_class = key_class.substring(0, key_class.lastIndexOf(SemanticVersioningUtils.classExt)) + SemanticVersioningUtils.javaExt;
+    }
+
+    return   "<package name=\"" + pkgName + "\"" +  getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\""  +transformForXml(reason) + "\" key_class=\"" + modified_key_class +  "\" change=\"" + status.text() + "\"/>";
+  }
+
+  private String getBundleStatusText(String bundleFileName, String bundleSymbolicName, VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr, String reason) {
+    return "<bundle fileName=\"" + bundleFileName + "\" bundleSymbolicName =\"" + bundleSymbolicName + "\"" + getStatusText(status, oldVersionStr, newVersionStr) + "\" reason=\"" + transformForXml(reason) + "\" change=\"" + status.text() + "\">";
+  }
+
+  private SemanticVersioningClassVisitor getVisitor(IFile file, URLClassLoader loader ) {
+    SemanticVersioningClassVisitor oldcv = new SemanticVersioningClassVisitor(loader);
+    try {
+      ClassReader cr = new ClassReader(file.open());
+      cr.accept(oldcv, 0);
+    } catch (IOException ioe) {
+      _logger.debug("The file " + file + "cannot be opened.");
+    }
+    return oldcv; 
+  }
+
+  private Collection<URL> getListURLs(Collection<BundleInfo> bundles){
+    Collection<URL> urls = new HashSet<URL>();
+    try {
+      for (BundleInfo bundle : bundles) {
+
+        URL url = bundle.getBundle().toURI().toURL();
+        urls.add(url);
+
+      }
+
+    } catch (MalformedURLException e) {
+      _logger.debug(e.getMessage());
+    }
+    return urls;
+  }
+
+  private String getClassName(String fullClassPath) {
+    String[] chunks = fullClassPath.split("/");
+    String className = chunks[chunks.length - 1];
+    className = className.replace(SemanticVersioningUtils.classExt, SemanticVersioningUtils.javaExt);
+    return className;
+  }
+
+  private class BundleInfo {
+    private final BundleManifest bundleManifest;
+    private final File bundle;
+    BundleInfo(BundleManifest bm, File bundle) {
+      this.bundleManifest =bm;
+      this.bundle = bundle;
+    }
+    public BundleManifest getBundleManifest()
+    {
+      return bundleManifest;
+    }
+    public File getBundle()
+    {
+      return bundle;
+    }
+  }
+  enum VERSION_CHANGE_TYPE { MAJOR_CHANGE("major"), MINOR_CHANGE("minor"), NO_CHANGE("no");
+  private final String text;
+  VERSION_CHANGE_TYPE(String text) {
+    this.text = text;
+  }
+  public String text() {
+    return this.text;
+  }
+
+  };
+
+  private class PackageContent {
+    private final String  packageName;
+    private final String packageVersion;
+    private final Map<String, IFile> classes = new HashMap<String, IFile>();
+    private final Map<String, IFile> xsds = new HashMap<String, IFile>();
+    PackageContent(String pkgName, String pkgVersion) {
+      packageName = pkgName;
+      packageVersion = pkgVersion;
+    }
+    public void addClass(String className, IFile file) {
+      classes.put(className, file);
+    }
+    public void addXsd(String className, IFile file) {
+      xsds.put(className, file);
+    }
+    public Map<String, IFile> getClasses () {
+      return classes;
+    }
+    public Map<String, IFile> getXsds () {
+      return xsds;
+    }
+
+    public String getPackageVersion()
+    {
+      return packageVersion;
+    }
+    public String getPackageName() {
+      return packageName;
+    }
+  }
+
+  private class VersionChange {
+    boolean change = false;
+    String reason= null;
+    String changeClass = null;
+    public boolean isChange()
+    {
+      return change;
+    }
+    public void setChange(boolean change)
+    {
+      this.change = change;
+    }
+    public String getReason()
+    {
+      return reason;
+    }
+    public String getChangeClass()
+    {
+      return changeClass;
+    }
+    public void update(String reason, String changeClass) {
+      this.change = true;
+      this.reason = reason;
+      this.changeClass = changeClass;
+    }
+  }
+
+}

Added: aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java
URL: http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java?rev=1179673&view=auto
==============================================================================
--- aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java (added)
+++ aries/trunk/versioning/versioning-checker/src/main/java/org/apache/aries/versioning/utils/BinaryCompatibilityStatus.java Thu Oct  6 15:47:50 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.versioning.utils;
+public class BinaryCompatibilityStatus
+{
+  private final boolean compatible;
+  private final String reason;
+  
+  public BinaryCompatibilityStatus(boolean compatible, String reason) {
+    this.compatible = compatible;
+    this.reason = reason;
+  }
+
+  public boolean isCompatible()
+  {
+    return compatible;
+  }
+
+  public String getReason()
+  {
+    return reason;
+  }
+  
+
+}



Mime
View raw message