Author: julien(a)jboss.com
Date: 2007-02-05 15:38:32 -0500 (Mon, 05 Feb 2007)
New Revision: 6163
Added:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/AbstractContentRenderer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/ContentRendererRegistryService.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/content/
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererRegistry.java
Removed:
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java
Modified:
trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/AbstractContentHandler.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.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/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java
Log:
introducer plugable content renderer for the content framework
Modified: trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/common/src/main/org/jboss/portal/common/util/CopyOnWriteRegistry.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -123,7 +123,7 @@
* @return the registeted object
* @throws IllegalArgumentException if the key is null
*/
- public Object get(Object key) throws IllegalArgumentException
+ public Object getRegistration(Object key) throws IllegalArgumentException
{
if (key == null)
{
Modified:
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/common/src/main/org/jboss/portal/test/common/CopyOnWriteRegistryTestCase.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -103,7 +103,7 @@
{
try
{
- registry.get(null);
+ registry.getRegistration(null);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -115,7 +115,7 @@
{
assertTrue(registry.register(key, registered1));
assertFalse(registry.register(key, registered2));
- assertEquals(registered1, registry.get(key));
+ assertEquals(registered1, registry.getRegistration(key));
}
public void testUnregisterNonRegistered()
@@ -130,9 +130,9 @@
assertTrue(registry.register(key, registered1));
assertEquals(Collections.singleton(key), registry.getKeys());
assertEquals(Collections.singletonList(registered1), new
ArrayList(registry.getRegistrations()));
- assertEquals(registered1, registry.get(key));
+ assertEquals(registered1, registry.getRegistration(key));
assertTrue(registry.unregister(key));
- assertEquals(null, registry.get(key));
+ assertEquals(null, registry.getRegistration(key));
assertEquals(Collections.EMPTY_SET, registry.getKeys());
assertEquals(Collections.EMPTY_LIST, new ArrayList(registry.getRegistrations()));
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.controller.command.mapper.CommandFactory;
import org.jboss.portal.core.controller.command.mapper.URLFactory;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.common.invocation.InterceptorStackFactory;
@@ -64,6 +65,19 @@
/** . */
protected CustomizationManager customizationManager;
+ /** . */
+ protected ContentRendererRegistry contentRendererRegistry;
+
+ public ContentRendererRegistry getContentRendererRegistry()
+ {
+ return contentRendererRegistry;
+ }
+
+ public void setContentRendererRegistry(ContentRendererRegistry
contentRendererRegistry)
+ {
+ this.contentRendererRegistry = contentRendererRegistry;
+ }
+
public CustomizationManager getCustomizationManager()
{
return customizationManager;
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/AbstractContentHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/AbstractContentHandler.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/AbstractContentHandler.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -69,7 +69,7 @@
this.registry = registry;
}
- protected void createService() throws Exception
+ protected void startService() throws Exception
{
registeredContentType = ContentType.create(contentType);
@@ -77,7 +77,7 @@
registry.registerHandler(registeredContentType, this);
}
- protected void destroyService() throws Exception
+ protected void stopService() throws Exception
{
if (registeredContentType != null)
{
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 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -61,11 +61,11 @@
private InstanceContainer instanceContainer;
/** . */
- private CopyOnWriteRegistry contentHandlerRegistry;
+ private CopyOnWriteRegistry contentHandlerRegistrations;
protected AbstractPortalObjectContainer()
{
- contentHandlerRegistry = new CopyOnWriteRegistry();
+ contentHandlerRegistrations = new CopyOnWriteRegistry();
}
public InstanceContainer getInstanceContainer()
@@ -80,19 +80,24 @@
public void registerHandler(ContentType contentType, ContentHandler handler) throws
IllegalArgumentException
{
- contentHandlerRegistry.register(contentType, handler);
+ contentHandlerRegistrations.register(contentType, handler);
}
public ContentHandler getHandler(ContentType contentType)
{
- return (ContentHandler)contentHandlerRegistry.get(contentType);
+ return (ContentHandler)contentHandlerRegistrations.getRegistration(contentType);
}
public void unregisterHandler(ContentType contentType)
{
- contentHandlerRegistry.unregister(contentType);
+ contentHandlerRegistrations.unregister(contentType);
}
+ public Collection getContentTypes()
+ {
+ return contentHandlerRegistrations.getKeys();
+ }
+
public PortalObject getRootObject()
{
return getObject(rootId);
@@ -243,7 +248,7 @@
*/
public ContentHandler getContentHandler(ContentType contentType)
{
- return (ContentHandler)contentHandlerRegistry.get(contentType);
+ return
(ContentHandler)contentHandlerRegistrations.getRegistration(contentType);
}
}
}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/AbstractContentRenderer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/AbstractContentRenderer.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/AbstractContentRenderer.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.content;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.content.ContentType;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractContentRenderer extends AbstractJBossService implements
ContentRenderer
+{
+
+ /** . */
+ private ContentRendererRegistry registry;
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private ContentType registeredContentType;
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public ContentRendererRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(ContentRendererRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ protected void startService() throws Exception
+ {
+ registeredContentType = ContentType.create(contentType);
+
+ //
+ registry.registerRenderer(registeredContentType, this);
+ }
+
+ protected void stopService() throws Exception
+ {
+ if (registeredContentType != null)
+ {
+ registry.unregisterRenderer(registeredContentType);
+ }
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/ContentRendererRegistryService.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/ContentRendererRegistryService.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/ContentRendererRegistryService.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * 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.content;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.common.util.CopyOnWriteRegistry;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContentRendererRegistryService extends AbstractJBossService implements
ContentRendererRegistry
+{
+
+ /** . */
+ private CopyOnWriteRegistry registrations;
+
+ public Collection getContentTypes()
+ {
+ return registrations.getKeys();
+ }
+
+ public ContentRendererRegistryService()
+ {
+ registrations = new CopyOnWriteRegistry();
+ }
+
+ public void registerRenderer(ContentType contentType, ContentRenderer renderer)
+ {
+ registrations.register(contentType, renderer);
+ }
+
+ public void unregisterRenderer(ContentType contentType)
+ {
+ registrations.unregister(contentType);
+ }
+
+ public ContentRenderer getRenderer(ContentType contentType)
+ {
+ return (ContentRenderer)registrations.getRegistration(contentType);
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/content/PortletContentRenderer.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,384 @@
+/******************************************************************************
+ * 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.content;
+
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.CustomizationManager;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ResourceAccessDeniedException;
+import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
+import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.Properties;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.Exceptions;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.config.ServerConfig;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.navigation.WindowNavigationalState;
+import org.jboss.logging.Logger;
+
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletContentRenderer extends AbstractContentRenderer implements
ContentRenderer
+{
+
+ /** . */
+ private final Logger log = Logger.getLogger(getClass());
+
+ /** . */
+ private CustomizationManager customizationManager;
+
+ public CustomizationManager getCustomizationManager()
+ {
+ return customizationManager;
+ }
+
+ public void setCustomizationManager(CustomizationManager customizationManager)
+ {
+ this.customizationManager = customizationManager;
+ }
+
+ protected Instance findInstance(RenderWindowCommand cmd)
+ {
+ ControllerContext context = cmd.getControllerContext();
+
+ // The window
+ Window window = cmd.getWindow();
+
+ // We need the user id
+ User user = context.getUser();
+
+ // Get instance
+ return customizationManager.getInstance(window, user);
+ }
+
+ public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ {
+ Window window = cmd.getWindow();
+ Portal portal = cmd.getPortal();
+ ControllerContext context = cmd.getControllerContext();
+ ServerConfig cfg =
context.getServerInvocation().getRequest().getServer().getConfig();
+ PortalObjectId windowId = window.getId();
+ StateString navigationalState =
(StateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE,
windowId);
+
+ // Get mode and window state
+ String navStateKey = windowId + "_window";
+ WindowNavigationalState windowNavState =
(WindowNavigationalState)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE,
navStateKey);
+ if (windowNavState == null)
+ {
+ windowNavState = new WindowNavigationalState();
+ context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, navStateKey,
windowNavState);
+ }
+ Mode mode = windowNavState.getMode();
+ WindowState windowState = windowNavState.getWindowState();
+
+ //
+ RenderInvocation invocation = PortletInvocationFactory.createRender(
+ context,
+ mode,
+ windowState,
+ navigationalState,
+ window,
+ portal);
+
+ //
+ String windowTitle;
+ String contentChars;
+ String headerChars = null;
+ Map actionMap = new HashMap();
+ Map windowProps = window.getDeclaredProperties();
+
+ //
+ try
+ {
+ // Obtain instance
+ Instance instance = findInstance(cmd);
+
+ // No instance means we can't continue
+ if (instance == null)
+ {
+ throw new ResourceNotFoundException(window.getURI());
+ }
+
+ //
+ PortletInvocationResponse response;
+ try
+ {
+ before(cmd, invocation);
+ response = instance.invoke(invocation);
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof NoSuchPortletException)
+ {
+ throw new
ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
+ }
+ else
+ {
+ throw new ControllerException(e);
+ }
+ }
+ finally
+ {
+ after(cmd, invocation);
+ }
+
+ //
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)response;
+ windowTitle = fragment.getTitle();
+ if (windowTitle == null)
+ {
+ windowTitle = window.getName();
+ }
+ headerChars = fragment.getHeader();
+
+ //
+ List supportedWindowStates = new ArrayList();
+ for (Iterator i =
instance.getPortlet().getInfo().getCapabilities().getAllWindowStates().iterator();
i.hasNext();)
+ {
+ WindowStateInfo windowStateInfo = (WindowStateInfo)i.next();
+ WindowState tmp = windowStateInfo.getWindowState();
+ if (portal.getSupportedWindowStates().contains(tmp))
+ {
+ supportedWindowStates.add(tmp);
+ }
+ }
+
+ //
+ List supportedModes = new ArrayList();
+ for (Iterator i =
instance.getPortlet().getInfo().getCapabilities().getAllModes().iterator(); i.hasNext();)
+ {
+ ModeInfo modeInfo = (ModeInfo)i.next();
+ Mode tmp = modeInfo.getMode();
+ if (portal.getSupportedModes().contains(tmp))
+ {
+ supportedModes.add(tmp);
+ }
+ }
+
+ // Remove edit mode if the user is not logged it
+ if
(context.getServerInvocation().getServerContext().getClientRequest().getUserPrincipal() ==
null)
+ {
+ supportedModes.remove(Mode.EDIT);
+ }
+
+ //
+ addModeActions(context, window, actionMap, windowNavState.getMode(),
supportedModes);
+
+ //
+ addStateActions(context, window, actionMap, windowNavState.getWindowState(),
supportedWindowStates);
+
+ //
+ contentChars = fragment.getContent();
+
+ //
+ return new WindowResult(
+ windowTitle,
+ contentChars,
+ actionMap,
+ windowProps,
+ new Properties(),
+ headerChars,
+ windowNavState.getWindowState(),
+ windowNavState.getMode());
+ }
+ else if (response instanceof ErrorResponse)
+ {
+ ErrorResponse errorResult = (ErrorResponse)response;
+ String logMessage = "Rendering portlet window " + windowId + "
triggered the following error :";
+ errorResult.logErrorTo(log, logMessage);
+ String property = cfg.getProperty(RenderWindowCommand.WINDOW_ERROR);
+ if (!RenderWindowCommand.HIDE.equals(property))
+ {
+ windowTitle = "An error occured while rendering window '" +
windowId + "'";
+ contentChars = errorResult.getMessage();
+ Throwable t = errorResult.getThrowable();
+ if (t != null && RenderWindowCommand.SHOW.equals(property))
+ {
+ contentChars = Exceptions.toHTML(t, true);
+ }
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
+ }
+ }
+ else if (response instanceof UnavailableResponse)
+ {
+ if
(RenderWindowCommand.SHOW.equals(cfg.getProperty(RenderWindowCommand.WINDOW_UNAVAILABLE)))
+ {
+ windowTitle = "Portlet unavailable";
+ contentChars = "Portlet unavailable";
+ actionMap = new HashMap();
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
+ }
+ }
+ else if (response instanceof InsufficientPrivilegesResponse)
+ {
+ // Julien : go to the section below, I know it is very ugly
+ throw new ResourceAccessDeniedException(windowId.toString());
+ }
+ else
+ {
+ return new PortletWindowResponse(windowId, response);
+ }
+ }
+ catch (ResourceAccessDeniedException e)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Window access denied", e);
+ }
+ if
(RenderWindowCommand.SHOW.equals(cfg.getProperty(RenderWindowCommand.WINDOW_ACCESS_DENIED)))
+ {
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ windowTitle = "Access denied";
+ contentChars = "Access denied";
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
+ }
+ }
+ catch (ResourceNotFoundException e)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Window not found", e);
+ }
+ if
(RenderWindowCommand.SHOW.equals(cfg.getProperty(RenderWindowCommand.WINDOW_NOT_FOUND)))
+ {
+ actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
+ windowTitle = "Cannot render";
+ contentChars = "Object not found " + e.getRef();
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
+ }
+ }
+ catch (ControllerException e)
+ {
+ // It's a CommandException that we rethrow
+ throw e;
+ }
+ catch (Exception e)
+ {
+ log.error("Rendering portlet window " + windowId + " produced an
internal error", e);
+ String property = cfg.getProperty(RenderWindowCommand.WINDOW_INTERNAL_ERROR);
+ if (RenderWindowCommand.SHOW.equals(property))
+ {
+ windowTitle = "An internal error occured while rendering window
'" + window + "'";
+ contentChars = Exceptions.toHTML(e, true);
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
+ }
+ }
+
+ //
+ return null;
+ }
+
+ protected void before(RenderWindowCommand cmd, PortletInvocation invocation)
+ {
+ }
+
+ protected void after(RenderWindowCommand cmd, PortletInvocation invocation)
+ {
+ }
+
+ /**
+ * Create the action URLs for the allowed window states of the rendered portlet window
and add them to the provided
+ * actionMap.
+ */
+ private void addStateActions(ControllerContext context, Window window, Map actionMap,
WindowState currentWindowState, List supportedWindowStates)
+ {
+ List windowStates = new ArrayList(supportedWindowStates.size());
+ for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
+ {
+ WindowState windowState = (WindowState)j.next();
+ String url = createUpdateNavigationalStateURL(context, window, null,
windowState);
+ boolean disabled = windowState.equals(currentWindowState);
+ WindowResult.Action action = new WindowResult.Action(windowState, url,
!disabled);
+ windowStates.add(action);
+ }
+ actionMap.put(WindowResult.WINDOWSTATES_KEY, windowStates);
+ }
+
+ /**
+ * Create the action URLs for the allowed portlet modes of the rendered portlet window
and add them to the provided
+ * actionMap.
+ */
+ private void addModeActions(ControllerContext context, Window window, Map actionMap,
Mode currentMode, List supportedModes)
+ {
+ List modes = new ArrayList(supportedModes.size());
+ for (Iterator j = supportedModes.iterator(); j.hasNext();)
+ {
+ Mode mode = (Mode)j.next();
+ String url = createUpdateNavigationalStateURL(context, window, mode, null);
+ boolean disabled = mode.equals(currentMode);
+ WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
+ modes.add(action);
+ }
+ actionMap.put(WindowResult.MODES_KEY, modes);
+ }
+
+ private String createUpdateNavigationalStateURL(ControllerContext context, Window
window, Mode mode, WindowState windowState)
+ {
+ InvokePortletWindowRenderCommand cmd = new
InvokePortletWindowRenderCommand(window.getId(), mode, windowState);
+ ServerInvocationContext serverContext =
context.getServerInvocation().getServerContext();
+ boolean secure = serverContext.getURLContext().isSecure();
+ boolean authenticated = serverContext.getURLContext().isAuthenticated();
+ URLContext urlContext = URLContext.newInstance(secure, authenticated);
+ return context.renderURL(cmd, urlContext, URLFormat.newInstance(true, true));
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -24,6 +24,8 @@
import org.jboss.portal.core.model.content.ContentType;
+import java.util.Collection;
+
/**
* A registry for content handlers.
*
@@ -32,7 +34,15 @@
*/
public interface ContentHandlerRegistry
{
+
/**
+ * Return the set of known content types by the registry.
+ *
+ * @return the set of content types
+ */
+ Collection getContentTypes();
+
+ /**
* Register an handler
*
* @param contentType the content type the handler will handle
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 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPageCommand.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -33,7 +33,6 @@
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.core.model.content.ContentType;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserProfileModule;
import org.jboss.portal.security.PortalSecurityException;
@@ -61,7 +60,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import java.lang.reflect.Constructor;
/**
* Render a full page.
@@ -215,29 +213,9 @@
boolean visible = true;
if (visible)
{
- ContentType contentType = window.getContentType();
+ RenderWindowCommand renderCmd = new
RenderWindowCommand(window.getId());
//
- RenderWindowCommand renderCmd = null;
- if (ContentType.PORTLET.equals(contentType))
- {
- renderCmd = new RenderPortletWindowCommand(window.getId());
- }
- else if (ContentType.CMS.equals(contentType))
- {
- // Weak integration for now, fix that later
- try
- {
- Class clazz =
Thread.currentThread().getContextClassLoader().loadClass("org.jboss.portal.core.cms.command.RenderCMSWindowCommand");
- Constructor ctor = clazz.getConstructor(new
Class[]{PortalObjectId.class});
- renderCmd = (RenderWindowCommand)ctor.newInstance(new
Object[]{window.getId()});
- }
- catch (Exception e)
- {
- }
- }
-
- //
Object res = null;
//
Deleted:
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 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPortletWindowCommand.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -1,373 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.command;
-
-import org.jboss.portal.identity.User;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.controller.ResourceNotFoundException;
-import org.jboss.portal.core.controller.ResourceAccessDeniedException;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Properties;
-import org.jboss.portal.portlet.info.WindowStateInfo;
-import org.jboss.portal.portlet.info.ModeInfo;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
-import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
-import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.Exceptions;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Collections;
-
-/**
- * Render a single window.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class RenderPortletWindowCommand extends RenderWindowCommand
-{
-
- public RenderPortletWindowCommand(PortalObjectId windowId) throws
IllegalArgumentException
- {
- super(windowId);
- }
-
- public void create() throws ControllerException
- {
- super.create();
- }
-
- protected Instance findInstance()
- {
- // We need the user id
- User user = getControllerContext().getUser();
-
- // Get instance
- return context.getController().getCustomizationManager().getInstance(window,
user);
- }
-
- protected void before(PortletInvocation invocation)
- {
-
- }
-
- protected void after(PortletInvocation invocation)
- {
-
- }
-
- public Object execute() throws ControllerException
- {
- //
- ServerConfig cfg =
getControllerContext().getServerInvocation().getRequest().getServer().getConfig();
-
- //
- PortalObjectId windowId = window.getId();
-
- //
- StateString navigationalState = (StateString)getAttribute(NAVIGATIONAL_STATE_SCOPE,
windowId);
-
- // Get mode and window state
- String navStateKey = windowId + "_window";
- WindowNavigationalState windowNavState =
(WindowNavigationalState)getAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey);
- if (windowNavState == null)
- {
- windowNavState = new WindowNavigationalState();
- setAttribute(NAVIGATIONAL_STATE_SCOPE, navStateKey, windowNavState);
- }
- Mode mode = windowNavState.getMode();
- WindowState windowState = windowNavState.getWindowState();
-
- //
- RenderInvocation invocation = PortletInvocationFactory.createRender(
- context,
- mode,
- windowState,
- navigationalState,
- window,
- portal);
-
- //
- String windowTitle;
- String contentChars;
- String headerChars = null;
- Map actionMap = new HashMap();
- Map windowProps = window.getDeclaredProperties();
-
- //
- try
- {
- // Obtain instance
- Instance instance = findInstance();
- if (instance == null)
- {
- // No instance means we can't continue
- throw new ResourceNotFoundException(window.getURI());
- }
-
- //
- PortletInvocationResponse response;
- try
- {
- before(invocation);
- response = instance.invoke(invocation);
- }
- catch (PortletInvokerException e)
- {
- if (e instanceof NoSuchPortletException)
- {
- throw new
ResourceNotFoundException(((NoSuchPortletException)e).getPortletId());
- }
- else
- {
- throw new ControllerException(e);
- }
- }
- finally
- {
- after(invocation);
- }
-
- //
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
- windowTitle = fragment.getTitle();
- if (windowTitle == null)
- {
- windowTitle = window.getName();
- }
- headerChars = fragment.getHeader();
-
- //
- List supportedWindowStates = new ArrayList();
- for (Iterator i =
instance.getPortlet().getInfo().getCapabilities().getAllWindowStates().iterator();
i.hasNext();)
- {
- WindowStateInfo windowStateInfo = (WindowStateInfo)i.next();
- WindowState tmp = windowStateInfo.getWindowState();
- if (portal.getSupportedWindowStates().contains(tmp))
- {
- supportedWindowStates.add(tmp);
- }
- }
-
- //
- List supportedModes = new ArrayList();
- for (Iterator i =
instance.getPortlet().getInfo().getCapabilities().getAllModes().iterator(); i.hasNext();)
- {
- ModeInfo modeInfo = (ModeInfo)i.next();
- Mode tmp = modeInfo.getMode();
- if (portal.getSupportedModes().contains(tmp))
- {
- supportedModes.add(tmp);
- }
- }
-
- // Remove edit mode if the user is not logged it
- if
(getControllerContext().getServerInvocation().getServerContext().getClientRequest().getUserPrincipal()
== null)
- {
- supportedModes.remove(Mode.EDIT);
- }
-
- //
- addModeActions(window, actionMap, windowNavState.getMode(), supportedModes);
-
- //
- addStateActions(window, actionMap, windowNavState.getWindowState(),
supportedWindowStates);
-
- //
- contentChars = fragment.getContent();
-
- //
- return new WindowResult(
- windowTitle,
- contentChars,
- actionMap,
- windowProps,
- new Properties(),
- headerChars,
- windowNavState.getWindowState(),
- windowNavState.getMode());
- }
- else if (response instanceof ErrorResponse)
- {
- ErrorResponse errorResult = (ErrorResponse)response;
- 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 '" +
windowId + "'";
- contentChars = errorResult.getMessage();
- Throwable t = errorResult.getThrowable();
- if (t != null && SHOW.equals(property))
- {
- contentChars = Exceptions.toHTML(t, true);
- }
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
- }
- }
- else if (response instanceof UnavailableResponse)
- {
- if (SHOW.equals(cfg.getProperty(WINDOW_UNAVAILABLE)))
- {
- windowTitle = "Portlet unavailable";
- contentChars = "Portlet unavailable";
- actionMap = new HashMap();
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
- }
- }
- else if (response instanceof InsufficientPrivilegesResponse)
- {
- // Julien : go to the section below, I know it is very ugly
- throw new ResourceAccessDeniedException(windowId.toString());
- }
- else
- {
- return new PortletWindowResponse(windowId, response);
- }
- }
- catch (ResourceAccessDeniedException e)
- {
- if (log.isTraceEnabled())
- {
- log.trace("Window access denied", e);
- }
- if (SHOW.equals(cfg.getProperty(WINDOW_ACCESS_DENIED)))
- {
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- windowTitle = "Access denied";
- contentChars = "Access denied";
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
- }
- }
- catch (ResourceNotFoundException e)
- {
- if (log.isTraceEnabled())
- {
- log.trace("Window not found", e);
- }
- if (SHOW.equals(cfg.getProperty(WINDOW_NOT_FOUND)))
- {
- actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIST);
- actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
- windowTitle = "Cannot render";
- contentChars = "Object not found " + e.getRef();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
- }
- }
- catch (ControllerException e)
- {
- // It's a CommandException that we rethrow
- throw e;
- }
- catch (Exception e)
- {
- log.error("Rendering portlet window " + windowId + " produced an
internal error", e);
- String property = cfg.getProperty(WINDOW_INTERNAL_ERROR);
- if (SHOW.equals(property))
- {
- windowTitle = "An internal error occured while rendering window
'" + window + "'";
- contentChars = Exceptions.toHTML(e, true);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNavState.getWindowState(),
windowNavState.getMode());
- }
- }
-
- //
- return null;
- }
-
- /**
- * Create the action URLs for the allowed window states of the rendered portlet window
and add them to the provided
- * actionMap.
- */
- private void addStateActions(Window window, Map actionMap, WindowState
currentWindowState, List supportedWindowStates)
- {
- List windowStates = new ArrayList(supportedWindowStates.size());
- for (Iterator j = supportedWindowStates.iterator(); j.hasNext();)
- {
- WindowState windowState = (WindowState)j.next();
- String url = createUpdateNavigationalStateURL(window, null, windowState);
- boolean disabled = windowState.equals(currentWindowState);
- WindowResult.Action action = new WindowResult.Action(windowState, url,
!disabled);
- windowStates.add(action);
- }
- actionMap.put(WindowResult.WINDOWSTATES_KEY, windowStates);
- }
-
- /**
- * Create the action URLs for the allowed portlet modes of the rendered portlet window
and add them to the provided
- * actionMap.
- */
- private void addModeActions(Window window, Map actionMap, Mode currentMode, List
supportedModes)
- {
- List modes = new ArrayList(supportedModes.size());
- for (Iterator j = supportedModes.iterator(); j.hasNext();)
- {
- Mode mode = (Mode)j.next();
- String url = createUpdateNavigationalStateURL(window, mode, null);
- boolean disabled = mode.equals(currentMode);
- WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
- modes.add(action);
- }
- actionMap.put(WindowResult.MODES_KEY, modes);
- }
-
- private String createUpdateNavigationalStateURL(Window window, Mode mode, WindowState
windowState)
- {
- InvokePortletWindowRenderCommand cmd = new
InvokePortletWindowRenderCommand(window.getId(), mode, windowState);
- ControllerContext controllerContext = getControllerContext();
- ServerInvocationContext serverContext =
controllerContext.getServerInvocation().getServerContext();
- boolean secure = serverContext.getURLContext().isSecure();
- boolean authenticated = serverContext.getURLContext().isAuthenticated();
- URLContext urlContext = URLContext.newInstance(secure, authenticated);
- return controllerContext.renderURL(cmd, urlContext, URLFormat.newInstance(true,
true));
- }
-}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderWindowCommand.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -24,35 +24,39 @@
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
+import org.jboss.portal.core.model.portal.content.ContentRenderer;
+import org.jboss.portal.core.model.content.ContentType;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class RenderWindowCommand extends WindowCommand
+public class RenderWindowCommand extends WindowCommand
{
/** . */
- protected static String WINDOW_ACCESS_DENIED =
"core.render.window_access_denied";
+ public static final String WINDOW_ACCESS_DENIED =
"core.render.window_access_denied";
/** . */
- protected static String WINDOW_UNAVAILABLE =
"core.render.window_unavailable";
+ public static final String WINDOW_UNAVAILABLE =
"core.render.window_unavailable";
/** . */
- protected static String WINDOW_ERROR = "core.render.window_error";
+ public static final String WINDOW_ERROR = "core.render.window_error";
/** . */
- protected static String WINDOW_INTERNAL_ERROR =
"core.render.window_internal_error";
+ public static final String WINDOW_INTERNAL_ERROR =
"core.render.window_internal_error";
/** . */
- protected static String WINDOW_NOT_FOUND = "core.render.window_not_found";
+ public static final String WINDOW_NOT_FOUND =
"core.render.window_not_found";
/** . */
- protected static String HIDE = "hide";
+ public static final String HIDE = "hide";
/** . */
- protected static String SHOW = "show";
+ public static final String SHOW = "show";
/** . */
private static final CommandInfo info = new ViewCommandInfo(true, "view");
@@ -67,4 +71,29 @@
{
return info;
}
+
+ public Object execute() throws ControllerException
+ {
+ ContentRendererRegistry registry =
context.getController().getContentRendererRegistry();
+
+ ContentType contentType = window.getContentType();
+
+ ContentRenderer renderer = registry.getRenderer(contentType);
+
+ if (renderer == null)
+ {
+ return null;
+ }
+ else
+ {
+ try
+ {
+ return renderer.renderWindow(this);
+ }
+ catch (Exception e)
+ {
+ throw new ControllerException(e);
+ }
+ }
+ }
}
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRenderer.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.content;
+
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ContentRenderer
+{
+ Object renderWindow(RenderWindowCommand cmd) throws Exception;
+}
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererRegistry.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererRegistry.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/content/ContentRendererRegistry.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * 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.content;
+
+import org.jboss.portal.core.model.content.ContentType;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ContentRendererRegistry
+{
+
+ /**
+ *
+ * @return
+ */
+ Collection getContentTypes();
+
+ /**
+ *
+ * @param contentType
+ * @param renderer
+ */
+ void registerRenderer(ContentType contentType, ContentRenderer renderer);
+
+ /**
+ *
+ * @param contentType
+ */
+ void unregisterRenderer(ContentType contentType);
+
+ /**
+ *
+ * @param contentType
+ * @return
+ */
+ ContentRenderer getRenderer(ContentType contentType);
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistry.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -32,7 +32,7 @@
*/
public interface ContentEditorRegistry
{
- Set getRegisteredContentTypes();
+ Set getContentTypes();
void registerEditor(ContentType contentType, ContentEditor editor);
void unregisterEditor(ContentType contentType);
ContentEditor getEditor(ContentType contentType);
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/ContentEditorRegistryService.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -43,7 +43,7 @@
registry = new CopyOnWriteRegistry();
}
- public Set getRegisteredContentTypes()
+ public Set getContentTypes()
{
return registry.getKeys();
}
@@ -60,6 +60,6 @@
public ContentEditor getEditor(ContentType contentType)
{
- return (ContentEditor)registry.get(contentType);
+ return (ContentEditor)registry.getRegistration(contentType);
}
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-02-05
20:38:32 UTC (rev 6163)
@@ -870,6 +870,52 @@
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
</mbean>
+ <!-- The content editor registry -->
+ <mbean
+
code="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistryService"
+ name="portal:service=ContentEditorRegistry"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
+ code="org.jboss.portal.core.portlet.dashboard.PortletContentEditor"
+ name="portal:service=ContentEditor,type=portlet"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:service=ContentEditorRegistry</depends>
+ <depends
+ optional-attribute-name="InstanceContainer"
+ proxy-type="attribute">portal:container=Instance</depends>
+ <attribute name="ContentType">portlet</attribute>
+ </mbean>
+
+ <!-- The content renderer registry -->
+ <mbean
+
code="org.jboss.portal.core.impl.model.portal.content.ContentRendererRegistryService"
+ name="portal:service=ContentRendererRegistry"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
+
code="org.jboss.portal.core.impl.model.portal.content.PortletContentRenderer"
+ name="portal:service=ContentRenderer,type=portlet"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="ContentType">portlet</attribute>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:service=ContentRendererRegistry</depends>
+ <depends
+ optional-attribute-name="CustomizationManager"
+
proxy-type="attribute">portal:service=CustomizationManager</depends>
+ </mbean>
+
<!-- The core controller -->
<mbean
code="org.jboss.portal.core.controller.classic.ClassicController"
@@ -901,6 +947,9 @@
<depends
optional-attribute-name="CustomizationManager"
proxy-type="attribute">portal:service=CustomizationManager</depends>
+ <depends
+ optional-attribute-name="ContentRendererRegistry"
+
proxy-type="attribute">portal:service=ContentRendererRegistry</depends>
</mbean>
<!-- The ajax controller -->
@@ -1115,25 +1164,4 @@
proxy-type="attribute">portal:service=EntityResolver</depends>
</mbean>
- <mbean
-
code="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistryService"
- name="portal:registry=ContentEditor"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.core.portlet.dashboard.PortletContentEditor"
- name="portal:service=ContentEditor,type=portlet"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
-
proxy-type="attribute">portal:registry=ContentEditor</depends>
- <depends
- optional-attribute-name="InstanceContainer"
- proxy-type="attribute">portal:container=Instance</depends>
- <attribute name="ContentType">portlet</attribute>
- </mbean>
</server>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp 2007-02-05
20:38:32 UTC (rev 6163)
@@ -230,7 +230,7 @@
%>
<div>
<%
- for (Iterator i = registry.getRegisteredContentTypes().iterator();i.hasNext();)
+ for (Iterator i = registry.getContentTypes().iterator(); i.hasNext();)
{
ContentType ct = (ContentType)i.next();
%>
Deleted:
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/command/RenderCMSWindowCommand.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -1,117 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.cms.command;
-
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.command.RenderPortletWindowCommand;
-import org.jboss.portal.core.impl.model.content.cms.CMSContent;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.controller.ControllerException;
-import org.jboss.portal.core.cms.ui.CMSPortlet;
-import org.jboss.portal.core.cms.CMSConstants;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.server.config.ServerConfig;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RenderCMSWindowCommand extends RenderPortletWindowCommand
-{
-
- public RenderCMSWindowCommand(PortalObjectId windowId)
- throws IllegalArgumentException
- {
- super(windowId);
- }
-
- protected Instance findInstance()
- {
- PortalObjectId windowId = window.getId();
-
- //
- CMSContent content = (CMSContent)window.getContent();
- String uri = content.getURI();
-
- // Initialize the navigational state with the URI when needed
- PortletParametersStateString navigationalState =
(PortletParametersStateString)getAttribute(NAVIGATIONAL_STATE_SCOPE, windowId);
- if (navigationalState == null)
- {
- navigationalState = new PortletParametersStateString();
- navigationalState.setValue("path", uri);
- setAttribute(NAVIGATIONAL_STATE_SCOPE, windowId, navigationalState);
- }
-
- // Make that configurable
- InstanceContainer container =
getControllerContext().getController().getInstanceContainer();
- return container.getDefinition("CMSPortletInstance");
- }
-
- protected void before(PortletInvocation invocation)
- {
- // Find out if we are invoking the content portlet
- ServerConfig cfg =
getControllerContext().getServerInvocation().getRequest().getServer().getConfig();
-
- // Set the request property for it
- String windowRef =
cfg.getProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME);
- if (window.getId().toString(PortalObjectId.LEGACY_FORMAT).equals(windowRef))
- {
- invocation.setAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS, "true");
- }
- }
-
- protected void after(PortletInvocation invocation)
- {
- // Cleanup request property
- invocation.removeAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS);
- }
-
- public Object execute() throws ControllerException
- {
- Object o = super.execute();
-
- //
- if (o instanceof WindowResult)
- {
- WindowResult result = (WindowResult)o;
-
- //
- Map props = new HashMap(result.getWindowProperties());
- props.put("theme.windowRendererId", "emptyRenderer");
- props.put("theme.decorationRendererId", "emptyRenderer");
- props.put("theme.portletRendererId", "emptyRenderer");
-
- //
- result.setWindowProperties(props);
- }
-
- //
- return o;
- }
-}
Added: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java
(rev 0)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentRenderer.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * 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.cms.content;
+
+import org.jboss.portal.core.impl.model.portal.content.PortletContentRenderer;
+import org.jboss.portal.core.impl.model.content.cms.CMSContent;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.command.RenderWindowCommand;
+import org.jboss.portal.core.cms.CMSConstants;
+import org.jboss.portal.core.cms.ui.CMSPortlet;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.server.config.ServerConfig;
+import org.jboss.portal.theme.page.WindowResult;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CMSContentRenderer extends PortletContentRenderer
+{
+
+ protected Instance findInstance(RenderWindowCommand cmd)
+ {
+ ControllerContext context = cmd.getControllerContext();
+
+ // The window
+ Window window = cmd.getWindow();
+ PortalObjectId windowId = window.getId();
+
+ //
+ CMSContent content = (CMSContent)window.getContent();
+ String uri = content.getURI();
+
+ // Initialize the navigational state with the URI when needed
+ PortletParametersStateString navigationalState =
(PortletParametersStateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE,
windowId);
+ if (navigationalState == null)
+ {
+ navigationalState = new PortletParametersStateString();
+ navigationalState.setValue("path", uri);
+ context.setAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId,
navigationalState);
+ }
+
+ // Make that configurable
+ InstanceContainer container = context.getController().getInstanceContainer();
+ return container.getDefinition("CMSPortletInstance");
+ }
+
+ protected void before(RenderWindowCommand cmd, PortletInvocation invocation)
+ {
+ // Find out if we are invoking the content portlet
+ ServerConfig cfg =
cmd.getControllerContext().getServerInvocation().getRequest().getServer().getConfig();
+
+ //
+ Window window = cmd.getWindow();
+
+ // Set the request property for it
+ String windowRef =
cfg.getProperty(CMSConstants.DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME);
+ if (window.getId().toString(PortalObjectId.LEGACY_FORMAT).equals(windowRef))
+ {
+ invocation.setAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS, "true");
+ }
+ }
+
+ protected void after(RenderWindowCommand cmd, PortletInvocation invocation)
+ {
+ // Cleanup request property
+ invocation.removeAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE,
CMSPortlet.REQUEST_PROPERTY_USE_GLOBAL_URLS);
+ }
+
+ public Object renderWindow(RenderWindowCommand cmd) throws Exception
+ {
+ Object o = super.renderWindow(cmd);
+
+ //
+ if (o instanceof WindowResult)
+ {
+ WindowResult result = (WindowResult)o;
+
+ //
+ Map props = new HashMap(result.getWindowProperties());
+ props.put("theme.windowRendererId", "emptyRenderer");
+ props.put("theme.decorationRendererId", "emptyRenderer");
+ props.put("theme.portletRendererId", "emptyRenderer");
+
+ //
+ result.setWindowProperties(props);
+ }
+
+ //
+ return o;
+ }
+}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-05
20:38:32 UTC (rev 6163)
@@ -661,6 +661,7 @@
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Server</depends>
</mbean>
+ <!-- Content editor integration -->
<mbean
code="org.jboss.portal.core.cms.editor.CMSContentEditor"
name="portal:service=ContentEditor,type=cms"
@@ -669,10 +670,23 @@
<xmbean/>
<depends
optional-attribute-name="Registry"
-
proxy-type="attribute">portal:registry=ContentEditor</depends>
+
proxy-type="attribute">portal:service=ContentEditorRegistry</depends>
<depends
optional-attribute-name="CMS"
proxy-type="attribute">portal:service=CMS</depends>
<attribute name="ContentType">cms</attribute>
</mbean>
+
+ <!-- Content renderer integration -->
+ <mbean
+ code="org.jboss.portal.core.cms.content.CMSContentRenderer"
+ name="portal:service=ContentRenderer,type=cms"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="ContentType">cms</attribute>
+ <depends
+ optional-attribute-name="Registry"
+
proxy-type="attribute">portal:service=ContentRendererRegistry</depends>
+ </mbean>
</server>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-02-05
17:29:10 UTC (rev 6162)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -62,7 +62,7 @@
public Object getObject(String name) throws IdentityException
{
- Object o = registry.get(name);
+ Object o = registry.getRegistration(name);
if (o == null)
{
throw new IdentityException("No such mapping in IdentityContext: " +
name);
Modified:
trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java
===================================================================
---
trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java 2007-02-05
17:29:10 UTC (rev 6162)
+++
trunk/security/src/main/org/jboss/portal/security/impl/JBossAuthorizationDomainRegistryImpl.java 2007-02-05
20:38:32 UTC (rev 6163)
@@ -27,8 +27,6 @@
import org.jboss.portal.common.util.CopyOnWriteRegistry;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
/**
* MBean to allow access to the policy config service and the policy configs stored
within.
@@ -65,7 +63,7 @@
public AuthorizationDomain getDomain(String domainType)
{
- return (AuthorizationDomain)domains.get(domainType);
+ return (AuthorizationDomain)domains.getRegistration(domainType);
}
public Collection getDomains()