<!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.6.0_0) on Wed Dec 30 04:50:33 EST 2009 --> <TITLE> DatabaseNamer </TITLE> <META NAME="date" CONTENT="2009-12-30"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DatabaseNamer"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= 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=2 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="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/persist/DatabaseNamer.html" target="_top"><B>FRAMES</B></A> <A HREF="DatabaseNamer.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <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"> com.sleepycat.persist</FONT> <BR> Interface DatabaseNamer</H2> <HR> <DL> <DT><PRE>public interface <B>DatabaseNamer</B></DL> </PRE> <P> Determines the file names to use for primary and secondary databases. <p>Each <A HREF="../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><CODE>PrimaryIndex</CODE></A> and <A HREF="../../../com/sleepycat/persist/SecondaryIndex.html" title="class in com.sleepycat.persist"><CODE>SecondaryIndex</CODE></A> is represented internally as a Berkeley DB <A HREF="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A>. The file names of primary and secondary indices must be unique within the environment, so that each index is stored in a separate database file.</p> <p>By default, the file names of primary and secondary databases are defined as follows.</p> <p>The syntax of a primary index database file name is:</p> <pre> STORE_NAME-ENTITY_CLASS</pre> <p>Where STORE_NAME is the name parameter passed to <A HREF="../../../com/sleepycat/persist/EntityStore.html#EntityStore(com.sleepycat.db.Environment, java.lang.String, com.sleepycat.persist.StoreConfig)"><CODE>EntityStore</CODE></A> and ENTITY_CLASS is name of the class passed to <A HREF="../../../com/sleepycat/persist/EntityStore.html#getPrimaryIndex(java.lang.Class, java.lang.Class)"><CODE>getPrimaryIndex</CODE></A>.</p> <p>The syntax of a secondary index database file name is:</p> <pre> STORE_NAME-ENTITY_CLASS-KEY_NAME</pre> <p>Where KEY_NAME is the secondary key name passed to <A HREF="../../../com/sleepycat/persist/EntityStore.html#getSecondaryIndex(com.sleepycat.persist.PrimaryIndex, java.lang.Class, java.lang.String)"><CODE>getSecondaryIndex</CODE></A>.</p> <p>The default naming described above is implemented by the built-in <A HREF="../../../com/sleepycat/persist/DatabaseNamer.html#DEFAULT"><CODE>DEFAULT</CODE></A> object. An application may supply a custom <A HREF="../../../com/sleepycat/persist/DatabaseNamer.html" title="interface in com.sleepycat.persist"><CODE>DatabaseNamer</CODE></A> to overrride the default naming scheme. For example, a custom namer could place all database files in a subdirectory with the name of the store. A custom namer could also be used to name files according to specific file system restrictions.</p> <p>The custom namer object must be an instance of the <code>DatabaseNamer</code> interface and is configured using <A HREF="../../../com/sleepycat/persist/StoreConfig.html#setDatabaseNamer(com.sleepycat.persist.DatabaseNamer)"><CODE>setDatabaseNamer</CODE></A>.</p> <p>When copying or removing all databases in a store, there is one further consideration. There are two internal databases that must be kept with the other databases in the store in order for the store to be used. These contain the data formats and sequences for the store. Their entity class names are:</p> <pre> com.sleepycat.persist.formats</pre> <pre> com.sleepycat.persist.sequences</pre> <p>With default database naming, databases with the following names will be present each store.</p> <pre> STORE_NAME-com.sleepycat.persist.formats</pre> <pre> STORE_NAME-com.sleepycat.persist.sequences</pre> <p>These databases must normally be included with copies of other databases in the store. They should not be modified by the application.</p> <P> <P> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../com/sleepycat/persist/DatabaseNamer.html" title="interface in com.sleepycat.persist">DatabaseNamer</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/persist/DatabaseNamer.html#DEFAULT">DEFAULT</A></B></CODE> <BR> The default database namer.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/persist/DatabaseNamer.html#getFileName(java.lang.String, java.lang.String, java.lang.String)">getFileName</A></B>(java.lang.String storeName, java.lang.String entityClassName, java.lang.String keyName)</CODE> <BR> Returns the name of the file to be used to store the dataabase for the given store, entity class and key.</TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="DEFAULT"><!-- --></A><H3> DEFAULT</H3> <PRE> static final <A HREF="../../../com/sleepycat/persist/DatabaseNamer.html" title="interface in com.sleepycat.persist">DatabaseNamer</A> <B>DEFAULT</B></PRE> <DL> <DD>The default database namer. <p>The <A HREF="../../../com/sleepycat/persist/DatabaseNamer.html#getFileName(java.lang.String, java.lang.String, java.lang.String)"><CODE>getFileName</CODE></A> method of this namer returns the <code>storeName</code>, <code>entityClassName</code> and <code>keyName</code> parameters as follows:<p> <pre class="code"> if (keyName != null) { return storeName + '-' + entityClassName + '-' + keyName; } else { return storeName + '-' + entityClassName; }</pre> <P> <DL> </DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getFileName(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3> getFileName</H3> <PRE> java.lang.String <B>getFileName</B>(java.lang.String storeName, java.lang.String entityClassName, java.lang.String keyName)</PRE> <DL> <DD>Returns the name of the file to be used to store the dataabase for the given store, entity class and key. This method may not return null. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>storeName</CODE> - the name of the <A HREF="../../../com/sleepycat/persist/EntityStore.html" title="class in com.sleepycat.persist"><CODE>EntityStore</CODE></A>.<DD><CODE>entityClassName</CODE> - the complete name of the entity class for a primary or secondary index.<DD><CODE>keyName</CODE> - the key name identifying a secondary index, or null for a primary index.</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=2 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="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/persist/DatabaseNamer.html" target="_top"><B>FRAMES</B></A> <A HREF="DatabaseNamer.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>