Author: chris.laprun(a)jboss.com
Date: 2011-01-14 15:09:15 -0500 (Fri, 14 Jan 2011)
New Revision: 5750
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/ContainerPortletInvoker.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
Log:
- GTNPC-49: Added isKnown and isExposed methods and relevant implementations.
- Improved documentation of PortletInvoker to make intent of getPortlets and getPortlet
methods clearer.
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-01-14
16:11:17 UTC (rev 5749)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -41,7 +41,7 @@
String LOCAL_PORTLET_INVOKER_ID = "local";
/**
- * Return the set of portlet exposed.
+ * Return the set of portlet exposed. Usually, this means only non-customized
portlets.
*
* @return the set of exposed portlets
* @throws PortletInvokerException a portlet invoker exception
@@ -49,7 +49,10 @@
Set<Portlet> getPortlets() throws PortletInvokerException;
/**
- * Get information about a specific portlet.
+ * 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>
*
* @param portletContext the portlet context in the scope of this invoker
* @return the <code>PortletInfo</code> for the specified portlet
@@ -59,6 +62,30 @@
Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException;
/**
+ * Determines whether the specified PortletContext is part of the set of exposed
Portlets as returned by {@link
+ * #getPortlets()}.
+ *
+ * @param portletContext the PortletContext which exposed status we want to determine
+ * @return <code>true</code> if the Portlet associated with the specified
PortletContext is exposed by this
+ * PortletInvoker, <code>false</code> otherwise
+ * @throws IllegalArgumentException if the specified PortletContext is null
+ * @throws PortletInvokerException if some other error occurs
+ */
+ boolean isExposed(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException;
+
+ /**
+ * Determines whether the Portlet associated with the specified PortletContext (if it
exists) is known to this
+ * PortletInvoker whether it is exposed or not. In particular, if this method returns
<code>true</code> then {@link
+ * #getPortlet(PortletContext)} will return a valid Portlet.
+ *
+ * @param portletContext the PortletContext to check
+ * @return <code>true</code>
+ * @throws IllegalArgumentException
+ * @throws PortletInvokerException
+ */
+ boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException;
+
+ /**
* Invoke an operation on a specific portlet.
*
* @param invocation the portlet invocation
@@ -125,23 +152,23 @@
* @throws PortletInvokerException a portlet invoker exception
*/
PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
-
+
/**
* Exports a portlet from the invoker which can be used to recreate this portlet
during an import portlet operation
- * The returned portlet Id will be the portlet Id of the base portlet, not a cloned
portlet Id
- * If the portlet contains state, it will be returned regardless if the portlet
invoker is set to persist state locally.
- *
- * @param stateType the portlet state type desired
+ * The returned portlet Id will be the portlet Id of the base portlet, not a cloned
portlet Id If the portlet
+ * contains state, it will be returned regardless if the portlet invoker is set to
persist state locally.
+ *
+ * @param stateType the portlet state type desired
* @param originalPortletContext the context of the porlet to be exported
* @return A new portlet context which can be used to import a portlet
* @throws PortletInvokerException
*/
PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext) throws PortletInvokerException;
-
+
/**
* Imports a portlet into the invoker.
- *
- * @param stateType the portlet state type desired
+ *
+ * @param stateType the portlet state type desired
* @param contextToImport the context to be imported
* @return The portletcontext for the imported portlet
* @throws PortletInvokerException
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-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -107,6 +107,18 @@
return new FederatedPortlet(this, compoundPortletContext, portlet);
}
+ public boolean isExposed(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ PortletContext context = dereference(portletContext);
+ return portletInvoker.isExposed(context);
+ }
+
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ PortletContext context = dereference(portletContext);
+ return portletInvoker.isKnown(context);
+ }
+
private class FederatedInstanceContext implements InstanceContext
{
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-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -204,6 +204,18 @@
return federated.getPortlet(compoundPortletContext);
}
+ public boolean isExposed(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(portletContext);
+ return federated.isExposed(portletContext);
+ }
+
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(portletContext);
+ return federated.isKnown(portletContext);
+ }
+
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
{
PortletContext compoundPortletContext = invocation.getTarget();
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-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/federation/src/test/java/org/gatein/pc/federation/FederatingPortletInvokerTestCase.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -116,6 +116,26 @@
}
@Test
+ public void testIsExposed() throws PortletInvokerException
+ {
+
assertTrue(federatingInvoker.isExposed(PortletContext.createPortletContext("foo.MyPortlet")));
+
assertTrue(federatingInvoker.isExposed(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID
+ ".MyLocalPortlet")));
+
+
assertTrue(federatedInvoker.isExposed(PortletContext.createPortletContext("foo.MyPortlet")));
+
assertTrue(localInvoker.isExposed(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID
+ ".MyLocalPortlet")));
+ }
+
+ @Test
+ public void testIsKnown() throws PortletInvokerException
+ {
+
assertTrue(federatingInvoker.isKnown(PortletContext.createPortletContext("foo.MyPortlet")));
+
assertTrue(federatingInvoker.isKnown(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID
+ ".MyLocalPortlet")));
+
+
assertTrue(federatedInvoker.isKnown(PortletContext.createPortletContext("foo.MyPortlet")));
+
assertTrue(localInvoker.isKnown(PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID
+ ".MyLocalPortlet")));
+ }
+
+ @Test
public void testFederation() throws PortletInvokerException
{
Collection federateds = federatingInvoker.getFederatedInvokers();
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-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -22,29 +22,27 @@
******************************************************************************/
package org.gatein.pc.portlet;
-import org.gatein.pc.api.state.DestroyCloneFailure;
-import org.gatein.pc.api.state.PropertyMap;
-import org.gatein.pc.api.state.PropertyChange;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletStateType;
-import org.gatein.pc.portlet.state.StateConversionException;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.state.DestroyCloneFailure;
+import org.gatein.pc.api.state.PropertyChange;
+import org.gatein.pc.api.state.PropertyMap;
-import java.io.Serializable;
+import java.util.List;
import java.util.Set;
-import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/**
- * A base class for {@link org.gatein.pc.api.PortletInvoker} interface interceptors. The
subclasses
- * extends it and override the intercepted methods. The next interceptor in the chain is
wired in the field
- * {@link #next} of the interceptor. When the interceptor wants to give control to the
next interceptor, it must
- * invoke the same method on the super class. If no next interceptor is configured the
invocation of the parent
- * method will throw an {@link IllegalStateException}.
+ * A base class for {@link org.gatein.pc.api.PortletInvoker} interface interceptors. The
subclasses extends it and
+ * override the intercepted methods. The next interceptor in the chain is wired in the
field {@link #next} of the
+ * interceptor. When the interceptor wants to give control to the next interceptor, it
must invoke the same method on
+ * the super class. If no next interceptor is configured the invocation of the parent
method will throw an {@link
+ * IllegalStateException}.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
@@ -84,6 +82,16 @@
return safeGetNext().getPortlet(portletContext);
}
+ public boolean isExposed(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ return safeGetNext().isExposed(portletContext);
+ }
+
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ return safeGetNext().isKnown(portletContext);
+ }
+
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
return safeGetNext().invoke(invocation);
@@ -115,8 +123,8 @@
}
/**
- * Attempt to get the next invoker, the method never returns a null value and rather
throws an {@link IllegalStateException}
- * if the next invoker cannot be obtained.
+ * Attempt to get the next invoker, the method never returns a null value and rather
throws an {@link
+ * IllegalStateException} if the next invoker cannot be obtained.
*
* @return the non null next invoker
*/
@@ -135,13 +143,13 @@
}
public PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
- throws PortletInvokerException, IllegalArgumentException
+ throws PortletInvokerException, IllegalArgumentException
{
return safeGetNext().exportPortlet(stateType, originalPortletContext);
}
-
+
public PortletContext importPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
- throws PortletInvokerException, IllegalArgumentException
+ throws PortletInvokerException, IllegalArgumentException
{
return safeGetNext().importPortlet(stateType, originalPortletContext);
}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletInvoker.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletInvoker.java 2011-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/container/ContainerPortletInvoker.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.gatein.pc.portlet.container;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
@@ -86,6 +87,19 @@
return new HashSet<Portlet>(portlets.values());
}
+ @Override
+ public boolean isExposed(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
+ return portlets.containsKey(portletContext.getId());
+ }
+
+ @Override
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ return isExposed(portletContext);
+ }
+
public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
{
if (portletContext == null)
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -27,25 +27,25 @@
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.StateEvent;
-import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.StatefulPortletContext;
-import org.gatein.pc.api.PortletStateType;
-import org.gatein.pc.api.state.PropertyMap;
-import org.gatein.pc.portlet.PortletInvokerInterceptor;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.spi.InstanceContext;
import org.gatein.pc.api.state.AccessMode;
+import org.gatein.pc.api.state.DestroyCloneFailure;
+import org.gatein.pc.api.state.PropertyChange;
+import org.gatein.pc.api.state.PropertyMap;
+import org.gatein.pc.portlet.PortletInvokerInterceptor;
import org.gatein.pc.portlet.state.InvalidStateIdException;
import org.gatein.pc.portlet.state.NoSuchStateException;
-import org.gatein.pc.api.state.PropertyChange;
-import org.gatein.pc.api.state.DestroyCloneFailure;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -121,6 +121,19 @@
return getConsumerContext(portletContext).getPortlet();
}
+ @Override
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ try
+ {
+ return getPortlet(portletContext) != null;
+ }
+ catch (NoSuchPortletException e)
+ {
+ return false;
+ }
+ }
+
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
IllegalArgumentException, PortletInvokerException
{
PortletContext portletContext = invocation.getTarget();
@@ -226,12 +239,12 @@
}
public PortletContext importPortlet(PortletStateType stateType,
- PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ PortletContext portletContext) throws
PortletInvokerException, IllegalArgumentException
{
ConsumerContext consumerContext = getConsumerContext(portletContext);
-
+
PortletContext importContext = super.importPortlet(stateType,
consumerContext.producerPortletContext);
-
+
if (importContext instanceof StatefulPortletContext)
{
StatefulPortletContext statefulimportContext =
(StatefulPortletContext)importContext;
@@ -243,18 +256,18 @@
{
return importContext;
}
-
+
}
-
+
public PortletContext exportPortlet(PortletStateType stateType,
- PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ PortletContext portletContext) throws
PortletInvokerException, IllegalArgumentException
{
ConsumerContext consumerContext = getConsumerContext(portletContext);
-
+
//
return super.exportPortlet(stateType, consumerContext.producerPortletContext);
}
-
+
public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
if (portletContexts == null)
@@ -396,7 +409,8 @@
}
}
- public PortletStateType<?> getStateType() {
+ public PortletStateType<?> getStateType()
+ {
return persistenceManager.getStateType();
}
}
@@ -419,9 +433,9 @@
{
ConsumerStateContext stateCtx = persistenceManager.loadState(stateId);
StatefulPortletContext<Serializable> blah =
StatefulPortletContext.create(
- stateCtx.getPortletId(),
- stateCtx.getStateType(),
- stateCtx.getState());
+ stateCtx.getPortletId(),
+ stateCtx.getStateType(),
+ stateCtx.getState());
return new ConsumerContext(portletContext, blah, stateId);
}
catch (NoSuchStateException e)
@@ -439,9 +453,7 @@
}
}
- /**
- * A context which defines how the consumer see the producer portlet.
- */
+ /** A context which defines how the consumer see the producer portlet. */
private class ConsumerContext
{
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -124,6 +124,19 @@
return _getPortlet(portletContext);
}
+ @Override
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ try
+ {
+ return getPortlet(portletContext) != null;
+ }
+ catch (NoSuchPortletException e)
+ {
+ return false;
+ }
+ }
+
private <S extends Serializable> Portlet _getPortlet(PortletContext
portletContext) throws IllegalArgumentException, PortletInvokerException
{
@@ -649,10 +662,10 @@
{
StatefulContext statefulContext = (StatefulContext)context;
try
- {
+ {
PortletState sstate = new PortletState(portletId,
statefulContext.getProperties());
Serializable marshalledState = stateConverter.marshall(stateType, sstate);
- return StatefulPortletContext.create(portletId, stateType, marshalledState);
+ return StatefulPortletContext.create(portletId, stateType, marshalledState);
}
catch (StateConversionException e)
{
@@ -685,19 +698,19 @@
}
}
}
-
+
public PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException
{
if (contextToImport == null)
{
throw new IllegalArgumentException("No null portlet id accepted");
}
-
+
try
{
if (contextToImport instanceof StatefulPortletContext)
{
- StatefulPortletContext statefulPortletContext = (StatefulPortletContext)
contextToImport;
+ StatefulPortletContext statefulPortletContext =
(StatefulPortletContext)contextToImport;
Boolean persistLocally = stateManagementPolicy.persistLocally();
PortletState portletState = getStateConverter().unmarshall(stateType,
statefulPortletContext.getState());
@@ -727,7 +740,7 @@
throw new PortletInvokerException(e);
}
}
-
+
private <S extends Serializable> PortletContext
marshall(PortletStateType<S> stateType, String portletId, PropertyMap props) throws
PortletInvokerException
{
try
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-01-14
16:11:17 UTC (rev 5749)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2011-01-14
20:09:15 UTC (rev 5750)
@@ -26,23 +26,23 @@
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletStateType;
-import org.gatein.pc.api.state.PropertyMap;
-import org.gatein.pc.portlet.support.info.PortletInfoSupport;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
-import org.gatein.pc.api.state.DestroyCloneFailure;
+import org.gatein.pc.api.state.PropertyMap;
import org.gatein.pc.portlet.state.SimplePropertyMap;
+import org.gatein.pc.portlet.support.info.PortletInfoSupport;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -103,9 +103,9 @@
}
/**
- * Returns a portlet or null if it is not found. The portlet is returned whether it is
tagged as valid or not.
- * This method is not equivalent to the
<code>getPortlet(PortletContext)</code> method which returns a portlet
- * only if that one is valid. It should be used for configuration purposes.
+ * Returns a portlet or null if it is not found. The portlet is returned whether it is
tagged as valid or not. This
+ * method is not equivalent to the <code>getPortlet(PortletContext)</code>
method which returns a portlet only if
+ * that one is valid. It should be used for configuration purposes.
*
* @param portletId the portlet id
* @return the portlet
@@ -132,6 +132,16 @@
return internalGetPortlet(portletContext);
}
+ public boolean isExposed(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ return portlets.containsKey(portletContext.getId());
+ }
+
+ public boolean isKnown(PortletContext portletContext) throws IllegalArgumentException,
PortletInvokerException
+ {
+ return isExposed(portletContext);
+ }
+
public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
{
PortletContext portletContext = invocation.getTarget();
@@ -187,7 +197,7 @@
{
PortletSupport internalPortlet = internalGetPortlet(portletContext);
PropertyMap props = new SimplePropertyMap();
- for (String key: internalPortlet.state.keySet())
+ for (String key : internalPortlet.state.keySet())
{
List<String> value = internalPortlet.state.get(key);
if (value != null)
@@ -214,13 +224,13 @@
}
public PortletContext exportPortlet(PortletStateType stateType,
- PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ PortletContext originalPortletContext) throws
PortletInvokerException, IllegalArgumentException
{
throw new UnsupportedOperationException();
}
public PortletContext importPortlet(PortletStateType stateType,
- PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ PortletContext originalPortletContext) throws
PortletInvokerException, IllegalArgumentException
{
throw new UnsupportedOperationException();
}