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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 6 19:43:21 EDT 2006


Author: julien at jboss.com
Date: 2006-10-06 19:43:14 -0400 (Fri, 06 Oct 2006)
New Revision: 5347

Added:
   trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java
   trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java
Modified:
   trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
   trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java
   trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
added signout from dashboard nav

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-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java	2006-10-06 23:43:14 UTC (rev 5347)
@@ -24,6 +24,7 @@
 import org.jboss.portal.core.controller.ControllerInterceptor;
 import org.jboss.portal.core.controller.ControllerCommand;
 import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.controller.command.SignOutCommand;
 import org.jboss.portal.core.model.portal.PortalObject;
 import org.jboss.portal.core.model.portal.Page;
 import org.jboss.portal.core.model.portal.PortalObjectPermission;
@@ -129,7 +130,8 @@
       else
       {
          // TODO: add checks for shared/private pages
-         String logoutURL = "BLAH";
+         SignOutCommand cmd = new SignOutCommand();
+         String logoutURL = rpc.getControllerContext().encodeURL(cmd, null, null);
 
          //sb.append("<a href=\"#\" class=\"addcontent\">Add Content</a>");
 

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-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/main/org/jboss/portal/core/controller/CoreController.java	2006-10-06 23:43:14 UTC (rev 5347)
@@ -26,6 +26,7 @@
 import org.jboss.portal.core.controller.command.RenderPageCommand;
 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.command.info.CommandInfo;
 import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
 import org.jboss.portal.core.controller.command.mapper.CommandFactory;
@@ -33,6 +34,7 @@
 import org.jboss.portal.core.model.instance.InstanceContainer;
 import org.jboss.portal.core.model.portal.PortalObjectContainer;
 import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Portal;
 import org.jboss.portal.core.output.SignOutResult;
 import org.jboss.portal.core.cms.command.StreamContentCommand;
 import org.jboss.portal.server.RequestController;
@@ -338,6 +340,18 @@
          StreamContentCommand scc = (StreamContentCommand)cmd;
          scc.stream(invocation);
       }
+      else if (cmd instanceof SignOutCommand)
+      {
+         // Indicate that we want a sign out to be done
+         invocation.getResponse().setWantSignOut(true);
+
+         //
+         Portal portal = portalObjectContainer.getContext().getDefaultPortal();
+         RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
+         boolean secure = invocation.getServerContext().getURLContext().getSecure();
+         URLContext urlInfo = URLContext.newInstance(secure, false);
+         return new Forward(renderCmd, urlInfo);
+      }
       return null;
    }
 

Added: trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java	2006-10-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/SignOutCommand.java	2006-10-06 23:43:14 UTC (rev 5347)
@@ -0,0 +1,50 @@
+/*
+* 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.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+
+/**
+ * A global signout.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SignOutCommand extends ControllerCommand
+{
+
+   /** . */
+   private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+
+   public CommandInfo getInfo()
+   {
+      return info;
+   }
+
+   public void execute() throws ControllerException
+   {
+      // Do nothing
+   }
+}

Added: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java	2006-10-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java	2006-10-06 23:43:14 UTC (rev 5347)
@@ -0,0 +1,80 @@
+/*
+* 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.mapper;
+
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.server.ServerInvocation;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleCommandFactory extends AbstractCommandFactory
+{
+
+   /** . */
+   private String commandClassName;
+
+   /** . */
+   private Class commandClass;
+
+
+   public String getCommandClassName()
+   {
+      return commandClassName;
+   }
+
+   public void setCommandClassName(String commandClassName)
+   {
+      this.commandClassName = commandClassName;
+   }
+
+   protected void startService() throws Exception
+   {
+      commandClass = Thread.currentThread().getContextClassLoader().loadClass(commandClassName);
+
+      //
+      super.startService();
+   }
+
+
+   protected void stopService() throws Exception
+   {
+      super.stopService();
+
+      //
+      commandClass = null;
+   }
+
+   public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+   {
+      try
+      {
+         return (ControllerCommand)commandClass.newInstance();
+      }
+      catch (Exception e)
+      {
+         log.error("Cannot create command", e);
+         return null;
+      }
+   }
+}

Added: 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-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleURLFactory.java	2006-10-06 23:43:14 UTC (rev 5347)
@@ -0,0 +1,73 @@
+/*
+* 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.mapper;
+
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.core.controller.ControllerCommand;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleURLFactory extends URLFactoryDelegate
+{
+
+   /** . */
+   private String prefix;
+
+   /** . */
+   private String[] classNames;
+
+   public String getPrefix()
+   {
+      return prefix;
+   }
+
+   public void setPrefix(String prefix)
+   {
+      this.prefix = prefix;
+   }
+
+   public String[] getClassNames()
+   {
+      return classNames;
+   }
+
+   public void setClassNames(String[] classNames)
+   {
+      this.classNames = classNames;
+   }
+
+   public ServerURL doMapping(ServerInvocation invocation, ControllerCommand cmd)
+   {
+      AbstractServerURL url = new AbstractServerURL();
+      url.setPortalRequestPath(prefix);
+      return url;
+   }
+
+   protected String[] getCommandClassNames()
+   {
+      return classNames;
+   }
+}

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-06 22:57:10 UTC (rev 5346)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml	2006-10-06 23:43:14 UTC (rev 5347)
@@ -576,6 +576,28 @@
          optional-attribute-name="DelegateFactory"
          proxy-type="attribute">portal:commandFactory=PortalObject</depends>
    </mbean>
+   <mbean
+      code="org.jboss.portal.core.controller.command.mapper.SimpleCommandFactory"
+      name="portal:commandFactory=SignOut"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="CommandClassName">org.jboss.portal.core.controller.command.SignOutCommand</attribute>
+   </mbean>
+   <mbean
+      code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+      name="portal:commandFactory=Delegate,prefix=signout"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Prefix">signout</attribute>
+      <depends
+         optional-attribute-name="DelegatingFactory"
+         proxy-type="attribute">portal:commandFactory=Delegating</depends>
+      <depends
+         optional-attribute-name="DelegateFactory"
+         proxy-type="attribute">portal:commandFactory=SignOut</depends>
+   </mbean>
 
    <!-- URL factories -->
    <mbean
@@ -596,6 +618,18 @@
          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=SignOut"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <xmbean/>
+      <attribute name="Prefix">/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>
 
    <!-- The federating portlet invoker -->
    <mbean




More information about the jboss-svn-commits mailing list