[jboss-svn-commits] JBoss Portal SVN: r5350 - in trunk/core/src: main/org/jboss/portal/core main/org/jboss/portal/core/aspects/controller main/org/jboss/portal/core/aspects/controller/node main/org/jboss/portal/core/impl/model/portal main/org/jboss/portal/core/model/portal main/org/jboss/portal/core/portlet/catalog main/org/jboss/portal/core/portlet/management main/org/jboss/portal/core/portlet/theme main/org/jboss/portal/core/portlet/user main/org/jboss/portlet resources/portal-core-sar/META-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Oct 7 09:42:06 EDT 2006
Author: julien at jboss.com
Date: 2006-10-07 09:41:42 -0400 (Sat, 07 Oct 2006)
New Revision: 5350
Added:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/JBossPortalNode.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/aspects/controller/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
Removed:
trunk/core/src/main/org/jboss/portal/core/api/
trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java
trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
decoupled implementation of portal node API from portal object tree
Deleted: trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/EventBroadcasterInterceptor.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -1,329 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.aspects.controller;
-
-import java.util.Map;
-
-import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.CommandRedirectionException;
-import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
-import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
-import org.jboss.portal.core.controller.command.WindowCommand;
-import org.jboss.portal.core.api.JBossPortalNode;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.core.api.Navigation;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.common.util.LazyMap;
-import org.jboss.portal.api.node.event.WindowActionEvent;
-import org.jboss.portal.api.node.event.WindowNavigationEvent;
-import org.jboss.portal.api.node.event.WindowRenderEvent;
-import org.jboss.portal.api.node.event.WindowEvent;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- */
-public class EventBroadcasterInterceptor extends ControllerInterceptor
-{
-
- private static Logger log = Logger.getLogger(EventBroadcasterInterceptor.class);
-
- public void invoke(ControllerCommand cmd) throws Exception, InvocationException
- {
- JBossPortalNode node = Navigation.getCurrentNode();
-
- //
- PortalNodeEvent event = createEvent(cmd, node);
- PortalNodeEvent nextEvent = null;
- if (event != null)
- {
- try
- {
- nextEvent = node.fireEvent(event);
- }
- catch (Exception e)
- {
- log.error("Error when dispatching pre event " + event, e);
- }
- }
-
- //
- ControllerCommand redirection = null;
- if (nextEvent instanceof WindowEvent)
- {
- WindowEvent we = (WindowEvent)nextEvent;
-
-
-
- JBossPortalNode nextNode = (JBossPortalNode)we.getNode();
- String nodeRef = nextNode.getRef();
- Mode mode = we.getMode();
- WindowState windowState = we.getWindowState();
- if (nextEvent instanceof WindowActionEvent)
- {
- WindowActionEvent wae = (WindowActionEvent)nextEvent;
- Map params = wae.getParameters();
-
- //
- Parameters interactionParams = null;
- if (params instanceof LazyParameterMap)
- {
- interactionParams = (Parameters)((LazyParameterMap)params).createDelegate();
- }
- else
- {
- interactionParams = asParameters(params);
- }
-
- //
- if (interactionParams != null)
- {
- redirection = new InvokeWindowActionCommand(
- nodeRef,
- mode,
- windowState,
- null,
- new ParametersStateString(interactionParams),
- null);
- }
- }
- else if (nextEvent instanceof WindowRenderEvent)
- {
- WindowRenderEvent wre = (WindowRenderEvent)nextEvent;
- Map params = wre.getParameters();
-
- //
- Parameters navigationalParams = asParameters(params);
-
- //
- if (navigationalParams != null)
- {
- redirection = new InvokeWindowRenderCommand(
- nodeRef,
- mode,
- windowState,
- new ParametersStateString(navigationalParams));
- }
- }
- else if (nextEvent instanceof WindowNavigationEvent)
- {
- redirection = new InvokeWindowRenderCommand(
- nodeRef,
- mode,
- windowState);
- }
- }
- else
- {
- if (event instanceof WindowActionEvent)
- {
- WindowActionEvent wae = (WindowActionEvent)event;
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
- Map params = wae.getParameters();
- if (params instanceof LazyParameterMap)
- {
- LazyParameterMap lpm = (LazyParameterMap)params;
- if (lpm.isModified())
- {
- iwac.setInteractionState(new ParametersStateString(lpm.params));
- iwac.setFormParameters(null);
- }
- }
- }
- }
-
- //
- if (redirection != null)
- {
- ControllerContext ctx = (ControllerContext)cmd.getContext();
- throw new CommandRedirectionException(redirection);
- }
- else
- {
- cmd.invokeNext();
- }
- }
-
- private PortalNodeEvent createEvent(ControllerCommand cmd, PortalNode node)
- {
- if (cmd instanceof WindowCommand)
- {
- WindowCommand wc = (WindowCommand)cmd;
-
- // Get the instance
- Instance instance = wc.getInstance();
- try
- {
- // Get the portlet
- Portlet portlet = instance.getPortlet();
- if (portlet != null && portlet.isRemote() == false)
- {
- if (cmd instanceof InvokeWindowActionCommand)
- {
- InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)wc;
-
- //
- Parameters formParams = iwac.getFormParameters();
-
- //
- Parameters interactionParams = null;
- if (iwac.getInteractionState() instanceof ParametersStateString)
- {
- interactionParams = ((ParametersStateString)iwac.getInteractionState()).getParameters();
- }
-
- //
- Map params = null;
- if (interactionParams != null)
- {
- if (formParams != null)
- {
- params = new LazyParameterMap(interactionParams, formParams);
- }
- else
- {
- params = interactionParams;
- }
- }
- else
- {
- if (formParams != null)
- {
- params = formParams;
- }
- else
- {
- params = new Parameters();
- }
- }
-
- //
- WindowActionEvent action = new WindowActionEvent(node);
- action.setMode(iwac.getMode());
- action.setWindowState(iwac.getWindowState());
- action.setParameters(params);
- return action;
- }
- else if (cmd instanceof InvokeWindowRenderCommand)
- {
- InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)wc;
- StateString navigationalState = iwrc.getNavigationalState();
-
- //
- if (navigationalState != null)
- {
- Map params = null;
- if (navigationalState instanceof ParametersStateString)
- {
- params = ((ParametersStateString)navigationalState).getParameters();
- }
-
- //
- WindowRenderEvent render = new WindowRenderEvent(node);
- render.setMode(iwrc.getMode());
- render.setWindowState(iwrc.getWindowState());
- render.setParameters(params);
- return render;
- }
- else
- {
- WindowNavigationEvent navigation = new WindowNavigationEvent(node);
- navigation.setMode(iwrc.getMode());
- navigation.setWindowState(iwrc.getWindowState());
- return navigation;
- }
- }
- }
- }
- catch (PortletInvokerException ignore)
- {
-
- }
- }
- return null;
- }
-
- private Parameters asParameters(Map map)
- {
- if (map == null)
- {
- return null;
- }
- if (map instanceof Parameters)
- {
- return (Parameters)map;
- }
- else
- {
- try
- {
- return new Parameters(map);
- }
- catch (IllegalArgumentException e)
- {
- log.error("Window action event received wrong parameter set", e);
- return null;
- }
- }
- }
-
- private static class LazyParameterMap extends LazyMap
- {
- /** . */
- private Parameters formParams;
-
- /** . */
- private Parameters interactionParams;
-
- /** . */
- private Parameters params;
-
- public LazyParameterMap(Parameters interactionParams, Parameters formParams)
- {
- this.formParams = formParams;
- this.interactionParams = interactionParams;
- this.params = null;
- }
-
- protected Map createDelegate()
- {
- if (params == null)
- {
- params = new Parameters(interactionParams);
- params.append(formParams);
- }
- return params;
- }
- }
-}
\ No newline at end of file
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -29,7 +29,6 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
-import org.jboss.portal.core.api.Navigation;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.identity.User;
@@ -41,9 +40,7 @@
import org.jboss.portal.theme.page.ModifiableWindowResult;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.PortalNodeURL;
-import javax.portlet.PortletURL;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
Deleted: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -1,87 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.aspects.controller;
-
-import org.jboss.portal.core.controller.ControllerInterceptor;
-import org.jboss.portal.core.controller.ControllerCommand;
-import org.jboss.portal.core.controller.command.WindowCommand;
-import org.jboss.portal.core.controller.command.RenderPageCommand;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.api.JBossPortalNode;
-import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.api.Navigation;
-
-/**
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalNodeInterceptor extends ControllerInterceptor
-{
-
-// private static Logger log = Logger.getLogger(PortalNodeInterceptor.class);
-
- public void invoke(ControllerCommand cmd) throws Exception, InvocationException
- {
- // Get the next node
- JBossPortalNode next = getNode(cmd);
-
- // Save previous node temporarily
- JBossPortalNode previous = Navigation.getCurrentNode();
-
- try
- {
- // Set next node
- Navigation.setCurrentNode(next);
-
- // Invoke
- cmd.invokeNext();
- }
- finally
- {
- // Set previous node back
- Navigation.setCurrentNode(previous);
- }
- }
-
- private JBossPortalNode getNode(ControllerCommand cmd)
- {
- JBossPortalNode next = null;
- if (cmd instanceof WindowCommand)
- {
- WindowCommand windowCmd = (WindowCommand)cmd;
- Window window = windowCmd.getWindow();
- PortalObjectContainer container = window.getContainer();
- next = container.getNode(window.getId());
- }
- else if (cmd instanceof RenderPageCommand)
- {
- RenderPageCommand rpCmd = (RenderPageCommand)cmd;
- Page page = rpCmd.getPage();
- PortalObjectContainer container = page.getContainer();
- next = container.getNode(page.getId());
- }
- return next;
- }
-}
Added: 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 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,345 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+import java.util.Map;
+
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.CommandRedirectionException;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
+import org.jboss.portal.core.controller.command.WindowCommand;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.common.util.LazyMap;
+import org.jboss.portal.api.node.event.WindowActionEvent;
+import org.jboss.portal.api.node.event.WindowNavigationEvent;
+import org.jboss.portal.api.node.event.WindowRenderEvent;
+import org.jboss.portal.api.node.event.WindowEvent;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ */
+public class EventBroadcasterInterceptor extends ControllerInterceptor
+{
+
+ /** . */
+ private static Logger log = Logger.getLogger(EventBroadcasterInterceptor.class);
+
+ /** . */
+ private PortalEventListenerRegistry listenerRegistry;
+
+
+ public PortalEventListenerRegistry getListenerRegistry()
+ {
+ return listenerRegistry;
+ }
+
+ public void setListenerRegistry(PortalEventListenerRegistry listenerRegistry)
+ {
+ this.listenerRegistry = listenerRegistry;
+ }
+
+ public void invoke(ControllerCommand cmd) throws Exception, InvocationException
+ {
+ JBossPortalNode node = Navigation.getCurrentNode();
+
+ //
+ PortalNodeEvent event = createEvent(cmd, node);
+ PortalNodeEvent nextEvent = null;
+ if (event != null)
+ {
+ try
+ {
+ nextEvent = node.fireEvent(listenerRegistry, event);
+ }
+ catch (Exception e)
+ {
+ log.error("Error when dispatching pre event " + event, e);
+ }
+ }
+
+ //
+ ControllerCommand redirection = null;
+ if (nextEvent instanceof WindowEvent)
+ {
+ WindowEvent we = (WindowEvent)nextEvent;
+
+
+
+ JBossPortalNode nextNode = (JBossPortalNode)we.getNode();
+ String nodeRef = nextNode.getRef();
+ Mode mode = we.getMode();
+ WindowState windowState = we.getWindowState();
+ if (nextEvent instanceof WindowActionEvent)
+ {
+ WindowActionEvent wae = (WindowActionEvent)nextEvent;
+ Map params = wae.getParameters();
+
+ //
+ Parameters interactionParams = null;
+ if (params instanceof LazyParameterMap)
+ {
+ interactionParams = (Parameters)((LazyParameterMap)params).createDelegate();
+ }
+ else
+ {
+ interactionParams = asParameters(params);
+ }
+
+ //
+ if (interactionParams != null)
+ {
+ redirection = new InvokeWindowActionCommand(
+ nodeRef,
+ mode,
+ windowState,
+ null,
+ new ParametersStateString(interactionParams),
+ null);
+ }
+ }
+ else if (nextEvent instanceof WindowRenderEvent)
+ {
+ WindowRenderEvent wre = (WindowRenderEvent)nextEvent;
+ Map params = wre.getParameters();
+
+ //
+ Parameters navigationalParams = asParameters(params);
+
+ //
+ if (navigationalParams != null)
+ {
+ redirection = new InvokeWindowRenderCommand(
+ nodeRef,
+ mode,
+ windowState,
+ new ParametersStateString(navigationalParams));
+ }
+ }
+ else if (nextEvent instanceof WindowNavigationEvent)
+ {
+ redirection = new InvokeWindowRenderCommand(
+ nodeRef,
+ mode,
+ windowState);
+ }
+ }
+ else
+ {
+ if (event instanceof WindowActionEvent)
+ {
+ WindowActionEvent wae = (WindowActionEvent)event;
+ InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)cmd;
+ Map params = wae.getParameters();
+ if (params instanceof LazyParameterMap)
+ {
+ LazyParameterMap lpm = (LazyParameterMap)params;
+ if (lpm.isModified())
+ {
+ iwac.setInteractionState(new ParametersStateString(lpm.params));
+ iwac.setFormParameters(null);
+ }
+ }
+ }
+ }
+
+ //
+ if (redirection != null)
+ {
+ ControllerContext ctx = (ControllerContext)cmd.getContext();
+ throw new CommandRedirectionException(redirection);
+ }
+ else
+ {
+ cmd.invokeNext();
+ }
+ }
+
+ private PortalNodeEvent createEvent(ControllerCommand cmd, PortalNode node)
+ {
+ if (cmd instanceof WindowCommand)
+ {
+ WindowCommand wc = (WindowCommand)cmd;
+
+ // Get the instance
+ Instance instance = wc.getInstance();
+ try
+ {
+ // Get the portlet
+ Portlet portlet = instance.getPortlet();
+ if (portlet != null && portlet.isRemote() == false)
+ {
+ if (cmd instanceof InvokeWindowActionCommand)
+ {
+ InvokeWindowActionCommand iwac = (InvokeWindowActionCommand)wc;
+
+ //
+ Parameters formParams = iwac.getFormParameters();
+
+ //
+ Parameters interactionParams = null;
+ if (iwac.getInteractionState() instanceof ParametersStateString)
+ {
+ interactionParams = ((ParametersStateString)iwac.getInteractionState()).getParameters();
+ }
+
+ //
+ Map params = null;
+ if (interactionParams != null)
+ {
+ if (formParams != null)
+ {
+ params = new LazyParameterMap(interactionParams, formParams);
+ }
+ else
+ {
+ params = interactionParams;
+ }
+ }
+ else
+ {
+ if (formParams != null)
+ {
+ params = formParams;
+ }
+ else
+ {
+ params = new Parameters();
+ }
+ }
+
+ //
+ WindowActionEvent action = new WindowActionEvent(node);
+ action.setMode(iwac.getMode());
+ action.setWindowState(iwac.getWindowState());
+ action.setParameters(params);
+ return action;
+ }
+ else if (cmd instanceof InvokeWindowRenderCommand)
+ {
+ InvokeWindowRenderCommand iwrc = (InvokeWindowRenderCommand)wc;
+ StateString navigationalState = iwrc.getNavigationalState();
+
+ //
+ if (navigationalState != null)
+ {
+ Map params = null;
+ if (navigationalState instanceof ParametersStateString)
+ {
+ params = ((ParametersStateString)navigationalState).getParameters();
+ }
+
+ //
+ WindowRenderEvent render = new WindowRenderEvent(node);
+ render.setMode(iwrc.getMode());
+ render.setWindowState(iwrc.getWindowState());
+ render.setParameters(params);
+ return render;
+ }
+ else
+ {
+ WindowNavigationEvent navigation = new WindowNavigationEvent(node);
+ navigation.setMode(iwrc.getMode());
+ navigation.setWindowState(iwrc.getWindowState());
+ return navigation;
+ }
+ }
+ }
+ }
+ catch (PortletInvokerException ignore)
+ {
+
+ }
+ }
+ return null;
+ }
+
+ private Parameters asParameters(Map map)
+ {
+ if (map == null)
+ {
+ return null;
+ }
+ if (map instanceof Parameters)
+ {
+ return (Parameters)map;
+ }
+ else
+ {
+ try
+ {
+ return new Parameters(map);
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.error("Window action event received wrong parameter set", e);
+ return null;
+ }
+ }
+ }
+
+ private static class LazyParameterMap extends LazyMap
+ {
+ /** . */
+ private Parameters formParams;
+
+ /** . */
+ private Parameters interactionParams;
+
+ /** . */
+ private Parameters params;
+
+ public LazyParameterMap(Parameters interactionParams, Parameters formParams)
+ {
+ this.formParams = formParams;
+ this.interactionParams = interactionParams;
+ this.params = null;
+ }
+
+ protected Map createDelegate()
+ {
+ if (params == null)
+ {
+ params = new Parameters(interactionParams);
+ params.append(formParams);
+ }
+ return params;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/JBossPortalNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/JBossPortalNode.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/JBossPortalNode.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+
+/**
+ * Specific extension that allows the node to fire events to the attached listener.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 3249 $
+ */
+public interface JBossPortalNode extends PortalNode
+{
+ /**
+ * Return the node ref.
+ */
+ String getRef();
+
+ /**
+ * Fire a pre event on this node.
+ */
+ PortalNodeEvent fireEvent(PortalEventListenerRegistry registry, PortalNodeEvent event);
+}
Added: 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 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/Navigation.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 3201 $
+ */
+public class Navigation
+{
+
+ /**
+ * Enforce singleton.
+ */
+ private Navigation()
+ {
+ }
+
+ private static final ThreadLocal currentNodeLocal = new ThreadLocal();
+
+ public static JBossPortalNode getCurrentNode()
+ {
+ return (JBossPortalNode)currentNodeLocal.get();
+ }
+
+ public static void setCurrentNode(JBossPortalNode currentNode)
+ {
+ currentNodeLocal.set(currentNode);
+ }
+}
Copied: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java (from rev 5345, trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PortalNodeInterceptor.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.WindowCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
+import org.jboss.portal.core.aspects.controller.node.PortalObjectNode;
+
+/**
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalNodeInterceptor extends ControllerInterceptor
+{
+
+// private static Logger log = Logger.getLogger(PortalNodeInterceptor.class);
+
+ public void invoke(ControllerCommand cmd) throws Exception, InvocationException
+ {
+ // Get the next node
+ JBossPortalNode next = getNode(cmd);
+
+ // Save previous node temporarily
+ JBossPortalNode previous = Navigation.getCurrentNode();
+
+ try
+ {
+ // Set next node
+ Navigation.setCurrentNode(next);
+
+ // Invoke
+ cmd.invokeNext();
+ }
+ finally
+ {
+ // Set previous node back
+ Navigation.setCurrentNode(previous);
+ }
+ }
+
+ private JBossPortalNode getNode(ControllerCommand cmd)
+ {
+ JBossPortalNode next = null;
+ if (cmd instanceof WindowCommand)
+ {
+ WindowCommand windowCmd = (WindowCommand)cmd;
+ Window window = windowCmd.getWindow();
+ next = new PortalObjectNode(window);
+ }
+ else if (cmd instanceof RenderPageCommand)
+ {
+ RenderPageCommand rpCmd = (RenderPageCommand)cmd;
+ Page page = rpCmd.getPage();
+ next = new PortalObjectNode(page);
+ }
+ return next;
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeInterceptor.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,172 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.portlet.ControllerPortletInvocationContext;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5136 $
+ */
+public class PortalNodeURLFactory
+{
+
+ public static PortalNodeURL createActionURL(JBossPortalNode node, PortletInvocation invocation)
+ {
+ switch (node.getType())
+ {
+ case PortalNode.TYPE_WINDOW:
+ return null;
+ case PortalNode.TYPE_CONTEXT:
+ case PortalNode.TYPE_PAGE:
+ case PortalNode.TYPE_PORTAL:
+ default:
+ throw new IllegalArgumentException("This kind of node does not support action url " + node);
+ }
+ }
+
+ public static PortalNodeURL createRenderURL(JBossPortalNode node, PortletInvocation invocation)
+ {
+ switch (node.getType())
+ {
+ case PortalNode.TYPE_WINDOW:
+ return new WindowURL(node.getRef(), invocation);
+ case PortalNode.TYPE_PAGE:
+ return new PageURL(node.getRef(), invocation);
+ case PortalNode.TYPE_PORTAL:
+ return null;
+ 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 String handle;
+ protected PortletInvocation invocation;
+ protected ParametersStateString parameters;
+ protected Boolean wantSecure;
+ protected Boolean wantAuthenticated;
+ protected boolean relative;
+
+ public AbstractPortalNodeURL(String handle, PortletInvocation invocation)
+ {
+ this.handle = handle;
+ this.invocation = invocation;
+ this.relative = true;
+ this.parameters = new ParametersStateString();
+ }
+
+ 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()
+ {
+ SecurityContext securityContext = invocation.getSecurityContext();
+
+ //
+ boolean secure = securityContext.isSecure();
+ if (wantSecure != null)
+ {
+ secure = wantSecure.booleanValue();
+ }
+
+ //
+ boolean authenticated = securityContext.isAuthenticated();
+ if (wantAuthenticated != null)
+ {
+ authenticated = wantAuthenticated.booleanValue();
+ }
+
+ //
+ return URLContext.newInstance(secure, authenticated);
+ }
+
+ }
+
+ private static class WindowURL extends AbstractPortalNodeURL
+ {
+
+ public WindowURL(String handle, PortletInvocation invocation)
+ {
+ super(handle, invocation);
+ }
+
+ public String toString()
+ {
+ ControllerPortletInvocationContext ctx = (ControllerPortletInvocationContext)invocation.getContext();
+ InvokeWindowRenderCommand cmd = new InvokeWindowRenderCommand(handle, null, null, parameters);
+ URLContext info = getURLContext();
+ return ctx.encodeURL(cmd, info, relative);
+ }
+ }
+
+ private static class PageURL extends AbstractPortalNodeURL
+ {
+
+ public PageURL(String handle, PortletInvocation invocation)
+ {
+ super(handle, invocation);
+ }
+
+ public String toString()
+ {
+ ControllerPortletInvocationContext ctx = (ControllerPortletInvocationContext)invocation.getContext();
+ RenderPageCommand cmd = new RenderPageCommand(handle);
+ URLContext urlContext = getURLContext();
+ return ctx.encodeURL(cmd, urlContext, relative);
+ }
+ }
+
+}
Added: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -0,0 +1,284 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.aspects.controller.node;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.event.PortalEventListenerRegistry;
+import org.jboss.portal.common.path.RelativePathParser;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalObjectNode implements JBossPortalNode
+{
+
+ /** The wrapped portal object. */
+ private final PortalObject object;
+
+ /** The parent node. */
+ private PortalObjectNode parentNode;
+
+ /** The children map. */
+ private Map childrenNodes;
+
+ /** The root node. */
+ private PortalNode root;
+
+ /**
+ * 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 PortalObjectNode(PortalObject object) throws IllegalArgumentException
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.object = object;
+ }
+
+ /**
+ * @param parentNode the parent node of this node
+ * @param object the wrapped portal object
+ */
+ private PortalObjectNode(PortalObjectNode parentNode, PortalObject object)
+ {
+ this.parentNode = parentNode;
+ this.object = object;
+ }
+
+ /**
+ * @param object the wrapped portal object
+ * @param childNode the child node creating that object
+ */
+ private PortalObjectNode(PortalObject object, PortalObjectNode childNode)
+ {
+ this.object = object;
+
+ //
+ Map childrenNodes = getChildrenNodes();
+ childrenNodes.put(childNode.getName(), childNode);
+ this.childrenNodes = Collections.unmodifiableMap(childrenNodes);
+ }
+
+ 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 PortalObjectNode(objectParent, this);
+ }
+ }
+ return parentNode;
+ }
+
+ public String getName()
+ {
+ return object.getName();
+ }
+
+ public PortalNode getChild(String name)
+ {
+ if (childrenNodes == null)
+ {
+ childrenNodes = Collections.unmodifiableMap(getChildrenNodes());
+ }
+ return (PortalNode)childrenNodes.get(name);
+ }
+
+ public Collection getChildren()
+ {
+ if (childrenNodes == null)
+ {
+ childrenNodes = Collections.unmodifiableMap(getChildrenNodes());
+ }
+ return childrenNodes.values();
+ }
+
+ 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 String getRef()
+ {
+ return object.getId();
+ }
+
+ public PortalNodeEvent fireEvent(PortalEventListenerRegistry registry, PortalNodeEvent event)
+ {
+ Bubbler bubbler = new Bubbler(registry, this, event);
+ return bubbler.dispatch();
+ }
+
+ private Map getChildrenNodes()
+ {
+ Map childrenMap = Collections.EMPTY_MAP;
+ Collection tmp = object.getChildren();
+ if (tmp.isEmpty() == false)
+ {
+ childrenMap = new HashMap();
+ for (Iterator i = tmp.iterator();i.hasNext();)
+ {
+ PortalObject childObject = (PortalObject)i.next();
+ PortalObjectNode child = new PortalObjectNode(this, childObject);
+ childrenMap.put(child.getName(), child);
+ }
+ }
+ return childrenMap;
+ }
+
+ private static class Bubbler implements PortalNodeEventContext
+ {
+
+ /** . */
+ PortalEventListenerRegistry registry;
+
+ /** . */
+ private PortalNodeEvent event;
+
+ /** . */
+ private PortalObjectNode node;
+
+ public Bubbler(PortalEventListenerRegistry registry, PortalObjectNode node, PortalNodeEvent event)
+ {
+ this.registry = registry;
+ this.node = node;
+ this.event = event;
+ }
+
+ 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)
+ {
+ PortalObjectNode current = node;
+ try
+ {
+ node = (PortalObjectNode)node.getParent();
+ nextEvent = listener.onEvent(this, event);
+ }
+ finally
+ {
+ node = current;
+ }
+ }
+ else
+ {
+ if (node.getParent() != null)
+ {
+ PortalObjectNode current = node;
+ try
+ {
+ node = (PortalObjectNode)node.getParent();
+ nextEvent = dispatch();
+ }
+ finally
+ {
+ node = current;
+ }
+ }
+ }
+
+ //
+ return nextEvent;
+ }
+
+ public PortalNode getNode()
+ {
+ return node;
+ }
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,7 +25,6 @@
import org.hibernate.SessionFactory;
import org.hibernate.Query;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.api.JBossPortalNode;
import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -227,19 +226,6 @@
return (Context)getObject("");
}
- public JBossPortalNode getNode(String id)
- {
- PortalObjectImpl object = (PortalObjectImpl)getObject(id);
- if (object != null)
- {
- return object.getPortalNode();
- }
- else
- {
- return null;
- }
- }
-
/**
* todo : use AOP for tx demarcation.
*/
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,12 +25,6 @@
import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
-import org.jboss.portal.core.api.JBossPortalNode;
-import org.jboss.portal.common.path.RelativePathParser;
-import org.jboss.portal.api.node.PortalNode;
-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.apache.log4j.Logger;
import java.util.Collection;
@@ -66,7 +60,6 @@
// Runtime fields
- protected PortalNodeImpl portalNode;
protected Collection collection;
protected Map properties;
@@ -108,15 +101,6 @@
//
- public JBossPortalNode getPortalNode()
- {
- if (portalNode == null)
- {
- portalNode = new PortalNodeImpl(this);
- }
- return portalNode;
- }
-
public void destroyChild(String name) throws NoSuchPortalObjectException
{
objectNode.removeChild(name);
@@ -328,29 +312,6 @@
return (String)properties.get(name);
}
- public PortalObject resolve(String relativePath)
- {
- // Use this as a starting point
- PortalObject o = this;
-
- //
- RelativePathParser cursor = new RelativePathParser(relativePath);
- for (int i = cursor.next();i != RelativePathParser.NONE && o != null;i = cursor.next())
- {
- switch (i)
- {
- case RelativePathParser.DOWN:
- String name = relativePath.substring(cursor.getOffset(), cursor.getOffset() + cursor.getLength());
- o = o.getChild(name);
- break;
- case RelativePathParser.UP:
- o = o.getParent();
- break;
- }
- }
- return o;
- }
-
public String toString()
{
return objectNode.toString();
@@ -358,296 +319,6 @@
public abstract int getType();
- private static class PortalNodeImpl implements JBossPortalNode
- {
-
- /** . */
- private final PortalObjectImpl object;
-
- /** . */
- private CollectionImpl children;
-
- public PortalNodeImpl(PortalObjectImpl object)
- {
- this.object = object;
- this.children = null;
- }
-
- public int getType()
- {
- return object.getType();
- }
-
- public PortalNode getRoot()
- {
- if (object.getObjectNode().getParent().getObject() instanceof ContextImpl)
- {
- return this;
- }
- else
- {
- // return object.theparent.getPortalNode();
- throw new UnsupportedOperationException();
- }
- }
-
- public PortalNode getParent()
- {
- if (object.getObjectNode().getParent() != null)
- {
- return object.getObjectNode().getParent().getObject().getPortalNode();
- }
- else
- {
- return null;
- }
- }
-
- public String getName()
- {
- return object.getObjectNode().getName();
- }
-
- public PortalNode getChild(String name)
- {
- PortalObjectImpl child = (PortalObjectImpl)object.getChild(name);
- if (child != null)
- {
- return child.getPortalNode();
- }
- else
- {
- return null;
- }
- }
-
- public Collection getChildren()
- {
- if (children == null)
- {
- children = new CollectionImpl(this);
- }
- return children;
- }
-
- public Map getProperties()
- {
- return object.getProperties();
- }
-
- public PortalNode resolve(String relativePath)
- {
- PortalObjectImpl relative = (PortalObjectImpl)object.resolve(relativePath);
- if (relative != null)
- {
- return relative.getPortalNode();
- }
- else
- {
- return null;
- }
- }
-
- public String getRef()
- {
- return object.getId();
- }
-
- public PortalNodeEvent fireEvent(PortalNodeEvent event)
- {
- Bubbler bubbler = new Bubbler(object, event);
- return bubbler.dispatch();
- }
- }
-
- private static class Bubbler implements PortalNodeEventContext
- {
-
- /** . */
- private PortalNodeEvent event;
-
- /** . */
- private PortalObjectImpl object;
-
- public Bubbler(PortalObjectImpl object, PortalNodeEvent event)
- {
- this.object = object;
- this.event = event;
- }
-
- public PortalNodeEvent dispatch()
- {
- PortalNodeEventListener listener = null;
- if (object.getListener() != null)
- {
- ContainerContext ctx = object.getObjectNode().getContext();
- Object tmp = ctx.getListener(object.getListener());
- if (tmp instanceof PortalNodeEventListener)
- {
- listener = (PortalNodeEventListener)tmp;
- }
- }
-
- // Dispatch to the listener
- PortalNodeEvent nextEvent = null;
- if (listener != null)
- {
- PortalObjectImpl current = object;
- try
- {
- object = (PortalObjectImpl)object.getParent();
- nextEvent = listener.onEvent(this, event);
- }
- finally
- {
- object = current;
- }
- }
- else
- {
- if (object.getParent() != null)
- {
- PortalObjectImpl current = object;
- try
- {
- object = (PortalObjectImpl)object.getParent();
- nextEvent = dispatch();
- }
- finally
- {
- object = current;
- }
- }
- }
-
- //
- return nextEvent;
- }
-
- public PortalNode getNode()
- {
- return object.getPortalNode();
- }
- }
-
- private static class CollectionImpl implements Collection
- {
-
- private final PortalNodeImpl node;
-
- public CollectionImpl(PortalNodeImpl node)
- {
- this.node = node;
- }
-
- public int size()
- {
- return node.object.getObjectNode().getChildren().size();
- }
-
- public void clear()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean isEmpty()
- {
- return node.object.getObjectNode().getChildren().isEmpty();
- }
-
- public Object[] toArray()
- {
-// Object[] objects = node.object.collection.values().toArray();
-// for (int i = 0; i < objects.length; i++)
-// {
-// PortalObjectImpl object = (PortalObjectImpl)objects[i];
-// objects[i] = object.getPortalNode();
-// }
-// return objects;
- throw new UnsupportedOperationException();
- }
-
- public boolean add(Object o)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean contains(Object o)
- {
-// if (o instanceof PortalNodeImpl)
-// {
-// return node.object.collection.containsValue(((PortalNodeImpl)o).object);
-// }
-// else
-// {
-// return false;
-// }
- throw new UnsupportedOperationException();
- }
-
- public boolean remove(Object o)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsAll(Collection c)
- {
-// for (Iterator i = c.iterator(); i.hasNext();)
-// {
-// Object o = i.next();
-// if (!contains(o))
-// {
-// return false;
-// }
-// }
-// return true;
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
-
- public Iterator iterator()
- {
-// Object[] asArray = toArray();
-// return Tools.iterator(asArray);
- final Iterator iterator = node.object.getObjectNode().getChildren().values().iterator();
- return new Iterator()
- {
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- public boolean hasNext()
- {
- return iterator.hasNext();
- }
- public Object next()
- {
- ObjectNode next = (ObjectNode)iterator.next();
- return next.getObject().getPortalNode();
- }
- };
- }
-
- public Object[] toArray(Object array[])
- {
- throw new UnsupportedOperationException("NYI");
- }
- }
-
/**
* Return the default child of this object based on the declared property that specifies the default
* object name.
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,7 +25,6 @@
import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
-import org.jboss.portal.core.api.JBossPortalNode;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.api.node.event.PortalNodeEventListener;
@@ -117,19 +116,6 @@
return (Context)root.getObject();
}
- public JBossPortalNode getNode(String id)
- {
- PortalObjectImpl object = (PortalObjectImpl)getObject(id);
- if (object != null)
- {
- return object.getPortalNode();
- }
- else
- {
- return null;
- }
- }
-
/**
* @see PortalObjectContainer#getAuthorizationDomain()
*/
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -23,7 +23,6 @@
import java.util.Map;
import java.util.Collection;
-import java.util.Set;
/**
* The base interface for all portal objects.
@@ -135,12 +134,4 @@
* Update a property declared on that object.
*/
void setDeclaredProperty(String name, String value);
-
- /**
- * Get a portal object relative to this object.
- *
- * @param relativePath the relative path
- * @return the relative object
- */
- PortalObject resolve(String relativePath);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -21,7 +21,6 @@
*/
package org.jboss.portal.core.model.portal;
-import org.jboss.portal.core.api.JBossPortalNode;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
/**
@@ -48,11 +47,6 @@
Context getContext();
/**
- * Return the api node.
- */
- JBossPortalNode getNode(String id);
-
- /**
* Get the authorization domain
*/
AuthorizationDomain getAuthorizationDomain();
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 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/catalog/CatalogPortlet.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -21,7 +21,7 @@
*/
package org.jboss.portal.core.portlet.catalog;
-import org.jboss.portal.core.api.JBossPortalNode;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
@@ -160,7 +160,7 @@
}
// }
}
-
+
// private PortalAuthorizationManager getPortalAuthorizationManager()
// {
// String type = PortalAuthorizationManagerFactory.JACC;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -35,7 +35,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.api.Navigation;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.PropertyDef;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -23,7 +23,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.core.api.JBossPortalNode;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.theme.LayoutInfo;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -23,7 +23,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.core.api.JBossPortalNode;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.theme.PortalTheme;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -28,7 +28,7 @@
import org.jboss.portal.common.util.LocaleInfo;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.core.api.Navigation;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.modules.MailModule;
import org.jboss.portal.core.portlet.PortletHelper;
import org.jboss.portal.core.servlet.jsp.PortalJsp;
Modified: trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,7 +25,7 @@
import javax.portlet.PortletPreferences;
-import org.jboss.portal.core.api.Navigation;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portlet.util.Parameters;
import org.jboss.portal.portlet.impl.jsr168.ActionRequestImpl;
Modified: trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -22,8 +22,8 @@
package org.jboss.portlet;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.core.api.JBossPortalNode;
-import org.jboss.portal.core.api.PortalNodeURLFactory;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
+import org.jboss.portal.core.aspects.controller.node.PortalNodeURLFactory;
import org.jboss.portal.core.output.SignOutResult;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
Modified: trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,7 +25,7 @@
import javax.portlet.PortletPreferences;
-import org.jboss.portal.core.api.Navigation;
+import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portlet.util.Parameters;
import org.jboss.portal.portlet.impl.jsr168.RenderRequestImpl;
Modified: trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2006-10-07 13:41:42 UTC (rev 5350)
@@ -25,8 +25,8 @@
import org.jboss.portal.portlet.impl.jsr168.PortletRequestImpl;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.core.api.PortalNodeURLFactory;
-import org.jboss.portal.core.api.JBossPortalNode;
+import org.jboss.portal.core.aspects.controller.node.PortalNodeURLFactory;
+import org.jboss.portal.core.aspects.controller.node.JBossPortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.api.node.PortalNode;
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 2006-10-07 00:10:41 UTC (rev 5349)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-10-07 13:41:42 UTC (rev 5350)
@@ -125,7 +125,7 @@
proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.aspects.controller.PortalNodeInterceptor"
+ code="org.jboss.portal.core.aspects.controller.node.PortalNodeInterceptor"
name="portal:service=Interceptor,type=Command,name=PortalNode"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
@@ -142,11 +142,14 @@
proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
</mbean>
<mbean
- code="org.jboss.portal.core.aspects.controller.EventBroadcasterInterceptor"
+ code="org.jboss.portal.core.aspects.controller.node.EventBroadcasterInterceptor"
name="portal:service=Interceptor,type=Command,name=EventBroadcaster"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <depends
+ optional-attribute-name="ListenerRegistry"
+ proxy-type="attribute">portal:service=ListenerRegistry</depends>
</mbean>
<mbean
code="org.jboss.portal.core.aspects.controller.WindowCacheInterceptor"
More information about the jboss-svn-commits
mailing list