/doc/javadoc/mdfs/namenode/repositories/UserDataRepository.html
https://bitbucket.org/crholm/mdfs · HTML · 415 lines · 351 code · 44 blank · 20 comment · 0 complexity · a983977a7140f94531cb428b6ff66b6c MD5 · raw file
- <!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_23) on Thu Apr 26 19:46:16 CEST 2012 -->
- <TITLE>
- UserDataRepository
- </TITLE>
- <META NAME="date" CONTENT="2012-04-26">
- <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="UserDataRepository";
- }
- }
- </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="class-use/UserDataRepository.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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">
- <A HREF="../../../mdfs/namenode/repositories/MetaDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>PREV CLASS</B></A>
- <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../index.html?mdfs/namenode/repositories/UserDataRepository.html" target="_top"><B>FRAMES</B></A>
- <A HREF="UserDataRepository.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | 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">
- mdfs.namenode.repositories</FONT>
- <BR>
- Class UserDataRepository</H2>
- <PRE>
- java.lang.Object
- <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>mdfs.namenode.repositories.UserDataRepository</B>
- </PRE>
- <HR>
- <DL>
- <DT><PRE>public class <B>UserDataRepository</B><DT>extends java.lang.Object</DL>
- </PRE>
- <P>
- UserDataRepository stores MDFS user data that correlates to the files, authentication and so on.
- It is a Singelton since it is a shared recorce and are synchronized via <CODE>ReentrantLock</CODE>
- for allowing multiple threads. When a lock is acquired all other operations on the UserDataRepository
- are locked. If the thread that holds the lock fails/craches, The lock will be unlocked.
- <P>
- <P>
- <DL>
- <DT><B>Author:</B></DT>
- <DD>Rasmus Holm</DD>
- </DL>
- <HR>
- <P>
- <!-- ========== 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> boolean</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#addUser(java.lang.String, java.lang.String)">addUser</A></B>(java.lang.String name,
- java.lang.String pass)</CODE>
- <BR>
- 1.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> boolean</CODE></FONT></TD>
- <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>
- <BR>
- 1.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> boolean</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#authUser(java.lang.String, java.lang.String)">authUser</A></B>(java.lang.String name,
- java.lang.String password)</CODE>
- <BR>
- Authenticates a user</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> boolean</CODE></FONT></TD>
- <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,
- java.lang.String password)</CODE>
- <BR>
- Authenticates a user</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static <A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html" title="class in mdfs.namenode.repositories">UserDataRepository</A></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#getInstance()">getInstance</A></B>()</CODE>
- <BR>
- </TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#getUser(java.lang.String)">getUser</A></B>(java.lang.String name)</CODE>
- <BR>
- Fetches the user from the repository</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> void</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#load()">load</A></B>()</CODE>
- <BR>
- Loads user data repository from permanent storage</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#removeUser(java.lang.String)">removeUser</A></B>(java.lang.String name)</CODE>
- <BR>
- Removes a user from the repository.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> void</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html#save()">save</A></B>()</CODE>
- <BR>
- Saves the repository to permanent storage</TD>
- </TR>
- </TABLE>
- <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
- <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
- </TR>
- </TABLE>
-
- <P>
- <!-- ============ 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="getInstance()"><!-- --></A><H3>
- getInstance</H3>
- <PRE>
- public static <A HREF="../../../mdfs/namenode/repositories/UserDataRepository.html" title="class in mdfs.namenode.repositories">UserDataRepository</A> <B>getInstance</B>()</PRE>
- <DL>
- <DD><DL>
- <DT><B>Returns:</B><DD>the instance of the UserDataRepository</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="addUser(mdfs.namenode.repositories.UserDataRepositoryNode)"><!-- --></A><H3>
- addUser</H3>
- <PRE>
- public boolean <B>addUser</B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> node)</PRE>
- <DL>
- <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.
- 2. Creates a home dir for the new user.
- 3. Updates permanent storage with new user.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>node</CODE> - the UserDataRepository node to add to repositori
- <DT><B>Returns:</B><DD>true if successful, false if it is preexisting</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="removeUser(java.lang.String)"><!-- --></A><H3>
- removeUser</H3>
- <PRE>
- public <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> <B>removeUser</B>(java.lang.String name)</PRE>
- <DL>
- <DD>Removes a user from the repository.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the user to be removed
- <DT><B>Returns:</B><DD>the removed users</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="addUser(java.lang.String, java.lang.String)"><!-- --></A><H3>
- addUser</H3>
- <PRE>
- public boolean <B>addUser</B>(java.lang.String name,
- java.lang.String pass)</PRE>
- <DL>
- <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
- 2. Creates a home dir for the new user.
- 3. Updates permanent storage with new user.
- <P>
- <DD><DL>
- <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
- <DT><B>Returns:</B><DD>true if successful, false if it is preexisting</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getUser(java.lang.String)"><!-- --></A><H3>
- getUser</H3>
- <PRE>
- public <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> <B>getUser</B>(java.lang.String name)</PRE>
- <DL>
- <DD>Fetches the user from the repository
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>name</CODE> - the username of the user that is requested
- <DT><B>Returns:</B><DD>the user, null if it dose not exist</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="authUser(java.lang.String, java.lang.String)"><!-- --></A><H3>
- authUser</H3>
- <PRE>
- public boolean <B>authUser</B>(java.lang.String name,
- java.lang.String password)</PRE>
- <DL>
- <DD>Authenticates a user
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>name</CODE> - username as a String<DD><CODE>password</CODE> - clear text password
- <DT><B>Returns:</B><DD>true if valid, false if wrong password</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="authUser(mdfs.namenode.repositories.UserDataRepositoryNode, java.lang.String)"><!-- --></A><H3>
- authUser</H3>
- <PRE>
- public boolean <B>authUser</B>(<A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories">UserDataRepositoryNode</A> user,
- java.lang.String password)</PRE>
- <DL>
- <DD>Authenticates a user
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>user</CODE> - the node that the password is checked against<DD><CODE>password</CODE> -
- <DT><B>Returns:</B><DD>true if valid, false if wrong password</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="load()"><!-- --></A><H3>
- load</H3>
- <PRE>
- public void <B>load</B>()</PRE>
- <DL>
- <DD>Loads user data repository from permanent storage
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="save()"><!-- --></A><H3>
- save</H3>
- <PRE>
- public void <B>save</B>()</PRE>
- <DL>
- <DD>Saves the repository to permanent storage
- <P>
- <DD><DL>
- </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="class-use/UserDataRepository.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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">
- <A HREF="../../../mdfs/namenode/repositories/MetaDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>PREV CLASS</B></A>
- <A HREF="../../../mdfs/namenode/repositories/UserDataRepositoryNode.html" title="class in mdfs.namenode.repositories"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../index.html?mdfs/namenode/repositories/UserDataRepository.html" target="_top"><B>FRAMES</B></A>
- <A HREF="UserDataRepository.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_bottom"></A>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <HR>
- </BODY>
- </HTML>