[jboss-svn-commits] JBoss Portal SVN: r5395 - in trunk/core/src: main/org/jboss/portal/core/aspects/controller main/org/jboss/portal/core/cms main/org/jboss/portal/core/controller main/org/jboss/portal/core/controller/command main/org/jboss/portal/core/controller/command/mapper main/org/jboss/portal/core/model/portal resources/portal-cms-sar/META-INF resources/portal-core-sar/META-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 10 09:26:00 EDT 2006


Author: julien at jboss.com
Date: 2006-10-10 09:25:47 -0400 (Tue, 10 Oct 2006)
New Revision: 5395

Added:
   trunk/core/src/main/org/jboss/portal/core/controller/ViewDashboardCommand.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/PortalCommand.java
   trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
Modified:
   trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
   trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
   trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
   trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
- added view dashboad command
- added dashboard command factory
- change prefix attribute name on url factories to path

Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -10,6 +10,8 @@
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.controller.command.PortalObjectCommand;
 import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.WindowCommand;
+import org.jboss.portal.core.controller.command.PageCommand;
 import org.jboss.portal.core.model.portal.Page;
 import org.jboss.portal.core.model.portal.Portal;
 import org.jboss.portal.core.model.portal.PortalObject;
@@ -50,7 +52,7 @@
 
    public void invoke(ControllerCommand cmd) throws Exception, InvocationException
    {
-      if (cmd instanceof PortalObjectCommand)
+      if (cmd instanceof WindowCommand || cmd instanceof PageCommand)
       {
          //
          PortalObject target = ((PortalObjectCommand)cmd).getTarget();

Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectURLFactory.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -39,16 +39,16 @@
    private static final String[] COMMAND_CLASS_NAMES = {StreamContentCommand.class.getName()};
 
    /** . */
-   private String prefix;
+   private String path;
 
-   public String getPrefix()
+   public String getPath()
    {
-      return prefix;
+      return path;
    }
 
-   public void setPrefix(String prefix)
+   public void setPath(String path)
    {
-      this.prefix = prefix;
+      this.path = path;
    }
 
    protected String[] getCommandClassNames()
@@ -67,9 +67,9 @@
          StringBuffer buffer = new StringBuffer();
 
          //
-         if (prefix != null && prefix.length() > 0)
+         if (path != null && path.length() > 0)
          {
-            buffer.append('/').append(prefix);
+            buffer.append(path);
          }
 
          //

Modified: trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -27,6 +27,7 @@
 import org.jboss.portal.core.controller.command.InvokeWindowActionCommand;
 import org.jboss.portal.core.controller.command.InvokeWindowRenderCommand;
 import org.jboss.portal.core.controller.command.SignOutCommand;
+import org.jboss.portal.core.controller.ViewDashboardCommand;
 import org.jboss.portal.core.controller.command.info.CommandInfo;
 import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
 import org.jboss.portal.core.controller.command.mapper.CommandFactory;
@@ -366,6 +367,12 @@
          URLContext urlInfo = URLContext.newInstance(secure, false);
          return new Forward(renderCmd, urlInfo);
       }
+      else if (cmd instanceof ViewDashboardCommand)
+      {
+         ViewDashboardCommand vdc = (ViewDashboardCommand)cmd;
+         RenderPageCommand rpc = new RenderPageCommand(vdc.getDashboardPage().getId());
+         return new Forward(rpc, null);
+      }
       return null;
    }
 

Added: trunk/core/src/main/org/jboss/portal/core/controller/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ViewDashboardCommand.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ViewDashboardCommand.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -0,0 +1,88 @@
+/*
+* 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.controller;
+
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.command.PortalCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerSecurityException;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
+import org.jboss.portal.security.PortalSecurityException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewDashboardCommand extends PortalCommand
+{
+
+   /** . */
+   private static final CommandInfo info = new ViewCommandInfo(false, "view");
+
+   /** . */
+   private Page dashboardPage;
+
+   public ViewDashboardCommand(String portalId)
+   {
+      super(portalId);
+   }
+
+   public CommandInfo getInfo()
+   {
+      return info;
+   }
+
+   public void create() throws ControllerException
+   {
+      super.create();
+
+      //
+      String userId = getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser();
+      if (userId == null)
+      {
+         throw new ControllerSecurityException("User needs to be authenticated to view a dashboard");
+      }
+
+      //
+      dashboardPage = portal.getPage(userId);
+      if (dashboardPage == null)
+      {
+         throw new IllegalArgumentException();
+      }
+   }
+
+   public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
+   {
+      // We don't enforce security here but intead rely on the execution of the next render page command
+   }
+
+   public void execute() throws ControllerException
+   {
+   }
+
+   public Page getDashboardPage()
+   {
+      return dashboardPage;
+   }
+}

Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -46,7 +46,7 @@
    }
 
    /**
-    * Get the requeste page
+    * Get the requested page
     *
     * @return the requested page
     */

Added: trunk/core/src/main/org/jboss/portal/core/controller/command/PortalCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PortalCommand.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PortalCommand.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -0,0 +1,66 @@
+/*
+* 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.controller.command;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class PortalCommand extends PortalObjectCommand
+{
+
+   /** . */
+   protected Portal portal;
+
+   public PortalCommand(String portalId)
+   {
+      super(portalId);
+   }
+
+   /**
+    * Get the requestet portal
+    *
+    * @return the requested portal
+    */
+   public Portal getPortal()
+   {
+      return portal;
+   }
+
+   /**
+    * Initialize the command
+    *
+    * @throws org.jboss.portal.common.invocation.InvocationException
+    */
+   public void create() throws ControllerException
+   {
+      super.create();
+
+      //
+      portal = (Portal)getTarget();
+   }
+}

Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -34,19 +34,19 @@
 {
 
    /** . */
-   private String prefix;
+   private String path;
 
    /** . */
    private String[] classNames;
 
-   public String getPrefix()
+   public String getPath()
    {
-      return prefix;
+      return path;
    }
 
-   public void setPrefix(String prefix)
+   public void setPath(String path)
    {
-      this.prefix = prefix;
+      this.path = path;
    }
 
    public String[] getClassNames()
@@ -62,7 +62,7 @@
    public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
    {
       AbstractServerURL url = new AbstractServerURL();
-      url.setPortalRequestPath(prefix);
+      url.setPortalRequestPath(path);
       return url;
    }
 

Added: trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -0,0 +1,53 @@
+/*
+* 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.model.portal;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ViewDashboardCommand;
+import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DashboardCommandFactory extends AbstractCommandFactory
+{
+
+   /** . */
+   private String dashboardId;
+
+   public String getDashboardId()
+   {
+      return dashboardId;
+   }
+
+   public void setDashboardId(String dashboardId)
+   {
+      this.dashboardId = dashboardId;
+   }
+
+   public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+   {
+      return new ViewDashboardCommand(dashboardId);
+   }
+}

Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java	2006-10-10 13:25:47 UTC (rev 5395)
@@ -57,16 +57,16 @@
    };
 
    /** . */
-   private String prefix;
+   private String path;
 
-   public String getPrefix()
+   public String getPath()
    {
-      return prefix;
+      return path;
    }
 
-   public void setPrefix(String prefix)
+   public void setPath(String path)
    {
-      this.prefix = prefix;
+      this.path = path;
    }
 
    protected String[] getCommandClassNames()
@@ -226,12 +226,11 @@
    {
       //
       StringBuffer buffer = new StringBuffer();
-      buffer.append('/');
 
       //
-      if (prefix != null && prefix.length() > 0)
+      if (path != null && path.length() > 0)
       {
-         buffer.append(prefix).append('/');
+         buffer.append(path).append('/');
       }
 
       // escape spaces

Modified: trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml	2006-10-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml	2006-10-10 13:25:47 UTC (rev 5395)
@@ -209,7 +209,7 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
       <xmbean/>
-      <attribute name="Prefix">content</attribute>
+      <attribute name="Path">/content</attribute>
       <depends optional-attribute-name="Factory" proxy-type="attribute">portal:urlFactory=Delegating</depends>
    </mbean>
    

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-10 09:46:27 UTC (rev 5394)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-10-10 13:25:47 UTC (rev 5395)
@@ -594,6 +594,28 @@
          optional-attribute-name="DelegateFactory"
          proxy-type="attribute">portal:commandFactory=SignOut</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.core.model.portal.DashboardCommandFactory"
+      name="portal:commandFactory=Dashboard"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="DashboardId">dashboard</attribute>
+   </mbean>
+   <mbean
+      code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+      name="portal:commandFactory=Delegate,prefix=dashboard"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Prefix">dashboard</attribute>
+      <depends
+         optional-attribute-name="DelegatingFactory"
+         proxy-type="attribute">portal:commandFactory=Delegating</depends>
+      <depends
+         optional-attribute-name="DelegateFactory"
+         proxy-type="attribute">portal:commandFactory=Dashboard</depends>
+   </mbean>
 
    <!-- URL factories -->
    <mbean
@@ -609,7 +631,7 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
       <xmbean/>
-      <attribute name="Prefix">portal</attribute>
+      <attribute name="Path">/portal</attribute>
       <depends
          optional-attribute-name="Factory"
          proxy-type="attribute">portal:urlFactory=Delegating</depends>
@@ -620,12 +642,24 @@
       xmbean-dd=""
       xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
       <xmbean/>
-      <attribute name="Prefix">/signout</attribute>
+      <attribute name="Path">/signout</attribute>
       <attribute name="ClassNames">org.jboss.portal.core.controller.command.SignOutCommand</attribute>
       <depends
          optional-attribute-name="Factory"
          proxy-type="attribute">portal:urlFactory=Delegating</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.core.controller.command.mapper.SimpleURLFactory"
+      name="portal:urlFactory=Dashboard"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Path">/dashboard</attribute>
+      <attribute name="ClassNames">org.jboss.portal.core.controller.ViewDashboardCommand</attribute>
+      <depends
+         optional-attribute-name="Factory"
+         proxy-type="attribute">portal:urlFactory=Delegating</depends>
+   </mbean>
 
    <!-- The federating portlet invoker -->
    <mbean




More information about the jboss-svn-commits mailing list