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 ta...@apache.org on 2013/07/26 01:59:58 UTC
svn commit: r1507157 [1/2] - in /portals/jetspeed-2/portal/trunk: ./
components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/
components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/
components/jetspeed-por...
Author: taylor
Date: Thu Jul 25 23:59:57 2013
New Revision: 1507157
URL: http://svn.apache.org/r1507157
Log:
JS2-874: checkpoint #1 in refactoring of Jetspeed-API to use Java Collections Generics
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfileLocator.java
portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/ProfileFallbackIterator.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SearchPathsSiteView.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreateUserTemplatePagesValveImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfilerImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleFallbackProfilingRule.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/StandardProfilingRule.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/JetspeedProfilerSerializer.java
portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/ConnectionRepositoryEntry.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/administration/PortalAdministration.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/profiler/ProfileLocator.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/profiler/Profiler.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/profiler/rules/ProfileResolvers.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/profiler/rules/RuleCriterion.java
portals/jetspeed-2/portal/trunk/jetspeed-archetype/src/main/resources/archetype-resources/pom.xml
portals/jetspeed-2/portal/trunk/openid-step2/pom.xml
portals/jetspeed-2/portal/trunk/pom.xml
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfileLocator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfileLocator.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfileLocator.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/JetspeedProfileLocator.java Thu Jul 25 23:59:57 2013
@@ -16,17 +16,13 @@
*/
package org.apache.jetspeed.profiler.impl;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.StringTokenizer;
-
import org.apache.jetspeed.profiler.ProfileLocator;
import org.apache.jetspeed.profiler.ProfileLocatorProperty;
import org.apache.jetspeed.profiler.Profiler;
import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import java.util.*;
+
/**
* ProfileLocatorImpl
*
@@ -69,7 +65,7 @@ public class JetspeedProfileLocator impl
this.requestServerName = requestServerName;
}
- public Iterator iterator()
+ public Iterator<ProfileLocatorProperty []> iterator()
{
return new ProfileFallbackIterator(this);
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/ProfileFallbackIterator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/ProfileFallbackIterator.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/ProfileFallbackIterator.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/main/java/org/apache/jetspeed/profiler/impl/ProfileFallbackIterator.java Thu Jul 25 23:59:57 2013
@@ -16,19 +16,19 @@
*/
package org.apache.jetspeed.profiler.impl;
-import java.util.Iterator;
-import java.util.List;
-
import org.apache.jetspeed.profiler.ProfileLocatorProperty;
import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import java.util.Iterator;
+import java.util.List;
+
/**
* ProfileFallbackIterator
*
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id$
*/
-public class ProfileFallbackIterator implements Iterator
+public class ProfileFallbackIterator implements Iterator<ProfileLocatorProperty []>
{
private ProfileLocatorControl locator;
private int last = 0;
@@ -82,7 +82,7 @@ public class ProfileFallbackIterator imp
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
- public Object next()
+ public ProfileLocatorProperty [] next()
{
ProfileLocatorProperty [] properties = null;
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java Thu Jul 25 23:59:57 2013
@@ -611,10 +611,10 @@ public class PortalSiteSessionContextImp
// property that will force the request path if
// non-null; otherwise default to locator request path
String requestPath = locator.getRequestPath();
- Iterator locatorIter = locator.iterator();
+ Iterator<ProfileLocatorProperty []> locatorIter = locator.iterator();
if (locatorIter.hasNext())
{
- ProfileLocatorProperty [] properties = (ProfileLocatorProperty []) locatorIter.next();
+ ProfileLocatorProperty [] properties = locatorIter.next();
for (int i = 0; (i < properties.length); i++)
{
if (!properties[i].isControl() && !properties[i].isNavigation())
@@ -1654,8 +1654,8 @@ public class PortalSiteSessionContextImp
// compare locators using the most specific,
// (i.e. first), locator properties array
// returned by the locator iterator
- ProfileLocatorProperty [] properties0 = (ProfileLocatorProperty [])locator0.iterator().next();
- ProfileLocatorProperty [] properties1 = (ProfileLocatorProperty [])locator1.iterator().next();
+ ProfileLocatorProperty [] properties0 = locator0.iterator().next();
+ ProfileLocatorProperty [] properties1 = locator1.iterator().next();
if ((properties0 != null) || (properties1 != null))
{
if ((properties0 == null) || (properties1 == null) || (properties0.length != properties1.length))
@@ -1713,7 +1713,7 @@ public class PortalSiteSessionContextImp
// returned by the locator iterator and return
// first valued property that is not a control
// or navigation type
- ProfileLocatorProperty [] properties = (ProfileLocatorProperty [])locator.iterator().next();
+ ProfileLocatorProperty [] properties = locator.iterator().next();
for (int i = 0, limit = properties.length; (i < limit); i++)
{
if (!properties[i].isControl() && !properties[i].isNavigation() && (properties[i].getValue() != null))
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SearchPathsSiteView.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SearchPathsSiteView.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SearchPathsSiteView.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SearchPathsSiteView.java Thu Jul 25 23:59:57 2013
@@ -16,12 +16,6 @@
*/
package org.apache.jetspeed.portalsite.view;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
import org.apache.jetspeed.om.folder.Folder;
import org.apache.jetspeed.om.folder.FolderNotFoundException;
import org.apache.jetspeed.om.folder.proxy.FolderProxy;
@@ -43,6 +37,12 @@ import org.apache.jetspeed.page.document
import org.apache.jetspeed.profiler.ProfileLocator;
import org.apache.jetspeed.profiler.ProfileLocatorProperty;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
/**
* This class defines a logical view of site content using
* search paths generated by the profiler.
@@ -484,7 +484,7 @@ public class SearchPathsSiteView extends
// generate the proper search paths
List locatorSearchPaths = new ArrayList(8);
int addLocatorSearchPathsAt = 0;
- Iterator locatorIter = locator.iterator();
+ Iterator<ProfileLocatorProperty []> locatorIter = locator.iterator();
while (locatorIter.hasNext())
{
// initialize path construction variables
@@ -502,7 +502,7 @@ public class SearchPathsSiteView extends
int skipProfileLocatorIterations = -1;
// form locator properties into a complete path
- ProfileLocatorProperty [] properties = (ProfileLocatorProperty []) locatorIter.next();
+ ProfileLocatorProperty [] properties = locatorIter.next();
for (int i = 0; (i < properties.length); i++)
{
if (properties[i].isNavigation())
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/administration/PortalAdministrationImpl.java Thu Jul 25 23:59:57 2013
@@ -16,21 +16,6 @@
*/
package org.apache.jetspeed.administration;
-import java.io.FileReader;
-import java.io.StringWriter;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-
import org.apache.commons.configuration.Configuration;
import org.apache.jetspeed.Jetspeed;
import org.apache.jetspeed.PortalReservedParameters;
@@ -49,14 +34,8 @@ import org.apache.jetspeed.profiler.Prof
import org.apache.jetspeed.profiler.Profiler;
import org.apache.jetspeed.profiler.rules.ProfilingRule;
import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.security.GroupManager;
-import org.apache.jetspeed.security.JSSubject;
-import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.RoleManager;
-import org.apache.jetspeed.security.SecurityAttributes;
+import org.apache.jetspeed.security.*;
import org.apache.jetspeed.security.SecurityException;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.security.UserManager;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.slf4j.Logger;
@@ -65,23 +44,33 @@ import org.springframework.mail.MailExce
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import java.io.FileReader;
+import java.io.StringWriter;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.util.*;
+
/**
* PortalAdministrationImpl
* Implements aggregate portal administration functions:
- * - Emails
- * - Registration
- * - Password Generation
- * -
- *
+ * - Emails
+ * - Registration
+ * - Password Generation
+ * -
+ *
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @author <a href="mailto:chris@bluesunrise.com">Chris Schaefer</a>
* @version $Id$
*/
-public class PortalAdministrationImpl implements PortalAdministration
-{
+public class PortalAdministrationImpl implements PortalAdministration {
private final static Logger log = LoggerFactory.getLogger(PortalAdministrationImpl.class);
-
- /** administration services */
+
+ /**
+ * administration services
+ */
protected Configuration config;
protected UserManager userManager;
protected RoleManager roleManager;
@@ -92,29 +81,40 @@ public class PortalAdministrationImpl im
protected JavaMailSender mailSender;
protected VelocityEngine velocityEngine;
protected PasswordGenerator passwordGenerator;
-
- /** list of default roles for a registered user */
- protected List defaultRoles;
- /** list of default groups for a registered user */
- protected List defaultGroups;
- /** map of default profiling rules for a registered user */
- protected Map defaultRules;
- /** name of PSML Folder Template to clone from when registering new user */
+
+ /**
+ * list of default roles for a registered user
+ */
+ protected List<String> defaultRoles;
+ /**
+ * list of default groups for a registered user
+ */
+ protected List<String> defaultGroups;
+ /**
+ * map of default profiling rules for a registered user
+ */
+ protected Map<String, String> defaultRules;
+ /**
+ * name of PSML Folder Template to clone from when registering new user
+ */
protected String folderTemplate;
- /** default administrative user */
+ /**
+ * default administrative user
+ */
protected String adminUser;
- /** default administrative role */
+ /**
+ * default administrative role
+ */
protected String adminRole;
-
- public PortalAdministrationImpl( UserManager userManager,
- RoleManager roleManager,
- GroupManager groupManager,
- PageManager pageManager,
- Profiler profiler,
- PortalSite portalSite,
- JavaMailSender mailSender,
- VelocityEngine velocityEngine)
- {
+
+ public PortalAdministrationImpl(UserManager userManager,
+ RoleManager roleManager,
+ GroupManager groupManager,
+ PageManager pageManager,
+ Profiler profiler,
+ PortalSite portalSite,
+ JavaMailSender mailSender,
+ VelocityEngine velocityEngine) {
this.userManager = userManager;
this.roleManager = roleManager;
this.groupManager = groupManager;
@@ -125,191 +125,154 @@ public class PortalAdministrationImpl im
this.velocityEngine = velocityEngine;
this.passwordGenerator = new SimplePasswordGeneratorImpl();
}
-
- public void setPasswordGenerator(PasswordGenerator passwordGenerator)
- {
- if (passwordGenerator != null)
- {
+
+ public void setPasswordGenerator(PasswordGenerator passwordGenerator) {
+ if (passwordGenerator != null) {
this.passwordGenerator = passwordGenerator;
}
}
- public void start()
- {
+ public void start() {
this.config = (Configuration) Jetspeed.getComponentManager().getComponent("portal_configuration");
-
- this.defaultRoles =
- config.getList(PortalConfigurationConstants.REGISTRATION_ROLES_DEFAULT);
- this.defaultGroups =
- config.getList(PortalConfigurationConstants.REGISTRATION_GROUPS_DEFAULT);
-
- Object[] profileRuleNames = config.getList(PortalConfigurationConstants.PROFILER_RULE_NAMES_DEFAULT).toArray();
- Object[] profileRuleValues = config.getList(PortalConfigurationConstants.PROFILER_RULE_VALUES_DEFAULT).toArray();
- defaultRules = new HashMap();
- if (profileRuleNames != null && profileRuleValues != null)
- {
- for (int ix = 0; ix < ((profileRuleNames.length < profileRuleValues.length) ? profileRuleNames.length : profileRuleValues.length); ix++)
- {
+
+ this.defaultRoles = config.getList(PortalConfigurationConstants.REGISTRATION_ROLES_DEFAULT);
+ this.defaultGroups = config.getList(PortalConfigurationConstants.REGISTRATION_GROUPS_DEFAULT);
+
+ String[] profileRuleNames = config.getStringArray(PortalConfigurationConstants.PROFILER_RULE_NAMES_DEFAULT);
+ String[] profileRuleValues = config.getStringArray(PortalConfigurationConstants.PROFILER_RULE_VALUES_DEFAULT);
+ defaultRules = new HashMap<String, String>();
+ if (profileRuleNames != null && profileRuleValues != null) {
+ for (int ix = 0; ix < ((profileRuleNames.length < profileRuleValues.length) ? profileRuleNames.length : profileRuleValues.length); ix++) {
defaultRules.put(profileRuleNames[ix], profileRuleValues[ix]);
}
}
- this.folderTemplate =
- config.getString(PortalConfigurationConstants.PSML_TEMPLATE_FOLDER);
+ this.folderTemplate =
+ config.getString(PortalConfigurationConstants.PSML_TEMPLATE_FOLDER);
this.adminUser = config.getString(PortalConfigurationConstants.USERS_DEFAULT_ADMIN);
this.adminRole = config.getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN);
}
-
+
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#registerUser(java.lang.String, java.lang.String)
*/
public void registerUser(String userName, String password)
- throws RegistrationException
- {
- registerUser(userName, password, (List)null, null, null, null, null);
+ throws RegistrationException {
+ registerUser(userName, password, (List) null, null, null, null, null);
}
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#registerUser(java.lang.String, java.lang.String, java.util.List, java.util.List, java.util.Map, java.util.Map, java.lang.String)
*/
public void registerUser(
- String userName,
- String password,
- List roles,
- List groups,
- Map userInfo,
- Map rules,
+ String userName,
+ String password,
+ List<String> roles,
+ List<String> groups,
+ Map<String, String> userInfo,
+ Map<String, String> rules,
String folderTemplate)
- throws RegistrationException
- {
+ throws RegistrationException {
registerUser(userName, password, roles, groups, userInfo, rules, folderTemplate, null);
}
-
+
/* (non-Javadoc)
+
* @see org.apache.jetspeed.administration.PortalAdministration#registerUser(java.lang.String, java.lang.String, java.util.List, java.util.List, java.util.Map, java.util.Map, java.lang.String, java.lang.String)
*/
public void registerUser(
- String userName,
- String password,
- List roles,
- List groups,
- Map userInfo,
- Map rules,
+ String userName,
+ String password,
+ List<String> roles,
+ List<String> groups,
+ Map<String, String> userInfo,
+ Map<String, String> rules,
String folderTemplate,
String subsite)
- throws RegistrationException
- {
+ throws RegistrationException {
registerUser(userName, password, roles, groups, userInfo, rules, folderTemplate, subsite, null, null);
}
-
+
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#registerUser(java.lang.String, java.lang.String, java.util.List, java.util.List, java.util.Map, java.util.Map, java.lang.String, java.lang.String, java.util.Locale, java.lang.String)
*/
public void registerUser(
- String userName,
- String password,
- List roles,
- List groups,
- Map userInfo,
- Map rules,
+ String userName,
+ String password,
+ List<String> roles,
+ List<String> groups,
+ Map<String, String> userInfo,
+ Map<String, String> rules,
String folderTemplate,
String subsite,
Locale locale,
String serverName)
- throws RegistrationException
- {
- try
- {
+ throws RegistrationException {
+ try {
// create the user
- User user = userManager.addUser(userName);
+ User user = userManager.addUser(userName);
PasswordCredential pwc = userManager.getPasswordCredential(user);
pwc.setPassword(null, password);
userManager.storePasswordCredential(pwc);
-
+
// assign roles to user
- if (roles == null || roles.isEmpty())
- {
+ if (roles == null || roles.isEmpty()) {
roles = this.defaultRoles;
}
- if (roles != null)
- {
- Iterator roleList = roles.iterator();
- while (roleList.hasNext())
- {
- String role = (String)roleList.next();
- if (role.trim().length() > 0)
+ if (roles != null) {
+ for (String role : roles) {
+ if (role.trim().length() > 0) {
roleManager.addRoleToUser(userName, role);
+ }
}
}
-
+
// assign groups to user
- if (groups == null || groups.isEmpty())
- {
+ if (groups == null || groups.isEmpty()) {
groups = this.defaultGroups;
}
- if (groups != null)
- {
- Iterator groupsList = groups.iterator();
- while (groupsList.hasNext())
- {
- String group = (String)groupsList.next();
- if (group.trim().length() > 0)
- {
+ if (groups != null) {
+ for (String group : groups) {
+ if (group.trim().length() > 0) {
groupManager.addUserToGroup(userName, group);
}
+
}
}
-
+
// assign user attributes to user
- if (userInfo != null)
- {
+ if (userInfo != null) {
SecurityAttributes userAttrs = user.getSecurityAttributes();
- Iterator info = userInfo.entrySet().iterator();
-
- while (info.hasNext())
- {
- Map.Entry entry = (Map.Entry) info.next();
- userAttrs.getAttribute((String) entry.getKey(), true).setStringValue((String) entry.getValue());
+ for (Map.Entry<String, String> entry : userInfo.entrySet()) {
+ userAttrs.getAttribute(entry.getKey(), true).setStringValue(entry.getValue());
}
}
-
+
// assign profiling rules to user
- if (rules == null || rules.isEmpty())
- {
+ if (rules == null || rules.isEmpty()) {
rules = this.defaultRules;
}
- if (rules != null)
- {
- Iterator ruleEntries = rules.entrySet().iterator();
- while (ruleEntries.hasNext())
- {
- Map.Entry entry = (Map.Entry)ruleEntries.next();
- ProfilingRule rule = profiler.getRule((String)entry.getValue());
- if (rule != null)
- {
- profiler.setRuleForPrincipal(user, rule, (String)entry.getKey());
+ if (rules != null) {
+ for (Map.Entry<String, String> entry : rules.entrySet()) {
+ ProfilingRule rule = profiler.getRule(entry.getValue());
+ if (rule != null) {
+ profiler.setRuleForPrincipal(user, rule, entry.getKey());
}
}
}
// get template folders
- if (folderTemplate == null)
- {
- folderTemplate = this.folderTemplate;
+ if (folderTemplate == null) {
+ folderTemplate = this.folderTemplate;
}
String userFolderPath = null;
- if ((subsite == null) && (serverName != null))
- {
+ if ((subsite == null) && (serverName != null)) {
userFolderPath = invokeGetUserFolderPath(user, locale, serverName);
- }
- else if (subsite != null)
- {
+ } else if (subsite != null) {
userFolderPath = subsite + Folder.USER_FOLDER + userName;
- }
- else
- {
+ } else {
userFolderPath = Folder.USER_FOLDER + userName;
}
-
+
// This next chunk of code is the fancy way to force the creation of the user
// template pages to be created with subject equal to the new user
// otherwise it would be created as guest, and guest does not have enough privs.
@@ -319,137 +282,105 @@ public class PortalAdministrationImpl im
final String innerUserName = userName;
final User innerUser = user;
User powerUser = userManager.getUser(this.adminUser);
- JetspeedException pe = (JetspeedException) JSSubject.doAsPrivileged(userManager.getSubject(powerUser), new PrivilegedAction()
- {
- public Object run()
- {
- try
- {
- if (innerUserFolderPath != null)
- {
- innerUser.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE, true).setStringValue(innerUserFolderPath);
- userManager.updateUser(innerUser);
+ JetspeedException pe = (JetspeedException) JSSubject.doAsPrivileged(userManager.getSubject(powerUser), new PrivilegedAction() {
+ public Object run() {
+ try {
+ if (innerUserFolderPath != null) {
+ innerUser.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE, true).setStringValue(innerUserFolderPath);
+ userManager.updateUser(innerUser);
+ }
+ // ensure user folder parents are created
+ Folder makeFolder = innerPageManager.getFolder("/");
+ for (; ; ) {
+ String path = makeFolder.getPath();
+ if (!path.endsWith("/")) {
+ path += "/";
}
- // ensure user folder parents are created
- Folder makeFolder = innerPageManager.getFolder("/");
- for (;;)
- {
- String path = makeFolder.getPath();
- if (!path.endsWith("/"))
- {
- path += "/";
- }
- if (innerUserFolderPath.startsWith(path))
- {
- String makeFolderName = innerUserFolderPath.substring(path.length());
- int endFolderNameIndex = makeFolderName.indexOf('/');
- if (endFolderNameIndex != -1)
- {
- makeFolderName = makeFolderName.substring(0, endFolderNameIndex);
- String makeFolderPath = path+makeFolderName;
- if (!innerPageManager.folderExists(makeFolderPath))
- {
- makeFolder = innerPageManager.newFolder(makeFolderPath);
- innerPageManager.updateFolder(makeFolder);
- }
- else
- {
- makeFolder = innerPageManager.getFolder(makeFolderPath);
- }
- }
- else
- {
- break;
+ if (innerUserFolderPath.startsWith(path)) {
+ String makeFolderName = innerUserFolderPath.substring(path.length());
+ int endFolderNameIndex = makeFolderName.indexOf('/');
+ if (endFolderNameIndex != -1) {
+ makeFolderName = makeFolderName.substring(0, endFolderNameIndex);
+ String makeFolderPath = path + makeFolderName;
+ if (!innerPageManager.folderExists(makeFolderPath)) {
+ makeFolder = innerPageManager.newFolder(makeFolderPath);
+ innerPageManager.updateFolder(makeFolder);
+ } else {
+ makeFolder = innerPageManager.getFolder(makeFolderPath);
}
+ } else {
+ break;
}
- else
- {
- throw new FolderNotFoundException("Cannot make parent folders for user folder: "+innerUserFolderPath);
- }
+ } else {
+ throw new FolderNotFoundException("Cannot make parent folders for user folder: " + innerUserFolderPath);
}
- // create user's home folder
- // deep copy from the default folder template tree, creating a deep-copy of the template
- // in the new user's folder tree
- Folder source = innerPageManager.getFolder(innerFolderTemplate);
- innerPageManager.deepCopyFolder(source, innerUserFolderPath, innerUserName);
- Folder newFolder = pageManager.getFolder(innerUserFolderPath);
- newFolder.setTitle("My Home Space");
- newFolder.setShortTitle("My Space");
- return null;
- }
- catch (SecurityException s1)
- {
- return s1;
- }
- catch (FolderNotFoundException e1)
- {
- return e1;
}
- catch (InvalidFolderException e1)
- {
- return e1;
- }
- catch (NodeException e1)
- {
- return e1;
- }
+ // create user's home folder
+ // deep copy from the default folder template tree, creating a deep-copy of the template
+ // in the new user's folder tree
+ Folder source = innerPageManager.getFolder(innerFolderTemplate);
+ innerPageManager.deepCopyFolder(source, innerUserFolderPath, innerUserName);
+ Folder newFolder = pageManager.getFolder(innerUserFolderPath);
+ newFolder.setTitle("My Home Space");
+ newFolder.setShortTitle("My Space");
+ return null;
+ } catch (SecurityException s1) {
+ return s1;
+ } catch (FolderNotFoundException e1) {
+ return e1;
+ } catch (InvalidFolderException e1) {
+ return e1;
+ } catch (NodeException e1) {
+ return e1;
}
- }, null);
-
- if(pe != null)
- {
+ }
+ }, null);
+
+ if (pe != null) {
// rollback user creation and cascade roles, groups, etc
- try
- {
- if (userManager.getUser(userName) != null)
- {
+ try {
+ if (userManager.getUser(userName) != null) {
userManager.removeUser(userName);
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
log.error("Registration Error: Failed to rollback user " + userName);
}
log.error("Registration Error: Failed to create user folders for " + userName + ", " + pe.toString());
throw pe;
}
-
- }
- catch (Exception e)
- {
+
+ } catch (Exception e) {
log.error("Registration Error: Failed to create registered user " + userName + ", " + e.toString());
- throw new RegistrationException(e);
- }
+ throw new RegistrationException(e);
+ }
}
-
-
+
+
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#generatePassword()
*/
- public String generatePassword()
- {
+ public String generatePassword() {
return passwordGenerator.generatePassword();
}
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#sendPassword(java.lang.String)
*/
- public void sendEmail(PortletConfig portletConfig,
- String emailAddress,
- String localizedSubject,
+ public void sendEmail(PortletConfig portletConfig,
+ String emailAddress,
+ String localizedSubject,
String localizedTemplatePath,
- Map userAttributes)
- throws AdministrationEmailException
- {
-
+ Map<String, String> userAttributes)
+ throws AdministrationEmailException {
+
String from = config.getString(PortalConfigurationConstants.EMAIL_SENDER);
String subject = localizedSubject;
String to = emailAddress;
String text = mergeEmailTemplate(portletConfig, userAttributes, "map", localizedTemplatePath);
sendEmail(from, subject, to, text);
-
+
}
-
+
/**
* @param from
* @param subject
@@ -457,82 +388,66 @@ public class PortalAdministrationImpl im
* @param text
* @throws AdministrationEmailException
*/
- public void sendEmail(String from, String subject, String to, String text) throws AdministrationEmailException
- {
+ public void sendEmail(String from, String subject, String to, String text) throws AdministrationEmailException {
SimpleMailMessage msg = new SimpleMailMessage();
- if(from == null)
- {
+ if (from == null) {
from = "jetspeed-admin@apache.org";
}
msg.setFrom(from);
- if(subject == null)
- {
+ if (subject == null) {
subject = "message from jetspeed";
}
msg.setSubject(subject);
msg.setTo(to);
msg.setText(text);
-
+
ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
-
- try
- {
- // JS2-1256: Needs to set context classloader to null to let geronimo-javamail find provider class properly.
- Thread.currentThread().setContextClassLoader(null);
+
+ try {
+ // JS2-1256: Needs to set context classloader to null to let geronimo-javamail find provider class properly.
+ Thread.currentThread().setContextClassLoader(null);
mailSender.send(msg);
- }
- catch (MailException ex)
- {
+ } catch (MailException ex) {
throw new AdministrationEmailException(
- "Failed to send forgotten password email to user with email address because "+ex.getMessage(), ex
- ); //+ user.getEmail());
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(currentCL);
+ "Failed to send forgotten password email to user with email address because " + ex.getMessage(), ex
+ ); //+ user.getEmail());
+ } finally {
+ Thread.currentThread().setContextClassLoader(currentCL);
}
}
-
- public String mergeEmailTemplate(PortletConfig portletConfig, Map attributes, String attributesName, String template)
- throws AdministrationEmailException
- {
+
+ public String mergeEmailTemplate(PortletConfig portletConfig, Map<String, String> attributes, String attributesName, String template)
+ throws AdministrationEmailException {
VelocityContext context = new VelocityContext();
context.put(attributesName, attributes);
StringWriter writer = new StringWriter();
-
- try
- {
+
+ try {
String realTemplatePath = portletConfig.getPortletContext().getRealPath(template);
FileReader templateReader = new FileReader(realTemplatePath);
velocityEngine.evaluate(context, writer, "UserEmailProcessor", templateReader);
- } catch (Exception e)
- {
+ } catch (Exception e) {
throw new AdministrationEmailException(
"Failed to generate email text for email template "
+ template, e);
}
-
+
String buffer = writer.getBuffer().toString();
-
+
return buffer;
}
-
+
private static final String USER_NOT_FOUND_FROM_EMAIL = "User not found for Email address: ";
-
+
public User lookupUserFromEmail(String email)
- throws AdministrationEmailException
- {
+ throws AdministrationEmailException {
Collection<User> users;
- try
- {
+ try {
users = userManager.lookupUsers("user.business-info.online.email", email);
- }
- catch (SecurityException e)
- {
- throw new AdministrationEmailException(e);
+ } catch (SecurityException e) {
+ throw new AdministrationEmailException(e);
}
- if (users.isEmpty())
- {
+ if (users.isEmpty()) {
throw new AdministrationEmailException(USER_NOT_FOUND_FROM_EMAIL + email);
}
return users.iterator().next(); // return the first one and hopefully the only (FIXME: need unique constraints)
@@ -541,15 +456,13 @@ public class PortalAdministrationImpl im
/**
* Helper for admin portlets to generate portal urls
*/
- public String getPortalURL(PortletRequest request, PortletResponse response, String path)
- {
+ public String getPortalURL(PortletRequest request, PortletResponse response, String path) {
// get internal request context
RequestContext context = (RequestContext)
- request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+ request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
String baseUrl = context.getPortalURL().getBaseURL();
String basePath = context.getPortalURL().getBasePath();
- if (basePath != null && basePath.endsWith("/action"))
- {
+ if (basePath != null && basePath.endsWith("/action")) {
basePath = basePath.replace("/action", "/desktop");
}
String jetspeedPath = AdminUtil.concatenatePaths(baseUrl, basePath);
@@ -557,97 +470,81 @@ public class PortalAdministrationImpl im
return jetspeedPath;
return AdminUtil.concatenatePaths(jetspeedPath, response.encodeURL(path));
}
-
-
- Map forgottenPasswordData = new HashMap();
+
+
+ Map<String, Map<String, String>> forgottenPasswordData = new HashMap<String, Map<String, String>>();
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#getNewLoginInfo(java.lang.String)
*/
- public Map getNewLoginInfo(String guid)
- {
- synchronized(forgottenPasswordData) {
- return (Map) forgottenPasswordData.get(guid);
+ public Map<String, String> getNewLoginInfo(String guid) {
+ synchronized (forgottenPasswordData) {
+ return forgottenPasswordData.get(guid);
}
}
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#setNewLoginInfo(java.lang.String, org.apache.jetspeed.administration.PortalAdministration.ResetPasswordInfo)
*/
- public void putNewLoginInfo(String guid, Map info)
- {
- synchronized(forgottenPasswordData) {
- forgottenPasswordData.put(guid,info);
+ public void putNewLoginInfo(String guid, Map<String, String> info) {
+ synchronized (forgottenPasswordData) {
+ forgottenPasswordData.put(guid, info);
}
}
-
+
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#removeNewLoginInfo(java.lang.String)
*/
- public void removeNewLoginInfo(String guid)
- {
- synchronized(forgottenPasswordData) {
+ public void removeNewLoginInfo(String guid) {
+ synchronized (forgottenPasswordData) {
forgottenPasswordData.remove(guid);
}
}
-
- public boolean isAdminUser(PortletRequest request)
- {
- if (adminUser == null)
- {
+
+ public boolean isAdminUser(PortletRequest request) {
+ if (adminUser == null) {
throw new IllegalStateException("PortalAdministration component is not started or misconfigured for the default admin user.");
}
-
+
Principal principal = request.getUserPrincipal();
-
- if (principal != null)
- {
+
+ if (principal != null) {
return adminUser.equals(principal.getName());
}
-
+
return false;
}
-
- public boolean isUserInAdminRole(PortletRequest request)
- {
- if (adminRole == null)
- {
+
+ public boolean isUserInAdminRole(PortletRequest request) {
+ if (adminRole == null) {
throw new IllegalStateException("PortalAdministration component is not started or misconfigured for the default admin role.");
}
-
+
return request.isUserInRole(adminRole);
}
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#getUserFolderPath(java.lang.String, java.util.Locale, java.lang.String)
*/
- public String getUserFolderPath(String userName, Locale locale, String serverName)
- {
- try
- {
+ public String getUserFolderPath(String userName, Locale locale, String serverName) {
+ try {
User user = userManager.getUser(userName);
return invokeGetUserFolderPath(user, locale, serverName);
- }
- catch (Exception e)
- {
- log.error("Unexpected exception getting user folder path for "+userName+": "+e, e);
+ } catch (Exception e) {
+ log.error("Unexpected exception getting user folder path for " + userName + ": " + e, e);
return null;
- }
+ }
}
/* (non-Javadoc)
* @see org.apache.jetspeed.administration.PortalAdministration#getBaseFolderPath(java.lang.String, java.util.Locale, java.lang.String)
*/
- public String getBaseFolderPath(String userName, Locale locale, String serverName)
- {
- try
- {
+ public String getBaseFolderPath(String userName, Locale locale, String serverName) {
+ try {
User user = userManager.getUser(userName);
return invokeGetBaseFolderPath(user, locale, serverName);
- }
- catch (Exception e)
- {
- log.error("Unexpected exception getting base folder path for "+userName+": "+e, e);
+ } catch (Exception e) {
+ log.error("Unexpected exception getting base folder path for " + userName + ": " + e, e);
return null;
}
}
@@ -657,79 +554,64 @@ public class PortalAdministrationImpl im
* running full profiler and portal site rules within a
* JSSubject.doAsPrivileged() block with a subject matching
* the specified user.
- *
- * @param user existing portal user
- * @param locale optional locale, (defaults to system locale, for language
- * profiling rules)
+ *
+ * @param user existing portal user
+ * @param locale optional locale, (defaults to system locale, for language
+ * profiling rules)
* @param serverName server name, (required for subsite profiling rules)
* @return PSML user folder path
* @throws Exception
*/
- private String invokeGetUserFolderPath(final User user, final Locale locale, final String serverName) throws Exception
- {
- if (config.getString(PortalConfigurationConstants.JETUI_CUSTOMIZATION_METHOD).equals(PortalConfigurationConstants.JETUI_CUSTOMIZATION_AJAX))
- {
- return Folder.USER_FOLDER + user.getName();
- }
- Object doneAs = JSSubject.doAsPrivileged(userManager.getSubject(user), new PrivilegedAction()
- {
- public Object run()
- {
- try
- {
+ private String invokeGetUserFolderPath(final User user, final Locale locale, final String serverName) throws Exception {
+ if (config.getString(PortalConfigurationConstants.JETUI_CUSTOMIZATION_METHOD).equals(PortalConfigurationConstants.JETUI_CUSTOMIZATION_AJAX)) {
+ return Folder.USER_FOLDER + user.getName();
+ }
+ Object doneAs = JSSubject.doAsPrivileged(userManager.getSubject(user), new PrivilegedAction() {
+ public Object run() {
+ try {
PortalSiteRequestContext requestContext = getMockPortalSiteRequestContext(user, locale, serverName);
return requestContext.getUserFolderPath();
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
return e;
}
}
}, null);
- if (doneAs instanceof Exception)
- {
- throw (Exception)doneAs;
+ if (doneAs instanceof Exception) {
+ throw (Exception) doneAs;
}
- return (String)doneAs;
+ return (String) doneAs;
}
-
+
/**
* Returns PSML base folder path for specified user by
* running full profiler and portal site rules within a
* JSSubject.doAsPrivileged() block with a subject matching
* the specified user.
- *
- * @param user existing portal user
- * @param locale optional locale, (defaults to system locale, for language
- * profiling rules)
+ *
+ * @param user existing portal user
+ * @param locale optional locale, (defaults to system locale, for language
+ * profiling rules)
* @param serverName server name, (required for subsite profiling rules)
* @return PSML base folder path
* @throws Exception
*/
- private String invokeGetBaseFolderPath(final User user, final Locale locale, final String serverName) throws Exception
- {
- Object doneAs = JSSubject.doAsPrivileged(userManager.getSubject(user), new PrivilegedAction()
- {
- public Object run()
- {
- try
- {
+ private String invokeGetBaseFolderPath(final User user, final Locale locale, final String serverName) throws Exception {
+ Object doneAs = JSSubject.doAsPrivileged(userManager.getSubject(user), new PrivilegedAction() {
+ public Object run() {
+ try {
PortalSiteRequestContext requestContext = getMockPortalSiteRequestContext(user, locale, serverName);
return requestContext.getBaseFolderPath();
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
return e;
}
}
}, null);
- if (doneAs instanceof Exception)
- {
- throw (Exception)doneAs;
+ if (doneAs instanceof Exception) {
+ throw (Exception) doneAs;
}
- return (String)doneAs;
+ return (String) doneAs;
}
-
+
/**
* Returns temporary mock portal site request context for
* specified user for use in constructing user or base PSML
@@ -737,37 +619,33 @@ public class PortalAdministrationImpl im
* method invocation should be wrapped in a
* JSSubject.doAsPrivileged() block with a subject matching
* the specified user.
- *
- * @param user portal user
- * @param locale optional locale, (defaults to system locale, for language
- * profiling rules)
+ *
+ * @param user portal user
+ * @param locale optional locale, (defaults to system locale, for language
+ * profiling rules)
* @param serverName server name, (required for subsite profiling rules)
* @return portal site request context
* @throws Exception
*/
- private PortalSiteRequestContext getMockPortalSiteRequestContext(User user, Locale locale, String serverName) throws Exception
- {
+ private PortalSiteRequestContext getMockPortalSiteRequestContext(User user, Locale locale, String serverName) throws Exception {
// setup profiler and portal site to determine template
// folders paths generate mock request for new user to profile
RequestContext request = new MockRequestContext("/");
request.setSubject(userManager.getSubject(user));
request.setLocale((locale != null) ? locale : Locale.getDefault());
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
- if (serverName != null)
- {
+ if (serverName != null) {
servletRequest.setServerName(serverName);
}
request.setRequest(servletRequest);
// get profile locators map for new user request, (taken from
// ProfilerValveImpl)
- Map locators = profiler.getProfileLocators(request , user);
- if (locators.size() == 0)
- {
- locators = profiler.getDefaultProfileLocators(request);
+ Map<String, ProfileLocator> locators = profiler.getProfileLocators(request, user);
+ if (locators.size() == 0) {
+ locators = profiler.getDefaultProfileLocators(request);
}
- if (locators.size() == 0)
- {
+ if (locators.size() == 0) {
locators.put(ProfileLocator.PAGE_LOCATOR, profiler.getProfile(request, ProfileLocator.PAGE_LOCATOR));
}
@@ -775,5 +653,5 @@ public class PortalAdministrationImpl im
// component using the profile locators for new user request
PortalSiteSessionContext sessionContext = portalSite.newSessionContext();
return sessionContext.newRequestContext(locators, user.getName());
- }
+ }
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java Thu Jul 25 23:59:57 2013
@@ -40,7 +40,7 @@ public class CreatePageValveImpl extends
/**
* CreatePageValveImpl - constructor
*
- * @param securityBehavior the behavior to create new page for new user
+ * @param behavior the behavior to create new page for new user
*/
public CreatePageValveImpl(PortletActionSecurityBehavior behavior)
{
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreateUserTemplatePagesValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreateUserTemplatePagesValveImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreateUserTemplatePagesValveImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreateUserTemplatePagesValveImpl.java Thu Jul 25 23:59:57 2013
@@ -24,9 +24,7 @@ import org.apache.jetspeed.pipeline.Pipe
import org.apache.jetspeed.pipeline.valve.ValveContext;
import org.apache.jetspeed.portalsite.PortalSite;
import org.apache.jetspeed.profiler.Profiler;
-import org.apache.jetspeed.profiler.impl.ProfilerValveImpl;
import org.apache.jetspeed.request.RequestContext;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,7 +56,7 @@ public class CreateUserTemplatePagesValv
* @param portalSite portal site component reference
* @param pageLayoutComponent page layout component reference
* @param requestFallback flag to enable root folder fallback
- * @param useHistory flag to enable selection of last visited folder page
+ * @param useHistoryPageManager flag to enable selection of last visited folder page
* @param pageManager pageManagerComponent reference
*/
public CreateUserTemplatePagesValveImpl(Profiler profiler, PortalSite portalSite, PageLayoutComponent pageLayoutComponent,
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java Thu Jul 25 23:59:57 2013
@@ -16,10 +16,6 @@
*/
package org.apache.jetspeed.profiler.impl;
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.layout.PageLayoutComponent;
import org.apache.jetspeed.page.document.NodeNotFoundException;
@@ -32,6 +28,10 @@ import org.apache.jetspeed.profiler.Prof
import org.apache.jetspeed.profiler.ProfilerException;
import org.apache.jetspeed.request.RequestContext;
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* ProfilerValveImpl
*
@@ -96,14 +96,14 @@ public class ProfilerValveImpl extends A
protected void setRequestPage(RequestContext request, String requestPath, Principal requestUserPrincipal) throws NodeNotFoundException, ProfilerException
{
// get request specific profile locators if required
- Map locators = null;
+ Map<String,ProfileLocator> locators = null;
String locatorName = (String)request.getAttribute(PROFILE_LOCATOR_REQUEST_ATTR_KEY);
if ( locatorName != null )
{
ProfileLocator locator = profiler.getProfile(request,locatorName);
if ( locator != null )
{
- locators = new HashMap();
+ locators = new HashMap<String,ProfileLocator>();
locators.put(ProfileLocator.PAGE_LOCATOR, locator);
}
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java?rev=1507157&r1=1507156&r2=1507157&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/administration/TestPortalAdministrationImpl.java Thu Jul 25 23:59:57 2013
@@ -16,33 +16,20 @@
*/
package org.apache.jetspeed.administration;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.NoSuchProviderException;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.URLName;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.apache.jetspeed.aggregator.TestWorkerMonitor;
import org.springframework.mail.javamail.JavaMailSenderImpl;
+import javax.mail.*;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.*;
+
/**
* TestPortalAdministrationImpl
*
@@ -178,9 +165,9 @@ public class TestPortalAdministrationImp
PortalAdministrationImpl pai = new PortalAdministrationImpl(null,null,null,null,null,null,null,null);
String user = "user"+(Math.abs(new Date().getTime()));
String password = "password";
- List emptyList = new ArrayList();
- Map emptyMap = new HashMap();
- Map userAttributes = new HashMap();
+ List<String> emptyList = new ArrayList<String>();
+ Map<String,String> emptyMap = new HashMap<String,String>();
+ Map<String,String> userAttributes = new HashMap<String,String>();
String emailTemplate = "";
pai.registerUser(user,
password,
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org