You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2004/05/17 01:55:17 UTC
cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/userinfo/impl UserInfoManagerImpl.java
dlestrat 2004/05/16 16:55:17
Modified: portal/src/java/org/apache/jetspeed/userinfo
UserInfoManager.java
portal/src/java/org/apache/jetspeed/userinfo/impl
UserInfoManagerImpl.java
Log:
Modified UserInfoManager.
Revision Changes Path
1.2 +7 -5 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/userinfo/UserInfoManager.java
Index: UserInfoManager.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/userinfo/UserInfoManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UserInfoManager.java 16 May 2004 20:08:28 -0000 1.1
+++ UserInfoManager.java 16 May 2004 23:55:17 -0000 1.2
@@ -14,9 +14,12 @@
*/
package org.apache.jetspeed.userinfo;
-import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import java.util.Map;
+
import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.common.ObjectID;
+
/**
* <p>The {@link UserInfoManager} retrieve the Map that will be set as a
* <code>(PortletRequest.USER_INFO</code> request attribute for a specific
@@ -51,10 +54,9 @@
* <p>Provide the user info map of user attributes for a given portlet application.</p>
* <p>The MutablePortletApplication can be retrieved from a Fragment through:</p>
* <p><code>MutablePortletApplication pa = getPortletApplication(portletFragment);</code></p>
- * @param pa The portlet application.
+ * @param oid The portlet application object id.
* @param context The request context.
- * @return The portlet request context updated with the
- * {@link PortletRequest.USER_INFO} map.
+ * @return The {@link PortletRequest.USER_INFO} map.
*/
- RequestContext setUserInfoMap(MutablePortletApplication pa, RequestContext context);
+ Map getUserInfoMap(ObjectID oid, RequestContext context);
}
1.2 +16 -30 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java
Index: UserInfoManagerImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/userinfo/impl/UserInfoManagerImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UserInfoManagerImpl.java 16 May 2004 20:08:28 -0000 1.1
+++ UserInfoManagerImpl.java 16 May 2004 23:55:17 -0000 1.2
@@ -41,6 +41,8 @@
import org.apache.jetspeed.security.SecurityHelper;
import org.apache.jetspeed.userinfo.UserInfoManager;
+import org.apache.pluto.om.common.ObjectID;
+
/**
* <p>Implements the {@link org.apache.jetspeed.userinfo.UserInfoManager} interface.</p>
@@ -66,8 +68,8 @@
UserManager userMgr;
/** The portlet registry. */
PortletRegistryComponent registry;
- /** The portlet application being processed. */
- String paName;
+ /** The object id of the portlet application being processed. */
+ String oid;
/**
* <p>Constructor providing access to the {@link UserManager}.</p>
@@ -101,39 +103,34 @@
/**
* @see org.apache.jetspeed.userinfo.UserInfoManager#setUserInfoMap(org.apache.jetspeed.om.page.Fragment, org.apache.jetspeed.request.RequestContext)
*/
- public RequestContext setUserInfoMap(MutablePortletApplication pa, RequestContext context)
+ public Map getUserInfoMap(ObjectID oid, RequestContext context)
{
+ if (log.isDebugEnabled()) log.debug("Getting user info for portlet application: " + oid.toString());
+
// Check if user info map is in cache.
- if (userInfoMapCache.containsKey(paName))
+ if (userInfoMapCache.containsKey(oid))
{
- context.setAttribute(PortletRequest.USER_INFO, userInfoMapCache.get(paName));
- return context;
+ return (Map) userInfoMapCache.get(oid);
}
// Not in cache, map user info.
Preferences userPrefs = getUserPreferences(context);
if (null == userPrefs)
{
- context.setAttribute(PortletRequest.USER_INFO, null);
log.debug(PortletRequest.USER_INFO + " is set to null");
- return context;
+ return null;
}
+
+ MutablePortletApplication pa = registry.getPortletApplication(oid);
if (null == pa)
{
- context.setAttribute(PortletRequest.USER_INFO, null);
log.debug(PortletRequest.USER_INFO + " is set to null");
- return context;
+ return null;
}
Preferences userInfoPrefs = userPrefs.node(userInfoPropertySet);
Collection portletUserAttributes = pa.getUserAttributes();
Map userInfoMap = mapUserInfo(userInfoPrefs, portletUserAttributes);
- if (null == userInfoMap)
- {
- context.setAttribute(PortletRequest.USER_INFO, null);
- log.debug(PortletRequest.USER_INFO + " is set to null");
- return context;
- }
- context.setAttribute(PortletRequest.USER_INFO, userInfoMapCache.get(paName));
- return context;
+
+ return userInfoMap;
}
/**
@@ -183,7 +180,7 @@
}
}
- userInfoMapCache.put(paName, userInfoMap);
+ userInfoMapCache.put(oid, userInfoMap);
return userInfoMap;
}
@@ -219,17 +216,6 @@
}
}
return userPrefs;
- }
-
- /**
- * <p>Gets the portlet application from the provided portlet fragment.</p>
- * @param portletFragment The portlet fragment.
- * @return The portlet application.
- */
- private MutablePortletApplication getPortletApplication(Fragment portletFragment)
- {
- paName = PortletRegistryHelper.parseAppName(portletFragment.getName());
- return registry.getPortletApplication(paName);
}
private void initUserInfoMapCache()
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org