JBoss Portal SVN: r7348 - in trunk: common/src/main/org/jboss/portal/common/path and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-29 06:05:40 -0400 (Tue, 29 May 2007)
New Revision: 7348
Added:
trunk/common/src/main/org/jboss/portal/common/path/PathMapper.java
trunk/common/src/main/org/jboss/portal/common/path/PathMapperContext.java
trunk/common/src/main/org/jboss/portal/common/path/PathMapperResult.java
trunk/common/src/main/org/jboss/portal/common/path/SimplePathMapper.java
trunk/common/src/main/org/jboss/portal/test/common/PathMapperTestCase.java
Removed:
trunk/core/src/main/org/jboss/portal/core/impl/invocation/Mapper.java
trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingContext.java
trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingResult.java
trunk/core/src/main/org/jboss/portal/core/impl/invocation/SimpleMapper.java
trunk/core/src/main/org/jboss/portal/test/core/MapperTestCase.java
Modified:
trunk/common/build.xml
Log:
moved path parser stuff from core to common package
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/common/build.xml 2007-05-29 10:05:40 UTC (rev 7348)
@@ -244,6 +244,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ModifierTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.PathMapperTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Added: trunk/common/src/main/org/jboss/portal/common/path/PathMapper.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/path/PathMapper.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/path/PathMapper.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.path;
+
+/**
+ * Map request uri path to portal object.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public interface PathMapper
+{
+
+ /**
+ * Map a path to a result.
+ *
+ * @param pathMapperContext the context of the mapping
+ * @param path the path to map
+ * @return returns a path mapper result
+ */
+ public PathMapperResult map(PathMapperContext pathMapperContext, String path);
+
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/path/PathMapper.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/common/path/PathMapperContext.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/path/PathMapperContext.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/path/PathMapperContext.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.path;
+
+/**
+ * Interface that provide access to objects that are mapped to pathes.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public interface PathMapperContext
+{
+ /**
+ * Returns the object graph root.
+ *
+ * @return the root object
+ */
+ Object getRoot();
+
+ /**
+ * Return the child object having the specified name or null if it does not exists.
+ *
+ * @return the child of the parent object matching the specifed name
+ */
+ Object getChild(Object parent, String name);
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/path/PathMapperContext.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/common/path/PathMapperResult.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/path/PathMapperResult.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/path/PathMapperResult.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.path;
+
+/**
+ * The result of a request to a mapper.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PathMapperResult
+{
+
+ /** . */
+ private final Object target;
+
+ /** . */
+ private final String targetPath;
+
+ /** . */
+ private final String targetPathInfo;
+
+ public PathMapperResult(Object target, String targetPath, String targetPathInfo)
+ {
+ this.target = target;
+ this.targetPath = targetPath;
+ this.targetPathInfo = targetPathInfo;
+ }
+
+ public Object getTarget()
+ {
+ return target;
+ }
+
+ public String getTargetPathInfo()
+ {
+ return targetPathInfo;
+ }
+
+ public int hashCode()
+ {
+ int hashCode = (target != null ? target.hashCode() : 0) +
+ (targetPath != null ? targetPath.hashCode() : 0) +
+ (targetPathInfo != null ? targetPathInfo.hashCode() : 0);
+ return hashCode;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PathMapperResult)
+ {
+ PathMapperResult other = (PathMapperResult)obj;
+ return (target == null ? (other.target == null) : target.equals(other.target)) &&
+ (targetPath == null ? (other.targetPath == null) : targetPath.equals(other.targetPath)) &&
+ (targetPathInfo == null ? (other.targetPathInfo == null) : targetPathInfo.equals(other.targetPathInfo));
+ }
+ return false;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer("MappingResult[");
+ buffer.append(target == null ? "-" : target.toString());
+ buffer.append(',');
+ buffer.append(targetPath == null ? "-" : targetPath);
+ buffer.append(',');
+ buffer.append(targetPathInfo == null ? "-" : targetPathInfo);
+ buffer.append("]");
+ return buffer.toString();
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/path/PathMapperResult.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/common/path/SimplePathMapper.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/path/SimplePathMapper.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/path/SimplePathMapper.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.path;
+
+/**
+ * A simple mapper implementation. The limitations is that only the root and its children can have children
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class SimplePathMapper implements PathMapper
+{
+ public PathMapperResult map(PathMapperContext ctx, String path)
+ {
+ Object root = ctx.getRoot();
+ Object target = null;
+ String targetPath = null;
+ String targetPathInfo = null;
+
+ if (path == null || path.length() == 0)
+ {
+ targetPath = null;
+ targetPathInfo = null;
+ }
+ else if ("/".equals(path))
+ {
+ targetPath = null;
+ targetPathInfo = "/";
+ }
+ else
+ {
+ int firstSlashPos = path.indexOf('/', 1);
+ if (firstSlashPos == -1)
+ {
+ String firstChunk = path.substring(1);
+ target = ctx.getChild(root, firstChunk);
+ if (target != null)
+ {
+ targetPath = path;
+ targetPathInfo = null;
+ }
+ else
+ {
+ targetPath = null;
+ targetPathInfo = path;
+ }
+ }
+ else if (firstSlashPos == 1)
+ {
+ targetPath = null;
+ targetPathInfo = "/";
+ }
+ else
+ {
+ String firstChunk = path.substring(1, firstSlashPos);
+ target = ctx.getChild(root, firstChunk);
+ if (target != null)
+ {
+ int secondSlashPos = path.indexOf('/', firstSlashPos + 1);
+ if (secondSlashPos == -1)
+ {
+ String secondChunck = path.substring(firstSlashPos + 1);
+ if (secondChunck.length() == 0)
+ {
+ targetPath = "/" + firstChunk;
+ targetPathInfo = "/";
+ }
+ else
+ {
+ Object child = ctx.getChild(target, secondChunck);
+ if (child != null)
+ {
+ target = child;
+ targetPath = path;
+ targetPathInfo = null;
+ }
+ else
+ {
+ targetPath = "/" + firstChunk;
+ targetPathInfo = "/" + secondChunck;
+ }
+ }
+ }
+ else
+ {
+ targetPath = "/" + firstChunk;
+ targetPathInfo = path.substring(firstSlashPos);
+ }
+ }
+ else
+ {
+ targetPath = null;
+ targetPathInfo = path;
+ }
+ }
+ }
+ return new PathMapperResult(target, targetPath, targetPathInfo);
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/path/SimplePathMapper.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/common/src/main/org/jboss/portal/test/common/PathMapperTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/PathMapperTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/PathMapperTestCase.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -0,0 +1,156 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.path.PathMapper;
+import org.jboss.portal.common.path.PathMapperContext;
+import org.jboss.portal.common.path.PathMapperResult;
+import org.jboss.portal.common.path.SimplePathMapper;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PathMapperTestCase extends TestCase
+{
+
+ public PathMapperTestCase(String s)
+ {
+ super(s);
+ }
+
+ private PathMapper mapper;
+
+ protected void setUp() throws Exception
+ {
+ mapper = new SimplePathMapper();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ mapper = null;
+ }
+
+ public void testEmptyContext()
+ {
+ PathMapperContextImpl root = new PathMapperContextImpl(null);
+
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, null));
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, ""));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "/"));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "//"));
+
+ assertEquals(new PathMapperResult(null, null, "/a"), mapper.map(root, "/a"));
+ assertEquals(new PathMapperResult(null, null, "/a/"), mapper.map(root, "/a/"));
+ assertEquals(new PathMapperResult(null, null, "/a/b"), mapper.map(root, "/a/b"));
+ assertEquals(new PathMapperResult(null, null, "/a/b/"), mapper.map(root, "/a/b/"));
+ assertEquals(new PathMapperResult(null, null, "/a/b/c"), mapper.map(root, "/a/b/c"));
+ }
+
+ public void testOneChild()
+ {
+ PathMapperContextImpl root = new PathMapperContextImpl(null);
+ PathMapperContextImpl child = new PathMapperContextImpl(null);
+ root.addChild("a", child);
+
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, null));
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, ""));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "/"));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "//"));
+
+ assertEquals(new PathMapperResult(child, "/a", null), mapper.map(root, "/a"));
+ assertEquals(new PathMapperResult(child, "/a", "/"), mapper.map(root, "/a/"));
+ assertEquals(new PathMapperResult(child, "/a", "/b"), mapper.map(root, "/a/b"));
+ assertEquals(new PathMapperResult(child, "/a", "/b/"), mapper.map(root, "/a/b/"));
+ assertEquals(new PathMapperResult(child, "/a", "/b/c"), mapper.map(root, "/a/b/c"));
+
+ assertEquals(new PathMapperResult(null, null, "/b"), mapper.map(root, "/b"));
+ assertEquals(new PathMapperResult(null, null, "/b/"), mapper.map(root, "/b/"));
+ assertEquals(new PathMapperResult(null, null, "/b/c"), mapper.map(root, "/b/c"));
+ assertEquals(new PathMapperResult(null, null, "/b/c/"), mapper.map(root, "/b/c/"));
+ assertEquals(new PathMapperResult(null, null, "/b/c/d"), mapper.map(root, "/b/c/d"));
+ }
+
+ public void testOneChildHavingOneChild()
+ {
+ PathMapperContextImpl root = new PathMapperContextImpl(null);
+ PathMapperContextImpl child = new PathMapperContextImpl(null);
+ PathMapperContextImpl childOfChild = new PathMapperContextImpl(null);
+ root.addChild("a", child);
+ child.addChild("b", childOfChild);
+
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, null));
+ assertEquals(new PathMapperResult(null, null, null), mapper.map(root, ""));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "/"));
+ assertEquals(new PathMapperResult(null, null, "/"), mapper.map(root, "//"));
+
+ assertEquals(new PathMapperResult(child, "/a", null), mapper.map(root, "/a"));
+ assertEquals(new PathMapperResult(child, "/a", "/"), mapper.map(root, "/a/"));
+ assertEquals(new PathMapperResult(childOfChild, "/a/b", null), mapper.map(root, "/a/b"));
+ assertEquals(new PathMapperResult(child, "/a", "/b/"), mapper.map(root, "/a/b/"));
+ assertEquals(new PathMapperResult(child, "/a", "/b/c"), mapper.map(root, "/a/b/c"));
+
+ assertEquals(new PathMapperResult(null, null, "/b"), mapper.map(root, "/b"));
+ assertEquals(new PathMapperResult(null, null, "/b/"), mapper.map(root, "/b/"));
+ assertEquals(new PathMapperResult(null, null, "/b/c"), mapper.map(root, "/b/c"));
+ assertEquals(new PathMapperResult(null, null, "/b/c/"), mapper.map(root, "/b/c/"));
+ assertEquals(new PathMapperResult(null, null, "/b/c/d"), mapper.map(root, "/b/c/d"));
+ }
+
+ private static class Context
+ {
+ private final Map children;
+
+ public Context(Object dflt)
+ {
+ children = new HashMap();
+ }
+
+ public void addChild(String name, Object child)
+ {
+ children.put(name, child);
+ }
+ }
+
+ private static class PathMapperContextImpl extends Context implements PathMapperContext
+ {
+ public PathMapperContextImpl(Object dflt)
+ {
+ super(dflt);
+ }
+
+ public Object getRoot()
+ {
+ return this;
+ }
+
+ public Object getChild(Object parent, String name)
+ {
+ return ((Context)parent).children.get(name);
+ }
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/test/common/PathMapperTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/invocation/Mapper.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/invocation/Mapper.java 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/core/src/main/org/jboss/portal/core/impl/invocation/Mapper.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.impl.invocation;
-
-/**
- * Map request uri path to portal object.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface Mapper
-{
-
- public MappingResult map(MappingContext ctx, String path);
-
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingContext.java 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingContext.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.impl.invocation;
-
-/**
- * Interface that provide access to portal object during a mapping request.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface MappingContext
-{
- /** Return the object graph root. */
- Object getRoot();
-
- /** Return the child object having the specified name or null if it does not exists. */
- Object getChild(Object parent, String name);
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingResult.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingResult.java 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/core/src/main/org/jboss/portal/core/impl/invocation/MappingResult.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -1,90 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.impl.invocation;
-
-/**
- * The result of a request to a mapper.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class MappingResult
-{
-
- private final Object target;
- private final String targetPath;
- private final String targetPathInfo;
-
- public MappingResult(Object target, String targetPath, String targetPathInfo)
- {
- this.target = target;
- this.targetPath = targetPath;
- this.targetPathInfo = targetPathInfo;
- }
-
- public Object getTarget()
- {
- return target;
- }
-
- public String getTargetPathInfo()
- {
- return targetPathInfo;
- }
-
- public int hashCode()
- {
- int hashCode = (target != null ? target.hashCode() : 0) +
- (targetPath != null ? targetPath.hashCode() : 0) +
- (targetPathInfo != null ? targetPathInfo.hashCode() : 0);
- return hashCode;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof MappingResult)
- {
- MappingResult other = (MappingResult)obj;
- return (target == null ? (other.target == null) : target.equals(other.target)) &&
- (targetPath == null ? (other.targetPath == null) : targetPath.equals(other.targetPath)) &&
- (targetPathInfo == null ? (other.targetPathInfo == null) : targetPathInfo.equals(other.targetPathInfo));
- }
- return false;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("MappingResult[");
- buffer.append(target == null ? "-" : target.toString());
- buffer.append(',');
- buffer.append(targetPath == null ? "-" : targetPath);
- buffer.append(',');
- buffer.append(targetPathInfo == null ? "-" : targetPathInfo);
- buffer.append("]");
- return buffer.toString();
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/impl/invocation/SimpleMapper.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/invocation/SimpleMapper.java 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/core/src/main/org/jboss/portal/core/impl/invocation/SimpleMapper.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -1,119 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.impl.invocation;
-
-/**
- * A simple mapper implementation. The limitations is that only the root and its children can have children
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class SimpleMapper implements Mapper
-{
- public MappingResult map(MappingContext ctx, String path)
- {
- Object root = ctx.getRoot();
- Object target = null;
- String targetPath = null;
- String targetPathInfo = null;
-
- if (path == null || path.length() == 0)
- {
- targetPath = null;
- targetPathInfo = null;
- }
- else if ("/".equals(path))
- {
- targetPath = null;
- targetPathInfo = "/";
- }
- else
- {
- int firstSlashPos = path.indexOf('/', 1);
- if (firstSlashPos == -1)
- {
- String firstChunk = path.substring(1);
- target = ctx.getChild(root, firstChunk);
- if (target != null)
- {
- targetPath = path;
- targetPathInfo = null;
- }
- else
- {
- targetPath = null;
- targetPathInfo = path;
- }
- }
- else if (firstSlashPos == 1)
- {
- targetPath = null;
- targetPathInfo = "/";
- }
- else
- {
- String firstChunk = path.substring(1, firstSlashPos);
- target = ctx.getChild(root, firstChunk);
- if (target != null)
- {
- int secondSlashPos = path.indexOf('/', firstSlashPos + 1);
- if (secondSlashPos == -1)
- {
- String secondChunck = path.substring(firstSlashPos + 1);
- if (secondChunck.length() == 0)
- {
- targetPath = "/" + firstChunk;
- targetPathInfo = "/";
- }
- else
- {
- Object child = ctx.getChild(target, secondChunck);
- if (child != null)
- {
- target = child;
- targetPath = path;
- targetPathInfo = null;
- }
- else
- {
- targetPath = "/" + firstChunk;
- targetPathInfo = "/" + secondChunck;
- }
- }
- }
- else
- {
- targetPath = "/" + firstChunk;
- targetPathInfo = path.substring(firstSlashPos);
- }
- }
- else
- {
- targetPath = null;
- targetPathInfo = path;
- }
- }
- }
- return new MappingResult(target, targetPath, targetPathInfo);
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/test/core/MapperTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/MapperTestCase.java 2007-05-29 08:53:17 UTC (rev 7347)
+++ trunk/core/src/main/org/jboss/portal/test/core/MapperTestCase.java 2007-05-29 10:05:40 UTC (rev 7348)
@@ -1,156 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.core;
-
-import junit.framework.TestCase;
-import org.jboss.portal.core.impl.invocation.Mapper;
-import org.jboss.portal.core.impl.invocation.MappingContext;
-import org.jboss.portal.core.impl.invocation.MappingResult;
-import org.jboss.portal.core.impl.invocation.SimpleMapper;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class MapperTestCase extends TestCase
-{
-
- public MapperTestCase(String s)
- {
- super(s);
- }
-
- private Mapper mapper;
-
- protected void setUp() throws Exception
- {
- mapper = new SimpleMapper();
- }
-
- protected void tearDown() throws Exception
- {
- mapper = null;
- }
-
- public void testEmptyContext()
- {
- MappingContextImpl root = new MappingContextImpl(null);
-
- assertEquals(new MappingResult(null, null, null), mapper.map(root, null));
- assertEquals(new MappingResult(null, null, null), mapper.map(root, ""));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "/"));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "//"));
-
- assertEquals(new MappingResult(null, null, "/a"), mapper.map(root, "/a"));
- assertEquals(new MappingResult(null, null, "/a/"), mapper.map(root, "/a/"));
- assertEquals(new MappingResult(null, null, "/a/b"), mapper.map(root, "/a/b"));
- assertEquals(new MappingResult(null, null, "/a/b/"), mapper.map(root, "/a/b/"));
- assertEquals(new MappingResult(null, null, "/a/b/c"), mapper.map(root, "/a/b/c"));
- }
-
- public void testOneChild()
- {
- MappingContextImpl root = new MappingContextImpl(null);
- MappingContextImpl child = new MappingContextImpl(null);
- root.addChild("a", child);
-
- assertEquals(new MappingResult(null, null, null), mapper.map(root, null));
- assertEquals(new MappingResult(null, null, null), mapper.map(root, ""));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "/"));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "//"));
-
- assertEquals(new MappingResult(child, "/a", null), mapper.map(root, "/a"));
- assertEquals(new MappingResult(child, "/a", "/"), mapper.map(root, "/a/"));
- assertEquals(new MappingResult(child, "/a", "/b"), mapper.map(root, "/a/b"));
- assertEquals(new MappingResult(child, "/a", "/b/"), mapper.map(root, "/a/b/"));
- assertEquals(new MappingResult(child, "/a", "/b/c"), mapper.map(root, "/a/b/c"));
-
- assertEquals(new MappingResult(null, null, "/b"), mapper.map(root, "/b"));
- assertEquals(new MappingResult(null, null, "/b/"), mapper.map(root, "/b/"));
- assertEquals(new MappingResult(null, null, "/b/c"), mapper.map(root, "/b/c"));
- assertEquals(new MappingResult(null, null, "/b/c/"), mapper.map(root, "/b/c/"));
- assertEquals(new MappingResult(null, null, "/b/c/d"), mapper.map(root, "/b/c/d"));
- }
-
- public void testOneChildHavingOneChild()
- {
- MappingContextImpl root = new MappingContextImpl(null);
- MappingContextImpl child = new MappingContextImpl(null);
- MappingContextImpl childOfChild = new MappingContextImpl(null);
- root.addChild("a", child);
- child.addChild("b", childOfChild);
-
- assertEquals(new MappingResult(null, null, null), mapper.map(root, null));
- assertEquals(new MappingResult(null, null, null), mapper.map(root, ""));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "/"));
- assertEquals(new MappingResult(null, null, "/"), mapper.map(root, "//"));
-
- assertEquals(new MappingResult(child, "/a", null), mapper.map(root, "/a"));
- assertEquals(new MappingResult(child, "/a", "/"), mapper.map(root, "/a/"));
- assertEquals(new MappingResult(childOfChild, "/a/b", null), mapper.map(root, "/a/b"));
- assertEquals(new MappingResult(child, "/a", "/b/"), mapper.map(root, "/a/b/"));
- assertEquals(new MappingResult(child, "/a", "/b/c"), mapper.map(root, "/a/b/c"));
-
- assertEquals(new MappingResult(null, null, "/b"), mapper.map(root, "/b"));
- assertEquals(new MappingResult(null, null, "/b/"), mapper.map(root, "/b/"));
- assertEquals(new MappingResult(null, null, "/b/c"), mapper.map(root, "/b/c"));
- assertEquals(new MappingResult(null, null, "/b/c/"), mapper.map(root, "/b/c/"));
- assertEquals(new MappingResult(null, null, "/b/c/d"), mapper.map(root, "/b/c/d"));
- }
-
- private static class Context
- {
- private final Map children;
-
- public Context(Object dflt)
- {
- children = new HashMap();
- }
-
- public void addChild(String name, Object child)
- {
- children.put(name, child);
- }
- }
-
- private static class MappingContextImpl extends Context implements MappingContext
- {
- public MappingContextImpl(Object dflt)
- {
- super(dflt);
- }
-
- public Object getRoot()
- {
- return this;
- }
-
- public Object getChild(Object parent, String name)
- {
- return ((Context)parent).children.get(name);
- }
- }
-}
16 years, 11 months
JBoss Portal SVN: r7347 - trunk/core/src/main/org/jboss/portal/core/controller.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-29 04:53:17 -0400 (Tue, 29 May 2007)
New Revision: 7347
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
Log:
minor javadoc
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-05-29 08:50:40 UTC (rev 7346)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-05-29 08:53:17 UTC (rev 7347)
@@ -37,6 +37,8 @@
import java.util.Map;
/**
+ * The context of the controller.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
16 years, 11 months
JBoss Portal SVN: r7346 - trunk/core/src/main/org/jboss/portal/core/controller.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-29 04:50:40 -0400 (Tue, 29 May 2007)
New Revision: 7346
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java
Log:
minor javadoc
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java 2007-05-29 08:44:29 UTC (rev 7345)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerInterceptor.java 2007-05-29 08:50:40 UTC (rev 7346)
@@ -27,6 +27,8 @@
import org.jboss.portal.server.impl.invocation.JBossInterceptor;
/**
+ * Base class for providing interception of controller command execution.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java 2007-05-29 08:44:29 UTC (rev 7345)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerResponse.java 2007-05-29 08:50:40 UTC (rev 7346)
@@ -23,9 +23,11 @@
package org.jboss.portal.core.controller;
/**
+ * Base class for responses from the controller after the execution of a controller command.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ControllerResponse
+public abstract class ControllerResponse
{
}
16 years, 11 months
JBoss Portal SVN: r7345 - in trunk/core/src/main/org/jboss/portal/core: controller/classic and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-05-29 04:44:29 -0400 (Tue, 29 May 2007)
New Revision: 7345
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
Log:
minor javadoc and renaming
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -148,11 +148,11 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
ControllerCommand commeand,
- ControllerResponse response) throws ResponseHandlerException
+ ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof PortletWindowResponse)
+ if (controllerResponse instanceof PortletWindowResponse)
{
- PortletWindowResponse pwr = (PortletWindowResponse)response;
+ PortletWindowResponse pwr = (PortletWindowResponse)controllerResponse;
PortletInvocationResponse pir = pwr.getResult();
if (pir instanceof RenderResponse)
{
@@ -172,20 +172,20 @@
}
else
{
- throw new Error("todo " + response);
+ throw new Error("todo " + controllerResponse);
}
}
- else if (response instanceof UpdatePageResponse)
+ else if (controllerResponse instanceof UpdatePageResponse)
{
- UpdatePageResponse upr = (UpdatePageResponse)response;
+ UpdatePageResponse upr = (UpdatePageResponse)controllerResponse;
ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
return new AjaxResponse(dresp);
}
- else if (response instanceof UpdateWindowResponse)
+ else if (controllerResponse instanceof UpdateWindowResponse)
{
- UpdateWindowResponse upw = (UpdateWindowResponse)response;
+ UpdateWindowResponse upw = (UpdateWindowResponse)controllerResponse;
// Obtain page and portal
final Window window = (Window)portalObjectContainer.getObject(upw.getWindowId());
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -65,18 +65,18 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
- ControllerCommand command,
+ ControllerCommand controllerCommand,
ControllerResponse commandResponse) throws ResponseHandlerException
{
- HandlerResponse handlerResponse = processHandlers(controllerContext, command, commandResponse);
+ HandlerResponse handlerResponse = processHandlers(controllerContext, controllerCommand, commandResponse);
// Handle redirection here
if (handlerResponse instanceof CommandForward)
{
CommandForward forward = (CommandForward)handlerResponse;
URLContext urlContext = controllerContext.getServerInvocation().getServerContext().getURLContext();
- if (requiresRedirect(command, urlContext, forward))
+ if (requiresRedirect(controllerCommand, urlContext, forward))
{
String url = controllerContext.renderURL(forward.getCommand(), forward.getURLContext(), null);
return new HTTPResponse.SendRedirect(url);
@@ -108,12 +108,12 @@
private static class OtherResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand cdmand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand cdmand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
final ServerInvocation invocation = controllerContext.getServerInvocation();
- if (response instanceof PageRendition)
+ if (controllerResponse instanceof PageRendition)
{
- final PageRendition rendition = (PageRendition)response;
+ final PageRendition rendition = (PageRendition)controllerResponse;
// Defer execution of rendition to the right place which is in the classic controller send response
return new HTTPResponse()
@@ -126,10 +126,10 @@
}
};
}
- else if (response instanceof SignOutResponse)
+ else if (controllerResponse instanceof SignOutResponse)
{
// Get the optional signout location
- String location = ((SignOutResponse)response).getLocation();
+ String location = ((SignOutResponse)controllerResponse).getLocation();
// Indicate that we want a sign out to be done
invocation.getResponse().setWantSignOut(true);
@@ -147,9 +147,9 @@
//
return new HTTPResponse.SendRedirect(location);
}
- else if (response instanceof StreamContentResponse)
+ else if (controllerResponse instanceof StreamContentResponse)
{
- StreamContentResponse scr = (StreamContentResponse)response;
+ StreamContentResponse scr = (StreamContentResponse)controllerResponse;
return new HTTPResponse.SendBinary(scr.getContentType(), scr.getInputStream());
}
else
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -44,11 +44,11 @@
*/
public class ThrowableResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof ThrowableResponse)
+ if (controllerResponse instanceof ThrowableResponse)
{
- ThrowableResponse tr = (ThrowableResponse)response;
+ ThrowableResponse tr = (ThrowableResponse)controllerResponse;
Throwable t = tr.getThrowable();
URLContext urlContext = controllerContext.getServerInvocation().getServerContext().getURLContext();
@@ -62,7 +62,7 @@
else
{
urlContext = URLContext.newInstance(urlContext.isSecure(), true);
- ServerURL serverURL = controllerContext.getController().getURLFactory().doMapping(controllerContext, controllerContext.getServerInvocation(), command);
+ ServerURL serverURL = controllerContext.getController().getURLFactory().doMapping(controllerContext, controllerContext.getServerInvocation(), controllerCommand);
String url = controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext, null);
return new HTTPResponse.SendRedirect(url);
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -28,13 +28,25 @@
import org.jboss.portal.core.controller.ControllerResponse;
/**
+ * The response handler interface defines the contract for translating the result of the execution
+ * of a command into a new type of result.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ResponseHandler
{
+ /**
+ * Process the command response and provides an handler response.
+ *
+ * @param controllerContext the controller context
+ * @param controllerCommand the controller command
+ * @param controllerResponse the controller response
+ * @return the handler response
+ * @throws ResponseHandlerException
+ */
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
- ControllerCommand command,
- ControllerResponse response) throws ResponseHandlerException;
+ ControllerCommand controllerCommand,
+ ControllerResponse controllerResponse) throws ResponseHandlerException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -61,15 +61,15 @@
this.ajaxResponseHandler = ajaxResponseHandler;
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
if (ControllerContext.AJAX_TYPE == controllerContext.getType())
{
- return ajaxResponseHandler.processCommandResponse(controllerContext, command, response);
+ return ajaxResponseHandler.processCommandResponse(controllerContext, controllerCommand, controllerResponse);
}
else
{
- return classicResponseHandler.processCommandResponse(controllerContext, command, response);
+ return classicResponseHandler.processCommandResponse(controllerContext, controllerCommand, controllerResponse);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -84,12 +84,12 @@
}
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof PortletResponse)
+ if (controllerResponse instanceof PortletResponse)
{
ServerInvocation invocation = controllerContext.getServerInvocation();
- PortletResponse pr = (PortletResponse)response;
+ PortletResponse pr = (PortletResponse)controllerResponse;
PortletInvocationResponse pir = pr.getResult();
//
@@ -118,12 +118,12 @@
else if (pir instanceof InsufficientTransportGuaranteeResponse)
{
boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(command, URLContext.newInstance(true, authenticated));
+ return new CommandForward(controllerCommand, URLContext.newInstance(true, authenticated));
}
else if (pir instanceof InsufficientPrivilegesResponse)
{
boolean authenticated = invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(command, URLContext.newInstance(true, authenticated));
+ return new CommandForward(controllerCommand, URLContext.newInstance(true, authenticated));
}
else if (pir instanceof SignOutResponse)
{
@@ -139,7 +139,7 @@
if (location == null)
{
// Redirect to the same page
- InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)command;
+ InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)controllerCommand;
Page page = iwac.getPage();
ViewPageCommand renderCmd = new ViewPageCommand(page.getId());
boolean secure = invocation.getServerContext().getURLContext().isSecure();
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -47,13 +47,13 @@
*/
public class PortletInstanceResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand codmmand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand codmmand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof UpdatePortletInstanceResponse)
+ if (controllerResponse instanceof UpdatePortletInstanceResponse)
{
try
{
- UpdatePortletInstanceResponse upir = (UpdatePortletInstanceResponse)response;
+ UpdatePortletInstanceResponse upir = (UpdatePortletInstanceResponse)controllerResponse;
RenderPortletInstanceCommand render= new RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
final PageRendition rendition = (PageRendition)controllerContext.execute(render);
final ServerInvocation invocation = controllerContext.getServerInvocation();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-05-26 22:12:54 UTC (rev 7344)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-05-29 08:44:29 UTC (rev 7345)
@@ -51,11 +51,11 @@
public class PortalObjectResponseHandler extends AbstractResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand ceommand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext, ControllerCommand ceommand, ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof UpdatePageResponse)
+ if (controllerResponse instanceof UpdatePageResponse)
{
- UpdatePageResponse uvr = (UpdatePageResponse)response;
+ UpdatePageResponse uvr = (UpdatePageResponse)controllerResponse;
try
{
@@ -80,9 +80,9 @@
return null;
}
}
- else if (response instanceof UpdateWindowResponse)
+ else if (controllerResponse instanceof UpdateWindowResponse)
{
- UpdateWindowResponse uwmr = (UpdateWindowResponse)response;
+ UpdateWindowResponse uwmr = (UpdateWindowResponse)controllerResponse;
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
Page page = (Page)window.getParent();
16 years, 11 months
JBoss Portal SVN: r7344 - in trunk/core/src: resources/portal-core-war/WEB-INF/jsp/user and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-26 18:12:54 -0400 (Sat, 26 May 2007)
New Revision: 7344
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp
Log:
JBPORTAL-1428 Creating a user should take you back to the screen you came from, not back to the members page.
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 2007-05-26 21:16:16 UTC (rev 7343)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-26 22:12:54 UTC (rev 7344)
@@ -563,6 +563,10 @@
{
if (req.isUserInRole("Admin"))
{
+ DelegateContext ctx = new DelegateContext();
+ ctx.put("lastView", req.getParameters().get("lastView", "showMenu"));
+ req.setAttribute(PortalJsp.CTX_REQUEST, ctx);
+
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/user/registerUser.jsp");
rd.include(req, resp);
}
@@ -691,6 +695,8 @@
{
// TODO: Check that a bot is not creating many accounts
String uname = req.getParameter("uname");
+ resp.setRenderParameter("op", req.getParameters().get("lastView",OP_SHOWMENU));
+
int nbErrors = 0;
if ((uname == null) || (uname.length() == 0))
{
@@ -825,8 +831,15 @@
{
log.info("You didn't specify a default role in the portlet init configuration, please refer to the documentation");
}
- resp.setRenderParameter("op", OP_SHOWREGISTER_TY);
- resp.setWindowState(WindowState.NORMAL);
+ //resp.setRenderParameter("op", OP_SHOWREGISTER_TY);
+ if (req.getParameters().get("lastView",OP_SHOWMENU).equals(OP_SHOWLISTUSERS))
+ {
+ resp.setWindowState(WindowState.MAXIMIZED);
+ }
+ else
+ {
+ resp.setWindowState(WindowState.NORMAL);
+ }
}
catch (IllegalArgumentException e)
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp 2007-05-26 21:16:16 UTC (rev 7343)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp 2007-05-26 22:12:54 UTC (rev 7344)
@@ -95,5 +95,6 @@
href="
<portlet:renderURL windowState="maximized">
<portlet:param name="op" value="showRegister"/>
+ <portlet:param name="lastView" value="showListUsers"/>
</portlet:renderURL>
">${n:i18n("REGISTER_REGISTER_ADMIN_LINK")}</a>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
===================================================================
(Binary files differ)
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp 2007-05-26 21:16:16 UTC (rev 7343)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp 2007-05-26 22:12:54 UTC (rev 7344)
@@ -15,6 +15,7 @@
<table width="100%" cellpadding="0" cellspacing="10" border="0" class="pn-normal">
<form name="<portlet:namespace/>register"
action="<portlet:actionURL><portlet:param name="op" value="userRegister"/></portlet:actionURL>" method="post">
+ <input name="lastView" value="${n:out('lastView')}" type="hidden"/>
<tr>
<td colspan="3" nowrap><h4>${n:i18n("REGISTER_BASICINFO")}</h4></td>
</tr>
@@ -62,10 +63,6 @@
</td>--%>
</tr>
</form>
- <form
- name="<portlet:namespace/>cancel"
- method="post"
- action="<portlet:renderURL windowState="normal"/>"/>
<tr>
<td colspan="3" class="bottombuttonbar">
<input name="Save" class="portlet-form-button" id="register" type="submit"
@@ -77,5 +74,12 @@
value="${n:i18n("Cancel")}"/>
</td>
</tr>
+ <form
+ name="<portlet:namespace/>cancel"
+ method="post"
+ action="<portlet:renderURL windowState="maximized">
+ <portlet:param name="op" value="${n:out('lastView')}"/>
+ </portlet:renderURL>"/>
+
</table>
\ No newline at end of file
16 years, 11 months
JBoss Portal SVN: r7343 - in trunk/core/src: resources/portal-core-war/WEB-INF/jsp/role and 1 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-26 17:16:16 -0400 (Sat, 26 May 2007)
New Revision: 7343
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editProfile.jsp
Log:
JBPORTAL-1437 - The cancel button should send you back to view that you came from, not back to the Members page.
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-25 16:40:42 UTC (rev 7342)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/role/RolePortlet.java 2007-05-26 21:16:16 UTC (rev 7343)
@@ -325,6 +325,10 @@
PortletURL editURL = resp.createRenderURL();
editURL.setParameter(getOperationName(), OP_SHOWADDROLESTOUSER);
editURL.setParameter("userid", "" + user.getId());
+ editURL.setParameter("roleid", "" + role.getId());
+ editURL.setParameter("usernamefilter", usernameFilter);
+ editURL.setParameter("offset", "" + offset);
+ editURL.setParameter("usersperpage", "" + usersPerPage);
rowCtx.put("editURL", editURL.toString());
}
@@ -398,7 +402,14 @@
try
{
+ ctx.put("usernamefilter", req.getParameter("usernamefilter"));
+ ctx.put("offset", req.getParameter("offset"));
+ ctx.put("usersperpage", req.getParameter("usersperpage"));
+ ctx.put("roleid", req.getParameter("roleid"));
+
+
User user = userModule.findUserById(req.getParameter("userid"));
+
ctx.put("userid", user.getId().toString());
ctx.put("username", user.getUserName());
ctx.put("userfullname", getFullName(bundle, user));
@@ -663,6 +674,12 @@
if (request.isUserInRole(ADMIN_ROLE))
{
String userId = request.getParameters().getParameter("userid");
+
+ response.setRenderParameter("usernamefilter", request.getParameter("usernamefilter"));
+ response.setRenderParameter("offset", request.getParameter("offset"));
+ response.setRenderParameter("roleid", request.getParameter("roleid"));
+ response.setRenderParameter("usersperpage", request.getParameter("usersperpage"));
+
if (request.getParameterMap().keySet().contains("addRoles"))
{
String[] selectedRoles = request.getParameterValues("assignedRoles");
@@ -757,6 +774,9 @@
User user = userModule.findUserById(userId);
Set roles = roleModule.findRolesByNames(selectedRoles);
membershipModule.assignRoles(user, roles);
+
+ response.setRenderParameter("op", OP_SHOWLISTROLEMEMBERS );
+ response.setRenderParameter("userid", userId);
}
catch (IllegalArgumentException e)
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-25 16:40:42 UTC (rev 7342)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/role/editUserRoles.jsp 2007-05-26 21:16:16 UTC (rev 7343)
@@ -12,9 +12,17 @@
<th/>
<th>${n:i18n("ASSIGNEDROLES")}</th>
</tr>
- <form name="<portlet:namespace/>editRoles" method="post" action="<portlet:actionURL><portlet:param name="op" value="addRolesToUser"/></portlet:actionURL>">
+ <form name="<portlet:namespace/>editRoles" method="post"
+ action="<portlet:actionURL>
+ <portlet:param name="op" value="addRolesToUser"/>
+ </portlet:actionURL>">
<input type="hidden" name="userid" value="${n:out("userid")}"/>
+ <input type="hidden" name="usernamefilter" value="${n:out("usernamefilter")}"/>
+ <input type="hidden" name="offset" value="${n:out("offset")}"/>
+ <input type="hidden" name="roleid" value="${n:out("roleid")}"/>
+ <input type="hidden" name="usersperpage" value="${n:out("usersperpage")}"/>
+
<n:iterate ctx="userRoles">
<input type="hidden" name="assignedRoles" value="${n:out("userRoles.name")}"/>
</n:iterate>
@@ -57,7 +65,13 @@
</tr>
<form
name="<portlet:namespace/>cancel"
- action="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showSummary"/></portlet:renderURL>"
+ action="<portlet:actionURL windowState="normal">
+ <portlet:param name="op" value="showListEditRoleMembers"/>
+ <portlet:param name="usernamefilter" value="${n:out('usernamefilter')}"/>
+ <portlet:param name="roleid" value="${n:out('roleid')}"/>
+ <portlet:param name="usersperpage" value="${n:out('usersperpage')}"/>
+ <portlet:param name="offset" value="${n:out('offset')}"/>
+ </portlet:actionURL>"
method="post"/>
</table>
</span>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editProfile.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editProfile.jsp 2007-05-25 16:40:42 UTC (rev 7342)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editProfile.jsp 2007-05-26 21:16:16 UTC (rev 7343)
@@ -8,7 +8,7 @@
<hr/>
<table cellpadding="0" cellspacing="8" border="0" class="pn-normal">
-<form action="<portlet:actionURL><portlet:param name="op" value="storeProfile"/></portlet:actionURL>" method="post">
+<form name="<portlet:namespace/>save" action="<portlet:actionURL><portlet:param name="op" value="storeProfile"/></portlet:actionURL>" method="post">
<input type="hidden" name="userid" value="${n:out("userid")}"/>
<tr>
<td colspan="3" nowrap><h4>${n:i18n("REGISTER_BASICINFO")}</h4></td>
@@ -175,11 +175,25 @@
<td class="pn-normal"><input type="text" name="answer" value="${n:out("ANSWER")}" size="30" maxlength="100"></td>
</tr>
<tr>
- <td colspan="3" class="bottombuttonbar"><input class="portlet-form-button" type="submit"
+ <%--<td colspan="3" class="bottombuttonbar"><input class="portlet-form-button" type="submit"
value="${n:i18n("REGISTER_SAVECHANGES")}">
<span class="portlet-font"><a
href="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showMenu"/></portlet:renderURL>">${n:i18n("Cancel")}</a></span>
- </td>
+ </td>--%>
</tr>
</form>
+<tr>
+ <td colspan="3">
+ <input name="Save" class="portlet-form-button" id="Assign" type="submit"
+ onclick="document.forms['<portlet:namespace/>save'].submit();"
+ value="${n:i18n("REGISTER_SAVECHANGES")}"/>
+
+ <input name="Cancel" class="portlet-form-button" id="Cancel" type="submit"
+ onclick="document.forms['<portlet:namespace/>cancel'].submit();"
+ value="${n:i18n("Cancel")}"/>
+</tr>
+<form
+ name="<portlet:namespace/>cancel"
+ action="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showMenu"/></portlet:renderURL>"
+ method="post"/>
</table>
\ No newline at end of file
16 years, 11 months
JBoss Portal SVN: r7342 - in branches/2_6_CAS_Integration: identity/cas and 1 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-05-25 12:40:42 -0400 (Fri, 25 May 2007)
New Revision: 7342
Added:
branches/2_6_CAS_Integration/identity/cas/config/
branches/2_6_CAS_Integration/identity/cas/config/context.xml
branches/2_6_CAS_Integration/identity/cas/config/deployerConfigContext.xml
Modified:
branches/2_6_CAS_Integration/core/build.xml
Log:
CAS plugin deployment related cleanup
Modified: branches/2_6_CAS_Integration/core/build.xml
===================================================================
--- branches/2_6_CAS_Integration/core/build.xml 2007-05-25 15:49:41 UTC (rev 7341)
+++ branches/2_6_CAS_Integration/core/build.xml 2007-05-25 16:40:42 UTC (rev 7342)
@@ -749,6 +749,15 @@
<copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" overwrite="true">
<fileset dir="../identity/cas/lib" includes="casclient.jar"/>
</copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/portal-server.war/WEB-INF" overwrite="true">
+ <fileset dir="../identity/cas/config" includes="context.xml"/>
+ </copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/cas.war/WEB-INF" overwrite="true">
+ <fileset dir="../identity/cas/config" includes="deployerConfigContext.xml"/>
+ </copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/cas.war/WEB-INF/lib" overwrite="true">
+ <fileset dir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" includes="portal-identity-lib.jar"/>
+ </copy>
</target>
<target name="deploy-cas-lenient" depends="deploy-explode">
<require file="${jboss.home}/server/${portal.deploy.dir}"/>
@@ -756,5 +765,14 @@
<copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" overwrite="true">
<fileset dir="../identity/cas/lib" includes="casclient-lenient.jar"/>
</copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/portal-server.war/WEB-INF" overwrite="true">
+ <fileset dir="../identity/cas/config" includes="context.xml"/>
+ </copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/cas.war/WEB-INF" overwrite="true">
+ <fileset dir="../identity/cas/config" includes="deployerConfigContext.xml"/>
+ </copy>
+ <copy todir="${jboss.home}/server/${portal.deploy.dir}/cas.war/WEB-INF/lib" overwrite="true">
+ <fileset dir="${jboss.home}/server/${portal.deploy.dir}/jboss-portal.sar/lib" includes="portal-identity-lib.jar"/>
+ </copy>
</target>
</project>
Added: branches/2_6_CAS_Integration/identity/cas/config/context.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/cas/config/context.xml (rev 0)
+++ branches/2_6_CAS_Integration/identity/cas/config/context.xml 2007-05-25 16:40:42 UTC (rev 7342)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<Context>
+ <Valve className="org.jboss.portal.identity.auth.CASAuthenticationValve"
+ casLogin="https://localhost/cas/login"
+ casValidate="https://localhost/cas/serviceValidate"
+ casServerName="localhost"
+ authType="FORM"
+ />
+</Context>
Added: branches/2_6_CAS_Integration/identity/cas/config/deployerConfigContext.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/cas/config/deployerConfigContext.xml (rev 0)
+++ branches/2_6_CAS_Integration/identity/cas/config/deployerConfigContext.xml 2007-05-25 16:40:42 UTC (rev 7342)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+ | deployerConfigContext.xml centralizes into one file some of the declarative configuration that
+ | all CAS deployers will need to modify.
+ |
+ | This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.
+ | The beans declared in this file are instantiated at context initialization time by the Spring
+ | ContextLoaderListener declared in web.xml. It finds this file because this
+ | file is among those declared in the context parameter "contextConfigLocation".
+ |
+ | By far the most common change you will need to make in this file is to change the last bean
+ | declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with
+ | one implementing your approach for authenticating usernames and passwords.
+ +-->
+<beans>
+ <!--
+ | This bean declares our AuthenticationManager. The CentralAuthenticationService service bean
+ | declared in applicationContext.xml picks up this AuthenticationManager by reference to its id,
+ | "authenticationManager". Most deployers will be able to use the default AuthenticationManager
+ | implementation and so do not need to change the class of this bean. We include the whole
+ | AuthenticationManager here in the userConfigContext.xml so that you can see the things you will
+ | need to change in context.
+ +-->
+ <bean id="authenticationManager"
+ class="org.jasig.cas.authentication.AuthenticationManagerImpl">
+ <!--
+ | This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate.
+ | The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which
+ | supports the presented credentials.
+ |
+ | AuthenticationManagerImpl uses these resolvers for two purposes. First, it uses them to identify the Principal
+ | attempting to authenticate to CAS /login . In the default configuration, it is the DefaultCredentialsToPrincipalResolver
+ | that fills this role. If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace
+ | DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are
+ | using.
+ |
+ | Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket.
+ | In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose.
+ | You will need to change this list if you are identifying services by something more or other than their callback URL.
+ +-->
+ <property name="credentialsToPrincipalResolvers">
+ <list>
+ <!--
+ | UsernamePasswordCredentialsToPrincipalResolver supports the UsernamePasswordCredentials that we use for /login
+ | by default and produces SimplePrincipal instances conveying the username from the credentials.
+ |
+ | If you've changed your LoginFormAction to use credentials other than UsernamePasswordCredentials then you will also
+ | need to change this bean declaration (or add additional declarations) to declare a CredentialsToPrincipalResolver that supports the
+ | Credentials you are using.
+ +-->
+ <bean
+ class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />
+ <!--
+ | HttpBasedServiceCredentialsToPrincipalResolver supports HttpBasedCredentials. It supports the CAS 2.0 approach of
+ | authenticating services by SSL callback, extracting the callback URL from the Credentials and representing it as a
+ | SimpleService identified by that callback URL.
+ |
+ | If you are representing services by something more or other than an HTTPS URL whereat they are able to
+ | receive a proxy callback, you will need to change this bean declaration (or add additional declarations).
+ +-->
+ <bean
+ class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
+ </list>
+ </property>
+
+ <!--
+ | Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate,
+ | AuthenticationHandlers actually authenticate credentials. Here we declare the AuthenticationHandlers that
+ | authenticate the Principals that the CredentialsToPrincipalResolvers identified. CAS will try these handlers in turn
+ | until it finds one that both supports the Credentials presented and succeeds in authenticating.
+ +-->
+ <property name="authenticationHandlers">
+ <list>
+ <!--
+ | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
+ | a server side SSL certificate.
+ +-->
+ <bean
+ class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler">
+ <property
+ name="httpClient"
+ ref="httpClient" />
+ </bean>
+
+ <!--
+ | This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS
+ | into production. The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
+ | where the username equals the password. You will need to replace this with an AuthenticationHandler that implements your
+ | local authentication strategy. You might accomplish this by coding a new such handler and declaring
+ | edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
+ +-->
+ <bean
+ class="org.jboss.portal.identity.auth.CASAuthenticationHandler" />
+ </list>
+ </property>
+ </bean>
+</beans>
16 years, 11 months
JBoss Portal SVN: r7341 - branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-05-25 11:49:41 -0400 (Fri, 25 May 2007)
New Revision: 7341
Removed:
branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml
Log:
cleaning up
Deleted: branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml
===================================================================
--- branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml 2007-05-25 11:00:53 UTC (rev 7340)
+++ branches/2_6_CAS_Integration/core/src/resources/portal-server-war/WEB-INF/context.xml 2007-05-25 15:49:41 UTC (rev 7341)
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<Context>
- <Valve className="org.jboss.portal.identity.auth.CASAuthenticationValve"
- casLogin="https://localhost/cas/login"
- casValidate="https://localhost/cas/serviceValidate"
- casServerName="localhost"
- authType="FORM"
- />
-</Context>
16 years, 11 months
JBoss Portal SVN: r7340 - in trunk/core/src: resources/portal-core-war/WEB-INF/jsp/user and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-05-25 07:00:53 -0400 (Fri, 25 May 2007)
New Revision: 7340
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
Log:
JBPORTAL-1428 - Creating a user should take you back to the screen you came from, not back to the members page.
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 2007-05-25 10:56:24 UTC (rev 7339)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-05-25 11:00:53 UTC (rev 7340)
@@ -487,6 +487,8 @@
DelegateContext ctx = new DelegateContext();
ctx.put("usernamefilter", req.getParameter("usernamefilter"));
+ ctx.put("offset", req.getParameter("offset"));
+ ctx.put("usersperpage", req.getParameter("usersperpage"));
try
{
@@ -1082,6 +1084,8 @@
String userId = request.getParameters().getParameter("userid");
response.setRenderParameter("usernamefilter", request.getParameter("usernamefilter"));
+ response.setRenderParameter("offset", request.getParameter("offset"));
+ response.setRenderParameter("usersperpage", request.getParameter("usersperpage"));
if (request.getParameterMap().keySet().contains("addRoles"))
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/editUserRoles.jsp
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Portal SVN: r7339 - trunk/core/src/bin/portal-core-war/layouts/3columns.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-05-25 06:56:24 -0400 (Fri, 25 May 2007)
New Revision: 7339
Modified:
trunk/core/src/bin/portal-core-war/layouts/3columns/index.jsp
Log:
Put back: "Powered by JBoss Portal"
Modified: trunk/core/src/bin/portal-core-war/layouts/3columns/index.jsp
===================================================================
--- trunk/core/src/bin/portal-core-war/layouts/3columns/index.jsp 2007-05-25 10:55:58 UTC (rev 7338)
+++ trunk/core/src/bin/portal-core-war/layouts/3columns/index.jsp 2007-05-25 10:56:24 UTC (rev 7339)
@@ -55,10 +55,9 @@
</div>
<!-- TODO: Fix the auto jump in this tag -->
-<!-- <div id="footer-container" class="portal-copyright">Powered by
+<div id="footer-container" class="portal-copyright">Powered by
<a class="portal-copyright" href="http://www.jboss.com/products/jbossportal">JBoss Portal</a><br/>
</div>
--->
<p:region regionName='AJAXFooter' regionID='AJAXFooter'/>
16 years, 11 months