directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1239581 [1/9] - in /directory/apacheds/trunk/jdbm2: ./ src/ src/etc/ src/examples/ src/main/ src/main/java/ src/main/java/jdbm/ src/main/java/jdbm/btree/ src/main/java/jdbm/helper/ src/main/java/jdbm/htree/ src/main/java/jdbm/recman/ src/s...
Date Thu, 02 Feb 2012 12:38:42 GMT
Author: elecharny
Date: Thu Feb  2 12:38:39 2012
New Revision: 1239581

URL: http://svn.apache.org/viewvc?rev=1239581&view=rev
Log:
Added the modified JDBM taken from Selcuk's branch into trunk

Added:
    directory/apacheds/trunk/jdbm2/   (with props)
    directory/apacheds/trunk/jdbm2/pom.xml
    directory/apacheds/trunk/jdbm2/src/
    directory/apacheds/trunk/jdbm2/src/build.xml
    directory/apacheds/trunk/jdbm2/src/etc/
    directory/apacheds/trunk/jdbm2/src/etc/MANIFEST.MF
    directory/apacheds/trunk/jdbm2/src/examples/
    directory/apacheds/trunk/jdbm2/src/examples/FamousPeople.java
    directory/apacheds/trunk/jdbm2/src/examples/FruitBasket.java
    directory/apacheds/trunk/jdbm2/src/examples/Primes.java
    directory/apacheds/trunk/jdbm2/src/main/
    directory/apacheds/trunk/jdbm2/src/main/java/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/ActionRecordManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerFactory.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerOptions.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerProvider.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/btree/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/btree/BPage.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/btree/BTree.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/btree/package.html
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ActionContext.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ActionVersioning.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ByteArrayComparator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ByteArraySerializer.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/CacheEvictionException.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/CachePolicy.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/CachePolicyListener.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/Conversion.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/DefaultSerializer.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/EntryIO.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ExplicitList.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/FastIterator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/IntegerComparator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/IntegerSerializer.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/IterationException.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/LRUCache.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/LongComparator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/LongSerializer.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/MRU.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/ObjectBAComparator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/Serialization.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/Serializer.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/SoftCache.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/StringComparator.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/Tuple.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/TupleBrowser.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/WrappedRuntimeException.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/helper/package.html
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/HTree.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/HashBucket.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/HashDirectory.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/HashNode.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/htree/package.html
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/package.html
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/BaseRecordManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/BlockIo.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/BlockView.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/CacheRecordManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/DataPage.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FileHeader.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FreeLogicalRowIdPage.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FreePhysicalRowId.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FreePhysicalRowIdPage.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/Location.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/LogicalRowIdManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/Magic.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/PageCursor.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/PageHeader.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/PageManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/PhysicalRowId.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/PhysicalRowIdManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/Provider.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/RecordCache.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/RecordFile.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/RecordHeader.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/SnapshotRecordManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/TransactionManager.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/TranslationPage.java
    directory/apacheds/trunk/jdbm2/src/main/java/jdbm/recman/package.html
    directory/apacheds/trunk/jdbm2/src/site/
    directory/apacheds/trunk/jdbm2/src/site/site.xml
    directory/apacheds/trunk/jdbm2/src/test/
    directory/apacheds/trunk/jdbm2/src/test/java/
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/btree/
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/btree/TestBTree.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/btree/TestBTreeBrowser.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/btree/TestSnapshotBTree.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/btree/TestStreamCorrupted.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/helper/
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/helper/TestActionVersioning.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/helper/TestVersionedCache.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/recman/
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/recman/BlockIoTest.java
    directory/apacheds/trunk/jdbm2/src/test/java/jdbm/recman/LocationTest.java
    directory/apacheds/trunk/jdbm2/src/test/resources/
    directory/apacheds/trunk/jdbm2/src/test/resources/log4j.properties

Propchange: directory/apacheds/trunk/jdbm2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb  2 12:38:39 2012
@@ -0,0 +1,11 @@
+.project
+.classpath
+.settings
+eclipse-classes
+*.log
+*.iml
+*.ipr
+dependency-reduced-pom.xml
+META-INF
+bin
+target

Added: directory/apacheds/trunk/jdbm2/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/pom.xml?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/pom.xml (added)
+++ directory/apacheds/trunk/jdbm2/pom.xml Thu Feb  2 12:38:39 2012
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>apacheds-parent</artifactId>
+    <version>2.0.0-M5-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>apacheds-jdbm2</artifactId>
+  <name>ApacheDS JDBM implementation</name>
+  <packaging>bundle</packaging>
+
+  <description>Specific JDBM Implementation</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.directory.junit</groupId>
+      <artifactId>junit-addons</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-i18n</artifactId>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <excludeSubProjects>false</excludeSubProjects>
+            <excludes>
+              <exclude>**/*</exclude>
+            </excludes>
+          </configuration>
+         </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+            <addMavenDescriptor>false</addMavenDescriptor>
+          </archive>
+        </configuration>
+      </plugin>
+    
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <inherited>true</inherited>
+        <extensions>true</extensions>
+        <configuration>
+          <manifestLocation>META-INF</manifestLocation>
+          <instructions>
+            <Bundle-SymbolicName>${project.groupId}.jdbm2</Bundle-SymbolicName>
+            <Export-Package>
+                {local-packages};version=${project.version};-noimport:=true
+            </Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: directory/apacheds/trunk/jdbm2/src/build.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/build.xml?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/build.xml (added)
+++ directory/apacheds/trunk/jdbm2/src/build.xml Thu Feb  2 12:38:39 2012
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="JDBM" default="all" basedir="..">
+
+  <target name="init">
+    <property name="project" value="jdbm" />
+    <property name="source" value="./src" />
+    <property name="main" value="${source}/main" />
+    <property name="etc" value="${source}/etc" />
+    <property name="build" value="build" />
+    <property name="classes" value="${build}/classes" />
+    <property name="test-classes" value="${build}/test-classes" />
+    <property name="dist" value="dist" />
+    <property name="lib" value="lib" />
+    <property name="doc" value="${source}/doc" />
+    <property name="schema" value="${source}/schema" />
+    <property name="test" value="${build}/test" />
+
+    <property name="classpath" value="${classpath}:${classes}" />
+    <property name="build.compiler" value="modern" />
+    <property name="deprecation" value="true" />
+    <property file="VERSION" />
+    <property name="version" value="unspecified" description="default value; should never happen"/>
+    <property name="archive" value="${project}-${version}" />
+  </target>
+
+
+  <!-- Display all the targets -->
+  <target name="targets">
+    <echo message=""/>
+    <echo message="ANT build for ${project} ${version}"/>
+    <echo message=""/>
+    <echo message="The following targets are available:"/>
+    <echo message="  targets  Lists the build targets"/>
+    <echo message="  clean    Cleans the build and distribution directories"/>
+    <echo message="  all      Cleans and builds all the packages and examples"/>
+    <echo message="  release  Cleans and builds all the release packages"/>
+    <echo message="           (JAR, source, doc, tarball) in the dist directory"/>
+    <echo message="  main     Builds the main packages (including debugging info)"/>
+    <echo message="  examples Builds the example packages (including debugging info)"/>
+    <echo message="  tests    Builds the test packages (including debugging info)"/>
+    <echo message="  tests.run Runs unit tests" />
+    <echo message="  jar      Builds the binary JAR in the dist directory"/>
+    <echo message="  doc      Builds the documentation"/>
+    <echo message="  api      Builds the API JavaDocs"/>
+    <echo message="  javadoc  Builds the full JavaDocs"/>
+    <echo message="  source   Builds the source tarball in the dist directory"/>
+    <echo message="  tarball  Builds the binary distribution in the dist directory"/>
+    <echo message="  cvs      Update the sources from the CVS"/>
+    <echo message=""/>
+  </target>
+
+
+  <!-- Prepare target directories -->
+  <target name="prepare" depends="init">
+    <mkdir dir="${build}"/>
+    <mkdir dir="${classes}"/>
+    <mkdir dir="${dist}"/>
+    <mkdir dir="${test}"/>
+  </target>
+
+  <!-- Kill all the directories created in prepare -->
+  <target name="clean" depends="init">
+    <delete dir="${test}"/>
+    <delete dir="${build}"/>
+    <delete dir="${dist}"/>
+  </target>
+
+
+  <!-- Build all the sources with debug and deprecation -->
+  <target name="main" depends="prepare">
+    <javac srcdir="${main}" destdir="${classes}" excludes="**/package.html"
+           classpath="${classpath}" debug="on" deprecation="${deprecation}" source="1.3" target="1.3"/>
+  </target>
+
+  <!-- Same as main, but also cleans and additional targets -->
+  <target name="all" depends="clean,main,examples,jar"/>
+
+  <!-- Run the unit tests -->
+  <target name="tests.run" depends="tests">
+        <!-- showoutput 'yes' to allow outputting debug msgs... -->
+        <junit fork="no" printsummary="yes" haltonfailure="no"
+         showoutput="yes">
+            <batchtest fork="no" todir="${test}">
+                <fileset dir="${test-classes}">
+                    <include name="**/Test*.class"/>
+                </fileset>
+            </batchtest>
+            <formatter type="xml" />
+            <classpath>
+                <pathelement path="${classes}" />
+                <pathelement path="${test-classes}" />
+            </classpath>     
+        </junit>
+
+        <junitreport todir="${build}/test">
+            <fileset dir="${build}/test">
+                <include name="TEST-*.xml" />
+            </fileset>
+            <report todir="${build}/test" />
+        </junitreport>
+   </target>
+
+  <!-- Build the example packages -->
+  <target name="examples" depends="main">
+    <mkdir dir="${build}/examples" />
+    <javac srcdir="${source}/examples" destdir="${build}/examples"
+           classpath="${classpath}" debug="on" deprecation="${deprecation}" />
+  </target>
+
+  <!-- Build the test packages -->
+  <target name="tests" depends="main">
+    <mkdir dir="${test-classes}" />
+    <javac srcdir="${source}/tests" destdir="${test-classes}"
+           classpath="${classpath}" debug="on" deprecation="${deprecation}" />
+  </target>
+
+  <!-- Build the JAR file using main -->
+  <target name="jar" depends="main">
+    <delete   file="${dist}/${archive}.jar" />
+
+    <copy file="${etc}/MANIFEST.MF" tofile="${classes}/MANIFEST.MF" />
+    <replace  file="${classes}/MANIFEST.MF" token="$$VERSION$$" value="${version}" />
+    <copy todir="${classes}">
+        <fileset dir="." includes="LICENSE.txt,CHANGES.txt,README.txt" />
+    </copy>
+
+    <jar      jarfile="${dist}/${archive}.jar" basedir="${classes}"
+              manifest="${classes}/MANIFEST.MF" includes="LICENSE.txt,README.txt,CHANGES.txt,jdbm/**" />
+  </target>
+
+
+  <!-- Build the full JavaDocs -->
+  <target name="javadoc" depends="prepare">
+    <mkdir    dir="${build}/doc" />
+    <mkdir    dir="${build}/doc/javadoc" />
+    <property name="copyright"
+              value="Cees de Groot (C) 2000-2001. All rights reserved  http://jdbm.sourceforge.net" />
+    <javadoc  sourcepath="${main}" destdir="${build}/doc/javadoc"
+              doctitle="JDBM JavaDoc" windowtitle="JDBM JavaDoc" bottom="${copyright}"
+              package="true" author="true" version="true" noindex="true"
+              packagenames="jdbm.*">
+        <link href="http://java.sun.com/products/jdk/1.2/docs/api"/>
+        <link href="http://www.junit.org/junit/javadoc/3.8"/>
+    </javadoc>
+  </target>
+
+  <!-- Build the API JavaDocs -->
+  <target name="api" depends="prepare">
+    <mkdir    dir="${build}/doc" />
+    <mkdir    dir="${build}/doc/api" />
+    <property name="copyright"
+              value="Cees de Groot (C) 2000. All rights reserved  http://jdbm.sourceforge.net" />
+    <javadoc  sourcepath="${main}" destdir="${build}/doc/api"
+              doctitle="JDBM JavaDoc" windowtitle="JDBM JavaDoc" bottom="${copyright}"
+              public="true" author="true"
+              packagenames="jdbm.*">
+        <link href="http://java.sun.com/products/jdk/1.2/docs/api"/>
+    </javadoc>
+  </target>
+
+  <!-- Build the docs, API and full JavaDocs, doc archives -->
+  <!-- Note CdG: Removed doc dependency, we don't have it yet... -->
+  <target name="docs" depends="api,javadoc">
+    <zip    zipfile="${dist}/${archive}-doc.zip" basedir="${build}" includes="doc/**" />
+    <tar    tarfile="${dist}/${archive}-doc.tar" basedir="${build}" includes="doc/**" />
+    <gzip   src="${dist}/${archive}-doc.tar" zipfile="${dist}/${archive}-doc.tgz" />
+    <delete file="${dist}/${archive}-doc.tar" />
+  </target>
+
+
+  <!-- Build the source distribution -->
+  <target name="source" depends="prepare">
+    <delete  file="${dist}/${archive}-src.tgz" />
+    <delete  file="${dist}/${archive}-src.zip" />
+    <delete dir="${build}/${archive}" />
+
+    <mkdir   dir="${build}/${archive}" />
+    <mkdir   dir="${build}/${archive}/src" />
+    <copy    todir="${build}/${archive}/src">
+      <fileset dir="${source}"/>
+    </copy>
+    <mkdir   dir="${build}/${archive}/lib" />
+    <copy    todir="${build}/${archive}/lib">
+      <fileset dir="${lib}"/>
+    </copy>
+    <copy    todir="${build}/${archive}">
+      <fileset dir="${source}" includes="*.sh,*.bat"/>
+    </copy>
+
+    <tar     includes="${archive}/**" basedir="${build}"
+             tarfile="${dist}/${archive}-src.tar" />
+    <gzip    src="${dist}/${archive}-src.tar" zipfile="${dist}/${archive}-src.tgz"/>
+    <delete  file="${dist}/${archive}-src.tar" />
+    <zip     zipfile="${dist}/${archive}-src.zip" basedir="${build}"
+             includes="${archive}/**" />
+
+  </target>
+
+
+  <!-- Build a full release including JAR, zip/tarball, source and documentation -->
+  <target name="release" depends="clean,jar,source,docs,tarball">
+  </target>
+
+  <!-- Build the tarball including JAR and all dependent packages -->
+  <target name="tarball" depends="prepare,jar,docs">
+    <delete  file="${dist}/${archive}.tgz" />
+    <delete  file="${dist}/${archive}.zip" />
+    <delete  dir="${build}/${archive}" />
+
+    <mkdir   dir="${build}/${archive}" />
+    <copy    todir="${build}/${archive}">
+        <fileset dir="." includes="README.txt,LICENSE.txt,CHANGES.txt" />
+    </copy>
+    <copy    todir="${build}/${archive}/lib">
+        <fileset dir="${dist}" includes="${archive}.jar" />
+    </copy>
+    <copy    todir="${build}/${archive}/doc">
+        <fileset dir="${build}/doc/api" includes="**"/>
+    </copy>
+
+    <copy    todir="${build}/${archive}">
+        <fileset dir="${source}" includes="examples/**"/>
+    </copy>
+
+    <tar     tarfile="${dist}/${archive}.tar" basedir="${build}"
+             includes="${archive}/**" excludes="${archive}/*.tar,${archive}/*.zip" />
+    <gzip    src="${dist}/${archive}.tar" zipfile="${dist}/${archive}.tgz" />
+    <delete  file="${dist}/${archive}.tar" />
+
+    <zip     zipfile="${dist}/${archive}.zip" basedir="${build}" 
+             includes="${archive}/**" excludes="${archive}/*.tar,${archive}/*.tgz" />
+  </target>
+
+
+  <!-- Update the sources from the CVS -->
+  <target name="cvs" depends="clean">
+    <cvs cvsRoot=":pserver:anoncvs@cvs.jdbm.sourceforge.net:/cvs/${project}"
+         dest="." package="${project}" />
+  </target>
+
+
+</project>
+

Added: directory/apacheds/trunk/jdbm2/src/etc/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/etc/MANIFEST.MF?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/etc/MANIFEST.MF (added)
+++ directory/apacheds/trunk/jdbm2/src/etc/MANIFEST.MF Thu Feb  2 12:38:39 2012
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Specification-Title: JDBM
+Specification-Vendor: JDBM at SourceForge Project
+Specification-Version: 0.09
+Implementation-Title: JDBM
+Implementation-Vendor: JDBM at SourceForge Project
+Implementation-Version: $VERSION$
+

Added: directory/apacheds/trunk/jdbm2/src/examples/FamousPeople.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/examples/FamousPeople.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/examples/FamousPeople.java (added)
+++ directory/apacheds/trunk/jdbm2/src/examples/FamousPeople.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,155 @@
+import java.util.Properties;
+import jdbm.RecordManager;
+import jdbm.RecordManagerFactory;
+
+import jdbm.helper.Tuple;
+import jdbm.helper.TupleBrowser;
+import jdbm.helper.StringComparator;
+
+import jdbm.btree.BTree;
+
+/**
+ * Famous People example.
+ * <p>
+ * Demonstrates the use of B+Tree data structure to manage a list of
+ * people and their occupation.  The example covers insertion,
+ * ordered traversal, reverse traversal and range lookup of records.
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ */
+public class FamousPeople {
+
+    static String DATABASE = "people";
+    static String BTREE_NAME = "FamousPeople";
+
+    static String[] people =
+        { "Greenspan, Alan",
+          "Williams-Byrd, Julie",
+          "Picasso, Pablo",
+          "Stallman, Richard",
+          "Fort, Paul",
+          "S�ndergaard, Ole",
+          "Schwarzenegger, Arnold",
+          "Dulkinys, Susanna" };
+
+    static String[] occupations =
+        { "Federal Reserve Board Chairman",
+          "Engineer",
+          "Painter",
+          "Programmer",
+          "Poet",
+          "Typographer",
+          "Actor",
+          "Designer" };
+
+    static String PREFIX = "S";
+
+    /**
+     * Example main entrypoint.
+     */
+    public static void main( String[] args ) {
+        RecordManager recman;
+        long          recid;
+        Tuple         tuple = new Tuple();
+        TupleBrowser  browser;
+        BTree         tree;
+        Properties    props;
+
+        props = new Properties();
+
+        try {
+            // open database and setup an object cache
+            recman = RecordManagerFactory.createRecordManager( DATABASE, props );
+
+            // try to reload an existing B+Tree
+            recid = recman.getNamedObject( BTREE_NAME );
+            if ( recid != 0 ) {
+                tree = BTree.load( recman, recid );
+                System.out.println( "Reloaded existing BTree with " + tree.size()
+                                    + " famous people." );
+            } else {
+                // create a new B+Tree data structure and use a StringComparator
+                // to order the records based on people's name.
+                tree = BTree.createInstance( recman, new StringComparator() );
+                recman.setNamedObject( BTREE_NAME, tree.getRecid() );
+                System.out.println( "Created a new empty BTree" );
+            }
+
+            // insert people with their respective occupation
+            System.out.println();
+            for ( int i=0; i<people.length; i++ ) {
+                System.out.println( "Insert: " + people[i] );
+                tree.insert( people[ i ], occupations[ i ], false );
+            }
+
+            // make the data persistent in the database
+            recman.commit();
+
+            // show list of people with their occupation
+            System.out.println();
+            System.out.println( "Person                   Occupation       " );
+            System.out.println( "------------------       ------------------" );
+
+            // traverse people in order
+            browser = tree.browse();
+            while ( browser.getNext( tuple ) ) {
+                print( tuple );
+            }
+
+            // traverse people in reverse order
+            System.out.println();
+            System.out.println( "Reverse order:" );
+            browser = tree.browse( null ); // position browser at end of the list
+
+            while ( browser.getPrevious( tuple ) ) {
+                print( tuple );
+            }
+
+
+
+            // display people whose name start with PREFIX range
+            System.out.println();
+            System.out.println( "All people whose name start with '" + PREFIX + "':" );
+
+            browser = tree.browse( PREFIX );
+            while ( browser.getNext( tuple ) ) {
+                String key = (String) tuple.getKey();
+                if ( key.startsWith( PREFIX ) ) {
+                    print( tuple );
+                } else {
+                    break;
+                }
+            }
+
+        } catch ( Exception except ) {
+            except.printStackTrace();
+        }
+    }
+
+
+    /**
+     * Print a Tuple containing a ( Person, Occupation ) pair.
+     */
+    static void print( Tuple tuple ) {
+        String person = (String) tuple.getKey();
+        String occupation = (String) tuple.getValue();
+        System.out.println( pad( person, 25) + occupation );
+    }
+
+
+    /**
+     * Pad a string with spaces on the right.
+     *
+     * @param str String to add spaces
+     * @param width Width of string after padding
+     */
+    static String pad( String str, int width ) {
+        StringBuffer buf = new StringBuffer( str );
+        int space = width-buf.length();
+        while ( space-- > 0 ) {
+            buf.append( ' ' );
+        }
+        return buf.toString();
+    }
+
+}

Added: directory/apacheds/trunk/jdbm2/src/examples/FruitBasket.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/examples/FruitBasket.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/examples/FruitBasket.java (added)
+++ directory/apacheds/trunk/jdbm2/src/examples/FruitBasket.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,120 @@
+import jdbm.RecordManager;
+import jdbm.RecordManagerFactory;
+import jdbm.helper.FastIterator;
+import jdbm.htree.HTree;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Sample JDBM application to demonstrate the use of basic JDBM operations.
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ */
+public class FruitBasket
+{
+    RecordManager  recman;
+    HTree          hashtable;
+    FastIterator   iter;
+    String         fruit;
+    String         color;
+
+
+    public FruitBasket()
+        throws IOException
+    {
+        // create or open fruits record manager
+        Properties props = new Properties();
+        recman = RecordManagerFactory.createRecordManager( "fruits", props );
+
+        // create or load fruit basket (hashtable of fruits)
+        long recid = recman.getNamedObject( "basket" );
+        if ( recid != 0 ) {
+            System.out.println( "Reloading existing fruit basket..." );
+            hashtable = HTree.load( recman, recid );
+            showBasket();
+        } else {
+            System.out.println( "Creating new fruit basket..." );
+            hashtable = HTree.createInstance( recman );
+            recman.setNamedObject( "basket", hashtable.getRecid() );
+        }
+    }
+
+
+    public void runDemo()
+        throws IOException
+    {
+        // insert keys and values
+        System.out.println();
+        System.out.println( "Adding fruits to the basket..." );
+        hashtable.put( "bananas", "yellow" );
+        hashtable.put( "strawberries", "red" );
+        hashtable.put( "kiwis", "green" );
+
+        showBasket();
+
+
+        // display color of a specific fruit
+        System.out.println();
+        System.out.println( "Get the color of bananas..." );
+        String bananasColor = (String) hashtable.get( "bananas" );
+        System.out.println( "bananas are " + bananasColor );
+        
+        recman.commit();
+        
+        try {
+            // Thread.sleep( 10 * 1000 );
+        } catch ( Exception except ) {
+            // ignore
+        }
+
+        // remove a specific fruit from hashtable
+        System.out.println();
+        System.out.print( "Removing bananas from the basket..." );
+        hashtable.remove( "bananas" );
+        recman.commit();
+        System.out.println( " done." );
+
+        // iterate over remaining objects
+        System.out.println();
+        System.out.println( "Remaining fruit colors:" );
+        iter = hashtable.keys();
+        fruit = (String) iter.next();
+        while ( fruit != null ) {
+            color = (String) hashtable.get( fruit );
+            System.out.println( fruit + " are " + color );
+            fruit = (String) iter.next();
+        }
+        
+        // cleanup
+        recman.close();
+    }
+
+
+    public void showBasket() 
+        throws IOException
+    {
+        // Display content of fruit basket
+        System.out.println();
+        System.out.print( "Fruit basket contains: " );
+        iter = hashtable.keys();
+        fruit = (String) iter.next();
+        while ( fruit != null ) {
+            System.out.print( " " + fruit );
+            fruit = (String) iter.next();
+        }
+        System.out.println();
+    }
+    
+    
+    public static void main( String[] args )
+    {
+        try {
+            FruitBasket basket = new FruitBasket();
+            basket.runDemo();
+        } catch ( IOException ioe ) {
+            ioe.printStackTrace();
+        }
+    }
+
+}

Added: directory/apacheds/trunk/jdbm2/src/examples/Primes.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/examples/Primes.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/examples/Primes.java (added)
+++ directory/apacheds/trunk/jdbm2/src/examples/Primes.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,275 @@
+import jdbm.RecordManager;
+import jdbm.RecordManagerFactory;
+import jdbm.RecordManagerOptions;
+
+import jdbm.btree.BTree;
+
+import jdbm.helper.LongComparator;
+import jdbm.helper.Tuple;
+import jdbm.helper.TupleBrowser;
+
+import java.util.Properties;
+import java.util.Random;
+import java.io.IOException;
+
+/**
+ * Example program dealing with B+Trees and Prime numbers.
+ */
+public class Primes
+{
+
+    /**
+     * Default number of prime number to populate in the database (if not specified on command-line)
+     */
+    public static int DEFAULT_POPULATE = 100;
+
+
+    /**
+     * Default number of random lookups (if not specified on command-line)
+     */
+    public static int DEFAULT_LOOKUPS = 100;
+
+    
+    /**
+     * Record Manager used for persistence.
+     */
+    private RecordManager _recman;
+
+    
+    /**
+     * B+Tree holding prime numbers.
+     */
+    private BTree _primes;
+    
+    
+    /**
+     * Random number generator.
+     */
+    private static Random  _random = new Random();
+
+
+    /**
+     * Main constructor
+     */
+    public Primes( String[] args ) 
+        throws IOException 
+    {
+        long        recid;
+        Properties  props;
+        
+        // open database and setup an object cache
+        props = new Properties();
+        props.put( RecordManagerOptions.CACHE_SIZE, "10000" );
+        _recman = RecordManagerFactory.createRecordManager( "primes", props );
+
+        recid = _recman.getNamedObject( "primes" );
+        if ( recid == 0 ) {
+            System.out.println( "Creating a new primes B+Tree." );
+            _primes = BTree.createInstance( _recman, new LongComparator() );
+            _recman.setNamedObject( "primes", _primes.getRecid() );
+        } else {
+            _primes = BTree.load( _recman, recid );
+            System.out.println( "B+Tree already contains " + _primes.size() + " primes." );
+        }
+        _recman.commit();
+    }
+
+    
+    /**
+     * Get the largest prime number in the database.
+     */
+    public Long getLargestPrime()
+        throws IOException
+     {
+        Tuple         tuple;
+        TupleBrowser  browser;
+        Long          largest = null;
+
+        tuple = new Tuple();
+        browser = _primes.browse( null );
+        if ( browser.getPrevious( tuple ) ) {
+            largest = (Long) tuple.getValue();
+            System.out.println( "Largest prime: " + largest );
+        } else {
+            System.out.println( "No prime number in the database." );
+        }
+        return largest;
+    }
+
+    
+    /**
+     * Populate the database with more prime numbers.
+     *
+     * @param count Number of primes to add to database.
+     */
+    void populate( int count ) 
+        throws IOException 
+    {
+        Long current;
+        Long largest;
+
+        System.out.println( "Populating prime B+Tree..." );
+        
+        // start after the largest known prime
+        largest = getLargestPrime();
+        if ( largest == null ) {
+            largest = new Long( 0 );
+        }
+
+        current = new Long( largest.longValue() + 1L ); 
+        while ( count > 0 ) {
+            if ( isPrime( current ) ) {
+                _primes.insert( current, current, false );
+                System.out.println( "Found prime #" + _primes.size() + ": " + current );
+                count--;
+            }
+            current = new Long( current.longValue() + 1 );
+        }
+        _recman.commit();
+    }
+
+    
+    /**
+     * Returns true if a number is prime.
+     */
+    boolean isPrime( Long number )
+        throws IOException
+    {
+        Tuple         tuple;
+        TupleBrowser  browser;
+        Long          largest;
+        Long          current;
+
+        if ( number.longValue() <= 0L ) {
+            throw new IllegalArgumentException( "Number must be greater than zero" );
+        }
+        if ( number.longValue() == 1 ) {
+            return true;
+        }
+        tuple = new Tuple();
+        browser = _primes.browse();
+        while ( browser.getNext( tuple ) ) {
+            current = (Long) tuple.getValue();
+            if ( current.longValue() != 1 && ( number.longValue() % current.longValue() ) == 0 ) {
+                // not a prime because it is divisibe by a prime
+                return false;
+            }
+        }           
+        // this is a prime
+        return true;
+    }
+
+        
+    /**
+     * Display a number of random prime numbers.
+     */
+    void random( int count ) 
+        throws IOException
+    {
+        Tuple         tuple;
+        TupleBrowser  browser;
+        Long          largest;
+        Long          number;
+
+        tuple = new Tuple();
+        largest = getLargestPrime();
+
+        System.out.println( "Looking up " + count + " random primes...." );
+        long start = System.currentTimeMillis();
+        for ( int i=0; i<count; i++ ) {
+            number = new Long( random( 0, largest.longValue() ) );
+            browser = _primes.browse( number );
+            if ( browser.getNext( tuple ) ) {
+                number = (Long) tuple.getValue();
+                System.out.print( number );
+                System.out.print( ", " );
+            }
+        }
+        long stop = System.currentTimeMillis();
+        System.out.println();
+        System.out.println( "Time: " + (stop-start)/count + " millis/lookup " );
+    }
+
+
+    /**
+     * Return true if number is a prime.
+     */
+    public static boolean isPrimeCompute( long number )
+    {
+        for ( int i=2; i<number/2; i++ ) {
+            if ( ( number % i ) == 0 ) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * Get random number between "low" and "high" (inclusively)
+     */
+    public static long random( long low, long high )
+    {
+        return ( (long) ( _random.nextDouble() * (high-low) ) + low );
+    }
+
+
+    /**
+     * Static program entrypoint.
+     */
+    public static void main( String[] args )
+    {
+        Primes  primes;
+        int     count;
+        Long    number;
+        Long    largest;
+            
+        try {
+            primes = new Primes( args );
+            
+            for ( int i=0; i<args.length; i++ ) {
+                if ( args[i].equalsIgnoreCase( "-populate" ) ) {
+                    if ( ++i < args.length ) {
+                        count = Integer.parseInt( args[i] );
+                    } else {
+                        count = DEFAULT_POPULATE;
+                    }
+                    primes.populate( count );
+                } else if ( args[i].equalsIgnoreCase( "-check" ) ) {
+                    if ( ++i < args.length ) {
+                        number = new Long( Long.parseLong( args[i] ) );
+                    } else {
+                        number = new Long( _random.nextLong() );
+                    }
+                    largest = primes.getLargestPrime();
+                    if ( number.longValue() > primes.getLargestPrime().longValue() ) {
+                        throw new IllegalArgumentException( "Number is larger than largest known prime in database." );
+                    }
+                    if ( primes.isPrime( number ) ) {
+                        System.out.println( "The number " + number + " is a prime." );
+                    } else {
+                        System.out.println( "The number " + number + " is not a prime." );
+                    }
+                } else if ( args[i].equalsIgnoreCase( "-random" ) ) {
+                    if ( ++i < args.length ) {
+                        count = Integer.parseInt( args[i] );
+                    } else {
+                        count = DEFAULT_LOOKUPS;
+                    }
+                    primes.random( count );
+                }
+            }
+            if ( args.length == 0 ) {
+                System.out.println( "Usage:   java Prime [action] [args]" );
+                System.out.println( "" );
+                System.out.println( "Actions:" );
+                System.out.println( "           -populate [number]   Populate database with prime numbers" );
+                System.out.println( "           -check [number]      Check if a number is a prime" );
+                System.out.println( "           -random [number]     Display random prime numbers" );
+                System.out.println( "" );
+            }
+        } catch ( IOException except ) {
+            except.printStackTrace();
+        }
+    }
+}

Added: directory/apacheds/trunk/jdbm2/src/main/java/jdbm/ActionRecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/main/java/jdbm/ActionRecordManager.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/main/java/jdbm/ActionRecordManager.java (added)
+++ directory/apacheds/trunk/jdbm2/src/main/java/jdbm/ActionRecordManager.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,82 @@
+/*
+ *  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 jdbm;
+
+import jdbm.helper.ActionContext;
+
+/**
+ * Extends the RecordManager to allow callers to group their RecordManager interface
+ * calls into actions. Actions operate in isolation. 
+ * 
+ * Each thread has a current action context associated with it. Threads can switch
+ * between different action context using set/unsetActionContext calls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ActionRecordManager extends RecordManager
+{
+    /**
+     * Initializes the context for the action. Implicity sets the
+     * context as the current action.
+     *
+     * @param readOnly true if action does not do any modification
+     * @param whoStarted caller can use this for debugging
+     * @return The created action context
+     */
+    ActionContext beginAction( boolean readOnly, String whoStarted );
+    
+    
+    /**
+     * Ends the action associated with the context. 
+     * ReadWrite actions' changes are made visible
+     * to readers.
+     *
+     * @param context identifies the action to end
+     */
+    void endAction( ActionContext context );
+    
+    
+    /**
+     * Aborts the given action. For write actions, actions's changes
+     * should not be made visible to readers.
+     *
+     * @param context identifies the action to abort
+     */
+    void abortAction( ActionContext context );
+    
+    
+    /**
+     * Set the context as the current action context for
+     * the given thread
+     *
+     * @param context identifies the context
+     */
+    public void setCurrentActionContext( ActionContext context );
+    
+    
+    /**
+     * Unsets the context as the current action context. 
+     * Given context should be current action context for the 
+     * calling thread.
+     *
+     * @param context identifies the context.
+     */
+    public void unsetCurrentActionContext( ActionContext context );
+}

Added: directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManager.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManager.java (added)
+++ directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManager.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,193 @@
+/**
+ * JDBM LICENSE v1.00
+ *
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ *    statements and notices.  Redistributions must also contain a
+ *    copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ *    above copyright notice, this list of conditions and the
+ *    following disclaimer in the documentation and/or other
+ *    materials provided with the distribution.
+ *
+ * 3. The name "JDBM" must not be used to endorse or promote
+ *    products derived from this Software without prior written
+ *    permission of Cees de Groot.  For written permission,
+ *    please contact cg@cdegroot.com.
+ *
+ * 4. Products derived from this Software may not be called "JDBM"
+ *    nor may "JDBM" appear in their names without prior written
+ *    permission of Cees de Groot.
+ *
+ * 5. Due credit should be given to the JDBM Project
+ *    (http://jdbm.sourceforge.net/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE JDBM PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * CEES DE GROOT OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 2000 (C) Cees de Groot. All Rights Reserved.
+ * Copyright 2000-2001 (C) Alex Boisvert. All Rights Reserved.
+ * Contributions are Copyright (C) 2000 by their associated contributors.
+ *
+ * $Id: RecordManager.java,v 1.3 2005/06/25 23:12:31 doomdark Exp $
+ */
+package jdbm;
+
+
+import java.io.IOException;
+import jdbm.helper.Serializer;
+
+
+/**
+ * An interface to manages records, which are uninterpreted blobs of data.
+ * <p>
+ * The set of record operations is simple: fetch, insert, update and delete.
+ * Each record is identified using a "rowid" and contains a byte[] data block.
+ * Rowids are returned on inserts and you can store them someplace safe
+ * to be able to get  back to them.  Data blocks can be as long as you wish,
+ * and may have lengths different from the original when updating.
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ * @author <a href="cg@cdegroot.com">Cees de Groot</a>
+ */
+public interface RecordManager
+{
+    /** Reserved slot for name directory. */
+    int NAME_DIRECTORY_ROOT = 0;
+
+
+    /** 
+     * Inserts a new record using standard java object serialization.
+     *
+     * @param obj the object for the new record.
+     * @return the rowid for the new record.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    long insert( Object obj ) throws IOException;
+
+    
+    /**
+     * Inserts a new record using a custom serializer.
+     *
+     * @param obj the object for the new record.
+     * @param serializer a custom serializer
+     * @return the rowid for the new record.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    long insert( Object obj, Serializer serializer ) throws IOException;
+
+
+    /**
+     * Deletes a record.
+     *
+     * @param recid the rowid for the record that should be deleted.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    void delete( long recid ) throws IOException;
+
+
+    /**
+     * Updates a record using standard java object serialization.
+     *
+     * @param recid the recid for the record that is to be updated.
+     * @param obj the new object for the record.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    void update( long recid, Object obj ) throws IOException;
+
+
+    /**
+     * Updates a record using a custom serializer.
+     *
+     * @param recid the recid for the record that is to be updated.
+     * @param obj the new object for the record.
+     * @param serializer a custom serializer
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    void update( long recid, Object obj, Serializer serializer ) throws IOException;
+
+    
+    /**
+     * Fetches a record using standard java object serialization.
+     *
+     * @param recid the recid for the record that must be fetched.
+     * @return the object contained in the record.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    Object fetch( long recid ) throws IOException;
+
+
+    /**
+     * Fetches a record using a custom serializer.
+     *
+     * @param recid the recid for the record that must be fetched.
+     * @param serializer a custom serializer
+     * @return the object contained in the record.
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    Object fetch( long recid, Serializer serializer ) throws IOException;
+
+
+    /**
+     * Closes the record manager.
+     *
+     * @throws IOException when one of the underlying I/O operations fails.
+     */
+    void close() throws IOException;
+
+
+    /**
+     * Returns the number of slots available for "root" rowids. These slots
+     * can be used to store special rowids, like rowids that point to
+     * other rowids. Root rowids are useful for bootstrapping access to
+     * a set of data.
+     */
+    int getRootCount();
+
+
+    /**
+     * Returns the indicated root rowid.
+     *
+     * @see #getRootCount
+     */
+    long getRoot( int id ) throws IOException;
+
+
+    /**
+     * Sets the indicated root rowid.
+     *
+     * @see #getRootCount
+     */
+    void setRoot( int id, long rowid ) throws IOException;
+
+
+    /** Commit (make persistent) all changes since beginning of transaction. */
+    void commit() throws IOException;
+
+
+    /** Rollback (cancel) all changes since beginning of transaction. */
+    void rollback() throws IOException;
+
+
+    /** Obtain the record id of a named object. Returns 0 if named object doesn't exist. */
+    long getNamedObject( String name ) throws IOException;
+
+
+    /** Set the record id of a named object. */
+    void setNamedObject( String name, long recid ) throws IOException;
+}
+

Added: directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerFactory.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerFactory.java (added)
+++ directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerFactory.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,115 @@
+/**
+ * JDBM LICENSE v1.00
+ *
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ *    statements and notices.  Redistributions must also contain a
+ *    copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ *    above copyright notice, this list of conditions and the
+ *    following disclaimer in the documentation and/or other
+ *    materials provided with the distribution.
+ *
+ * 3. The name "JDBM" must not be used to endorse or promote
+ *    products derived from this Software without prior written
+ *    permission of Cees de Groot.  For written permission,
+ *    please contact cg@cdegroot.com.
+ *
+ * 4. Products derived from this Software may not be called "JDBM"
+ *    nor may "JDBM" appear in their names without prior written
+ *    permission of Cees de Groot.
+ *
+ * 5. Due credit should be given to the JDBM Project
+ *    (http://jdbm.sourceforge.net/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE JDBM PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * CEES DE GROOT OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 2000 (C) Cees de Groot. All Rights Reserved.
+ * Copyright 2000-2001 (C) Alex Boisvert. All Rights Reserved.
+ * Contributions are Copyright (C) 2000 by their associated contributors.
+ *
+ * $Id: RecordManagerFactory.java,v 1.2 2005/06/25 23:12:31 doomdark Exp $
+ */
+package jdbm;
+
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.directory.server.i18n.I18n;
+
+
+/**
+ * This is the factory class to use for instantiating {@link RecordManager}
+ * instances.
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ * @author <a href="cg@cdegroot.com">Cees de Groot</a>
+ */
+public final class RecordManagerFactory
+{
+
+    /**
+     * Create a record manager.
+     *
+     * @param name Name of the record file.
+     * @throws IOException if an I/O related exception occurs while creating
+     *                    or opening the record manager.
+     * @throws UnsupportedOperationException if some options are not supported by the
+     *                                      implementation.
+     * @throws IllegalArgumentException if some options are invalid.
+     */
+    public static RecordManager createRecordManager( String name ) throws IOException
+    {
+        return createRecordManager( name, new Properties() );
+    }
+
+
+    /**
+     * Create a record manager.
+     *
+     * @param name Name of the record file.
+     * @param options Record manager options.
+     * @throws IOException if an I/O related exception occurs while creating
+     *                    or opening the record manager.
+     * @throws UnsupportedOperationException if some options are not supported by the
+     *                                      implementation.
+     * @throws IllegalArgumentException if some options are invalid.
+     */
+    public static RecordManager createRecordManager( String name, Properties options ) throws IOException
+    {
+        String                 provider;
+        Class<?>               clazz;
+        RecordManagerProvider  factory;
+
+        provider = options.getProperty( RecordManagerOptions.PROVIDER_FACTORY, "jdbm.recman.Provider" );
+
+        try 
+        {
+            clazz = Thread.currentThread().getContextClassLoader().loadClass( provider );
+            factory = ( RecordManagerProvider ) clazz.newInstance();
+        } 
+        catch ( Exception except ) 
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_567, provider, except.getClass().getName(),
+                except.getLocalizedMessage() ) );
+        }
+        
+        return factory.createRecordManager( name, options );
+    }
+}

Added: directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerOptions.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerOptions.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerOptions.java (added)
+++ directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerOptions.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,118 @@
+/**
+ * JDBM LICENSE v1.00
+ *
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ *    statements and notices.  Redistributions must also contain a
+ *    copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ *    above copyright notice, this list of conditions and the
+ *    following disclaimer in the documentation and/or other
+ *    materials provided with the distribution.
+ *
+ * 3. The name "JDBM" must not be used to endorse or promote
+ *    products derived from this Software without prior written
+ *    permission of Cees de Groot.  For written permission,
+ *    please contact cg@cdegroot.com.
+ *
+ * 4. Products derived from this Software may not be called "JDBM"
+ *    nor may "JDBM" appear in their names without prior written
+ *    permission of Cees de Groot.
+ *
+ * 5. Due credit should be given to the JDBM Project
+ *    (http://jdbm.sourceforge.net/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE JDBM PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * CEES DE GROOT OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 2000 (C) Cees de Groot. All Rights Reserved.
+ * Copyright 2000-2001 (C) Alex Boisvert. All Rights Reserved.
+ * Contributions are Copyright (C) 2000 by their associated contributors.
+ *
+ * $Id: RecordManagerOptions.java,v 1.1 2002/05/31 06:33:20 boisvert Exp $
+ */
+package jdbm;
+
+
+/**
+ * Standard options for RecordManager.
+ * Final reference -> class shouldn't be extended
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ * @author <a href="cg@cdegroot.com">Cees de Groot</a>
+ */
+public final class RecordManagerOptions
+{
+    /**
+     *  Ensures no construction of this class, also ensures there is no need for final keyword above
+     *  (Implicit super constructor is not visible for default constructor),
+     *  but is still self documenting.
+     */
+    private RecordManagerOptions()
+    {
+    }
+
+    /** Option to create a thread-safe record manager. */
+    public final static String PROVIDER_FACTORY = "jdbm.provider";
+
+
+    /** Option to create a thread-safe record manager. */
+    public final static String THREAD_SAFE = "jdbm.threadSafe";
+
+
+    /** Option to automatically commit data after each operation. */
+    public final static String AUTO_COMMIT = "jdbm.autoCommit";
+
+
+    /**
+     * Option to disable transaction (to increase performance at the cost of
+     * potential data loss).
+     */
+    public final static String DISABLE_TRANSACTIONS = "jdbm.disableTransactions";
+
+
+    /** Cache type. */
+    public final static String CACHE_TYPE = "jdbm.cache.type";
+
+
+    /** Cache size (when applicable) */
+    public final static String CACHE_SIZE = "jdbm.cache.size";
+
+
+    /** Use normal (strong) object references for the record cache. */
+    public final static String NORMAL_CACHE = "normal";
+
+
+    /**
+     * Use soft references {$link java.lang.ref.SoftReference} for the record
+     * cache instead of the default normal object references.
+     * <p>
+     * Soft references are cleared at the discretion of the garbage collector
+     * in response to memory demand.
+     */
+    public final static String SOFT_REF_CACHE = "soft";
+
+
+    /**
+     * Use weak references {$link java.lang.ref.WeakReference} for the record
+     * cache instead of the default normal object references.
+     * <p>
+     * Weak references do not prevent their referents from being made
+     * finalizable, finalized, and then reclaimed.
+     */
+    public final static String WEAK_REF_CACHE = "weak";
+}

Added: directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerProvider.java?rev=1239581&view=auto
==============================================================================
--- directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerProvider.java (added)
+++ directory/apacheds/trunk/jdbm2/src/main/java/jdbm/RecordManagerProvider.java Thu Feb  2 12:38:39 2012
@@ -0,0 +1,76 @@
+/**
+ * JDBM LICENSE v1.00
+ *
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ *    statements and notices.  Redistributions must also contain a
+ *    copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ *    above copyright notice, this list of conditions and the
+ *    following disclaimer in the documentation and/or other
+ *    materials provided with the distribution.
+ *
+ * 3. The name "JDBM" must not be used to endorse or promote
+ *    products derived from this Software without prior written
+ *    permission of Cees de Groot.  For written permission,
+ *    please contact cg@cdegroot.com.
+ *
+ * 4. Products derived from this Software may not be called "JDBM"
+ *    nor may "JDBM" appear in their names without prior written
+ *    permission of Cees de Groot.
+ *
+ * 5. Due credit should be given to the JDBM Project
+ *    (http://jdbm.sourceforge.net/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE JDBM PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * CEES DE GROOT OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 2000 (C) Cees de Groot. All Rights Reserved.
+ * Copyright 2000-2001 (C) Alex Boisvert. All Rights Reserved.
+ * Contributions are Copyright (C) 2000 by their associated contributors.
+ *
+ * $Id: RecordManagerProvider.java,v 1.2 2005/06/25 23:12:31 doomdark Exp $
+ */
+package jdbm;
+
+
+import java.io.IOException;
+import java.util.Properties;
+
+
+/**
+ * Provider of RecordManager implementation.  Classes implementing this
+ * interface act as a factory to provide implementations of RecordManager.
+ *
+ * @author <a href="mailto:boisvert@intalio.com">Alex Boisvert</a>
+ */
+public interface RecordManagerProvider
+{
+
+    /**
+     * Create a record manager.
+     *
+     * @param filename Base filename of the record file.
+     * @param options Record manager options.
+     * @throws IOException if an I/O related exception occurs while creating
+     *                    or opening the record manager.
+     * @throws UnsupportedOperationException if some options are not supported by the
+     *                                      implementation.
+     * @throws IllegalArgumentException if some options are invalid.
+     */
+    RecordManager createRecordManager( String filename, Properties options ) throws IOException;
+}



Mime
View raw message