You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/09/28 05:58:43 UTC

svn commit: r1176706 - in /openejb/trunk/sandbox/legal/src/main: java/org/apache/openejb/tools/legal/ resources/legal/ resources/licenses/

Author: dblevins
Date: Wed Sep 28 03:58:42 2011
New Revision: 1176706

URL: http://svn.apache.org/viewvc?rev=1176706&view=rev
Log:
Reports

Added:
    openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Templates.java
    openejb/trunk/sandbox/legal/src/main/resources/legal/
    openejb/trunk/sandbox/legal/src/main/resources/legal/archive.vm
    openejb/trunk/sandbox/legal/src/main/resources/legal/archives.vm
    openejb/trunk/sandbox/legal/src/main/resources/legal/licenses.vm
    openejb/trunk/sandbox/legal/src/main/resources/legal/notices.vm
    openejb/trunk/sandbox/legal/src/main/resources/licenses/
    openejb/trunk/sandbox/legal/src/main/resources/licenses/asl.txt
Modified:
    openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/IOUtil.java
    openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Main.java

Modified: openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/IOUtil.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/IOUtil.java?rev=1176706&r1=1176705&r2=1176706&view=diff
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/IOUtil.java (original)
+++ openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/IOUtil.java Wed Sep 28 03:58:42 2011
@@ -20,6 +20,7 @@ import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
@@ -63,6 +64,12 @@ public class IOUtil {
         }
     }
 
+    public static String slurp(File file) throws IOException {
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        copy(file, out);
+        return new String(out.toByteArray());
+    }
+
     public static void writeString(File file, String string) throws IOException {
         final FileWriter out = new FileWriter(file);
         try {

Modified: openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Main.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Main.java?rev=1176706&r1=1176705&r2=1176706&view=diff
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Main.java (original)
+++ openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Main.java Wed Sep 28 03:58:42 2011
@@ -16,8 +16,10 @@
  */
 package org.apache.openejb.tools.legal;
 
+import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpHead;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
@@ -26,11 +28,19 @@ import org.apache.log4j.PatternLayout;
 import org.codehaus.swizzle.stream.StreamLexer;
 
 import java.io.File;
+import java.io.FileFilter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
@@ -52,19 +62,31 @@ public class Main {
 
     private final DefaultHttpClient client;
     private final File local;
-    private final URI repo;
-    private final File localRepo;
+    private final URI staging;
+    private final File repository;
+    private final File content;
+    private String asl;
 
     public Main(String... args) throws Exception {
         client = new DefaultHttpClient();
-        local = File.createTempFile("repository-check", "local");
-        assert local.delete();
-        assert local.mkdirs();
+//        local = File.createTempFile("repository-check", "local");
+//        assert local.delete();
+//        assert local.mkdirs();
+        local = new File("/var/folders/Kp/KpmOujsB2RWdqE+BYnAOX++++TI/-Tmp-/repository-check7644335928314455238local");
 
-        localRepo = new File(local, "repo");
-        assert localRepo.mkdirs();
+        repository = new File(local, "repo");
+        content = new File(local, "content");
 
-        repo = new URI(args[0]);
+        mkdirs(repository);
+        mkdirs(content);
+
+        staging = new URI(args[0]);
+
+        log.info("Repo: " + staging);
+        log.info("Local: " + local);
+
+//        URL resource = this.getClass().getResource("licenses/asl.txt");
+//        asl = IOUtil.readString(resource).trim();
     }
 
     public static void main(String[] args) throws Exception {
@@ -74,9 +96,90 @@ public class Main {
     private void main() throws Exception {
         // https://repository.apache.org/content/repositories/orgapacheopenejb-094
 
-        final URI index = new URI("https://repository.apache.org/content/repositories/orgapacheopenejb-094");
+//        prepare();
+
+        final List<File> jars = collect(repository, new FileFilter() {
+            @Override
+            public boolean accept(File pathname) {
+                return pathname.isFile();
+            }
+        });
+
+        final List<Archive> archives = new ArrayList<Archive>();
+        for (File file : jars) {
+            final Archive archive = new Archive(file);
+            archives.add(archive);
+        }
+
+        Templates.template("archives.vm").add("archives", archives).write(new File(local, "report.html"));
+
+        reportLicenses(archives);
+        reportNotices(archives);
+    }
+
+    private void reportLicenses(List<Archive> archives) throws IOException {
+        Map<License, License> licenses = new HashMap<License, License>();
+
+        for (Archive archive : archives) {
+            List<File> files = collect(contents(archive.getFile()), new LicenseFilter());
+            for (File file : files) {
+                final License license = new License(IOUtil.slurp(file));
+
+                License existing = licenses.get(license);
+                if (existing == null) {
+                    licenses.put(license, license);
+                    existing = license;
+                }
+
+                existing.getArchives().add(archive);
+                archive.getLicenses().add(existing);
+            }
+        }
+
+        Templates.template("licenses.vm").add("licenses", licenses.values()).write(new File(local, "licenses.html"));
+    }
+
+    private void reportNotices(List<Archive> archives) throws IOException {
+        Map<Notice, Notice> notices = new HashMap<Notice, Notice>();
 
-        final Set<URI> resources = crawl(index);
+        for (Archive archive : archives) {
+            List<File> files = collect(contents(archive.getFile()), new NoticeFilter());
+            for (File file : files) {
+                final Notice notice = new Notice(IOUtil.slurp(file));
+
+                Notice existing = notices.get(notice);
+                if (existing == null) {
+                    notices.put(notice, notice);
+                    existing = notice;
+                }
+
+                existing.getArchives().add(archive);
+                archive.getNotices().add(existing);
+            }
+        }
+
+        Templates.template("notices.vm").add("notices", notices.values()).write(new File(local, "notices.html"));
+    }
+
+    private List<URI> allNoticeFiles() {
+        List<File> legal = collect(content, new LegalFilter());
+        for (File file : legal) {
+            log.info("Legal " + file);
+        }
+
+        URI uri = local.toURI();
+        List<URI> uris = new ArrayList<URI>();
+        for (File file : legal) {
+            URI full = file.toURI();
+            URI relativize = uri.relativize(full);
+            uris.add(relativize);
+        }
+        return uris;
+    }
+
+    private void prepare() throws URISyntaxException, IOException {
+
+        final Set<URI> resources = crawl(staging);
 
         final Set<File> files = new HashSet<File>();
 
@@ -95,18 +198,20 @@ public class Main {
         try {
             final ZipInputStream zip = IOUtil.unzip(archive);
 
-            final File contents = new File(archive.getAbsolutePath() + ".contents");
-            assert contents.mkdir();
+            final File contents = contents(archive);
 
             try {
                 ZipEntry entry = null;
 
                 while ((entry = zip.getNextEntry()) != null) {
+
+                    if (entry.isDirectory()) continue;
+
                     final String path = entry.getName();
 
                     final File fileEntry = new File(contents, path);
 
-                    mkdirs(fileEntry);
+                    mkparent(fileEntry);
 
                     // Open the output file
 
@@ -124,33 +229,264 @@ public class Main {
         }
     }
 
+    public class License {
+        private final String text;
+        private String key;
+        private Set<Archive> archives = new HashSet<Archive>();
+
+        public License(String text) {
+            this.text = text.trim().intern();
+            key = text.replaceAll("[ \\n\\t\\r]+", "").intern();
+        }
+
+        public String getText() {
+            return text;
+        }
+
+        public String getKey() {
+            return key;
+        }
+
+        public Set<Archive> getArchives() {
+            return archives;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            License license = (License) o;
+
+            if (!key.equals(license.key)) return false;
+
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            return key.hashCode();
+        }
+    }
+
+    public class Notice {
+        private final String text;
+        private String key;
+        private Set<Archive> archives = new HashSet<Archive>();
+
+        public Notice(String text) {
+            this.text = text.trim().intern();
+            key = text.replaceAll("[ \\n\\t\\r]+", "").intern();
+        }
+
+        public String getText() {
+            return text;
+        }
+
+        public String getKey() {
+            return key;
+        }
+
+        public Set<Archive> getArchives() {
+            return archives;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            Notice notice = (Notice) o;
+
+            if (!key.equals(notice.key)) return false;
+
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            return key.hashCode();
+        }
+    }
+
+    public List<File> collect(File dir, FileFilter filter) {
+        final List<File> accepted = new ArrayList<File>();
+        if (filter.accept(dir)) accepted.add(dir);
+
+        final File[] files = dir.listFiles();
+        if (files != null) for (File file : files) {
+            accepted.addAll(collect(file, filter));
+        }
+
+        return accepted;
+    }
+
+    private File contents(File archive) {
+        String path = archive.getAbsolutePath().substring(local.getAbsolutePath().length() + 1);
+
+        if (path.startsWith("repo/")) path = path.substring("repo/".length());
+        if (path.startsWith("content/")) path = path.substring("content/".length());
+
+        final File contents = new File(content, path + ".contents");
+        mkdirs(contents);
+        return contents;
+    }
+
     private File download(URI uri) throws IOException {
+
+        final File file = getFile(uri);
+
+        if (file.exists()) {
+
+            long length = getConentLength(uri);
+
+            if (file.length() == length) {
+                log.info("Exists " + uri);
+                return file;
+            } else {
+                log.info("Incomplete " + uri);
+            }
+        }
+
         log.info("Download " + uri);
 
         final HttpResponse response = get(uri);
 
         final InputStream content = response.getEntity().getContent();
-        final String name = uri.toString().replace(repo.toString(), "").replaceFirst("^/", "");
 
-        final File file = new File(localRepo, name);
-
-        mkdirs(file);
+        mkparent(file);
 
         IOUtil.copy(content, file);
 
         return file;
     }
 
+    private static class LegalFilter implements FileFilter {
+
+        private static final NoticeFilter notice = new NoticeFilter();
+        private static final LicenseFilter license = new LicenseFilter();
+
+        @Override
+        public boolean accept(File pathname) {
+            return notice.accept(pathname) || license.accept(pathname);
+        }
+    }
+
+    private static class NoticeFilter implements FileFilter {
+        @Override
+        public boolean accept(File pathname) {
+            final String name = pathname.getName().toLowerCase();
+
+            if (name.equals("notice")) return true;
+            if (name.equals("notice.txt")) return true;
+
+            return false;
+        }
+    }
+
+    private static class LicenseFilter implements FileFilter {
+        @Override
+        public boolean accept(File pathname) {
+            final String name = pathname.getName().toLowerCase();
+
+            if (name.equals("license")) return true;
+            if (name.equals("license.txt")) return true;
+
+            return false;
+        }
+    }
+
+    public class Archive {
+
+        private final URI uri;
+        private final File file;
+        private final Map<URI, URI> map;
+
+        private final Set<License> licenses = new HashSet<License>();
+        private final Set<Notice> notices = new HashSet<Notice>();
+
+        private final Set<License> declaredLicenses = new HashSet<License>();
+        private final Set<Notice> declaredNotices = new HashSet<Notice>();
+
+        public Archive(File file) {
+            this.uri = repository.toURI().relativize(file.toURI());
+            this.file = file;
+            this.map = map();
+        }
+
+        public Set<License> getDeclaredLicenses() {
+            return declaredLicenses;
+        }
+
+        public Set<Notice> getDeclaredNotices() {
+            return declaredNotices;
+        }
+
+        public Set<License> getLicenses() {
+            return licenses;
+        }
+
+        public Set<Notice> getNotices() {
+            return notices;
+        }
+
+        public URI getUri() {
+            return uri;
+        }
+
+        public File getFile() {
+            return file;
+        }
+
+        public Map<URI, URI> getLegal() {
+            return map;
+        }
+
+        private Map<URI, URI> map() {
+            final File jarContents = contents(file);
+            final List<File> legal = collect(jarContents, new LegalFilter());
+
+            Map<URI, URI> map = new LinkedHashMap<URI, URI>();
+            for (File file : legal) {
+                URI name = jarContents.toURI().relativize(file.toURI());
+                URI link = local.toURI().relativize(file.toURI());
+
+                map.put(name, link);
+            }
+            return map;
+        }
+    }
+
+    private long getConentLength(URI uri) throws IOException {
+        HttpResponse head = head(uri);
+        Header[] headers = head.getHeaders("Content-Length");
+
+        for (Header header : headers) {
+            return new Long(header.getValue());
+        }
+
+        return -1;
+    }
+
+    private File getFile(URI uri) {
+        final String name = uri.toString().replace(staging.toString(), "").replaceFirst("^/", "");
+        return new File(repository, name);
+    }
+
+    private void mkparent(File file) {
+        mkdirs(file.getParentFile());
+    }
+
     private void mkdirs(File file) {
 
-        final File parent = file.getParentFile();
+        if (!file.exists()) {
+
+            assert file.mkdirs() : "mkdirs " + file;
 
-        if (!parent.exists()) {
-            assert parent.mkdirs() : "mkdirs " + parent;
             return;
         }
 
-        assert parent.isDirectory() : "not a directory" + parent;
+        assert file.isDirectory() : "not a directory" + file;
     }
 
     private HttpResponse get(URI uri) throws IOException {
@@ -159,6 +495,12 @@ public class Main {
         return client.execute(request);
     }
 
+    private HttpResponse head(URI uri) throws IOException {
+        final HttpHead request = new HttpHead(uri);
+        request.setHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13");
+        return client.execute(request);
+    }
+
     private Set<URI> crawl(URI index) throws IOException {
         log.info("Crawl " + index);
         final Set<URI> resources = new LinkedHashSet<URI>();
@@ -187,7 +529,7 @@ public class Main {
                     continue;
                 }
 
-                if (!uri.getPath().matches(".*(jar|zip|war|tar.gz)")) continue;
+                if (!uri.getPath().matches(".*(jar|zip|war|ear|tar.gz)")) continue;
 
                 resources.add(uri);
 
@@ -203,6 +545,4 @@ public class Main {
         }
         return resources;
     }
-
-
 }

Added: openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Templates.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Templates.java?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Templates.java (added)
+++ openejb/trunk/sandbox/legal/src/main/java/org/apache/openejb/tools/legal/Templates.java Wed Sep 28 03:58:42 2011
@@ -0,0 +1,173 @@
+/**
+ * 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.openejb.tools.legal;
+
+import org.apache.log4j.Logger;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.log.CommonsLogLogChute;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+public final class Templates {
+    private static final Logger LOGGER = Logger.getLogger(Templates.class);
+
+    private static final Templates INSTANCE = new Templates();
+    private static final String LOG_TAG = Templates.class.getName();
+    private static final String BASE = "legal/";
+
+    private VelocityEngine engine;
+    private Map<String, URL> resources = new HashMap<String, URL>();
+
+    private Templates() {
+        // no-op
+    }
+
+    public synchronized void init() {
+        if (engine != null) {
+            return;
+        }
+
+        engine = new VelocityEngine();
+
+        Properties properties = new Properties();
+        properties.setProperty("file.resource.loader.cache", "true");
+        properties.setProperty("resource.loader", "file, class");
+        properties.setProperty("class.resource.loader.description", "Velocity Classpath Resource Loader");
+        properties.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+        properties.setProperty("runtime.log.logsystem.class", CommonsLogLogChute.class.getName());
+        properties.setProperty("runtime.log.logsystem.commons.logging.name", LOG_TAG);
+        engine.init(properties);
+    }
+
+    private void evaluate(String template, Map<String, Object> mapContext, Writer writer) throws IOException {
+        if (engine == null) {
+            init();
+        }
+
+        if (!resources.containsKey(template)) {
+            URL resource = Thread.currentThread().getContextClassLoader().getResource(BASE + template);
+            resources.put(template, resource);
+        }
+
+        URL url = resources.get(template);
+        if (url == null) {
+            LOGGER.error("can't find template " + template);
+            return;
+        }
+
+        VelocityContext context = new VelocityContext(mapContext);
+        engine.evaluate(context, writer, LOG_TAG, new InputStreamReader(url.openStream()));
+    }
+
+    /**
+     * generate a file from a velocity template.
+     * <p/>
+     * In error case (template not found...), only log with error level will be done (no exception).
+     *
+     * @param template   the template path in PREFIX resource folder
+     * @param mapContext the parameters of the template
+     * @param path       the output path
+     */
+    public void apply(String template, Map<String, Object> mapContext, String path) {
+        FileWriter writer = null;
+        try {
+            writer = new FileWriter(path);
+            evaluate(template, mapContext, writer);
+        } catch (IOException ioe) {
+            LOGGER.error("can't apply template " + template, ioe);
+        } finally {
+            if (writer != null) {
+                try {
+                    writer.flush();
+                    writer.close();
+                } catch (IOException e) {
+                    LOGGER.error("can't flush file " + path, e);
+                }
+            }
+        }
+    }
+
+    public String apply(String template, Map<String, Object> mapContext) {
+        StringWriter writer = null;
+        try {
+            writer = new StringWriter();
+            evaluate(template, mapContext, writer);
+        } catch (IOException ioe) {
+            LOGGER.error("can't apply template " + template, ioe);
+        } finally {
+            if (writer != null) {
+                try {
+                    writer.flush();
+                    writer.close();
+                } catch (IOException e) {
+                    LOGGER.error("can't flush writer", e);
+                }
+            }
+        }
+        if (writer == null) {
+            return "";
+        }
+        return writer.toString();
+    }
+
+    public static Templates get() {
+        return INSTANCE;
+    }
+
+    public static Builder template(String name) {
+        return get().new Builder(name);
+    }
+
+    public class Builder {
+        private final String template;
+        private final Map<String, Object> map = new HashMap<String, Object>();
+
+        public Builder(String template) {
+            this.template = template;
+        }
+
+        public Builder add(String key, Object value) {
+            map.put(key, value);
+            return this;
+        }
+
+        public Builder addAll(Map<String, Object> map) {
+            this.map.putAll(map);
+            return this;
+        }
+
+        public String apply() {
+            return Templates.this.apply(template, map);
+        }
+
+        public File write(File file) throws IOException {
+            IOUtil.writeString(file, apply());
+            return file;
+        }
+    }
+}

Added: openejb/trunk/sandbox/legal/src/main/resources/legal/archive.vm
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/resources/legal/archive.vm?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/resources/legal/archive.vm (added)
+++ openejb/trunk/sandbox/legal/src/main/resources/legal/archive.vm Wed Sep 28 03:58:42 2011
@@ -0,0 +1,17 @@
+<html>
+
+<body>
+<h1>$archive.uri</h1>
+<ul>
+#foreach($archive in $archives)
+    <li>$archive.uri
+        <ul>
+        #foreach($file in $archive.legal.entrySet())
+            <li><a href="$file.value">$file.key</a></li>
+        #end
+        </ul>
+    </li>
+#end
+</ul>
+</body>
+</html>
\ No newline at end of file

Added: openejb/trunk/sandbox/legal/src/main/resources/legal/archives.vm
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/resources/legal/archives.vm?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/resources/legal/archives.vm (added)
+++ openejb/trunk/sandbox/legal/src/main/resources/legal/archives.vm Wed Sep 28 03:58:42 2011
@@ -0,0 +1,23 @@
+<html>
+
+<body>
+
+<h1>All</h1>
+<ul>
+<li>all (licenses, notices, <a href="content">contents</a>)</li>
+</ul>
+
+<h1>Archives</h1>
+<ul>
+#foreach($archive in $archives)
+    <li>$archive.uri  (licenses, notices, <a href="content/${archive.uri}.contents">contents</a>)
+        <ul>
+        #foreach($file in $archive.legal.entrySet())
+            <li><a href="$file.value">$file.key</a></li>
+        #end
+        </ul>
+    </li>
+#end
+</ul>
+</body>
+</html>
\ No newline at end of file

Added: openejb/trunk/sandbox/legal/src/main/resources/legal/licenses.vm
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/resources/legal/licenses.vm?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/resources/legal/licenses.vm (added)
+++ openejb/trunk/sandbox/legal/src/main/resources/legal/licenses.vm Wed Sep 28 03:58:42 2011
@@ -0,0 +1,17 @@
+<html>
+
+<body>
+
+#foreach($license in $licenses)
+    <h1>License</h1>
+<pre>
+$license.text
+</pre>
+    <ul>
+    #foreach($archive in $license.archives)
+        <li>$archive.uri</li>
+    #end
+    </ul>
+#end
+</body>
+</html>
\ No newline at end of file

Added: openejb/trunk/sandbox/legal/src/main/resources/legal/notices.vm
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/resources/legal/notices.vm?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/resources/legal/notices.vm (added)
+++ openejb/trunk/sandbox/legal/src/main/resources/legal/notices.vm Wed Sep 28 03:58:42 2011
@@ -0,0 +1,17 @@
+<html>
+
+<body>
+
+#foreach($notice in $notices)
+    <h1>Notice</h1>
+<pre>
+$notice.text
+</pre>
+    <ul>
+    #foreach($archive in $notice.archives)
+        <li>$archive.uri</li>
+    #end
+    </ul>
+#end
+</body>
+</html>
\ No newline at end of file

Added: openejb/trunk/sandbox/legal/src/main/resources/licenses/asl.txt
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/legal/src/main/resources/licenses/asl.txt?rev=1176706&view=auto
==============================================================================
--- openejb/trunk/sandbox/legal/src/main/resources/licenses/asl.txt (added)
+++ openejb/trunk/sandbox/legal/src/main/resources/licenses/asl.txt Wed Sep 28 03:58:42 2011
@@ -0,0 +1,202 @@
+
+                                 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.
\ No newline at end of file