Author: chris.laprun(a)jboss.com
Date: 2011-10-07 17:54:28 -0400 (Fri, 07 Oct 2011)
New Revision: 7688
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletDispatcher.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
Log:
- GTNPC-75: added isActive method on PortletInvoker and check whether an invoker is active
before attempting to retrieve portlets from it. Should maybe extend active checking to
other methods.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2011-10-07
11:37:36 UTC (rev 7687)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -49,8 +49,10 @@
Set<Portlet> getPortlets() throws PortletInvokerException;
/**
- * Get information about a specific portlet. Note that this PortletInvoker can know
about more portlets than returned
- * by {@link #getPortlets()}. In particular, cloned portlets wouldn't necessarily
be exposed to getPortlets and still
+ * Get information about a specific portlet. Note that this PortletInvoker can know
about more portlets than
+ * returned
+ * by {@link #getPortlets()}. In particular, cloned portlets wouldn't necessarily
be exposed to getPortlets and
+ * still
* be known by this PortletInvoker i.e. there exists PortletContexts
<code>pc</code> as follows: <p> <code> assert
* getPortlet(pc) != null && !getPortlets().contains(portlet);<br/>
</code> </p>
*
@@ -161,4 +163,11 @@
* @throws PortletInvokerException
*/
PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException;
+
+ /**
+ * Returns whether this portlet invoker is active and can respond to requests.
+ *
+ * @return <code>true</code> if this portlet invoker can respond to
requests, <code>false</code> otherwise
+ */
+ boolean isActive();
}
Modified:
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -75,6 +75,11 @@
return portletInvoker;
}
+ public boolean isActive()
+ {
+ return portletInvoker.isActive();
+ }
+
public String getId()
{
return id;
Modified:
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
---
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -191,6 +191,13 @@
final FederatedPortletInvoker federated = getFederatedInvoker(invokerId);
+ // skip the invoker if it isn't active
+ if(!federated.isActive())
+ {
+ log.info("PortletInvoker with id: " + invokerId + " was
skipped because it isn't active.");
+ continue;
+ }
+
try
{
Set<Portlet> offeredPortlets = federated.getPortlets();
@@ -305,6 +312,11 @@
return federated.importPortlet(stateType, compoundPortletContext);
}
+ public boolean isActive()
+ {
+ return true;
+ }
+
public synchronized void setPortletInvokerResolver(PortletInvokerResolver
portletResolver)
{
if (portletResolver == null)
Modified:
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -258,5 +258,10 @@
{
return null;
}
+
+ public boolean isActive()
+ {
+ return true;
+ }
}
}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -149,4 +149,9 @@
{
return safeGetNext().importPortlet(stateType, originalPortletContext);
}
+
+ public boolean isActive()
+ {
+ return safeGetNext().isActive();
+ }
}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletDispatcher.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletDispatcher.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletDispatcher.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -41,4 +41,10 @@
//
return container.dispatch(invocation);
}
+
+ @Override
+ public boolean isActive()
+ {
+ return true; // todo: should it be smarter than this? i.e. check if the
PortletContainer is available or not?
+ }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-10-07
11:37:36 UTC (rev 7687)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-10-07
21:54:28 UTC (rev 7688)
@@ -232,4 +232,9 @@
{
throw new UnsupportedOperationException();
}
+
+ public boolean isActive()
+ {
+ return true;
+ }
}
Show replies by date