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)