JBoss Portal SVN: r7136 - trunk/core/src/main/org/jboss/portal/core/impl/api/node.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 18:12:17 -0400 (Sun, 29 Apr 2007)
New Revision: 7136
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java
Log:
minor
Modified: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java 2007-04-29 22:11:01 UTC (rev 7135)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java 2007-04-29 22:12:17 UTC (rev 7136)
@@ -48,15 +48,14 @@
this.controllerContext = controllerContext;
}
- public PortalNodeURL createURL(PortalNode node)
+ public PortalNodeURL createURL(PortalNodeImpl node)
{
- PortalNodeImpl pon = (PortalNodeImpl)node;
switch (node.getType())
{
case PortalNode.TYPE_WINDOW:
- return new WindowURL(pon.getObjectId(), controllerContext);
+ return new WindowURL(node.getObjectId(), controllerContext);
case PortalNode.TYPE_PAGE:
- return new PageURL(pon.getObjectId(), controllerContext);
+ return new PageURL(node.getObjectId(), controllerContext);
case PortalNode.TYPE_PORTAL:
case PortalNode.TYPE_CONTEXT:
default:
17 years
JBoss Portal SVN: r7135 - trunk/core/src/main/org/jboss/portal/core/impl/api/node.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 18:11:01 -0400 (Sun, 29 Apr 2007)
New Revision: 7135
Added:
trunk/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java
Log:
transform inner classes into outter classes
Added: trunk/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java 2007-04-29 22:11:01 UTC (rev 7135)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.server.request.URLContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractPortalNodeURL implements PortalNodeURL
+{
+
+ /** . */
+ protected PortalObjectId id;
+
+ /** . */
+ protected ControllerContext controllerContext;
+
+ /** . */
+ protected PortletParametersStateString parameters;
+
+ /** . */
+ protected Boolean wantSecure;
+
+ /** . */
+ protected Boolean wantAuthenticated;
+
+ /** . */
+ protected boolean relative;
+
+ public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ this.id = id;
+ this.controllerContext = controllerContext;
+ this.relative = true;
+ this.parameters = new PortletParametersStateString();
+ }
+
+ public void setParameter(String name, String value)
+ {
+ parameters.setValue(name, value);
+ }
+
+ public void setParameter(String name, String[] values)
+ {
+ parameters.setValues(name, values);
+ }
+
+ public void setAuthenticated(Boolean authenticated)
+ {
+ this.wantAuthenticated = authenticated;
+ }
+
+ public void setSecure(Boolean secure)
+ {
+ this.wantSecure = secure;
+ }
+
+ public void setRelative(boolean relative)
+ {
+ this.relative = relative;
+ }
+
+ protected URLContext getURLContext()
+ {
+ return controllerContext.getServerInvocation().getServerContext().getURLContext();
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PageURL.java 2007-04-29 22:11:01 UTC (rev 7135)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageURL extends AbstractPortalNodeURL
+{
+
+ public PageURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ super(id, controllerContext);
+ }
+
+ public String toString()
+ {
+ ViewPageCommand cmd = new ViewPageCommand(id);
+ URLContext urlContext = getURLContext();
+ return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java 2007-04-29 22:03:38 UTC (rev 7134)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java 2007-04-29 22:11:01 UTC (rev 7135)
@@ -63,97 +63,4 @@
throw new IllegalArgumentException("This kind of node does not support render url " + node);
}
}
-
- private static class AbstractPortalNodeURL implements PortalNodeURL
- {
-
- /** . */
- protected PortalObjectId id;
-
- /** . */
- protected ControllerContext controllerContext;
-
- /** . */
- protected PortletParametersStateString parameters;
-
- /** . */
- protected Boolean wantSecure;
-
- /** . */
- protected Boolean wantAuthenticated;
-
- /** . */
- protected boolean relative;
-
- public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
- {
- this.id = id;
- this.controllerContext = controllerContext;
- this.relative = true;
- this.parameters = new PortletParametersStateString();
- }
-
- public void setParameter(String name, String value)
- {
- parameters.setValue(name, value);
- }
-
- public void setParameter(String name, String[] values)
- {
- parameters.setValues(name, values);
- }
-
- public void setAuthenticated(Boolean authenticated)
- {
- this.wantAuthenticated = authenticated;
- }
-
- public void setSecure(Boolean secure)
- {
- this.wantSecure = secure;
- }
-
- public void setRelative(boolean relative)
- {
- this.relative = relative;
- }
-
- protected URLContext getURLContext()
- {
- return controllerContext.getServerInvocation().getServerContext().getURLContext();
- }
-
- }
-
- private static class WindowURL extends AbstractPortalNodeURL
- {
-
- public WindowURL(PortalObjectId id, ControllerContext controllerContext)
- {
- super(id, controllerContext);
- }
-
- public String toString()
- {
- InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
- URLContext urlContext = getURLContext();
- return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
- }
- }
-
- private static class PageURL extends AbstractPortalNodeURL
- {
-
- public PageURL(PortalObjectId id, ControllerContext controllerContext)
- {
- super(id, controllerContext);
- }
-
- public String toString()
- {
- ViewPageCommand cmd = new ViewPageCommand(id);
- URLContext urlContext = getURLContext();
- return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
- }
- }
}
Added: trunk/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/WindowURL.java 2007-04-29 22:11:01 UTC (rev 7135)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowURL extends AbstractPortalNodeURL
+{
+
+ public WindowURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ super(id, controllerContext);
+ }
+
+ public String toString()
+ {
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
+ URLContext urlContext = getURLContext();
+ return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+ }
+}
17 years
JBoss Portal SVN: r7134 - in trunk/core/src: main/org/jboss/portal/core/impl/api and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 18:03:38 -0400 (Sun, 29 Apr 2007)
New Revision: 7134
Added:
trunk/core/src/main/org/jboss/portal/core/impl/api/PortalRuntimeContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/event/
trunk/core/src/main/org/jboss/portal/core/impl/api/event/EventBridge.java
trunk/core/src/main/org/jboss/portal/core/impl/api/event/PortalEventContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/navstate/
trunk/core/src/main/org/jboss/portal/core/impl/api/navstate/NavigationalStateContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeEventContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/api/session/
trunk/core/src/main/org/jboss/portal/core/impl/api/session/PortalSessionImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridgeTriggerInterceptor.java
Removed:
trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java
trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalNode.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/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventContext.java
trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventInterceptor.java
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/Navigation.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
Log:
- WindowRenderEvent was not returned properly
- package reorg in the portal api impl to better match the api package org
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 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -32,6 +32,7 @@
import org.jboss.portal.api.node.event.WindowNavigationEvent;
import org.jboss.portal.api.node.event.WindowRenderEvent;
import org.jboss.portal.api.node.event.PageRenderEvent;
+import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.LazyMap;
import org.jboss.portal.core.controller.CommandRedirectionException;
@@ -46,8 +47,8 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
-import org.jboss.portal.core.impl.api.CorePortalNode;
-import org.jboss.portal.core.impl.api.CorePortalRuntimeContext;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.core.impl.api.node.PortalNodeEventContextImpl;
import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletParametersStateString;
@@ -77,17 +78,28 @@
public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
- CorePortalNode node = Navigation.getCurrentNode();
+ // Get the current node from the thread local
+ PortalNodeImpl node = Navigation.getCurrentNode();
+ // The next event that will optionally replace this one
+ PortalNodeEvent nextEvent = null;
+
+ // Create an event from the current node
+ PortalNodeEvent event = createEvent(cmd, node);
+
//
- PortalNodeEvent event = createEvent(cmd, node);
- PortalNodeEvent nextEvent = null;
if (event != null)
{
try
{
- CorePortalRuntimeContext runtimeContext = new CorePortalRuntimeContext(cmd.getControllerContext());
- nextEvent = node.fireEvent(listenerRegistry, event, runtimeContext);
+ // Get runtime context from the thread local
+ PortalRuntimeContext runtimeContext = Navigation.getPortalRuntimeContext();
+
+ //
+ PortalNodeEventContextImpl nodeEventContext = new PortalNodeEventContextImpl(listenerRegistry, node, event, runtimeContext);
+
+ // Fire the event
+ nextEvent = nodeEventContext.dispatch();
}
catch (Exception e)
{
@@ -96,26 +108,49 @@
}
//
- ControllerCommand redirection = null;
- if (nextEvent instanceof WindowEvent)
+ if (nextEvent != null)
{
- WindowEvent we = (WindowEvent)nextEvent;
+ ControllerCommand redirection = createCommand(nextEvent);
//
- CorePortalNode nextNode = (CorePortalNode)we.getNode();
+ if (redirection != null)
+ {
+ throw new CommandRedirectionException(redirection);
+ }
+ }
+
+ //
+ return (ControllerResponse)cmd.invokeNext();
+ }
+
+ /**
+ *
+ * @param event
+ * @return
+ */
+ private ControllerCommand createCommand(PortalNodeEvent event)
+ {
+ if (event instanceof WindowEvent)
+ {
+ WindowEvent we = (WindowEvent)event;
+
+ //
+ PortalNodeImpl nextNode = (PortalNodeImpl)we.getNode();
PortalObjectId nodeRef = nextNode.getObjectId();
Mode mode = we.getMode();
WindowState windowState = we.getWindowState();
- if (nextEvent instanceof WindowActionEvent)
+
+ //
+ if (event instanceof WindowActionEvent)
{
- WindowActionEvent wae = (WindowActionEvent)nextEvent;
+ WindowActionEvent wae = (WindowActionEvent)event;
Map params = wae.getParameters();
//
- PortletParameters interactionParams = null;
- if (params instanceof LazyParameterMap)
+ PortletParameters interactionParams;
+ if (params instanceof ActionParameterMap)
{
- interactionParams = (PortletParameters)((LazyParameterMap)params).createDelegate();
+ interactionParams = (PortletParameters)((ActionParameterMap)params).createDelegate();
}
else
{
@@ -125,7 +160,7 @@
//
if (interactionParams != null)
{
- redirection = new InvokePortletWindowActionCommand(
+ return new InvokePortletWindowActionCommand(
nodeRef,
mode,
windowState,
@@ -134,141 +169,112 @@
null);
}
}
- else if (nextEvent instanceof WindowRenderEvent)
+ else if (event instanceof WindowNavigationEvent)
{
- WindowRenderEvent wre = (WindowRenderEvent)nextEvent;
- Map params = wre.getParameters();
+ WindowNavigationEvent wne = (WindowNavigationEvent)event;
//
+ Map params = wne.getParameters();
PortletParameters navigationalParams = asParameters(params);
+ StateString state = navigationalParams != null ? new PortletParametersStateString(navigationalParams) : null;
//
- if (navigationalParams != null)
- {
- redirection = new InvokePortletWindowRenderCommand(
- nodeRef,
- mode,
- windowState,
- new PortletParametersStateString(navigationalParams));
- }
+ return new InvokePortletWindowRenderCommand(nodeRef, mode, windowState, state);
}
- else if (nextEvent instanceof WindowNavigationEvent)
- {
- redirection = new InvokePortletWindowRenderCommand(
- nodeRef,
- mode,
- windowState);
- }
}
- else
- {
- if (event instanceof WindowActionEvent)
- {
- WindowActionEvent wae = (WindowActionEvent)event;
- InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)cmd;
- Map params = wae.getParameters();
- if (params instanceof LazyParameterMap)
- {
- LazyParameterMap lpm = (LazyParameterMap)params;
- if (lpm.isModified())
- {
- iwac.setInteractionState(new PortletParametersStateString(lpm.params));
- iwac.setFormParameters(null);
- }
- }
- }
- }
//
- if (redirection != null)
- {
- throw new CommandRedirectionException(redirection);
- }
- else
- {
- return (ControllerResponse)cmd.invokeNext();
- }
+ return null;
}
- private PortalNodeEvent createEvent(ControllerCommand cmd, PortalNode node)
+ /**
+ * Returns portal node event corresponding to the command or null.
+ *
+ * @param command
+ * @param node
+ * @return a portal node event
+ */
+ private PortalNodeEvent createEvent(ControllerCommand command, PortalNode node)
{
- if (cmd instanceof WindowCommand)
+ if (command instanceof WindowCommand)
{
- WindowCommand wc = (WindowCommand)cmd;
- if (cmd instanceof InvokePortletWindowActionCommand)
+ WindowCommand wc = (WindowCommand)command;
+
+ //
+ if (command instanceof InvokePortletWindowActionCommand)
{
InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)wc;
- //
- PortletParameters formParams = iwac.getFormParameters();
+ // Get form parameters
+ PortletParameters formParameters = iwac.getFormParameters();
- //
- PortletParameters interactionParams = null;
+ // Get interaction parameters
+ PortletParameters interactionParameters = null;
if (iwac.getInteractionState() instanceof PortletParametersStateString)
{
- interactionParams = ((PortletParametersStateString)iwac.getInteractionState()).getParameters();
+ interactionParameters = ((PortletParametersStateString)iwac.getInteractionState()).getParameters();
}
- //
- Map params;
- if (interactionParams != null)
+ // Build a map that represents the parameters of the action
+ Map actionParameters;
+ if (interactionParameters != null)
{
- if (formParams != null)
+ if (formParameters != null)
{
- params = new LazyParameterMap(interactionParams, formParams);
+ actionParameters = new ActionParameterMap(interactionParameters, formParameters);
}
else
{
- params = interactionParams;
+ actionParameters = interactionParameters;
}
}
else
{
- if (formParams != null)
+ if (formParameters != null)
{
- params = formParams;
+ actionParameters = formParameters;
}
else
{
- params = new PortletParameters();
+ actionParameters = new PortletParameters();
}
}
- //
+ // Populate and return the window action event
WindowActionEvent action = new WindowActionEvent(node);
action.setMode(iwac.getMode());
action.setWindowState(iwac.getWindowState());
- action.setParameters(params);
+ action.setParameters(actionParameters);
return action;
}
- else if (cmd instanceof InvokePortletWindowRenderCommand)
+ else if (command instanceof InvokePortletWindowRenderCommand)
{
InvokePortletWindowRenderCommand iwrc = (InvokePortletWindowRenderCommand)wc;
//
- WindowNavigationEvent navigation = new WindowNavigationEvent(node);
- navigation.setMode(iwrc.getMode());
- navigation.setWindowState(iwrc.getWindowState());
+ WindowNavigationEvent event = new WindowNavigationEvent(node);
+ event.setMode(iwrc.getMode());
+ event.setWindowState(iwrc.getWindowState());
//
StateString navigationalState = iwrc.getNavigationalState();
if (navigationalState instanceof PortletParametersStateString)
{
Map params = ((PortletParametersStateString)navigationalState).getParameters();
- navigation.setParameters(params);
+ event.setParameters(params);
}
//
- return navigation;
+ return event;
}
- else if (cmd instanceof RenderWindowCommand)
+ else if (command instanceof RenderWindowCommand)
{
WindowRenderEvent event = new WindowRenderEvent(node);
//
- RenderWindowCommand rwc = (RenderWindowCommand)cmd;
+ RenderWindowCommand rwc = (RenderWindowCommand)command;
NavigationalStateKey key = new NavigationalStateKey(WindowNavigationalState.class, rwc.getTargetId());
- WindowNavigationalState navstate = (WindowNavigationalState)cmd.getControllerContext().getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, key);
+ WindowNavigationalState navstate = (WindowNavigationalState)command.getControllerContext().getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, key);
if (navstate != null)
{
event.setMode(navstate.getMode());
@@ -281,22 +287,32 @@
event.setParameters(params);
}
}
+
+ //
+ return event;
}
}
- else if (cmd instanceof RenderPageCommand)
+ else if (command instanceof RenderPageCommand)
{
return new PageRenderEvent(node);
}
+
+ //
return null;
}
+ /**
+ *
+ * @param map
+ * @return
+ */
private PortletParameters asParameters(Map map)
{
if (map == null)
{
return null;
}
- if (map instanceof PortletParameters)
+ else if (map instanceof PortletParameters)
{
return (PortletParameters)map;
}
@@ -309,12 +325,17 @@
catch (IllegalArgumentException e)
{
log.error("Window action event received wrong parameter set", e);
+
+ //
return null;
}
}
}
- private static class LazyParameterMap extends LazyMap
+ /**
+ *
+ */
+ private static class ActionParameterMap extends LazyMap
{
/** . */
private PortletParameters formParams;
@@ -325,7 +346,7 @@
/** . */
private PortletParameters params;
- public LazyParameterMap(PortletParameters interactionParams, PortletParameters formParams)
+ public ActionParameterMap(PortletParameters interactionParams, PortletParameters formParams)
{
this.formParams = formParams;
this.interactionParams = interactionParams;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.aspects.controller.node;
-import org.jboss.portal.core.impl.api.CorePortalNode;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
import org.jboss.portal.api.PortalRuntimeContext;
/**
@@ -38,12 +38,12 @@
/** . */
private static final ThreadLocal runtimeContextLocal = new ThreadLocal();
- public static CorePortalNode getCurrentNode()
+ public static PortalNodeImpl getCurrentNode()
{
- return (CorePortalNode)currentNodeLocal.get();
+ return (PortalNodeImpl)currentNodeLocal.get();
}
- static void setCurrentNode(CorePortalNode currentNode)
+ static void setCurrentNode(PortalNodeImpl currentNode)
{
currentNodeLocal.set(currentNode);
}
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -30,8 +30,8 @@
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.impl.api.CorePortalNode;
-import org.jboss.portal.core.impl.api.CorePortalRuntimeContext;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.core.impl.api.PortalRuntimeContextImpl;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
@@ -58,10 +58,10 @@
public ControllerResponse invoke(ControllerCommand cmd) throws Exception, InvocationException
{
// Get the next node
- CorePortalNode next = getNode(cmd);
+ PortalNodeImpl next = getNode(cmd);
// Save previous node temporarily
- CorePortalNode previous = Navigation.getCurrentNode();
+ PortalNodeImpl previous = Navigation.getCurrentNode();
// Whether or not we inherit from an existing factory
boolean noFactory = Navigation.getPortalRuntimeContext() == null;
@@ -74,7 +74,7 @@
//
if (noFactory)
{
- Navigation.setPortalRuntimeContext(new CorePortalRuntimeContext(cmd.getControllerContext()));
+ Navigation.setPortalRuntimeContext(new PortalRuntimeContextImpl(cmd.getControllerContext()));
}
// Invoke
@@ -93,23 +93,23 @@
}
}
- private CorePortalNode getNode(ControllerCommand cmd)
+ private PortalNodeImpl getNode(ControllerCommand cmd)
{
PortalAuthorizationManager pam = portalAuthorizationManagerFactory.getManager();
- CorePortalNode next = null;
+ PortalNodeImpl next = null;
//
if (cmd instanceof WindowCommand)
{
WindowCommand windowCmd = (WindowCommand)cmd;
Window window = windowCmd.getWindow();
- next = new CorePortalNode(pam, window);
+ next = new PortalNodeImpl(pam, window);
}
else if (cmd instanceof RenderPageCommand)
{
RenderPageCommand rpCmd = (RenderPageCommand)cmd;
Page page = rpCmd.getPage();
- next = new CorePortalNode(pam, page);
+ next = new PortalNodeImpl(pam, page);
}
//
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,132 +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.core.impl.api;
-
-import org.jboss.portal.api.navstate.NavigationalStateContext;
-import org.jboss.portal.core.navstate.NavigationalStateKey;
-import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.AttributeResolver;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CoreNavigationalStateContext implements NavigationalStateContext
-{
-
- /** . */
- private AttributeResolver navigationalStateResolver;
-
- public CoreNavigationalStateContext(AttributeResolver navigationalStateResolver)
- {
- this.navigationalStateResolver = navigationalStateResolver;
- }
-
- private WindowNavigationalState getWNS(PortalNode window, boolean create)
- {
- CorePortalNode pon = (CorePortalNode)window;
- NavigationalStateKey key = new NavigationalStateKey(WindowNavigationalState.class, pon.getObjectId());
- WindowNavigationalState wns = (WindowNavigationalState)navigationalStateResolver.getAttribute(key);
- if (wns == null && create)
- {
- wns = WindowNavigationalState.create();
- navigationalStateResolver.setAttribute(key, wns);
- }
- return wns;
- }
-
- public WindowState getWindowState(PortalNode window) throws IllegalArgumentException
- {
- if (window == null)
- {
- throw new IllegalArgumentException("No null window can be provided");
- }
-
- //
- WindowNavigationalState wns = getWNS(window, false);
- if (wns != null)
- {
- return wns.getWindowState();
- }
- else
- {
- return null;
- }
- }
-
- public void setWindowState(PortalNode window, WindowState windowState) throws IllegalArgumentException
- {
- if (window == null)
- {
- throw new IllegalArgumentException("No null window can be provided");
- }
- if (windowState == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- CorePortalNode pon = (CorePortalNode)window;
- WindowNavigationalState.setWindowState(navigationalStateResolver, pon.getObjectId(), windowState);
- }
-
- public Mode getMode(PortalNode window) throws IllegalArgumentException
- {
- if (window == null)
- {
- throw new IllegalArgumentException("No null window can be provided");
- }
-
- //
- WindowNavigationalState wns = getWNS(window, false);
- if (wns != null)
- {
- return wns.getMode();
- }
- else
- {
- return null;
- }
- }
-
- public void setMode(PortalNode window, Mode mode) throws IllegalArgumentException
- {
- if (window == null)
- {
- throw new IllegalArgumentException("No null window can be provided");
- }
- if (mode == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- CorePortalNode pon = (CorePortalNode)window;
-
- //
- WindowNavigationalState.setMode(navigationalStateResolver, pon.getObjectId(), mode);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalNode.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalNode.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,519 +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.core.impl.api;
-
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.api.node.event.PortalNodeEventContext;
-import org.jboss.portal.api.node.event.PortalNodeEventListener;
-import org.jboss.portal.api.PortalRuntimeContext;
-import org.jboss.portal.common.path.RelativePathParser;
-import org.jboss.portal.common.i18n.ResourceBundleManager;
-import org.jboss.portal.common.i18n.SimpleResourceBundleFactory;
-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.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.util.Comparator;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CorePortalNode implements PortalNode
-{
-
- /** Order. */
- private static final String ORDER = "order";
-
- /** The prefix for resources in the bundle. */
- private static final String RESOURCE_PREFIX = "PAGENAME_";
-
- /** . */
- private static final String BUNDLE_BASE_NAME = "conf.bundles.Resource";
-
- /** . */
- private static final ResourceBundleManager resourceBundles = new ResourceBundleManager(null, new SimpleResourceBundleFactory(BUNDLE_BASE_NAME, CorePortalNode.class.getClassLoader()));
-
- /** The wrapped portal object. */
- private final PortalObject object;
-
- /** The parent node. */
- private CorePortalNode parentNode;
-
- /** The children. */
- private final NodeList children;
-
- /** The root node. */
- private PortalNode root;
-
- /** The key for the display name in the resource bundle. */
- private String displayNameKey;
-
- /** The security checks. */
- private final PortalAuthorizationManager portalAuthorizationManager;
-
- /**
- * Build a portal node object wrapping the specified portal object.
- *
- * @param object the wrapped portal object
- * @throws IllegalArgumentException if the specified object is null
- */
- public CorePortalNode(PortalAuthorizationManager portalAuthorizationManager, PortalObject object) throws IllegalArgumentException
- {
- if (object == null)
- {
- throw new IllegalArgumentException();
- }
- this.portalAuthorizationManager = portalAuthorizationManager;
- this.object = object;
- this.children = new Children(this);
- }
-
- /**
- * Used during the construction of a children list.
- *
- * @param parentNode the parent node of this node
- * @param object the wrapped portal object
- */
- protected CorePortalNode(CorePortalNode parentNode, PortalObject object)
- {
- this.portalAuthorizationManager = parentNode.portalAuthorizationManager;
- this.parentNode = parentNode;
- this.object = object;
- this.children = new Children(this);
- }
-
- /**
- * Used when building the parent.
- *
- * @param object the wrapped portal object
- * @param childNode the child node creating that object
- */
- private CorePortalNode(PortalObject object, CorePortalNode childNode)
- {
- this.portalAuthorizationManager = childNode.portalAuthorizationManager;
- this.object = object;
- this.children = new Siblings(childNode);
- }
-
- public int getType()
- {
- return object.getType();
- }
-
- public PortalNode getRoot()
- {
- if (root == null)
- {
- PortalNode parent = getParent();
- if (parent == null)
- {
- root = this;
- }
- else
- {
- root = parent.getRoot();
- }
- }
- return root;
- }
-
- public PortalNode getParent()
- {
- if (parentNode == null)
- {
- PortalObject objectParent = object.getParent();
- if (objectParent != null)
- {
- parentNode = new CorePortalNode(objectParent, this);
- }
- }
- return parentNode;
- }
-
- public String getName()
- {
- return object.getName();
- }
-
- public String getDisplayName(Locale locale)
- {
- // Lazyly compute the display name
- if (displayNameKey == null)
- {
- displayNameKey = RESOURCE_PREFIX + object.getName();
- }
-
- // Try to get the display name from the resource bundles
- String displayName = null;
- ResourceBundle bundle = resourceBundles.getResourceBundle(locale);
- if (bundle != null)
- {
- try
- {
- displayName = bundle.getString(displayNameKey);
- }
- catch (MissingResourceException ignore)
- {
- }
- }
-
- // If nothing found just use the name
- if (displayName == null)
- {
- displayName = object.getName();
- }
-
- //
- return displayName;
- }
-
- public PortalNode getChild(String name)
- {
- return (PortalNode)children.getMap().get(name);
- }
-
- public Collection getChildren()
- {
- return children.getList();
- }
-
- public PortalNode resolve(String relativePath)
- {
- // Use this as a starting point
- PortalNode node = this;
-
- //
- RelativePathParser cursor = new RelativePathParser(relativePath);
- for (int i = cursor.next(); i != RelativePathParser.NONE && node != null; i = cursor.next())
- {
- switch (i)
- {
- case RelativePathParser.DOWN:
- String name = relativePath.substring(cursor.getOffset(), cursor.getOffset() + cursor.getLength());
- node = node.getChild(name);
- break;
- case RelativePathParser.UP:
- node = node.getParent();
- break;
- }
- }
- return node;
- }
-
- public Map getProperties()
- {
- return object.getProperties();
- }
-
- public PortalNodeURL createURL(PortalRuntimeContext portalRuntimeContext)
- {
- CorePortalRuntimeContext crc = (CorePortalRuntimeContext)portalRuntimeContext;
-
- //
- return crc.getURLFactory().createURL(this);
- }
-
- //
-
- public PortalObjectId getObjectId()
- {
- return object.getId();
- }
-
- public PortalNodeEvent fireEvent(PortalEventListenerRegistry registry, PortalNodeEvent event, PortalRuntimeContext prc)
- {
- return new Bubbler(registry, this, event, prc).dispatch();
- }
-
- private static class Bubbler implements PortalNodeEventContext
- {
-
- /** . */
- PortalEventListenerRegistry registry;
-
- /** . */
- private PortalNodeEvent event;
-
- /** . */
- private CorePortalNode node;
-
- /** . */
- private PortalRuntimeContext prc;
-
- public Bubbler(
- PortalEventListenerRegistry registry,
- CorePortalNode node,
- PortalNodeEvent event,
- PortalRuntimeContext prc)
- {
- this.registry = registry;
- this.node = node;
- this.event = event;
- this.prc = prc;
- }
-
- public PortalRuntimeContext getPortalRuntimeContext()
- {
- return prc;
- }
-
- public PortalNodeEvent dispatch()
- {
- PortalNodeEventListener listener = null;
- if (node.object.getListener() != null)
- {
- Object tmp = registry.getListener(node.object.getListener());
- if (tmp != null && tmp instanceof PortalNodeEventListener)
- {
- listener = (PortalNodeEventListener)tmp;
- }
- }
-
- // Dispatch to the listener
- PortalNodeEvent nextEvent = null;
- if (listener != null)
- {
- CorePortalNode current = node;
- try
- {
- node = (CorePortalNode)node.getParent();
- nextEvent = listener.onEvent(this, event);
- }
- finally
- {
- node = current;
- }
- }
- else
- {
- if (node.getParent() != null)
- {
- CorePortalNode current = node;
- try
- {
- node = (CorePortalNode)node.getParent();
- nextEvent = dispatch();
- }
- finally
- {
- node = current;
- }
- }
- }
-
- //
- return nextEvent;
- }
-
- public PortalNode getNode()
- {
- return node;
- }
- }
-
- private float getWeight()
- {
- switch(object.getType())
- {
- case PortalObject.TYPE_CONTEXT:
- return 0;
- case PortalObject.TYPE_PORTAL:
- return 1;
- case PortalObject.TYPE_PAGE:
- String orderProperty = object.getDeclaredProperty(ORDER);
- if (orderProperty == null)
- {
- return 2.999f;
- }
- try
- {
- return Float.parseFloat("2." + orderProperty);
- }
- catch (NumberFormatException e)
- {
- return 2.999f;
- }
- case PortalObject.TYPE_WINDOW:
- return 3;
- default:
- return 4;
- }
- }
-
- private static final Comparator siblingComparator = new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- CorePortalNode node1 = (CorePortalNode)o1;
- CorePortalNode node2 = (CorePortalNode)o2;
- float weight1 = node1.getWeight();
- float weight2 = node2.getWeight();
- if (weight1 == weight2)
- {
- return node1.getName().compareTo(node2.getName());
- }
- else if (weight1 < weight2)
- {
- return -1;
- }
- else
- {
- return 1;
- }
- }
- };
-
- private abstract class NodeList
- {
-
- /** . */
- private Map map;
-
- /** . */
- private List list;
-
- protected abstract Map createMap();
-
- public final List getList()
- {
- if (list == null)
- {
- Map childrenMap = getMap();
-
- //
- list = new ArrayList(childrenMap.values());
- Collections.sort(list, siblingComparator);
- list = Collections.unmodifiableList(list);
- }
-
- //
- return list;
- }
-
- public final Map getMap()
- {
- if (map == null)
- {
- map = createMap();
- }
-
- //
- return map;
- }
-
- /**
- * Compute and returns a modifiable map made of the children nodes.
- */
- protected final Map buildChildMap(CorePortalNode objectNode)
- {
- PortalObject object = objectNode.object;
-
- //
- Collection tmp = object.getChildren();
-
- //
- if (tmp.size() > 0)
- {
- Map childrenMap = new HashMap();
-
- //
- for (Iterator i = tmp.iterator(); i.hasNext();)
- {
- PortalObject childObject = (PortalObject)i.next();
-
- // Prepare to check
- PortalObjectPermission perm = new PortalObjectPermission(childObject.getId(), PortalObjectPermission.VIEW_MASK);
-
- // We only add it if the user can view the node
- if (portalAuthorizationManager.checkPermission(perm))
- {
- CorePortalNode child = new CorePortalNode(objectNode, childObject);
- childrenMap.put(child.getName(), child);
- }
- }
-
- //
- return childrenMap;
- }
- else
- {
- return Collections.EMPTY_MAP;
- }
- }
- }
-
- private class Children extends NodeList
- {
-
- /** . */
- private CorePortalNode node;
-
- public Children(CorePortalNode node)
- {
- this.node = node;
- }
-
- protected Map createMap()
- {
- return buildChildMap(node);
- }
- }
-
- private class Siblings extends NodeList
- {
-
- /** . */
- private CorePortalNode node;
-
- private Siblings(CorePortalNode node)
- {
- this.node = node;
- }
-
- protected Map createMap()
- {
- Map childrenNodes = buildChildMap(node.parentNode);
-
- // Replace the node with the one provided
- childrenNodes.put(node.getName(), node);
-
- //
- return childrenNodes;
- }
- }
-}
Deleted: 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 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,97 +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.core.impl.api;
-
-import org.jboss.portal.api.PortalRuntimeContext;
-import org.jboss.portal.api.navstate.NavigationalStateContext;
-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;
-
-import javax.servlet.http.HttpSession;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CorePortalRuntimeContext implements PortalRuntimeContext
-{
-
- /** . */
- private CoreNavigationalStateContext navigationalStateContext;
-
- /** . */
- private PortalNodeURLFactory urlFactory;
-
- /** . */
- private PortalSession session;
-
- /** . */
- private String userId;
-
- public CorePortalRuntimeContext(HttpSession session)
- {
- this.session = new CorePortalSession(session);
- }
-
- public CorePortalRuntimeContext(HttpSession session, String userId)
- {
- this.session = new CorePortalSession(session);
- this.userId = userId;
- }
-
- public CorePortalRuntimeContext(ControllerContext controllerContext)
- {
- navigationalStateContext = new CoreNavigationalStateContext(controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE));
- session = new CorePortalSession(controllerContext.getServerInvocation().getServerContext().getClientRequest().getSession());
- urlFactory = new PortalNodeURLFactory(controllerContext);
-
- //
- User user = controllerContext.getUser();
- if (user != null)
- {
- userId = user.getId().toString();
- }
- }
-
- public String getUserId()
- {
- return userId;
- }
-
- public PortalSession getSession()
- {
- return session;
- }
-
- public NavigationalStateContext getNavigationalStateContext()
- {
- return navigationalStateContext;
- }
-
- public PortalNodeURLFactory getURLFactory()
- {
- return urlFactory;
- }
-}
Deleted: 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 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,79 +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.core.impl.api;
-
-import org.jboss.portal.api.session.PortalSession;
-
-import javax.servlet.http.HttpSession;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CorePortalSession implements PortalSession
-{
-
- /** . */
- private HttpSession session;
-
- public CorePortalSession(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);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/api/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/PortalNodeURLFactory.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/PortalNodeURLFactory.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,158 +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.core.impl.api;
-
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
-import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5136 $
- */
-public class PortalNodeURLFactory
-{
-
- /** . */
- private final ControllerContext controllerContext;
-
- public PortalNodeURLFactory(ControllerContext controllerContext)
- {
- this.controllerContext = controllerContext;
- }
-
- public PortalNodeURL createURL(PortalNode node)
- {
- CorePortalNode pon = (CorePortalNode)node;
- switch (node.getType())
- {
- case PortalNode.TYPE_WINDOW:
- return new WindowURL(pon.getObjectId(), controllerContext);
- case PortalNode.TYPE_PAGE:
- return new PageURL(pon.getObjectId(), controllerContext);
- case PortalNode.TYPE_PORTAL:
- case PortalNode.TYPE_CONTEXT:
- default:
- throw new IllegalArgumentException("This kind of node does not support render url " + node);
- }
- }
-
- private static class AbstractPortalNodeURL implements PortalNodeURL
- {
-
- /** . */
- protected PortalObjectId id;
-
- /** . */
- protected ControllerContext controllerContext;
-
- /** . */
- protected PortletParametersStateString parameters;
-
- /** . */
- protected Boolean wantSecure;
-
- /** . */
- protected Boolean wantAuthenticated;
-
- /** . */
- protected boolean relative;
-
- public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
- {
- this.id = id;
- this.controllerContext = controllerContext;
- this.relative = true;
- this.parameters = new PortletParametersStateString();
- }
-
- public void setParameter(String name, String value)
- {
- parameters.setValue(name, value);
- }
-
- public void setParameter(String name, String[] values)
- {
- parameters.setValues(name, values);
- }
-
- public void setAuthenticated(Boolean authenticated)
- {
- this.wantAuthenticated = authenticated;
- }
-
- public void setSecure(Boolean secure)
- {
- this.wantSecure = secure;
- }
-
- public void setRelative(boolean relative)
- {
- this.relative = relative;
- }
-
- protected URLContext getURLContext()
- {
- return controllerContext.getServerInvocation().getServerContext().getURLContext();
- }
-
- }
-
- private static class WindowURL extends AbstractPortalNodeURL
- {
-
- public WindowURL(PortalObjectId id, ControllerContext controllerContext)
- {
- super(id, controllerContext);
- }
-
- public String toString()
- {
- InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
- URLContext urlContext = getURLContext();
- return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
- }
- }
-
- private static class PageURL extends AbstractPortalNodeURL
- {
-
- public PageURL(PortalObjectId id, ControllerContext controllerContext)
- {
- super(id, controllerContext);
- }
-
- public String toString()
- {
- ViewPageCommand cmd = new ViewPageCommand(id);
- URLContext urlContext = getURLContext();
- return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
- }
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/PortalRuntimeContextImpl.java (from rev 7130, trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalRuntimeContext.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/PortalRuntimeContextImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/PortalRuntimeContextImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,100 @@
+/******************************************************************************
+ * 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.api;
+
+import org.jboss.portal.api.PortalRuntimeContext;
+import org.jboss.portal.api.navstate.NavigationalStateContext;
+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.core.impl.api.session.PortalSessionImpl;
+import org.jboss.portal.core.impl.api.navstate.NavigationalStateContextImpl;
+import org.jboss.portal.core.impl.api.node.PortalNodeURLFactory;
+import org.jboss.portal.identity.User;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalRuntimeContextImpl implements PortalRuntimeContext
+{
+
+ /** . */
+ private NavigationalStateContextImpl navigationalStateContext;
+
+ /** . */
+ private PortalNodeURLFactory urlFactory;
+
+ /** . */
+ private PortalSession session;
+
+ /** . */
+ private String userId;
+
+ public PortalRuntimeContextImpl(HttpSession session)
+ {
+ this.session = new PortalSessionImpl(session);
+ }
+
+ public PortalRuntimeContextImpl(HttpSession session, String userId)
+ {
+ this.session = new PortalSessionImpl(session);
+ this.userId = userId;
+ }
+
+ public PortalRuntimeContextImpl(ControllerContext controllerContext)
+ {
+ navigationalStateContext = new NavigationalStateContextImpl(controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE));
+ session = new PortalSessionImpl(controllerContext.getServerInvocation().getServerContext().getClientRequest().getSession());
+ urlFactory = new PortalNodeURLFactory(controllerContext);
+
+ //
+ User user = controllerContext.getUser();
+ if (user != null)
+ {
+ userId = user.getId().toString();
+ }
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ public PortalSession getSession()
+ {
+ return session;
+ }
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+
+ public PortalNodeURLFactory getURLFactory()
+ {
+ return urlFactory;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/event/EventBridge.java (from rev 7130, trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/event/EventBridge.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/event/EventBridge.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * 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.api.event;
+
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.portal.api.event.PortalEvent;
+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.session.event.PortalSessionEvent;
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+import org.jboss.portal.core.impl.api.PortalRuntimeContextImpl;
+import org.jboss.portal.core.impl.api.event.PortalEventContextImpl;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+import java.util.Iterator;
+
+/**
+ * Bridge
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class EventBridge 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)
+ {
+ PortalRuntimeContextImpl rt = new PortalRuntimeContextImpl(event.getSession());
+ PortalEventContextImpl uec = new PortalEventContextImpl(rt);
+ PortalSessionEvent use = new PortalSessionEvent(PortalSessionEvent.SESSION_CREATED);
+ fireEvent(uec, use);
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event)
+ {
+ PortalRuntimeContextImpl rt = new PortalRuntimeContextImpl(event.getSession());
+ PortalEventContextImpl uec = new PortalEventContextImpl(rt);
+ PortalSessionEvent use = new PortalSessionEvent(PortalSessionEvent.SESSION_DESTROYED);
+ fireEvent(uec, use);
+ }
+
+ // HttpSessionAttributeListener implementation **********************************************************************
+
+
+ public void attributeAdded(HttpSessionBindingEvent event)
+ {
+ if ("PRINCIPAL_TOKEN".equals(event.getName()))
+ {
+ String userId = (String)event.getValue();
+ PortalRuntimeContextImpl rt = new PortalRuntimeContextImpl(event.getSession(), userId);
+ PortalEventContextImpl uec = new PortalEventContextImpl(rt);
+ UserAuthenticationEvent uae = new UserAuthenticationEvent(userId, UserAuthenticationEvent.SIGN_IN);
+ fireEvent(uec, uae);
+ }
+ }
+
+ public void attributeRemoved(HttpSessionBindingEvent event)
+ {
+ if ("PRINCIPAL_TOKEN".equals(event.getName()))
+ {
+ String userId = (String)event.getValue();
+ PortalRuntimeContextImpl rt = new PortalRuntimeContextImpl(event.getSession(), userId);
+ PortalEventContextImpl uec = new PortalEventContextImpl(rt);
+ UserAuthenticationEvent uae = new UserAuthenticationEvent(userId, UserAuthenticationEvent.SIGN_OUT);
+ fireEvent(uec, uae);
+ }
+ }
+
+ public void attributeReplaced(HttpSessionBindingEvent event)
+ {
+ }
+
+ private void fireEvent(PortalEventContext eventContext, 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(eventContext, event);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/event/PortalEventContextImpl.java (from rev 7111, trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventContext.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/event/PortalEventContextImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/event/PortalEventContextImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.api.event;
+
+import org.jboss.portal.api.event.PortalEventContext;
+import org.jboss.portal.api.PortalRuntimeContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalEventContextImpl implements PortalEventContext
+{
+
+ /** . */
+ private PortalRuntimeContext portalRuntimeContext;
+
+ public PortalEventContextImpl(PortalRuntimeContext portalRuntimeContext)
+ {
+ this.portalRuntimeContext = portalRuntimeContext;
+ }
+
+ public PortalRuntimeContext getPortalRuntimeContext()
+ {
+ return portalRuntimeContext;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/navstate/NavigationalStateContextImpl.java (from rev 7111, trunk/core/src/main/org/jboss/portal/core/impl/api/CoreNavigationalStateContext.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/navstate/NavigationalStateContextImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/navstate/NavigationalStateContextImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * 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.api.navstate;
+
+import org.jboss.portal.api.navstate.NavigationalStateContext;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
+import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NavigationalStateContextImpl implements NavigationalStateContext
+{
+
+ /** . */
+ private AttributeResolver navigationalStateResolver;
+
+ public NavigationalStateContextImpl(AttributeResolver navigationalStateResolver)
+ {
+ this.navigationalStateResolver = navigationalStateResolver;
+ }
+
+ private WindowNavigationalState getWNS(PortalNode window, boolean create)
+ {
+ PortalNodeImpl pon = (PortalNodeImpl)window;
+ NavigationalStateKey key = new NavigationalStateKey(WindowNavigationalState.class, pon.getObjectId());
+ WindowNavigationalState wns = (WindowNavigationalState)navigationalStateResolver.getAttribute(key);
+ if (wns == null && create)
+ {
+ wns = WindowNavigationalState.create();
+ navigationalStateResolver.setAttribute(key, wns);
+ }
+ return wns;
+ }
+
+ public WindowState getWindowState(PortalNode window) throws IllegalArgumentException
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException("No null window can be provided");
+ }
+
+ //
+ WindowNavigationalState wns = getWNS(window, false);
+ if (wns != null)
+ {
+ return wns.getWindowState();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void setWindowState(PortalNode window, WindowState windowState) throws IllegalArgumentException
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException("No null window can be provided");
+ }
+ if (windowState == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PortalNodeImpl pon = (PortalNodeImpl)window;
+ WindowNavigationalState.setWindowState(navigationalStateResolver, pon.getObjectId(), windowState);
+ }
+
+ public Mode getMode(PortalNode window) throws IllegalArgumentException
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException("No null window can be provided");
+ }
+
+ //
+ WindowNavigationalState wns = getWNS(window, false);
+ if (wns != null)
+ {
+ return wns.getMode();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void setMode(PortalNode window, Mode mode) throws IllegalArgumentException
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException("No null window can be provided");
+ }
+ if (mode == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PortalNodeImpl pon = (PortalNodeImpl)window;
+
+ //
+ WindowNavigationalState.setMode(navigationalStateResolver, pon.getObjectId(), mode);
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeEventContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeEventContextImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeEventContextImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.PortalRuntimeContext;
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalNodeEventContextImpl implements PortalNodeEventContext
+{
+
+ /** . */
+ PortalEventListenerRegistry registry;
+
+ /** . */
+ private PortalNodeEvent event;
+
+ /** . */
+ private PortalNodeImpl node;
+
+ /** . */
+ private PortalRuntimeContext prc;
+
+ public PortalNodeEventContextImpl(
+ PortalEventListenerRegistry registry,
+ PortalNodeImpl node,
+ PortalNodeEvent event,
+ PortalRuntimeContext prc)
+ {
+ this.registry = registry;
+ this.node = node;
+ this.event = event;
+ this.prc = prc;
+ }
+
+ public PortalRuntimeContext getPortalRuntimeContext()
+ {
+ return prc;
+ }
+
+ public PortalNodeEvent dispatch()
+ {
+ PortalNodeEventListener listener = null;
+ if (node.object.getListener() != null)
+ {
+ Object tmp = registry.getListener(node.object.getListener());
+ if (tmp != null && tmp instanceof PortalNodeEventListener)
+ {
+ listener = (PortalNodeEventListener)tmp;
+ }
+ }
+
+ // Dispatch to the listener
+ PortalNodeEvent nextEvent = null;
+ if (listener != null)
+ {
+ PortalNodeImpl current = node;
+ try
+ {
+ node = (PortalNodeImpl)node.getParent();
+ nextEvent = listener.onEvent(this, event);
+ }
+ finally
+ {
+ node = current;
+ }
+ }
+ else
+ {
+ if (node.getParent() != null)
+ {
+ PortalNodeImpl current = node;
+ try
+ {
+ node = (PortalNodeImpl)node.getParent();
+ nextEvent = dispatch();
+ }
+ finally
+ {
+ node = current;
+ }
+ }
+ }
+
+ //
+ return nextEvent;
+ }
+
+ public PortalNode getNode()
+ {
+ return node;
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java (from rev 7111, trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalNode.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,423 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.api.PortalRuntimeContext;
+import org.jboss.portal.common.path.RelativePathParser;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.common.i18n.SimpleResourceBundleFactory;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.impl.api.PortalRuntimeContextImpl;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.util.Comparator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalNodeImpl implements PortalNode
+{
+
+ /** Order. */
+ private static final String ORDER = "order";
+
+ /** The prefix for resources in the bundle. */
+ private static final String RESOURCE_PREFIX = "PAGENAME_";
+
+ /** . */
+ private static final String BUNDLE_BASE_NAME = "conf.bundles.Resource";
+
+ /** . */
+ private static final ResourceBundleManager resourceBundles = new ResourceBundleManager(null, new SimpleResourceBundleFactory(BUNDLE_BASE_NAME, PortalNodeImpl.class.getClassLoader()));
+
+ /** The wrapped portal object. */
+ final PortalObject object;
+
+ /** The parent node. */
+ private PortalNodeImpl parentNode;
+
+ /** The children. */
+ private final NodeList children;
+
+ /** The root node. */
+ private PortalNode root;
+
+ /** The key for the display name in the resource bundle. */
+ private String displayNameKey;
+
+ /** The security checks. */
+ private final PortalAuthorizationManager portalAuthorizationManager;
+
+ /**
+ * Build a portal node object wrapping the specified portal object.
+ *
+ * @param object the wrapped portal object
+ * @throws IllegalArgumentException if the specified object is null
+ */
+ public PortalNodeImpl(PortalAuthorizationManager portalAuthorizationManager, PortalObject object) throws IllegalArgumentException
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.portalAuthorizationManager = portalAuthorizationManager;
+ this.object = object;
+ this.children = new Children(this);
+ }
+
+ /**
+ * Used during the construction of a children list.
+ *
+ * @param parentNode the parent node of this node
+ * @param object the wrapped portal object
+ */
+ protected PortalNodeImpl(PortalNodeImpl parentNode, PortalObject object)
+ {
+ this.portalAuthorizationManager = parentNode.portalAuthorizationManager;
+ this.parentNode = parentNode;
+ this.object = object;
+ this.children = new Children(this);
+ }
+
+ /**
+ * Used when building the parent.
+ *
+ * @param object the wrapped portal object
+ * @param childNode the child node creating that object
+ */
+ private PortalNodeImpl(PortalObject object, PortalNodeImpl childNode)
+ {
+ this.portalAuthorizationManager = childNode.portalAuthorizationManager;
+ this.object = object;
+ this.children = new Siblings(childNode);
+ }
+
+ public int getType()
+ {
+ return object.getType();
+ }
+
+ public PortalNode getRoot()
+ {
+ if (root == null)
+ {
+ PortalNode parent = getParent();
+ if (parent == null)
+ {
+ root = this;
+ }
+ else
+ {
+ root = parent.getRoot();
+ }
+ }
+ return root;
+ }
+
+ public PortalNode getParent()
+ {
+ if (parentNode == null)
+ {
+ PortalObject objectParent = object.getParent();
+ if (objectParent != null)
+ {
+ parentNode = new PortalNodeImpl(objectParent, this);
+ }
+ }
+ return parentNode;
+ }
+
+ public String getName()
+ {
+ return object.getName();
+ }
+
+ public String getDisplayName(Locale locale)
+ {
+ // Lazyly compute the display name
+ if (displayNameKey == null)
+ {
+ displayNameKey = RESOURCE_PREFIX + object.getName();
+ }
+
+ // Try to get the display name from the resource bundles
+ String displayName = null;
+ ResourceBundle bundle = resourceBundles.getResourceBundle(locale);
+ if (bundle != null)
+ {
+ try
+ {
+ displayName = bundle.getString(displayNameKey);
+ }
+ catch (MissingResourceException ignore)
+ {
+ }
+ }
+
+ // If nothing found just use the name
+ if (displayName == null)
+ {
+ displayName = object.getName();
+ }
+
+ //
+ return displayName;
+ }
+
+ public PortalNode getChild(String name)
+ {
+ return (PortalNode)children.getMap().get(name);
+ }
+
+ public Collection getChildren()
+ {
+ return children.getList();
+ }
+
+ public PortalNode resolve(String relativePath)
+ {
+ // Use this as a starting point
+ PortalNode node = this;
+
+ //
+ RelativePathParser cursor = new RelativePathParser(relativePath);
+ for (int i = cursor.next(); i != RelativePathParser.NONE && node != null; i = cursor.next())
+ {
+ switch (i)
+ {
+ case RelativePathParser.DOWN:
+ String name = relativePath.substring(cursor.getOffset(), cursor.getOffset() + cursor.getLength());
+ node = node.getChild(name);
+ break;
+ case RelativePathParser.UP:
+ node = node.getParent();
+ break;
+ }
+ }
+ return node;
+ }
+
+ public Map getProperties()
+ {
+ return object.getProperties();
+ }
+
+ public PortalNodeURL createURL(PortalRuntimeContext portalRuntimeContext)
+ {
+ PortalRuntimeContextImpl crc = (PortalRuntimeContextImpl)portalRuntimeContext;
+
+ //
+ return crc.getURLFactory().createURL(this);
+ }
+
+ public PortalObjectId getObjectId()
+ {
+ return object.getId();
+ }
+
+ private float getWeight()
+ {
+ switch(object.getType())
+ {
+ case PortalObject.TYPE_CONTEXT:
+ return 0;
+ case PortalObject.TYPE_PORTAL:
+ return 1;
+ case PortalObject.TYPE_PAGE:
+ String orderProperty = object.getDeclaredProperty(ORDER);
+ if (orderProperty == null)
+ {
+ return 2.999f;
+ }
+ try
+ {
+ return Float.parseFloat("2." + orderProperty);
+ }
+ catch (NumberFormatException e)
+ {
+ return 2.999f;
+ }
+ case PortalObject.TYPE_WINDOW:
+ return 3;
+ default:
+ return 4;
+ }
+ }
+
+ private static final Comparator siblingComparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ PortalNodeImpl node1 = (PortalNodeImpl)o1;
+ PortalNodeImpl node2 = (PortalNodeImpl)o2;
+ float weight1 = node1.getWeight();
+ float weight2 = node2.getWeight();
+ if (weight1 == weight2)
+ {
+ return node1.getName().compareTo(node2.getName());
+ }
+ else if (weight1 < weight2)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ };
+
+ private abstract class NodeList
+ {
+
+ /** . */
+ private Map map;
+
+ /** . */
+ private List list;
+
+ protected abstract Map createMap();
+
+ public final List getList()
+ {
+ if (list == null)
+ {
+ Map childrenMap = getMap();
+
+ //
+ list = new ArrayList(childrenMap.values());
+ Collections.sort(list, siblingComparator);
+ list = Collections.unmodifiableList(list);
+ }
+
+ //
+ return list;
+ }
+
+ public final Map getMap()
+ {
+ if (map == null)
+ {
+ map = createMap();
+ }
+
+ //
+ return map;
+ }
+
+ /**
+ * Compute and returns a modifiable map made of the children nodes.
+ */
+ protected final Map buildChildMap(PortalNodeImpl objectNode)
+ {
+ PortalObject object = objectNode.object;
+
+ //
+ Collection tmp = object.getChildren();
+
+ //
+ if (tmp.size() > 0)
+ {
+ Map childrenMap = new HashMap();
+
+ //
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ PortalObject childObject = (PortalObject)i.next();
+
+ // Prepare to check
+ PortalObjectPermission perm = new PortalObjectPermission(childObject.getId(), PortalObjectPermission.VIEW_MASK);
+
+ // We only add it if the user can view the node
+ if (portalAuthorizationManager.checkPermission(perm))
+ {
+ PortalNodeImpl child = new PortalNodeImpl(objectNode, childObject);
+ childrenMap.put(child.getName(), child);
+ }
+ }
+
+ //
+ return childrenMap;
+ }
+ else
+ {
+ return Collections.EMPTY_MAP;
+ }
+ }
+ }
+
+ private class Children extends NodeList
+ {
+
+ /** . */
+ private PortalNodeImpl node;
+
+ public Children(PortalNodeImpl node)
+ {
+ this.node = node;
+ }
+
+ protected Map createMap()
+ {
+ return buildChildMap(node);
+ }
+ }
+
+ private class Siblings extends NodeList
+ {
+
+ /** . */
+ private PortalNodeImpl node;
+
+ private Siblings(PortalNodeImpl node)
+ {
+ this.node = node;
+ }
+
+ protected Map createMap()
+ {
+ Map childrenNodes = buildChildMap(node.parentNode);
+
+ // Replace the node with the one provided
+ childrenNodes.put(node.getName(), node);
+
+ //
+ return childrenNodes;
+ }
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java (from rev 7111, trunk/core/src/main/org/jboss/portal/core/impl/api/PortalNodeURLFactory.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/node/PortalNodeURLFactory.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -0,0 +1,159 @@
+/******************************************************************************
+ * 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.api.node;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5136 $
+ */
+public class PortalNodeURLFactory
+{
+
+ /** . */
+ private final ControllerContext controllerContext;
+
+ public PortalNodeURLFactory(ControllerContext controllerContext)
+ {
+ this.controllerContext = controllerContext;
+ }
+
+ public PortalNodeURL createURL(PortalNode node)
+ {
+ PortalNodeImpl pon = (PortalNodeImpl)node;
+ switch (node.getType())
+ {
+ case PortalNode.TYPE_WINDOW:
+ return new WindowURL(pon.getObjectId(), controllerContext);
+ case PortalNode.TYPE_PAGE:
+ return new PageURL(pon.getObjectId(), controllerContext);
+ case PortalNode.TYPE_PORTAL:
+ case PortalNode.TYPE_CONTEXT:
+ default:
+ throw new IllegalArgumentException("This kind of node does not support render url " + node);
+ }
+ }
+
+ private static class AbstractPortalNodeURL implements PortalNodeURL
+ {
+
+ /** . */
+ protected PortalObjectId id;
+
+ /** . */
+ protected ControllerContext controllerContext;
+
+ /** . */
+ protected PortletParametersStateString parameters;
+
+ /** . */
+ protected Boolean wantSecure;
+
+ /** . */
+ protected Boolean wantAuthenticated;
+
+ /** . */
+ protected boolean relative;
+
+ public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ this.id = id;
+ this.controllerContext = controllerContext;
+ this.relative = true;
+ this.parameters = new PortletParametersStateString();
+ }
+
+ public void setParameter(String name, String value)
+ {
+ parameters.setValue(name, value);
+ }
+
+ public void setParameter(String name, String[] values)
+ {
+ parameters.setValues(name, values);
+ }
+
+ public void setAuthenticated(Boolean authenticated)
+ {
+ this.wantAuthenticated = authenticated;
+ }
+
+ public void setSecure(Boolean secure)
+ {
+ this.wantSecure = secure;
+ }
+
+ public void setRelative(boolean relative)
+ {
+ this.relative = relative;
+ }
+
+ protected URLContext getURLContext()
+ {
+ return controllerContext.getServerInvocation().getServerContext().getURLContext();
+ }
+
+ }
+
+ private static class WindowURL extends AbstractPortalNodeURL
+ {
+
+ public WindowURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ super(id, controllerContext);
+ }
+
+ public String toString()
+ {
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
+ URLContext urlContext = getURLContext();
+ return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+ }
+ }
+
+ private static class PageURL extends AbstractPortalNodeURL
+ {
+
+ public PageURL(PortalObjectId id, ControllerContext controllerContext)
+ {
+ super(id, controllerContext);
+ }
+
+ public String toString()
+ {
+ ViewPageCommand cmd = new ViewPageCommand(id);
+ URLContext urlContext = getURLContext();
+ return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
+ }
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/session/PortalSessionImpl.java (from rev 7130, trunk/core/src/main/org/jboss/portal/core/impl/api/CorePortalSession.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/session/PortalSessionImpl.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/session/PortalSessionImpl.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -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.api.session;
+
+import org.jboss.portal.api.session.PortalSession;
+
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalSessionImpl implements PortalSession
+{
+
+ /** . */
+ private HttpSession session;
+
+ public PortalSessionImpl(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("api." + name);
+ }
+
+ public void setAttribute(String name, Object attribute)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ session.setAttribute("api." + name, attribute);
+ }
+
+ public void removeAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ session.removeAttribute("api." + name);
+ }
+}
Deleted: 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 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridge.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,142 +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.core.impl.api.user;
-
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.portal.api.event.PortalEvent;
-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.session.event.PortalSessionEvent;
-import org.jboss.portal.core.event.PortalEventListenerRegistry;
-import org.jboss.portal.core.impl.api.CorePortalRuntimeContext;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.http.HttpSessionAttributeListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-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)
- {
- CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession());
- UserEventContext uec = new UserEventContext(rt);
- PortalSessionEvent use = new PortalSessionEvent(PortalSessionEvent.SESSION_CREATED);
- fireEvent(uec, use);
- }
-
- public void sessionDestroyed(HttpSessionEvent event)
- {
- CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession());
- UserEventContext uec = new UserEventContext(rt);
- PortalSessionEvent use = new PortalSessionEvent(PortalSessionEvent.SESSION_DESTROYED);
- fireEvent(uec, use);
- }
-
- // HttpSessionAttributeListener implementation **********************************************************************
-
-
- public void attributeAdded(HttpSessionBindingEvent event)
- {
- if ("PRINCIPAL_TOKEN".equals(event.getName()))
- {
- String userId = (String)event.getValue();
- CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession(), userId);
- UserEventContext uec = new UserEventContext(rt);
- UserAuthenticationEvent uae = new UserAuthenticationEvent(userId, UserAuthenticationEvent.SIGN_IN);
- fireEvent(uec, uae);
- }
- }
-
- public void attributeRemoved(HttpSessionBindingEvent event)
- {
- if ("PRINCIPAL_TOKEN".equals(event.getName()))
- {
- String userId = (String)event.getValue();
- CorePortalRuntimeContext rt = new CorePortalRuntimeContext(event.getSession(), userId);
- UserEventContext uec = new UserEventContext(rt);
- UserAuthenticationEvent uae = new UserAuthenticationEvent(userId, UserAuthenticationEvent.SIGN_OUT);
- fireEvent(uec, uae);
- }
- }
-
- public void attributeReplaced(HttpSessionBindingEvent event)
- {
- }
-
- private void fireEvent(PortalEventContext eventContext, 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(eventContext, event);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridgeTriggerInterceptor.java (from rev 7111, trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventInterceptor.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridgeTriggerInterceptor.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventBridgeTriggerInterceptor.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -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.core.impl.api.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;
+
+/**
+ * Trigger user events in the event bridge.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserEventBridgeTriggerInterceptor 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();
+ }
+}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventContext.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventContext.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,47 +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.core.impl.api.user;
-
-import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.PortalRuntimeContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class UserEventContext implements PortalEventContext
-{
-
- /** . */
- private PortalRuntimeContext portalRuntimeContext;
-
- public UserEventContext(PortalRuntimeContext portalRuntimeContext)
- {
- this.portalRuntimeContext = portalRuntimeContext;
- }
-
- public PortalRuntimeContext getPortalRuntimeContext()
- {
- return portalRuntimeContext;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventInterceptor.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/impl/api/user/UserEventInterceptor.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -1,65 +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.core.impl.api.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();
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java 2007-04-29 22:03:38 UTC (rev 7134)
@@ -24,7 +24,7 @@
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.core.impl.api.CorePortalNode;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portlet.JBossPortlet;
@@ -127,9 +127,9 @@
{
boolean allowed = false;
// check if the current user is allowed to access this page
- if (child instanceof CorePortalNode)
+ if (child instanceof PortalNodeImpl)
{
- CorePortalNode pn = (CorePortalNode)child;
+ PortalNodeImpl pn = (PortalNodeImpl)child;
PortalObjectPermission perm = new PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
{
@@ -152,9 +152,9 @@
{
boolean allowed = false;
// check if the current user is allowed to access this page
- if (parentSibling instanceof CorePortalNode)
+ if (parentSibling instanceof PortalNodeImpl)
{
- CorePortalNode pn = (CorePortalNode)parentSibling;
+ PortalNodeImpl pn = (PortalNodeImpl)parentSibling;
PortalObjectPermission perm = new PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
{
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-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-29 22:03:38 UTC (rev 7134)
@@ -108,7 +108,7 @@
<xmbean/>
</mbean>
<mbean
- code="org.jboss.portal.core.impl.api.user.UserEventInterceptor"
+ code="org.jboss.portal.core.impl.api.user.UserEventBridgeTriggerInterceptor"
name="portal:service=Interceptor,type=Server,name=UserEvent"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified: trunk/core/src/resources/portal-server-war/WEB-INF/web.xml
===================================================================
--- trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-04-29 20:16:18 UTC (rev 7133)
+++ trunk/core/src/resources/portal-server-war/WEB-INF/web.xml 2007-04-29 22:03:38 UTC (rev 7134)
@@ -33,7 +33,7 @@
<!-- Bridge portal user events -->
<listener>
- <listener-class>org.jboss.portal.core.impl.api.user.UserEventBridge</listener-class>
+ <listener-class>org.jboss.portal.core.impl.api.event.EventBridge</listener-class>
</listener>
<!-- The portal servlet is the main entrance point -->
17 years
JBoss Portal SVN: r7133 - trunk/core/src/main/org/jboss/portal/core/aspects/controller/node.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 16:16:18 -0400 (Sun, 29 Apr 2007)
New Revision: 7133
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
Log:
- create WindowRenderEvent correctly
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 13:54:48 UTC (rev 7132)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-04-29 20:16:18 UTC (rev 7133)
@@ -44,9 +44,11 @@
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.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.impl.api.CorePortalNode;
import org.jboss.portal.core.impl.api.CorePortalRuntimeContext;
+import org.jboss.portal.core.navstate.NavigationalStateKey;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
@@ -261,12 +263,24 @@
}
else if (cmd instanceof RenderWindowCommand)
{
+ WindowRenderEvent event = new WindowRenderEvent(node);
+
+ //
RenderWindowCommand rwc = (RenderWindowCommand)cmd;
+ NavigationalStateKey key = new NavigationalStateKey(WindowNavigationalState.class, rwc.getTargetId());
+ WindowNavigationalState navstate = (WindowNavigationalState)cmd.getControllerContext().getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, key);
+ if (navstate != null)
+ {
+ event.setMode(navstate.getMode());
+ event.setWindowState(navstate.getWindowState());
- //
- WindowRenderEvent event = new WindowRenderEvent(node);
- event.setMode(rwc.getMode());
- event.setWindowState(rwc.getWindowState());
+ StateString parametersState = navstate.getState();
+ if (parametersState instanceof PortletParametersStateString)
+ {
+ Map params = ((PortletParametersStateString)parametersState).getParameters();
+ event.setParameters(params);
+ }
+ }
}
}
else if (cmd instanceof RenderPageCommand)
17 years
JBoss Portal SVN: r7132 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 09:54:48 -0400 (Sun, 29 Apr 2007)
New Revision: 7132
Modified:
docs/trunk/referenceGuide/en/modules/portalapi.xml
Log:
more portal api doc
Modified: docs/trunk/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-29 13:48:37 UTC (rev 7131)
+++ docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-29 13:54:48 UTC (rev 7132)
@@ -226,8 +226,15 @@
<sect2>
<title>Portal node events</title>
<para>Portal node events extends the abstract portal event framework in order to provide notifications
- about user interface events happening at runtime. For instance when the portal renders a page, a corresponding
- event will be fired.</para>
+ about user interface events happening at runtime. For instance when the portal renders a page or a window,
+ a corresponding event will be fired.</para>
+ <sect3>Portal node event propagation model</sect3>
+ <para>
+ A portal node event is fired when an event of interest happens to a portal node of the portal tree. The
+ notification model is comparable to the <ulink url="http://en.wikipedia.org/wiki/DOM_Events#Event_flow">bubbling propagation model </ulink>
+ defined by the DOM specification. When an event is fired, the event is propagated in the hierarchy from the most
+ inner node where the event happens to the root node of the tree.
+ </para>
</sect2>
<sect2>
<title>Portal user events</title>
17 years
JBoss Portal SVN: r7131 - in docs/trunk/referenceGuide/en: images/portalapi and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 09:48:37 -0400 (Sun, 29 Apr 2007)
New Revision: 7131
Added:
docs/trunk/referenceGuide/en/images/content/all.png
docs/trunk/referenceGuide/en/images/portalapi/NavigationalStateContext.png
docs/trunk/referenceGuide/en/images/portalapi/PortalEvent.png
docs/trunk/referenceGuide/en/images/portalapi/PortalEventContext.png
docs/trunk/referenceGuide/en/images/portalapi/PortalEventListener.png
docs/trunk/referenceGuide/en/images/portalapi/PortalRuntimeContext.png
Modified:
docs/trunk/referenceGuide/en/modules/installation.xml
docs/trunk/referenceGuide/en/modules/portalapi.xml
Log:
more portal api doc
Added: docs/trunk/referenceGuide/en/images/content/all.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/content/all.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/trunk/referenceGuide/en/images/portalapi/NavigationalStateContext.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/portalapi/NavigationalStateContext.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/trunk/referenceGuide/en/images/portalapi/PortalEvent.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/portalapi/PortalEvent.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/trunk/referenceGuide/en/images/portalapi/PortalEventContext.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/portalapi/PortalEventContext.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/trunk/referenceGuide/en/images/portalapi/PortalEventListener.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/portalapi/PortalEventListener.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: docs/trunk/referenceGuide/en/images/portalapi/PortalRuntimeContext.png
===================================================================
(Binary files differ)
Property changes on: docs/trunk/referenceGuide/en/images/portalapi/PortalRuntimeContext.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: docs/trunk/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/installation.xml 2007-04-29 13:00:50 UTC (rev 7130)
+++ docs/trunk/referenceGuide/en/modules/installation.xml 2007-04-29 13:48:37 UTC (rev 7131)
@@ -40,9 +40,9 @@
Application Server 4.0.4.GA) that prevents the complete deployment of JBoss Portal's WSRP service if the user
is not online or behind a firewall/proxy. This, in turn, prevents the deployment of JBoss Portal. If you do not
need the WSRP service, you can remove the
- <emphasis>portal-wsrp.sar</emphasis>
+ <filename>portal-wsrp.sar</filename>
file from the
- <emphasis>jboss-portal.sar</emphasis>
+ <filename>jboss-portal.sar</filename>
file. If you'd like to use the WSRP service, the JBoss WS issue has been
addressed in version 1.0.2.GA of JBoss WS. Please follow the instructions on
<ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRP_UpdateJBossWS">how to upgrade JBoss WS</ulink>
@@ -73,13 +73,13 @@
<para>
<emphasis role="bold">Extract the bundle:</emphasis>
Extract the zip archive to a directory of your choosing. In windows, we
- recommend, C:\jboss-X.X.X
+ recommend, <command>C:\jboss-X.X.X</command>
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">Start the Server:</emphasis>
- Go to JBOSS_INSTALL_DIRECTORY/bin and execute run.bat (run.sh, if
+ Go to JBOSS_INSTALL_DIRECTORY/bin and execute <command>run.bat</command> (<command>run.sh</command>, if
Linux)
</para>
</listitem>
@@ -103,7 +103,7 @@
<sect1 id="install_binary">
<title>Installing from Binary Download</title>
<para>The binary download package typically consists of the
- <emphasis>jboss-portal.sar</emphasis>
+ <filename>jboss-portal.sar</filename>
, documentation (which you are already reading), and a set of preconfigured datasource descriptors that allow
JBoss Portal to communicate with a database.
</para>
@@ -169,7 +169,7 @@
<emphasis role="bold">Deploy your JDBC connector:</emphasis>
You must make available a JDBC connector for JBoss Portal to communicate with your database. The
connector lib should be placed in
- <emphasis>JBOSS_INSTALL_DIRECTORY/server/default/lib/*</emphasis>
+ <filename>JBOSS_INSTALL_DIRECTORY/server/default/lib/*</filename>
</para>
</listitem>
</orderedlist>
@@ -219,13 +219,13 @@
Copy the datasource descriptor file (*-ds.xml) you modified above AND the
<emphasis>jboss-portal.sar</emphasis>
from the download folder to
- <emphasis>JBOSS_INSTALL_DIRECTORY/server/default/deploy/.</emphasis>
+ <filename>JBOSS_INSTALL_DIRECTORY/server/default/deploy/.</filename>
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">Start the Server:</emphasis>
- Go to JBOSS_INSTALL_DIRECTORY/bin and execute run.bat (run.sh, if
+ Go to <filename>JBOSS_INSTALL_DIRECTORY/bin</filename> and execute <command>run.bat</command> (<command>run.sh</command>, if
Linux)
</para>
</listitem>
@@ -309,7 +309,7 @@
<sect3 id="install_source_env">
<title>Operating System Environment Setting</title>
<para>For the build targets to work, you must first set the
- <emphasis>JBOSS_HOME</emphasis>
+ <filename>JBOSS_HOME</filename>
environment variable in your
operating system, to the root directory of the JBoss Application Server installation.
</para>
@@ -320,7 +320,7 @@
section, click
<emphasis>New</emphasis>
. You will be setting the
- <emphasis>JBOSS_HOME</emphasis>
+ <filename>JBOSS_HOME</filename>
environment variable to the location of your JBoss Application Server installation:
<mediaobject>
<imageobject>
@@ -330,7 +330,7 @@
</para>
<para>
On a Unix-like Operating System, you would accomplish this by typing:
- <programlisting>export JBOSS_HOME=/path/to/your/jboss/directory</programlisting>
+ <command>export JBOSS_HOME=/path/to/your/jboss/directory</command>
</para>
</sect3>
<sect3>
@@ -357,7 +357,7 @@
<emphasis role="bold">Deploy your JDBC connector:</emphasis>
You must make available a JDBC connector for JBoss Portal to communicate with your database. The
connector lib should be placed in
- <emphasis>JBOSS_HOME/server/default/lib/*</emphasis>
+ <filename>JBOSS_HOME/server/default/lib/*</filename>
</para>
</listitem>
</orderedlist>
@@ -373,7 +373,7 @@
</para>
<para>
Navigate to
- <emphasis>JBOSS_PORTAL_HOME_DIRECTORY/core</emphasis>
+ <filename>JBOSS_PORTAL_HOME_DIRECTORY/core</filename>
and type:
<programlisting>build datasource</programlisting>
<mediaobject>
@@ -411,14 +411,14 @@
Now
<emphasis role="bold">copy</emphasis>
your datasource descriptor to
- <emphasis>JBOSS_HOME/server/default/deploy</emphasis>
+ <filename>JBOSS_HOME/server/default/deploy</filename>
</para>
</sect3>
</sect2>
<sect2>
<title>Building/Deploying from Sources</title>
<para>To build and deploy the JBoss Portal service, go to
- <emphasis>JBOSS_PORTAL_HOME_DIRECTORY/build</emphasis>
+ <filename>JBOSS_PORTAL_HOME_DIRECTORY/build</filename>
and type:
<programlisting>build deploy</programlisting>
<mediaobject>
@@ -427,23 +427,23 @@
</imageobject>
</mediaobject>
<note>To build the clustered version, you will need to go to
- <emphasis>JBOSS_PORTAL_HOME_DIRECTORY/build</emphasis>
+ <filename>JBOSS_PORTAL_HOME_DIRECTORY/build</filename>
and type:
- <programlisting>build main</programlisting>
+ <command>build main</command>
Then, go to
- <emphasis>JBOSS_PORTAL_HOME_DIRECTORY/core</emphasis>
+ <filename>JBOSS_PORTAL_HOME_DIRECTORY/core</filename>
and type:
- <programlisting>build deploy-ha</programlisting>
+ <command>build deploy-ha</command>
This will copy the
- <emphasis>jboss-portal-ha.sar</emphasis>
+ <filename>jboss-portal-ha.sar</filename>
to your
- <emphasis>all</emphasis>
+ <filename>all</filename>
configuration for you.
</note>
At the end of the build process, the
- <emphasis>jboss-portal.sar</emphasis>
+ <filename>jboss-portal.sar</filename>
is copied to
- <emphasis>JBOSS_HOME/server/default/deploy</emphasis>
+ <filename>JBOSS_HOME/server/default/deploy</filename>
:
<mediaobject>
<imageobject>
@@ -451,7 +451,7 @@
</imageobject>
</mediaobject>
Please verify that your
- <emphasis>JBOSS_HOME/server/default/deploy</emphasis>
+ <filename>JBOSS_HOME/server/default/deploy</filename>
directory, contains both necessary files before starting JBoss Application Server.
</para>
<para>
@@ -505,7 +505,7 @@
</listitem>
<listitem>
<para>After you have downloaded the installer jar, you can execute it with
- <emphasis>java -jar xxxx-installer.jar</emphasis>
+ <command>java -jar xxxx-installer.jar</command>
</para>
</listitem>
<listitem>
@@ -564,7 +564,7 @@
</listitem>
<listitem>
<para>Now, start JBoss AS, by executing
- <emphasis>INSTALL_PATH/bin/run.bat</emphasis>
+ <command>INSTALL_PATH/bin/run.bat</command>
. The initial startup process will create all of the necessary portal tables in the embedded
Hypersonic database.
<note>This will require JDK5+</note>
Modified: docs/trunk/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-29 13:00:50 UTC (rev 7130)
+++ docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-29 13:48:37 UTC (rev 7131)
@@ -46,21 +46,6 @@
it makes the assumption that the underlying object is of type Portlet.</note>
</sect1>
<sect1>
- <title>Portal session</title>
- <mediaobject>
- <imageobject>
- <imagedata width="28em" align="center" fileref="images/portalapi/PortalSession.png" format="png"/>
- </imageobject>
- <caption>
- <para>The PortalSession interface</para>
- </caption>
- </mediaobject>
- <para>It is possible to have access to a portion of the portal session to store objects. The <emphasis>org.jboss.portal.api.PortalSession</emphasis>
- interface defines its API and is similar to the <emphasis>javax.servlet.http.HttpSession</emphasis> except that it does
- not offer methods to invalidate the session as the session is managed by the portal.
- </para>
- </sect1>
- <sect1>
<title>Portal URL</title>
<para>The Portal API defines the <emphasis>org.jboss.portal.api.PortalURL</emphasis> interface to represent
URL managed by the portal.</para>
@@ -85,6 +70,39 @@
</itemizedlist>
</sect1>
<sect1>
+ <title>Portal session</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalSession.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The PortalSession interface</para>
+ </caption>
+ </mediaobject>
+ <para>It is possible to have access to a portion of the portal session to store objects. The <emphasis>org.jboss.portal.api.session.PortalSession</emphasis>
+ interface defines its API and is similar to the <emphasis>javax.servlet.http.HttpSession</emphasis> except that it does
+ not offer methods to invalidate the session as the session is managed by the portal.
+ </para>
+ </sect1>
+
+ <sect1>
+ <title>Portal runtime context</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalRuntimeContext.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The PortalRuntimeContext interface</para>
+ </caption>
+ </mediaobject>
+ <para>The <emphasis>org.jboss.portal.api.PortalRuntimeContext</emphasis> gives access to state or operations
+ associated at runtime with the current user of the portal. It allows to retrieve the user id when the method
+ <emphasis>String getUserId()</emphasis> returns a non null string. It also gives access to the
+ <emphasis>PortalSession</emphasis> instance associated with the current user. Finally it gives access to the
+ <emphasis>NavigationalStateContext</emphasis> associated with the current user.</para>
+ </sect1>
+
+ <sect1>
<title>Portal nodes</title>
<para>The portal structure is a tree formed by nodes. It is possible to programmatically access the portal tree in order to
</para>
@@ -123,10 +141,11 @@
<listitem>PortalNode.TYPE_WINDOW : the node represents a page window</listitem>
</itemizedlist>
<para>The <emphasis>org.jboss.portal.api.node.PortalNodeURL</emphasis> is an extension of the <emphasis>PortalURL</emphasis> interface
- which adds additional methods useful for setting
- parameters on the URL. There are no guarantees that the portal node will use the parameters. So far portal node
- URL parameters are only useful for nodes of type <emphasis>PortalNode.TYPE_WINDOW</emphasis> and they should
- be treated as portlet render parameters in the case of the portlet is a local portlet and is not a remote portlet.</para>
+ which adds additional methods useful for setting parameters on the URL. There are no guarantees that the
+ portal node will use the parameters. So far portal node URL parameters are only useful for nodes of type
+ <emphasis>PortalNode.TYPE_WINDOW</emphasis> and they should be treated as portlet render parameters in the case of
+ the portlet is a local portlet and is not a remote portlet. The method that creates portal node URL requires
+ as parameter an instance of <emphasis>PortalRuntimeContext</emphasis>.</para>
<para>The interface also offers methods to navigate the node hierarchy:</para>
<programlisting><![CDATA[
public interface PortalNode
@@ -141,22 +160,81 @@
]]></programlisting>
</sect1>
<sect1>
+ <title>Portal navitational state</title>
+ <para>The navigational state is a state managed by the portal that associates to each user the state triggered
+ by its navigation. A well known part of the navigational state are the render parameters provided at runtime
+ during the call of the method <emphasis>void render(RenderRequest req, RenderResponse resp)</emphasis>. The portal
+ API offers an interface to query and update the navigational state of the portal. For now the API only exposes
+ mode and window states of portal nodes of type window.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/NavigationalStateContext.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The NavigationalStateContext interface</para>
+ </caption>
+ </mediaobject>
+ </sect1>
+ <sect1>
<title>Portal events</title>
- <para>todo</para>
+ <para>Portal events are a powerful mechanism to be aware of what is happening in the portal at runtime. The base
+ package for event is <emphasis>org.jboss.portal.api.event</emphasis> and it contains the common event classes
+ and interfaces.
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalEvent.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The PortalEvent class</para>
+ </caption>
+ </mediaobject>
+ <para>The <emphasis>org.jboss.portal.api.event.PortalEvent</emphasis> abstract class is the base class for
+ all kind of portal events.
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalEventContext.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The PortalEventContext interface</para>
+ </caption>
+ </mediaobject>
+ <para>
+ The <emphasis>org.jboss.portal.api.event.PortalEventContext</emphasis> interface defines the context in which
+ an event is created and propagated. It allows to retrieve the <emphasis>PortalRuntimeContext</emphasis> in
+ order to obtain the portal context. Note that this method may return null if no context is available.
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalEventListener.png" format="png"/>
+ </imageobject>
+ <caption>
+ <para>The PortalEventListener interface</para>
+ </caption>
+ </mediaobject>
+ <para>
+ The <emphasis>org.jboss.portal.api.event.PortalEventListener</emphasis> interface defines the contract that
+ class can implement in order to receive portal event notifications. It contains the method
+ <emphasis>void onEvent(PortalEvent event)</emphasis> called by the portal framework.
+ </para>
+ <important>
+ The event propagation model is to use one instance of a listener class to receive all portal events that
+ may be routed to that class when appropriate. Therefore implementors needs to be aware of that model
+ and must provide implementations that are thread safe.
+ </important>
<sect2>
<title>Portal node events</title>
- <para>todo</para>
+ <para>Portal node events extends the abstract portal event framework in order to provide notifications
+ about user interface events happening at runtime. For instance when the portal renders a page, a corresponding
+ event will be fired.</para>
</sect2>
<sect2>
<title>Portal user events</title>
- <para>todo</para>
+ <para>The life cycle of the user can also raise events such as .</para>
</sect2>
</sect1>
<sect1>
- <title>Portal navitational state</title>
- <para>todo</para>
- </sect1>
- <sect1>
<title>Examples</title>
<para>todo</para>
</sect1>
17 years
JBoss Portal SVN: r7130 - in trunk: api/src/main/org/jboss/portal/api/node/event and 8 other directories.
by portal-commits@lists.jboss.org
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)
17 years
JBoss Portal SVN: r7129 - in trunk: core/src/main/org/jboss/portal/core/metadata/portlet and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 07:58:03 -0400 (Sun, 29 Apr 2007)
New Revision: 7129
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd
trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml
Log:
- document the header injection of content in dtd
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-04-29 11:58:03 UTC (rev 7129)
@@ -78,11 +78,10 @@
if ("link".equalsIgnoreCase(localName))
{
String href = attrs.getValue("href");
- String title = attrs.getValue("title");
String type = attrs.getValue("type");
String media = attrs.getValue("media");
String rel = attrs.getValue("rel");
- ElementMetaData elt = ElementMetaData.createLinkElement(type, rel, href, title, media);
+ ElementMetaData elt = ElementMetaData.createLinkElement(type, rel, href, media);
elt.init();
child = elt;
}
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2007-04-29 11:58:03 UTC (rev 7129)
@@ -81,13 +81,12 @@
* @param type the type attribute of the link
* @param rel the rel attribute of the link
* @param href the href attribute of the link
- * @param title the title attribute of the link
* @param media the media attribute of the link
* @return a new link header element
*/
- public static ElementMetaData createLinkElement(String type, String rel, String href, String title, String media)
+ public static ElementMetaData createLinkElement(String type, String rel, String href, String media)
{
- return new LinkElementMetaData(rel, type, href, title, media);
+ return new LinkElementMetaData(rel, type, href, media);
}
/**
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2007-04-29 11:58:03 UTC (rev 7129)
@@ -43,9 +43,6 @@
/** %URI : CDATA -- a Uniform Resource Identifier, see [URI]. */
private String hrefAttribute;
- /** %Text : CDATA : CDATA. */
- private String titleAttribute;
-
/** %MediaDesc : CDATA -- single or comma-separated list of media descriptors. */
private String mediaAttribute;
@@ -53,13 +50,11 @@
String relAttribute,
String typeAttribute,
String hrefAttribute,
- String titleAttribute,
String mediaAttribute)
{
this.typeAttribute = typeAttribute;
this.relAttribute = relAttribute;
this.hrefAttribute = hrefAttribute;
- this.titleAttribute = titleAttribute;
this.mediaAttribute = mediaAttribute;
}
@@ -78,10 +73,6 @@
{
attributes.add(new MarkupAttribute("href", hrefAttribute, MarkupAttribute.Type.URI));
}
- if (titleAttribute != null && titleAttribute.length() > 0)
- {
- attributes.add(new MarkupAttribute("title", titleAttribute, MarkupAttribute.Type.TEXT));
- }
if (mediaAttribute != null && mediaAttribute.length() > 0)
{
attributes.add(new MarkupAttribute("media", mediaAttribute, MarkupAttribute.Type.MEDIA_DESC));
@@ -104,11 +95,6 @@
return hrefAttribute;
}
- public String getTitleAttribute()
- {
- return titleAttribute;
- }
-
public String getMediaAttribute()
{
return mediaAttribute;
Modified: trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-04-29 11:58:03 UTC (rev 7129)
@@ -81,7 +81,6 @@
LinkElementMetaData link = (LinkElementMetaData)elements.get(0);
assertEquals("text/css", link.getTypeAttribute());
assertEquals("stylesheet", link.getRelAttribute());
- assertEquals("stylesheet title", link.getTitleAttribute());
assertEquals("screen", link.getMediaAttribute());
assertEquals("test.css", link.getHrefAttribute());
Modified: trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-app_2_6.dtd 2007-04-29 11:58:03 UTC (rev 7129)
@@ -32,10 +32,11 @@
<!ELEMENT jboss-app (app-name?)>
<!--
-When a web application is deployed, the context path under wich it is deployed is taken as application
-name. The application name value in this descriptor is used to override it. When a component references a
-references a portlet, it needs to reference the application too and if the portlet application war file is renammed
-the reference is not valid anymore. Therefore this tag is used to have an application name that does not depend
-upon the context path under which the application is deployed.
+When a web application is deployed, the context path under wich it is deployed
+is taken as application name. The application name value in this descriptor is
+used to override it. When a component references a references a portlet, it needs to
+reference the application too and if the portlet application war file is renammed
+the reference is not valid anymore. Therefore this tag is used to have an application
+name that does not depend upon the context path under which the application is deployed.
-->
<!ELEMENT app-name (#PCDATA)>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-04-29 11:58:03 UTC (rev 7129)
@@ -31,30 +31,33 @@
-->
<!--
-The remotable element is used to configure the default behavior of the portlets with respect to WSRP
-exposure.
+The remotable element is used to configure the default behavior of the portlets with
+respect to WSRP exposure.
-For each portlet defined in portlet.xml, it is possible to configure specific settings
-of the portlet container.
+For each portlet defined in portlet.xml, it is possible to configure specific
+settings of the portlet container.
-It is also possible to inject services in the portlet context of the application using the service elements.
+It is also possible to inject services in the portlet context of the application
+using the service elements.
-->
<!ELEMENT portlet-app (remotable?,portlet*,service*)>
<!--
Additional configuration for a portlet.
-The portlet-name defines the name of the portlet. It must match a portlet defined already in portlet.xml
-of the same web application.
+The portlet-name defines the name of the portlet. It must match a portlet defined already
+in portlet.xml of the same web application.
-The remotable element configures the portlet exposure to WSRP. If no value is present then the value considered
-is either the value defined globally at the portlet application level or false.
+The remotable element configures the portlet exposure to WSRP. If no value is present
+then the value considered is either the value defined globally at the portlet
+application level or false.
-The trans-attribute value specifies the behavior of the portlet when it is invoked at runtime with
-respect to the transactionnal context. According to how the portlet is invoked a transaction may exist or not
-before the portlet is invoked. Usually in the local context the portal transaction could be present.
-By default the value considered is NotSupported which means that the portal transaction will be suspended
-for the duration of the portlet invocation.
+The trans-attribute value specifies the behavior of the portlet when it is invoked at
+runtime with respect to the transactionnal context. According to how the portlet is
+invoked a transaction may exist or not before the portlet is invoked. Usually in the
+local context the portal transaction could be present. By default the value considered is
+ NotSupported which means that the portal transaction will be suspended for the duration
+ of the portlet invocation.
Example:
@@ -73,13 +76,15 @@
<!ELEMENT portlet-name (#PCDATA)>
<!--
-The remotable value is used for WSRP exposure. The accepted values are the litterals true of false.
+The remotable value is used for WSRP exposure. The accepted values are the
+litterals true of false.
-->
<!ELEMENT remotable (#PCDATA)>
<!--
-The ajax tag allows to configure the ajax capabilities of the portlet. If the portlet is tagged as partial-refresh
-then the portal may use partial page refreshing and render only that portlet. If the portlet partial-refresh value
+The ajax tag allows to configure the ajax capabilities of the portlet. If
+the portlet is tagged as partial-refresh then the portal may use partial page
+refreshing and render only that portlet. If the portlet partial-refresh value
is false, then the portal will perform a full page refresh when the portlet is refreshed.
-->
<!ELEMENT ajax (partial-refresh)>
@@ -92,9 +97,9 @@
<!--
This element configure the portlet session of the portlet.
-The distributed element instructs the container to distribute the session attributes using the
-portal session replication. It applies only to local portlets are not to remote portlets.
-The default value is false.
+The distributed element instructs the container to distribute the session attributes
+using the portal session replication. It applies only to local portlets are not to
+remote portlets. The default value is false.
Example:
@@ -123,39 +128,65 @@
<!ELEMENT transaction (trans-attribute)>
<!--
-The trans-attribute value defines the transactionnal behavior. The accepted values are Required,
-Mandatory, Never, Supports, NotSupported and RequiresNew.
+The trans-attribute value defines the transactionnal behavior. The accepted values
+are Required, Mandatory, Never, Supports, NotSupported and RequiresNew.
-->
<!ELEMENT trans-attribute (#PCDATA)>
<!--
-Specify content which should be included in the portal aggregated page when the portlet is present
-on that page. This setting only applies when the portlet is used in the local mode.
+Specify content which should be included in the portal aggregated page when the portlet
+is present on that page. This setting only applies when the portlet is used in the local mode.
-->
<!ELEMENT header-content (link|script|meta)*>
<!--
-todo + check if ANY cannot be restricted
--->
-<!ELEMENT link ANY>
+Creates an header markup element for linked resources,
+see http://www.w3.org/TR/html401/struct/links.html#h-12.3
-<!--
-todo
+At runtime the href attribute value will be prefixed with the context path
+of the web application.
+
+Example:
+
+<link rel="stylesheet" type="text/css" href="/style.css" media="screen"/>
+
+will produce at runtime the following markup
+
+<link rel="stylesheet" type="text/css" href="/my-web-application/style.css" media="screen"/>
-->
<!ATTLIST link
+ href CDATA #IMPLIED
rel CDATA #IMPLIED
- href CDATA #IMPLIED
- title CDATA #IMPLIED
type CDATA #IMPLIED
media CDATA #IMPLIED>
<!--
-todo + check if ANY cannot be restricted
+No content is allowed inside an link element.
-->
-<!ELEMENT script ANY>
+<!ELEMENT link EMPTY>
<!--
-todo
+Creates an header markup for scripting,
+see http://www.w3.org/TR/html401/interact/scripts.html
+
+At runtime the src attribute value will be prefixed with the context path
+of the web application.
+
+Example 1:
+
+<script type="text/javascript" src="/myscript.js"></script>
+
+will produce at runtime the following markup
+
+<script type="text/javascript" src="/my-web-application/myscript.js"></script>
+
+Example 2:
+
+<script type="text/javascript">
+ function hello() {
+ alert('Hello');
+ }
+</script>
-->
<!ATTLIST script
src CDATA #IMPLIED
@@ -163,30 +194,41 @@
language CDATA #IMPLIED>
<!--
-todo + check if ANY cannot be restricted
+The script header element can contain inline script definitions.
-->
-<!ELEMENT meta ANY>
+<!ELEMENT script (#PCDATA)>
<!--
-todo
+Creates an header markup for adding meta data to a page,
+see http://www.w3.org/TR/html401/struct/global.html#h-7.4.4
+
+Example:
+
+<meta name="keywords" content="jboss, portal, redhat"/>
-->
<!ATTLIST meta
name CDATA #REQUIRED
content CDATA #REQUIRED>
<!--
-Declare a service that will be injected by the portlet container as an attribute of the portlet context.
+No content is allowed for meta element.
+-->
+<!ELEMENT meta EMPTY>
-Example :
+<!--
+Declare a service that will be injected by the portlet container as an
+attribute of the portlet context.
+Example:
+
<service>
<service-name>UserModule</service-name>
<service-class>org.jboss.portal.identity.UserModule</service-class>
<service-ref>:service=Module,type=User</service-ref>
</service>
-In the portlet it is then possible to use it by doing a lookup on the service name, for example in the
-init() lifecycle method :
+In the portlet it is then possible to use it by doing a lookup on the service
+name, for example in the init() lifecycle method :
public void init()
{
@@ -207,7 +249,8 @@
<!ELEMENT service-class (#PCDATA)>
<!--
-The reference to the service. In the JMX Microkernel environment it consist of the JMX name of the service MBean.
-For an MBean reference if the domain is left out, then the current domain of the portal will be used.
+The reference to the service. In the JMX Microkernel environment it consist of the JMX
+name of the service MBean. For an MBean reference if the domain is left out, then the
+current domain of the portal will be used.
-->
<!ELEMENT service-ref (#PCDATA)>
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-04-29 11:58:03 UTC (rev 7129)
@@ -37,10 +37,10 @@
<!--
The deployment is a generic container for portal object elements. The parent-ref
child gives the name of the parent object that the current object will use as parent.
-The optional if-exists element define the behavior when a portal object which an identical
-name is already child of the parent element. The default behavior of the if-exist tag is to
-keep the existing object and not create a new object. The last element is the portal object
-itself.
+The optional if-exists element define the behavior when a portal object which
+an identical name is already child of the parent element. The default behavior of
+the if-exist tag is to keep the existing object and not create a new object. The
+last element is the portal object itself.
Example:
@@ -53,11 +53,11 @@
All portal objects have a common configuration which can be :
-1/ a listener : specifies the id of a listener is the listener registry. A listener object is able to
-listen portal events which apply to the portal node hierarchy.
+1/ a listener : specifies the id of a listener is the listener registry. A listener
+object is able to listen portal events which apply to the portal node hierarchy.
-2/ properties : a set of generic properties owned by the portal object. Some properties can drive the behavior
-of the object.
+2/ properties : a set of generic properties owned by the portal object. Some
+properties can drive the behavior of the object.
3/ security-constraint : defines security configuration of the portal object.
@@ -72,22 +72,26 @@
Example:
<parent-ref/> the root having an empty path
-<parent-ref>default</parent-ref> the object with the name default under the root having the path (default)
+
+<parent-ref>default</parent-ref> the object with the name default under the root
+having the path (default)
+
<parent-ref>default.default</parent-ref> the object with the path (default,default)
-->
<!ELEMENT parent-ref (#PCDATA)>
<!--
-The authorized values are overwrite and keep. Overwrite means that the existing object will be destroyed
-and the current declaration will be used. Keep means that the existing object will not be destroyed and
-no creation hence will be done.
+The authorized values are overwrite and keep. Overwrite means that the existing
+object will be destroyed and the current declaration will be used. Keep means that
+the existing object will not be destroyed and no creation hence will be done.
-->
<!ELEMENT if-exists (#PCDATA)>
<!--
-A portal object of type context. A context type represent a node in the tree which does not have
-a visual representation. It can exist only under the root. A context can only have children with the portal type.
+A portal object of type context. A context type represent a node in the tree which
+does not have a visual representation. It can exist only under the root. A context can
+only have children with the portal type.
-->
<!ELEMENT context (context-name,properties?,listener?,security-constraint?,portal*)>
@@ -97,12 +101,14 @@
<!ELEMENT context-name (#PCDATA)>
<!--
-A portal object of type portal. A portal type represents a virtual portal and can have children of type page.
-In addition of the common portal object elements it support also the declaration of the modes and the window
-states it supports. If no declaration of modes or window states is done then the default value will be
-respectively (view,edit,help) and (normal,minimized,maximized).
+A portal object of type portal. A portal type represents a virtual portal and can
+have children of type page. In addition of the common portal object elements it support
+also the declaration of the modes and the window states it supports. If no declaration
+of modes or window states is done then the default value will be respectively
+(view,edit,help) and (normal,minimized,maximized).
-->
-<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,listener?,security-constraint?,page*)>
+<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,
+ listener?,security-constraint?,page*)>
<!--
The portal name value.
@@ -148,8 +154,9 @@
<!ELEMENT window-state (#PCDATA)>
<!--
-A portal object of type page. A page type represents a page which can have children of type page and window.
-The children windows are the windows of the page and the children pages are the subpages of this page.
+A portal object of type page. A page type represents a page which can have children of
+type page and window. The children windows are the windows of the page and the children
+pages are the subpages of this page.
-->
<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*)>
@@ -159,12 +166,13 @@
<!ELEMENT page-name (#PCDATA)>
<!--
-A portal object of type window. A window type represents a window. Beside the common properties a window has
-a content and belong to a region on the page.
+A portal object of type window. A window type represents a window. Beside the common
+properties a window has a content and belong to a region on the page.
-The instance-ref or content tags are used to define the content of the window. The usage of the content tag
-is generic and can be used to describe any kind of content. The instance-ref is a shortcut to define a content
-type of portlet which points to a portlet instance.
+The instance-ref or content tags are used to define the content of the window. The
+usage of the content tag is generic and can be used to describe any kind of content.
+The instance-ref is a shortcut to define a content type of portlet which points to a
+portlet instance.
The region and height defines how the window is placed in the page.
-->
@@ -176,7 +184,8 @@
<!ELEMENT window-name (#PCDATA)>
<!--
-Define the content of the window as a reference to a portlet instance. The value is the id of the instance.
+Define the content of the window as a reference to a portlet instance. The value
+is the id of the instance.
Example:
@@ -186,8 +195,8 @@
<!ELEMENT instance-ref (#PCDATA)>
<!--
-Define the content of the window in a generic manner. The content is define by the type of the content
-and an URI which acts as an identificator for the content.
+Define the content of the window in a generic manner. The content is define by
+the type of the content and an URI which acts as an identificator for the content.
Example:
Modified: trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/resources/portal-core-sar/dtd/portlet-instances_2_6.dtd 2007-04-29 11:58:03 UTC (rev 7129)
@@ -44,9 +44,10 @@
<!ELEMENT if-exists (#PCDATA)>
<!--
-The instance element is used to create an instance of a portlet from the portlet application of the same
-war file containing the portlet-instances.xml file. The portlet will be created and configured only
-if the portlet is present and an instance with such a name does not already exist.
+The instance element is used to create an instance of a portlet from the portlet
+application of the same war file containing the portlet-instances.xml file. The portlet
+will be created and configured only if the portlet is present and an instance with
+such a name does not already exist.
Example :
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-04-29 11:58:03 UTC (rev 7129)
@@ -63,11 +63,6 @@
<transaction>
<trans-attribute>RequiresNew</trans-attribute>
</transaction>
-<!--
- <header-content>
- <link rel="stylesheet" type="text/css" href="/style.css" title="" media="screen"/>
- </header-content>
--->
</portlet>
<!-- Service injected in the portlet context. -->
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-04-29 11:58:03 UTC (rev 7129)
@@ -32,7 +32,7 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
- <link rel="stylesheet" type="text/css" href="/style.css" title="" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/style.css" media="screen"/>
</header-content>
</portlet>
<portlet>
@@ -41,7 +41,7 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
- <link rel="stylesheet" type="text/css" href="/style.css" title="" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/style.css" media="screen"/>
</header-content>
</portlet>
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml 2007-04-29 11:58:03 UTC (rev 7129)
@@ -32,7 +32,7 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
- <link rel="stylesheet" type="text/css" href="/images/cms/admin/style.css" title="" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/images/cms/admin/style.css" media="screen"/>
</header-content>
</portlet>
<!-- Service injected in the portlet context. -->
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml 2007-04-29 08:40:00 UTC (rev 7128)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml 2007-04-29 11:58:03 UTC (rev 7129)
@@ -28,7 +28,7 @@
<trans-attribute>Required</trans-attribute>
</transaction>
<header-content>
- <link rel="stylesheet" type="text/css" href="/style.css" title="" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/style.css" media="screen"/>
</header-content>
</portlet>
<service>
17 years
JBoss Portal SVN: r7128 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-29 04:40:00 -0400 (Sun, 29 Apr 2007)
New Revision: 7128
Modified:
docs/trunk/referenceGuide/en/modules/portalapi.xml
Log:
specifying relative size of UML images for a better layout
Modified: docs/trunk/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-28 22:58:49 UTC (rev 7127)
+++ docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-29 08:40:00 UTC (rev 7128)
@@ -27,7 +27,7 @@
</itemizedlist>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/portalapi/Mode.png" format="png"/>
+ <imagedata width="28em" align="center" fileref="images/portalapi/Mode.png" format="png"/>
</imageobject>
<caption>
<para>The Mode class</para>
@@ -35,7 +35,7 @@
</mediaobject>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/portalapi/WindowState.png" format="png"/>
+ <imagedata width="28em" align="center" fileref="images/portalapi/WindowState.png" format="png"/>
</imageobject>
<caption>
<para>The WindowState class</para>
@@ -49,7 +49,7 @@
<title>Portal session</title>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/portalapi/PortalSession.png" format="png"/>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalSession.png" format="png"/>
</imageobject>
<caption>
<para>The PortalSession interface</para>
@@ -66,7 +66,7 @@
URL managed by the portal.</para>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/portalapi/PortalURL.png" format="png"/>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalURL.png" format="png"/>
</imageobject>
<caption>
<para>The PortalURL interface</para>
@@ -95,7 +95,7 @@
</itemizedlist>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/portalapi/PortalNode.png" format="png"/>
+ <imagedata width="28em" align="center" fileref="images/portalapi/PortalNode.png" format="png"/>
</imageobject>
<caption>
<para>The PortalNode interface</para>
17 years
JBoss Portal SVN: r7127 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-04-28 18:58:49 -0400 (Sat, 28 Apr 2007)
New Revision: 7127
Modified:
docs/trunk/referenceGuide/en/modules/portalapi.xml
Log:
chapter structure for portal api
Modified: docs/trunk/referenceGuide/en/modules/portalapi.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-28 22:53:07 UTC (rev 7126)
+++ docs/trunk/referenceGuide/en/modules/portalapi.xml 2007-04-28 22:58:49 UTC (rev 7127)
@@ -142,5 +142,22 @@
</sect1>
<sect1>
<title>Portal events</title>
+ <para>todo</para>
+ <sect2>
+ <title>Portal node events</title>
+ <para>todo</para>
+ </sect2>
+ <sect2>
+ <title>Portal user events</title>
+ <para>todo</para>
+ </sect2>
</sect1>
+ <sect1>
+ <title>Portal navitational state</title>
+ <para>todo</para>
+ </sect1>
+ <sect1>
+ <title>Examples</title>
+ <para>todo</para>
+ </sect1>
</chapter>
17 years