Author: julien(a)jboss.com
Date: 2007-04-29 09:00:50 -0400 (Sun, 29 Apr 2007)
New Revision: 7130
Added:
trunk/api/src/main/org/jboss/portal/api/session/
trunk/api/src/main/org/jboss/portal/api/session/PortalSession.java
trunk/api/src/main/org/jboss/portal/api/session/event/
trunk/api/src/main/org/jboss/portal/api/session/event/PortalSessionEvent.java
Removed:
trunk/api/src/main/org/jboss/portal/api/PortalSession.java
trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java
Modified:
trunk/api/src/main/org/jboss/portal/api/PortalRuntimeContext.java
trunk/api/src/main/org/jboss/portal/api/node/event/WindowNavigationEvent.java
trunk/api/src/main/org/jboss/portal/api/node/event/WindowRenderEvent.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java
Log:
- reorg of PortalSession and UserSessionEvent->PortalSessionEvent
- improved WindowRenderEvent
Modified: trunk/api/src/main/org/jboss/portal/api/PortalRuntimeContext.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/PortalRuntimeContext.java 2007-04-29 11:58:03
UTC (rev 7129)
+++ trunk/api/src/main/org/jboss/portal/api/PortalRuntimeContext.java 2007-04-29 13:00:50
UTC (rev 7130)
@@ -23,6 +23,7 @@
package org.jboss.portal.api;
import org.jboss.portal.api.navstate.NavigationalStateContext;
+import org.jboss.portal.api.session.PortalSession;
/**
* The portal runtime context which provides access to runtime objects.
Deleted: trunk/api/src/main/org/jboss/portal/api/PortalSession.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/PortalSession.java 2007-04-29 11:58:03 UTC
(rev 7129)
+++ trunk/api/src/main/org/jboss/portal/api/PortalSession.java 2007-04-29 13:00:50 UTC
(rev 7130)
@@ -1,66 +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.api;
-
-/**
- * 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();
-
- /**
- * Returns a session attribute.
- *
- * @param name the attribute name
- * @return the attribute value or null if it is not found
- * @throws IllegalArgumentException if the attribute name is null
- */
- Object getAttribute(String name) throws IllegalArgumentException;
-
- /**
- * Update an attribute value. If the attribute value is null, then it is considered as
a removal.
- *
- * @param name the attribute name
- * @param attribute the attribute value
- * @throws IllegalArgumentException if the attribute name is null
- */
- void setAttribute(String name, Object attribute) throws IllegalArgumentException;
-
- /**
- * Removes an attribute value.
- *
- * @param name the attribute name
- * @throws IllegalArgumentException if the attribute name is null
- */
- void removeAttribute(String name) throws IllegalArgumentException;
-}
Modified: trunk/api/src/main/org/jboss/portal/api/node/event/WindowNavigationEvent.java
===================================================================
---
trunk/api/src/main/org/jboss/portal/api/node/event/WindowNavigationEvent.java 2007-04-29
11:58:03 UTC (rev 7129)
+++
trunk/api/src/main/org/jboss/portal/api/node/event/WindowNavigationEvent.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -24,14 +24,30 @@
import org.jboss.portal.api.node.PortalNode;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public class WindowNavigationEvent extends WindowEvent
{
+
+ /** . */
+ protected Map parameters;
+
public WindowNavigationEvent(PortalNode node)
{
super(node);
}
+
+ public Map getParameters()
+ {
+ return parameters;
+ }
+
+ public void setParameters(Map parameters)
+ {
+ this.parameters = parameters;
+ }
}
Modified: trunk/api/src/main/org/jboss/portal/api/node/event/WindowRenderEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/node/event/WindowRenderEvent.java 2007-04-29
11:58:03 UTC (rev 7129)
+++ trunk/api/src/main/org/jboss/portal/api/node/event/WindowRenderEvent.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -30,7 +30,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WindowRenderEvent extends WindowNavigationEvent
+public class WindowRenderEvent extends WindowEvent
{
/** . */
@@ -50,5 +50,4 @@
{
this.parameters = parameters;
}
-
}
Copied: trunk/api/src/main/org/jboss/portal/api/session/PortalSession.java (from rev 7111,
trunk/api/src/main/org/jboss/portal/api/PortalSession.java)
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/session/PortalSession.java
(rev 0)
+++ trunk/api/src/main/org/jboss/portal/api/session/PortalSession.java 2007-04-29 13:00:50
UTC (rev 7130)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.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();
+
+ /**
+ * Returns a session attribute.
+ *
+ * @param name the attribute name
+ * @return the attribute value or null if it is not found
+ * @throws IllegalArgumentException if the attribute name is null
+ */
+ Object getAttribute(String name) throws IllegalArgumentException;
+
+ /**
+ * Update an attribute value. If the attribute value is null, then it is considered as
a removal.
+ *
+ * @param name the attribute name
+ * @param attribute the attribute value
+ * @throws IllegalArgumentException if the attribute name is null
+ */
+ void setAttribute(String name, Object attribute) throws IllegalArgumentException;
+
+ /**
+ * Removes an attribute value.
+ *
+ * @param name the attribute name
+ * @throws IllegalArgumentException if the attribute name is null
+ */
+ void removeAttribute(String name) throws IllegalArgumentException;
+}
Copied: trunk/api/src/main/org/jboss/portal/api/session/event/PortalSessionEvent.java
(from rev 7111, trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java)
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/session/event/PortalSessionEvent.java
(rev 0)
+++
trunk/api/src/main/org/jboss/portal/api/session/event/PortalSessionEvent.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.session.event;
+
+import org.jboss.portal.api.event.PortalEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalSessionEvent extends PortalEvent
+{
+
+ public static final int SESSION_CREATED = 0;
+
+ public static final int SESSION_DESTROYED = 1;
+
+ private final int type;
+
+ public PortalSessionEvent(int type)
+ {
+ if (type < SESSION_CREATED || type > SESSION_DESTROYED)
+ {
+ throw new IllegalArgumentException("Wrong event type");
+ }
+
+ //
+ this.type = type;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
Deleted: trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java
===================================================================
--- trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java 2007-04-29
11:58:03 UTC (rev 7129)
+++ trunk/api/src/main/org/jboss/portal/api/user/event/UserSessionEvent.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -1,56 +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.api.user.event;
-
-/**
- * @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(String userId, int type)
- {
- super(userId);
-
- //
- if (type < SESSION_CREATED || type > SESSION_DESTROYED)
- {
- throw new IllegalArgumentException("Wrong event type");
- }
-
- //
- this.type = type;
- }
-
- public int getType()
- {
- return type;
- }
-}
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-04-29
11:58:03 UTC (rev 7129)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -42,6 +42,7 @@
import
org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.command.render.RenderPageCommand;
+import org.jboss.portal.core.model.portal.command.render.RenderWindowCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.impl.api.CorePortalNode;
@@ -241,32 +242,32 @@
else if (cmd instanceof InvokePortletWindowRenderCommand)
{
InvokePortletWindowRenderCommand iwrc =
(InvokePortletWindowRenderCommand)wc;
- StateString navigationalState = iwrc.getNavigationalState();
//
- if (navigationalState != null)
- {
- Map params = null;
- if (navigationalState instanceof PortletParametersStateString)
- {
- params =
((PortletParametersStateString)navigationalState).getParameters();
- }
+ WindowNavigationEvent navigation = new WindowNavigationEvent(node);
+ navigation.setMode(iwrc.getMode());
+ navigation.setWindowState(iwrc.getWindowState());
- //
- WindowRenderEvent render = new WindowRenderEvent(node);
- render.setMode(iwrc.getMode());
- render.setWindowState(iwrc.getWindowState());
- render.setParameters(params);
- return render;
- }
- else
+ //
+ StateString navigationalState = iwrc.getNavigationalState();
+ if (navigationalState instanceof PortletParametersStateString)
{
- WindowNavigationEvent navigation = new WindowNavigationEvent(node);
- navigation.setMode(iwrc.getMode());
- navigation.setWindowState(iwrc.getWindowState());
- return navigation;
+ Map params =
((PortletParametersStateString)navigationalState).getParameters();
+ navigation.setParameters(params);
}
+
+ //
+ return navigation;
}
+ else if (cmd instanceof RenderWindowCommand)
+ {
+ RenderWindowCommand rwc = (RenderWindowCommand)cmd;
+
+ //
+ WindowRenderEvent event = new WindowRenderEvent(node);
+ event.setMode(rwc.getMode());
+ event.setWindowState(rwc.getWindowState());
+ }
}
else if (cmd instanceof RenderPageCommand)
{
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java 2007-04-29
11:58:03 UTC (rev 7129)
+++
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -24,7 +24,7 @@
import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.api.navstate.NavigationalStateContext;
-import org.jboss.portal.api.PortalSession;
+import org.jboss.portal.api.session.PortalSession;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.identity.User;
Modified: trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java 2007-04-29
11:58:03 UTC (rev 7129)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.impl.api;
-import org.jboss.portal.api.PortalSession;
+import org.jboss.portal.api.session.PortalSession;
import javax.servlet.http.HttpSession;
Modified: trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java 2007-04-29
11:58:03 UTC (rev 7129)
+++
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -30,7 +30,7 @@
import org.jboss.portal.api.event.PortalEventContext;
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.api.user.event.UserAuthenticationEvent;
-import org.jboss.portal.api.user.event.UserSessionEvent;
+import org.jboss.portal.api.session.event.PortalSessionEvent;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.impl.api.CorePortalRuntimeContext;
@@ -77,7 +77,7 @@
{
CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession());
UserEventContext uec = new UserEventContext(rt);
- UserSessionEvent use = new UserSessionEvent(null,
UserSessionEvent.SESSION_CREATED);
+ PortalSessionEvent use = new
PortalSessionEvent(PortalSessionEvent.SESSION_CREATED);
fireEvent(uec, use);
}
@@ -85,7 +85,7 @@
{
CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession());
UserEventContext uec = new UserEventContext(rt);
- UserSessionEvent use = new UserSessionEvent(null,
UserSessionEvent.SESSION_DESTROYED);
+ PortalSessionEvent use = new
PortalSessionEvent(PortalSessionEvent.SESSION_DESTROYED);
fireEvent(uec, use);
}
Modified:
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 2007-04-29
11:58:03 UTC (rev 7129)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -25,7 +25,7 @@
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.api.event.PortalEvent;
import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.user.event.UserSessionEvent;
+import org.jboss.portal.api.session.event.PortalSessionEvent;
import org.jboss.portal.api.user.event.UserAuthenticationEvent;
/**
@@ -36,10 +36,10 @@
{
public void onEvent(PortalEventContext eventContext, PortalEvent event)
{
- if (event instanceof UserSessionEvent)
+ if (event instanceof PortalSessionEvent)
{
- UserSessionEvent use = (UserSessionEvent)event;
- System.out.println(use.getType() == UserSessionEvent.SESSION_CREATED ?
"session created" : "session destroyed");
+ PortalSessionEvent use = (PortalSessionEvent)event;
+ System.out.println(use.getType() == PortalSessionEvent.SESSION_CREATED ?
"session created" : "session destroyed");
}
else if (event instanceof UserAuthenticationEvent)
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java 2007-04-29
11:58:03 UTC (rev 7129)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java 2007-04-29
13:00:50 UTC (rev 7130)
@@ -27,7 +27,7 @@
import org.jboss.portal.api.event.PortalEvent;
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.user.event.UserSessionEvent;
+import org.jboss.portal.api.session.event.PortalSessionEvent;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.InvokerUnavailableException;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -403,17 +403,17 @@
public void onEvent(PortalEventContext eventContext, PortalEvent event)
{
- if (event instanceof UserSessionEvent)
+ if (event instanceof PortalSessionEvent)
{
- UserSessionEvent use = (UserSessionEvent)event;
+ PortalSessionEvent use = (PortalSessionEvent)event;
int type = use.getType();
String id = eventContext.getPortalRuntimeContext().getSession().getId();
switch (type)
{
- case UserSessionEvent.SESSION_CREATED:
+ case PortalSessionEvent.SESSION_CREATED:
break; // nothing to do
- case UserSessionEvent.SESSION_DESTROYED:
+ case PortalSessionEvent.SESSION_DESTROYED:
// check if the session being destroyed is the one associated with this
thread
ProducerSessionInformation info =
RequestHeaderClientHandler.getCurrentProducerSessionInformation();
if (info != null)