Author: chris.laprun(a)jboss.com
Date: 2008-06-06 12:22:38 -0400 (Fri, 06 Jun 2008)
New Revision: 10936
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
Log:
- Implemented acquireResources in RenderWindowCommand to fail fast if resource associated
with window is not available.
Otherwise, e.g. if the associated portlet was not deployed, it would cause an NPE in
InternalContentProvider.
- Minor improvements.
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2008-06-06
14:02:22 UTC (rev 10935)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2008-06-06
16:22:38 UTC (rev 10936)
@@ -197,7 +197,7 @@
if (user == null)
{
- PortalURL portalURL = null;
+ PortalURL portalURL;
String configNamespace =
config.getProperty("core.login.namespace");
if (loginNamespace == null)
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-06-06
14:02:22 UTC (rev 10935)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-06-06
16:22:38 UTC (rev 10936)
@@ -22,21 +22,20 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.navstate.NavigationalStateContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.core.navstate.NavigationalStateContext;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.PortalObjectId;
import javax.xml.namespace.QName;
-import java.util.Set;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
@@ -375,4 +374,9 @@
//
pageUpdates.put(name, REMOVAL);
}
+
+ public Window getWindow(String windowName)
+ {
+ return controllerContext.getWindow(windowName);
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-06-06
14:02:22 UTC (rev 10935)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-06-06
16:22:38 UTC (rev 10936)
@@ -122,8 +122,6 @@
{
log.debug("Couldn't find a ContentProvider for content type
'" + contentType + "'");
instanceId = null;
- // todo: this condition should bubble up, this would happen when trying to
access a page referencing portlets
- // for which no content provider is deployed (e.g. default page when cms
is not deployed)
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-06-06
14:02:22 UTC (rev 10935)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-06-06
16:22:38 UTC (rev 10936)
@@ -276,7 +276,7 @@
//
try
{
- Context dashboardContext =
(Context)portalObjectContainer.getContext(dashboardContextId);
+ Context dashboardContext =
portalObjectContainer.getContext(dashboardContextId);
//
dashboardPortal = dashboardContext.getPortal(userId);
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06
14:02:22 UTC (rev 10935)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-06-06
16:22:38 UTC (rev 10936)
@@ -25,12 +25,14 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerException;
import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.NoSuchResourceException;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
-import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
import org.jboss.portal.core.model.portal.content.ContentRendererContext;
@@ -38,8 +40,8 @@
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.control.page.PageControlContext;
import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import java.util.Map;
@@ -135,4 +137,20 @@
portal,
pageNavigationalState);
}
+
+ @Override
+ public void acquireResources() throws NoSuchResourceException
+ {
+ super.acquireResources();
+
+ // check that the portlet associated with the window is deployed by delegating to
the navigational state which
+ // in turn delegates to ControllerPortletControllerContext which knows the windows
which are available
+ String windowName = window.getId().toString();
+ Window realWindow = pageNavigationalState.getWindow(windowName);
+ if(realWindow == null)
+ {
+ log.debug("Resource associated with window '" + windowName +
"' could not be found!");
+ throw new NoSuchResourceException(windowName);
+ }
+ }
}
Show replies by date