1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 --> 6<TITLE> 7DatabaseNamer (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="keywords" CONTENT="com.sleepycat.persist.DatabaseNamer interface"> 11 12<LINK REL ="stylesheet" TYPE="text/css" HREF="/style.css" TITLE="Style"> 13 14<SCRIPT type="text/javascript"> 15function windowTitle() 16{ 17 parent.document.title="DatabaseNamer (Oracle - Berkeley DB Java API)"; 18} 19</SCRIPT> 20<NOSCRIPT> 21</NOSCRIPT> 22 23</HEAD> 24 25<BODY BGCOLOR="white" onload="windowTitle();"> 26 27 28<!-- ========= START OF TOP NAVBAR ======= --> 29<A NAME="navbar_top"><!-- --></A> 30<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 32<TR> 33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 34<A NAME="navbar_top_firstrow"><!-- --></A> 35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 36 <TR ALIGN="center" VALIGN="top"> 37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DatabaseNamer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 45 </TR> 46</TABLE> 47</TD> 48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 50</TD> 51</TR> 52 53<TR> 54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 55 PREV CLASS 56 <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="/index.html?com/sleepycat/persist/DatabaseNamer.html" target="_top"><B>FRAMES</B></A> 59 <A HREF="DatabaseNamer.html" target="_top"><B>NO FRAMES</B></A> 60 <SCRIPT type="text/javascript"> 61 <!-- 62 if(window==top) { 63 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 64 } 65 //--> 66</SCRIPT> 67<NOSCRIPT> 68 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 69</NOSCRIPT> 70 71 72</FONT></TD> 73</TR> 74<TR> 75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 76 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 78DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 79</TR> 80</TABLE> 81<A NAME="skip-navbar_top"></A> 82<!-- ========= END OF TOP NAVBAR ========= --> 83 84<HR> 85<!-- ======== START OF CLASS DATA ======== --> 86<H2> 87<FONT SIZE="-1"> 88com.sleepycat.persist</FONT> 89<BR> 90Interface DatabaseNamer</H2> 91<HR> 92<DL> 93<DT><PRE>public interface <B>DatabaseNamer</B></DL> 94</PRE> 95 96<P> 97Determines the file names to use for primary and secondary databases. 98 99 <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 100 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 101 secondary indices must be unique within the environment, so that each index 102 is stored in a separate database file.</p> 103 104 <p>By default, the file names of primary and secondary databases are 105 defined as follows.</p> 106 107 <p>The syntax of a primary index database file name is:</p> 108 <pre> STORE_NAME-ENTITY_CLASS</pre> 109 <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 110 passed to <A HREF="/com/sleepycat/persist/EntityStore.html#getPrimaryIndex(java.lang.Class, java.lang.Class)"><CODE>getPrimaryIndex</CODE></A>.</p> 111 112 <p>The syntax of a secondary index database file name is:</p> 113 <pre> STORE_NAME-ENTITY_CLASS-KEY_NAME</pre> 114 <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> 115 116 <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 117 custom namer could place all database files in a subdirectory with the name 118 of the store. A custom namer could also be used to name files according to 119 specific file system restrictions.</p> 120 121 <p>The custom namer object must be an instance of the <code>DatabaseNamer</code> 122 interface and is configured using <A HREF="/com/sleepycat/persist/StoreConfig.html#setDatabaseNamer(com.sleepycat.persist.DatabaseNamer)"><CODE>setDatabaseNamer</CODE></A>.</p> 123 124 <p>When copying or removing all databases in a store, there is one further 125 consideration. There are two internal databases that must be kept with the 126 other databases in the store in order for the store to be used. These 127 contain the data formats and sequences for the store. Their entity class 128 names are:</p> 129 130 <pre> com.sleepycat.persist.formats</pre> 131 <pre> com.sleepycat.persist.sequences</pre> 132 133 <p>With default database naming, databases with the following names will be 134 present each store.</p> 135 136 <pre> STORE_NAME-com.sleepycat.persist.formats</pre> 137 <pre> STORE_NAME-com.sleepycat.persist.sequences</pre> 138 139 <p>These databases must normally be included with copies of other databases 140 in the store. They should not be modified by the application.</p> 141<P> 142 143<P> 144<HR> 145 146<P> 147<!-- =========== FIELD SUMMARY =========== --> 148 149<A NAME="field_summary"><!-- --></A> 150<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 151<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 152<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 153<B>Field Summary</B></FONT></TH> 154</TR> 155<TR BGCOLOR="white" CLASS="TableRowColor"> 156<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 157<CODE>static <A HREF="/com/sleepycat/persist/DatabaseNamer.html" title="interface in com.sleepycat.persist">DatabaseNamer</A></CODE></FONT></TD> 158<TD><CODE><B><A HREF="/com/sleepycat/persist/DatabaseNamer.html#DEFAULT">DEFAULT</A></B></CODE> 159 160<BR> 161 The default database namer.</TD> 162</TR> 163</TABLE> 164 165<!-- ========== METHOD SUMMARY =========== --> 166 167<A NAME="method_summary"><!-- --></A> 168<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 169<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 170<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 171<B>Method Summary</B></FONT></TH> 172</TR> 173<TR BGCOLOR="white" CLASS="TableRowColor"> 174<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 175<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> 176<TD><CODE><B><A HREF="/com/sleepycat/persist/DatabaseNamer.html#getFileName(java.lang.String, java.lang.String, java.lang.String)">getFileName</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> storeName, 177 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> entityClassName, 178 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> keyName)</CODE> 179 180<BR> 181 Returns the name of the file to be used to store the dataabase for the 182 given store, entity class and key.</TD> 183</TR> 184</TABLE> 185 186<P> 187 188<!-- ============ FIELD DETAIL =========== --> 189 190<A NAME="field_detail"><!-- --></A> 191<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 192<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 193<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 194<B>Field Detail</B></FONT></TH> 195</TR> 196</TABLE> 197 198<A NAME="DEFAULT"><!-- --></A><H3> 199DEFAULT</H3> 200<PRE> 201static final <A HREF="/com/sleepycat/persist/DatabaseNamer.html" title="interface in com.sleepycat.persist">DatabaseNamer</A> <B>DEFAULT</B></PRE> 202<DL> 203<DD>The default database namer. 204 205 <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 206 <code>storeName</code>, <code>entityClassName</code> and <code>keyName</code> 207 parameters as follows:<p> 208 209 <pre class="code"> 210 if (keyName != null) { 211 return storeName + '-' + entityClassName + '-' + keyName; 212 } else { 213 return storeName + '-' + entityClassName; 214 }</pre> 215<P> 216<DL> 217</DL> 218</DL> 219 220<!-- ============ METHOD DETAIL ========== --> 221 222<A NAME="method_detail"><!-- --></A> 223<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 224<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 225<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 226<B>Method Detail</B></FONT></TH> 227</TR> 228</TABLE> 229 230<A NAME="getFileName(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3> 231getFileName</H3> 232<PRE> 233<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getFileName</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> storeName, 234 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> entityClassName, 235 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> keyName)</PRE> 236<DL> 237<DD>Returns the name of the file to be used to store the dataabase for the 238 given store, entity class and key. This method may not return null. 239<P> 240<DD><DL> 241<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 242 primary or secondary index.<DD><CODE>keyName</CODE> - the key name identifying a secondary index, or null for 243 a primary index.</DL> 244</DD> 245</DL> 246<!-- ========= END OF CLASS DATA ========= --> 247<HR> 248 249 250<!-- ======= START OF BOTTOM NAVBAR ====== --> 251<A NAME="navbar_bottom"><!-- --></A> 252<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 253<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 254<TR> 255<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 256<A NAME="navbar_bottom_firstrow"><!-- --></A> 257<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 258 <TR ALIGN="center" VALIGN="top"> 259 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 260 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 261 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 262 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DatabaseNamer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 263 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 264 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 265 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 266 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 267 </TR> 268</TABLE> 269</TD> 270<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 271<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 272</TD> 273</TR> 274 275<TR> 276<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 277 PREV CLASS 278 <A HREF="/com/sleepycat/persist/EntityCursor.html" title="interface in com.sleepycat.persist"><B>NEXT CLASS</B></A></FONT></TD> 279<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 280 <A HREF="/index.html?com/sleepycat/persist/DatabaseNamer.html" target="_top"><B>FRAMES</B></A> 281 <A HREF="DatabaseNamer.html" target="_top"><B>NO FRAMES</B></A> 282 <SCRIPT type="text/javascript"> 283 <!-- 284 if(window==top) { 285 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 286 } 287 //--> 288</SCRIPT> 289<NOSCRIPT> 290 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 291</NOSCRIPT> 292 293 294</FONT></TD> 295</TR> 296<TR> 297<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 298 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 299<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 300DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 301</TR> 302</TABLE> 303<A NAME="skip-navbar_bottom"></A> 304<!-- ======== END OF BOTTOM NAVBAR ======= --> 305 306<HR> 307<font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 308</BODY> 309</HTML> 310