From 1c315b754e580b0d79dda937eea1a07a59ee8345 Mon Sep 17 00:00:00 2001 From: Nicolas MASSE Date: Wed, 11 Sep 2019 11:35:34 +0200 Subject: [PATCH] migration from svn --- bookshelf/build.xml | 66 ++ bookshelf/conf/MANIFEST.MF | 2 + bookshelf/nbproject/ant-deploy.xml | 28 + bookshelf/nbproject/build-impl.xml | 690 ++++++++++++ bookshelf/nbproject/genfiles.properties | 8 + bookshelf/nbproject/project.properties | 65 ++ bookshelf/nbproject/project.xml | 18 + .../fr/itix/bookshelf/BookshelfDatabase.java | 39 + .../fr/itix/bookshelf/BookshelfDocument.java | 66 ++ .../src/fr/itix/bookshelf/DeweyCategory.java | 65 ++ bookshelf/src/fr/itix/bookshelf/Isbn.java | 194 ++++ .../src/fr/itix/bookshelf/LdapDatabase.java | 144 +++ .../itix/bookshelf/BookshelfDocumentTest.java | 177 +++ .../test/fr/itix/bookshelf/IsbnTest.java | 102 ++ bookshelf/web/META-INF/context.xml | 2 + bookshelf/web/WEB-INF/web.xml | 17 + bookshelf/web/index.jsp | 36 + ldap/classification/dewey.txt | 1000 +++++++++++++++++ ldap/classification/to_ldap.sh | 50 + ldap/schema/bookshelf.schema | 114 ++ ldap/slapd.conf | 16 + 21 files changed, 2899 insertions(+) create mode 100755 bookshelf/build.xml create mode 100755 bookshelf/conf/MANIFEST.MF create mode 100755 bookshelf/nbproject/ant-deploy.xml create mode 100755 bookshelf/nbproject/build-impl.xml create mode 100755 bookshelf/nbproject/genfiles.properties create mode 100755 bookshelf/nbproject/project.properties create mode 100755 bookshelf/nbproject/project.xml create mode 100755 bookshelf/src/fr/itix/bookshelf/BookshelfDatabase.java create mode 100755 bookshelf/src/fr/itix/bookshelf/BookshelfDocument.java create mode 100755 bookshelf/src/fr/itix/bookshelf/DeweyCategory.java create mode 100755 bookshelf/src/fr/itix/bookshelf/Isbn.java create mode 100755 bookshelf/src/fr/itix/bookshelf/LdapDatabase.java create mode 100755 bookshelf/test/fr/itix/bookshelf/BookshelfDocumentTest.java create mode 100755 bookshelf/test/fr/itix/bookshelf/IsbnTest.java create mode 100755 bookshelf/web/META-INF/context.xml create mode 100755 bookshelf/web/WEB-INF/web.xml create mode 100755 bookshelf/web/index.jsp create mode 100755 ldap/classification/dewey.txt create mode 100755 ldap/classification/to_ldap.sh create mode 100755 ldap/schema/bookshelf.schema create mode 100755 ldap/slapd.conf diff --git a/bookshelf/build.xml b/bookshelf/build.xml new file mode 100755 index 0000000..59d348e --- /dev/null +++ b/bookshelf/build.xml @@ -0,0 +1,66 @@ + + + + + + Builds, tests, and runs the project bookshelf. + + + diff --git a/bookshelf/conf/MANIFEST.MF b/bookshelf/conf/MANIFEST.MF new file mode 100755 index 0000000..59499bc --- /dev/null +++ b/bookshelf/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/bookshelf/nbproject/ant-deploy.xml b/bookshelf/nbproject/ant-deploy.xml new file mode 100755 index 0000000..bcfeee4 --- /dev/null +++ b/bookshelf/nbproject/ant-deploy.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bookshelf/nbproject/build-impl.xml b/bookshelf/nbproject/build-impl.xml new file mode 100755 index 0000000..90b056b --- /dev/null +++ b/bookshelf/nbproject/build-impl.xml @@ -0,0 +1,690 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bookshelf/nbproject/genfiles.properties b/bookshelf/nbproject/genfiles.properties new file mode 100755 index 0000000..ea06ba4 --- /dev/null +++ b/bookshelf/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=c1b5a629 +build.xml.script.CRC32=16f4cbe7 +build.xml.stylesheet.CRC32=95be3570 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=c1b5a629 +nbproject/build-impl.xml.script.CRC32=4e40cf18 +nbproject/build-impl.xml.stylesheet.CRC32=ac43bae1 diff --git a/bookshelf/nbproject/project.properties b/bookshelf/nbproject/project.properties new file mode 100755 index 0000000..54555ba --- /dev/null +++ b/bookshelf/nbproject/project.properties @@ -0,0 +1,65 @@ +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.ear.classes.dir=${build.ear.web.dir}/WEB-INF/classes +build.ear.web.dir=${build.dir}/ear-module +build.generated.dir=${build.dir}/generated +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=conf +debug.classpath=${javac.classpath}:${build.classes.dir}:${build.ear.classes.dir} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +j2ee.platform=1.4 +j2ee.server.type=Tomcat55 +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.source=${default.javac.source} +javac.target=${default.javac.target} +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jspcompilation.classpath=${jspc.classpath}:${javac.classpath} +lib.dir=${web.docbase.dir}/WEB-INF/lib +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running class with main method +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.root=. +src.dir=src +test.src.dir=test +war.content.additional= +war.ear.name=bookshelf.war +war.name=bookshelf.war +war.package=true +web.docbase.dir=web diff --git a/bookshelf/nbproject/project.xml b/bookshelf/nbproject/project.xml new file mode 100755 index 0000000..91d6a59 --- /dev/null +++ b/bookshelf/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.web.project + + + bookshelf + 1.6 + + + + + + + + + + + diff --git a/bookshelf/src/fr/itix/bookshelf/BookshelfDatabase.java b/bookshelf/src/fr/itix/bookshelf/BookshelfDatabase.java new file mode 100755 index 0000000..b986416 --- /dev/null +++ b/bookshelf/src/fr/itix/bookshelf/BookshelfDatabase.java @@ -0,0 +1,39 @@ +/* + * BookshelfDatabase.java + * + * Created on November 19, 2006, 11:36 AM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import java.util.List; + +/** + * Represents a connection to a database. + * + * @author Nicolas MASSE + */ +public interface BookshelfDatabase { + + public BookshelfDocument getDocumentFromGlobalId(int globalId); + public List getDeweyCategories(String level); +} diff --git a/bookshelf/src/fr/itix/bookshelf/BookshelfDocument.java b/bookshelf/src/fr/itix/bookshelf/BookshelfDocument.java new file mode 100755 index 0000000..c93a9ae --- /dev/null +++ b/bookshelf/src/fr/itix/bookshelf/BookshelfDocument.java @@ -0,0 +1,66 @@ +/* + * BookshelfDocument.java + * + * Created on November 5, 2006, 8:59 PM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import javax.naming.*; +import javax.naming.directory.*; + +/** + * + * @author Nicolas MASSE + */ +public class BookshelfDocument { + private int globalId; + private String title; + + /** Creates a new instance of BookshelfDocument */ + public BookshelfDocument(SearchResult res) { + try { + Attributes attrs = res.getAttributes(); + + Attribute gidAttr = attrs.get("frItixGlobalId"); + this.globalId = Integer.parseInt((String) gidAttr.get()); + + Attribute titleAttr = attrs.get("frItixTitle"); + this.title = (String) titleAttr.get(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public String toString() { + return "[" + this.globalId + "] \"" + this.title + "\""; + } + + public int getGlobalId() { + return globalId; + } + + public String getTitle() { + return title; + } + +} diff --git a/bookshelf/src/fr/itix/bookshelf/DeweyCategory.java b/bookshelf/src/fr/itix/bookshelf/DeweyCategory.java new file mode 100755 index 0000000..8b26bbd --- /dev/null +++ b/bookshelf/src/fr/itix/bookshelf/DeweyCategory.java @@ -0,0 +1,65 @@ +/* + * DeweyCategory.java + * + * Created on January 22, 2007, 9:16 PM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import javax.naming.*; +import javax.naming.directory.*; + +/** + * + * @author Nicolas MASSE + */ +public class DeweyCategory { + private String id; + private String name; + + /** Creates a new instance of DeweyCategory */ + public DeweyCategory(SearchResult res) { + try { + Attributes attrs = res.getAttributes(); + + Attribute idAttr = attrs.get("frItixCategoryId"); + this.id = (String) idAttr.get(); + + Attribute nameAttr = attrs.get("frItixCategoryName"); + this.name = (String) nameAttr.get(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String toString() { + return "[" + this.getId() + "] \"" + this.getName() + "\""; + } +} diff --git a/bookshelf/src/fr/itix/bookshelf/Isbn.java b/bookshelf/src/fr/itix/bookshelf/Isbn.java new file mode 100755 index 0000000..843b7ba --- /dev/null +++ b/bookshelf/src/fr/itix/bookshelf/Isbn.java @@ -0,0 +1,194 @@ +/* + * Isbn.java + * + * Created on November 19, 2006, 10:08 AM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +/** + * Represents an ISBN (10 or 13 chars long). + * + * @author Nicolas MASSE + */ +public abstract class Isbn { + /** The ISBN without separator */ + private String isbn; + + /** Creates a new instance of Isbn */ + public Isbn(String newIsbn) { + // Is the checksum valid ? + if (this.check(newIsbn)) { + + // All is OK + this.isbn = newIsbn; + } else { + throw new IllegalArgumentException("Bad Checksum"); + } + } + + /** + * Check the validity of the Isbn + */ + public abstract boolean check(String isbn); + + /** + * Returns the string representation of this ISBN. + */ + public String toString() { + return isbn; + } + + /** + * The factory of ISBNs. + * + * @param i an ISBN (10 or 13) + * @return an object + */ + public static Isbn newIsbn(String i) { + // remove separators and length check + i = Isbn.cleanIsbn(i); + + Isbn newIsbn = null; + + // An ISBN must be 10 or 13 chars long. + if (i.length() == 10) { + newIsbn = new Isbn10(i); + } else if (i.length() == 13) { + newIsbn = new Isbn13(i); + } else { + throw new IllegalArgumentException("The ISBN has an invalid size" + + " (" + i.length() + ")"); + } + + return newIsbn; + } + + /** + * Cleans the ISBN by removing all hyphens and white spaces. + * + * @param newIsbn the isbn to check + * @return the cleaned isbn + */ + public static String cleanIsbn(String newIsbn) { + StringBuffer b = new StringBuffer(13); + + // Remove all the separators + int len = newIsbn.length(); + for (int i = 0; i < len; i++) { + + char c = newIsbn.charAt(i); + + if ((c >= '0' && c <= '9') || c == 'X' || c == 'x') { + // valid ISBN character + b.append(c); + } else if (c == '-' || c == ' ') { + // ignore separators + } else { + throw new IllegalArgumentException("Invalid character found in" + + " the ISBN at pos " + i + " (" + c + ")"); + } + } + + return b.toString(); + } +} + +/** + * An old ISBN (10 chars) + */ +class Isbn10 extends Isbn { + public Isbn10(String i) { + super(i); + } + + /** + * Check the validity of an ISBN10. + * + * @param isbn the result of the function cleanIsbn. + * @return true or false + */ + public boolean check(String isbn) { + boolean res = false; + + int sum = 0; + for (int i = 0; i < 9; i++) { + if (isbn.charAt(i) == 'x' || isbn.charAt(i) == 'X') { + throw new IllegalArgumentException("Invalid 'X' character found" + + " in the middle of the ISBN"); + } + + sum += (isbn.charAt(i) - '0') * (10 - i); + } + + if (isbn.charAt(9) == 'x' || isbn.charAt(9) == 'X') { + sum += 10; + } else { + sum += (isbn.charAt(9) - '0'); + } + + if ((sum % 11) == 0) { + res = true; + } + + return res; + } +} + +/** + * A new ISBN (13 chars). + */ +class Isbn13 extends Isbn { + public Isbn13(String i) { + super(i); + } + + /** + * Check the validity of an ISBN13. + * + * @param s the result of the function cleanIsbn. + * @return true or false + */ + public boolean check(String s) { + boolean res = false; + + int sum = 0; + int w = 1; + for (int i = 0; i < 13; i++) { + if (s.charAt(i) == 'x' || s.charAt(i) == 'X') { + throw new IllegalArgumentException("Invalid 'X' character found" + + " in an ISBN13"); + } + + sum += (s.charAt(i) - '0') * w; + w = (w == 1 ? 3 : 1); + } + + + if ((sum % 10) == 0) { + res = true; + } + + return res; + } + +} \ No newline at end of file diff --git a/bookshelf/src/fr/itix/bookshelf/LdapDatabase.java b/bookshelf/src/fr/itix/bookshelf/LdapDatabase.java new file mode 100755 index 0000000..ceaf2d8 --- /dev/null +++ b/bookshelf/src/fr/itix/bookshelf/LdapDatabase.java @@ -0,0 +1,144 @@ +/* + * LdapDatabase.java + * + * Created on November 19, 2006, 11:38 AM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import java.util.*; +import javax.naming.*; +import javax.naming.directory.*; + +/** + * Represents an LDAP directory. + * + * @author Nicolas MASSE + */ +public class LdapDatabase implements BookshelfDatabase { + private DirContext dctx; + + /** Creates a new instance of LdapDatabase */ + public LdapDatabase(String jndiUrl, String user, String pass) throws NamingException { + //Create a Hashtable object to place environment settings + Hashtable env = new Hashtable(); + + //Specify service provider class + String sp = "com.sun.jndi.ldap.LdapCtxFactory"; + env.put(Context.INITIAL_CONTEXT_FACTORY, sp); + + //Specify location of LDAP directory service + env.put(Context.PROVIDER_URL, jndiUrl); + + //Set the authentication type + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + + //Set username and password + env.put(Context.SECURITY_PRINCIPAL, user); + env.put(Context.SECURITY_CREDENTIALS, pass); + + dctx = new InitialDirContext(env); + } + + /** + * Closes the connection to the directory. + */ + protected void finalize() throws NamingException { + dctx.close(); + } + + /* + * See BookshelfDatabase.java + */ + public BookshelfDocument getDocumentFromGlobalId(int globalId) { + // Set search base + String base = ""; + + // Set attribute filter and search scope + SearchControls sc = new SearchControls(); + String[] attributeFilter = { "frItixGlobalId", "frItixTitle" }; + sc.setReturningAttributes(attributeFilter); + sc.setSearchScope(SearchControls.SUBTREE_SCOPE); + + // Define filter + String filter = "(frItixGlobalId=" + globalId + ")"; + NamingEnumeration results; + + // The document + BookshelfDocument d = null; + + try { + results = dctx.search(base, filter, sc); + if (results.hasMore()) { + SearchResult sr = (SearchResult)results.next(); + d = new BookshelfDocument(sr); + d.toString(); + } else { + throw new RuntimeException("No matching document found"); + } + } catch (NamingException ex) { + ex.printStackTrace(); + } + + return d; + } + + /** + * Returns the list of all the categories of the Decimal Dewey + * Classification under the given level. + * + * @param level the catagory in which we search + */ + public List getDeweyCategories(String level) { + if ("".equals(level)) { + // Set search base + String base = ""; + + // Set attribute filter and search scope + SearchControls sc = new SearchControls(); + String[] attributeFilter = { "frItixCategoryId", "frItixCategoryName" }; + sc.setReturningAttributes(attributeFilter); + sc.setSearchScope(SearchControls.ONELEVEL_SCOPE); + + // Define filter + String filter = "(objectClass=frItixCategory)"; + NamingEnumeration results; + + // The document + List categories = new ArrayList(); + + try { + results = dctx.search(base, filter, sc); + while (results.hasMore()) { + SearchResult sr = (SearchResult) results.next(); + categories.add(new DeweyCategory(sr)); + } + } catch (NamingException ex) { + ex.printStackTrace(); + } + + return categories; + } + + throw new RuntimeException("Not implemented"); + } +} diff --git a/bookshelf/test/fr/itix/bookshelf/BookshelfDocumentTest.java b/bookshelf/test/fr/itix/bookshelf/BookshelfDocumentTest.java new file mode 100755 index 0000000..73c6bbc --- /dev/null +++ b/bookshelf/test/fr/itix/bookshelf/BookshelfDocumentTest.java @@ -0,0 +1,177 @@ +/* + * BookshelfDocumentTest.java + * JUnit based test + * + * Created on November 5, 2006, 9:16 PM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import junit.framework.*; +import java.util.*; +import javax.naming.*; +import javax.naming.directory.*; + + +/** + * Asserts the behavior of the class BookshelfDocument + * + * @author Nicolas MASSE + */ +public class BookshelfDocumentTest extends TestCase { + private DirContext dctx; + + /** + * Creates a new test suite + */ + public BookshelfDocumentTest(String testName) { + super(testName); + } + + /** + * Establishes the connection to the LDAP server. + */ + protected void setUp() throws Exception { + //Create a Hashtable object to place environment settings + Hashtable env = new Hashtable(); + + //Specify service provider class + String sp = "com.sun.jndi.ldap.LdapCtxFactory"; + env.put(Context.INITIAL_CONTEXT_FACTORY, sp); + + //Specify location of LDAP directory service + String jndiUrl = "ldap://localhost:389/dc=bookshelf,dc=itix,dc=fr"; + env.put(Context.PROVIDER_URL,jndiUrl); + + //Specify an user and password + String user = "cn=Manager,dc=bookshelf,dc=itix,dc=fr"; + String pwd = "secret"; + + //Set the authentication type + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + + //Set username and password + env.put(Context.SECURITY_PRINCIPAL, user); + env.put(Context.SECURITY_CREDENTIALS, pwd); + + dctx = new InitialDirContext(env); + } + + /** + * Closes the connection to the LDAP server + */ + protected void tearDown() throws Exception { + dctx.close(); + } + + /** + * Test if a document can be constructed from an LDAP search. + */ + public void testConstructDocument() throws Exception { + //Set search base + String base = ""; + + //Set attribute filter and search scope + SearchControls sc = new SearchControls(); + String[] attributeFilter = {"frItixGlobalId", "frItixTitle"}; + sc.setReturningAttributes(attributeFilter); + sc.setSearchScope(SearchControls.SUBTREE_SCOPE); + + //Define filter + String filter = "(frItixTitle=*SELinux*)"; + + //Perform search + NamingEnumeration results = dctx.search(base, filter, sc); + + //results + while (results.hasMore()) { + SearchResult sr = (SearchResult)results.next(); + BookshelfDocument d = new BookshelfDocument(sr); + d.toString(); + } + + } + + /** + * Tests a failing construtor (frItixTitle missing). + */ + public void testConstructDocument2() throws Exception { + //Set search base + String base = ""; + + //Set attribute filter and search scope + SearchControls sc = new SearchControls(); + String[] attributeFilter = {"frItixGlobalId"}; + sc.setReturningAttributes(attributeFilter); + sc.setSearchScope(SearchControls.SUBTREE_SCOPE); + + //Define filter + String filter = "(frItixTitle=*SELinux*)"; + + //Perform search + NamingEnumeration results = dctx.search(base, filter, sc); + + //results + while (results.hasMore()) { + SearchResult sr = (SearchResult)results.next(); + try { + BookshelfDocument d = new BookshelfDocument(sr); + fail("Should throw a RuntimeException"); + } catch (RuntimeException expected) { + // Normal behavior + } + } + + } + + /** + * Tests a failing construtor (frItixGlobalId missing). + */ + public void testConstructDocument3() throws Exception { + //Set search base + String base = ""; + + //Set attribute filter and search scope + SearchControls sc = new SearchControls(); + String[] attributeFilter = {"frItixTitle"}; + sc.setReturningAttributes(attributeFilter); + sc.setSearchScope(SearchControls.SUBTREE_SCOPE); + + //Define filter + String filter = "(frItixTitle=*SELinux*)"; + + //Perform search + NamingEnumeration results = dctx.search(base, filter, sc); + + //results + while (results.hasMore()) { + SearchResult sr = (SearchResult)results.next(); + try { + BookshelfDocument d = new BookshelfDocument(sr); + fail("Should throw a RuntimeException"); + } catch (RuntimeException expected) { + // Normal behavior + } + } + + } +} diff --git a/bookshelf/test/fr/itix/bookshelf/IsbnTest.java b/bookshelf/test/fr/itix/bookshelf/IsbnTest.java new file mode 100755 index 0000000..0b2dbbb --- /dev/null +++ b/bookshelf/test/fr/itix/bookshelf/IsbnTest.java @@ -0,0 +1,102 @@ +/* + * IsbnTest.java + * JUnit based test + * + * Created on November 19, 2006, 10:10 AM + * + * + * Bookshelf - Manage a virtual bookshelf + * + * Copyright (C) 2006 Nicolas MASSE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package fr.itix.bookshelf; + +import junit.framework.*; + +/** + * + * @author Nicolas MASSE + */ +public class IsbnTest extends TestCase { + + public IsbnTest(String testName) { + super(testName); + } + + public void testConstructor() { + try { + Isbn i = Isbn.newIsbn(""); + this.fail("no exception thrown on empty ISBN"); + } catch (IllegalArgumentException ignored) { + // normal behavior + } + + try { + Isbn i = Isbn.newIsbn("0306406152"); + } catch (Exception e) { + this.fail("Exception thrown on valid ISBN - 1 [" + e + "]"); + } + + try { + Isbn i = Isbn.newIsbn("0-306-40615-2"); + } catch (Exception e) { + this.fail("Exception thrown on valid ISBN - 2 [" + e + "]"); + } + + try { + Isbn i = Isbn.newIsbn(" 0 306 40615 2 "); + } catch (Exception e) { + this.fail("Exception thrown on valid ISBN - 3 [" + e + "]"); + } + + try { + Isbn i = Isbn.newIsbn("123456789012345"); + this.fail("no exception thrown on too long ISBN (15)"); + } catch (IllegalArgumentException ignored) { + // normal behavior + } + + try { + Isbn i = Isbn.newIsbn("123456789012"); + this.fail("no exception thrown on bad ISBN (12 chars)"); + } catch (IllegalArgumentException ignored) { + // normal behavior + } + + try { + Isbn i = Isbn.newIsbn("12345678"); + this.fail("no exception thrown on too short ISBN (8)"); + } catch (IllegalArgumentException ignored) { + // normal behavior + } + + try { + Isbn i = Isbn.newIsbn("978-0-356-42615-0"); + } catch (Exception e) { + this.fail("Exception thrown on valid ISBN13 - [" + e + "]"); + } + + } + + protected void setUp() throws Exception { + } + + protected void tearDown() throws Exception { + } + +} diff --git a/bookshelf/web/META-INF/context.xml b/bookshelf/web/META-INF/context.xml new file mode 100755 index 0000000..9d722b3 --- /dev/null +++ b/bookshelf/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/bookshelf/web/WEB-INF/web.xml b/bookshelf/web/WEB-INF/web.xml new file mode 100755 index 0000000..9c98471 --- /dev/null +++ b/bookshelf/web/WEB-INF/web.xml @@ -0,0 +1,17 @@ + + + + + + 30 + + + + + index.jsp + + + diff --git a/bookshelf/web/index.jsp b/bookshelf/web/index.jsp new file mode 100755 index 0000000..245c308 --- /dev/null +++ b/bookshelf/web/index.jsp @@ -0,0 +1,36 @@ +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> +<%-- + Bookshelf - Manage a virtual bookshelf + + Copyright (C) 2006 Nicolas MASSE + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--%> + + + + + + + JSP Page + + + +

JSP Page

+ + + diff --git a/ldap/classification/dewey.txt b/ldap/classification/dewey.txt new file mode 100755 index 0000000..57db115 --- /dev/null +++ b/ldap/classification/dewey.txt @@ -0,0 +1,1000 @@ +000 Generalities +001 Knowledge +002 The book +003 Systems +004 Data processing Computer science +005 Computer programming, programs, data +006 Special computer methods +007 Not assigned or no longer used +008 Not assigned or no longer used +009 Not assigned or no longer used +010 Bibliography +011 Bibliographies +012 Bibliographies of individuals +013 Bibliographies of works by specific classes of authors +014 Bibliographies of anonymous and pseudonymous works +015 Bibliographies of works from specific places +016 Bibliographies of works from specific subjects +017 General subject catalogs +018 Catalogs arranged by author & date +019 Dictionary catalogs +020 Library & information sciences +021 Library relationships +022 Administration of the physical plant +023 Personnel administration +024 Not assigned or no longer used +025 Library operations +026 Libraries for specific subjects +027 General libraries +028 Reading, use of other information media +029 Not assigned or no longer used +030 General encyclopedic works +031 General encyclopedic works -- American +032 General encyclopedic works in English +033 General encyclopedic works in other Germanic languages +034 General encyclopedic works in French, Provencal, Catalan +035 General encyclopedic works in Italian, Romanian, Rhaeto-Romanic +036 General encyclopedic works in Spanish & Portuguese +037 General encyclopedic works in Slavic languages +038 General encyclopedic works in Scandinavian languages +039 General encyclopedic works in other languages +040 Not assigned or no longer used +041 Not assigned or no longer used +042 Not assigned or no longer used +043 Not assigned or no longer used +044 Not assigned or no longer used +045 Not assigned or no longer used +046 Not assigned or no longer used +047 Not assigned or no longer used +048 Not assigned or no longer used +049 Not assigned or no longer used +050 General serials & their indexes +051 General serials & their indexes American +052 General serials & their indexes In English +053 General serials & their indexes In other Germanic languages +054 General serials & their indexes In French, Provencal, Catalan +055 General serials & their indexes In Italian, Romanian, Rhaeto-Romanic +056 General serials & their indexes In Spanish & Portuguese +057 General serials & their indexes In Slavic languages +058 General serials & their indexes In Scandinavian languages +059 General serials & their indexes In other languages +060 General organization & museology +061 General organization & museology In North America +062 General organization & museology In British Isles In England +063 General organization & museology In central Europe In Germany +064 General organization & museology In France & Monaco +065 General organization & museology In Italy & adjacent territories +066 General organization & museology In Iberian Peninsula & adjacent islands +067 General organization & museology In eastern Europe In Soviet Union +068 General organization & museology In other areas +069 Museology (Museum science) +070 News media, journalism, publishing +071 News media, journalism, publishing In North America +072 News media, journalism, publishing In British Isles In England +073 News media, journalism, publishing In central Europe In Germany +074 News media, journalism, publishing In France & Monaco +075 News media, journalism, publishing In Italy & adjacent territories +076 News media, journalism, publishing In Iberian Peninsula & adjacent islands +077 News media, journalism, publishing In eastern Europe In Soviet Union +078 News media, journalism, publishing In Scandinavia +079 News media, journalism, publishing In other languages +080 General collections +081 General collections American +082 General collections In English +083 General collections In other Germanic languages +084 General collections In French, Provencal, Catalan +085 General collections In Italian, Romanian, Rhaeto-Romanic +086 General collections In Spanish & Portuguese +087 General collections In Slavic languages +088 General collections In Scandinavian languages +089 General collections In other languages +090 Manuscripts & rare books +091 Manuscripts +092 Block books +093 Incunabula +094 Printed books +095 Books notable for bindings +096 Books notable for illustrations +097 Books notable for ownership or origin +098 Prohibited works, forgeries, hoaxes +099 Books notable for format +100 Philosophy & psychology +101 Theory of philosophy +102 Miscellany of philosophy +103 Dictionaries of philosophy +104 Not assigned or no longer used +105 Serial publications of philosophy +106 Organizations of philosophy +107 Education, research in philosophy +108 Kinds of persons in philosophy +109 Historical treatment of philosophy +110 Metaphysics +111 Ontology +112 Not assigned or no longer used +113 Cosmology (Philosophy of nature) +114 Space +115 Time +116 Change +117 Structure +118 Force & Energy +119 Number & quantity +120 Epistemology, causation, humankind +121 Epistemology (Theory of knowledge) +122 Causation +123 Determinism & indeterminism +124 Teleology +125 Not assigned or no longer used +126 The self +127 The unconscious & the subconscious +128 Humankind +129 Origin & destiny of individual souls +130 Paranormal phenomena +131 Occult methods for achieving well-being +132 Not assigned or no longer used +133 Parapsychology & occultism +134 Not assigned or no longer used +135 Dreams & mysteries +136 Not assigned or no longer used +137 Divinatory graphology +138 Physiognomy +139 Phrenology +140 Specific philosophical schools +141 Idealism & related systems +142 Critical philosophy +143 Intuitionism & Bergsonism +144 Humanism & related systems +145 Sensationalism +146 Naturalism & related systems +147 Pantheism & related systems +148 Liberalism, eclecticism, traditionalism +149 Other philosophical systems +150 Psychology +151 Not assigned or no longer used +152 Perception, movement, emotions, drives +153 Mental processes & intelligence +154 Subconscious & altered states +155 Differential & developmental psychology +156 Comparative psychology +157 Not assigned or no longer used +158 Applied psychology +159 Not assigned or no longer used +160 Logic +161 Induction +162 Deduction +163 Not assigned or no longer used +164 Not assigned or no longer used +165 Fallacies & sources of error +166 Syllogisms +167 Hypotheses +168 Argument & persuasion +169 Analogy +170 Ethics (Moral philosophy) +171 Systems & doctrines +172 Political ethics +173 Ethics of family relationships +174 Economic & professional ethics +175 Ethics of recreation & leisure +176 Ethics of sex & reproduction +177 Ethics of social relations +178 Ethics of consumption +179 Other ethical norms +180 Ancient, medieval, Oriental philosophy +181 Oriental philosophy +182 Pre-Socratic Greek philosophies +183 Sophistic & Socratic philosophies +184 Platonic philosophy +185 Aristotelian philosophy +186 Skeptic and Neoplatonic philosophies +187 Epicurean philosophy +188 Stoic philosophy +189 Medieval Western philosophy +190 Modern Western philosophy +191 Modern Western philosophy United States & Canada +192 Modern Western philosophy British Isles +193 Modern Western philosophy Germany & Austria +194 Modern Western philosophy France +195 Modern Western philosophy Italy +196 Modern Western philosophy Spain & Portugal +197 Modern Western philosophy Soviet Union +198 Modern Western philosophy Scandinavia +199 Modern Western philosophy Other geographical areas +200 Religion +201 Philosophy of Christianity +202 Miscellany of Christianity +203 Dictionaries of Christianity +204 Special topics +205 Serial publications of Christianity +206 Organizations of Christianity +207 Education, research in Christianity +208 Kinds of persons in Christianity +209 History & geography of Christianity +210 Natural theology +211 Concepts of God +212 Existence, attributes of God +213 Creation +214 Theodicy +215 Science & religion +216 Good & evil +217 Not assigned or no longer used +218 Humankind +219 Not assigned or no longer used +220 Bible +221 Old Testament +222 Historical books of Old Testament +223 Poetic books of Old Testament +224 Prophetic books of Old Testament +225 New Testament +226 Gospels & Acts +227 Epistles +228 Revelation (Apocalypse) +229 Apocrypha & pseudepigrapha +230 Christian theology +231 God +232 Jesus Christ & his family +233 Humankind +234 Salvation (Soteriology) & grace +235 Spiritual beings +236 Eschatology +237 Not assigned or no longer used +238 Creeds & catechisms +239 Apologetics & polemics +240 Christian moral & devotional theology +241 Moral theology +242 Devotional literature +243 Evangelistic writings for individuals +244 Not assigned or no longer used +245 Texts of hymns +246 Use of art in Christianity +247 Church furnishings & articles +248 Christian experience, practice, life +249 Christian observances in family life +250 Christian orders & local church +251 Preaching (Homiletics) +252 Texts of sermons +253 Pastoral office (Pastoral theology) +254 Parish government & administration +255 Religious congregations & orders +256 Not assigned or no longer used +257 Not assigned or no longer used +258 Not assigned or no longer used +259 Activities of the local church +260 Christian social theology +261 Social theology +262 Ecclesiology +263 Times, places of religious observance +264 Public worship +265 Sacraments, other rites & acts +266 Missions +267 Associations for religious work +268 Religious education +269 Spiritual renewal +270 Christian church history +271 Religious orders in church history +272 Persecutions in church history +273 Heresies in church history +274 Christian church in Europe +275 Christian church in Asia +276 Christian church in Africa +277 Christian church in North America +278 Christian church in South America +279 Christian church in other areas +280 Christian denominations & sects +281 Early church & Eastern churches +282 Roman Catholic Church +283 Anglican churches +284 Protestants of Continental origin +285 Presbyterian, Reformed, Congregational +286 Baptist, Disciples of Christ, Adventist +287 Methodist & related churches +288 Not assigned or no longer used +289 Other denominations & sects +290 Other & comparative religions +291 Comparative religion +292 Classical (Greek & Roman) religion +293 Germanic religion +294 Religions of Indic origin +295 Zoroastrianism (Mazdaism, Parseeism) +296 Judaism +297 Islam & religions originating in it +298 Not assigned or no longer used +299 Other religions +300 Social sciences +301 Sociology & anthropology +302 Social interaction +303 Social processes +304 Factors affecting social behavior +305 Social groups +306 Culture & institutions +307 Communities +308 Not assigned or no longer used +309 Not assigned or no longer used +310 General statistics +311 Not assigned or no longer used +312 Not assigned or no longer used +313 Not assigned or no longer used +314 General statistics Of Europe +315 General statistics Of Asia +316 General statistics Of Africa +317 General statistics Of North America +318 General statistics Of South America +319 General statistics Of other parts of the world +320 Political science +321 Systems of governments & states +322 Relation of state to organized groups +323 Civil & political rights +324 The political process +325 International migration & colonization +326 Slavery & emancipation +327 International relations +328 The legislative process +329 Not assigned or no longer used +330 Economics +331 Labor economics +332 Financial economics +333 Land economics +334 Cooperatives +335 Socialism & related systems +336 Public finance +337 International economics +338 Production +339 Macroeconomics & related topics +340 Law +341 International law +342 Constitutional & administrative law +343 Military, tax, trade, industrial law +344 Social, labor, welfare, & related law +345 Criminal law +346 Private law +347 Civil procedure & courts +348 Law (Statutes), regulations, cases +349 Law of specific jurisdictions & areas +350 Public administration +351 Of central governments +352 Of local governments +353 of U.S. federal & state governments +354 Of specific central governments +355 Military science +356 Foot forces & warfare +357 Mounted forces & warfare +358 Other specialized forces & services +359 Sea (Naval) forces & warfare +360 Social services; association +361 General social problems & services +362 Social welfare problems & services +363 Other social problems & services +364 Criminology +365 Penal & related institutions +366 Association +367 General clubs +368 Insurance +369 Miscellaneous kinds of associations +370 Education +371 School management; special education +372 Elementary education +373 Secondary education +374 Adult education +375 Curriculums +376 Education of women +377 Schools & religion +378 Higher education +379 Government regulation, control, support +380 Commerce, communications, transport +381 Internal commerce (Domestic trade) +382 International commerce (Foreign trade) +383 Postal communication +384 Communications Telecommunication +385 Railroad transportation +386 Inland waterway & ferry transportation +387 Water, air, space transportation +388 Transportation Ground transportation +389 Metrology & standardization +390 Customs, etiquette, folklore +391 Costume & personal appearance +392 Customs of life cycle & domestic life +393 Death customs +394 General customs +395 Etiquette (Manners) +396 Not assigned or no longer used +397 Not assigned or no longer used +398 Folklore +399 Customs of war & diplomacy +400 Language +401 Philosophy & theory +402 Miscellany +403 Dictionaries & encyclopedias +404 Special topics +405 Serial publications +406 Organizations & management +407 Education, research, related topics +408 With respect to kinds of persons +409 Geographical & persons treatment +410 Linguistics +411 Writing systems +412 Etymology +413 Dictionaries +414 Phonology +415 Structural systems (Grammar) +416 Not assigned or no longer used +417 Dialectology & historical linguistics +418 Standard usage Applied linguistics +419 Verbal language not spoken or written +420 English & Old English +421 English writing system & phonology +422 English etymology +423 English dictionaries +424 Not assigned or no longer used +425 English grammar +426 Not assigned or no longer used +427 English language variations +428 Standard English usage +429 Old English (Anglo-Saxon) +430 Germanic languages German +431 German writing system & phonology +432 German etymology +433 German dictionaries +434 Not assigned or no longer used +435 German grammar +436 Not assigned or no longer used +437 German language variations +438 Standard German usage +439 Other Germanic languages +440 Romance languages French +441 French writing system & phonology +442 French etymology +443 French dictionaries +444 Not assigned or no longer used +445 French grammar +446 Not assigned or no longer used +447 French language variations +448 Standard French usage +449 Provencal & Catalan +450 Italian, Romanian, Rhaeto-Romantic +451 Italian writing system & phonology +452 Italian etymology +453 Italian dictionaries +454 Not assigned or no longer used +455 Italian grammar +456 Not assigned or no longer used +457 Italian language variations +458 Standard Italian usage +459 Romanian & Rhaeto-Romanic +460 Spanish & Portugese languages +461 Spanish writing system & phonology +462 Spanish etymology +463 Spanish dictionaries +464 Not assigned or no longer used +465 Spanish grammar +466 Not assigned or no longer used +467 Spanish language variations +468 Standard Spanish usage +469 Portugese +470 Italic Latin +471 Classical Latin writing & phonology +472 Classical Latin etymology & phonology +473 Classical Latin dictionaries +474 Not assigned or no longer used +475 Classical Latin grammar +476 Not assigned or no longer used +477 Old, Postclassical, Vulgar Latin +478 Classical Latin usage +479 Other Italic languages +480 Hellenic languages Classical Greek +481 Classical Greek writing & phonology +482 Classical Greek etymology +483 Classical Greek dictionaries +484 Not assigned or no longer used +485 Classical Greek grammar +486 Not assigned or no longer used +487 Preclassical & postclassical Greek +488 Classical Greek usage +489 Other Hellenic languages +490 Other languages +491 East Indo-European & Celtic languages +492 Afro-Asiatic languages Semitic +493 Non-Semitic Afro-Asiatic languages +494 Ural-Altaic, Paleosiberian, Dravidian +495 Languages of East & Southeast Asia +496 African languages +497 North American native languages +498 South American native languages +499 Miscellaneous languages +500 Natural sciences & mathematics +501 Philosophy & theory +502 Miscellany +503 Dictionaries & encyclopedias +504 Not assigned or no longer used +505 Serial publications +506 Organizations & management +507 Education, research, related topics +508 Natural history +509 Historical, areas, persons treatment +510 Mathematics +511 General principles +512 Algebra & number theory +513 Arithmetic +514 Topology +515 Analysis +516 Geometry +517 Not assigned or no longer used +518 Not assigned or no longer used +519 Probabilities & applied mathematics +520 Astronomy & allied sciences +521 Celestial mechanics +522 Techniques, equipment, materials +523 Specific celestial bodies & phenomena +524 Not assigned or no longer used +525 Earth (Astronomical geography) +526 Mathematical geography +527 Celestial navigation +528 Ephemerides +529 Chronology +530 Physics +531 Classical mechanics Solid mechanics +532 Fluid mechanics Liquid mechanics +533 Gas mechanics +534 Sound & related vibrations +535 Light & paraphotic phenomena +536 Heat +537 Electricity & electronics +538 Magnetism +539 Modern physics +540 Chemistry & allied sciences +541 Physical & theoretical chemistry +542 Techniques, equipment, materials +543 Analytical chemistry +544 Qualitative analysis +545 Quantitative analysis +546 Inorganic chemistry +547 Organic chemistry +548 Crystallography +549 Mineralogy +550 Earth sciences +551 Geology, hydrology, meteorology +552 Petrology +553 Economic geology +554 Earth sciences of Europe +555 Earth sciences of Asia +556 Earth sciences of Africa +557 Earth sciences of North America +558 Earth sciences of South America +559 Earth sciences of other areas +560 Paleontology Paleozoology +561 Paleobotany +562 Fossil invertebrates +563 Fossil primitive phyla +564 Fossil Mollusca & Molluscoidea +565 Other fossil invertebrates +566 Fossil Vertebrata (Fossil Craniata) +567 Fossil cold-blooded vertebrates +568 Fossil Aves (Fossil birds) +569 Fossil Mammalia +570 Life sciences +571 Not assigned or no longer used +572 Human races +573 Physical anthropology +574 Biology +575 Evolution & genetics +576 Microbiology +577 General nature of life +578 Microscopy in biology +579 Collection and preservation +580 Botanical sciences +581 Botany +582 Spermatophyta (Seed-bearing plants) +583 Dicotyledones +584 Monocotyledones +585 Gymnospermae (Pinophyta) +586 Cryptogamia (Seedless plants) +587 Pteridophyta (Vascular cryptograms) +588 Bryophyta +589 Thallobionta & Prokaryotae +590 Zoological sciences +591 Zoology +592 Invertebrates +593 Protozoa, Echinodermata, related phyla +594 Mollusca & Molluscoidea +595 Other invertebrates +596 Vertebrata (Craniata, Vertebrates) +597 Cold-blooded vertebrates Fishes +598 Aves (Birds) +599 Mammalia (Mammals) +600 Technology (Applied sciences) +601 Philosophy & theory +602 Miscellany +603 Dictionaries & encyclopedias +604 Special topics +605 Serial publications +606 Organizations +607 Education, research, related topics +608 Invention & patents +609 Historical, areas, persons treatment +610 Medical sciences Medicine +611 Human anatomy, cytology, histology +612 Human physiology +613 Promotion of health +614 Incidence & prevention of disease +615 Pharmacology & theraputics +616 Diseases +617 Surgery & related medical specialities +618 Gynecology & other medical specialities +619 Experimental medicine +620 Engineering & allied operations +621 Applied physics +622 Mining & related operations +623 Military & nautical engineering +624 Civil engineering +625 Engineering of railroads, roads +626 Not assigned or no longer used +627 Hydraulic engineering +628 Sanitary & municipal engineering +629 Other branches of engineering +630 Agriculture +631 Techniques, equipment, materials +632 Plant injuries, diseases, pests +633 Field & plantation crops +634 Orchards, fruits, forestry +635 Garden crops (Horticulture) +636 Animal husbandry +637 Processing dairy & related products +638 Insect culture +639 Hunting, fishing, conservation +640 Home economics & family living +641 Food & drink +642 Meals & table service +643 Housing & household equipment +644 Household utilities +645 Household furnishings +646 Sewing, clothing, personal living +647 Management of public households +648 Housekeeping +649 Child rearing & home care of sick +650 Management & auxiliary services +651 Office services +652 Processes of written communication +653 Shorthand +654 Not assigned or no longer used +655 Not assigned or no longer used +656 Not assigned or no longer used +657 Accounting +658 General management +659 Advertising & public relations +660 Chemical engineering +661 Industrial chemicals technology +662 Explosives, fuels technology +663 Beverage technology +664 Food technology +665 Industrial oils, fats, waxes, gases +666 Ceramic & allied technologies +667 Cleaning, color, related technologies +668 Technology of other organic products +669 Metallurgy +670 Manufacturing +671 Metalworking & metal products +672 Iron, steel, other iron alloys +673 Nonferrous metals +674 Lumber processing, wood products, cork +675 Leather & fur processing +676 Pulp & paper technology +677 Textiles +678 Elastomers & elastomer products +679 Other products of specific materials +680 Manufacture for specific uses +681 Precision instruments & other devices +682 Small forge work (Blacksmithing) +683 Hardware & household appliances +684 Furnishings & home workshops +685 Leather, fur, related products +686 Printing & related activities +687 Clothing +688 Other final products & packaging +689 Not assigned or no longer used +690 Buildings +691 Building materials +692 Auxiliary construction practices +693 Specific materials & purposes +694 Wood construction Carpentry +695 Roof covering +696 Utilities +697 Heating, ventilating, air-conditioning +698 Detail finishing +699 Not assigned or no longer used +700 The arts +701 Philosophy & theory +702 Miscellany +703 Dictionaries & encyclopedias +704 Special topics +705 Serial publications +706 Organizations & management +707 Education, research, related topics +708 Galleries, museums, private collections +709 Historical, areas, persons treatment +710 Civic & landscape art +711 Area planning (Civic art) +712 Landscape architecture +713 Landscape architecture of trafficways +714 Water features +715 Woody plants +716 Herbaceous plants +717 Structures +718 Landscape design of cemeteries +719 Natural landscapes +720 Architecture +721 Architectural structure +722 Architecture to ca. 300 +723 Architecture from ca. 300 to 1399 +724 Architecture from 1400 +725 Public structures +726 Buildings for religious purposes +727 Buildings for education & research +728 Residential & related buildings +729 Design & decoration +730 Plastic arts Sculpture +731 Processes, forms, subjects of sculpture +732 Sculpture to ca. 500 +733 Greek, Etruscan, Roman sculpture +734 Sculpture from ca. 500 to 1399 +735 Sculpture from 1400 +736 Carving & carvings +737 Numismatics & sigillography +738 Ceramic arts +739 Art metalwork +740 Drawing & decorative arts +741 Drawing & drawings +742 Perspective +743 Drawing & drawings by subject +744 Not assigned or no longer used +745 Decorative arts +746 Textile arts +747 Interior decoration +748 Glass +749 Furniture & accessories +750 Painting & paintings +751 Techniques, equipment, forms +752 Color +753 Symbolism, allegory, mythology, legend +754 Genre paintings +755 Religion & religious symbolism +756 Not assigned or no longer used +757 Human figures & their parts +758 Other subjects +759 Historical, areas, persons treatment +760 Graphic arts Printmaking & prints +761 Relief processes (Block printing) +762 Not assigned or no longer used +763 Lithographic (Planographic) processes +764 Chromolithography & serigraphy +765 Metal engraving +766 Mezzotinting & related processes +767 Etching & drypoint +768 Not assigned or no longer used +769 Prints +770 Photography & photographs +771 Techniques, equipment, materials +772 Metallic salt processes +773 Pigment processes of printing +774 Holography +775 Not assigned or no longer used +776 Not assigned or no longer used +777 Not assigned or no longer used +778 Fields & kinds of photography +779 Photographs +780 Music +781 General principles & musical forms +782 Vocal music +783 Music for single voices The voice +784 Instruments & Instrumental ensembles +785 Chamber music +786 Keyboard & other instruments +787 Stringed instruments (Chordophones) +788 Wind instruments (Aerophones) +789 Not assigned or no longer used +790 Recreational & performing arts +791 Public performances +792 Stage presentations +793 Indoor games & amusements +794 Indoor games of skill +795 Games of chance +796 Athletic & outdoor sports & games +797 Aquatic & air sports +798 Equestrian sports & animal racing +799 Fishing, hunting, shooting +800 Literature & rhetoric +801 Philosophy & theory +802 Miscellany +803 Dictionaries & encyclopedias +804 Not assigned or no longer used +805 Serial publications +806 Organizations +807 Education, research, related topics +808 Rhetoric & collections of literature +809 Literary history & criticism +810 American literature in English +811 Poetry +812 Drama +813 Fiction +814 Essays +815 Speeches +816 Letters +817 Satire & humor +818 Miscellaneous writings +819 Not assigned or no longer used +820 English & Old English literatures +821 English poetry +822 English drama +823 English fiction +824 English essays +825 English speeches +826 English letters +827 English satire & humor +828 English miscellaneous writings +829 Old English (Anglo-Saxon) +830 Literatures of Germanic languages +831 German poetry +832 German drama +833 German fiction +834 German essays +835 German speeches +836 German letters +837 German satire & humor +838 German miscellaneous writings +839 Other Germanic literatures +840 Literatures of Romance languages +841 French poetry +842 French drama +843 French fiction +844 French essays +845 French speeches +846 French letters +847 French satire & humor +848 French miscellaneous writings +849 Provencal & Catalan +850 Italian, Romanian, Rhaeto-Romanic +851 Italian poetry +852 Italian drama +853 Italian fiction +854 Italian essays +855 Italian speeches +856 Italian letters +857 Italian satire & humor +858 Italian miscellaneous writings +859 Romanian & Rhaeto-Romanic +860 Spanish & Portuguese literatures +861 Spanish poetry +862 Spanish drama +863 Spanish fiction +864 Spanish essays +865 Spanish speeches +866 Spanish letters +867 Spanish satire & humor +868 Spanish miscellaneous writings +869 Portuguese +870 Italic literatures Latin +871 Latin poetry +872 Latin dramatic poetry & drama +873 Latin epic poetry & fiction +874 Latin lyric poetry +875 Latin speeches +876 Latin letters +877 Latin satire & humor +878 Latin miscellaneous writings +879 Literatures of other Italic languages +880 Hellenic literatures Classical Greek +881 Classical Greek poetry +882 Classical Greek drama +883 Classical Greek epic poetry & fiction +884 Classical Greek lyric poetry +885 Classical Greek speeches +886 Classical Greek letters +887 Classical Greek satire & humor +888 Classical Greek miscellaneous writings +889 Modern Greek +890 Literatures of other languages +891 East Indo-European & Celtic +892 Afro-Asiatic literatures Semitic +893 Non-Semitic Afro-Asiatic literatures +894 Ural-Altaic, Paleosiberian, Dravidian +895 Literatures of East & Southeast Asia +896 African literatures +897 North American native literatures +898 South Anerican native literatures +899 Other literatures +900 Geography & history +901 Philosophy & theory +902 Miscellany +903 Dictionaries & encyclopedias +904 Collected accounts of events +905 Serial publications +906 Organizations & management +907 Education, research, related topics +908 With respect to kinds of persons +909 World history +910 Geography & travel +911 Historical geography +912 Graphic representations of earth +913 Ancient world +914 Europe +915 Asia +916 Africa +917 North America +918 South America +919 Other areas +920 Biography, genealogy, insignia +921 Not assigned or no longer used +922 Not assigned or no longer used +923 Not assigned or no longer used +924 Not assigned or no longer used +925 Not assigned or no longer used +926 Not assigned or no longer used +927 Not assigned or no longer used +928 Not assigned or no longer used +929 Genealogy, names, insignia +930 History of ancient world +931 History of ancient world China +932 History of ancient world Egypt +933 History of ancient world Palestine +934 History of ancient world India +935 History of ancient world Mesopotamia & Iranian Plateau +936 History of ancient world Europe north & west of Italy +937 History of ancient world Italy & adjacent territories +938 History of ancient world Greece +939 History of ancient world Other parts of ancient world +940 General history of Europe +941 General history of Europe British Isles +942 General history of Europe England & Wales +943 General history of Europe Central Europe Germany +944 General history of Europe France & Monaco +945 General history of Europe Italian Peninsula & adjacent islands +946 General history of Europe Iberian Peninsula & adjacent islands +947 General history of Europe Eastern Europe Soviet Union +948 General history of Europe Northern Europe Scandinavia +949 General history of Europe Other parts of Europe +950 General history of Asia Far East +951 General history of Asia China & adjacent areas +952 General history of Asia Japan +953 General history of Asia Arabian Peninsula & adjacent areas +954 General history of Asia South Asia India +955 General history of Asia Iran +956 General history of Asia Middle East (Near East) +957 General history of Asia Siberia (Asiatic Russia) +958 General history of Asia Central Asia +959 General history of Asia Southeast Asia +960 General history of Africa +961 General history of Africa Tunisia & Libya +962 General history of Africa Egypt & Sudan +963 General history of Africa Ethiopia +964 General history of Africa Morocco & Canary Islands +965 General history of Africa Algeria +966 General history of Africa West Africa & offshore islands +967 General history of Africa Central Africa & offshore islands +968 General history of Africa Southern Africa +969 General history of Africa South Indian Ocean islands +970 General history of North America +971 General history of North America Canada +972 General history of North America Middle America Mexico +973 General history of North America United States +974 General history of North America Northeastern United States +975 General history of North America Southeastern United States +976 General history of North America South central United States +977 General history of North America North central United States +978 General history of North America Western United States +979 General history of North America Great Basin & Pacific Slope +980 General history of South America +981 General history of South America Brazil +982 General history of South America Argentina +983 General history of South America Chile +984 General history of South America Bolivia +985 General history of South America Peru +986 General history of South America Colombia & Ecuador +987 General history of South America Venezuela +988 General history of South America Guiana +989 General history of South America Paraguay & Uruguay +990 General history of other areas +991 Not assigned or no longer used +992 Not assigned or no longer used +993 General history of other areas New Zealand +994 General history of other areas Australia +995 General history of other areas Melanesia New Guinea +996 General history of other areas Other parts of Pacific Polynesia +997 General history of other areas Atlantic Ocean islands +998 General history of other areas Arctic islands & Antarctica +999 Extraterrestrial worlds diff --git a/ldap/classification/to_ldap.sh b/ldap/classification/to_ldap.sh new file mode 100755 index 0000000..8099f52 --- /dev/null +++ b/ldap/classification/to_ldap.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +base="dc=bookshelf,dc=itix,dc=fr" + +echo "Extracting level 1..." +egrep '^[0-9]00 ' dewey.txt > dewey1.txt +echo "Extracting level 2..." +egrep '^[0-9][0-9]0 ' dewey.txt > dewey2.txt +echo "Extracting level 3..." +egrep '^[0-9][0-9][1-9] ' dewey.txt > dewey3.txt + +n=$(wc -l < dewey.txt) +n1=$(wc -l < dewey1.txt) +n2=$(wc -l < dewey2.txt) +n3=$(wc -l < dewey3.txt) + +sum=$(($n1 + $n2 + $n3)) + +echo "original: $n" +echo "dewey1/2/3: $n1/$n2/$n3" +echo "sum: $sum" + +echo "Generating LDAP, level 1..." + +sed -r "s/([0-9][0-9][0-9]) (.*)/dn: frItixCategoryId=\\1,$base\\ +frItixCategoryId: \\1\\ +frItixCategoryName: \\2\\ +objectClass: frItixCategory\\ +/" dewey1.txt > dewey1.ldif + + + +echo "Generating LDAP, level 2..." + +sed -r "s/(([0-9])[0-9][0-9]) (.*)/dn: frItixCategoryId=\\1,frItixCategoryId=\\200,$base\\ +frItixCategoryId: \\1\\ +frItixCategoryName: \\3\\ +objectClass: frItixCategory\\ +/" dewey2.txt > dewey2.ldif + + + +echo "Generating LDAP, level 3..." + +sed -r "s/((([0-9])[0-9])[0-9]) (.*)/dn: frItixCategoryId=\\1,frItixCategoryId=\\20,frItixCategoryId=\\300,$base\\ +frItixCategoryId: \\1\\ +frItixCategoryName: \\4\\ +objectClass: frItixCategory\\ +/" dewey3.txt > dewey3.ldif + diff --git a/ldap/schema/bookshelf.schema b/ldap/schema/bookshelf.schema new file mode 100755 index 0000000..86b846d --- /dev/null +++ b/ldap/schema/bookshelf.schema @@ -0,0 +1,114 @@ +attributeType ( 1.3.6.1.4.14000.1.1.6 NAME 'frItixId' + DESC 'An abstract type which represents an ID' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) + +attributeType ( 1.3.6.1.4.14000.1.1.1 NAME 'frItixNextLocalDocumentId' + DESC 'The next available localDocumentId in a bookshelf' + SUP frItixId + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.2 NAME 'frItixNextGlobalId' + DESC 'The next available globalId in a bookshelf' + SUP frItixId + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.3 NAME 'frItixGlobalId' + DESC 'A globalId identifies a document within a bookshelf' + SUP frItixId + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.4 NAME 'frItixTitle' + DESC 'The title of a document' + SUP name + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.5 NAME 'frItixAuthor' + DESC 'The author of a document' + SUP cn ) + +attributeType ( 1.3.6.1.4.14000.1.1.7 NAME 'frItixCollection' + DESC 'The name of the collection of the book' + SUP name + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.8 NAME 'frItixPublisherName' + DESC 'The name of the publisher of the book' + SUP name + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.9 NAME 'frItixPages' + DESC 'The number of pages in the book' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.10 NAME 'frItixEditionNumber' + DESC 'The edition number of the book (1st, 2nd, etc.)' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.11 NAME ( 'frItixISBN' 'frItixISBN10' ) + DESC 'The International Standard Book Number (10) of a book' + EQUALITY caseIgnoreMatch + ORDERING caseIgnoreOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{10} + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.12 NAME 'frItixISBN13' + DESC 'The International Standard Book Number (13) of a book' + EQUALITY caseIgnoreMatch + ORDERING caseIgnoreOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{13} + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.13 NAME 'frItixPublicationDate' + DESC 'The publication date of the book' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.14 NAME ( 'frItixCategoryId' ) + DESC 'The Dewey category number' + EQUALITY caseExactMatch + ORDERING caseExactOrderingMatch + SUBSTR caseExactSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE ) + +attributeType ( 1.3.6.1.4.14000.1.1.15 NAME ( 'frItixCategoryName' ) + DESC 'The Dewey category name' + EQUALITY caseIgnoreMatch + ORDERING caseIgnoreOrderingMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE ) + +objectClass ( 1.3.6.1.4.14000.1.3.1 NAME 'frItixBookshelf' + DESC 'A bookshelf' + SUP top + MUST ( frItixNextLocalDocumentId $ frItixNextGlobalId ) ) + +objectClass ( 1.3.6.1.4.14000.1.3.2 NAME 'frItixDocument' + DESC 'A document' + SUP top + ABSTRACT + MUST ( frItixGlobalId $ frItixTitle ) + MAY ( frItixAuthor $ organizationName ) ) + +objectClass ( 1.3.6.1.4.14000.1.3.3 NAME 'frItixBook' + DESC 'A book' + SUP frItixDocument + MAY ( frItixCollection $ frItixPublisherName $ frItixPublicationDate $ frItixPages $ frItixEditionNumber $ frItixISBN10 $ frItixISBN13 ) ) + + +objectClass ( 1.3.6.1.4.14000.1.3.4 NAME 'frItixCategory' + DESC 'A Dewey Category' + SUP top + MUST ( frItixCategoryId $ frItixCategoryName ) ) + diff --git a/ldap/slapd.conf b/ldap/slapd.conf new file mode 100755 index 0000000..07d1ca8 --- /dev/null +++ b/ldap/slapd.conf @@ -0,0 +1,16 @@ +include /etc/openldap/schema/core.schema +include /etc/openldap/schema/cosine.schema +include /etc/openldap/schema/inetorgperson.schema +include /etc/openldap/schema/bookshelf.schema + + +pidfile /var/run/openldap/slapd.pid +argsfile /var/run/openldap/slapd.args + +database bdb +suffix "dc=bookshelf,dc=itix,dc=fr" +rootdn "cn=Manager,dc=bookshelf,dc=itix,dc=fr" +rootpw secret +checkpoint 32 30 # +directory /var/lib/openldap-data +index objectClass eq