Author: chris.laprun(a)jboss.com
Date: 2007-01-07 23:28:36 -0500 (Sun, 07 Jan 2007)
New Revision: 5953
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
Log:
- Now include portlets that hint at cloning.
- Accept other access modes than read-only.
- BUT throw an exception when cloning occurs so that it can be fixed since I need to hook
the code to Portal's state management.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-01-08
04:26:33 UTC (rev 5952)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-01-08
04:28:36 UTC (rev 5953)
@@ -26,6 +26,7 @@
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.Parameters;
import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
@@ -72,11 +73,7 @@
ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance
context");
AccessMode accessMode = instanceContext.getAccessMode();
ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access
mode");
- if (AccessMode.CLONE_BEFORE_WRITE.equals(accessMode))
- {
- log.warn("Requesting clone before write but since this is not currently
supported we switch to read only");
- accessMode = AccessMode.READ_ONLY; // fix-me
- }
+ log.debug("Portlet is requesting " + accessMode + " access
mode");
InteractionParams interactionParams =
WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
@@ -118,7 +115,7 @@
interactionParams);
}
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation
invocation, RequestPrecursor requestPrecursor)
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation
invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
{
BlockingInteractionResponse blockingInteractionResponse =
(BlockingInteractionResponse)response;
@@ -163,8 +160,7 @@
PortletContext portletContext = updateResponse.getPortletContext();
if (portletContext != null &&
!requestPrecursor.portletHandle.equals(portletContext.getPortletHandle()))
{
- // fix-me: we don't currently handle clones
- log.warn("Implicit clone operation not currently supported: producer
'" + consumer.getProducerId()
+ throw new UnsupportedOperationException("Portlet cloning not currently
supported: producer '" + consumer.getProducerId()
+ "' updated the portlet handle.");
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-01-08
04:26:33 UTC (rev 5952)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-01-08
04:28:36 UTC (rev 5953)
@@ -260,6 +260,6 @@
protected abstract Object prepareRequest(RequestPrecursor requestPrecursor,
PortletInvocation invocation);
- protected abstract PortletInvocationResponse processResponse(Object response,
PortletInvocation invocation, RequestPrecursor requestPrecursor);
+ protected abstract PortletInvocationResponse processResponse(Object response,
PortletInvocation invocation, RequestPrecursor requestPrecursor) throws
PortletInvokerException;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-01-08
04:26:33 UTC (rev 5952)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-01-08
04:28:36 UTC (rev 5953)
@@ -82,9 +82,6 @@
/** The service description sent to producer. */
private GetServiceDescription serviceDescriptionRequest;
- /** The registration with the current producer. */
- private RegistrationContext registrationContext;
-
/*protected org.jboss.portal.wsrp.core.ItemDescription[] userCategoryDescriptions;
protected org.jboss.portal.wsrp.core.ItemDescription[]
customUserProfileItemDescriptions;
protected org.jboss.portal.wsrp.core.ItemDescription[] customWindowStateDescriptions;
@@ -291,15 +288,13 @@
+ "' uses the GET method in forms. Since we don't handle this,
this portlet will be excluded from " +
"the list of offered portlets for producer " + producerId);
}
- else if (info.isHasUserSpecificState())
- {
- log.warn("Portlet '" + portletHandle
- + "' will store persistent state for each user. To be handled
properly, this would require " +
- "supporting portlet cloning, which we don't currently do. This
portlet will be excluded from the " +
- "list of offered portlets for producer " + producerId);
- }
else
{
+ if (info.isHasUserSpecificState())
+ {
+ log.debug("Portlet '" + portletHandle + "' will store
persistent state for each user. NOT WELL TESTED!");
+ }
+
wsrpPortlet = new
WSRPPortlet(PortletContext.createPortletContext(portletHandle), info);
// add the portlet to the appropriate group if needed
@@ -343,7 +338,7 @@
{
log.debug("getPortlet via getPortletDescription");
- GetPortletDescription gpd =
WSRPTypeFactory.createGetPortletDescription(registrationContext, portletId);
+ GetPortletDescription gpd =
WSRPTypeFactory.createGetPortletDescription(getRegistrationContext(), portletId);
gpd.setUserContext(null); // todo: deal with user context!!
try
{
@@ -424,7 +419,7 @@
private ServiceDescription getServiceDescription() throws
ServiceDescriptionUnavailableException, PortletInvokerException
{
GetServiceDescription request = getServiceDescriptionRequest();
- request.setRegistrationContext(registrationContext);
+ request.setRegistrationContext(getRegistrationContext());
ServiceDescription serviceDescription;
@@ -506,4 +501,9 @@
gsd.setDesiredLocales(WSRPConstants.DEFAULT_LOCALES);
return gsd;
}
+
+ private RegistrationContext getRegistrationContext()
+ {
+ return registrationInfo.getRegistrationContext();
+ }
}
Show replies by date