Debian Codegraph @

docs/java/com/sleepycat/db/SecondaryMultiKeyCreator.html

raw symbols SCIP
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_51) on Mon Sep 09 11:47:05 EDT 2013 -->
6 <TITLE>
7 SecondaryMultiKeyCreator (Oracle - Berkeley DB Java API)
8 </TITLE>
9
10 <META NAME="date" CONTENT="2013-09-09">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17 if (location.href.indexOf('is-external=true') == -1) {
18 parent.document.title="SecondaryMultiKeyCreator (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>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecondaryMultiKeyCreator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</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 5.3.28</font></EM>
53 </TD>
54 </TR>
55
56 <TR>
57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58 &nbsp;<A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A>&nbsp;
59 &nbsp;<A HREF="../../../com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD>
60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61 <A HREF="../../../index.html?com/sleepycat/db/SecondaryMultiKeyCreator.html" target="_top"><B>FRAMES</B></A> &nbsp;
62 &nbsp;<A HREF="SecondaryMultiKeyCreator.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
63 &nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<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">
91 com.sleepycat.db</FONT>
92 <BR>
93 Interface SecondaryMultiKeyCreator</H2>
94 <HR>
95 <DL>
96 <DT><PRE>public interface <B>SecondaryMultiKeyCreator</B></DL>
97 </PRE>
98
99 <P>
100 The interface implemented for extracting multi-valued secondary keys from
101 primary records.
102 <p>
103 The key creator object is specified by calling
104 <A HREF="../../../com/sleepycat/db/SecondaryConfig.html#setMultiKeyCreator(com.sleepycat.db.SecondaryMultiKeyCreator)"><CODE>SecondaryConfig.setMultiKeyCreator</CODE></A>.
105 The secondary database configuration is specified when calling
106 <A HREF="../../../com/sleepycat/db/Environment.html#openSecondaryDatabase(com.sleepycat.db.Transaction, java.lang.String, java.lang.String, com.sleepycat.db.Database, com.sleepycat.db.SecondaryConfig)"><CODE>Environment.openSecondaryDatabase</CODE></A>.
107 <p>
108 For example:
109 <pre>
110 class MyMultiKeyCreator implements SecondaryMultiKeyCreator {
111 public void createSecondaryKeys(SecondaryDatabase secondary,
112 DatabaseEntry key,
113 DatabaseEntry data,
114 Set results)
115 throws DatabaseException {
116 //
117 // DO HERE: Extract the secondary keys from the primary key and
118 // data. For each key extracted, create a DatabaseEntry and add it
119 // to the results set.
120 //
121 }
122 }
123 ...
124 SecondaryConfig secConfig = new SecondaryConfig();
125 secConfig.setMultiKeyCreator(new MyMultiKeyCreator());
126 // Now pass secConfig to Environment.openSecondaryDatabase
127 </pre>
128 <p>
129 Use this interface when any number of secondary keys may be present in a single
130 primary record, in other words, for many-to-many and one-to-many relationships.
131 When only zero or one secondary key is present (for many-to-one and one-to-one
132 relationships) you may use the <A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A> interface instead.
133 The table below summarizes how to create all four variations of relationships.
134 <div>
135 <table border="yes">
136 <tr><th>Relationship</th>
137 <th>Interface</th>
138 <th>Duplicates</th>
139 <th>Example</th>
140 </tr>
141 <tr><td>One-to-one</td>
142 <td><A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A></td>
143 <td>No</td>
144 <td>A person record with a unique social security number key.</td>
145 </tr>
146 <tr><td>Many-to-one</td>
147 <td><A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A></td>
148 <td>Yes</td>
149 <td>A person record with a non-unique employer key.</td>
150 </tr>
151 <tr><td>One-to-many</td>
152 <td><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryMultiKeyCreator</CODE></A></td>
153 <td>No</td>
154 <td>A person record with multiple unique email address keys.</td>
155 </tr>
156 <tr><td>Many-to-many</td>
157 <td><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryMultiKeyCreator</CODE></A></td>
158 <td>Yes</td>
159 <td>A person record with multiple non-unique organization keys.</td>
160 </tr>
161 </table>
162 </div>
163 <p>To configure a database for duplicates. pass true to <A HREF="../../../com/sleepycat/db/DatabaseConfig.html#setSortedDuplicates(boolean)"><CODE>DatabaseConfig.setSortedDuplicates(boolean)</CODE></A>.</p>
164 <p>
165 Note that <code>SecondaryMultiKeyCreator</code> may also be used for single key
166 secondaries (many-to-one and one-to-one); in this case, at most a single key is
167 added to the results set. <code>SecondaryMultiKeyCreator</code> is only
168 slightly less efficient than <A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><CODE>SecondaryKeyCreator</CODE></A> in that two or three
169 temporary sets must be created to hold the results.
170 <P>
171
172 <P>
173 <DL>
174 <DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/SecondaryConfig.html" title="class in com.sleepycat.db"><CODE>SecondaryConfig</CODE></A></DL>
175 <HR>
176
177 <P>
178
179 <!-- ========== METHOD SUMMARY =========== -->
180
181 <A NAME="method_summary"><!-- --></A>
182 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
183 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
184 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
185 <B>Method Summary</B></FONT></TH>
186 </TR>
187 <TR BGCOLOR="white" CLASS="TableRowColor">
188 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
189 <CODE>&nbsp;void</CODE></FONT></TD>
190 <TD><CODE><B><A HREF="../../../com/sleepycat/db/SecondaryMultiKeyCreator.html#createSecondaryKeys(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, java.util.Set)">createSecondaryKeys</A></B>(<A HREF="../../../com/sleepycat/db/SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</A>&nbsp;secondary,
191 <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;key,
192 <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;data,
193 <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&nbsp;results)</CODE>
194
195 <BR>
196 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a secondary key entry, given a primary key and data entry.</TD>
197 </TR>
198 </TABLE>
199 &nbsp;
200 <P>
201
202 <!-- ============ METHOD DETAIL ========== -->
203
204 <A NAME="method_detail"><!-- --></A>
205 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
206 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
207 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
208 <B>Method Detail</B></FONT></TH>
209 </TR>
210 </TABLE>
211
212 <A NAME="createSecondaryKeys(com.sleepycat.db.SecondaryDatabase, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, java.util.Set)"><!-- --></A><H3>
213 createSecondaryKeys</H3>
214 <PRE>
215 void <B>createSecondaryKeys</B>(<A HREF="../../../com/sleepycat/db/SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</A>&nbsp;secondary,
216 <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;key,
217 <A HREF="../../../com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A>&nbsp;data,
218 <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&nbsp;results)
219 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE>
220 <DL>
221 <DD>Creates a secondary key entry, given a primary key and data entry.
222 <p>
223 A secondary key may be derived from the primary key, primary data, or a
224 combination of the primary key and data. Zero or more secondary keys may
225 be derived from the primary record and returned in the results parameter.
226 To ensure the integrity of a secondary database the key creator method must
227 always return the same results for a given set of input parameters.
228 <p>
229 <P>
230 <DD><DL>
231 <DT><B>Parameters:</B><DD><CODE>secondary</CODE> - the database to which the secondary key will be added.
232 This parameter is passed for informational purposes but is not commonly
233 used.
234 <p><DD><CODE>key</CODE> - the primary key entry. This parameter must not be modified
235 by this method.
236 <p><DD><CODE>data</CODE> - the primary data entry. This parameter must not be modified
237 by this method.
238 <p><DD><CODE>results</CODE> - the set to contain the the secondary key DatabaseEntry
239 objects created by this method.
240 <p>
241 <DT><B>Throws:</B>
242 <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if an error occurs attempting to create the
243 secondary key.</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>&nbsp;</TD>
260 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
261 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
262 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SecondaryMultiKeyCreator.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
263 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
264 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
265 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
266 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</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 5.3.28</font></EM>
272 </TD>
273 </TR>
274
275 <TR>
276 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
277 &nbsp;<A HREF="../../../com/sleepycat/db/SecondaryKeyCreator.html" title="interface in com.sleepycat.db"><B>PREV CLASS</B></A>&nbsp;
278 &nbsp;<A HREF="../../../com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD>
279 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
280 <A HREF="../../../index.html?com/sleepycat/db/SecondaryMultiKeyCreator.html" target="_top"><B>FRAMES</B></A> &nbsp;
281 &nbsp;<A HREF="SecondaryMultiKeyCreator.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
282 &nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
299 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
300 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<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, 2013 Oracle and/or its affiliates. All rights reserved.</font>
308 </BODY>
309 </HTML>