/doc/javadoc/mdfs/namenode/repositories/UserDataRepository.html
HTML | 415 lines | 351 code | 44 blank | 20 comment | 0 complexity | a983977a7140f94531cb428b6ff66b6c MD5 | raw file
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_23) on Thu Apr 26 19:46:16 CEST 2012 -->
6<TITLE>
7UserDataRepository
8</TITLE>
9
10<META NAME="date" CONTENT="2012-04-26">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.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="UserDataRepository";
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/UserDataRepository.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-files/index-1.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</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58 <A HREF="../../../mdfs/namenode/repositories/MetaDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>PREV CLASS</B></A>
59 <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61 <A HREF="../../../index.html?mdfs/namenode/repositories/UserDataRepository.html" target="_top"><B>FRAMES</B></A>
62 <A HREF="UserDataRepository.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL: FIELD | 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">
91mdfs.namenode.repositories</FONT>
92<BR>
93Class UserDataRepository</H2>
94<PRE>
95java.lang.Object
96 <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>mdfs.namenode.repositories.UserDataRepository</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public class <B>UserDataRepository</B><DT>extends java.lang.Object</DL>
101</PRE>
102
103<P>
104UserDataRepository stores MDFS user data that correlates to the files, authentication and so on.
105 It is a Singelton since it is a shared recorce and are synchronized via <CODE>ReentrantLock</CODE>
106 for allowing multiple threads. When a lock is acquired all other operations on the UserDataRepository
107 are locked. If the thread that holds the lock fails/craches, The lock will be unlocked.
108<P>
109
110<P>
111<DL>
112<DT><B>Author:</B></DT>
113 <DD>Rasmus Holm</DD>
114</DL>
115<HR>
116
117<P>
118
119<!-- ========== METHOD SUMMARY =========== -->
120
121<A NAME="method_summary"><!-- --></A>
122<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
123<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
124<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
125<B>Method Summary</B></FONT></TH>
126</TR>
127<TR BGCOLOR="white" CLASS="TableRowColor">
128<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
129<CODE> boolean</CODE></FONT></TD>
130<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#addUser(java.lang.String, java.lang.String)">addUser</A></B>(java.lang.String name,
131 java.lang.String pass)</CODE>
132
133<BR>
134 1.</TD>
135</TR>
136<TR BGCOLOR="white" CLASS="TableRowColor">
137<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
138<CODE> boolean</CODE></FONT></TD>
139<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#addUser(mdfs.namenode.repositories.UserDataRepositoryNode)">addUser</A></B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> node)</CODE>
140
141<BR>
142 1.</TD>
143</TR>
144<TR BGCOLOR="white" CLASS="TableRowColor">
145<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
146<CODE> boolean</CODE></FONT></TD>
147<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#authUser(java.lang.String, java.lang.String)">authUser</A></B>(java.lang.String name,
148 java.lang.String password)</CODE>
149
150<BR>
151 Authenticates a user</TD>
152</TR>
153<TR BGCOLOR="white" CLASS="TableRowColor">
154<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
155<CODE> boolean</CODE></FONT></TD>
156<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#authUser(mdfs.namenode.repositories.UserDataRepositoryNode, java.lang.String)">authUser</A></B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> user,
157 java.lang.String password)</CODE>
158
159<BR>
160 Authenticates a user</TD>
161</TR>
162<TR BGCOLOR="white" CLASS="TableRowColor">
163<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
164<CODE>static <A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html" title="class in mdfs.namenode.repositories">UserDataRepository</A></CODE></FONT></TD>
165<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#getInstance()">getInstance</A></B>()</CODE>
166
167<BR>
168 </TD>
169</TR>
170<TR BGCOLOR="white" CLASS="TableRowColor">
171<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
172<CODE> <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A></CODE></FONT></TD>
173<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#getUser(java.lang.String)">getUser</A></B>(java.lang.String name)</CODE>
174
175<BR>
176 Fetches the user from the repository</TD>
177</TR>
178<TR BGCOLOR="white" CLASS="TableRowColor">
179<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
180<CODE> void</CODE></FONT></TD>
181<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#load()">load</A></B>()</CODE>
182
183<BR>
184 Loads user data repository from permanent storage</TD>
185</TR>
186<TR BGCOLOR="white" CLASS="TableRowColor">
187<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
188<CODE> <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A></CODE></FONT></TD>
189<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#removeUser(java.lang.String)">removeUser</A></B>(java.lang.String name)</CODE>
190
191<BR>
192 Removes a user from the repository.</TD>
193</TR>
194<TR BGCOLOR="white" CLASS="TableRowColor">
195<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
196<CODE> void</CODE></FONT></TD>
197<TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#save()">save</A></B>()</CODE>
198
199<BR>
200 Saves the repository to permanent storage</TD>
201</TR>
202</TABLE>
203 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
204<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
205<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
206<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
207</TR>
208<TR BGCOLOR="white" CLASS="TableRowColor">
209<TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
210</TR>
211</TABLE>
212
213<P>
214
215<!-- ============ METHOD DETAIL ========== -->
216
217<A NAME="method_detail"><!-- --></A>
218<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
219<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
220<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
221<B>Method Detail</B></FONT></TH>
222</TR>
223</TABLE>
224
225<A NAME="getInstance()"><!-- --></A><H3>
226getInstance</H3>
227<PRE>
228public static <A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html" title="class in mdfs.namenode.repositories">UserDataRepository</A> <B>getInstance</B>()</PRE>
229<DL>
230<DD><DL>
231
232<DT><B>Returns:</B><DD>the instance of the UserDataRepository</DL>
233</DD>
234</DL>
235<HR>
236
237<A NAME="addUser(mdfs.namenode.repositories.UserDataRepositoryNode)"><!-- --></A><H3>
238addUser</H3>
239<PRE>
240public boolean <B>addUser</B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> node)</PRE>
241<DL>
242<DD>1. Adds a user in the form a <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><CODE>UserDataRepositoryNode</CODE></A> to the Repository where the key is the username.
243 2. Creates a home dir for the new user.
244 3. Updates permanent storage with new user.
245<P>
246<DD><DL>
247<DT><B>Parameters:</B><DD><CODE>node</CODE> - the UserDataRepository node to add to repositori
248<DT><B>Returns:</B><DD>true if successful, false if it is preexisting</DL>
249</DD>
250</DL>
251<HR>
252
253<A NAME="removeUser(java.lang.String)"><!-- --></A><H3>
254removeUser</H3>
255<PRE>
256public <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> <B>removeUser</B>(java.lang.String name)</PRE>
257<DL>
258<DD>Removes a user from the repository.
259<P>
260<DD><DL>
261<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the user to be removed
262<DT><B>Returns:</B><DD>the removed users</DL>
263</DD>
264</DL>
265<HR>
266
267<A NAME="addUser(java.lang.String, java.lang.String)"><!-- --></A><H3>
268addUser</H3>
269<PRE>
270public boolean <B>addUser</B>(java.lang.String name,
271 java.lang.String pass)</PRE>
272<DL>
273<DD>1. Adds a user in the form a <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><CODE>UserDataRepositoryNode</CODE></A> but generated from name and pass to the Repository where the key is the username
274 2. Creates a home dir for the new user.
275 3. Updates permanent storage with new user.
276<P>
277<DD><DL>
278<DT><B>Parameters:</B><DD><CODE>name</CODE> - the username of the new user<DD><CODE>pass</CODE> - the cleartext password of the new user
279<DT><B>Returns:</B><DD>true if successful, false if it is preexisting</DL>
280</DD>
281</DL>
282<HR>
283
284<A NAME="getUser(java.lang.String)"><!-- --></A><H3>
285getUser</H3>
286<PRE>
287public <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> <B>getUser</B>(java.lang.String name)</PRE>
288<DL>
289<DD>Fetches the user from the repository
290<P>
291<DD><DL>
292<DT><B>Parameters:</B><DD><CODE>name</CODE> - the username of the user that is requested
293<DT><B>Returns:</B><DD>the user, null if it dose not exist</DL>
294</DD>
295</DL>
296<HR>
297
298<A NAME="authUser(java.lang.String, java.lang.String)"><!-- --></A><H3>
299authUser</H3>
300<PRE>
301public boolean <B>authUser</B>(java.lang.String name,
302 java.lang.String password)</PRE>
303<DL>
304<DD>Authenticates a user
305<P>
306<DD><DL>
307<DT><B>Parameters:</B><DD><CODE>name</CODE> - username as a String<DD><CODE>password</CODE> - clear text password
308<DT><B>Returns:</B><DD>true if valid, false if wrong password</DL>
309</DD>
310</DL>
311<HR>
312
313<A NAME="authUser(mdfs.namenode.repositories.UserDataRepositoryNode, java.lang.String)"><!-- --></A><H3>
314authUser</H3>
315<PRE>
316public boolean <B>authUser</B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> user,
317 java.lang.String password)</PRE>
318<DL>
319<DD>Authenticates a user
320<P>
321<DD><DL>
322<DT><B>Parameters:</B><DD><CODE>user</CODE> - the node that the password is checked against<DD><CODE>password</CODE> -
323<DT><B>Returns:</B><DD>true if valid, false if wrong password</DL>
324</DD>
325</DL>
326<HR>
327
328<A NAME="load()"><!-- --></A><H3>
329load</H3>
330<PRE>
331public void <B>load</B>()</PRE>
332<DL>
333<DD>Loads user data repository from permanent storage
334<P>
335<DD><DL>
336</DL>
337</DD>
338</DL>
339<HR>
340
341<A NAME="save()"><!-- --></A><H3>
342save</H3>
343<PRE>
344public void <B>save</B>()</PRE>
345<DL>
346<DD>Saves the repository to permanent storage
347<P>
348<DD><DL>
349</DL>
350</DD>
351</DL>
352<!-- ========= END OF CLASS DATA ========= -->
353<HR>
354
355
356<!-- ======= START OF BOTTOM NAVBAR ====== -->
357<A NAME="navbar_bottom"><!-- --></A>
358<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
359<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
360<TR>
361<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
362<A NAME="navbar_bottom_firstrow"><!-- --></A>
363<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
364 <TR ALIGN="center" VALIGN="top">
365 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
366 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
367 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
368 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/UserDataRepository.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
369 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
370 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
371 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
372 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
373 </TR>
374</TABLE>
375</TD>
376<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
377</EM>
378</TD>
379</TR>
380
381<TR>
382<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
383 <A HREF="../../../mdfs/namenode/repositories/MetaDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>PREV CLASS</B></A>
384 <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>NEXT CLASS</B></A></FONT></TD>
385<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
386 <A HREF="../../../index.html?mdfs/namenode/repositories/UserDataRepository.html" target="_top"><B>FRAMES</B></A>
387 <A HREF="UserDataRepository.html" target="_top"><B>NO FRAMES</B></A>
388 <SCRIPT type="text/javascript">
389 <!--
390 if(window==top) {
391 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
392 }
393 //-->
394</SCRIPT>
395<NOSCRIPT>
396 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
397</NOSCRIPT>
398
399
400</FONT></TD>
401</TR>
402<TR>
403<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
404 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
405<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
406DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
407</TR>
408</TABLE>
409<A NAME="skip-navbar_bottom"></A>
410<!-- ======== END OF BOTTOM NAVBAR ======= -->
411
412<HR>
413
414</BODY>
415</HTML>