Author: channa
Date: Thu Jul 17 11:20:34 2008
New Revision: 19427
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19427

Log:
Adding Primary user id to WSAS PM at provisioning. 
Added @mashup_version@ to error page.
Added null check to make getUserProfile more robust, but reverting pages to 
anonymous user TBD. MASHUP-968.

Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
   trunk/mashup/java/modules/www/error.jsp

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java?rev=19427&r1=19426&r2=19427&view=diff
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
Thu Jul 17 11:20:34 2008
@@ -154,6 +154,7 @@
     public static final String CREATE_PRIMARY_USER = "CreatePrimary";
     public static final String PRIMARY_USER = "PrimaryUser";
     public static final String PRIMARY_PASSWORD = "PrimaryPassword";
+    public static final String PRIMARY_USER_ID = "PrimaryUserId";
     public static final String LOCALHOST = "localhost";
     public static final String LOCALHOST_IP = "127.0.0.1";
     public static final String TRUE = "true";

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java?rev=19427&r1=19426&r2=19427&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
  (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
  Thu Jul 17 11:20:34 2008
@@ -45,6 +45,7 @@
 import org.wso2.utils.ServerException;
 import org.wso2.wsas.ServerManager;
 import org.wso2.wsas.persistence.exception.KeyStoreAlreadyExistsException;
+import org.wso2.wsas.persistence.PersistenceManager;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
@@ -336,17 +337,26 @@
         return fullName;
     }
 
+    /**
+     * Get the profile of a given user.
+     * @param userID Unique identifier of user.
+     * @param registry Instance of registry.
+     * @return Instance of User object.
+     * @throws RegistryException
+     */
     public static User getUserProfile(String userID, Registry registry) throws 
RegistryException {
+        User user = null;
 
-        UserRegistry userRegistry = (UserRegistry) registry;
+        if (userID != null) {
+            UserRegistry userRegistry = (UserRegistry) registry;
 
-        String profilePath = "/users/" + userID + "/profile";
-        Resource userProfile = userRegistry.get(profilePath);
-        String userData = new String((byte[]) userProfile.getContent());
-
-        User user = new User();
-        user.deserializeUserProfile(userData);
+            String profilePath = "/users/" + userID + "/profile";
+            Resource userProfile = userRegistry.get(profilePath);
+            String userData = new String((byte[]) userProfile.getContent());
 
+            user = new User();
+            user.deserializeUserProfile(userData);
+        }
         return user;
     }
 
@@ -797,6 +807,10 @@
         // Set the 'primary' property.
         userProps.put(MashupConstants.PRIMARY, String.valueOf(true));
         userStoreAdmin.setUserProperties(userName, userProps);
+
+        // Set primary user's ID in persistance manager.
+        PersistenceManager pm = new PersistenceManager();
+        pm.updateConfigurationProperty(MashupConstants.PRIMARY_USER_ID, 
userName);
     }
 
     /**

Modified: trunk/mashup/java/modules/www/error.jsp
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/www/error.jsp?rev=19427&r1=19426&r2=19427&view=diff
==============================================================================
--- trunk/mashup/java/modules/www/error.jsp     (original)
+++ trunk/mashup/java/modules/www/error.jsp     Thu Jul 17 11:20:34 2008
@@ -31,7 +31,7 @@
                 <td>
                     <div class="logo-position">
                         <img src="/images/wso2_mashup_logo.png"/>
-                        <span class="version">1.0</span>
+                        <span class="version">@mashup_version@</span>
                     </div>
                 </td>
             </tr>

_______________________________________________
Mashup-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to