JBoss Portal SVN: r5768 - trunk/core/src/main/org/jboss/portal/core/model/portal
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-05 17:00:26 -0500 (Tue, 05 Dec 2006)
New Revision: 5768
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Log:
added javadoc
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-12-05 21:52:46 UTC (rev 5767)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-12-05 22:00:26 UTC (rev 5768)
@@ -35,6 +35,7 @@
/**
* Return a container object.
*
+ * @param id the portal object id
* @return the specified portal object
* @throws IllegalArgumentException if the id is null
*/
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 21:52:46 UTC (rev 5767)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 22:00:26 UTC (rev 5768)
@@ -28,19 +28,27 @@
import java.util.Iterator;
/**
+ * A composite id for a portal object.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public class PortalObjectId implements Comparable
{
- /** . */
+ /** The composites. */
private final String[] names;
- /** . */
+ /** The lazy computed hash code. */
private Integer hashCode;
- public PortalObjectId(PortalObjectId that)
+ /**
+ * Copy constructor.
+ *
+ * @param that the id to clone
+ * @throws IllegalArgumentException if the argument to clone is null
+ */
+ public PortalObjectId(PortalObjectId that) throws IllegalArgumentException
{
if (that == null)
{
@@ -50,7 +58,13 @@
this.hashCode = that.hashCode;
}
- public PortalObjectId(String[] names)
+ /**
+ * Build an id directly from its composing names.
+ *
+ * @param names the id names
+ * @throws IllegalArgumentException if any argument is null or not well formed
+ */
+ public PortalObjectId(String[] names) throws IllegalArgumentException
{
if (names == null)
{
@@ -59,7 +73,14 @@
this.names = names;
}
- public PortalObjectId(String value, Format format)
+ /**
+ * Build an id by parsing a string representation.
+ *
+ * @param value the string representation
+ * @param format the string format
+ * @throws IllegalArgumentException if any argument is null or not well formed
+ */
+ public PortalObjectId(String value, Format format) throws IllegalArgumentException
{
this.names = format.parse(value);
}
@@ -116,16 +137,30 @@
throw new NotYetImplemented();
}
+ /**
+ * Return an iterator over the different names.
+ *
+ * @return the iterator over the names
+ */
public Iterator names()
{
return Tools.iterator(names);
}
+ /**
+ * Returns the canonical representation of the id.
+ */
public String toString()
{
return CANONICAL_FORMAT.toString(names);
}
+ /**
+ * Returns a string representation using a specified format
+ *
+ * @param format the output format
+ * @return the string value
+ */
public String toString(Format format)
{
if (format == null)
@@ -137,14 +172,12 @@
public static PortalObjectId parse(String value, Format format)
{
- if (format == null)
- {
- throw new IllegalArgumentException();
- }
- String[] names = format.parse(value);
- return new PortalObjectId(names);
+ return new PortalObjectId(value, format);
}
+ /**
+ * The format of a string representation of an id.
+ */
public abstract static class Format
{
/**
@@ -152,21 +185,21 @@
* @param value
* @return
*/
- public abstract String[] parse(String value);
+ public abstract String[] parse(String value) throws IllegalArgumentException;
/**
*
* @param names
* @return
*/
- public abstract String toString(String[] names);
+ public abstract String toString(String[] names) throws IllegalArgumentException;
/**
*
* @param id
* @return
*/
- public final String toString(PortalObjectId id)
+ public final String toString(PortalObjectId id) throws IllegalArgumentException
{
if (id == null)
{
@@ -176,6 +209,9 @@
}
}
+ /**
+ * Canonical format, smth like /a/b/c.
+ */
public static final Format CANONICAL_FORMAT = new Format()
{
public String[] parse(String value)
@@ -254,6 +290,9 @@
}
};
+ /**
+ * The internal format when it is persisted, smth like a.b.c
+ */
public static final Format LEGACY_FORMAT = new Format()
{
19 years, 6 months
JBoss Portal SVN: r5767 - in trunk: common/src/main/org/jboss/portal/common/util core core/src/main/org/jboss/portal/core/model/portal core/src/main/org/jboss/portal/test/core/model/portal
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-05 16:52:46 -0500 (Tue, 05 Dec 2006)
New Revision: 5767
Added:
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java
Modified:
trunk/common/src/main/org/jboss/portal/common/util/Tools.java
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Log:
added PortalObjectId tests
Modified: trunk/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2006-12-05 18:58:54 UTC (rev 5766)
+++ trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2006-12-05 21:52:46 UTC (rev 5767)
@@ -409,6 +409,11 @@
return set;
}
+ public static Object[] toArray(Iterator i)
+ {
+ return toList(i).toArray();
+ }
+
public static List toList(Enumeration e)
{
List list = new ArrayList();
@@ -429,7 +434,7 @@
return set;
}
- public static Set toSet(final Iterator iterator)
+ public static Set toSet(Iterator iterator)
{
HashSet set = new HashSet();
while (iterator.hasNext())
@@ -439,7 +444,7 @@
return set;
}
- public static List toList(final Object[] objects)
+ public static List toList(Object[] objects)
{
List list = new ArrayList();
for (int i = 0; i < objects.length; i++)
@@ -450,7 +455,7 @@
return list;
}
- public static List toList(final Iterator iterator)
+ public static List toList(Iterator iterator)
{
List list = new ArrayList();
while (iterator.hasNext())
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-12-05 18:58:54 UTC (rev 5766)
+++ trunk/core/build.xml 2006-12-05 21:52:46 UTC (rev 5767)
@@ -556,8 +556,10 @@
<execute-tests>
<x-sysproperty>
+<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+-->
<sysproperty
key="jboss.aop.path"
@@ -603,6 +605,8 @@
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
+ <test todir="${test.reports}"
+ name="org.jboss.portal.test.core.model.portal.PortalObjectIdTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-core-lib.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 18:58:54 UTC (rev 5766)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 21:52:46 UTC (rev 5767)
@@ -42,12 +42,20 @@
public PortalObjectId(PortalObjectId that)
{
+ if (that == null)
+ {
+ throw new IllegalArgumentException();
+ }
this.names = that.names;
this.hashCode = that.hashCode;
}
public PortalObjectId(String[] names)
{
+ if (names == null)
+ {
+ throw new IllegalArgumentException();
+ }
this.names = names;
}
@@ -160,6 +168,10 @@
*/
public final String toString(PortalObjectId id)
{
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No null id accepted");
+ }
return toString(id.names);
}
}
Added: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java 2006-12-05 18:58:54 UTC (rev 5766)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectIdTestCase.java 2006-12-05 21:52:46 UTC (rev 5767)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.model.portal;
+
+import junit.framework.TestCase;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.junit.ExtendedAssert;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalObjectIdTestCase extends TestCase
+{
+
+ public void testIAE()
+ {
+ try
+ {
+ PortalObjectId.parse("/", null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse(null, PortalObjectId.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ PortalObjectId.parse(null, PortalObjectId.LEGACY_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId((String[])null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId((PortalObjectId)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId(null, PortalObjectId.CANONICAL_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId(null, PortalObjectId.LEGACY_FORMAT);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new PortalObjectId(new String[0]).toString(null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testFormatIAE()
+ {
+ testFormatIAE(PortalObjectId.CANONICAL_FORMAT);
+ testFormatIAE(PortalObjectId.LEGACY_FORMAT);
+ }
+
+ private void testFormatIAE(PortalObjectId.Format format)
+ {
+ try
+ {
+ format.toString((String[])null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ format.toString((PortalObjectId)null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ try
+ {
+ format.toString(new String[]{"a",null,"b"});
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testCanonicalFormat()
+ {
+ assertEquals(new PortalObjectId(new String[]{}), PortalObjectId.parse("/", PortalObjectId.CANONICAL_FORMAT));
+ assertEquals(new PortalObjectId(new String[]{"a"}), PortalObjectId.parse("/a", PortalObjectId.CANONICAL_FORMAT));
+ assertEquals(new PortalObjectId(new String[]{"a","b"}), PortalObjectId.parse("/a/b", PortalObjectId.CANONICAL_FORMAT));
+ }
+
+ public void testLegacyFormat()
+ {
+ assertEquals(new PortalObjectId(new String[]{}), PortalObjectId.parse("", PortalObjectId.LEGACY_FORMAT));
+ assertEquals(new PortalObjectId(new String[]{"a"}), PortalObjectId.parse("a", PortalObjectId.LEGACY_FORMAT));
+ assertEquals(new PortalObjectId(new String[]{"a","b"}), PortalObjectId.parse("a.b", PortalObjectId.LEGACY_FORMAT));
+ }
+
+ public void testEquals()
+ {
+ assertTrue(new PortalObjectId(new String[]{}).equals(new PortalObjectId(new String[]{})));
+ assertFalse(new PortalObjectId(new String[]{}).equals(new PortalObjectId(new String[]{"a"})));
+ assertFalse(new PortalObjectId(new String[]{}).equals(new PortalObjectId(new String[]{"a","b"})));
+ assertFalse(new PortalObjectId(new String[]{"a"}).equals(new PortalObjectId(new String[]{})));
+ assertTrue(new PortalObjectId(new String[]{"a"}).equals(new PortalObjectId(new String[]{"a"})));
+ assertFalse(new PortalObjectId(new String[]{"a"}).equals(new PortalObjectId(new String[]{"a","b"})));
+ assertFalse(new PortalObjectId(new String[]{"a","b"}).equals(new PortalObjectId(new String[]{})));
+ assertFalse(new PortalObjectId(new String[]{"a","b"}).equals(new PortalObjectId(new String[]{"a"})));
+ assertTrue(new PortalObjectId(new String[]{"a","b"}).equals(new PortalObjectId(new String[]{"a","b"})));
+ }
+
+ public void testIterator()
+ {
+ ExtendedAssert.assertEquals(new Object[]{}, Tools.toArray(new PortalObjectId(new String[]{}).names()));
+ ExtendedAssert.assertEquals(new Object[]{"a"}, Tools.toArray(new PortalObjectId(new String[]{"a"}).names()));
+ ExtendedAssert.assertEquals(new Object[]{"a","b"}, Tools.toArray(new PortalObjectId(new String[]{"a","b"}).names()));
+ }
+}
19 years, 6 months
JBoss Portal SVN: r5766 - docs/trunk/userGuide/en/modules
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-05 13:58:54 -0500 (Tue, 05 Dec 2006)
New Revision: 5766
Modified:
docs/trunk/userGuide/en/modules/admincmsPortlet.xml
Log:
JBPORTAL-1113 - cmsadmin chapter redone.
Modified: docs/trunk/userGuide/en/modules/admincmsPortlet.xml
===================================================================
--- docs/trunk/userGuide/en/modules/admincmsPortlet.xml 2006-12-05 18:54:26 UTC (rev 5765)
+++ docs/trunk/userGuide/en/modules/admincmsPortlet.xml 2006-12-05 18:58:54 UTC (rev 5766)
@@ -12,112 +12,26 @@
<title>Introduction</title>
<para>The CMSAdmin Portlet allows control over the content management system.</para>
<para>Viewing the CMSAdmin Portlet is accomplished by logging in as an admin (admin/admin) and
- navigating to the <xref linkend="adminportal"/> and then the CMS Page tab.</para>
+ navigating to the
+ <xref linkend="adminportal"/>
+ and then the CMS Page tab.
+ </para>
<para>You should then be presented with a page that is similar to this:</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/admincms/cms_adminpage.gif" format="gif" align="center" valign="middle"/>
</imageobject>
</mediaobject>
- <itemizedlist>
- <para>It is important for a user to note the action icons used throughout the portlet and
- their meanings. The action options change depending on what type of resource the user is
- dealing with. All possible actions are listed here:</para>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/edit.gif" format="gif"/>
- </imageobject>
- - Launches HTML WYSIWYG Editor window for HTML files. Launches upload dialog
- windoe for binary type files.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/copy.gif" format="gif"/>
- </imageobject>
- - Opens the copy file/folder dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/move.gif" format="gif"/>
- </imageobject>
- - Opens the move file/folder dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/createfile.gif" format="gif"/>
- </imageobject>
- - Launches HTML WYSIWYG Editor window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/createfolder.gif" format="gif"/>
- </imageobject>
- - Opens the create folder dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/upload.gif" format="gif"/>
- </imageobject>
- - Opens the upload file dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/upload_archive.gif" format="gif"/>
- </imageobject>
- - Opens the upload archive dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/export_archive.gif" format="gif"/>
- </imageobject>
- - Opens the export archive dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/delete.gif" format="gif"/>
- </imageobject>
- - Opens the delete confirmation dialog window.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/view.gif" format="gif"/>
- </imageobject>
- - In the case of files, opens the file properties view. In the case of
- folders, opens the folder listing.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/upfolder.gif" format="gif"/>
- </imageobject>
- - Moves up the folder tree when clicked on.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/plus.gif" format="gif"/>
- </imageobject>
- - Expands directory tree.
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <para>Additionally, there are icons that help describe the types of resources present on the
- page:</para>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/file.gif" format="gif"/>
- </imageobject>
- - Denotes this resource as a file.
- </listitem>
- <listitem>
- <imageobject>
- <imagedata fileref="images/admincms/folder.gif" format="gif"/>
- </imageobject>
- - Denotes this resource as a folder.
- </listitem>
- </itemizedlist>
</sect1>
<sect1>
<title>Actions</title>
- <para>This section describes common actions an administrator can perform from within the AdminCMS Portlet:
+ <para>This section describes common actions an administrator can perform from within the AdminCMS Portlet. All
+ actions are available using the flyout menu.
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/admincms/actions_menu.gif" format="gif" align="center" valign="middle"/>
+ </imageobject>
+ </mediaobject>
<itemizedlist>
<listitem>
<para>
@@ -174,6 +88,11 @@
<xref linkend="edittext"/>
</para>
</listitem>
+ <listitem>
+ <para>
+ <xref linkend="secure"/>
+ </para>
+ </listitem>
</itemizedlist>
</para>
<sect2 id="viewdir">
@@ -181,15 +100,11 @@
<para>
<mediaobject>
<imageobject>
- <imagedata fileref="images/admincms/ss_viewdir.gif" format="gif" align="center" valign="middle"/>
+ <imagedata fileref="images/admincms/ss_viewfile.gif" format="gif" align="center" valign="middle"/>
</imageobject>
</mediaobject>
- A user can list directory contents by either clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/view.gif" format="gif"/>
- </imageobject>
- icon, or clicking on the directory's "DisplayName". All actions are possible
- from this screen.
+ A user can list directory contents by either clicking on the folder name or selecting "view" from the Action
+ dropdown and clicking "go".
</para>
</sect2>
<sect2 id="viewfileprops">
@@ -200,11 +115,7 @@
<imagedata fileref="images/admincms/ss_viewfile.gif" format="gif" align="center" valign="middle"/>
</imageobject>
</mediaobject>
- Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/view.gif" format="gif"/>
- </imageobject>
- icon or the "DisplayName" of a file brings up the File Properties page.
+ Clicking on the "Name" of a file brings up the File Properties page.
</para>
<mediaobject>
<imageobject>
@@ -212,7 +123,8 @@
</imageobject>
</mediaobject>
<para>The File Properties window displays all the possible actions available to perform on a
- file.</para>
+ file.
+ </para>
<para>Version and Locale Information are also contained on this screen. Note that any version
labeled with the
<imageobject>
@@ -223,11 +135,7 @@
</sect2>
<sect2 id="copy">
<title>Copying Files/Directories</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/copy.gif" format="gif"/>
- </imageobject>
- icon displays the copy file/directory dialog window.
+ <para>Clicking on the "Copy" action, displays the copy file/directory dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/resourcecopy.gif" format="gif" align="center" valign="middle"/>
@@ -244,11 +152,7 @@
</sect2>
<sect2 id="move">
<title>Moving Files/Directories</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/move.gif" format="gif"/>
- </imageobject>
- icon displays the move file/directory dialog window.
+ <para>Clicking on the "Move" action, displays the move file/directory dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/resourcemove.gif" format="gif" align="center" valign="middle"/>
@@ -265,43 +169,35 @@
</sect2>
<sect2 id="delete">
<title>Deleting Files/Directories</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/delete.gif" format="gif"/>
- </imageobject>
- icon displays the delete file/directory confirmation window.
+ <para>Clicking on the "Delete" action, displays the delete file/directory confirmation window.
</para>
<imageobject>
<imagedata fileref="images/admincms/resourcedelete.gif" format="gif" align="center" valign="middle"/>
</imageobject>
<para>The delete resource confirmation window allows a user to delete a file, or a directory
on the system. Note that deleting a directory, will delete the entire tree, so all
- directories under the deleted one, will also be deleted.</para>
+ directories under the deleted one, will also be deleted.
+ </para>
<warning>Currently, there is no way to retrieve deleted files/directories! Deleting a file or
- directory is permanent!</warning>
+ directory is permanent!
+ </warning>
</sect2>
<sect2 id="createdir">
<title>Creating Directories</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/createfolder.gif" format="gif"/>
- </imageobject>
- icon displays the create directory dialog window.
+ <para>Clicking on the "Create Folder" action, displays the create directory dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/createdirectory.gif" format="gif" align="center" valign="middle"/>
</imageobject>
<para>The create directory resource window allows a user to create a directory under chosen
path. On this window, a user can specify a name for the new empty directory and assign it a
- description.</para>
+ description.
+ </para>
</sect2>
<sect2 id="createtext">
<title>Creating Text/HTML Files</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/createfile.gif" format="gif"/>
- </imageobject>
- icon displays the create file dialog window with the embedded WYSIWYG editor
+ <para>Clicking on the "Create File" action, displays the create file dialog window with the embedded WYSIWYG
+ editor
and directory browser.
</para>
<imageobject>
@@ -329,17 +225,15 @@
<note>It is important to note here that when creating links to images or other resources
within the system, as user must use the relative file path to that resource. ie:
images/hello.gif. Keep in mind at all times that the document base is
- http://localhost/portal/ by default!</note>
+ http://localhost/portal/ by default!
+ </note>
<para>Additionally, a user can set a title for the file that will be used in the portlet
- title bar, and a language for the file, used in serving localized content.</para>
+ title bar, and a language for the file, used in serving localized content.
+ </para>
</sect2>
<sect2 id="uploadfile">
<title>Uploading Files</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/upload.gif" format="gif"/>
- </imageobject>
- icon displays the upload file dialog window.
+ <para>Clicking on the "Upload File" action, displays the upload file dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/resourceupload.gif" format="gif" align="center" valign="middle"/>
@@ -359,11 +253,7 @@
</sect2>
<sect2 id="uploadarchive">
<title>Uploading Archives</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/upload_archive.gif" format="gif"/>
- </imageobject>
- icon displays the upload archive dialog window.
+ <para>Clicking on the "Upload Archive" action, displays the upload archive dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/resourceuploadarchive.gif" format="gif" align="center" valign="middle"/>
@@ -382,11 +272,7 @@
</sect2>
<sect2 id="exportarchive">
<title>Exporting Archives</title>
- <para>Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/export_archive.gif" format="gif"/>
- </imageobject>
- icon displays the export archive dialog window.
+ <para>Clicking on the "Export Folder" action, displays the export archive dialog window.
</para>
<imageobject>
<imagedata fileref="images/admincms/ss_exportarchive.gif" format="gif" align="center" valign="middle"/>
@@ -412,11 +298,7 @@
<imagedata fileref="images/admincms/ss_editfile.gif" format="gif" align="center" valign="middle"/>
</imageobject>
</mediaobject>
- Clicking on the
- <imageobject>
- <imagedata fileref="images/admincms/edit.gif" format="gif"/>
- </imageobject>
- icon displays the edit file dialog window with the embedded WYSIWYG editor
+ Clicking on the "text/html"link, displays the edit file dialog window with the embedded WYSIWYG editor
and directory browser.
</para>
<imageobject>
@@ -436,7 +318,12 @@
</para>
<para>A user may specify at this point if he would like to make the new edit "live", or
available in production. Additionally, a user can set a title for the file that will be used
- as the portlet window title.</para>
+ as the portlet window title.
+ </para>
</sect2>
+ <sect2 id="secure">
+ <title>Securing Resources</title>
+ <para>TODO</para>
+ </sect2>
</sect1>
- </chapter>
+</chapter>
19 years, 6 months
JBoss Portal SVN: r5765 - docs/trunk/userGuide/en/images/admincms
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-05 13:54:26 -0500 (Tue, 05 Dec 2006)
New Revision: 5765
Added:
docs/trunk/userGuide/en/images/admincms/actions_menu.gif
Removed:
docs/trunk/userGuide/en/images/admincms/accessing.gif
docs/trunk/userGuide/en/images/admincms/binaryfile.gif
docs/trunk/userGuide/en/images/admincms/copy.gif
docs/trunk/userGuide/en/images/admincms/createfile.gif
docs/trunk/userGuide/en/images/admincms/createfolder.gif
docs/trunk/userGuide/en/images/admincms/delete.gif
docs/trunk/userGuide/en/images/admincms/edit.gif
docs/trunk/userGuide/en/images/admincms/export_archive.gif
docs/trunk/userGuide/en/images/admincms/move.gif
docs/trunk/userGuide/en/images/admincms/upload.gif
docs/trunk/userGuide/en/images/admincms/upload_archive.gif
docs/trunk/userGuide/en/images/admincms/view.gif
Modified:
docs/trunk/userGuide/en/images/admincms/cms_adminpage.gif
docs/trunk/userGuide/en/images/admincms/createdirectory.gif
docs/trunk/userGuide/en/images/admincms/createhtml.gif
docs/trunk/userGuide/en/images/admincms/editfile.gif
docs/trunk/userGuide/en/images/admincms/fileproperties.gif
docs/trunk/userGuide/en/images/admincms/resourcecopy.gif
docs/trunk/userGuide/en/images/admincms/resourcedelete.gif
docs/trunk/userGuide/en/images/admincms/resourcemove.gif
docs/trunk/userGuide/en/images/admincms/resourceupload.gif
docs/trunk/userGuide/en/images/admincms/resourceuploadarchive.gif
docs/trunk/userGuide/en/images/admincms/ss_editfile.gif
docs/trunk/userGuide/en/images/admincms/ss_exportarchive.gif
docs/trunk/userGuide/en/images/admincms/ss_viewfile.gif
Log:
JBPORTAL-1113 - cmsadmin chapter redone.
Deleted: docs/trunk/userGuide/en/images/admincms/accessing.gif
===================================================================
(Binary files differ)
Added: docs/trunk/userGuide/en/images/admincms/actions_menu.gif
===================================================================
(Binary files differ)
Property changes on: docs/trunk/userGuide/en/images/admincms/actions_menu.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: docs/trunk/userGuide/en/images/admincms/binaryfile.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/cms_adminpage.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/copy.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/createdirectory.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/createfile.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/createfolder.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/createhtml.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/delete.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/edit.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/editfile.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/export_archive.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/fileproperties.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/move.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/resourcecopy.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/resourcedelete.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/resourcemove.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/resourceupload.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/resourceuploadarchive.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/ss_editfile.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/ss_exportarchive.gif
===================================================================
(Binary files differ)
Modified: docs/trunk/userGuide/en/images/admincms/ss_viewfile.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/upload.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/upload_archive.gif
===================================================================
(Binary files differ)
Deleted: docs/trunk/userGuide/en/images/admincms/view.gif
===================================================================
(Binary files differ)
19 years, 6 months
JBoss Portal SVN: r5764 - trunk/core
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-05 12:42:02 -0500 (Tue, 05 Dec 2006)
New Revision: 5764
Modified:
trunk/core/build.xml
Log:
run all tests in core (was commented because of me in previous commit)
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-12-05 17:36:47 UTC (rev 5763)
+++ trunk/core/build.xml 2006-12-05 17:42:02 UTC (rev 5764)
@@ -568,7 +568,6 @@
</x-sysproperty>
<x-test>
-<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
@@ -602,7 +601,6 @@
</zest>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
--->
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
</x-test>
19 years, 6 months
JBoss Portal SVN: r5763 - in trunk: common/src/main/org/jboss/portal/common/text core core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/aspects/controller/node core/src/main/org/jboss/portal/core/cms core/src/main/org/jboss/portal/core/controller/ajax core/src/main/org/jboss/portal/core/controller/classic core/src/main/org/jboss/portal/core/deployment/jboss core/src/main/org/jboss/portal/core/impl/model/portal core/src/main/org/jboss/portal/core/meta
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-05 12:36:47 -0500 (Tue, 05 Dec 2006)
New Revision: 5763
Added:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
Modified:
trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/metadata/PortalObjectMetaData.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/WindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/AddPageAction.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java
trunk/security/src/main/org/jboss/portal/security/PortalPermission.java
trunk/security/src/main/org/jboss/portal/security/spi/provider/PermissionRepository.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java
trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/WindowLocation.java
trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java
Log:
structure portal object ids
Modified: trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/common/src/main/org/jboss/portal/common/text/FastURLEncoder.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -73,7 +73,7 @@
}
}
- public String encode(String s) throws UnsupportedEncodingException, IllegalArgumentException
+ public String encode(String s) throws IllegalArgumentException
{
StringBuffer tmp = new StringBuffer();
encode(s, tmp);
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/build.xml 2006-12-05 17:36:47 UTC (rev 5763)
@@ -556,10 +556,8 @@
<execute-tests>
<x-sysproperty>
-<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
--->
<sysproperty
key="jboss.aop.path"
@@ -570,6 +568,7 @@
</x-sysproperty>
<x-test>
+<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
@@ -603,6 +602,7 @@
</zest>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
+-->
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPermissionTestCase"/>
</x-test>
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-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -37,6 +37,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.identity.User;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
@@ -161,13 +162,13 @@
String label;
if (dashboard)
{
- RenderPageCommand _rpc = new RenderPageCommand("default.default");
+ RenderPageCommand _rpc = new RenderPageCommand(new PortalObjectId(new String[]{"default","default"}));
pageURL = cc.getControllerContext().renderURL(_rpc, null, null);
label = "Pages";
}
else
{
- ViewDashboardCommand vdc = new ViewDashboardCommand("dashboard");
+ ViewDashboardCommand vdc = new ViewDashboardCommand(new PortalObjectId(new String[]{"dashboard"}));
pageURL = cc.getControllerContext().renderURL(vdc, null, null);
label = "My Dashboard";
}
@@ -187,17 +188,17 @@
if (admin)
{
- RenderPageCommand showDefault = new RenderPageCommand("default");
+ RenderPageCommand showDefault = new RenderPageCommand(new PortalObjectId(new String[]{"default"}));
showDefaultURL = cc.getControllerContext().renderURL(showDefault, null, null);
}
else
{
- PortalObjectPermission perm = new PortalObjectPermission("admin", PortalObjectPermission.VIEW_MASK);
+ PortalObjectPermission perm = new PortalObjectPermission(new PortalObjectId(new String[]{"admin"}), PortalObjectPermission.VIEW_MASK);
try
{
if (cc.getControllerContext().getController().getPortalAuthorizationManagerFactory().getManager().checkPermission(perm))
{
- RenderPageCommand showadmin = new RenderPageCommand("admin");
+ RenderPageCommand showadmin = new RenderPageCommand(new PortalObjectId(new String[]{"admin"}));
showadminURL = cc.getControllerContext().renderURL(showadmin, null, null);
}
}
@@ -298,7 +299,7 @@
{
}
- String id = navElement.getId();
+ PortalObjectId id = navElement.getId();
PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
if (portalAuthorizationManagerFactory.getManager().checkPermission(perm))
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -39,6 +39,7 @@
import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.command.WindowCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.portlet.Parameters;
@@ -97,7 +98,7 @@
//
PortalObjectNode nextNode = (PortalObjectNode)we.getNode();
- String nodeRef = nextNode.getRef();
+ PortalObjectId nodeRef = nextNode.getObjectId();
Mode mode = we.getMode();
WindowState windowState = we.getWindowState();
if (nextEvent instanceof WindowActionEvent)
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -30,6 +30,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -57,9 +58,9 @@
switch (node.getType())
{
case PortalNode.TYPE_WINDOW:
- return new WindowURL(node.getRef(), controllerContext);
+ return new WindowURL(node.getObjectId(), controllerContext);
case PortalNode.TYPE_PAGE:
- return new PageURL(node.getRef(), controllerContext);
+ return new PageURL(node.getObjectId(), controllerContext);
case PortalNode.TYPE_PORTAL:
return null;
case PortalNode.TYPE_CONTEXT:
@@ -71,16 +72,16 @@
private static class AbstractPortalNodeURL implements PortalNodeURL
{
- protected String handle;
+ protected PortalObjectId id;
protected ControllerContext controllerContext;
protected ParametersStateString parameters;
protected Boolean wantSecure;
protected Boolean wantAuthenticated;
protected boolean relative;
- public AbstractPortalNodeURL(String handle, ControllerContext controllerContext)
+ public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
{
- this.handle = handle;
+ this.id = id;
this.controllerContext = controllerContext;
this.relative = true;
this.parameters = new ParametersStateString();
@@ -121,14 +122,14 @@
private static class WindowURL extends AbstractPortalNodeURL
{
- public WindowURL(String handle, ControllerContext controllerContext)
+ public WindowURL(PortalObjectId id, ControllerContext controllerContext)
{
- super(handle, controllerContext);
+ super(id, controllerContext);
}
public String toString()
{
- InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(handle, null, null, parameters);
+ InvokePortletWindowRenderCommand cmd = new InvokePortletWindowRenderCommand(id, null, null, parameters);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
@@ -137,14 +138,14 @@
private static class PageURL extends AbstractPortalNodeURL
{
- public PageURL(String handle, ControllerContext controllerContext)
+ public PageURL(PortalObjectId id, ControllerContext controllerContext)
{
- super(handle, controllerContext);
+ super(id, controllerContext);
}
public String toString()
{
- RenderPageCommand cmd = new RenderPageCommand(handle);
+ RenderPageCommand cmd = new RenderPageCommand(id);
URLContext urlContext = getURLContext();
return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(relative, true));
}
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalObjectNode.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.common.path.RelativePathParser;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import java.util.Collection;
import java.util.Collections;
@@ -182,7 +183,7 @@
//
- public String getRef()
+ public PortalObjectId getObjectId()
{
return object.getId();
}
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -30,6 +30,7 @@
import org.jboss.portal.cms.model.File;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.server.ServerInvocation;
@@ -50,6 +51,9 @@
/** . */
protected String targetWindowRef;
+ /** . */
+ protected PortalObjectId targetWindowId;
+
public CMS getCMSService()
{
return CMSService;
@@ -70,6 +74,24 @@
this.targetWindowRef = targetWindowRef;
}
+
+ protected void startService() throws Exception
+ {
+ targetWindowId = PortalObjectId.parse(targetWindowRef, PortalObjectId.LEGACY_FORMAT);
+
+ //
+ super.startService();
+ }
+
+
+ protected void stopService() throws Exception
+ {
+ super.stopService();
+
+ //
+ targetWindowId = null;
+ }
+
public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
{
try
@@ -119,7 +141,7 @@
parameters.setValue("path", portalRequestPath);
// Perform a render URL on the target window
- return new InvokePortletWindowRenderCommand(targetWindowRef, Mode.VIEW, null, parameters);
+ return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, null, parameters);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -27,6 +27,7 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.Controller;
import org.jboss.portal.core.model.portal.command.MoveWindowCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
@@ -52,7 +53,11 @@
String toRegion = req.getParameter("toRegion");
int fromPosInt = Integer.parseInt(fromPos);
int toPosInt = Integer.parseInt(toPos);
- ControllerCommand cmd = new MoveWindowCommand(windowId, fromPosInt, fromRegion, toPosInt, toRegion);
+
+ //
+ PortalObjectId tmp = PortalObjectId.parse(windowId, PortalObjectId.CANONICAL_FORMAT);
+
+ ControllerCommand cmd = new MoveWindowCommand(tmp, fromPosInt, fromRegion, toPosInt, toRegion);
ControllerContext controllerContext = new ControllerContext(invocation, this);
try
{
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 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -32,6 +32,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.command.RenderPageCommand;
import javax.servlet.ServletException;
@@ -47,7 +48,7 @@
public class ClassicResponseHandler extends AbstractResponseHandler
{
- private String defaultPortalPath = "default";
+ private PortalObjectId defaultPortalPath = PortalObjectId.parse("/default", PortalObjectId.CANONICAL_FORMAT);
public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeployment.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -30,6 +30,7 @@
import org.jboss.portal.core.metadata.PortalObjectMetaData;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.portal.server.deployment.jboss.Deployment;
import org.w3c.dom.Document;
@@ -117,7 +118,7 @@
//
Element parentRefElt = XML.getUniqueChild(deploymentElt, "parent-ref", false);
- unit.parentRef = parentRefElt == null ? null : XML.asString(parentRefElt);
+ unit.parentRef = parentRefElt == null ? null : PortalObjectId.parse(XML.asString(parentRefElt), PortalObjectId.LEGACY_FORMAT);
//
Element ifExistsElt = XML.getUniqueChild(deploymentElt, "if-exists", false);
@@ -240,52 +241,8 @@
public void stop() throws DeploymentException
{
- // clean out policies and permissions
-// for (int i = 0; i < units.length; i++)
-// {
-// try
-// {
-// factory.getPortalPolicyConfig().removeConstraints(units[i].ref);
-// }
-// catch (PortalPolicyConfigException e)
-// {
-// e.printStackTrace();
-// }
-// }
-
-// for (int i = 0; i < units.length; i++)
-// {
-// Unit unit = units[i];
-// if (unit.handle != null)
-// {
-// if (unit.metaData instanceof PortalObjectMetaData)
-// {
-// try
-// {
-// PortalObject parent = (PortalObject)factory.getPortalObjectContainer().lookup(unit.parentRef);
-// parent.destroyChild(((PortalObjectMetaData)unit.metaData).getName());
-// }
-// catch (NoSuchPortalObjectException e)
-// {
-// e.printStackTrace();
-// }
-// }
-// else if (unit.metaData instanceof InstanceMetaData)
-// {
-// try
-// {
-// factory.getInstanceContainer().destroyInstance(((InstanceMetaData)unit.metaData).getId());
-// }
-// catch (NoSuchInstanceException e)
-// {
-// e.printStackTrace();
-// }
-// }
-// }
-// }
}
-
/**
* Return factory
*
@@ -303,13 +260,13 @@
protected int ifExists;
/** The parent ref. */
- protected String parentRef;
+ protected PortalObjectId parentRef;
/** Meta data of the deployed portal object. */
protected MetaData metaData;
/** The handle of the deployed object if not null. */
- protected String ref;
+ protected PortalObjectId ref;
public String toString()
{
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.security.PortalPermission;
import org.jboss.portal.security.PortalPermissionCollection;
@@ -50,24 +51,12 @@
implements PortalObjectContainer, PermissionFactory, AuthorizationDomain, DomainConfigurator, PermissionRepository
{
- public PortalObject getObject(String id)
- {
- ObjectNode node = getObjectNode(id);
+ /** . */
+ private PortalObjectIdImpl rootId = new PortalObjectIdImpl();
- //
- if (node != null)
- {
- return node.getObject();
- }
- else
- {
- return null;
- }
- }
-
public PortalObject getRootObject()
{
- return getObject("");
+ return getObject(rootId);
}
public String getType()
@@ -97,22 +86,44 @@
public PortalPermission createPermission(String uri, String action) throws PortalSecurityException
{
- return new PortalObjectPermission(uri, action);
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ return new PortalObjectPermission(id, action);
}
public PortalPermission createPermission(String uri, Collection actions) throws PortalSecurityException
{
- return new PortalObjectPermission(uri, actions);
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ return new PortalObjectPermission(id, actions);
}
- protected abstract ObjectNode getObjectNode(String id);
+ public PortalObject getObject(PortalObjectId id) throws IllegalArgumentException
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No null id accepted " + id);
+ }
+ ObjectNode node;
+ if (id instanceof PortalObjectIdImpl)
+ {
+ node = getObjectNode((PortalObjectIdImpl)id);
+ }
+ else
+ {
+ PortalObjectIdImpl poid = new PortalObjectIdImpl(id);
+ node = getObjectNode(poid);
+ }
+ return node == null ? null : node.getObject();
+ }
+ protected abstract ObjectNode getObjectNode(PortalObjectIdImpl id);
+
public PortalPermission getPermission(String roleName, String uri) throws PortalSecurityException
{
- ObjectNode objectNode = getObjectNode(uri);
- if (objectNode != null)
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ ObjectNode on = getObjectNode(id);
+ if (on != null)
{
- for (Iterator i = objectNode.getBindings().iterator(); i.hasNext();)
+ for (Iterator i = on.getBindings().iterator(); i.hasNext();)
{
RoleSecurityBinding binding = (RoleSecurityBinding)i.next();
String constraintRoleName = binding.getRoleName();
@@ -127,7 +138,8 @@
public void removeSecurityBindings(String uri) throws SecurityConfigurationException
{
- ObjectNode on = getObjectNode(uri);
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ ObjectNode on = getObjectNode(id);
if (on == null)
{
throw new SecurityConfigurationException("The object should exist prior its security is configured : fixme");
@@ -137,7 +149,8 @@
public void setSecurityBindings(String uri, Set securityBindings) throws SecurityConfigurationException
{
- ObjectNode on = getObjectNode(uri);
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ ObjectNode on = getObjectNode(id);
if (on == null)
{
throw new SecurityConfigurationException("The object should exist prior its security is configured : fixme");
@@ -147,7 +160,8 @@
public Set getSecurityBindings(String uri)
{
- ObjectNode on = getObjectNode(uri);
+ PortalObjectIdImpl id = new PortalObjectIdImpl(PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT));
+ ObjectNode on = getObjectNode(id);
if (on != null)
{
return on.getBindings();
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -246,9 +246,10 @@
}
}
- protected ObjectNode getObjectNode(String uri)
+
+ protected ObjectNode getObjectNode(PortalObjectIdImpl id)
{
- return getObjectNode(sessionFactory.getCurrentSession(), uri);
+ return getObjectNode(sessionFactory.getCurrentSession(), id.internalId);
}
private ObjectNode getObjectNodeNoCache(Session session, String path)
Added: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdImpl.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectIdImpl.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.model.portal;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
+/**
+ * A convenient subclass.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalObjectIdImpl extends PortalObjectId
+{
+
+ /** . */
+ final String internalId;
+
+ /** . */
+ String canonicalString;
+
+ PortalObjectIdImpl()
+ {
+ super(new String[0]);
+ internalId = "";
+ }
+
+ PortalObjectIdImpl(PortalObjectId that)
+ {
+ super(that);
+
+ //
+ this.internalId = LEGACY_FORMAT.toString(that);
+ }
+
+ PortalObjectIdImpl(String[] names)
+ {
+ super(names);
+
+ //
+ this.internalId = LEGACY_FORMAT.toString(names);
+ }
+
+ PortalObjectIdImpl(PortalObjectImpl object)
+ {
+ super(object.getObjectNode().getPath(), LEGACY_FORMAT);
+
+ //
+ this.internalId = object.getObjectNode().getPath();
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -26,7 +26,7 @@
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import java.util.ArrayList;
import java.util.Collection;
@@ -63,6 +63,7 @@
protected Collection collection;
protected Map properties;
+ protected PortalObjectIdImpl id;
public PortalObjectImpl()
{
@@ -102,14 +103,19 @@
//
- public void destroyChild(String name) throws NoSuchPortalObjectException
+
+ public PortalObjectId getId()
{
- objectNode.removeChild(name);
+ if (id == null)
+ {
+ id = new PortalObjectIdImpl(this);
+ }
+ return id;
}
- public String getId()
+ public void destroyChild(String name) throws NoSuchPortalObjectException
{
- return objectNode.getPath();
+ objectNode.removeChild(name);
}
public String getName()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -25,6 +25,8 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import java.util.Iterator;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -85,28 +87,16 @@
throw new IllegalStateException("Unimplemented");
}
- protected ObjectNode getObjectNode(String id)
+ protected ObjectNode getObjectNode(PortalObjectIdImpl id)
{
ObjectNode node = root;
- int prev = 0;
- int index = id.indexOf('.');
-
- //
- while (node != null && index != -1)
+ for (Iterator i = id.names();node != null && i.hasNext();)
{
- String name = id.substring(prev, index);
+ String name = (String)i.next();
node = (ObjectNode)node.getChildren().get(name);
- prev = index + 1;
- index = id.indexOf('.', index + 1);
}
//
- if (node != null && prev < id.length())
- {
- node = (ObjectNode)node.getChildren().get(id.substring(prev));
- }
-
- //
return node;
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/PortalObjectMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/PortalObjectMetaData.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/PortalObjectMetaData.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.metadata.SecurityConstraintsMetaData;
@@ -164,7 +165,7 @@
// Apply the constraint
PortalObjectContainer poc = buildContext.getContainer();
DomainConfigurator domainConfigurator = poc.getAuthorizationDomain().getConfigurator();
- domainConfigurator.setSecurityBindings(object.getId(), securityConstraints.getConstraints());
+ domainConfigurator.setSecurityBindings(object.getId().toString(PortalObjectId.CANONICAL_FORMAT), securityConstraints.getConstraints());
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -37,6 +37,9 @@
/** . */
private String dashboardId;
+ /** . */
+ private PortalObjectId objectId;
+
public String getDashboardId()
{
return dashboardId;
@@ -47,8 +50,26 @@
this.dashboardId = dashboardId;
}
+
+ protected void createService() throws Exception
+ {
+ super.createService();
+
+ //
+ objectId = PortalObjectId.parse(dashboardId, PortalObjectId.LEGACY_FORMAT);
+ }
+
+
+ protected void destroyService() throws Exception
+ {
+ objectId = null;
+
+ //
+ super.destroyService();
+ }
+
public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
{
- return new ViewDashboardCommand(dashboardId);
+ return new ViewDashboardCommand(objectId);
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -37,7 +37,7 @@
public class DefaultPortalCommandFactory extends AbstractCommandFactory
{
- private String defaultPortalPath = "default";
+ private PortalObjectId defaultPortalPath = PortalObjectId.parse("/default", PortalObjectId.CANONICAL_FORMAT);
private CommandFactory nextFactory;
@@ -78,8 +78,8 @@
{
throw new IllegalStateException("Default page does not exist");
}
- String handle = page.getId();
- cmd = new RenderPageCommand(handle);
+ PortalObjectId id = page.getId();
+ cmd = new RenderPageCommand(id);
}
return cmd;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -57,7 +57,7 @@
*
* @return the object id
*/
- String getId();
+ PortalObjectId getId();
/**
* Returns the type of the object which is a value that discriminates the object type.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -90,7 +90,7 @@
}
//
- Object target = null;
+ Object target;
if (portalRequestPath.length() == 0)
{
target = container.getRootObject();
@@ -163,8 +163,8 @@
if (target instanceof Page)
{
Page page = (Page)target;
- String handle = page.getId();
- cmd = new RenderPageCommand(handle);
+ PortalObjectId id = page.getId();
+ cmd = new RenderPageCommand(id);
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -38,7 +38,7 @@
* @return the specified portal object
* @throws IllegalArgumentException if the id is null
*/
- PortalObject getObject(String id) throws IllegalArgumentException;
+ PortalObject getObject(PortalObjectId id) throws IllegalArgumentException;
/**
* Return the root object of this container.
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectId.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -0,0 +1,309 @@
+/******************************************************************************
+ * 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.model.portal;
+
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalObjectId implements Comparable
+{
+
+ /** . */
+ private final String[] names;
+
+ /** . */
+ private Integer hashCode;
+
+ public PortalObjectId(PortalObjectId that)
+ {
+ this.names = that.names;
+ this.hashCode = that.hashCode;
+ }
+
+ public PortalObjectId(String[] names)
+ {
+ this.names = names;
+ }
+
+ public PortalObjectId(String value, Format format)
+ {
+ this.names = format.parse(value);
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PortalObjectId)
+ {
+ PortalObjectId that = (PortalObjectId)obj;
+ String[] thatNames = that.names;
+ String[] thisNames = this.names;
+
+ //
+ if (thatNames.length != thisNames.length)
+ {
+ return false;
+ }
+
+ //
+ for (int i = thisNames.length - 1;i >= 0;i--)
+ {
+ if (thisNames[i].equals(thatNames[i]) == false)
+ {
+ return false;
+ }
+ }
+
+ //
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ if (hashCode == null)
+ {
+ int value = 0;
+ for (int i = names.length - 1;i >= 0;i--)
+ {
+ value = value * 41 + names[i].hashCode();
+ }
+ hashCode = new Integer(value);
+ }
+ return hashCode.intValue();
+ }
+
+ public int compareTo(Object o)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public Iterator names()
+ {
+ return Tools.iterator(names);
+ }
+
+ public String toString()
+ {
+ return CANONICAL_FORMAT.toString(names);
+ }
+
+ public String toString(Format format)
+ {
+ if (format == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return format.toString(names);
+ }
+
+ public static PortalObjectId parse(String value, Format format)
+ {
+ if (format == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ String[] names = format.parse(value);
+ return new PortalObjectId(names);
+ }
+
+ public abstract static class Format
+ {
+ /**
+ *
+ * @param value
+ * @return
+ */
+ public abstract String[] parse(String value);
+
+ /**
+ *
+ * @param names
+ * @return
+ */
+ public abstract String toString(String[] names);
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public final String toString(PortalObjectId id)
+ {
+ return toString(id.names);
+ }
+ }
+
+ public static final Format CANONICAL_FORMAT = new Format()
+ {
+ public String[] parse(String value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Null value not accepted");
+ }
+ if (value.length() == 0 || value.charAt(0) != '/')
+ {
+ throw new IllegalArgumentException("Not a canonical value " + value);
+ }
+ if (value.length() == 1)
+ {
+ return new String[0];
+ }
+
+ //
+ int length = 1;
+ int previous = 1;
+ while (true)
+ {
+ int next = value.indexOf('/', previous);
+ if (next == -1)
+ {
+ break;
+ }
+ length++;
+ previous = next + 1;
+ }
+
+ //
+ String[] names = new String[length];
+ length = 0;
+ previous = 1;
+ while (true)
+ {
+ int next = value.indexOf('/', previous);
+ if (next == -1)
+ {
+ break;
+ }
+ names[length++] = value.substring(previous, next);
+ previous = next + 1;
+ }
+ names[length] = value.substring(previous);
+
+ //
+ return names;
+ }
+
+ public String toString(String[] names)
+ {
+ if (names == null)
+ {
+ throw new IllegalArgumentException("Null string array not accepted");
+ }
+ if (names.length == 0)
+ {
+ return "/";
+ }
+ else
+ {
+ StringBuffer tmp = new StringBuffer(names.length * 10);
+ for (int i = 0;i < names.length;i++)
+ {
+ String name = names[i];
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name expected in the name string array");
+ }
+ tmp.append('/').append(name);
+ }
+ return tmp.toString();
+ }
+ }
+ };
+
+ public static final Format LEGACY_FORMAT = new Format()
+ {
+
+ private final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ public String[] parse(String value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ if (value.length() == 0)
+ {
+ return EMPTY_STRING_ARRAY;
+ }
+
+ // Count the number of names
+ int length = 1;
+ for (int next = value.indexOf('.');next != -1;next = value.indexOf('.', next + 1))
+ {
+ length++;
+ }
+
+ //
+ String[] names = new String[length];
+ length = 0;
+ int previous = 0;
+ for (int next = value.indexOf('.');next != -1;previous = next + 1, next = value.indexOf('.', next + 1))
+ {
+ names[length++] = value.substring(previous, next);
+ }
+ names[length] = value.substring(previous);
+
+ //
+ return names;
+ }
+
+ public String toString(String[] names)
+ {
+ if (names == null)
+ {
+ throw new IllegalArgumentException("Null string array not accepted");
+ }
+ if (names.length == 0)
+ {
+ return "";
+ }
+ StringBuffer buffer = new StringBuffer(names.length * 8);
+ for (int i = 0;i < names.length;i++)
+ {
+ if (i > 0)
+ {
+ buffer.append('.');
+ }
+ String name = names[i];
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name expected in the name string array");
+ }
+ buffer.append(name);
+ }
+ return buffer.toString();
+ }
+ };
+}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPermission.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -100,9 +100,9 @@
super("portalobjectpermission", collection);
}
- public PortalObjectPermission(String uri, Collection actions)
+ public PortalObjectPermission(PortalObjectId id, Collection actions)
{
- super("portalobjectpermission", uri);
+ super("portalobjectpermission", id.toString(PortalObjectId.CANONICAL_FORMAT));
//
if (actions == null)
@@ -121,9 +121,9 @@
mask |= recursiveMask;
}
- public PortalObjectPermission(String uri, String actions)
+ public PortalObjectPermission(PortalObjectId id, String actions)
{
- super("portalobjectpermission", uri);
+ super("portalobjectpermission", id.toString(PortalObjectId.CANONICAL_FORMAT));
if (actions == null)
{
throw new IllegalArgumentException("Actions agurment cannot be null");
@@ -141,16 +141,16 @@
mask |= recursiveMask;
}
- public PortalObjectPermission(String uri, int mask, int recursiveMask)
+ public PortalObjectPermission(PortalObjectId id, int mask, int recursiveMask)
{
- super("portalobjectpermission", uri);
+ super("portalobjectpermission", id.toString(PortalObjectId.CANONICAL_FORMAT));
this.mask = mask | recursiveMask;
this.recursiveMask = recursiveMask;
}
- public PortalObjectPermission(String uri, int mask)
+ public PortalObjectPermission(PortalObjectId id, int mask)
{
- super("portalobjectpermission", uri);
+ super("portalobjectpermission", id.toString(PortalObjectId.CANONICAL_FORMAT));
this.mask = mask;
this.recursiveMask = 0;
}
@@ -213,17 +213,22 @@
}
// Do we have terminated our job ?
- if (uri.length() == 0)
+ if (uri.length() == 1)
{
break;
}
// Get the parent uri
- int index = uri.lastIndexOf('.');
+ int index = uri.lastIndexOf('/');
if (index == -1)
{
- uri = "";
+ // Should not happen if the URI is well formed
+ return false;
}
+ else if (index == 0)
+ {
+ uri = "/";
+ }
else
{
uri = uri.substring(0, index);
@@ -259,21 +264,37 @@
UserPrincipal user = (UserPrincipal)i.next();
String userName = user.getName();
+ // The index of the expected '/' in that.uri
+ int index = this.uri.length();
+
//
- int a = this.uri.length();
- if (a > 0)
+ if (index == 1)
{
- a++;
+ index = 0;
}
- if (a < that.uri.length())
+
+ // We must have (this.uri + '/' + userName) a prefix
+ // of that.uri
+ if (that.uri.length() > index)
{
- int b = that.uri.indexOf('.', a);
- if (b == -1)
+ // No '/' means not good
+ if (that.uri.charAt(index) == '/')
{
- b = that.uri.length();
+ // Get the index of where to extract the name to make the comparison
+ int from = index + 1;
+ int to = that.uri.indexOf('/', from);
+ if (to == -1)
+ {
+ to = that.uri.length();
+ }
+
+ //
+ String name = that.uri.substring(from, to);
+ if (name.equals(userName))
+ {
+ return true;
+ }
}
- String name = that.uri.substring(a, b);
- return name.equals(userName);
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.model.portal.command.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.InvokeWindowCommand;
@@ -38,6 +38,8 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
+import java.util.Iterator;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -45,6 +47,9 @@
public class PortalObjectURLFactory extends URLFactoryDelegate
{
+ /** The fast url encoder. */
+ private static final FastURLEncoder urlEncoder = FastURLEncoder.create("UTF8", 0, 1024);
+
/** . */
private String path;
@@ -71,8 +76,8 @@
if (cmd instanceof RenderPageCommand)
{
RenderPageCommand rpCmd = (RenderPageCommand)cmd;
- String pageRef = rpCmd.getTargetId();
- return getBaseURL(pageRef);
+ PortalObjectId pageId = rpCmd.getTargetId();
+ return getBaseURL(pageId);
}
else if (cmd instanceof InvokeWindowCommand)
{
@@ -106,7 +111,7 @@
return null;
}
- private AbstractServerURL getBaseURL(String objectRef)
+ private AbstractServerURL getBaseURL(PortalObjectId objectRef)
{
//
StringBuffer buffer = new StringBuffer();
@@ -114,23 +119,16 @@
//
if (path != null && path.length() > 0)
{
- buffer.append(path).append('/');
+ buffer.append(path);
}
// escape spaces
- objectRef = Tools.replace(objectRef, " ", "%20");
-
- //
- char[] chars = objectRef.toCharArray();
- for (int i = 0; i < chars.length; i++)
+ for (Iterator i = objectRef.names();i.hasNext();)
{
- char c = chars[i];
- if (c == '.')
- {
- chars[i] = '/';
- }
+ String name = (String)i.next();
+ name = urlEncoder.encode(name);
+ buffer.append('/').append(name);
}
- buffer.append(chars, 0, chars.length);
//
AbstractServerURL asu = new AbstractServerURL();
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Parameters;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -61,7 +62,7 @@
private Parameters formParameters;
public InvokePortletWindowActionCommand(
- String windowId,
+ PortalObjectId windowId,
Mode mode,
WindowState windowState,
StateString navigationalState,
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowRenderCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.model.portal.command.response.UpdateWindowMarkupResponse;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
@@ -45,18 +46,18 @@
protected final StateString navigationalState;
public InvokePortletWindowRenderCommand(
- String windowRef,
+ PortalObjectId windowId,
Mode mode,
WindowState windowState,
StateString navigationalState)
throws IllegalArgumentException
{
- super(windowRef, mode, windowState);
+ super(windowId, mode, windowState);
this.navigationalState = navigationalState;
}
public InvokePortletWindowRenderCommand(
- String windowId,
+ PortalObjectId windowId,
Mode mode,
WindowState windowState)
throws IllegalArgumentException
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokeWindowCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.core.model.portal.command.WindowCommand;
+import org.jboss.portal.core.model.portal.PortalObjectId;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -39,7 +40,7 @@
/** . */
protected final WindowState windowState;
- public InvokeWindowCommand(String windowId, Mode mode, WindowState windowState) throws IllegalArgumentException
+ public InvokeWindowCommand(PortalObjectId windowId, Mode mode, WindowState windowState) throws IllegalArgumentException
{
super(windowId);
this.mode = mode;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/MoveWindowCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -27,6 +27,7 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.theme.ThemeConstants;
import java.util.Iterator;
@@ -53,10 +54,10 @@
/** . */
private String toRegion;
- public MoveWindowCommand(String windowRef, int fromPos, String fromRegion, int toPos, String toRegion)
+ public MoveWindowCommand(PortalObjectId windowId, int fromPos, String fromRegion, int toPos, String toRegion)
throws IllegalArgumentException
{
- super(windowRef);
+ super(windowId);
this.fromPos = fromPos;
this.fromRegion = fromRegion;
this.toPos = toPos;
@@ -105,7 +106,7 @@
if (child.getType() == PortalObject.TYPE_WINDOW)
{
Window window = (Window)child;
- String windowId = window.getId();
+ PortalObjectId windowId = window.getId();
String regionId = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION);
String posAsString = window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER);
if (regionId != null && posAsString != null)
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/PageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/PageCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/PageCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObjectId;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,7 +41,7 @@
/** . */
protected Portal portal;
- public PageCommand(String pageId)
+ public PageCommand(PortalObjectId pageId)
{
super(pageId);
}
@@ -74,7 +75,7 @@
//
if (portal == null)
{
- throw new ResourceNotFoundException(targetId);
+ throw new ResourceNotFoundException(targetId.toString());
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -24,6 +24,7 @@
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObjectId;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -35,7 +36,7 @@
/** . */
protected Portal portal;
- public PortalCommand(String portalId)
+ public PortalCommand(PortalObjectId portalId)
{
super(portalId);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/PortalObjectCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.controller.ResourceNotFoundException;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.identity.User;
@@ -40,13 +41,13 @@
public abstract class PortalObjectCommand extends ControllerCommand
{
- protected final String targetId;
+ protected final PortalObjectId targetId;
protected PortalObject target;
private Boolean dashboard;
- protected PortalObjectCommand(String targetId)
+ protected PortalObjectCommand(PortalObjectId targetId)
{
if (targetId == null)
{
@@ -56,7 +57,7 @@
}
- public final String getTargetId()
+ public final PortalObjectId getTargetId()
{
return targetId;
}
@@ -68,7 +69,7 @@
if (target == null)
{
- throw new ResourceNotFoundException(targetId);
+ throw new ResourceNotFoundException(targetId.toString());
}
}
@@ -82,7 +83,7 @@
public void enforceSecurity(PortalAuthorizationManager pam) throws ControllerSecurityException, PortalSecurityException
{
PortalObject target = getTarget();
- String id = target.getId();
+ PortalObjectId id = target.getId();
PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
if (!pam.checkPermission(perm))
{
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -26,7 +26,6 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.Exceptions;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerSecurityException;
@@ -40,6 +39,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.ModeInfo;
@@ -47,7 +47,6 @@
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
-import org.jboss.portal.portlet.invocation.response.InsufficientTransportGuaranteeResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.security.PortalSecurityException;
@@ -145,7 +144,7 @@
*/
private boolean personalizable;
- public RenderPageCommand(String pageId)
+ public RenderPageCommand(PortalObjectId pageId)
{
super(pageId);
}
@@ -203,7 +202,7 @@
super.enforceSecurity(pam);
// Check if the user can personalize the page
- String uri = page.getId();
+ PortalObjectId uri = page.getId();
PortalObjectPermission perm = new PortalObjectPermission(uri, PortalObjectPermission.PERSONALIZE_MASK);
personalizable = pam.checkPermission(perm);
}
@@ -286,7 +285,7 @@
// Take care of maximized window HERE
for (Iterator i = pageResult.getWindowIds().iterator();i.hasNext();)
{
- String windowId = (String)i.next();
+ PortalObjectId windowId = (PortalObjectId)i.next();
WindowResult res = pageResult.getWindowResult(windowId);
if (WindowState.MAXIMIZED.equals(res.getWindowState()))
{
@@ -417,7 +416,7 @@
protected Object renderPortletWindow(ServerConfig cfg, Window window) throws ControllerException
{
// Execute render command
- String windowRef = window.getId();
+ PortalObjectId windowId = window.getId();
//
String windowTitle;
@@ -436,7 +435,7 @@
try
{
- RenderPortletWindowCommand renderCmd = new RenderPortletWindowCommand(windowRef);
+ RenderPortletWindowCommand renderCmd = new RenderPortletWindowCommand(windowId);
PortletResponse portletResponse = (PortletResponse)context.execute(renderCmd);
PortletInvocationResponse response = portletResponse.getResult();
@@ -507,12 +506,12 @@
else if (response instanceof ErrorResponse)
{
ErrorResponse errorResult = (ErrorResponse)response;
- String logMessage = "Rendering portlet window " + windowRef + " triggered the following error :";
+ String logMessage = "Rendering portlet window " + windowId + " triggered the following error :";
errorResult.logErrorTo(log, logMessage);
String property = cfg.getProperty(WINDOW_ERROR);
if (!HIDE.equals(property))
{
- windowTitle = "An error occured while rendering window '" + windowRef + "'";
+ windowTitle = "An error occured while rendering window '" + windowId + "'";
contentChars = errorResult.getMessage();
Throwable t = errorResult.getThrowable();
if (t != null && SHOW.equals(property))
@@ -537,7 +536,7 @@
else if (response instanceof InsufficientPrivilegesResponse)
{
// Julien : go to the section below, I know it is very ugly
- throw new ResourceAccessDeniedException(windowRef);
+ throw new ResourceAccessDeniedException(windowId.toString());
}
else
{
@@ -581,7 +580,7 @@
}
catch (Exception e)
{
- log.error("Rendering portlet window " + windowRef + " produced an internal error", e);
+ log.error("Rendering portlet window " + windowId + " produced an internal error", e);
String property = cfg.getProperty(WINDOW_INTERNAL_ERROR);
if (SHOW.equals(property))
{
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -30,6 +30,7 @@
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
@@ -49,9 +50,9 @@
/** . */
private static final CommandInfo info = new ViewCommandInfo(true, "view");
- public RenderPortletWindowCommand(String windowRef) throws IllegalArgumentException
+ public RenderPortletWindowCommand(PortalObjectId windowId) throws IllegalArgumentException
{
- super(windowRef);
+ super(windowId);
}
public CommandInfo getInfo()
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/ViewDashboardCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -31,6 +31,7 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
@@ -53,7 +54,7 @@
/** . */
private String userId;
- public ViewDashboardCommand(String portalId)
+ public ViewDashboardCommand(PortalObjectId portalId)
{
super(portalId);
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/WindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/WindowCommand.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/WindowCommand.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.identity.User;
@@ -54,7 +55,7 @@
/** The instance. */
protected Instance instance;
- public WindowCommand(String windowId) throws IllegalArgumentException
+ public WindowCommand(PortalObjectId windowId) throws IllegalArgumentException
{
super(windowId);
}
@@ -90,14 +91,14 @@
page = (Page)window.getParent();
if (page == null)
{
- throw new ResourceNotFoundException(targetId);
+ throw new ResourceNotFoundException(targetId.toString());
}
// Get hardcoded portal for now
portal = page.getPortal();
if (portal == null)
{
- throw new ResourceNotFoundException(targetId);
+ throw new ResourceNotFoundException(targetId.toString());
}
// We need the user id
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/PortletWindowResponse.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.model.portal.command.response;
import org.jboss.portal.core.controller.portlet.PortletResponse;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
/**
@@ -35,9 +36,9 @@
{
/** The window id targetting the portlet. */
- private String windowId;
+ private PortalObjectId windowId;
- public PortletWindowResponse(String windowId, PortletInvocationResponse response)
+ public PortletWindowResponse(PortalObjectId windowId, PortletInvocationResponse response)
{
super(response);
@@ -51,7 +52,7 @@
this.windowId = windowId;
}
- public String getWindowId()
+ public PortalObjectId getWindowId()
{
return windowId;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateViewResponse.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.command.response;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -30,9 +32,9 @@
{
/** . */
- private String pageId;
+ private PortalObjectId pageId;
- public UpdateViewResponse(String pageId)
+ public UpdateViewResponse(PortalObjectId pageId)
{
if (pageId == null)
{
@@ -41,7 +43,7 @@
this.pageId = pageId;
}
- public String getPageId()
+ public PortalObjectId getPageId()
{
return pageId;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/response/UpdateWindowMarkupResponse.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.model.portal.command.response;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -30,9 +32,9 @@
{
/** . */
- private String windowId;
+ private PortalObjectId windowId;
- public UpdateWindowMarkupResponse(String windowId)
+ public UpdateWindowMarkupResponse(PortalObjectId windowId)
{
if (windowId == null)
{
@@ -41,7 +43,7 @@
this.windowId = windowId;
}
- public String getWindowId()
+ public PortalObjectId getWindowId()
{
return windowId;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -45,6 +46,6 @@
public String getId()
{
- return window.getId();
+ return window.getId().toString(PortalObjectId.CANONICAL_FORMAT);
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.ThemeConstants;
@@ -95,6 +96,8 @@
}
}
+ private PortalObjectId dashboardId = PortalObjectId.parse("/dashboard", PortalObjectId.CANONICAL_FORMAT);
+
protected void doView(JBossRenderRequest req, JBossRenderResponse resp)
throws PortletException, PortletSecurityException, IOException
{
@@ -109,11 +112,11 @@
if (req.getParameter("editPageSelect") != null)
{
String editPageSelect = req.getParameter("editPageSelect");
- page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPageSelect);
+ page = (Page)portalObjectContainer.getObject(dashboardId).getChild(editPageSelect);
}
else
{
- page = (Page)portalObjectContainer.getObject("dashboard").getChild(req.getUser().getUserName());
+ page = (Page)portalObjectContainer.getObject(dashboardId).getChild(req.getUser().getUserName());
}
List available_instances = (List)instanceContainer.getInstances();
@@ -190,7 +193,7 @@
String toRegion = actionRequest.getParameter("toRegion");
String[] copyInstance = actionRequest.getParameterValues("available_instances");
- Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
+ Page page = (Page)portalObjectContainer.getObject(dashboardId).getChild(editPage);
try
{
for (int i = 0; i < copyInstance.length; i++)
@@ -230,7 +233,7 @@
removeWindows = actionRequest.getParameterValues("right_instances");
}
- Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
+ Page page = (Page)portalObjectContainer.getObject(dashboardId).getChild(editPage);
try
{
for (int i = 0; i < removeWindows.length; i++)
@@ -261,7 +264,7 @@
moveWindows = actionRequest.getParameterValues("right_instances");
}
- Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
+ Page page = (Page)portalObjectContainer.getObject(dashboardId).getChild(editPage);
for (int i = 0; i < moveWindows.length; i++)
{
Window window = page.getWindow(moveWindows[i]);
@@ -280,7 +283,7 @@
{
String pageName = actionRequest.getParameter("pagename");
- Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(actionRequest.getUser().getUserName());
+ Page page = (Page)portalObjectContainer.getObject(dashboardId).getChild(actionRequest.getUser().getUserName());
PageContainer pageContainer = page.getPortal();
try
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import java.util.ArrayList;
import java.util.Collections;
@@ -140,7 +141,7 @@
public String getIdentifier()
{
- return object.getId();
+ return object.getId().toString(PortalObjectId.CANONICAL_FORMAT);
}
public void setIdentifier(String name)
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -39,6 +39,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.PropertyDef;
import org.jboss.portal.faces.el.TypeDef;
@@ -299,7 +300,8 @@
{
try
{
- result = portalObjectContainer.getObject(selectedId);
+ PortalObjectId id = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ result = portalObjectContainer.getObject(id);
}
catch (Exception e)
{
@@ -354,7 +356,8 @@
// Set the state from the id
if (id != null)
{
- PortalObject object = portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ PortalObject object = portalObjectContainer.getObject(poid);
//
if (object != null)
@@ -396,7 +399,8 @@
// Destroy the object
if (id != null)
{
- PortalObject object = portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ PortalObject object = portalObjectContainer.getObject(poid);
//
object.getParent().destroyChild(object.getName());
@@ -512,7 +516,8 @@
{
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String id = (String)pmap.get("id");
- Window target = (Window)portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
move(target, MOVE_UP);
}
catch (Exception e)
@@ -527,7 +532,8 @@
{
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String id = (String)pmap.get("id");
- Window target = (Window)portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
move(target, MOVE_DOWN);
}
catch (Exception e)
@@ -542,7 +548,8 @@
{
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String id = (String)pmap.get("id");
- Window target = (Window)portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
move(target, MOVE_RIGHT);
}
catch (Exception e)
@@ -557,7 +564,8 @@
{
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String id = (String)pmap.get("id");
- Window target = (Window)portalObjectContainer.getObject(id);
+ PortalObjectId poid = PortalObjectId.parse(selectedId, PortalObjectId.CANONICAL_FORMAT);
+ Window target = (Window)portalObjectContainer.getObject(poid);
move(target, MOVE_LEFT);
}
catch (Exception e)
@@ -849,7 +857,7 @@
PortalObject po = getSelectedObject();
if (po != null)
{
- return po.getId();
+ return po.getId().toString(PortalObjectId.CANONICAL_FORMAT);
}
else
{
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/AddPageAction.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/AddPageAction.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/AddPageAction.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PageContainer;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
@@ -111,7 +112,7 @@
Page page = pageContainer.createPage(pageName);
DomainConfigurator configurator = pomgr.getDomainConfigurator();
Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(page.getId(), constraints);
+ configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
}
catch (Exception e)
{
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.portlet.management.PortalObjectManagerBean;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
@@ -145,7 +146,7 @@
actions.add(PortalObjectPermission.PERSONALIZE_RECURSIVE_ACTION);
RoleSecurityBinding binding = new RoleSecurityBinding(actions, SecurityConstants.UNCHECKED_ROLE_NAME);
Set constraints = Collections.singleton(binding);
- configurator.setSecurityBindings(portal.getId(), constraints);
+ configurator.setSecurityBindings(portal.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
// We need to add initial layout sets to avoid problems...
portal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "generic");
@@ -166,7 +167,7 @@
// Create the default page
Page page = portal.createPage("default");
constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(page.getId(), constraints);
+ configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
portal.setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, page.getName());
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeManagerPortlet.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -400,7 +400,7 @@
if (current instanceof PortalObjectNode)
{
PortalObjectNode portalNode = (PortalObjectNode)current;
- PortalObject portal = container.getObject(portalNode.getRef());
+ PortalObject portal = container.getObject(portalNode.getObjectId());
portal.setDeclaredProperty(key, value);
if (log.isDebugEnabled())
{
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/theme/ThemeSelectorPortlet.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -169,7 +169,7 @@
if (current instanceof PortalObjectNode)
{
PortalObjectNode portalNode = (PortalObjectNode)current;
- PortalObject portal = container.getObject(portalNode.getRef());
+ PortalObject portal = container.getObject(portalNode.getObjectId());
portal.setDeclaredProperty(key, value);
if (log.isDebugEnabled())
{
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl;
import org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory;
import org.jboss.portal.test.core.PortalBaseTestCase;
@@ -111,7 +112,7 @@
//
hibernate.openSession();
- PortalObject root = container.getObject("");
+ PortalObject root = container.getRootObject();
assertNotNull(root);
assertTrue(hibernate.commitTransaction());
@@ -131,7 +132,7 @@
hibernate.openSession();
PortalContainer ctx = (PortalContainer)container.getRootObject();
Portal portal = ctx.createPortal("default");
- String portalId = portal.getId();
+ PortalObjectId portalId = portal.getId();
assertNotNull(portalId);
assertNotNull(portal);
portal.setDeclaredProperty("foo1", "bar1");
@@ -146,7 +147,7 @@
//
Page page = portal.createPage("default");
assertNotNull(page);
- String pageId = page.getId();
+ PortalObjectId pageId = page.getId();
assertNotNull(pageId);
page.setDeclaredProperty("foo2", "bar2_");
page.setDeclaredProperty("foo3", "bar3");
@@ -162,7 +163,7 @@
//
Window window = page.createWindow("default");
assertNotNull(window);
- String windowId = window.getId();
+ PortalObjectId windowId = window.getId();
assertNotNull(windowId);
assertEquals(page, window.getParent());
assertEquals(window, page.getChild("default"));
@@ -224,6 +225,9 @@
container.start();
//
+ PortalObjectId defaultId = new PortalObjectId(new String[]{"default"});
+
+ //
hibernate.openSession();
assertTrue(hibernate.commitTransaction());
@@ -234,7 +238,7 @@
assertNotNull(portal);
//
- PortalObject object = container.getObject("default");
+ PortalObject object = container.getObject(defaultId);
assertNotNull(object);
//
@@ -242,7 +246,7 @@
ctx.createPortal("default");
//
- object = container.getObject("default");
+ object = container.getObject(defaultId);
assertNotNull(object);
assertTrue(hibernate.commitTransaction());
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPermissionTestCase.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.core.model.portal;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.identity.auth.UserPrincipal;
import org.jboss.portal.security.PortalPermission;
import org.jboss.portal.security.PortalPermissionCollection;
@@ -55,8 +56,8 @@
public void testImplies1()
{
- PortalObjectPermission v = new PortalObjectPermission("abc", "view");
- PortalObjectPermission vr = new PortalObjectPermission("abc", "viewrecursive");
+ PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "view");
+ PortalObjectPermission vr = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "viewrecursive");
assertTrue(v.implies(v));
assertTrue(v.implies(vr));
assertTrue(vr.implies(v));
@@ -65,8 +66,8 @@
public void testImplies2()
{
- PortalObjectPermission v = new PortalObjectPermission("abc", "view");
- PortalObjectPermission vr = new PortalObjectPermission("abc.def", "viewrecursive");
+ PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "view");
+ PortalObjectPermission vr = new PortalObjectPermission(new PortalObjectId(new String[]{"abc","def"}), "viewrecursive");
assertTrue(v.implies(v));
assertFalse(v.implies(vr));
assertFalse(vr.implies(v));
@@ -75,8 +76,8 @@
public void testImplies3()
{
- PortalObjectPermission v = new PortalObjectPermission("abc", "viewrecursive");
- PortalObjectPermission vr = new PortalObjectPermission("abc.def", "view");
+ PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "viewrecursive");
+ PortalObjectPermission vr = new PortalObjectPermission(new PortalObjectId(new String[]{"abc","def"}), "view");
assertTrue(v.implies(v));
assertTrue(v.implies(vr));
assertFalse(vr.implies(v));
@@ -85,11 +86,11 @@
public void testDashboard1() throws Exception
{
- PortalObjectPermission v = new PortalObjectPermission("", "dashboard");
- PortalObjectPermission v1 = new PortalObjectPermission("abc", "view");
- PortalObjectPermission v2 = new PortalObjectPermission("abc.def", "view");
- PortalObjectPermission v3 = new PortalObjectPermission("def", "view");
- PortalObjectPermission v4 = new PortalObjectPermission("def.ghi", "view");
+ PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId(new String[0]), "dashboard");
+ PortalObjectPermission v1 = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "view");
+ PortalObjectPermission v2 = new PortalObjectPermission(new PortalObjectId(new String[]{"abc","def"}), "view");
+ PortalObjectPermission v3 = new PortalObjectPermission(new PortalObjectId(new String[]{"def"}), "view");
+ PortalObjectPermission v4 = new PortalObjectPermission(new PortalObjectId(new String[]{"def","ghi"}), "view");
Subject abc = new Subject();
abc.getPrincipals().add(new UserPrincipal("abc"));
@@ -127,11 +128,11 @@
public void testDashboard2() throws Exception
{
- PortalObjectPermission v = new PortalObjectPermission("abc", "dashboard");
- PortalObjectPermission v1 = new PortalObjectPermission("abc.def", "view");
- PortalObjectPermission v2 = new PortalObjectPermission("abc.def.ghi", "view");
- PortalObjectPermission v3 = new PortalObjectPermission("jkl", "view");
- PortalObjectPermission v4 = new PortalObjectPermission("jkl.mno", "view");
+ PortalObjectPermission v = new PortalObjectPermission(new PortalObjectId(new String[]{"abc"}), "dashboard");
+ PortalObjectPermission v1 = new PortalObjectPermission(new PortalObjectId(new String[]{"abc","def"}), "view");
+ PortalObjectPermission v2 = new PortalObjectPermission(new PortalObjectId(new String[]{"abc","def","ghi"}), "view");
+ PortalObjectPermission v3 = new PortalObjectPermission(new PortalObjectId(new String[]{"jkl"}), "view");
+ PortalObjectPermission v4 = new PortalObjectPermission(new PortalObjectId(new String[]{"jkl","mno"}), "view");
Subject def = new Subject();
def.getPrincipals().add(new UserPrincipal("def"));
@@ -192,12 +193,14 @@
public PortalPermission createPermission(String uri, String action) throws PortalSecurityException
{
- return new PortalObjectPermission(uri, action);
+ PortalObjectId id = PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT);
+ return new PortalObjectPermission(id, action);
}
public PortalPermission createPermission(String uri, Collection actions) throws PortalSecurityException
{
- return new PortalObjectPermission(uri, actions);
+ PortalObjectId id = PortalObjectId.parse(uri, PortalObjectId.CANONICAL_FORMAT);
+ return new PortalObjectPermission(id, actions);
}
};
}
@@ -212,7 +215,7 @@
public void testDomainImplies1() throws Exception
{
//
- domain.getConfigurator().setSecurityBindings("", Collections.singleton(new RoleSecurityBinding("viewrecursive", "admin")));
+ domain.getConfigurator().setSecurityBindings("/", Collections.singleton(new RoleSecurityBinding("viewrecursive", "admin")));
//
server.execute(new Server.Task()
@@ -220,9 +223,9 @@
public void execute() throws Exception
{
Principal[] principals = new Principal[]{new SimplePrincipal("admin")};
- assertTrue(implies(new PortalObjectPermission("", "view"), principals));
- assertTrue(implies(new PortalObjectPermission("default", "view"), principals));
- assertTrue(implies(new PortalObjectPermission("default.default", "view"), principals));
+ assertTrue(implies(new PortalObjectPermission(new PortalObjectId(new String[0]), "view"), principals));
+ assertTrue(implies(new PortalObjectPermission(new PortalObjectId(new String[]{"default"}), "view"), principals));
+ assertTrue(implies(new PortalObjectPermission(new PortalObjectId(new String[]{"default","default"}), "view"), principals));
}
});
}
@@ -230,7 +233,7 @@
public void testDomainImplies2() throws Exception
{
//
- domain.getConfigurator().setSecurityBindings("", Collections.singleton(new RoleSecurityBinding("view", "admin")));
+ domain.getConfigurator().setSecurityBindings("/", Collections.singleton(new RoleSecurityBinding("view", "admin")));
//
server.execute(new Server.Task()
@@ -238,9 +241,9 @@
public void execute() throws Exception
{
Principal[] principals = new Principal[]{new SimplePrincipal("admin")};
- assertTrue(implies(new PortalObjectPermission("", "view"), principals));
- assertFalse(implies(new PortalObjectPermission("default", "view"), principals));
- assertFalse(implies(new PortalObjectPermission("default.default", "view"), principals));
+ assertTrue(implies(new PortalObjectPermission(new PortalObjectId(new String[0]), "view"), principals));
+ assertFalse(implies(new PortalObjectPermission(new PortalObjectId(new String[]{"default"}), "view"), principals));
+ assertFalse(implies(new PortalObjectPermission(new PortalObjectId(new String[]{"default","default"}), "view"), principals));
}
});
}
Modified: trunk/security/src/main/org/jboss/portal/security/PortalPermission.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/PortalPermission.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/security/src/main/org/jboss/portal/security/PortalPermission.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -83,7 +83,7 @@
/** Return true if the permission is a container. */
public boolean isContainer()
{
- return uri == null;
+ return collection != null;
}
/**
Modified: trunk/security/src/main/org/jboss/portal/security/spi/provider/PermissionRepository.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/spi/provider/PermissionRepository.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/security/src/main/org/jboss/portal/security/spi/provider/PermissionRepository.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -33,6 +33,10 @@
*/
public interface PermissionRepository
{
- /** Load a permission from the repository. */
+ /**
+ * Load a permission from the repository.
+ *
+ * @return a portam permission
+ */
PortalPermission getPermission(String roleName, String uri) throws PortalSecurityException;
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -59,9 +59,9 @@
}
else
{
- if (renderContext.getRegionID() != null)
+ if (renderContext.getRegionId() != null)
{
- markup.append(" id='").append(renderContext.getRegionID()).append("'>");
+ markup.append(" id='").append(renderContext.getRegionId()).append("'>");
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -219,7 +219,7 @@
{
markup.append("<script>").
append("regions_on_page[\"").
- append(renderContext.getRegionID()).
+ append(renderContext.getRegionId()).
append("\"]=\"").
append(region.getId()).
append("\";").
@@ -240,9 +240,9 @@
}
//
- if (portletPos.get(renderContext.getRegionID()) != null && ((Integer)portletPos.get(renderContext.getRegionID())).intValue() > 0)
+ if (portletPos.get(renderContext.getRegionId()) != null && ((Integer)portletPos.get(renderContext.getRegionId())).intValue() > 0)
{
- portletPos.put(renderContext.getRegionID(), new Integer(0));
+ portletPos.put(renderContext.getRegionId(), new Integer(0));
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -58,10 +58,10 @@
{
int portletNumber = ((DynaRegionRenderer)renderContext
.getRegionRenderer()).getPortletNumber(renderContext
- .getRegionID());
+ .getRegionId());
((DynaRegionRenderer)renderContext.getRegionRenderer()).setWindowId(
- "portlet-dnd-" + renderContext.getRegionID() + "-"
+ "portlet-dnd-" + renderContext.getRegionId() + "-"
+ portletNumber, portletContext.getWindowName());
renderContext.getMarkupFragment().append("<div id=\"").append(portletContext.getId()).append("\">\n");
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/strategy/MaximizingStrategyImpl.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -66,7 +66,7 @@
if (maximizedWindows.size() > 0)
{
// The first one wins
- String maximizedWindowId = ((WindowContext)maximizedWindows.get(0)).getId();
+ Object maximizedWindowId = ((WindowContext)maximizedWindows.get(0)).getId();
//
ensureSingleMaximizedWindow(maximizedWindows, maximizedWindowId, response);
@@ -89,8 +89,8 @@
StrategyResponse response = context.createResponse();
//
- String maximizedWindowId = null;
- String targetWindowId = null;
+ Object maximizedWindowId = null;
+ Object targetWindowId = null;
WindowState newState = null;
if (evt instanceof NavigationalStateChangedEvent)
{
@@ -149,7 +149,7 @@
* @param maximizedWindowId
* @param response
*/
- private void ensureSingleMaximizedWindow(List maximizedWindows, String maximizedWindowId, StrategyResponse response)
+ private void ensureSingleMaximizedWindow(List maximizedWindows, Object maximizedWindowId, StrategyResponse response)
{
for (Iterator i = maximizedWindows.iterator(); i.hasNext();)
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -164,7 +164,7 @@
* @param windowId the window id identifying the portlet window to get the window result for
* @return the window result for the provided window id
*/
- public WindowResult getWindowResult(String windowId)
+ public WindowResult getWindowResult(Object windowId)
{
return (WindowResult)results.get(windowId);
}
@@ -185,7 +185,7 @@
* @param windowId the window id identifying the portlet to get the context for
* @return the window context for the provided window id
*/
- public WindowContext getWindowContext(String windowId)
+ public WindowContext getWindowContext(Object windowId)
{
return (WindowContext)windowContexts.get(windowId);
}
@@ -210,7 +210,7 @@
this.layoutState = layoutState;
}
- public void addWindowResult(String windowId, WindowResult result)
+ public void addWindowResult(Object windowId, WindowResult result)
{
if (!windowContexts.keySet().contains(windowId))
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -37,7 +37,7 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = -225656969004976637L;
- private final String windowID;
+ private final Object windowId;
private final String windowName;
// mutable properties
@@ -47,13 +47,13 @@
public static WindowContext copy(WindowContext template)
{
- return new WindowContext(template.windowName, template.windowID, template.regionName, template.order);
+ return new WindowContext(template.windowName, template.windowId, template.regionName, template.order);
}
- public WindowContext(String windowName, String windowID, String regionName, int order)
+ public WindowContext(String windowName, Object windowId, String regionName, int order)
{
this.windowName = windowName;
- this.windowID = windowID;
+ this.windowId = windowId;
this.regionName = regionName;
this.order = order;
// by default the window is visible
@@ -65,9 +65,9 @@
return windowName;
}
- public String getId()
+ public Object getId()
{
- return windowID;
+ return windowId;
}
public String getRegionName()
@@ -118,16 +118,16 @@
final WindowContext that = (WindowContext)o;
- return windowID.equals(that.windowID);
+ return windowId.equals(that.windowId);
}
public int hashCode()
{
- return windowID.hashCode();
+ return windowId.hashCode();
}
public String toString()
{
- return windowName + " " + windowID + " " + regionName + " " + order + " " + (visible ? "visible" : "invisible");
+ return windowName + " " + windowId + " " + regionName + " " + order + " " + (visible ? "visible" : "invisible");
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -353,7 +353,7 @@
}
/** @return the region CSS id */
- public String getRegionID()
+ public String getRegionId()
{
return regionCssId;
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/WindowLocation.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/WindowLocation.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/WindowLocation.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -39,7 +39,7 @@
this.windowContext = windowContext;
}
- public String getWindowId()
+ public Object getWindowId()
{
return windowContext.getId();
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java 2006-12-05 16:34:35 UTC (rev 5762)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java 2006-12-05 17:36:47 UTC (rev 5763)
@@ -67,8 +67,8 @@
Map results = page.getWindowResultMap();
for (Iterator i = results.keySet().iterator(); i.hasNext();)
{
- String windowID = (String)i.next();
- WindowResult result = page.getWindowResult(windowID);
+ Object windowId = i.next();
+ WindowResult result = page.getWindowResult(windowId);
Properties responseProperties = result.getResponseProperties();
if (responseProperties != null)
19 years, 6 months
JBoss Portal SVN: r5762 - /
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2006-12-05 11:34:35 -0500 (Tue, 05 Dec 2006)
New Revision: 5762
Removed:
jira-test.txt
Log:
Deleted: jira-test.txt
===================================================================
19 years, 6 months
JBoss Portal SVN: r5761 - /
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2006-12-05 11:19:38 -0500 (Tue, 05 Dec 2006)
New Revision: 5761
Added:
jira-test.txt
Log:
Added: jira-test.txt
===================================================================
19 years, 6 months
JBoss Portal SVN: r5760 - trunk/core/src/resources/portal-core-sar/META-INF
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2006-12-05 10:54:52 -0500 (Tue, 05 Dec 2006)
New Revision: 5760
Modified:
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Use the new interface of the Scheduler
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-12-04 23:06:50 UTC (rev 5759)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-12-05 15:54:52 UTC (rev 5760)
@@ -28,11 +28,11 @@
<!-- Portlet discovery executed every 30 seconds -->
<mbean code="org.jboss.varia.scheduler.Scheduler"
name="portal:service=Management,type=Scheduler">
- <attribute name="TargetName">portal:service=Management,type=PortletDiscoveryManagement,name=Default</attribute>
- <attribute name="TargetMethod">processPortletDiscovery()</attribute>
- <attribute name="StartDate">NOW</attribute>
- <attribute name="Period">30000</attribute>
- <attribute name="Repetitions">-1</attribute>
+ <attribute name="SchedulableMBean">portal:service=Management,type=PortletDiscoveryManagement,name=Default</attribute>
+ <attribute name="SchedulableMBeanMethod">processPortletDiscovery()</attribute>
+ <attribute name="InitialStartDate">NOW</attribute>
+ <attribute name="SchedulePeriod">30000</attribute>
+ <attribute name="InitialRepetitions">-1</attribute>
</mbean>
<mbean
19 years, 6 months
JBoss Portal SVN: r5759 - trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-04 18:06:50 -0500 (Mon, 04 Dec 2006)
New Revision: 5759
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
Log:
- Cleaned-up NeedPortletHandleTest and adapted inheriting tests.
- Need to figure out what can be tested in ReleaseSessionTestCase since not much can be based on our implementation.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2006-12-04 23:03:50 UTC (rev 5758)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2006-12-04 23:06:50 UTC (rev 5759)
@@ -29,7 +29,6 @@
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRenderURL;
import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.CacheControl;
import org.jboss.portal.wsrp.core.GetMarkup;
@@ -42,7 +41,6 @@
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UpdateResponse;
-import org.jboss.portal.wsrp.handler.RequestHeaderClientHandler;
import java.rmi.RemoteException;
@@ -108,7 +106,7 @@
String archiveName = "test-renderparam-portlet.war";
deploy(archiveName);
- GetMarkup gm = createMarkupRequest(archiveName);
+ GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse res = markupService.getMarkup(gm);
String markupString = res.getMarkupContext().getMarkupString();
@@ -135,7 +133,7 @@
// let's see now if we can increment the counter
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForPortletDeployedIn(archiveName));
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
markupService.performBlockingInteraction(performBlockingInteraction);
@@ -161,7 +159,7 @@
String sessionPortletArchive = "test-session-portlet.war";
deploy(sessionPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(sessionPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse response = markupService.getMarkup(getMarkup);
@@ -240,7 +238,7 @@
String sessionPortletArchive = "test-session-portlet.war";
deploy(sessionPortletArchive);
- response = markupService.getMarkup(createMarkupRequest(sessionPortletArchive));
+ response = markupService.getMarkup(createMarkupRequestForCurrentlyDeployedPortlet());
cacheControl = response.getMarkupContext().getCacheControl();
ExtendedAssert.assertNull(cacheControl);
@@ -299,7 +297,7 @@
String dispatcherPortletArchive = "test-dispatcher-portlet.war";
deploy(dispatcherPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(dispatcherPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "test");
@@ -313,7 +311,7 @@
String basicPortletArchive = "test-basic-portlet.war";
deploy(basicPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(basicPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "");
@@ -327,7 +325,7 @@
String getLocalesPortletArchive = "test-getlocales-portlet.war";
deploy(getLocalesPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(getLocalesPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
getMarkup.getMarkupParams().setLocales(new String[]{"en_US"});
MarkupResponse response = null;
@@ -352,7 +350,7 @@
String encodeURLPortletArchive = "test-encodeurl-portlet.war";
deploy(encodeURLPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(encodeURLPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n" +
@@ -367,7 +365,7 @@
String userContextPortletArchive = "test-usercontext-portlet.war";
deploy(userContextPortletArchive);
- GetMarkup getMarkup = createMarkupRequest(userContextPortletArchive);
+ GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
getMarkup.setUserContext(WSRPTypeFactory.createUserContext("johndoe"));
MarkupResponse response = markupService.getMarkup(getMarkup);
@@ -386,7 +384,7 @@
WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
action.getInteractionParams().setFormParameters(new NamedString[]{new NamedString("multi", "value1")});
BlockingInteractionResponse actionResponse = markupService.performBlockingInteraction(action);
- GetMarkup markupRequest = createMarkupRequest(multiValuedPortletArchive);
+ GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
MarkupResponse response = markupService.getMarkup(markupRequest);
checkMarkupResponse(response, "multi: value1");
@@ -394,14 +392,14 @@
action.getInteractionParams().setFormParameters(new NamedString[]{
new NamedString("multi", "value1"), new NamedString("multi", "value2")});
actionResponse = markupService.performBlockingInteraction(action);
- markupRequest = createMarkupRequest(multiValuedPortletArchive);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
response = markupService.getMarkup(markupRequest);
checkMarkupResponse(response, "multi: value1, value2");
action.getInteractionParams().setFormParameters(new NamedString[]{});
actionResponse = markupService.performBlockingInteraction(action);
- markupRequest = createMarkupRequest(multiValuedPortletArchive);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
response = markupService.getMarkup(markupRequest);
checkMarkupResponse(response, "multi: ");
@@ -449,9 +447,7 @@
"&wsrp-navigationalState=JBPNS_/wsrp_rewrite\">render</a></div>", markupContext.getMarkupString());
// checking session
- ProducerSessionInformation sessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
- ExtendedAssert.assertNotNull(sessionInfo);
- ExtendedAssert.assertTrue(sessionInfo.getUserCookie().lastIndexOf("JSESSIONID") != -1);
+ checkSessionForCurrentlyDeployedPortlet(response);
}
private MarkupContext checkMarkupResponse(MarkupResponse response, String markupString)
@@ -469,22 +465,8 @@
return markupContext;
}
- /**
- * Creates a valid Markup request.
- *
- * @param archiveName
- * @return a basic, valid GetMarkup object representing the markup request
- */
- private GetMarkup createMarkupRequest(String archiveName) throws Exception
+ protected String getMostUsedPortletWARFileName()
{
- GetMarkup getMarkup = WSRPTypeFactory.createDefaultMarkupRequest(getHandleForPortletDeployedIn(archiveName));
- getMarkup.getMarkupParams().setMarkupCharacterSets(new String[]{WSRPConstants.DEFAULT_CHARACTER_SET});
-
- return getMarkup;
+ return DEFAULT_MARKUP_PORTLET_WAR;
}
-
- private GetMarkup createMarkupRequest() throws Exception
- {
- return createMarkupRequest(null);
- }
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2006-12-04 23:03:50 UTC (rev 5758)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2006-12-04 23:06:50 UTC (rev 5759)
@@ -23,16 +23,21 @@
package org.jboss.portal.test.wsrp.v1.producer;
+import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.MarkupResponse;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.handler.RequestHeaderClientHandler;
import java.rmi.RemoteException;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -42,44 +47,33 @@
*/
public abstract class NeedPortletHandleTest extends V1ProducerBaseTest
{
- private String portletWARFileName;
- private Map warFileName2handle = new HashMap();
+ private String mostUsedPortletWARFileName;
private String currentlyDeployedArchiveName;
+ private Map war2Handle = new HashMap(7);
+
public NeedPortletHandleTest(String portletWARFileName)
throws Exception
{
this("NeedPortletHandleTest", portletWARFileName);
- this.portletWARFileName = portletWARFileName;
+ this.mostUsedPortletWARFileName = portletWARFileName;
}
protected NeedPortletHandleTest(String name, String portletWARFileName)
throws Exception
{
super(name);
- this.portletWARFileName = portletWARFileName;
+ this.mostUsedPortletWARFileName = portletWARFileName;
}
- protected String getHandleForPortletDeployedIn(String archiveName)
- throws org.jboss.portal.wsrp.core.OperationFailedFault, org.jboss.portal.wsrp.core.InvalidRegistrationFault, java.rmi.RemoteException
- {
-// printMappings("getHandleForPortletDeployedIn");
- if (archiveName == null)
- {
- archiveName = portletWARFileName;
- }
-
- return (String)warFileName2handle.get(archiveName);
- }
-
protected String getDefaultHandle() throws RemoteException, InvalidRegistrationFault, OperationFailedFault
{
- return getHandleForPortletDeployedIn(null);
+ return (String)war2Handle.get(mostUsedPortletWARFileName);
}
protected String getHandleForCurrentlyDeployedArchive() throws RemoteException, InvalidRegistrationFault, OperationFailedFault
{
- return getHandleForPortletDeployedIn(currentlyDeployedArchiveName);
+ return (String)war2Handle.get(currentlyDeployedArchiveName);
}
/**
@@ -93,32 +87,25 @@
{
super.deploy(archiveName);
currentlyDeployedArchiveName = archiveName;
- GetServiceDescription getServiceDescription = WSRPTypeFactory.createGetServiceDescription();
- ServiceDescription serviceDescription = serviceDescriptionService.getServiceDescription(getServiceDescription);
- PortletDescription[] offered = serviceDescription.getOfferedPortlets();
- for (int i = 0; i < offered.length; i++)
+
+ if (!war2Handle.containsKey(archiveName))
{
- PortletDescription portletDescription = offered[i];
- String handle = portletDescription.getPortletHandle();
- if (!warFileName2handle.containsKey(archiveName))
+ GetServiceDescription getServiceDescription = WSRPTypeFactory.createGetServiceDescription();
+ ServiceDescription serviceDescription = serviceDescriptionService.getServiceDescription(getServiceDescription);
+ PortletDescription[] offered = serviceDescription.getOfferedPortlets();
+ for (int i = 0; i < offered.length; i++)
{
- warFileName2handle.put(archiveName, handle);
+ PortletDescription portletDescription = offered[i];
+ String handle = portletDescription.getPortletHandle();
+ String warName = handle.substring(1, handle.indexOf('.')) + ".war";
+ if (warName.equals(archiveName))
+ {
+ war2Handle.put(warName, handle);
+ }
}
}
-// printMappings("deploy");
}
- private void printMappings(String when)
- {
- System.out.println("when = " + when);
- for (Iterator iterator = warFileName2handle.entrySet().iterator(); iterator.hasNext();)
- {
- Map.Entry entry = (Map.Entry)iterator.next();
- System.out.println("archive = " + entry.getKey() + " | handle = " + entry.getValue());
- }
- System.out.println("----");
- }
-
protected void undeploy(String archiveName) throws Exception
{
try
@@ -132,23 +119,63 @@
return;
}
- if (warFileName2handle.containsKey(archiveName))
+ currentlyDeployedArchiveName = null;
+
+ // only remove the mapping if we're not undeploying the most used portlet (optimization, as it avoids parsing the SD)
+ if (!mostUsedPortletWARFileName.equals(archiveName))
{
- warFileName2handle.remove(archiveName);
+ war2Handle.remove(archiveName);
}
- currentlyDeployedArchiveName = null;
-// printMappings("undeploy");
}
public void setUp() throws Exception
{
super.setUp();
- deploy(portletWARFileName);
+ this.mostUsedPortletWARFileName = getMostUsedPortletWARFileName();
+ deploy(mostUsedPortletWARFileName);
}
+ /**
+ * Sub-classes need to implement this method to return the local WAR file name of the portlet being deployed most of
+ * the time in the context of the test case. This is required since we cannot rely on the name to be properly set at
+ * all time via the constructor.
+ *
+ * @return
+ */
+ protected abstract String getMostUsedPortletWARFileName();
+
public void tearDown() throws Exception
{
- undeploy(portletWARFileName);
+ undeploy(mostUsedPortletWARFileName);
super.tearDown();
}
+
+ /**
+ * Creates a valid Markup request.
+ *
+ * @return a basic, valid GetMarkup object representing the markup request
+ */
+ protected GetMarkup createMarkupRequestForCurrentlyDeployedPortlet() throws Exception
+ {
+ GetMarkup getMarkup = WSRPTypeFactory.createDefaultMarkupRequest(getHandleForCurrentlyDeployedArchive());
+ getMarkup.getMarkupParams().setMarkupCharacterSets(new String[]{WSRPConstants.DEFAULT_CHARACTER_SET});
+
+ return getMarkup;
+ }
+
+ protected GetMarkup createMarkupRequest() throws Exception
+ {
+ return createMarkupRequestForCurrentlyDeployedPortlet();
+ }
+
+ protected void checkSessionForCurrentlyDeployedPortlet(MarkupResponse response)
+ throws RemoteException, InvalidRegistrationFault, OperationFailedFault
+ {
+ // We don't send any portlet session information, just user cookies... The producer takes care of the details
+ // What this means, though is that we don't have access to individual portlet session ids... so we can only
+ // check that we get a cookie... Not very test-friendly...
+ ProducerSessionInformation sessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
+ ExtendedAssert.assertNotNull(sessionInfo);
+ ExtendedAssert.assertTrue(sessionInfo.getUserCookie().lastIndexOf("JSESSIONID") != -1);
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2006-12-04 23:03:50 UTC (rev 5758)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/PortletManagementTestCase.java 2006-12-04 23:06:50 UTC (rev 5759)
@@ -41,10 +41,12 @@
*/
public class PortletManagementTestCase extends NeedPortletHandleTest
{
+ private static final String TEST_BASIC_PORTLET_WAR = "test-basic-portlet.war";
+
public PortletManagementTestCase()
throws Exception
{
- super("PortletManagementTestCase", "test-basic-portlet.war");
+ super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
}
public void testClonePortlet()
@@ -109,6 +111,11 @@
// todo: implement
}
+ protected String getMostUsedPortletWARFileName()
+ {
+ return TEST_BASIC_PORTLET_WAR;
+ }
+
private static class PropertyDecorator implements Decorator
{
private Property prop;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2006-12-04 23:03:50 UTC (rev 5758)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2006-12-04 23:06:50 UTC (rev 5759)
@@ -27,13 +27,17 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.MarkupResponse;
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ReleaseSessions;
import org.jboss.portal.wsrp.handler.RequestHeaderClientHandler;
+import java.rmi.RemoteException;
+
/**
* Tests the behavior of the ReleaseSession method.
*
@@ -47,10 +51,22 @@
Logger log = Logger.getLogger(ReleaseSessionTestCase.class);
+ public void tearDown() throws Exception
+ {
+ producer.getProducerRegistrationRequirements().clearRegistrationProperties();
+ producer.getRegistrationManager().clear();
+ super.tearDown();
+ }
+
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return DEFAULT_SESSION_PORTLET_WAR;
+ }
+
public ReleaseSessionTestCase() throws Exception
{
super("SessionWar", DEFAULT_SESSION_PORTLET_WAR);
- //super("SessionWar");
log.debug("Instantiating ReleaseSessionTestCase");
}
@@ -62,15 +78,19 @@
Class exceptionClass = InvalidRegistrationFault.class;
String message = "A null RegistrationContext when a registration is required should produce an InvalidRegistrationFault";
- releaseSessionsWithRegistration(regContext, getSessionIDs(), exceptionClass, message);
+ releaseSessionsWithRegistration(regContext, null, exceptionClass, message);
}
public void testNullRegistrationContext() throws Exception
{
RegistrationContext regContext = null;
+ GetMarkup getMarkup = createMarkupRequest();
+ MarkupResponse response = markupService.getMarkup(getMarkup);
+ checkSessionForCurrentlyDeployedPortlet(response);
+
// Since no registration is required, a null RegistrationContext should be acceptable
- releaseSessions(regContext, getSessionIDs(), null, null);
+ releaseSessions(regContext, null, null, null);
}
public void testNullSessionIDWithRegistration() throws Exception
@@ -231,10 +251,11 @@
//*************************************************************************************************
- private String[] getSessionIDs()
+ private String[] getSessionIDs() throws RemoteException, InvalidRegistrationFault, OperationFailedFault
{
ProducerSessionInformation sessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
- String sessionID = (sessionInfo.getUserCookie()).substring("JSESSIONID=".length());
+ // session ids are portlet session, not portal session so we cannot rely on the JSESSIONID cookie
+ String sessionID = sessionInfo.getSessionIdForPortlet(getDefaultHandle());
return new String[]
{sessionID};
}
19 years, 6 months