jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r659413 - /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java
Date Fri, 23 May 2008 04:20:01 GMT
Author: ajaquith
Date: Thu May 22 21:20:00 2008
New Revision: 659413

URL: http://svn.apache.org/viewvc?rev=659413&view=rev
Log:
Checked in three new features for UserProfile and the UserDatabase classes. First, profiles
can now store arbitrary Serializable objects via a new method in UserProfile, getAttributes,
that returns a Map<Serializable,Serializable> that can be directly manipulated. Arbitrary
attributes such as user preferences can be added to the profile and be guaranteed to be persisted
on save. Second, the UserProfile now has two methods setLockExpiry(Date)/getLockExpiry that
allow callers to disable user profiles. These are NOT enforced in AuthenticationManager yet.
Third, user profile now have a 'uid' field that stores a long value for uniquely identifying
users. Existing profiles without UIDs are automatically upgraded when they are loaded by a
findBy___() method. The default XML/JDBC UserDatabase implementations have been enhanced to
support all of these new features. If you have custom UserDatabase implementations, you should
take a look at the new code.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java?rev=659413&r1=659412&r2=659413&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/auth/user/DefaultUserProfile.java Thu May
22 21:20:00 2008
@@ -20,7 +20,8 @@
  */
 package com.ecyrd.jspwiki.auth.user;
 
-.import java.util.Date;
+import java.io.Serializable;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -56,7 +57,26 @@
     private long m_uid = -1;
 
     private String   m_wikiname  = null;
-.
+
+    /**
+     * Private constructor to prevent direct instantiation.
+     */
+    private DefaultUserProfile() { }
+
+    /**
+     * Static factory method that creates a new DefaultUserProfile
+     * and sets a unique identifier (uid) for the supplied UserDatabase.
+     * @param db the UserDatabase for which the uid should be
+     * created
+     * @return the new profile
+     */
+    protected static UserProfile newProfile( UserDatabase db )
+    {
+        UserProfile profile = new DefaultUserProfile();
+        profile.setUid( AbstractUserDatabase.generateUid( db ) );
+        return profile;
+    }
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message