class License {

    public static License findByValue(final String uri) {
        License found = License.lookupLicense.get(uri);

        // No I am going to try an guess about unknown licenses
        // This is try and match known CC licenses of other versions or various URLs to
        // current licenses, then make a new one with the same permissions.
        if (found == null && uri.startsWith("http://") && uri.toLowerCase().indexOf("creativecommons.org") != -1) {
            final Iterator<String> it = License.lookupLicense.keySet().iterator();
            while (it.hasNext() && found == null) {
                final String key = it.next();
                try {
                    if (key.startsWith(CC_START)) {
                        final String licensePath = key.substring(CC_START.length(), key.length());
                        final StringTokenizer tok = new StringTokenizer(licensePath, "/");
                        final String license = tok.nextToken();
                        // final String version = tok.nextToken();
                        if (uri.toLowerCase().indexOf("creativecommons.org/licenses/" + license) != -1) {
                            final License current = lookupLicense.get(key);
                            found = new License(uri, current.getRequires(), current.getPermits());
                        }
                    }
                } catch (final Exception e) {
                    LOG.error("Error", e);
                }
            }
        }
        // OK, we got here. If we haven't found a match, return a new License with unknown
        // permissions.
        if (found == null) {
            found = new License(uri, null, null);
        }
        return found;
    }

    public  License(final String uri, final Behaviour[] requires, final Behaviour[] permits);

}