/
area/
classes/net/sourceforge/pain/logic/
classes/net/sourceforge/pain/logic/event/
classes/net/sourceforge/pain/logic/fn/util/
classes/net/sourceforge/pain/network/console/
classes/net/sourceforge/pain/plugin/
classes/net/sourceforge/pain/plugin/reset/
classes/net/sourceforge/pain/plugin/shutdown/
classes/net/sourceforge/pain/plugin/social/
classest/net/sourceforge/pain/db/data/
doc/
doc/paindb/resources/
src/net/sourceforge/pain/logic/
src/net/sourceforge/pain/logic/event/
src/net/sourceforge/pain/logic/fn/util/
src/net/sourceforge/pain/network/console/
src/net/sourceforge/pain/network/console/telnet/
src/net/sourceforge/pain/plugin/
src/net/sourceforge/pain/plugin/command/
src/net/sourceforge/pain/plugin/reset/
src/net/sourceforge/pain/plugin/shutdown/
src/net/sourceforge/pain/plugin/social/
src/net/sourceforge/pain/util/
tests/
tests/net/sourceforge/pain/db/data/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2) on Sun Oct 19 20:56:57 NOVST 2003 -->
<TITLE>
PainDB
</TITLE>

<META NAME="keywords" CONTENT="net.sourceforge.pain.db.PainDB class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="PainDB";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbType.html" title="class in net.sourceforge.pain.db"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="PainDB.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.sourceforge.pain.db</FONT>
<BR>
Class PainDB</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>net.sourceforge.pain.db.PainDB</B>
</PRE>
<HR>
<DL>
<DT>public final class <B>PainDB</B><DT>extends java.lang.Object</DL>

<P>
PAiN Db is a not thread safe semi-object oriented main memory and very buggy database.<br>
 It's used by <a href="http://pain.sf.net">PAiN Mud Codebase</a> as persistence engine.<br>
 However, PAiN DB is  <b>general purpose database</b>,  it has great performance,<br>
 it's simple, opensource and could be used in any java based opensource projects.<br>
 <i>Distributed under the GPL licence</i>
<P>

<P>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#ALLOW_PLAIN_WRITE">ALLOW_PLAIN_WRITE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;allows use setters outside from transactions ->  could not be rolled back (performance issue)
 but if database will be closed before flush, this changes will be lost</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#DB_VERSION">DB_VERSION</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#MANUAL_FLUSH_MODE">MANUAL_FLUSH_MODE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MANUAL_FLUSH mode is a kind of delayed commit, user should manually call flush (outside of transaction)
 to flush all data to disk, if MANUAL_FLUSH_MODE is false every time T1(upper level) transaction
 commited PainDB will automatically call flush method.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#PainDB(java.lang.String)">PainDB</A></B>(java.lang.String&nbsp;fileName)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Opens specified database file.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#backupTo(java.lang.String, boolean)">backupTo</A></B>(java.lang.String&nbsp;backupFileName,
         boolean&nbsp;withFlush)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates database backup file<br>
 <code>withFlush</code> should be <code>false</code> if this method is called inside of<br>
 transaction (database image created with last flush will be used)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#beginTransaction()">beginTransaction</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;starts the database transaction.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#close()">close</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closes database.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#commitTransaction()">commitTransaction</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;commits the database transaction.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#execute(net.sourceforge.pain.db.DbTransaction)">execute</A></B>(<A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db">DbTransaction</A>&nbsp;trans)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;same as execute(trans, null);</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#execute(net.sourceforge.pain.db.DbTransaction, java.lang.Object[])">execute</A></B>(<A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db">DbTransaction</A>&nbsp;trans,
        java.lang.Object[]&nbsp;params)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Executes transaction.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#exportToXml(java.lang.String)">exportToXml</A></B>(java.lang.String&nbsp;fileName)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exports all database data to XML file.<br>
 encodes with BASE64 binary fields values<br>
 keeps objects identities</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#finalize()">finalize</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#flush()">flush</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flushes all changes done after previous flush to disk
 Called automatically after each upper level transaction commit if
 MANUAL_FLUSH_MODE is false</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#forceClose()">forceClose</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;forces database to close.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbClass.html" title="interface in net.sourceforge.pain.db">DbClass</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getClass(java.lang.Object)">getClass</A></B>(java.lang.Object&nbsp;classId)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbClass.html" title="interface in net.sourceforge.pain.db">DbClass</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getDbClass(java.lang.Class)">getDbClass</A></B>(java.lang.Class&nbsp;javaClazz)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getDbFileName()">getDbFileName</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getDBFileSize()">getDBFileSize</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getNumberOfObjectsInDb()">getNumberOfObjectsInDb</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getObject(java.lang.Object)">getObject</A></B>(java.lang.Object&nbsp;objectId)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#getRoot()">getRoot</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root is a simple mark on object, It's allowed to do not have root in DB.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sourceforge/pain/db/PainDB.html" title="class in net.sourceforge.pain.db">PainDB</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#importFromXml(java.lang.String, java.lang.String)">importFromXml</A></B>(java.lang.String&nbsp;xmlFileName,
              java.lang.String&nbsp;resultDbFileName)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates new database instance, fills it with data from given XML file.<br>
 all objects keeps identity.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#isClosed()">isClosed</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#isDatabaseEmpty()">isDatabaseEmpty</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#rollbackTransaction()">rollbackTransaction</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/pain/db/PainDB.html#setRoot(net.sourceforge.pain.db.DbObject)">setRoot</A></B>(<A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A>&nbsp;obj)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root is a simple mark on object, db could have not root at all, any time user can null this mark</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="DB_VERSION"><!-- --></A><H3>
DB_VERSION</H3>
<PRE>
public static final java.lang.String <B>DB_VERSION</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.pain.db.PainDB.DB_VERSION">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="ALLOW_PLAIN_WRITE"><!-- --></A><H3>
ALLOW_PLAIN_WRITE</H3>
<PRE>
public boolean <B>ALLOW_PLAIN_WRITE</B></PRE>
<DL>
<DD>allows use setters outside from transactions ->  could not be rolled back (performance issue)
 but if database will be closed before flush, this changes will be lost
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="MANUAL_FLUSH_MODE"><!-- --></A><H3>
MANUAL_FLUSH_MODE</H3>
<PRE>
public boolean <B>MANUAL_FLUSH_MODE</B></PRE>
<DL>
<DD>MANUAL_FLUSH mode is a kind of delayed commit, user should manually call flush (outside of transaction)
 to flush all data to disk, if MANUAL_FLUSH_MODE is false every time T1(upper level) transaction
 commited PainDB will automatically call flush method.
 'plain writes' always should be flushed manually
<P>
<DL>
</DL>
</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="PainDB(java.lang.String)"><!-- --></A><H3>
PainDB</H3>
<PRE>
public <B>PainDB</B>(java.lang.String&nbsp;fileName)
       throws java.lang.Exception</PRE>
<DL>
<DD>Opens specified database file. Creates if file do not exists.
<P>
<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - - name of database file
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE> - - if file is corrupted or is not paindb database file</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="flush()"><!-- --></A><H3>
flush</H3>
<PRE>
public void <B>flush</B>()
           throws java.io.IOException</PRE>
<DL>
<DD>flushes all changes done after previous flush to disk
 Called automatically after each upper level transaction commit if
 MANUAL_FLUSH_MODE is false
<P>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if any IO error occurs.
<DD><CODE>java.lang.RuntimeException</CODE> - if there is active transaction</DL>
</DD>
</DL>
<HR>

<A NAME="getClass(java.lang.Object)"><!-- --></A><H3>
getClass</H3>
<PRE>
public <A HREF="../../../../net/sourceforge/pain/db/DbClass.html" title="interface in net.sourceforge.pain.db">DbClass</A> <B>getClass</B>(java.lang.Object&nbsp;classId)</PRE>
<DL>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>classId</CODE> - - OID of the DbClass
<DT><B>Returns:</B><DD>DbClass instance or null if no DbClass with specified classId found</DL>
</DD>
</DL>
<HR>

<A NAME="getObject(java.lang.Object)"><!-- --></A><H3>
getObject</H3>
<PRE>
public <A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A> <B>getObject</B>(java.lang.Object&nbsp;objectId)</PRE>
<DL>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>objectId</CODE> - - serialized unique object id
<DT><B>Returns:</B><DD>DbObject for specified objectId or null if no object found</DL>
</DD>
</DL>
<HR>

<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()</PRE>
<DL>
<DD>closes database. All database objects are DETACHED after this method call
 flushes all changes if MANUAL_FLUSH_MODE = true;
 Database should not have active transaction during this method call
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getDbClass(java.lang.Class)"><!-- --></A><H3>
getDbClass</H3>
<PRE>
public <A HREF="../../../../net/sourceforge/pain/db/DbClass.html" title="interface in net.sourceforge.pain.db">DbClass</A> <B>getDbClass</B>(java.lang.Class&nbsp;javaClazz)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getRoot()"><!-- --></A><H3>
getRoot</H3>
<PRE>
public <A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A> <B>getRoot</B>()</PRE>
<DL>
<DD>root is a simple mark on object, It's allowed to do not have root in DB.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>database root object</DL>
</DD>
</DL>
<HR>

<A NAME="setRoot(net.sourceforge.pain.db.DbObject)"><!-- --></A><H3>
setRoot</H3>
<PRE>
public void <B>setRoot</B>(<A HREF="../../../../net/sourceforge/pain/db/DbObject.html" title="class in net.sourceforge.pain.db">DbObject</A>&nbsp;obj)</PRE>
<DL>
<DD>root is a simple mark on object, db could have not root at all, any time user can null this mark
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getDBFileSize()"><!-- --></A><H3>
getDBFileSize</H3>
<PRE>
public long <B>getDBFileSize</B>()
                   throws java.io.IOException</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>database file size
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if any IO error occured during this method call</DL>
</DD>
</DL>
<HR>

<A NAME="isDatabaseEmpty()"><!-- --></A><H3>
isDatabaseEmpty</H3>
<PRE>
public boolean <B>isDatabaseEmpty</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>true for just created database or for database without objects created</DL>
</DD>
</DL>
<HR>

<A NAME="getNumberOfObjectsInDb()"><!-- --></A><H3>
getNumberOfObjectsInDb</H3>
<PRE>
public int <B>getNumberOfObjectsInDb</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>number of all objects, including classes.</DL>
</DD>
</DL>
<HR>

<A NAME="finalize()"><!-- --></A><H3>
finalize</H3>
<PRE>
protected void <B>finalize</B>()</PRE>
<DL>
<DD><B>Description copied from class: <CODE>java.lang.Object</CODE></B></DD>
<DD>Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.
 A subclass overrides the <code>finalize</code> method to dispose of
 system resources or to perform other cleanup. 
 <p>
 The general contract of <tt>finalize</tt> is that it is invoked 
 if and when the Java<font size="-2"><sup>TM</sup></font> virtual 
 machine has determined that there is no longer any
 means by which this object can be accessed by any thread that has
 not yet died, except as a result of an action taken by the
 finalization of some other object or class which is ready to be
 finalized. The <tt>finalize</tt> method may take any action, including
 making this object available again to other threads; the usual purpose
 of <tt>finalize</tt>, however, is to perform cleanup actions before 
 the object is irrevocably discarded. For example, the finalize method 
 for an object that represents an input/output connection might perform
 explicit I/O transactions to break the connection before the object is
 permanently discarded. 
 <p>
 The <tt>finalize</tt> method of class <tt>Object</tt> performs no 
 special action; it simply returns normally. Subclasses of 
 <tt>Object</tt> may override this definition.
 <p>
 The Java programming language does not guarantee which thread will 
 invoke the <tt>finalize</tt> method for any given object. It is 
 guaranteed, however, that the thread that invokes finalize will not 
 be holding any user-visible synchronization locks when finalize is 
 invoked. If an uncaught exception is thrown by the finalize method, 
 the exception is ignored and finalization of that object terminates.
 <p>
 After the <tt>finalize</tt> method has been invoked for an object, no 
 further action is taken until the Java virtual machine has again 
 determined that there is no longer any means by which this object can 
 be accessed by any thread that has not yet died, including possible
 actions by other objects or classes which are ready to be finalized, 
 at which point the object may be discarded.
 <p>
 The <tt>finalize</tt> method is never invoked more than once by a Java
 virtual machine for any given object.
 <p>
 Any exception thrown by the <code>finalize</code> method causes 
 the finalization of this object to be halted, but is otherwise 
 ignored.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="beginTransaction()"><!-- --></A><H3>
beginTransaction</H3>
<PRE>
public void <B>beginTransaction</B>()</PRE>
<DL>
<DD>starts the database transaction.
 Recurrent calls of this method without commit will create subtransactions.
 Its recommended to use <A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db"><CODE>DbTransaction</CODE></A> wrapper class and do not call
 this method manually
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="commitTransaction()"><!-- --></A><H3>
commitTransaction</H3>
<PRE>
public void <B>commitTransaction</B>()
                       throws java.io.IOException</PRE>
<DL>
<DD>commits the database transaction.
 Its recommended to use <A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db"><CODE>DbTransaction</CODE></A> wrapper class and do not call
 this method manually
 This method will automatically flush all changes to disk if
 there no upperlevel transaction and MANUAL_FLUSH_MODE was not set
<P>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if any IO problem occurs during flush</DL>
</DD>
</DL>
<HR>

<A NAME="rollbackTransaction()"><!-- --></A><H3>
rollbackTransaction</H3>
<PRE>
public void <B>rollbackTransaction</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="execute(net.sourceforge.pain.db.DbTransaction)"><!-- --></A><H3>
execute</H3>
<PRE>
public java.lang.Object <B>execute</B>(<A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db">DbTransaction</A>&nbsp;trans)
                         throws java.lang.Exception</PRE>
<DL>
<DD>same as execute(trans, null);
<P>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="execute(net.sourceforge.pain.db.DbTransaction, java.lang.Object[])"><!-- --></A><H3>
execute</H3>
<PRE>
public java.lang.Object <B>execute</B>(<A HREF="../../../../net/sourceforge/pain/db/DbTransaction.html" title="interface in net.sourceforge.pain.db">DbTransaction</A>&nbsp;trans,
                                java.lang.Object[]&nbsp;params)
                         throws java.lang.Exception</PRE>
<DL>
<DD>Executes transaction.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>params</CODE> - passed to DbTransaction.execute() method
<DT><B>Returns:</B><DD>result of the DbTransaction execute method}
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE> - if it was thrown in DbTransaction.execute method or if
 write error on flush occurs</DL>
</DD>
</DL>
<HR>

<A NAME="getDbFileName()"><!-- --></A><H3>
getDbFileName</H3>
<PRE>
public java.lang.String <B>getDbFileName</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>database file name</DL>
</DD>
</DL>
<HR>

<A NAME="isClosed()"><!-- --></A><H3>
isClosed</H3>
<PRE>
public boolean <B>isClosed</B>()</PRE>
<DL>
<DD><DL>

<DT><B>Returns:</B><DD>true if database was closed</DL>
</DD>
</DL>
<HR>

<A NAME="forceClose()"><!-- --></A><H3>
forceClose</H3>
<PRE>
public void <B>forceClose</B>()</PRE>
<DL>
<DD>forces database to close. All active transactions will be rolled back
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="backupTo(java.lang.String, boolean)"><!-- --></A><H3>
backupTo</H3>
<PRE>
public void <B>backupTo</B>(java.lang.String&nbsp;backupFileName,
                     boolean&nbsp;withFlush)
              throws java.io.IOException</PRE>
<DL>
<DD>Creates database backup file<br>
 <code>withFlush</code> should be <code>false</code> if this method is called inside of<br>
 transaction (database image created with last flush will be used)
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>backupFileName</CODE> - file name for backup<DD><CODE>withFlush</CODE> - - if true database flush precede to backup
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="exportToXml(java.lang.String)"><!-- --></A><H3>
exportToXml</H3>
<PRE>
public void <B>exportToXml</B>(java.lang.String&nbsp;fileName)
                 throws java.io.IOException</PRE>
<DL>
<DD>Exports all database data to XML file.<br>
 encodes with BASE64 binary fields values<br>
 keeps objects identities
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - = XML file name to export
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="importFromXml(java.lang.String, java.lang.String)"><!-- --></A><H3>
importFromXml</H3>
<PRE>
public static <A HREF="../../../../net/sourceforge/pain/db/PainDB.html" title="class in net.sourceforge.pain.db">PainDB</A> <B>importFromXml</B>(java.lang.String&nbsp;xmlFileName,
                                   java.lang.String&nbsp;resultDbFileName)
                            throws java.lang.Exception</PRE>
<DL>
<DD>Creates new database instance, fills it with data from given XML file.<br>
 all objects keeps identity.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>xmlFileName</CODE> - - XML file with database image to import<DD><CODE>resultDbFileName</CODE> - - name if result database file.
<DT><B>Returns:</B><DD>new database instance
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sourceforge/pain/db/DbType.html" title="class in net.sourceforge.pain.db"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="PainDB.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>