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