JBoss Portal SVN: r6805 - in trunk: core and 4 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-23 09:58:47 -0400 (Fri, 23 Mar 2007)
New Revision: 6805
Added:
trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/
trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/
trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate.tpl
trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate_fr.tpl
Modified:
trunk/build/build-thirdparty.xml
trunk/core/.classpath
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties
Log:
Email verification using a template
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/build/build-thirdparty.xml 2007-03-23 13:58:47 UTC (rev 6805)
@@ -107,7 +107,8 @@
<componentref name="sun-opends" version="snapshot"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="xdoclet" version="1.2.3"/>
- <componentref name="jbpm/jaronly" version="3.1.2"/>
+ <componentref name="jbpm/jaronly" version="3.1.2"/>
+ <componentref name="freemarker" version="2.3.9"/>
<componentref name="wutka-dtdparser" version="1.2.1"/>
</build>
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/.classpath 2007-03-23 13:58:47 UTC (rev 6805)
@@ -49,5 +49,6 @@
<classpathentry kind="lib" path="/thirdparty/jbpm/jaronly/lib/jbpm.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet-server"/>
<classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/freemarker/lib/freemarker.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/build.xml 2007-03-23 13:58:47 UTC (rev 6805)
@@ -91,6 +91,7 @@
<path refid="jboss.cache.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
+ <path refid="freemarker.freemarker.classpath"/>
<path refid="apache.ant.classpath"/>
<path refid="apache.myfaces.classpath"/>
<path refid="apache.log4j.classpath"/>
@@ -337,6 +338,7 @@
<fileset dir="${javassist.javassist.lib}" includes="javassist.jar"/>
<fileset dir="${apache.fileupload.lib}" includes="commons-fileupload.jar"/>
<fileset dir="${jakarta.io.lib}" includes="commons-io.jar"/>
+ <fileset dir="${freemarker.freemarker.lib}" includes="freemarker.jar"/>
<fileset dir="${portals.bridges.lib}" includes="portals-bridges-common.jar"/>
</copy>
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-23 13:58:47 UTC (rev 6805)
@@ -22,16 +22,21 @@
******************************************************************************/
package org.jboss.portal.core.portlet.user;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.io.StringWriter;
import java.net.URL;
+import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
+import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
-import java.util.Date;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -59,7 +64,6 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.identity.config.metadata.profile.ProfileMetaData;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ThemeInfo;
import org.jboss.portal.theme.ThemeService;
@@ -69,6 +73,10 @@
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
/**
* This portlet aims at managing users
*
@@ -1050,8 +1058,6 @@
// gen link using username, encrypted pw, and a salt.
String hash = Tools.md5AsHexString(user.getUserName() + getProperty(user, User.INFO_USER_REGISTRATION_DATE).toString() + UserPortletConstants.SALT);
- String rootURL = getPortletConfig().getInitParameter("emailDomain");
-
PortalNode node = req.getPortalNode();
//PortalNodeURL link = resp.createActionURL(node);
@@ -1061,72 +1067,49 @@
link.setParameter(UserPortletConstants.HASH, hash);
link.setRelative(false);
- // TODO: refactor to have a simple text file outside the code that can be
- // easily changed
+ // Fill data to share with the template
+ Map modelRoot = new HashMap();
+ modelRoot.put("emailDomain", getPortletConfig().getInitParameter("emailDomain"));
+ modelRoot.put("id", user.getId());
+ modelRoot.put("username", user.getUserName());
+ modelRoot.put("password", clearPassword);
+ modelRoot.put("activationLink", link);
- StringBuffer sb = new StringBuffer();
- Locale locale = req.getLocale();
- ResourceBundle bundle = getResourceBundle(locale);
- try
- {
- sb.append(bundle.getString("VALIDATIONEMAIL_1")).append(" - ");
- sb.append(rootURL);
- sb.append("\n\n");
- sb.append(bundle.getString("VALIDATIONEMAIL_2")).append(":\n\n");
- sb.append("----------------------------\n");
- sb.append(bundle.getString("USERNAME")).append(": ").append(user.getUserName()).append("\n");
- sb.append(bundle.getString("PASSWORD")).append(": ").append(clearPassword).append("\n");
- sb.append("----------------------------\n\n");
- sb.append(bundle.getString("VALIDATIONEMAIL_3")).append(": \n");
- sb.append(link);
- sb.append("\n\n");
- sb.append(bundle.getString("VALIDATIONEMAIL_4"));
- sb.append("\n\n");
- sb.append(bundle.getString("VALIDATIONEMAIL_5")).append("\n");
- }
- catch (Exception e)
- {
- log.error("Cannot generate an email notification", e);
- }
-
- return sb.toString();
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param req DOCUMENT_ME
- * @param resp DOCUMENT_ME
- */
- /*
- public void activate(JBossActionRequest req,
- JBossActionResponse resp)
- {
- String hash = req.getParameter(UserPortletConstants.HASH);
- String userId = req.getParameters().getParameter(UserPortletConstants.USERID);
-
- User user;
- try
- {
- user = userModule.findUserById(userId);
- String hexCompare = Tools.md5AsHexString(user.getUserName() + getProperty(user, User.INFO_USER_REGISTRATION_DATE).toString() + UserPortletConstants.SALT);
- if (hash.equals(hexCompare))
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ String message = null;
+ try {
+ Locale locale = req.getLocale();
+ URL config = tcl.getResource("templates/user/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry()+ ".tpl");
+ if (config == null)
{
- //user.setEnabled(true);
- setProperty(user, User.INFO_USER_ENABLED, Boolean.valueOf(true));
- portletHelper.setI18nRenderParameter(req, resp, UserPortletConstants.INFOMESSAGE, "INFOMESSAGE_CONGRATULATIONACTIVATED");
+ config = tcl.getResource("templates/user/emailTemplate_" + locale.getLanguage() + ".tpl");
}
- else
+ if (config == null)
{
- portletHelper.setI18nRenderParameter(req, resp, UserPortletConstants.ERRORMESSAGE, "ERRORMESSAGE_UNABLEACTIVATE");
+ config = tcl.getResource("templates/user/emailTemplate.tpl");
}
+ if (config == null)
+ {
+ throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl in templates/user");
+ }
+ InputStream in = config.openStream();
+ Template tpl = new Template("emailTemplate", new InputStreamReader(in), new Configuration());
+ StringWriter out = new StringWriter();
+ tpl.process(modelRoot, out);
+ out.close();
+ message = out.toString();
}
- catch (Exception e)
+ catch (IOException e1)
{
- portletHelper.setI18nRenderParameter(req, resp, UserPortletConstants.ERRORMESSAGE, "ERRORMESSAGE_UNABLEACTIVATE");
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (TemplateException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+
+ return message;
}
- */
private String getFirstName(ResourceBundle bundle, User user)
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-03-23 13:58:47 UTC (rev 6805)
@@ -305,12 +305,6 @@
ROLE_TEXT_1=Use this portlet to create, edit, delete and add users to roles.
ROLE_TEXT_2=These roles are used in the Management Portlet to set access rights.
-VALIDATIONEMAIL_1=A user with this email address has registered on our site.
-VALIDATIONEMAIL_2=Please keep this email for your records. Your account information is as follows
-VALIDATIONEMAIL_3=Your account is currently inactive. You cannot use it until you visit the following link
-VALIDATIONEMAIL_4=If you did not register for membership on our site, no further action is required.
-VALIDATIONEMAIL_5=Regards,\nThe staff.
-
PERMISSION_PICKPORTLET=Portlet Permissions Administration
PERMISSION_PERMISSIONS=Permissions to modify
PERMISSION_TOP=Select a Component to Modify
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2007-03-23 13:58:47 UTC (rev 6805)
@@ -286,12 +286,6 @@
MENU_EDITROLE=Editar un rol existente
MENU_EDITROLEMEMBERS=Editar los miembros de un rol
-VALIDATIONEMAIL_1=Un usuario con esta direcci�n de email se ha registado en nuestro sitio.
-VALIDATIONEMAIL_2=Por favor, mantenga este correo para su registro. La informaci�n de su cuenta es la siguiente
-VALIDATIONEMAIL_3=Su cuenta est� actualmente inactiva. No puede usarla hasta que visite el siguiente enlace
-VALIDATIONEMAIL_4=Si no se ha registrado como miembro en nuestro sitio, no es necesario que haga nada m�s.
-VALIDATIONEMAIL_5=Saludos,\nEl personal.
-
PERMISSION_PICKPORTLET=Permisos de administraci�n de portlets
PERMISSION_PERMISSIONS=Permisos para modificaci�n
PERMISSION_TOP=Elegir un componente para modificar
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2007-03-23 13:58:47 UTC (rev 6805)
@@ -254,11 +254,6 @@
MENU_CREATEROLE=Creer nouveau role
MENU_EDITROLE=Editer un role existant
-VALIDATIONEMAIL_1=Un utilisateur s'est enregistre avec cette adresse email.
-VALIDATIONEMAIL_2=Merci de garder cet email. Vos informations sont les suivantes
-VALIDATIONEMAIL_3=Votre compte est desactive pour le moment. Vous en pouvez pas l'utiliser tant que vous n'aurez pas clique sur le lien suivant
-VALIDATIONEMAIL_4=Si vous n'avez pas demande a etre membre, ne faite rien.
-VALIDATIONEMAIL_5=Cordialement.
TITLE_FILEBROWSE=Explorateur de fichier
_ASREGISTERED=Vous n'avez pas de compte? vous pouvez en cr\u00E9er <a href\="">un</a>.
Question=Question secr\u00E8te
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties 2007-03-23 10:31:03 UTC (rev 6804)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties 2007-03-23 13:58:47 UTC (rev 6805)
@@ -284,12 +284,6 @@
MENU_EDITROLE=Editar grupo
MENU_EDITROLEMEMBERS=Editar membros do grupo
-VALIDATIONEMAIL_1=Um usu�rio com este endere�o de email j� existe em nosso sistema.
-VALIDATIONEMAIL_2=Mantenha esse email salvo. As informa��es de sua conta est�o a seguir
-VALIDATIONEMAIL_3=Sua conta esta atualmente inativa. Voc� n�o pode utiliz�-la at� visitar o link
-VALIDATIONEMAIL_4=Se voc� n�o se cadastrar em nosso site, nenhuma outra a��o � necess�ria.
-VALIDATIONEMAIL_5=Atenciosamente,\nA Ger�ncia.
-
PERMISSION_PICKPORTLET=Administra��o de Permiss�es de Portlet
PERMISSION_PERMISSIONS=Permiss�es para modificar
PERMISSION_TOP=Selecione um Componente para Modificar
Added: trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate.tpl
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate.tpl (rev 0)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate.tpl 2007-03-23 13:58:47 UTC (rev 6805)
@@ -0,0 +1,15 @@
+Hello,
+
+you tried to create an account on ${emailDomain}
+
+The user information are written here for your convenience:
+Username: ${username}
+Password: ${password}
+
+At this time, your account is not activated and you will need to access the following URL to be able to login.
+${activationLink}
+
+If you didn't ask to create an account, we apologize and no further action is required.
+
+Best regards,
+${emailDomain}
Added: trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate_fr.tpl
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate_fr.tpl (rev 0)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/templates/user/emailTemplate_fr.tpl 2007-03-23 13:58:47 UTC (rev 6805)
@@ -0,0 +1,15 @@
+Bonjour
+
+vous avez créé un compte sur ${emailDomain}
+
+Voici les informations de connexion relatives a ce compte:
+Identifiant: ${username}
+Mot de passe: ${password}
+
+Votre compte n'est pas actif pour le moment et vous devez vous rendre à l'adresse suivante pour l'activer.
+${activationLink}
+
+Si vous n'avez pas créé de compte, nous vous prions de bien vouloir nous excuser et vous pouvez simplement ignorer cet email.
+
+Cordialement,
+${emailDomain}
17 years, 3 months
JBoss Portal SVN: r6804 - trunk/core/src/main/org/jboss/portal/core/portlet/user.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-23 06:31:03 -0400 (Fri, 23 Mar 2007)
New Revision: 6804
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
Log:
When an admin creates a user, bypass the email verification and enable the user automatically
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-23 08:55:44 UTC (rev 6803)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-23 10:31:03 UTC (rev 6804)
@@ -725,7 +725,7 @@
subscriptionMode = UserPortletConstants.SUBSCRIPTIONMODE_AUTOMATIC;
}
- if (UserPortletConstants.SUBSCRIPTIONMODE_AUTOMATIC.equals(subscriptionMode))
+ if (UserPortletConstants.SUBSCRIPTIONMODE_AUTOMATIC.equals(subscriptionMode) || req.isUserInRole("Admin"))
{
setProperty(user, User.INFO_USER_ENABLED, Boolean.TRUE);
}
17 years, 3 months
JBoss Portal SVN: r6803 - in trunk: core/src/main/org/jboss/portal/core/portlet/user and 12 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-23 04:55:44 -0400 (Fri, 23 Mar 2007)
New Revision: 6803
Added:
trunk/identity/src/main/org/jboss/portal/identity/UserStatus.java
Modified:
trunk/core-samples/
trunk/core-samples/.classpath
trunk/core/.classpath
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-sar/conf/login-config.xml
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
trunk/core/src/resources/portal-server-war/error.jsp
trunk/identity/.classpath
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
trunk/jems/.classpath
trunk/portlet-server/
trunk/registration/.classpath
Log:
- Display warning message when a user updates his profile (taken into account at the next login)
- Email verification on sign up working again
- Disabling a user is now possible
- Eclipse files update
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/.classpath 2007-03-23 08:55:44 UTC (rev 6803)
@@ -48,5 +48,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/portlet-federation"/>
<classpathentry kind="lib" path="/thirdparty/jbpm/jaronly/lib/jbpm.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet-server"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-23 08:55:44 UTC (rev 6803)
@@ -23,7 +23,9 @@
package org.jboss.portal.core.portlet.user;
import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
+import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
@@ -57,6 +59,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.config.metadata.profile.ProfileMetaData;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ThemeInfo;
import org.jboss.portal.theme.ThemeService;
@@ -327,6 +330,10 @@
{
ctx.next("admin");
}
+ if (req.getParameter("modifiedProfile") != null)
+ {
+ ctx.next("modifiedProfile");
+ }
req.setAttribute(PortalJsp.CTX_REQUEST, ctx);
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/user/menu.jsp");
rd.include(req, resp);
@@ -522,7 +529,7 @@
// User is not logged in
op = req.getParameters().get(getOperationName(), OP_SHOWLOGIN);
- if (req.getWindowState() != WindowState.MAXIMIZED && ! OP_SHOWREGISTER_TY.equals(op))
+ if (req.getWindowState() != WindowState.MAXIMIZED && ! OP_SHOWREGISTER_TY.equals(op) && ! OP_ACTIVATEUSER.equals(op))
{
op = OP_SHOWLOGIN;
}
@@ -552,7 +559,7 @@
try
{
user = userModule.findUserById(userId);
- String hexCompare = Tools.md5AsHexString(user.getUserName() + getProperty(user,User.INFO_USER_REGISTRATION_DATE) + UserPortletConstants.SALT);
+ String hexCompare = Tools.md5AsHexString(user.getUserName() + getProperty(user,User.INFO_USER_REGISTRATION_DATE).toString() + UserPortletConstants.SALT);
if (hash.equals(hexCompare))
{
setProperty(user, User.INFO_USER_ENABLED, Boolean.TRUE);
@@ -956,6 +963,7 @@
// Set back to normal window state
resp.setWindowState(WindowState.NORMAL);
+ portletHelper.setRenderParameter(resp, "modifiedProfile", "true");
portletHelper.setRenderParameter(resp, getOperationName(), OP_SHOWMENU);
}
else
@@ -989,6 +997,7 @@
portletHelper.setRenderParameter(resp, "EXTRA", extra);
portletHelper.setRenderParameter(resp, getOperationName(), OP_SHOWPROFILE);
}
+
}
/**
@@ -1040,10 +1049,11 @@
{
// gen link using username, encrypted pw, and a salt.
String hash = Tools.md5AsHexString(user.getUserName() + getProperty(user, User.INFO_USER_REGISTRATION_DATE).toString() + UserPortletConstants.SALT);
-
+
String rootURL = getPortletConfig().getInitParameter("emailDomain");
PortalNode node = req.getPortalNode();
+
//PortalNodeURL link = resp.createActionURL(node);
PortalNodeURL link = resp.createRenderURL(node);
link.setParameter("op", OP_ACTIVATEUSER);
@@ -1053,6 +1063,7 @@
// TODO: refactor to have a simple text file outside the code that can be
// easily changed
+
StringBuffer sb = new StringBuffer();
Locale locale = req.getLocale();
ResourceBundle bundle = getResourceBundle(locale);
@@ -1087,6 +1098,7 @@
* @param req DOCUMENT_ME
* @param resp DOCUMENT_ME
*/
+ /*
public void activate(JBossActionRequest req,
JBossActionResponse resp)
{
@@ -1114,6 +1126,7 @@
portletHelper.setI18nRenderParameter(req, resp, UserPortletConstants.ERRORMESSAGE, "ERRORMESSAGE_UNABLEACTIVATE");
}
}
+ */
private String getFirstName(ResourceBundle bundle, User user)
{
Modified: trunk/core/src/resources/portal-core-sar/conf/login-config.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/login-config.xml 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/src/resources/portal-core-sar/conf/login-config.xml 2007-03-23 08:55:44 UTC (rev 6803)
@@ -42,6 +42,7 @@
<module-option name="unauthenticatedIdentity">guest</module-option>
<module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
<module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
+ <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
<module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
<module-option name="additionalRole">Authenticated</module-option>
<module-option name="password-stacking">useFirstPass</module-option>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-03-23 08:55:44 UTC (rev 6803)
@@ -177,6 +177,8 @@
NAMENOTAVAILABLE=N/A
+MODIFIED_PROFILE=Your profile has been modified, the portal will be running with your former profile until you log back in.
+
# Registration
REGISTER_NOT_LOGGED_IN=You are currently not logged in.
REGISTER_REGISTER=You can create an account.
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
===================================================================
(Binary files differ)
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-23 08:55:44 UTC (rev 6803)
@@ -40,10 +40,10 @@
<init-param>
<description>Subscription mode</description>
<name>subscriptionMode</name>
+ <value>emailVerification</value>
<!--
- <value>emailVerification</value>
+ <value>automatic</value>
-->
- <value>automatic</value>
</init-param>
<init-param>
<description>Domain of your website for email verification.</description>
Modified: trunk/core/src/resources/portal-server-war/error.jsp
===================================================================
--- trunk/core/src/resources/portal-server-war/error.jsp 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core/src/resources/portal-server-war/error.jsp 2007-03-23 08:55:44 UTC (rev 6803)
@@ -59,7 +59,7 @@
<!-- REAL CONTENT CELL : begin -->
<td style="background-color:#b4b4b4" align="center">
<b>JBoss Portal Login</b><br/><br/>
- <p style="color:red">Login failed !</p>
+ <p style="color:red"><%= request.getAttribute("org.jboss.portal.loginError") %></p>
<table>
<tr>
<td align="right" width="50">
Property changes on: trunk/core-samples
___________________________________________________________________
Name: svn:ignore
- output
+ output
bin
Modified: trunk/core-samples/.classpath
===================================================================
--- trunk/core-samples/.classpath 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/core-samples/.classpath 2007-03-23 08:55:44 UTC (rev 6803)
@@ -10,5 +10,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/identity"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
<classpathentry combineaccessrules="false" kind="src" path="/theme"/>
+ <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-j2ee.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/identity/.classpath
===================================================================
--- trunk/identity/.classpath 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/identity/.classpath 2007-03-23 08:55:44 UTC (rev 6803)
@@ -21,5 +21,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/jbossxb/lib/jboss-xml-binding.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/identity/build.xml 2007-03-23 08:55:44 UTC (rev 6803)
@@ -89,6 +89,7 @@
<!-- Configure thirdparty libraries -->
&libraries;
<path id="library.classpath">
+ <path refid="sun.servlet.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="apache.xerces.classpath"/>
Added: trunk/identity/src/main/org/jboss/portal/identity/UserStatus.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/UserStatus.java (rev 0)
+++ trunk/identity/src/main/org/jboss/portal/identity/UserStatus.java 2007-03-23 08:55:44 UTC (rev 6803)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 5907 $
+ */
+
+public class UserStatus {
+
+ public static UserStatus OK = new UserStatus(0);
+ public static UserStatus DISABLE = new UserStatus(1);
+ public static UserStatus UNEXISTING = new UserStatus(2);
+ public static UserStatus NOTASSIGNEDTOROLE = new UserStatus(3);
+ public static UserStatus WRONGPASSWORD = new UserStatus(4);
+
+ private int value;
+
+ private UserStatus(int value)
+ {
+ this.value = value;
+ }
+
+}
Modified: trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2007-03-23 08:55:44 UTC (rev 6803)
@@ -29,6 +29,8 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.UserStatus;
import org.jboss.security.SimpleGroup;
import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
@@ -37,6 +39,8 @@
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
+import javax.security.jacc.PolicyContext;
+import javax.servlet.http.HttpServletRequest;
import javax.transaction.TransactionManager;
import java.security.Principal;
import java.security.acl.Group;
@@ -46,18 +50,24 @@
/**
* A login module that uses the user module.
- *
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
*/
-public class IdentityLoginModule
- extends UsernamePasswordLoginModule
+public class IdentityLoginModule extends UsernamePasswordLoginModule
{
protected String userModuleJNDIName;
+
protected String roleModuleJNDIName;
+
+ protected String userProfileModuleJNDIName;
+
protected String membershipModuleJNDIName;
+
protected String additionalRole;
+
protected String havingRole;
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
@@ -65,22 +75,30 @@
super.initialize(subject, callbackHandler, sharedState, options);
// Get data
- userModuleJNDIName = (String)options.get("userModuleJNDIName");
- roleModuleJNDIName = (String)options.get("roleModuleJNDIName");
- membershipModuleJNDIName = (String)options.get("membershipModuleJNDIName");
- additionalRole = (String)options.get("additionalRole");
- havingRole = (String)options.get("havingRole");
+ userModuleJNDIName = (String) options.get("userModuleJNDIName");
+ roleModuleJNDIName = (String) options.get("roleModuleJNDIName");
+ userProfileModuleJNDIName = (String) options
+ .get("userProfileModuleJNDIName");
+ membershipModuleJNDIName = (String) options
+ .get("membershipModuleJNDIName");
+ additionalRole = (String) options.get("additionalRole");
+ havingRole = (String) options.get("havingRole");
// Some info
log.trace("userModuleJNDIName = " + userModuleJNDIName);
log.trace("roleModuleJNDIName = " + roleModuleJNDIName);
+ log.trace("userProfileModuleJNDIName = " + userProfileModuleJNDIName);
log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
log.trace("additionalRole = " + additionalRole);
log.trace("havingRole = " + havingRole);
}
private UserModule userModule;
+
private RoleModule roleModule;
+
+ private UserProfileModule userProfileModule;
+
private MembershipModule membershipModule;
protected UserModule getUserModule() throws NamingException
@@ -102,6 +120,16 @@
return roleModule;
}
+ protected UserProfileModule getUserProfileModule() throws NamingException
+ {
+
+ if (userProfileModule == null) {
+ userProfileModule = (UserProfileModule) new InitialContext()
+ .lookup(userProfileModuleJNDIName);
+ }
+ return userProfileModule;
+ }
+
protected MembershipModule getMembershipModule() throws NamingException
{
@@ -119,57 +147,40 @@
protected boolean validatePassword(final String inputPassword, String expectedPassword)
{
- Boolean isValid = Boolean.FALSE;
if (inputPassword != null)
{
try
{
try
{
- TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
- isValid = (Boolean)Transactions.required(tm, new Transactions.Runnable()
+ HttpServletRequest request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
+
+ UserStatus userStatus = getUserStatus(inputPassword);
+
+ if (userStatus == UserStatus.DISABLE)
{
- public Object run() throws Exception
- {
- try
- {
- User user = getUserModule().findUserByUserName(getUsername());
- //in case module implementation doesn't throw proper exception...
- if (user == null)
- {
- throw new NoSuchUserException("UserModule returned null user object");
- }
- if (havingRole != null)
- {
- boolean hasTheRole = false;
- Set roles = getMembershipModule().getRoles(user);
- for (Iterator i = roles.iterator(); i.hasNext();)
- {
- Role role = (Role)i.next();
- if (havingRole.equals(role.getName()))
- {
- hasTheRole = true;
- break;
- }
- }
- if (!hasTheRole)
- {
- return Boolean.FALSE;
- }
- }
- return Boolean.valueOf(user.validatePassword(inputPassword));
- }
- catch (NoSuchUserException e)
- {
- //TODO: log or throw
- }
- catch (Exception e)
- {
- throw new LoginException(e.toString());
- }
- return Boolean.FALSE;
- }
- });
+ request.setAttribute("org.jboss.portal.loginError", "Your account is disabled");
+ return false;
+ }
+ else if (userStatus == UserStatus.NOTASSIGNEDTOROLE)
+ {
+ request.setAttribute("org.jboss.portal.loginError", "The user doesn't have the correct role");
+ return false;
+ }
+ else if ((userStatus == UserStatus.UNEXISTING) || userStatus == UserStatus.WRONGPASSWORD)
+ {
+ request.setAttribute("org.jboss.portal.loginError", "The user doesn't exist or the password is incorrect");
+ return false;
+ }
+ else if (userStatus == UserStatus.OK)
+ {
+ return true;
+ }
+ else
+ {
+ log.error("Unexpected error while logging in");
+ return false;
+ }
}
catch (Exception e)
{
@@ -181,60 +192,128 @@
log.debug("Failed to validate password", e);
}
}
- return Boolean.TRUE.equals(isValid);
+ return false;
}
- protected Group[] getRoleSets() throws LoginException
+ protected UserStatus getUserStatus(final String inputPassword)
{
- try
- {
+ UserStatus result = UserStatus.OK;
+
+ try {
TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
- return (Group[])Transactions.required(tm, new Transactions.Runnable()
+ UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
{
public Object run() throws Exception
{
try
{
User user = getUserModule().findUserByUserName(getUsername());
+ // in case module implementation doesn't throw proper
+ // exception...
+ if (user == null)
+ {
+ throw new NoSuchUserException("UserModule returned null user object");
+ }
+ boolean enabled = false;
+ try {
+ Object enabledS;
+ enabledS = getUserProfileModule().getProperty(user,
+ User.INFO_USER_ENABLED);
+ if (enabledS != null && (enabledS instanceof Boolean)) {
+ enabled = ((Boolean)enabledS).booleanValue();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (!enabled) {
+ return UserStatus.DISABLE;
+ }
+ if (havingRole != null)
+ {
+ boolean hasTheRole = false;
+ Set roles = getMembershipModule().getRoles(user);
+ for (Iterator i = roles.iterator(); i.hasNext();)
+ {
+ Role role = (Role)i.next();
+ if (havingRole.equals(role.getName()))
+ {
+ hasTheRole = true;
+ break;
+ }
+ }
+ if (!hasTheRole)
+ {
+ return UserStatus.NOTASSIGNEDTOROLE;
+ }
+ }
+ if (!user.validatePassword(inputPassword))
+ {
+ return UserStatus.WRONGPASSWORD;
+ }
+ }
+ catch (NoSuchUserException e1)
+ {
+ return UserStatus.UNEXISTING;
+ }
+ catch (Exception e)
+ {
+ throw new LoginException(e.toString());
+ }
+ return null;
+ }
+ });
+ if (tmp != null)
+ {
+ result = tmp;
+ }
+ } catch (NamingException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ return result;
+ }
+
+ protected Group[] getRoleSets() throws LoginException
+ {
+ try {
+ TransactionManager tm = (TransactionManager) new InitialContext()
+ .lookup("java:/TransactionManager");
+ return (Group[]) Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ try {
+ User user = getUserModule().findUserByUserName(getUsername());
Set roles = getMembershipModule().getRoles(user);
//
Group rolesGroup = new SimpleGroup("Roles");
//
- if (additionalRole != null)
- {
+ if (additionalRole != null) {
rolesGroup.addMember(createIdentity(additionalRole));
}
//
- for (Iterator iterator = roles.iterator(); iterator.hasNext();)
- {
- Role role = (Role)iterator.next();
+ for (Iterator iterator = roles.iterator(); iterator.hasNext();) {
+ Role role = (Role) iterator.next();
String roleName = role.getName();
- try
- {
+ try {
Principal p = createIdentity(roleName);
rolesGroup.addMember(p);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
log.debug("Failed to create principal " + roleName, e);
}
}
//
- return new Group[]{rolesGroup};
- }
- catch (Exception e)
- {
+ return new Group[] { rolesGroup };
+ } catch (Exception e) {
throw new LoginException(e.toString());
}
}
});
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
Throwable cause = e.getCause();
throw new LoginException(cause.toString());
}
Modified: trunk/jems/.classpath
===================================================================
--- trunk/jems/.classpath 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/jems/.classpath 2007-03-23 08:55:44 UTC (rev 6803)
@@ -24,5 +24,6 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jmx-invoker-adaptor-client.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/common"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Property changes on: trunk/portlet-server
___________________________________________________________________
Name: svn:ignore
+ bin
output
Modified: trunk/registration/.classpath
===================================================================
--- trunk/registration/.classpath 2007-03-22 00:34:11 UTC (rev 6802)
+++ trunk/registration/.classpath 2007-03-23 08:55:44 UTC (rev 6803)
@@ -9,5 +9,6 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-xerces/lib/xml-apis.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 years, 3 months
JBoss Portal SVN: r6802 - trunk/api/src/main/org/jboss/portal/spi/runtime.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-21 20:34:11 -0400 (Wed, 21 Mar 2007)
New Revision: 6802
Modified:
trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java
Log:
minor javadoc
Modified: trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java 2007-03-22 00:26:50 UTC (rev 6801)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java 2007-03-22 00:34:11 UTC (rev 6802)
@@ -27,7 +27,7 @@
import org.jboss.portal.api.node.PortalNode;
/**
- * Provide access to the navigational state.
+ * Provide access to a portion of the navigational state managed by the portal.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
17 years, 3 months
JBoss Portal SVN: r6801 - in trunk/api/src/main/org/jboss/portal: spi/runtime and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-21 20:26:50 -0400 (Wed, 21 Mar 2007)
New Revision: 6801
Modified:
trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java
trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java
Log:
minor javadoc
Modified: trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java 2007-03-22 00:23:50 UTC (rev 6800)
+++ trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java 2007-03-22 00:26:50 UTC (rev 6801)
@@ -33,7 +33,7 @@
public abstract class PortalEvent
{
- /** . */
+ /** The portal runtime context. */
protected PortalRuntimeContext runtimeContext;
protected PortalEvent(PortalRuntimeContext runtimeContext)
@@ -41,6 +41,11 @@
this.runtimeContext = runtimeContext;
}
+ /**
+ * Returns the runtime context or null if it is not available during the event broadcasting.
+ *
+ * @return the portal runtime context
+ */
public PortalRuntimeContext getRuntimeContext()
{
return runtimeContext;
Modified: trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java 2007-03-22 00:23:50 UTC (rev 6800)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java 2007-03-22 00:26:50 UTC (rev 6801)
@@ -23,14 +23,19 @@
package org.jboss.portal.spi.runtime;
/**
- * The portal session.
+ * The portal session, the portal session attributes are accessible however it is not possible to influence
+ * the lifecycle of the session as it is managed by the portal.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface PortalSession
{
-
+ /**
+ * Return the session id.
+ *
+ * @return the session id
+ */
String getId();
Object getAttribute(String name);
17 years, 3 months
JBoss Portal SVN: r6800 - in trunk: api/src/main/org/jboss/portal/spi and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-21 20:23:50 -0400 (Wed, 21 Mar 2007)
New Revision: 6800
Added:
trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java
Removed:
trunk/api/src/main/org/jboss/portal/spi/NavigationalStateContext.java
Modified:
trunk/api/src/main/org/jboss/portal/api/node/event/PortalNodeEventContext.java
trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
Log:
moved NavigationalStateContext to the spi.runtime.package since it is a runtime object
Modified: trunk/api/src/main/org/jboss/portal/api/node/event/PortalNodeEventContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/node/event/PortalNodeEventContext.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/api/src/main/org/jboss/portal/api/node/event/PortalNodeEventContext.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -23,7 +23,7 @@
package org.jboss.portal.api.node.event;
import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.spi.NavigationalStateContext;
+import org.jboss.portal.spi.runtime.NavigationalStateContext;
/**
* The context in which a <code>PortalNodeEvent</code> is dispatched.
Deleted: trunk/api/src/main/org/jboss/portal/spi/NavigationalStateContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/NavigationalStateContext.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/api/src/main/org/jboss/portal/spi/NavigationalStateContext.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -1,72 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.spi;
-
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.api.node.PortalNode;
-
-/**
- * Provide access to the navigational state.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface NavigationalStateContext
-{
- /**
- * Returns the window state of a window or null if it is not found.
- *
- * @param window the window from which the window state is returned
- * @return the window state
- * @throws IllegalArgumentException
- */
- WindowState getWindowState(PortalNode window) throws IllegalArgumentException;
-
- /**
- * Updates the window state of a window.
- *
- * @param window the window to update
- * @param windowState the new window state value
- * @throws IllegalArgumentException
- */
- void setWindowState(PortalNode window, WindowState windowState) throws IllegalArgumentException;
-
- /**
- * Returns the mode of a window or null if it is not found.
- *
- * @param window the window from which the mode is returned
- * @return the mode
- * @throws IllegalArgumentException
- */
- Mode getMode(PortalNode window) throws IllegalArgumentException;
-
- /**
- * Updates the mode of a window.
- *
- * @param window the window to update
- * @param mode the new mode value
- * @throws IllegalArgumentException
- */
- void setMode(PortalNode window, Mode mode) throws IllegalArgumentException;
-}
Copied: trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java (from rev 6798, trunk/api/src/main/org/jboss/portal/spi/NavigationalStateContext.java)
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/NavigationalStateContext.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.spi.runtime;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.api.node.PortalNode;
+
+/**
+ * Provide access to the navigational state.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface NavigationalStateContext
+{
+ /**
+ * Returns the window state of a window or null if it is not found.
+ *
+ * @param window the window from which the window state is returned
+ * @return the window state
+ * @throws IllegalArgumentException
+ */
+ WindowState getWindowState(PortalNode window) throws IllegalArgumentException;
+
+ /**
+ * Updates the window state of a window.
+ *
+ * @param window the window to update
+ * @param windowState the new window state value
+ * @throws IllegalArgumentException
+ */
+ void setWindowState(PortalNode window, WindowState windowState) throws IllegalArgumentException;
+
+ /**
+ * Returns the mode of a window or null if it is not found.
+ *
+ * @param window the window from which the mode is returned
+ * @return the mode
+ * @throws IllegalArgumentException
+ */
+ Mode getMode(PortalNode window) throws IllegalArgumentException;
+
+ /**
+ * Updates the mode of a window.
+ *
+ * @param window the window to update
+ * @param mode the new mode value
+ * @throws IllegalArgumentException
+ */
+ void setMode(PortalNode window, Mode mode) throws IllegalArgumentException;
+}
Modified: trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -23,7 +23,7 @@
package org.jboss.portal.spi.runtime;
/**
- * The portal runtime context.
+ * The portal runtime context which provides access to runtime objects.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -26,7 +26,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.spi.NavigationalStateContext;
+import org.jboss.portal.spi.runtime.NavigationalStateContext;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.event.PortalNodeEvent;
import org.jboss.portal.api.node.event.WindowActionEvent;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -30,7 +30,7 @@
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.spi.NavigationalStateContext;
+import org.jboss.portal.spi.runtime.NavigationalStateContext;
import java.util.Collection;
import java.util.Collections;
Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-03-22 00:20:28 UTC (rev 6799)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-03-22 00:23:50 UTC (rev 6800)
@@ -29,7 +29,7 @@
import org.jboss.portal.api.node.event.WindowNavigationEvent;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.spi.NavigationalStateContext;
+import org.jboss.portal.spi.runtime.NavigationalStateContext;
import org.jboss.portal.WindowState;
import java.util.Map;
17 years, 3 months
JBoss Portal SVN: r6799 - in trunk: api/src/main/org/jboss/portal/api/event and 13 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-21 20:20:28 -0400 (Wed, 21 Mar 2007)
New Revision: 6799
Added:
trunk/api/src/main/org/jboss/portal/api/event/PortalEventListener.java
trunk/api/src/main/org/jboss/portal/api/user/
trunk/api/src/main/org/jboss/portal/api/user/event/
trunk/api/src/main/org/jboss/portal/api/user/event/UserAuthenticationEvent.java
trunk/api/src/main/org/jboss/portal/api/user/event/UserEvent.java
trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java
trunk/api/src/main/org/jboss/portal/spi/runtime/
trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java
trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeObject.java
trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
trunk/core/src/main/org/jboss/portal/core/event/user/
trunk/core/src/main/org/jboss/portal/core/event/user/UserEventBridge.java
trunk/core/src/main/org/jboss/portal/core/event/user/UserEventInterceptor.java
trunk/core/src/main/org/jboss/portal/core/impl/CoreRuntimeContext.java
trunk/core/src/main/org/jboss/portal/core/impl/CoreSession.java
Modified:
trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java
trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistry.java
trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistryImpl.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
trunk/widget/src/resources/widget-war/WEB-INF/web.xml
trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ReleaseSessionsSessionListener.java
Log:
first shot for portal events
Modified: trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/api/src/main/org/jboss/portal/api/event/PortalEvent.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.api.event;
+import org.jboss.portal.spi.runtime.PortalRuntimeContext;
+
/**
* Base event class for portal events.
*
@@ -30,4 +32,17 @@
*/
public abstract class PortalEvent
{
+
+ /** . */
+ protected PortalRuntimeContext runtimeContext;
+
+ protected PortalEvent(PortalRuntimeContext runtimeContext)
+ {
+ this.runtimeContext = runtimeContext;
+ }
+
+ public PortalRuntimeContext getRuntimeContext()
+ {
+ return runtimeContext;
+ }
}
Added: trunk/api/src/main/org/jboss/portal/api/event/PortalEventListener.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/event/PortalEventListener.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/api/event/PortalEventListener.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.api.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortalEventListener
+{
+ void onEvent(PortalEvent event);
+}
Added: trunk/api/src/main/org/jboss/portal/api/user/event/UserAuthenticationEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/user/event/UserAuthenticationEvent.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/api/user/event/UserAuthenticationEvent.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.api.user.event;
+
+import org.jboss.portal.spi.runtime.PortalRuntimeContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserAuthenticationEvent extends UserEvent
+{
+
+ public static final int SIGN_IN = 0;
+
+ public static final int SIGN_OUT = 1;
+
+ private final int type;
+
+
+ public UserAuthenticationEvent(PortalRuntimeContext runtimeContext, String userId, int type)
+ {
+ super(runtimeContext, userId);
+
+ //
+ if (runtimeContext == null)
+ {
+ throw new IllegalArgumentException("Need a runtime context for this kind of event");
+ }
+ if (userId == null)
+ {
+ throw new IllegalArgumentException("No user id provided");
+ }
+ if (type < SIGN_IN || type > SIGN_OUT)
+ {
+ throw new IllegalArgumentException("Wrong event type");
+ }
+
+ //
+ this.type = type;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
Added: trunk/api/src/main/org/jboss/portal/api/user/event/UserEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/user/event/UserEvent.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/api/user/event/UserEvent.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.api.user.event;
+
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.spi.runtime.PortalRuntimeContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class UserEvent extends PortalEvent
+{
+
+ /** The user id or null if the user is anonymous. */
+ protected final String userId;
+
+ public UserEvent(PortalRuntimeContext runtimeContext, String userId)
+ {
+ super(runtimeContext);
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+}
Added: trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.api.user.event;
+
+import org.jboss.portal.spi.runtime.PortalRuntimeContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserSessionEvent extends UserEvent
+{
+
+ public static final int SESSION_CREATED = 0;
+
+ public static final int SESSION_DESTROYED = 1;
+
+ private final int type;
+
+ public UserSessionEvent(PortalRuntimeContext runtimeContext, String userId, int type)
+ {
+ super(runtimeContext, userId);
+
+ //
+ if (runtimeContext == null)
+ {
+ throw new IllegalArgumentException("Need a runtime context for this kind of event");
+ }
+ if (type < SESSION_CREATED || type > SESSION_DESTROYED)
+ {
+ throw new IllegalArgumentException("Wrong event type");
+ }
+
+ //
+ this.type = type;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
Added: trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeContext.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.spi.runtime;
+
+/**
+ * The portal runtime context.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortalRuntimeContext
+{
+ /**
+ * Return the user id or null if no user is associated with the context.
+ *
+ * @return the user id
+ */
+ String getUserId();
+
+ /**
+ * Return the portal session or null if no session is associated with the client.
+ */
+ PortalSession getSession();
+}
Added: trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeObject.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeObject.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/PortalRuntimeObject.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.spi.runtime;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortalRuntimeObject
+{
+ PortalRuntimeContext getRuntimeContext();
+}
Added: trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java (rev 0)
+++ trunk/api/src/main/org/jboss/portal/spi/runtime/PortalSession.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.spi.runtime;
+
+/**
+ * The portal session.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortalSession
+{
+
+ String getId();
+
+ Object getAttribute(String name);
+
+ void setAttribute(String name, Object attribute);
+
+ void removeAttribute(String name);
+
+}
Modified: trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistry.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistry.java 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistry.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.event;
+import java.util.Collection;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -42,4 +44,10 @@
*
*/
Object getListener(String id);
+
+
+ /**
+ *
+ */
+ Collection getListeners();
}
Modified: trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistryImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistryImpl.java 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/core/src/main/org/jboss/portal/core/event/PortalEventListenerRegistryImpl.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -23,9 +23,9 @@
package org.jboss.portal.core.event;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -35,39 +35,26 @@
{
/** . */
- protected Map listeners = new HashMap();
+ protected final CopyOnWriteRegistry listeners = new CopyOnWriteRegistry();
public void registerListener(String id, Object listener)
{
- synchronized (this)
- {
- if (listeners.containsKey(id))
- {
- throw new IllegalArgumentException("Listener already registered " + id);
- }
- Map copy = new HashMap(listeners);
- copy.put(id, listener);
- listeners = copy;
- }
+ listeners.register(id, listener);
}
public void unregisterListener(String id)
{
- synchronized (this)
- {
- if (!listeners.containsKey(id))
- {
- throw new IllegalArgumentException("Listener is not registered " + id);
- }
- Map copy = new HashMap(listeners);
- copy.remove(id);
- listeners = copy;
- }
+ listeners.unregister(id);
}
-
public Object getListener(String id)
{
- return listeners.get(id);
+ return listeners.getRegistration(id);
}
+
+ public Collection getListeners()
+ {
+ return listeners.getRegistrations();
+ }
+
}
Added: trunk/core/src/main/org/jboss/portal/core/event/user/UserEventBridge.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/event/user/UserEventBridge.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/event/user/UserEventBridge.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,148 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.event.user;
+
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+import org.jboss.portal.core.impl.CoreRuntimeContext;
+import org.jboss.portal.core.impl.CoreSession;
+import org.jboss.portal.api.user.event.UserSessionEvent;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.MBeanProxyCreationException;
+
+import javax.servlet.http.HttpSessionListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserEventBridge implements HttpSessionListener, ServletContextListener, HttpSessionAttributeListener
+{
+
+ /** . */
+ private PortalEventListenerRegistry listenerRegistry;
+
+ // ServletContextListener implementation ****************************************************************************
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ try
+ {
+ listenerRegistry = (PortalEventListenerRegistry)MBeanProxy.get(PortalEventListenerRegistry.class, ObjectNameFactory.create("portal:service=ListenerRegistry"), MBeanServerLocator.locateJBoss());
+ }
+ catch (MBeanProxyCreationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ listenerRegistry = null;
+ }
+
+ // HttpSessionListener implementation *******************************************************************************
+
+ public void sessionCreated(HttpSessionEvent event)
+ {
+ CoreRuntimeContext rt = new CoreRuntimeContext();
+ rt.setSession(new CoreSession(event.getSession()));
+
+ //
+ UserSessionEvent use = new UserSessionEvent(rt, null, UserSessionEvent.SESSION_CREATED);
+ fireEvent(use);
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event)
+ {
+ CoreRuntimeContext rt = new CoreRuntimeContext();
+ rt.setSession(new CoreSession(event.getSession()));
+
+ //
+ UserSessionEvent use = new UserSessionEvent(rt, null, UserSessionEvent.SESSION_DESTROYED);
+ fireEvent(use);
+ }
+
+ // HttpSessionAttributeListener implementation **********************************************************************
+
+
+ public void attributeAdded(HttpSessionBindingEvent event)
+ {
+ if ("PRINCIPAL_TOKEN".equals(event.getName()))
+ {
+ String userId = (String)event.getValue();
+ CoreRuntimeContext rt = new CoreRuntimeContext();
+ rt.setSession(new CoreSession(event.getSession()));
+ rt.setUserId(userId);
+ UserAuthenticationEvent uae = new UserAuthenticationEvent(rt, userId, UserAuthenticationEvent.SIGN_IN);
+ fireEvent(uae);
+ }
+ }
+
+ public void attributeRemoved(HttpSessionBindingEvent event)
+ {
+ if ("PRINCIPAL_TOKEN".equals(event.getName()))
+ {
+ String userId = (String)event.getValue();
+ CoreRuntimeContext rt = new CoreRuntimeContext();
+ rt.setSession(new CoreSession(event.getSession()));
+ rt.setUserId(userId);
+ UserAuthenticationEvent uae = new UserAuthenticationEvent(rt, userId, UserAuthenticationEvent.SIGN_OUT);
+ fireEvent(uae);
+ }
+ }
+
+ public void attributeReplaced(HttpSessionBindingEvent event)
+ {
+ }
+
+ private void fireEvent(PortalEvent event)
+ {
+ for (Iterator i = listenerRegistry.getListeners().iterator();i.hasNext();)
+ {
+ Object o = i.next();
+ if (o instanceof PortalEventListener)
+ {
+ PortalEventListener listener = (PortalEventListener)o;
+ try
+ {
+ listener.onEvent(event);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/event/user/UserEventInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/event/user/UserEventInterceptor.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/event/user/UserEventInterceptor.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.event.user;
+
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.common.invocation.InvocationException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserEventInterceptor extends ServerInterceptor
+{
+ protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+ {
+ HttpServletRequest req = invocation.getServerContext().getClientRequest();
+ HttpSession session = req.getSession(false);
+ if (session != null)
+ {
+ Principal userPrincipal = req.getUserPrincipal();
+ if (userPrincipal != null)
+ {
+ if (session.getAttribute("PRINCIPAL_TOKEN") == null)
+ {
+ session.setAttribute("PRINCIPAL_TOKEN", userPrincipal.getName());
+ }
+ }
+ else
+ {
+ if (session.getAttribute("PRINCIPAL_TOKEN") != null)
+ {
+ session.removeAttribute("PRINCIPAL_TOKEN");
+ }
+ }
+ }
+
+ //
+ invocation.invokeNext();
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/impl/CoreRuntimeContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/CoreRuntimeContext.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/CoreRuntimeContext.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.impl;
+
+import org.jboss.portal.spi.runtime.PortalRuntimeContext;
+import org.jboss.portal.spi.runtime.PortalSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CoreRuntimeContext implements PortalRuntimeContext
+{
+
+ /** . */
+ private PortalSession session;
+
+ /** . */
+ private String userId;
+
+ public String getUserId()
+ {
+ return null;
+ }
+
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public PortalSession getSession()
+ {
+ return session;
+ }
+
+ public void setSession(PortalSession session)
+ {
+ this.session = session;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/impl/CoreSession.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/CoreSession.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/CoreSession.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.impl;
+
+import org.jboss.portal.spi.runtime.PortalSession;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CoreSession implements PortalSession
+{
+
+ /** . */
+ private HttpSession session;
+
+ public CoreSession(HttpSession session)
+ {
+ if (session == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.session = session;
+ }
+
+ public String getId()
+ {
+ return session.getId();
+ }
+
+ public Object getAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return session.getAttribute("blah." + name);
+ }
+
+ public void setAttribute(String name, Object attribute)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ session.setAttribute("blah." + name, attribute);
+ }
+
+ public void removeAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ session.removeAttribute("blah." + name);
+ }
+}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-22 00:20:28 UTC (rev 6799)
@@ -101,6 +101,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.event.user.UserEventInterceptor"
+ name="portal:service=Interceptor,type=Server,name=UserEvent"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.aspects.server.SessionInvalidatorInterceptor"
name="portal:service=Interceptor,type=Server,name=SessionInvalidator"
xmbean-dd=""
@@ -138,6 +145,7 @@
<xmbean/>
<depends-list optional-attribute-name="InterceptorNames">
<depends-list-element>portal:service=Interceptor,type=Server,name=Transaction</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Server,name=UserEvent</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionInvalidator</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
Modified: trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
===================================================================
--- trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-03-22 00:20:28 UTC (rev 6799)
@@ -31,6 +31,11 @@
<distributable/>
@portal.web.postdistributable@-->
+ <!-- Bridge portal user events -->
+ <listener>
+ <listener-class>org.jboss.portal.core.event.user.UserEventBridge</listener-class>
+ </listener>
+
<!-- The portal servlet is the main entrance point -->
<servlet>
<servlet-name>PortalServletWithPathMapping</servlet-name>
Added: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.test.event;
+
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.user.event.UserSessionEvent;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalEventListenerLogger implements PortalEventListener
+{
+ public void onEvent(PortalEvent event)
+ {
+ if (event instanceof UserSessionEvent)
+ {
+ UserSessionEvent use = (UserSessionEvent)event;
+ System.out.println(use.getType() == UserSessionEvent.SESSION_CREATED ? "session created" : "session destroyed");
+ }
+ else if (event instanceof UserAuthenticationEvent)
+ {
+ UserAuthenticationEvent uae = (UserAuthenticationEvent)event;
+ System.out.println(uae.getType() == UserAuthenticationEvent.SIGN_IN ? "user login" : "user logout");
+ }
+ else
+ {
+ System.out.println("event = " + event);
+ }
+ }
+}
Modified: trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml 2007-03-22 00:20:28 UTC (rev 6799)
@@ -49,5 +49,17 @@
<attribute name="RegistryId">window_event_listener</attribute>
<attribute name="ListenerClassName">org.jboss.portal.core.portlet.test.event.WindowConstraintEventListener</attribute>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
+ name="portal:service=ListenerService,type=user_listener"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+ proxy-type="attribute">portal:service=ListenerRegistry</depends>
+ <attribute name="RegistryId">user_listener</attribute>
+ <attribute name="ListenerClassName">org.jboss.portal.core.portlet.test.event.PortalEventListenerLogger</attribute>
+ </mbean>
</server>
Modified: trunk/widget/src/resources/widget-war/WEB-INF/web.xml
===================================================================
--- trunk/widget/src/resources/widget-war/WEB-INF/web.xml 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/widget/src/resources/widget-war/WEB-INF/web.xml 2007-03-22 00:20:28 UTC (rev 6799)
@@ -36,6 +36,6 @@
<param-value>GoogleWidgetPortletInstance</param-value>
</context-param>
<listener>
- <listener-class>org.jboss.portal.core.servlet.jsp.ContentTypeRegistration</listener-class>
+ <listener-class>org.jboss.portlet.content.ContentTypeRegistration</listener-class>
</listener>
</web-app>
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ReleaseSessionsSessionListener.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ReleaseSessionsSessionListener.java 2007-03-21 21:26:54 UTC (rev 6798)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ReleaseSessionsSessionListener.java 2007-03-22 00:20:28 UTC (rev 6799)
@@ -23,7 +23,7 @@
package org.jboss.portal.wsrp.servlet;
-import org.jboss.portal.core.event.SessionEventListenerRegistry;
+// import org.jboss.portal.core.event.SessionEventListenerRegistry;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.handler.RequestHeaderClientHandler;
@@ -68,11 +68,11 @@
public void start()
{
- SessionEventListenerRegistry.registerListener(ID, this);
+// SessionEventListenerRegistry.registerListener(ID, this);
}
public void stop()
{
- SessionEventListenerRegistry.unregisterListener(ID);
+// SessionEventListenerRegistry.unregisterListener(ID);
}
}
17 years, 3 months
JBoss Portal SVN: r6797 - trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-21 17:18:05 -0400 (Wed, 21 Mar 2007)
New Revision: 6797
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ServletAccess.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/UserAccess.java
Log:
- Fixed tests.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ServletAccess.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ServletAccess.java 2007-03-21 21:04:26 UTC (rev 6796)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/ServletAccess.java 2007-03-21 21:18:05 UTC (rev 6797)
@@ -84,7 +84,8 @@
public static HttpServletRequest getRequest()
{
- return (HttpServletRequest)((Invocation)local.get()).req;
+ Invocation invocation = (Invocation)local.get();
+ return invocation != null ? (HttpServletRequest)invocation.req : null;
}
public static HttpServletResponse getResponse()
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/UserAccess.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/UserAccess.java 2007-03-21 21:04:26 UTC (rev 6796)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/UserAccess.java 2007-03-21 21:18:05 UTC (rev 6797)
@@ -38,7 +38,7 @@
public static String getUser()
{
HttpServletRequest req = ServletAccess.getRequest();
- return req.getRemoteUser();
+ return req != null ? req.getRemoteUser() : null;
}
public static UserContext getUserContext()
@@ -46,4 +46,4 @@
String userId = getUser();
return userId != null ? WSRPTypeFactory.createUserContext(userId) : null;
}
-}
+}
\ No newline at end of file
17 years, 3 months
JBoss Portal SVN: r6796 - trunk/core/src/main/org/jboss/portal/core/model/portal/metadata.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-21 17:04:26 -0400 (Wed, 21 Mar 2007)
New Revision: 6796
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
Log:
- Use Tools.getShortName.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-03-21 21:01:14 UTC (rev 6795)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/metadata/PortalObjectMetaData.java 2007-03-21 21:04:26 UTC (rev 6796)
@@ -23,12 +23,13 @@
package org.jboss.portal.core.model.portal.metadata;
import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
+import org.jboss.portal.core.model.content.spi.ContentHandlerRegistry;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.content.spi.ContentHandlerRegistry;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.metadata.SecurityConstraintsMetaData;
@@ -269,8 +270,6 @@
public String toString()
{
String name = getClass().getName();
- int start = name.lastIndexOf(".");
- int end = name.length() - start;
- return name.substring(start, end) + "[" + name + "]";
+ return Tools.getShortNameOf(getClass()) + "[" + name + "]";
}
}
17 years, 3 months