1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Release 4.2: Java</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> 10 <link rel="up" href="upgrade_4_2_toc.html" title="Chapter��39.��Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2" /> 11 <link rel="prev" href="upgrade_4_2_toc.html" title="Chapter��39.��Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2" /> 12 <link rel="next" href="upgrade_4_2_queue.html" title="Release 4.2: Queue access method" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Release 4.2: Java</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="upgrade_4_2_toc.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��39.��Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2</th> 23 <td width="20%" align="right">��<a accesskey="n" href="upgrade_4_2_queue.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="upgrade_4_2_java"></a>Release 4.2: Java</h2> 33 </div> 34 </div> 35 </div> 36 <p>There are a number of major changes to the Java support in Berkeley DB in this 37release. Despite that we have tried to make this a bridge release, a 38release where we don't require you to change anything. We've done this 39using the standard approach to deprecation in Java. If you do not 40compile with deprecation warnings on, your existing sources should work 41with this new release with only minor changes despite the large number 42of changes. Expect that in a future release we will remove all the 43deprecated API and only support the new API names.</p> 44 <p>This is a list of areas where we have broken compatibility with the 454.1 release. In most cases it is a name change in an interface class. 46</p> 47 <div class="itemizedlist"> 48 <ul type="disc"> 49 <li> 50 <span class="bold"> 51 <strong>DbAppDispatch.app_dispatch(DbEnv,Dbt,DbLsn,int)</strong> 52 </span> 53 <p>is now: 54<span class="bold"><strong>DbAppDispatch.appDispatch(DbEnv,Dbt,DbLsn,int)</strong></span></p> 55 </li> 56 <li> 57 <span class="bold"> 58 <strong>DbAppendRecno.db_append_recno(Db,Dbt,int)</strong> 59 </span> 60 <p>is now: 61<span class="bold"><strong>DbAppendRecno.dbAppendRecno(Db,Dbt,int)</strong></span></p> 62 </li> 63 <li> 64 <span class="bold"> 65 <strong>DbBtreeCompare.bt_compare(Db,Dbt,Dbt)</strong> 66 </span> 67 <p>is now: 68<span class="bold"><strong>DbBtreeCompare.compare(Db,Dbt,Dbt)</strong></span></p> 69 </li> 70 <li> 71 <span class="bold"> 72 <strong>DbBtreeCompare.dup_compare(Db,Dbt,Dbt)</strong> 73 </span> 74 <p>is now: 75<span class="bold"><strong>DbBtreeCompare.compareDuplicates(Db,Dbt,Dbt)</strong></span></p> 76 </li> 77 <li> 78 <span class="bold"> 79 <strong>DbBtreePrefix.bt_prefix(Db,Dbt,Dbt)</strong> 80 </span> 81 <p>is now: 82<span class="bold"><strong>DbBtreePrefix.prefix(Db,Dbt,Dbt)</strong></span></p> 83 </li> 84 <li> 85 <span class="bold"> 86 <strong>DbSecondaryKeyCreate.secondary_key_create(Db,Dbt,Dbt,Dbt)</strong> 87 </span> 88 <p>is now: 89<span class="bold"><strong>DbSecondaryKeyCreate.secondaryKeyCreate(Db,Dbt,Dbt,Dbt)</strong></span></p> 90 </li> 91 </ul> 92 </div> 93 <p>The 4.2 release of Berkeley DB requires at minimum a J2SE 1.3.1 certified Java 94virtual machine and associated classes to properly build and execute. 95To determine what version virtual machine you are running, enter:</p> 96 <pre class="programlisting">java -version</pre> 97 <p>at a command line and look for the version number. If you need to 98deploy to a version 1.1 or 1.0 Java environment, it may be possible to 99do so by not including the classes in the com.sleepycat.bdb package 100in the Java build process (however, that workaround has not been tested 101by us).</p> 102 <p>A few inconsistent methods have been cleaned up (for example, Db.close 103now returns void; previously, it returned an int which was always zero). 104The synchronized attributed has been toggled on some methods -- this is 105an attempt to prevent multithreaded applications from calling close or 106similar methods concurrently from multiple threads.</p> 107 <p>The Berkeley DB API has up until now been consistent across all language APIs. 108Although consistency has is benefits, it made our Java API look strange to 109Java programmers. Many methods have been renamed in this release of the 110Java API to conform with Java naming conventions. Sometimes this renaming 111was simply "camel casing", sometimes it required rewording. The mapping 112file for these name changes is in <code class="filename">dist/camel.pm</code>. The Perl script 113we use to convert code to the new names is called 114<code class="filename">dist/camelize.pl</code>, and may help with updating Java applications 115written for earlier versions of Berkeley DB.</p> 116 <p>Berkeley DB has a number of places where as a C library it uses function pointers 117to move into custom code for the purpose of notification of some event. In 118Java the best parallel is the registration of some class which implements 119an interface. In this version of Berkeley DB we have made an effort to make those 120interfaces more uniform and predictable. Specifically, DbEnvFeedback is now 121DbEnvFeedbackHandler, DbErrcall is DbErrorHandler and DbFeedback is 122DbFeedbackHandler. In every case we have kept the older interfaces and the 123older registration methods so as to allow for backward compatibility in this 124release. Expect them to be removed in future releases.</p> 125 <p>As you upgrade to this release of Berkeley DB you will notice that we have 126added an entirely new layer inside the package com.sleepycat.bdb. This 127was formerly the Greybird project by Mark Hayes. Sleepycat Software and 128Mark worked together to incorporate his work. We have done this in 129hopes of reducing the learning curve when using Berkeley DB in a Java project. 130When you upgrade you should consider switching to this layer as over 131time the historical classes and the new bdb package classes will be more 132and more integrated providing a simple yet powerful interface from Java 133into the Berkeley DB library.</p> 134 <p>Berkeley DB's Java API is now generated with <a class="ulink" href="http://www.swig.org" target="_top">SWIG</a>. 135The new Java API is significantly faster for many operations.</p> 136 <p>Some internal methods and constructors that were previously public have 137been hidden or removed.</p> 138 <p>Packages found under com.sleepycat are considered different APIs into 139the Berkeley DB system. These include the core db api (com.sleepycat.db), the 140collections style access layer (com.sleepycat.bdb) and the now relocated XA 141system (com.sleepycat.xa).</p> 142 </div> 143 <div class="navfooter"> 144 <hr /> 145 <table width="100%" summary="Navigation footer"> 146 <tr> 147 <td width="40%" align="left"><a accesskey="p" href="upgrade_4_2_toc.html">Prev</a>��</td> 148 <td width="20%" align="center"> 149 <a accesskey="u" href="upgrade_4_2_toc.html">Up</a> 150 </td> 151 <td width="40%" align="right">��<a accesskey="n" href="upgrade_4_2_queue.html">Next</a></td> 152 </tr> 153 <tr> 154 <td width="40%" align="left" valign="top">Chapter��39.��Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2��</td> 155 <td width="20%" align="center"> 156 <a accesskey="h" href="index.html">Home</a> 157 </td> 158 <td width="40%" align="right" valign="top">��Release 4.2: Queue access method</td> 159 </tr> 160 </table> 161 </div> 162 </body> 163</html> 164