felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r763213 [1/2] - in /felix/sandbox/clement/Project-Checker: ./ .settings/ libs/ licenses/ src/ src/org/ src/org/apache/ src/org/apache/felix/ src/org/apache/felix/project/ src/org/apache/felix/project/checker/
Date Wed, 08 Apr 2009 12:30:29 GMT
Author: clement
Date: Wed Apr  8 12:30:27 2009
New Revision: 763213

URL: http://svn.apache.org/viewvc?rev=763213&view=rev
Log:
Commit the initial version of project-checker

Added:
    felix/sandbox/clement/Project-Checker/
    felix/sandbox/clement/Project-Checker/.classpath
    felix/sandbox/clement/Project-Checker/.project
    felix/sandbox/clement/Project-Checker/.settings/
    felix/sandbox/clement/Project-Checker/.settings/org.eclipse.jdt.core.prefs
    felix/sandbox/clement/Project-Checker/README.txt
    felix/sandbox/clement/Project-Checker/config.properties
    felix/sandbox/clement/Project-Checker/jardesc.jardesc
    felix/sandbox/clement/Project-Checker/libs/
    felix/sandbox/clement/Project-Checker/libs/apache-rat-0.7-SNAPSHOT.jar   (with props)
    felix/sandbox/clement/Project-Checker/libs/apache-rat-core-0.7-SNAPSHOT.jar   (with props)
    felix/sandbox/clement/Project-Checker/libs/commons-cli-1.1.jar   (with props)
    felix/sandbox/clement/Project-Checker/libs/commons-collections-3.2.1.jar   (with props)
    felix/sandbox/clement/Project-Checker/libs/commons-lang-2.4.jar   (with props)
    felix/sandbox/clement/Project-Checker/libs/dom4j-1.6.1.jar   (with props)
    felix/sandbox/clement/Project-Checker/licenses/
    felix/sandbox/clement/Project-Checker/licenses/LICENSE.asm
    felix/sandbox/clement/Project-Checker/licenses/LICENSE.kxml2
    felix/sandbox/clement/Project-Checker/licenses/apache.xml
    felix/sandbox/clement/Project-Checker/licenses/asm.xml
    felix/sandbox/clement/Project-Checker/licenses/kxml2.xml
    felix/sandbox/clement/Project-Checker/licenses/mortbay.xml
    felix/sandbox/clement/Project-Checker/licenses/osgi.xml
    felix/sandbox/clement/Project-Checker/project-checker.jar   (with props)
    felix/sandbox/clement/Project-Checker/src/
    felix/sandbox/clement/Project-Checker/src/org/
    felix/sandbox/clement/Project-Checker/src/org/apache/
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Checker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Command.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/FileChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedApacheLicence.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedLicenseChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarLicenseChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarNoticeChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseParser.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseSummaryChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LinkCollector.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Notice.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeNameChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Project.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ProjectLicenseChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ProjectNoticeChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Sha1Checker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/SignatureBeautifiedChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/SignatureChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/TagChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/UsedLicenseChecker.java
    felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Utils.java

Added: felix/sandbox/clement/Project-Checker/.classpath
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/.classpath?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/.classpath (added)
+++ felix/sandbox/clement/Project-Checker/.classpath Wed Apr  8 12:30:27 2009
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.5.0 (MacOS X Default)"/>
+	<classpathentry kind="lib" path="libs/apache-rat-0.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="libs/apache-rat-core-0.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="libs/commons-cli-1.1.jar"/>
+	<classpathentry kind="lib" path="libs/commons-collections-3.2.1.jar"/>
+	<classpathentry kind="lib" path="libs/commons-lang-2.4.jar"/>
+	<classpathentry kind="lib" path="libs/dom4j-1.6.1.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: felix/sandbox/clement/Project-Checker/.project
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/.project?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/.project (added)
+++ felix/sandbox/clement/Project-Checker/.project Wed Apr  8 12:30:27 2009
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Project-Checker</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: felix/sandbox/clement/Project-Checker/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/.settings/org.eclipse.jdt.core.prefs?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/.settings/org.eclipse.jdt.core.prefs (added)
+++ felix/sandbox/clement/Project-Checker/.settings/org.eclipse.jdt.core.prefs Wed Apr  8 12:30:27 2009
@@ -0,0 +1,12 @@
+#Wed Apr 01 09:53:45 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5

Added: felix/sandbox/clement/Project-Checker/README.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/README.txt?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/README.txt (added)
+++ felix/sandbox/clement/Project-Checker/README.txt Wed Apr  8 12:30:27 2009
@@ -0,0 +1,102 @@
+Project-Checker
+===============
+
+I. What is it ?
+---------------
+
+Project-Checker is a simple tools checking releases and projects. This aims to simplify the release checking process, 
+BUT does not avoid manual checking.
+Project-Checker was mainly made for Apache Felix bundles.
+
+II. Mode
+--------
+
+Project-Checker can be used in two mode:
+- the project mode allows checking a not-yet released project (build already packages). It aims to detect license and notice
+issues
+- the release mode allows checking a released project. It do the project mode checks + a couple of release checking
+
+III. Checks
+-----------
+
+The checkers applied on the project depends on the mode:
+
+A] Project Mode
+- the License file is in the project
+- the Notice file is in the project
+- the License file is in the Jar file (in META-INF)
+- the Notice file is in the Jar file (in META-INF)
+- the files contains Apache License Header (use RAT)
+- the Notice license summary is correct
+- The Notice name contains the project name
+- The Notice copyright contains a correct year
+- The Notice file says that the product contains code from the Apache Software Foundation
+- All included packages match with a declared included license specified in the notice file
+- All imported packages (only if the jar file is a bundle) match with a declared used license specified in the notice file
+
+B] Release Mode
+- all the project mode checks +
+- all the waited artifacts are created (Zip, Tag.GZ, source ...)
+- MD5 and SHA1 signatures are beautified
+- the MD5 signatures are correct
+- the SHA1 signatures are correct
+- the ASC signatures are correct
+- rhe changelog file exists
+- The release tag is correctly created
+
+IV. How to use it ?
+--------------------
+
+Using project checker depends on the mode to use
+
+A] Common part
+java -cp project-checker.jar:commons-cli-1.1.jar:commons-collections-3.2.1.jar:commons-lang-2.4.jar:dom4j-1.6.1.jar:apache-rat-0.7-SNAPSHOT.jar:apache-rat-core-0.7-SNAPSHOT.jar org.apache.felix.project.checker.Project
+
+Arguments:
+	 -n or --name: Name of the artifact [mandatory] 
+	 -v or --version: Version of the artifact [mandatory] 
+	 -c or --configuration: Set the configuration file to use 
+
+
+B] Project Mode arguments 
+ 	-d or --directory: path of the project to check [mandatory in the project mode]
+ 	
+Example:
+java 
+ -cp project-checker.jar:libs/commons-cli-1.1.jar:libs/commons-collections-3.2.1.jar:libs/commons-lang-2.4.jar:libs/dom4j-1.6.1.jar: 
+ libs/apache-rat-0.7-SNAPSHOT.jar:libs/apache-rat-core-0.7-SNAPSHOT.jar org.apache.felix.project.checker.Project 
+ -d ~/workspaces/felix-trunk/ipojo/arch/ 
+ -n org.apache.felix.ipojo.arch 
+ -v 1.3.0-SNAPSHOT
+ 	
+
+C] Release Mode
+	 -u or --url: URL to download the release [mandatory in the release mode]
+	 -o or --offline: to not download the artifacts (reused them) 
+
+V. Configuration file
+---------------------
+
+The configuration file contains the used commands and project information. You can either edit the config.properties file or create your own.
+
+VI. Process in the release mode
+-------------------------------
+
+Release Checker is quite simple:
+1) Download (if needed) the release files
+2) Extract and parse the Notice file
+3) Launch each "checker"
+4) Generate the report
+
+A "checker" is a simple class checking one point of the release.
+
+Once downloaded, you can check manually the release by inspecting artifacts contained in the release-$RELEASE_NAME-$RELEASE_VERSION folder.
+
+VI. Todo list
+-------------
+
+- Add more known license
+- MD5 and SHA1 checks should use RegEx
+- Changelog checker should see if all Jira issues are mentioned
+- Changelog checker should checks that the changelog contains an entry for the current version
+- Allow to write the report in a file (right know, output can be redirected)

Added: felix/sandbox/clement/Project-Checker/config.properties
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/config.properties?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/config.properties (added)
+++ felix/sandbox/clement/Project-Checker/config.properties Wed Apr  8 12:30:27 2009
@@ -0,0 +1,9 @@
+# Used commands
+SSL=openssl
+GPG=/usr/local/bin/gpg
+UNZIP=unzip
+RM=rm
+
+# Global properties
+PARENT_PROJECT_NAME=Apache Felix
+SVN_URL=http://svn.apache.org/repos/asf/felix/releases/
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/jardesc.jardesc
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/jardesc.jardesc?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/jardesc.jardesc (added)
+++ felix/sandbox/clement/Project-Checker/jardesc.jardesc Wed Apr  8 12:30:27 2009
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="MacRoman"?>
+<jardesc>
+<jar path="Release-Checker/project-checker.jar"/>
+<options buildIfNeeded="true" compress="true" descriptionLocation="/Release-Checker/jardesc.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
+<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
+<selectedProjects/>
+<manifest generateManifest="true" mainClassHandleIdentifier="=Release-Checker/src&lt;org.apache.felix.project.checker{Project.java[Project" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+<sealing sealJar="false">
+<packagesToSeal/>
+<packagesToUnSeal/>
+</sealing>
+</manifest>
+<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
+<file path="/Release-Checker/config.properties"/>
+<folder path="/Release-Checker/licenses"/>
+<file path="/Release-Checker/README.txt"/>
+<javaElement handleIdentifier="=Release-Checker/src"/>
+</selectedElements>
+<fatjar builder="org.eclipse.jdt.ui.plain_jar_builder" launchConfig=""/>
+</jardesc>

Added: felix/sandbox/clement/Project-Checker/libs/apache-rat-0.7-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/apache-rat-0.7-SNAPSHOT.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/apache-rat-0.7-SNAPSHOT.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/libs/apache-rat-core-0.7-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/apache-rat-core-0.7-SNAPSHOT.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/apache-rat-core-0.7-SNAPSHOT.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/libs/commons-cli-1.1.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/commons-cli-1.1.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/commons-cli-1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/libs/commons-collections-3.2.1.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/commons-collections-3.2.1.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/commons-collections-3.2.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/libs/commons-lang-2.4.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/commons-lang-2.4.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/commons-lang-2.4.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/libs/dom4j-1.6.1.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/libs/dom4j-1.6.1.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/libs/dom4j-1.6.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/licenses/LICENSE.asm
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/LICENSE.asm?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/LICENSE.asm (added)
+++ felix/sandbox/clement/Project-Checker/licenses/LICENSE.asm Wed Apr  8 12:30:27 2009
@@ -0,0 +1,29 @@
+Copyright (c) 2000-2005 INRIA, France Telecom
+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 the copyright holders nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS 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 THE COPYRIGHT OWNER OR 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: felix/sandbox/clement/Project-Checker/licenses/LICENSE.kxml2
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/LICENSE.kxml2?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/LICENSE.kxml2 (added)
+++ felix/sandbox/clement/Project-Checker/licenses/LICENSE.kxml2 Wed Apr  8 12:30:27 2009
@@ -0,0 +1,20 @@
+Copyright (c) 2002-2007 Stefan Haustein, Oberhausen, Rhld., Germany
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The  above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE. 
+

Added: felix/sandbox/clement/Project-Checker/licenses/apache.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/apache.xml?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/apache.xml (added)
+++ felix/sandbox/clement/Project-Checker/licenses/apache.xml Wed Apr  8 12:30:27 2009
@@ -0,0 +1,11 @@
+<license>
+<!-- 
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+ -->
+	<keyword>Apache Software Foundation</keyword>
+	<packages>org.apache</packages>
+	<license>Apache License 2.0</license>
+	<url>http://www.apache.org/</url>
+	<provider>The Apache Software Foundation</provider>
+</license>
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/licenses/asm.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/asm.xml?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/asm.xml (added)
+++ felix/sandbox/clement/Project-Checker/licenses/asm.xml Wed Apr  8 12:30:27 2009
@@ -0,0 +1,12 @@
+<license>
+<!-- 
+   This product includes software from http://kxml.sourceforge.net.
+Copyright (c) 2002,2007, Stefan Haustein, Oberhausen, Rhld., Germany.
+Licensed under BSD License.
+ -->
+	<keyword>kxml</keyword>
+	<packages>org.xmlpull,org.kxml2</packages>
+	<license>BSD License</license>
+	<copyright>Copyright (c) 2002,2007, Stefan Haustein, Oberhausen, Rhld., Germany.</copyright>
+	<file>LICENSE.kxml2</file>
+</license>
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/licenses/kxml2.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/kxml2.xml?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/kxml2.xml (added)
+++ felix/sandbox/clement/Project-Checker/licenses/kxml2.xml Wed Apr  8 12:30:27 2009
@@ -0,0 +1,12 @@
+<license>
+<!-- 
+This product includes software developed at
+Copyright (c) 2000-2005 INRIA, France Telecom
+Licensed under BSD License.
+ -->
+	<keyword>INRIA, France Telecom</keyword>
+	<packages>org.objectweb.asm</packages>
+	<license>BSD License</license>
+	<copyright>Copyright (c) 2000-2005 INRIA, France Telecom</copyright>
+	<file>LICENSE.asm</file>
+</license>
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/licenses/mortbay.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/mortbay.xml?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/mortbay.xml (added)
+++ felix/sandbox/clement/Project-Checker/licenses/mortbay.xml Wed Apr  8 12:30:27 2009
@@ -0,0 +1,7 @@
+<license>
+	<keyword>Mortbay</keyword>
+	<packages>org.mortbay,javax.servlet</packages>
+	<license>Apache License 2.0</license>
+	<url>http://mortbay.org</url>
+	<provider>Mortbay</provider>
+</license>
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/licenses/osgi.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/licenses/osgi.xml?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/licenses/osgi.xml (added)
+++ felix/sandbox/clement/Project-Checker/licenses/osgi.xml Wed Apr  8 12:30:27 2009
@@ -0,0 +1,16 @@
+<license>
+<!-- 
+    /*
+     *  This product includes software developed at
+     *  The OSGi Alliance (http://www.osgi.org/).
+     *  Copyright (c) OSGi Alliance (2000, 2007).
+     *  Licensed under the Apache License 2.0.
+     */
+ -->
+	<keyword>osgi</keyword>
+	<packages>org.osgi</packages>
+	<license>Apache License 2.0</license>
+	<url>http://www.osgi.org/</url>
+	<provider>The OSGi Alliance</provider>
+	<copyright>Copyright (c) OSGi Alliance (2000, 2007).</copyright>
+</license>
\ No newline at end of file

Added: felix/sandbox/clement/Project-Checker/project-checker.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/project-checker.jar?rev=763213&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/clement/Project-Checker/project-checker.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/ChangelogChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,32 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+
+public class ChangelogChecker implements Checker {
+    
+    private File project;
+
+    public void check() throws Exception {
+        File changelog = new File(project, "/doc/changelog.txt");
+        
+        if (! changelog.exists()) {
+            throw new Exception("The changelog is missing");
+        }
+        //TODO Check that the changelog is up to date.
+    }
+
+    public void clean() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public String getCheckerName() {
+       return "Changelog checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+       project = release.getProjectRoot();
+       return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Checker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Checker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Checker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Checker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,13 @@
+package org.apache.felix.project.checker;
+
+public interface Checker {
+    
+    boolean prepare(Project release) throws Exception;
+    
+    String getCheckerName();
+    
+    void check() throws Exception;
+    
+    void clean();
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Command.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Command.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Command.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Command.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,98 @@
+package org.apache.felix.project.checker;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class Command {
+  
+    private String error;
+    private String output;
+    
+    private Process process;
+    
+    public void executeCommand(Project release, String cmd, boolean timeout) throws IOException {
+        if (timeout) {
+            new Thread(new Killer()).start();
+        }
+        process = Runtime.getRuntime().exec(cmd, null, release.getArtifactDirectory());
+        error = inputStreamAsString(process.getErrorStream());
+        output = inputStreamAsString(process.getInputStream());
+    }
+    
+    public void executeCommand(File dir, String cmd, boolean timeout) throws IOException {
+        if (timeout) {
+            new Thread(new Killer()).start();
+        }
+        process = Runtime.getRuntime().exec(cmd, null, dir);
+      
+        error = inputStreamAsString(process.getErrorStream());
+        output = inputStreamAsString(process.getInputStream());
+       
+    }
+    
+    public String getOutput() {
+        return output;
+    }
+    
+    public String getError() {
+        return error;
+    }
+    
+    public static String inputStreamAsString(InputStream stream)
+            throws IOException {
+        BufferedReader br = new BufferedReader(new InputStreamReader(stream));
+        StringBuilder sb = new StringBuilder();
+        String line = null;
+        try {
+        while ((line = br.readLine()) != null) {
+            sb.append(line + "\n");
+        }
+        
+            br.close();
+        } catch(Exception e) {}
+        return sb.toString();
+    }
+    
+    public static void main(String[] args) throws IOException, InterruptedException {
+        Command command = new Command();
+        command.executeCommand((File) null, "ls", false);
+        System.out.println("Out:");
+        System.out.println(command.getOutput());
+        System.out.println("Err:");
+        System.out.println(command.getError());
+        System.out.println("===");
+        File dir = new File("release-org.apache.felix.log-1.0.0");
+        command.executeCommand(dir, "/usr/bin/openssl md5 org.apache.felix.log-1.0.0.jar", false);
+        //command.executeCommand(dir, "echo $PATH");
+        
+        System.out.println("Out:");
+        System.out.println(command.getOutput());
+        System.out.println("Err:");
+        System.out.println(command.getError());
+   
+        System.out.println("Done");
+        
+    }
+    
+    private class Killer implements Runnable {
+    
+    public void run() {
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        if (process != null) {
+            process.destroy();
+        }
+        
+    }
+    }
+    
+    
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/FileChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/FileChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/FileChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/FileChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,78 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.util.Map;
+
+public class FileChecker implements Checker {
+
+    private Project release;
+    private Map<String, File> artifacts;
+
+    public void check() throws Exception {
+        checkNotBZ2();
+        checkZip();
+        checkTarGz();
+        checkJar();
+        checkPom();
+    }
+    
+    private boolean exist(String suffix) {
+        String name = release.getName() + "-" + release.getVersion();
+        return artifacts.containsKey(name + suffix);
+    }
+    
+    private void checkZip() {
+        if (!exist("-bin.zip")) {
+            release.error(this, "Cannot found the -bin.zip file", null);
+        }
+        if (!exist("-project.zip")) {
+            release.error(this, "Cannot found the -project.zip file", null);
+        }
+    }
+    
+    private void checkTarGz() {
+        if (!exist("-bin.tar.gz")) {
+            release.error(this, "Cannot found the -tar.gz file", null);
+        }
+        if (!exist("-project.tar.gz")) {
+            release.error(this, "Cannot found the -project.tar.gz file", null);
+        }
+    }
+    
+    private void checkJar() {
+        if (!exist(".jar")) {
+            release.error(this, "Cannot found the .jar file", null);
+        }
+        if (!exist("-sources.jar")) {
+            release.error(this, "Cannot found the -sources.jar file", null);
+        }
+    }
+    
+    private void checkPom() {
+        if (!exist(".pom")) {
+            release.error(this, "Cannot found the .pom file", null);
+        }
+    }
+    
+    private void checkNotBZ2() {
+        if (exist("-bin.bz2")) {
+            release.warning(this, "The -bin.bz2 file is not needed");
+        }
+        if (exist("-project.bz2")) {
+            release.warning(this, "The -project.bz2 file is not needed");
+        }
+    }
+
+    public void clean() { }
+
+    public String getCheckerName() {
+        return "Artifacts Checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+        artifacts = release.getArtifacts();
+        return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/HeaderChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,200 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.rat.analysis.util.HeaderMatcherMultiplexer;
+import org.apache.rat.document.impl.FileDocument;
+import org.apache.rat.document.impl.zip.ZipFileUnarchiver;
+import org.apache.rat.license.Apache20LicenseFamily;
+import org.apache.rat.license.ILicenseFamily;
+import org.apache.rat.report.IReportable;
+import org.apache.rat.report.RatReport;
+import org.apache.rat.report.RatReportFailedException;
+import org.apache.rat.report.xml.XmlReportFactory;
+import org.apache.rat.report.xml.writer.IXmlWriter;
+import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+public class HeaderChecker implements Checker {
+    
+    Project release;
+    File file = null, xmlreport = null;
+    public static final String UNZIP_PROPERTY = "UNZIP"; 
+    public static final String RM_PROPERTY = "RM"; 
+
+
+
+    public void check() throws Exception {
+        List<String> errors = new ArrayList<String>();
+        List<String> warnings = new ArrayList<String>();
+        List<String> ignored = new ArrayList<String>();
+
+        Container walker = new Container(release.getProjectRoot());
+        HeaderMatcherMultiplexer m = new HeaderMatcherMultiplexer(org.apache.rat.Defaults.DEFAULT_MATCHERS);
+        xmlreport = new File(release.getArtifactDirectory(), "rat.xml");
+        FileWriter pw = new FileWriter(xmlreport);
+        
+        IXmlWriter writer = new XmlWriter(pw);
+        RatReport report = XmlReportFactory.createStandardReport(writer,
+                m, new ILicenseFamily[] { new Apache20LicenseFamily() });
+        report.startReport();
+        walker.run(report);
+        report.endReport();
+        writer.closeDocument();
+        
+        SAXReader reader = new SAXReader();
+        Document document = reader.read(xmlreport);        
+        Element root = document.getRootElement();
+        // iterate through child elements of root with element name "foo"
+        for ( Iterator<Element> i = root.elementIterator( "resource" ); i.hasNext(); ) {
+            Element resource = (Element) i.next();
+            Attribute name = resource.attribute("name");
+            Element la = resource.element("license-approval");
+            if (la != null) {
+                if (la.attribute("name").getValue().equals("false")) {
+                    if (name.getValue().contains("test/")) { // Test folder
+                        warnings.add(name.getValue());
+                    } else if (name.getValue().contains("doc/")) { // Test folder
+                        ignored.add(name.getValue());
+                    } else {
+                        errors.add(name.getValue());
+                    }
+                    
+                }
+            }
+        }
+        
+        for (String s : ignored) {
+        //    release.warning(this, "Missing license in " + s + " ignored");
+            // Nothing to do
+        }
+        for (String s : warnings) {
+            release.warning(this, "Missing licence in " + s);
+        }
+        
+        for(String s : errors) {
+            release.error(this, "Missing licence in " + s, null);
+        }
+        
+        if (errors.size() > 0) {
+            throw new Exception("Missing licence headers : " + errors);
+        }
+        
+    }
+
+  
+
+    public void clean() { }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+        file = release.getProjectRoot();
+        return true;
+
+    }
+    
+    private class Container implements IReportable {
+        
+        File basedir;
+        private final ZipFileUnarchiver UNARCHIVER = new ZipFileUnarchiver();
+        private final FileNameComparator COMPARATOR = new FileNameComparator();
+
+        public Container(File basedir) {
+            this.basedir = basedir;
+        }
+        
+        private boolean ignored(String name) {
+            return name.contains("/doc/")  
+                || name.contains("LICENSE") || name.contains("LICENCE")
+                || name.contains("/target/")
+                || name.contains(".svn")
+                || name.contains(".classpath") || name.contains(".project") 
+                || name.contains(".externalToolBuilders") || name.contains(".settings")
+                || name.contains("maven-eclipse.xml");
+        }
+
+        public void report(RatReport report, File file) throws RatReportFailedException {
+            if (! ignored(file.getAbsolutePath())) {
+                org.apache.rat.document.IDocument document = new FileDocument(file,
+                        UNARCHIVER);
+                report.report(document);
+            }
+            
+        }
+        
+        public void run(RatReport report) throws RatReportFailedException {
+            process(report, basedir);
+        }
+
+        private void process(RatReport report, File file)
+                throws RatReportFailedException {
+            File files[] = file.listFiles();
+            if (files != null) {
+                Arrays.sort(files, COMPARATOR);
+                processNonDirectories(report, files);
+                processDirectories(report, files);
+            }
+        }
+
+        private void processDirectories(RatReport report, File files[])
+                throws RatReportFailedException {
+            for (int i = 0; i < files.length; i++) {
+                File file = files[i];
+                String name = file.getName();
+                if (!ignored(name) && file.isDirectory())
+                    processDirectory(report, file);
+            }
+
+        }
+        
+        private void processDirectory(RatReport report, File file)  throws RatReportFailedException {
+            process(report, file);
+        }
+
+        private void processNonDirectories(RatReport report, File files[])
+                throws RatReportFailedException {
+            for (int i = 0; i < files.length; i++) {
+                File file = files[i];
+                String name = file.getName();
+                if (!ignored(name) && !file.isDirectory())
+                    report(report, file);
+            }
+
+        }
+        
+    }
+    
+    private class FileNameComparator implements Comparator<File> {
+
+        public int compare(File first, File second) {
+            int result = 0;
+            if (first == null) {
+                if (second != null)
+                    result = 1;
+            } else if (second == null) {
+                result = -1;
+            } else {
+                String firstName = first.getName();
+                String secondName = second.getName();
+                result = firstName.compareTo(secondName);
+            }
+            return result;
+        }
+    }
+
+    public String getCheckerName() {
+        return "License Header Checker";
+    }
+    
+
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedApacheLicence.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedApacheLicence.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedApacheLicence.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedApacheLicence.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,53 @@
+package org.apache.felix.project.checker;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class IncludedApacheLicence implements Checker {
+
+    private Project release;
+    public static final String APACHE_LICENCE_NAME = "Apache License 2.0";
+
+    public void check() throws Exception {
+        Notice notice = release.getNotice();
+        List<License> list = notice.getIncluded();
+        boolean found = false;
+        for(License lic :list) {
+            if (lic.getLicense().equals(APACHE_LICENCE_NAME)) {
+                found = true;
+            }
+        }
+        
+        if (! found) {
+            throw new Exception("The artifacts contain Apache code, but the license is not included");
+        }
+    }
+
+    public void clean() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public String getCheckerName() {
+        return "Include Apache Licence Checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+       // Check that we include Apache code.
+        Iterator<String> it = release.getArtifacts().keySet().iterator();
+        ZipFile jar = null;
+        while(it.hasNext()) {
+            String f = it.next();
+            if (f.endsWith(release.getVersion() + ".jar")) { // Avoid sources.
+                jar = new ZipFile(release.getArtifacts().get(f));
+            }
+        }
+        
+        ZipEntry ze = jar.getEntry("org/apache");
+        return (ze != null);
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedLicenseChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedLicenseChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedLicenseChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/IncludedLicenseChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,118 @@
+package org.apache.felix.project.checker;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class IncludedLicenseChecker implements Checker {
+
+    private Project release;
+    private JarFile jar;
+
+    public void check() throws Exception {
+        List<String> referred = new ArrayList<String>();
+        Enumeration entries = jar.entries();
+        while(entries.hasMoreElements()) {
+            JarEntry je = (JarEntry) entries.nextElement();
+            if (je.getName().endsWith(".class")) {
+                // Compute the package name
+                int index = je.getName().lastIndexOf('/');
+                String prefix = je.getName().substring(0, index);
+                if (! referred.contains(prefix)) {
+                    referred.add(prefix);
+                }
+            }
+        }
+        
+        filter(referred); // Remove apache
+        check(referred); // Check the others references against the checkers.
+        
+        if (! referred.isEmpty()) {
+            // Unrecognized packages.
+            for (String r : referred) {
+                release.warning(this, "Cannot match " + r + " with a known license");
+            }
+        }
+    }
+    
+    private void filter(List<String> referred) {
+        List<String> toRemove = new ArrayList<String>();
+        for (String s : referred) {
+            if (s.startsWith("org/apache/")) {
+                toRemove.add(s);
+            }
+        }
+        referred.removeAll(toRemove);
+    }
+    
+    private void check(List<String> referred) {
+        List<String> toRemove = new ArrayList<String>();
+        for (String s : referred) {
+            if (toRemove.contains(s)) {
+                continue; // Already checked.
+            }
+            String name = s.replace('/', '.'); 
+            License checker = getLicenseByPrefix(name);
+
+            if (checker != null) {
+                try {
+                    License found = getLicenseByKeyword(checker.getKeyword());
+                    checker.check(this, release, found);
+                    // Remove package.
+                    for (String x : referred) {
+                        if (x.startsWith(s)) {
+                            toRemove.add(x);
+                        }
+                    }
+                } catch (Exception e) {
+                    release.error(this, "Included code does not have an appropriate licence " + s, e.getMessage());
+                }
+            }
+            
+        }
+        referred.removeAll(toRemove);
+    }
+    
+    public License getLicenseByPrefix(String packagename) {
+        for (License checker : release.getKnownLicense()) {
+            for (int i = 0; i < checker.getPackages().length; i++) {
+                if (packagename.startsWith(checker.getPackages()[i])) {
+                    return checker;
+                }
+            }
+            
+        }
+        return null;
+    }
+    
+    public License getLicenseByKeyword(String key) {
+        Notice notice = release.getNotice();
+        License found = null;
+        List<License> lics = notice.getIncluded();
+        for (License lic : lics) {
+            if (lic.getText().contains(key)) {
+                if (found == null) {
+                    found = lic;
+                } else {
+                    release.warning(this, "Ambiguity found when analyzing the notice file, several licenses matche with " + key);
+                }
+            } 
+        }
+        return found;
+    }
+
+    public void clean() {    }
+
+    public String getCheckerName() {
+        return "Included License Checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+        jar = release.getJar();
+        return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarLicenseChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarLicenseChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarLicenseChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarLicenseChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,43 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class JarLicenseChecker implements Checker {
+    
+    private ZipFile file;
+
+    public void check() throws Exception {
+       ZipEntry entry = file.getEntry("META-INF/LICENSE");
+       if (entry == null) {
+           entry = file.getEntry("META-INF/LICENCE");
+       }
+       
+       if (entry == null) {
+           throw new Exception("Cannot find license file in " + file.getName());
+       }
+    }
+    
+    public String getCheckerName() {
+        return "Jar Header Checker";
+    }
+
+    public void clean() {    }
+
+    public boolean prepare(Project release) throws Exception {
+        // Get the zipped project
+        Map<String, File> maps = release.getArtifacts();
+        Iterator<String> it = maps.keySet().iterator();
+        while(it.hasNext()) {
+            String f = it.next();
+            if (f.endsWith(release.getVersion() + ".jar")) { // Avoid sources.
+                file = new ZipFile(maps.get(f));
+            }
+        }
+        return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarNoticeChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarNoticeChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarNoticeChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/JarNoticeChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,41 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class JarNoticeChecker implements Checker {
+    
+    private ZipFile file;
+
+    public void check() throws Exception {
+       ZipEntry entry = file.getEntry("META-INF/NOTICE");
+      
+       if (entry == null) {
+           throw new Exception("Cannot find notice file in " + file.getName());
+       }
+    }
+
+    public void clean() {    }
+
+    public boolean prepare(Project release) throws Exception {
+        // Get the zipped project
+        Map<String, File> maps = release.getArtifacts();
+        Iterator<String> it = maps.keySet().iterator();
+        while(it.hasNext()) {
+            String f = it.next();
+            if (f.endsWith(release.getVersion() + ".jar")) { // Avoid sources.
+                file = new ZipFile(maps.get(f));
+            }
+        }
+        
+        return true;
+    }
+    
+    public String getCheckerName() {
+        return "Jar Notice Checker";
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/License.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,278 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class License {
+    
+    private static final String FIRST_LINE_REGEX = "This product (includes|uses) software .*";
+    private static final Pattern FIRST_LINE_PATTERN = Pattern.compile(FIRST_LINE_REGEX);
+    
+    private static final String PROVIDER_REGEX = "(.*)\\((.*)\\)\\.?";
+    private static final Pattern PROVIDER_PATTERN = Pattern.compile(PROVIDER_REGEX);
+    
+    private static final String LICENSE_REGEX = "Licensed under( the)? (.*).";
+    private static final Pattern LICENSE_PATTERN = Pattern.compile(LICENSE_REGEX);
+        
+    private String copyright;
+    
+    private String text;
+    
+    private String provider;
+    
+    private String url;
+    
+    private String license;
+    
+    boolean includes = false;
+    
+    private File file;
+    
+    private String[] packages;
+    
+    private String keyword;
+    
+    public License(String text) throws Exception {
+        this.text = text;
+        String[] table = text.split("\n");
+        switch (table.length) {
+            case 2: // First line + license line or First line + copyright
+                parseFirstLine(table[0]);
+                if (table[1].contains("Copyright")) {
+                    parseCopyright(table[1]);
+                } else {
+                    parseLicenseLine(table[1]);
+                }
+                break;
+            case 3: // First line + provider | copyright + license line
+                parseFirstLine(table[0]);
+                if (table[1].contains("Copyright")) {
+                    // No provider, copyright:
+                    parseCopyright(table[1]);
+                } else {
+                    parseProvider(table[1]);
+                }
+                parseLicenseLine(table[2]);
+                break;
+            case 4: // First line + provider + copyright + license line
+                parseFirstLine(table[0]);
+                parseProvider(table[1]);
+                parseCopyright(table[2]);
+                parseLicenseLine(table[3]);
+                break;
+            default:
+                throw new Exception("Cannot parse the license " + table[0]);
+        }
+       
+                    
+    }
+    
+    public License(String keyword, String packages, String license, String copyright, String provider, String url, File file) {
+        this.keyword = keyword;
+        this.license = license;
+        if (packages.contains(",")) {
+            this.packages = packages.split(",");
+        } else {
+            this.packages = new String[] {packages};
+        }
+        this.copyright = copyright;
+        this.provider = provider;
+        this.url = url;
+        this.file = file;
+    }
+  
+    public String getCopyright() {
+        return copyright;
+    }
+    
+    public String getText() {
+        return text;
+    }
+    
+    public boolean includes() {
+        return includes;
+    }
+    
+    public String getProvider() {
+        return provider;
+    }
+    
+    public String getLicense() {
+        return license;
+    }
+    
+    
+    public String getUrl() {
+        return url;
+    }
+
+    public boolean isIncludes() {
+        return includes;
+    }
+
+    public File getFile() {
+        return file;
+    }
+
+    public String[] getPackages() {
+        return packages;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    private void parseFirstLine(String s) throws Exception {
+        Matcher matcher = FIRST_LINE_PATTERN.matcher(s);
+        if (matcher.matches()) {
+            String verb = matcher.group(1);
+            if (verb.equals("includes")) {
+                includes = true;
+            }
+        } else {
+            throw new Exception("Malformed licence - the first line " + s + " does not match '" + FIRST_LINE_REGEX +"'");
+        }
+       
+    }
+    
+    private void parseProvider(String s) throws Exception {
+        Matcher matcher = PROVIDER_PATTERN.matcher(s);
+        if (matcher.matches()) {
+            provider = matcher.group(1).trim();
+            url = matcher.group(2).trim();
+        } else {
+            throw new Exception("Malformed licence - License provider line " + s + " doesn't match '" + PROVIDER_REGEX + "'");
+        }
+    }
+    
+    private void parseCopyright(String s) {
+        // Optional line.
+        if (s.contains("Copyright")) {
+            copyright = s.trim();
+        }
+    }
+    
+    private void parseLicenseLine(String s) throws Exception {
+        Matcher matcher = LICENSE_PATTERN.matcher(s);
+        if (matcher.matches()) {
+          license = matcher.group(2).trim();
+        } else {
+            throw new Exception("Malformed licence - Licence line " + s + " doesn't match '" + LICENSE_REGEX + "'");
+        }
+        
+    }
+    
+    public void check(Checker chk, Project release, License toanalyze) throws Exception {
+        if (file != null) {
+            checkJarFile(chk, release, release.getJar());
+            checkProjectFile(chk, release, release.getProjectRoot());
+        }
+        
+        // Check the license content
+        if (copyright != null) {
+            if (toanalyze.getCopyright() == null || ! copyright.equals(toanalyze.getCopyright())) {
+                release.error(chk, "Bad copyright for " + getKeyword() + " license : " + copyright + " expected.", null);
+            }
+        } else {
+            if (toanalyze.getCopyright() != null) {
+                release.error(chk, "Bad copyright for " + getKeyword() + " license (no copyright expected)", null);
+            }
+        }
+        
+        if (provider != null) {
+            if (toanalyze.getProvider() == null || ! provider.equals(toanalyze.getProvider())) {
+                release.error(chk, "Bad provider for " + getKeyword() + " license : " + provider + " expected, found " + toanalyze.getProvider(), null);
+            }
+        } else {
+            if (toanalyze.getProvider() != null) {
+                release.error(chk, "Bad provider for " + getKeyword() + " license (no provider expected)", null);
+            }
+        }
+        
+        if (url != null) {
+            if (toanalyze.getUrl() == null || ! url.equals(toanalyze.getUrl())) {
+                release.error(chk, "Bad URL for " + getKeyword() + " license : " + url + " expected, found " + toanalyze.getUrl(), null);
+            }
+        } else {
+            if (toanalyze.getUrl() != null) {
+                release.error(chk, "Bad URL for " + getKeyword() + " license (no url expected)", null);
+            }
+        }
+        
+        if (! license.equals(toanalyze.getLicense())) {
+            release.error(chk, "Bad license for " + getKeyword() + " license ( " + license + " expected)", null);
+        }
+    }
+
+    private void checkJarFile(Checker chk, Project release, JarFile jar) {
+       JarEntry je = jar.getJarEntry("META-INF/" + file.getName());
+       if (je == null) {
+           release.error(chk, "Cannot find the " + file.getName() + " in the Jar file", null);
+       }
+       
+       File file = null;
+       try {
+           file = Utils.expand(release.getArtifactDirectory(), "LIC-1", je, jar);
+           boolean ok = Utils.compare(this.file, file);
+           if (! ok) {
+               release.error(chk, "Differences found in the license file", null);
+           }
+       } catch (IOException e) {
+           release.error(chk, "Cannot expand the license file from the Jar file", e.getMessage());
+       } finally {
+           if (file != null) {
+               Utils.delete(file);
+           }
+       }
+    }
+    
+    private void checkProjectFile(Checker chk, Project release, File project) {
+        File lic = new File(project, file.getName());
+        if (! lic.exists()) {
+            release.error(chk, "Cannot found the " + file.getName() + " in the root of the project", null);
+        }
+        boolean ok = Utils.compare(this.file, file);
+        if (! ok) {
+            release.error(chk, "Differences found in the license file", null);
+        }
+     }
+    
+    
+    
+//    public static void main(String args[]) throws Exception {
+//        String l1 = "This product uses software developed at \n"
+//                    + "The OSGi Alliance (http://www.osgi.org/).\n"
+//                    + "Copyright (c) OSGi Alliance (2000, 2007).\n"
+//                    + "Licensed under the Apache License 2.0.";
+//        
+//        String l2 = "This product includes software developed at\n"
+//                + "The Apache Software Foundation (http://www.apache.org/).\n"
+//                + "Licensed under the Apache License 2.0.\n";
+//
+//        String l3 = "This product includes software developed by\n"
+//                   + "Mortbay (http://mortbay.org)\n"
+//                   + "Licensed under the Apache License 2.0.";
+//        
+//        String l4 = "This product includes software developed at\n"
+//                    + "Copyright (c) 2000-2005 INRIA, France Telecom\n"
+//                    + "Licensed under BSD License.";
+//        
+//        License lic1 = new License(l1);
+//
+//        License lic2 = new License(l2);
+//
+//        License lic3 = new License(l3);
+//        
+//        License lic4 = new License(l4);
+//
+//    }
+        
+        
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseParser.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseParser.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseParser.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseParser.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,89 @@
+package org.apache.felix.project.checker;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+public class LicenseParser {
+    
+    public static String KEYWORD = "keyword";
+    public static String PACKAGES = "packages";
+    public static String LICENSE = "license";
+    public static String COPYRIGHT = "copyright";
+    public static String PROVIDER = "provider";
+    public static String URL = "url";
+    public static String FILE = "file";
+    
+    public static List<License >getKnownLicenses(File repository) {
+        List<License> licenses = new ArrayList<License>();
+        File[] files = repository.listFiles();
+        if (files == null) {
+            System.err.println("Cannot load license repository");
+        }
+        for (File file : files) {
+            try {
+                if (file.getName().endsWith(".xml")) {
+                    licenses.add(parseLicence(file));
+                }
+            } catch (IOException e) {
+                System.err.println("Cannot parse the licence file " + e.getMessage());
+            } catch (DocumentException e) {
+                System.err.println("Cannot parse the licence file " + e.getMessage());
+            }
+        }
+        System.out.println("[INFO] " + licenses.size() + " known");
+        return licenses;
+    }
+    
+    
+    private static License parseLicence(File file) throws IOException, DocumentException {
+        SAXReader reader = new SAXReader();
+        Document document = reader.read(file);        
+        Element root = document.getRootElement();
+        Element key = root.element(KEYWORD);
+        if (key == null) {
+            throw new IOException("No keyword in the license file " + file.getName());
+        }
+        Element packages = root.element(PACKAGES);
+        if (packages == null) {
+            throw new IOException("No packages in the license file " + file.getName());
+        }
+        Element license = root.element(LICENSE);
+        if (license == null) {
+            throw new IOException("No keyword in the license file " + file.getName());
+        }
+        Element copyright = root.element(COPYRIGHT);
+        Element provider = root.element(PROVIDER);
+        Element url = root.element(URL);
+        Element licfile = root.element(FILE);
+
+        
+        String copy = null;
+        if (copyright != null) {
+            copy = copyright.getTextTrim();
+        }
+        String prov = null;
+        if (provider != null) {
+            prov = provider.getTextTrim();
+        }
+        String uri = null;
+        if (url != null) {
+            uri = url.getTextTrim();
+        }
+        File lic = null; 
+        if (licfile != null) {
+            lic = new File(file.getParentFile(), licfile.getTextTrim());
+        }
+        
+        return new License(key.getTextTrim(), packages.getTextTrim(), license.getTextTrim(), copy, prov, uri, lic);
+        
+        
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseSummaryChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseSummaryChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseSummaryChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LicenseSummaryChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,52 @@
+package org.apache.felix.project.checker;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class LicenseSummaryChecker implements Checker {
+    
+    private Notice notice;
+    private Project release;
+
+    public void check() throws Exception {
+        Set<String> referred = new HashSet<String>();
+        for(License lic : notice.getIncluded()) {
+            referred.add(lic.getLicense());
+        }
+        
+        for(License lic : notice.getUsed()) {
+            referred.add(lic.getLicense());
+        }
+        
+        
+        List<String> list = new ArrayList<String>(notice.getSummary());
+        
+        // Check that all license are in the summary.
+        for(String l : referred) {
+            boolean found = list.remove(l);
+            if (! found) {
+             throw new Exception("A referred license '" + l + "' is not in the summary " + notice.getSummary());   
+            }
+        }
+        
+        if (! list.isEmpty()) {
+            release.warning(this, "Licenses contained in the summary seems not used, may be unrecognized licences : " + list);
+        }
+    }
+
+    public void clean() {
+    }
+
+    public String getCheckerName() {
+        return "License Summary Checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+        notice = release.getNotice();
+        return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LinkCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LinkCollector.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LinkCollector.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/LinkCollector.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,49 @@
+package org.apache.felix.project.checker;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLEditorKit;
+
+public class LinkCollector extends HTMLEditorKit.ParserCallback {
+    
+    private URL url;
+    private String name;
+    private Map<String, URL> list = new HashMap<String, URL>();
+
+    public LinkCollector(URL url, String name) {
+        this.url = url;
+        this.name = name;
+    }
+    
+    public void add(String link) {
+        try {
+            URL url = new URL(this.url, link);
+            list.put(link, url);
+        } catch (MalformedURLException e) {
+            System.err.println("Cannot compute the url for " + link);
+        }
+    }
+    
+    public Map<String, URL> getlist() {
+        return list;
+    }
+
+    public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
+        if (t.equals(HTML.Tag.A)) {
+            String str = (String) a.getAttribute(HTML.Attribute.HREF);
+            if (str.contains(name+"-") && ! str.endsWith("/")) {
+                add(str);
+            }
+        }
+
+    }
+    
+
+
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/MD5Checker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,65 @@
+package org.apache.felix.project.checker;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class MD5Checker implements Checker {
+    
+    public static final String SSL_PROPERTY = "SSL"; 
+    
+    private List<File> files = new ArrayList<File>();
+    private Project release;
+
+    public void check() throws Exception {
+        for (File f : files) {
+            // Remove the .asc from the file name
+            int index = f.getName().lastIndexOf('.');
+            String n = f.getName().substring(0, index);
+            
+            Command cmd = new Command();
+            cmd.executeCommand(release, release.getProperty(SSL_PROPERTY) + " md5 " + n, false);
+            String out = cmd.getOutput();            
+            String md5 = getMD5(f);
+            if (! out.contains(md5)) {
+                throw new Exception("Bad MD5 hash for " + n + "Expected:" + md5 + " Get:" + out);
+            }
+        }
+    }
+
+    private String getMD5(File f) throws IOException {
+        FileReader fis = new FileReader (f);
+        BufferedReader br = new BufferedReader (fis);
+        String line = br.readLine();
+        int index = line.indexOf(' ');
+        return line.substring(index).trim();
+    }
+
+    public void clean() {
+        files.clear();
+    }
+
+    public boolean prepare(Project release) throws Exception {
+        this.release = release;
+        // Get all md5 and sha1 files
+        Map<String, File> maps = release.getArtifacts();
+        Iterator<String> it = maps.keySet().iterator();
+        while(it.hasNext()) {
+            String f = it.next();
+            if (f.endsWith(".md5")) {
+                files.add(maps.get(f));
+            }
+        }
+        return true;
+    }
+    
+    public String getCheckerName() {
+        return "MD5 Signature Checker";
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Notice.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Notice.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Notice.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/Notice.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,122 @@
+package org.apache.felix.project.checker;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Notice {
+
+    private String title;
+    private String copyright;
+    
+    private List<License> included = new ArrayList<License>();
+    private List<License> used = new ArrayList<License>();
+    
+    private List<String> summary = new ArrayList<String>();
+       
+    public String getTitle() {
+        return title;
+    }
+
+    public String getCopyright() {
+        return copyright;
+    }
+
+    public List<License> getIncluded() {
+        return included;
+    }
+
+    public List<License> getUsed() {
+        return used;
+    }
+
+    public List<String> getSummary() {
+        return summary;
+    }
+    
+    public Notice(File notice) throws Exception {
+        read(notice);
+    }
+    
+    public void read(File file) throws Exception {
+        BufferedReader input =  new BufferedReader(new FileReader(file));
+
+        String line = null;
+        int step = 0; // 0 = header, 1 = included, 2 = used, 3 = summary
+        boolean newentry = true;
+        StringBuffer current = new StringBuffer();
+        while (( line = input.readLine()) != null) {
+            if(line.length() == 0) {
+                if (current.length() > 0) {
+                    try {
+                    if (step == 1) {
+                        included.add(new License(current.toString()));
+                    } else {
+                        used.add(new License(current.toString()));
+                    }
+                    } catch(Exception e) {
+                        System.out.println("[WARNING] Unrecognized license format in the notice file :");
+                        System.out.println(current);
+                    }
+                }
+                current = new StringBuffer();
+                newentry = true;
+            } else if (line.contains("I. Included Software")){
+                step = 1;
+            } else if (line.contains("II. Used Software")){
+                step = 2;
+            } else if (line.contains("III. ")){ // SUMMARY
+                step = 3;
+            } else {
+                switch (step) {
+                    case 0: 
+                        newentry = false;
+                        
+                        if (title == null) {
+                            title = line.trim();
+                        } else if (copyright == null){
+                            copyright = line.trim();
+                        } else {
+                            throw new Exception("Unexpected header line : " + line);
+                        }
+                        break;
+                    case 1:
+                    case 2:
+                        if (newentry) {
+                            newentry = false;
+                        }
+                        current.append(line +"\n");
+                        break;
+                    case 3: 
+                        // One license per line : - License name
+                        parseLicense(line);
+                        break;                      
+                }
+            } 
+        }
+    }
+    
+    private void parseLicense(String line) throws Exception {
+        Pattern pattern = Pattern.compile("-( )?(.*)");
+        Matcher matcher = pattern.matcher(line);
+        if (matcher.matches()) {
+            summary.add(matcher.group(2));
+        } else {
+            throw new Exception("Cannot parse the summary licence: " + line);
+        }
+    }
+    
+    public static void main(String args[]) throws Exception {
+        new Notice(new File("/Users/clement/workspaces/felix-trunk/ipojo/ant/NOTICE"));
+        new Notice(new File("/Users/clement/workspaces/felix-trunk/webconsole/NOTICE"));
+        new Notice(new File("/Users/clement/workspaces/felix-trunk/http.jetty/NOTICE"));
+
+
+        
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeCopyrightChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,37 @@
+package org.apache.felix.project.checker;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NoticeCopyrightChecker implements Checker {
+    
+    private Notice notice;
+    private static final String COPYRIGHT_REGEX = "Copyright (\\d{4}|\\d{4}-\\d{4}) The Apache Software Foundation";
+    private static final Pattern COPYRIGHT_PATTERN = Pattern.compile(COPYRIGHT_REGEX);
+
+
+    public void check() throws Exception {
+        String copyright = notice.getCopyright();
+        Matcher matcher = COPYRIGHT_PATTERN.matcher(copyright);
+        if (matcher.matches()) {
+            String year = matcher.group(1);
+            if (! year.contains("2009")) {
+                throw new Exception("The copyright year(s) must contains 2009");
+            }
+        } else {
+            throw new Exception("The copyright (" + copyright + ") is not conform against " + COPYRIGHT_REGEX);
+        }
+    }
+
+    public void clean() {    }
+
+    public String getCheckerName() {
+        return "Notice Copyright checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+       notice = release.getNotice();
+       return true;
+    }
+
+}

Added: felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeNameChecker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeNameChecker.java?rev=763213&view=auto
==============================================================================
--- felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeNameChecker.java (added)
+++ felix/sandbox/clement/Project-Checker/src/org/apache/felix/project/checker/NoticeNameChecker.java Wed Apr  8 12:30:27 2009
@@ -0,0 +1,34 @@
+package org.apache.felix.project.checker;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NoticeNameChecker implements Checker {
+    
+    private Notice notice;
+    private Project release;;
+
+
+    public void check() throws Exception {
+        String regex = release.getProperty("PARENT_PROJECT_NAME") + " (.)+";
+        Pattern pattern = Pattern.compile(regex);
+
+        Matcher matcher = pattern.matcher(notice.getTitle());
+        if (! matcher.matches()) {
+             throw new Exception("The notice title (" + notice.getTitle() + ") is not conform against " + regex);
+        }
+    }
+
+    public void clean() {    }
+
+    public String getCheckerName() {
+        return "Notice Copyright checker";
+    }
+
+    public boolean prepare(Project release) throws Exception {
+       this.release = release;
+       notice = release.getNotice();
+       return true;
+    }
+
+}



Mime
View raw message