JBoss Portal SVN: r6163 - in trunk: common/src/main/org/jboss/portal/test/common and 17 other directories.
by portal-commits@lists.jboss.org
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()
19 years, 2 months
JBoss Portal SVN: r6162 - in trunk/core/src/main/org/jboss/portal: core/impl/model/content/portlet and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 12:29:10 -0500 (Mon, 05 Feb 2007)
New Revision: 6162
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/portlet/PortletContent.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContentHandler.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandler.java
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.java
trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java
Log:
javadoc for the content handler framework
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:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/AbstractContentHandler.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -85,11 +85,11 @@
}
}
- public void createContent(String contextId, ContentState state)
+ public void contentCreated(String contextId, ContentState state)
{
}
- public void destroyContent(String contextId, ContentState state)
+ public void contentDestroyed(String contextId, ContentState state)
{
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -76,7 +76,7 @@
//
if (currentInstanceRef != null && currentInstanceRef.equals(instanceRef) == false)
{
- handler.destroyContent(contextId, state);
+ handler.contentDestroyed(contextId, state);
}
//
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContentHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContentHandler.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContentHandler.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -54,7 +54,7 @@
return new PortletContent(this, contextId, state);
}
- public void destroyContent(String contextId, ContentState state)
+ public void contentDestroyed(String contextId, ContentState state)
{
String instanceRef = state.getURI();
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/WindowImpl.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -206,7 +206,7 @@
ContentHandler handler = getContentHandler();
//
- handler.destroyContent(contextId, this);
+ handler.contentDestroyed(contextId, this);
}
private Content getContent()
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -25,12 +25,17 @@
import org.jboss.portal.common.util.LocalizedString;
/**
- * The content.
+ * Defines the base interface for content.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface Content
{
+ /**
+ * Return a localized display name of the content.
+ *
+ * @return the content display name
+ */
LocalizedString getDisplayName();
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -23,6 +23,8 @@
package org.jboss.portal.core.model.content;
/**
+ * Type safe string for notion of content type.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -74,6 +76,13 @@
return value;
}
+ /**
+ * Factory method to create objects.
+ *
+ * @param value the wrapped value
+ * @return the corresponding content type
+ * @throws IllegalArgumentException if the string argument is null
+ */
public static ContentType create(String value) throws IllegalArgumentException
{
if ("portlet".equals(value))
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandler.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandler.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -25,23 +25,39 @@
import org.jboss.portal.core.model.content.Content;
/**
+ * The content handler act as a factory for <code>Content</code> objects from their state. The interface
+ * receives also callbacks of the content lifecycle in order to be able to manage additional resources
+ * related to the content.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ContentHandler
{
/**
- * Factory method to create an instance of window content object.
+ * Factory method that creates an instance of content object. This method is called
+ * whenever the frameworks needs a runtime representation of the content state which
+ * can be used at runtime by content clients.
+ *
+ * @param contextId the context id in which the state is used
+ * @param state the state
+ * @return the content interface implementation
*/
Content newContent(String contextId, ContentState state);
/**
- * Life cycle method to signal creation.
+ * Life cycle method to signal state creation.
+ *
+ * @param contextId the context id in which the state is created
+ * @param state the state
*/
- void createContent(String contextId, ContentState state);
+ void contentCreated(String contextId, ContentState state);
/**
- * Life cycle method to signal destruction.
+ * Life cycle method to signal state destruction.
+ *
+ * @param contextId the context id in which the state is destroyed
+ * @param state the state
*/
- void destroyContent(String contextId, ContentState state);
+ void contentDestroyed(String contextId, ContentState state);
}
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:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentHandlerRegistry.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -25,29 +25,36 @@
import org.jboss.portal.core.model.content.ContentType;
/**
+ * A registry for content handlers.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ContentHandlerRegistry
{
/**
+ * Register an handler
*
- * @param contentType
- * @param handler
- * @throws IllegalArgumentException
+ * @param contentType the content type the handler will handle
+ * @param handler the handler
+ * @throws IllegalArgumentException if the content type or the handler is null
*/
void registerHandler(ContentType contentType, ContentHandler handler) throws IllegalArgumentException;
/**
+ * Return an handler for the specified content type or null if it is not found
*
- * @param contentType
- * @return
+ * @param contentType the content type
+ * @return the handler
+ * @throws IllegalArgumentException if the content type is null
*/
- ContentHandler getHandler(ContentType contentType);
+ ContentHandler getHandler(ContentType contentType) throws IllegalArgumentException;
/**
- *
- * @param contentType
+ * Unregister the handler for the specified content type.
+ *
+ * @param contentType the content type of the handler to unregister.
+ * @throws IllegalArgumentException if the content type is null
*/
- void unregisterHandler(ContentType contentType);
+ void unregisterHandler(ContentType contentType) throws IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/spi/ContentState.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -23,36 +23,41 @@
package org.jboss.portal.core.model.content.spi;
/**
+ * Represents the state of the content which consist in an URI and a set of properties.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ContentState
{
/**
+ * Returns the URI value.
*
- * @return
+ * @return the URI
*/
String getURI();
/**
- *
- * @return
+ * Set the URI value.
*/
void setURI(String uri);
/**
- * Set a content property, the property name must not be null and must start with the litteral 'content.'.
+ * Set a content property, the property name must be prefixed by the litteral 'content.'.
*
* @param name the property name
* @param value the property value
+ * @throws IllegalArgumentException if the name is null or is not prefixed by the litteral 'content.'.
*/
- void setProperty(String name, String value);
+ void setProperty(String name, String value) throws IllegalArgumentException;
/**
- * Retrieve a content property
+ * Return a property of the content state.
*
* @param name the property name
* @return the property value or null if it does not exist
+ * @throws IllegalArgumentException if the name is null or is not prefixed by the litteral 'content.'.
+ * @see #setProperty(String, String)
*/
- String getProperty(String name);
+ String getProperty(String name) throws IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java 2007-02-05 17:12:13 UTC (rev 6161)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContentHandler.java 2007-02-05 17:29:10 UTC (rev 6162)
@@ -25,8 +25,6 @@
import org.jboss.portal.core.model.content.spi.ContentState;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.impl.model.content.AbstractContentHandler;
-import org.jboss.portal.common.NotYetImplemented;
-import org.w3c.dom.Element;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -39,11 +37,11 @@
return new NullContent(contextId, state);
}
- public void createContent(String contextId, ContentState state)
+ public void contentCreated(String contextId, ContentState state)
{
}
- public void destroyContent(String contextId, ContentState state)
+ public void contentDestroyed(String contextId, ContentState state)
{
}
}
19 years, 2 months
JBoss Portal SVN: r6161 - trunk/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 12:12:13 -0500 (Mon, 05 Feb 2007)
New Revision: 6161
Modified:
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
commenting more the portal object dtd
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 17:02:04 UTC (rev 6160)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 17:12:13 UTC (rev 6161)
@@ -159,55 +159,93 @@
<!ELEMENT page-name (#PCDATA)>
<!--
-A portal object of type window. A window type represents a window.
+A portal object of type window. A window type represents a window. Beside the common properties a window has
+a content and belong to a region on the page.
+
+The instance-ref or content tags are used to define the content of the window. The usage of the content tag
+is generic and can be used to describe any kind of content. The instance-ref is a shortcut to define a content
+type of portlet which points to a portlet instance.
+
+The region and height defines how the window is placed in the page.
-->
<!ELEMENT window (window-name,(instance-ref|content),region,height,properties?,listener?)>
<!--
+The window name value.
-->
<!ELEMENT window-name (#PCDATA)>
<!--
+Define the content of the window as a reference to a portlet instance. The value is the id of the instance.
+
+Example:
+
+<instance-ref>MyPortletInstance</instance-ref>
+
-->
<!ELEMENT instance-ref (#PCDATA)>
<!--
+Define the content of the window in a generic manner. The content is define by the type of the content
+and an URI which acts as an identificator for the content.
+
+Example:
+
+<content>
+ <content-type>portlet</content-type>
+ <content-uri>MyPortletInstance</content-uri>
+</content>
+
+<content>
+ <content-type>cms</content-type>
+ <content-uri>/default/index.html</content-uri>
+</content>
+
-->
<!ELEMENT content (content-type,content-uri)>
<!--
+The content type of the window.
-->
<!ELEMENT content-type (#PCDATA)>
<!--
+The content URI of the window.
-->
<!ELEMENT content-uri (#PCDATA)>
<!--
+The region the window belongs to.
-->
<!ELEMENT region (#PCDATA)>
<!--
+The height of the window in the particular region.
-->
<!ELEMENT height (#PCDATA)>
<!--
+Define a listener for a portal object. The value is the id of the listener.
-->
<!ELEMENT listener (#PCDATA)>
<!--
+A set of generic properties for the portal object.
-->
<!ELEMENT properties (property*)>
<!--
+A generic string property.
-->
<!ELEMENT property (name,value)>
<!--
+A name value.
-->
<!ELEMENT name (#PCDATA)>
<!--
+A value.
-->
<!ELEMENT value (#PCDATA)>
19 years, 2 months
JBoss Portal SVN: r6160 - in trunk: core-samples/src/resources/portal-samples-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 12:02:04 -0500 (Mon, 05 Feb 2007)
New Revision: 6160
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
moved the News page to portal-samples
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 16:55:45 UTC (rev 6159)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 17:02:04 UTC (rev 6160)
@@ -119,37 +119,6 @@
</portal>
</deployment>
<deployment>
- <parent-ref>default</parent-ref>
- <if-exists>keep</if-exists>
- <page>
- <page-name>News</page-name>
- <properties>
- <property>
- <name>order</name>
- <value>3</value>
- </property>
- </properties>
- <window>
- <window-name>WeatherPortletWindow</window-name>
- <instance-ref>WeatherPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NewsPortletWindow</window-name>
- <instance-ref>NewsPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NewsPortletWindow2</window-name>
- <instance-ref>NewsPortletInstance2</instance-ref>
- <region>center</region>
- <height>1</height>
- </window>
- </page>
- </deployment>
- <deployment>
<parent-ref/>
<if-exists>keep</if-exists>
<context>
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-02-05 16:55:45 UTC (rev 6159)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-02-05 17:02:04 UTC (rev 6160)
@@ -31,6 +31,37 @@
<parent-ref>default</parent-ref>
<if-exists>keep</if-exists>
<page>
+ <page-name>News</page-name>
+ <properties>
+ <property>
+ <name>order</name>
+ <value>3</value>
+ </property>
+ </properties>
+ <window>
+ <window-name>WeatherPortletWindow</window-name>
+ <instance-ref>WeatherPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>NewsPortletWindow</window-name>
+ <instance-ref>NewsPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>NewsPortletWindow2</window-name>
+ <instance-ref>NewsPortletInstance2</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>keep</if-exists>
+ <page>
<page-name>Test</page-name>
<properties>
<property>
19 years, 2 months
JBoss Portal SVN: r6159 - trunk/core/src/resources/portal-core-sar/conf/data.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:55:45 -0500 (Mon, 05 Feb 2007)
New Revision: 6159
Modified:
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
updates to the portal-object dtd
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 16:51:57 UTC (rev 6158)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 16:55:45 UTC (rev 6159)
@@ -81,9 +81,9 @@
</properties>
<security-constraint>
<policy-permission>
- <unchecked/>
<action-name>viewrecursive</action-name>
<action-name>personalizerecursive</action-name>
+ <unchecked/>
</policy-permission>
</security-constraint>
<page>
@@ -119,8 +119,8 @@
</portal>
</deployment>
<deployment>
+ <parent-ref>default</parent-ref>
<if-exists>keep</if-exists>
- <parent-ref>default</parent-ref>
<page>
<page-name>News</page-name>
<properties>
@@ -331,8 +331,8 @@
</properties>
<security-constraint>
<policy-permission>
+ <action-name>viewrecursive</action-name>
<role-name>Admin</role-name>
- <action-name>viewrecursive</action-name>
</policy-permission>
</security-constraint>
<page>
19 years, 2 months
JBoss Portal SVN: r6158 - in trunk: core/src/resources/portal-core-sar/dtd and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:51:57 -0500 (Mon, 05 Feb 2007)
New Revision: 6158
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
updates to the portal-object dtd
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 16:30:21 UTC (rev 6157)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-02-05 16:51:57 UTC (rev 6158)
@@ -32,6 +32,16 @@
<if-exists>keep</if-exists>
<portal>
<portal-name>default</portal-name>
+ <supported-modes>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
+ </supported-modes>
+ <supported-window-states>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supported-window-states>
<properties>
<!--
| Set the layout for the default portal, see also portal-layouts.xml.
@@ -69,16 +79,13 @@
<value>default</value>
</property>
</properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
+ <security-constraint>
+ <policy-permission>
+ <unchecked/>
+ <action-name>viewrecursive</action-name>
+ <action-name>personalizerecursive</action-name>
+ </policy-permission>
+ </security-constraint>
<page>
<page-name>default</page-name>
<properties>
@@ -109,13 +116,6 @@
<height>1</height>
</window>
</page>
- <security-constraint>
- <policy-permission>
- <unchecked/>
- <action-name>viewrecursive</action-name>
- <action-name>personalizerecursive</action-name>
- </policy-permission>
- </security-constraint>
</portal>
</deployment>
<deployment>
@@ -191,14 +191,6 @@
<value>true</value>
</property>
</properties>
-<!--
- <security-constraint>
- <policy-permission>
- <role-name>Authenticated</role-name>
- <action-name>view</action-name>
- </policy-permission>
- </security-constraint>
--->
</context>
</deployment>
<deployment>
@@ -206,6 +198,16 @@
<if-exists>keep</if-exists>
<portal>
<portal-name>template</portal-name>
+ <supported-modes>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
+ </supported-modes>
+ <supported-window-states>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supported-window-states>
<properties>
<!--
| Set the layout for the default portal, see also portal-layouts.xml.
@@ -243,16 +245,6 @@
<value>default</value>
</property>
</properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
<page>
<page-name>default</page-name>
<properties>
@@ -290,6 +282,16 @@
<if-exists>keep</if-exists>
<portal>
<portal-name>admin</portal-name>
+ <supported-modes>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
+ </supported-modes>
+ <supported-window-states>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supported-window-states>
<properties>
<!--
| Set the layout for the default portal, see also portal-layouts.xml.
@@ -327,16 +329,12 @@
<value>default</value>
</property>
</properties>
- <supported-modes>
- <mode>view</mode>
- <mode>edit</mode>
- <mode>help</mode>
- </supported-modes>
- <supported-window-states>
- <window-state>normal</window-state>
- <window-state>minimized</window-state>
- <window-state>maximized</window-state>
- </supported-window-states>
+ <security-constraint>
+ <policy-permission>
+ <role-name>Admin</role-name>
+ <action-name>viewrecursive</action-name>
+ </policy-permission>
+ </security-constraint>
<page>
<page-name>default</page-name>
<window>
@@ -367,12 +365,6 @@
<height>0</height>
</window>
</page>
- <security-constraint>
- <policy-permission>
- <role-name>Admin</role-name>
- <action-name>viewrecursive</action-name>
- </policy-permission>
- </security-constraint>
</portal>
</deployment>
</deployments>
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:30:21 UTC (rev 6157)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:51:57 UTC (rev 6158)
@@ -62,7 +62,7 @@
3/ security-constraint : defines security configuration of the portal object.
-->
-<!ELEMENT deployment (parent-ref,if-exists?,context|portal|page|window)>
+<!ELEMENT deployment (parent-ref,if-exists?,(context|portal|page|window))>
<!--
Contains a reference to the parent object. The naming convention for naming object
@@ -89,7 +89,7 @@
A portal object of type context. A context type represent a node in the tree which does not have
a visual representation. It can exist only under the root. A context can only have children with the portal type.
-->
-<!ELEMENT context (context-name,properties?,portal*,listener?,security-constraint?)>
+<!ELEMENT context (context-name,properties?,listener?,security-constraint?,portal*)>
<!--
The context name value.
@@ -102,7 +102,7 @@
states it supports. If no declaration of modes or window states is done then the default value will be
respectively (view,edit,help) and (normal,minimized,maximized).
-->
-<!ELEMENT portal (portal-name,properties?,supported-modes,supported-window-states?,page*,listener?,security-constraint?)>
+<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,listener?,security-constraint?,page*)>
<!--
The portal name value.
@@ -151,7 +151,7 @@
A portal object of type page. A page type represents a page which can have children of type page and window.
The children windows are the windows of the page and the children pages are the subpages of this page.
-->
-<!ELEMENT page (page-name,properties?,(page|window)*,listener?,security-constraint?)>
+<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page|window)*)>
<!--
The page name value.
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-02-05 16:30:21 UTC (rev 6157)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/default-object.xml 2007-02-05 16:51:57 UTC (rev 6158)
@@ -56,6 +56,7 @@
</window>
<page>
<page-name>event test</page-name>
+ <listener>event_listener</listener>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -74,10 +75,10 @@
<region>center</region>
<height>1</height>
</window>
- <listener>event_listener</listener>
</page>
<page>
<page-name>page event test</page-name>
+ <listener>window_event_listener</listener>
<window>
<window-name>CatalogPortletWindow1</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -114,7 +115,6 @@
<region>center</region>
<height>2</height>
</window>
- <listener>window_event_listener</listener>
</page>
<page>
<page-name>secure test</page-name>
19 years, 2 months
JBoss Portal SVN: r6157 - trunk/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:30:21 -0500 (Mon, 05 Feb 2007)
New Revision: 6157
Modified:
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
updates to the portal-object dtd
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:27:44 UTC (rev 6156)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:30:21 UTC (rev 6157)
@@ -161,7 +161,7 @@
<!--
A portal object of type window. A window type represents a window.
-->
-<!ELEMENT window (window-name,(instance-ref|content),properties?,region,height,listener?)>
+<!ELEMENT window (window-name,(instance-ref|content),region,height,properties?,listener?)>
<!--
-->
19 years, 2 months
JBoss Portal SVN: r6156 - trunk/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:27:44 -0500 (Mon, 05 Feb 2007)
New Revision: 6156
Modified:
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
updates to the portal-object dtd
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:25:36 UTC (rev 6155)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:27:44 UTC (rev 6156)
@@ -102,7 +102,7 @@
states it supports. If no declaration of modes or window states is done then the default value will be
respectively (view,edit,help) and (normal,minimized,maximized).
-->
-<!ELEMENT portal (portal-name,properties?,supported-window-states?,page*,listener?,security-constraint?)>
+<!ELEMENT portal (portal-name,properties?,supported-modes,supported-window-states?,page*,listener?,security-constraint?)>
<!--
The portal name value.
19 years, 2 months
JBoss Portal SVN: r6155 - trunk/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:25:36 -0500 (Mon, 05 Feb 2007)
New Revision: 6155
Modified:
trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
Log:
updates to the portal-object dtd
Modified: trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:00:59 UTC (rev 6154)
+++ trunk/core/src/resources/portal-core-sar/dtd/portal-object_2_6.dtd 2007-02-05 16:25:36 UTC (rev 6155)
@@ -30,68 +30,136 @@
-->
<!--
-The deployements element is a container for deployment elements.
+The deployements element is a generic container for deployment elements.
-->
<!ELEMENT deployments (deployment*)>
<!--
-The deployment is a container for an instance element.
+The deployment is a generic container for portal object elements. The parent-ref
+child gives the name of the parent object that the current object will use as parent.
+The optional if-exists element define the behavior when a portal object which an identical
+name is already child of the parent element. The default behavior of the if-exist tag is to
+keep the existing object and not create a new object. The last element is the portal object
+itself.
+
+Example:
+
+<deployment>
+ <parent-ref>default</parent-ref>
+ <page>
+ ...
+ </page>
+</deployment>
+
+All portal objects have a common configuration which can be :
+
+1/ a listener : specifies the id of a listener is the listener registry. A listener object is able to
+listen portal events which apply to the portal node hierarchy.
+
+2/ properties : a set of generic properties owned by the portal object. Some properties can drive the behavior
+of the object.
+
+3/ security-constraint : defines security configuration of the portal object.
+
-->
-<!ELEMENT deployment (parent-ref,if-exists?,(context|portal|page|window)*)>
+<!ELEMENT deployment (parent-ref,if-exists?,context|portal|page|window)>
<!--
+Contains a reference to the parent object. The naming convention for naming object
+is to concatenate the names of the path to the object and separate the names by a dot.
+If the path is empty then the empty string must be used.
+
+Example:
+
+<parent-ref/> the root having an empty path
+<parent-ref>default</parent-ref> the object with the name default under the root having the path (default)
+<parent-ref>default.default</parent-ref> the object with the path (default,default)
+
-->
<!ELEMENT parent-ref (#PCDATA)>
<!--
+The authorized values are overwrite and keep. Overwrite means that the existing object will be destroyed
+and the current declaration will be used. Keep means that the existing object will not be destroyed and
+no creation hence will be done.
-->
<!ELEMENT if-exists (#PCDATA)>
<!--
+A portal object of type context. A context type represent a node in the tree which does not have
+a visual representation. It can exist only under the root. A context can only have children with the portal type.
-->
<!ELEMENT context (context-name,properties?,portal*,listener?,security-constraint?)>
<!--
+The context name value.
-->
<!ELEMENT context-name (#PCDATA)>
<!--
+A portal object of type portal. A portal type represents a virtual portal and can have children of type page.
+In addition of the common portal object elements it support also the declaration of the modes and the window
+states it supports. If no declaration of modes or window states is done then the default value will be
+respectively (view,edit,help) and (normal,minimized,maximized).
-->
-<!ELEMENT portal (portal-name,properties?,supported-modes?,supported-window-states?,(page|window)*,listener?,security-constraint?)>
+<!ELEMENT portal (portal-name,properties?,supported-window-states?,page*,listener?,security-constraint?)>
<!--
+The portal name value.
-->
+<!ELEMENT portal-name (#PCDATA)>
+
+
+<!--
+The supported modes of a portal.
+
+Example:
+
+<supported-mode>
+ <mode>view</mode>
+ <mode>edit</mode>
+ <mode>help</mode>
+</supported-mode>
+-->
<!ELEMENT supported-modes (mode*)>
<!--
+A portlet mode value.
-->
<!ELEMENT mode (#PCDATA)>
<!--
+The supported window states of a portal.
+
+Example:
+
+<supported-window-states>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+</supported-window-states>
+
-->
<!ELEMENT supported-window-states (window-state*)>
<!--
+A window state value.
-->
<!ELEMENT window-state (#PCDATA)>
<!--
+A portal object of type page. A page type represents a page which can have children of type page and window.
+The children windows are the windows of the page and the children pages are the subpages of this page.
-->
-<!ELEMENT portal-name (#PCDATA)>
-
-<!--
--->
<!ELEMENT page (page-name,properties?,(page|window)*,listener?,security-constraint?)>
<!--
+The page name value.
-->
-<!ELEMENT listener (#PCDATA)>
-
-<!--
--->
<!ELEMENT page-name (#PCDATA)>
<!--
+A portal object of type window. A window type represents a window.
-->
<!ELEMENT window (window-name,(instance-ref|content),properties?,region,height,listener?)>
@@ -125,6 +193,10 @@
<!--
-->
+<!ELEMENT listener (#PCDATA)>
+
+<!--
+-->
<!ELEMENT properties (property*)>
<!--
19 years, 2 months
JBoss Portal SVN: r6154 - trunk/core/src/resources/portal-core-sar/dtd.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-05 11:00:59 -0500 (Mon, 05 Feb 2007)
New Revision: 6154
Modified:
trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
Log:
completed the jboss-portlet.dtd except the header-content stuff.
Modified: trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-02-05 14:54:08 UTC (rev 6153)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-02-05 16:00:59 UTC (rev 6154)
@@ -56,7 +56,7 @@
By default the value considered is NotSupported which means that the portal transaction will be suspended
for the duration of the portlet invocation.
-Example :
+Example:
<portlet>
<portlet-name>MyPortlet</portlet-name>
@@ -78,17 +78,35 @@
<!ELEMENT remotable (#PCDATA)>
<!--
-todo
+This element configure the portlet session of the portlet.
+
+The distributed element instructs the container to distribute the session attributes using the
+portal session replication. It applies only to local portlets are not to remote portlets.
+The default value is false.
+
+Example:
+
+<session-config>
+ <distributed>true</distributed>
+</session-config>
+
-->
<!ELEMENT session-config (distributed)>
<!--
-todo
+The authorized values for the distributed element are true or false.
-->
<!ELEMENT distributed (#PCDATA)>
<!--
-todo
+Defines how the portlet behaves with the transactionnal context. The default value
+is Never.
+
+Example:
+
+<transaction>
+ <trans-attribute>Required</transaction>
+<transaction>
-->
<!ELEMENT transaction (trans-attribute)>
19 years, 2 months