[jboss-cvs] jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer ...
Chris Laprun
chris.laprun at jboss.com
Thu Aug 10 15:56:47 EDT 2006
User: claprun
Date: 06/08/10 15:56:47
Modified: wsrp/src/main/org/jboss/portal/wsrp/consumer
InvocationHandler.java SessionHandler.java
WSRPConsumerImpl.java
Log:
- Now reset the producer information when the session is invalidated.
- Removed handler on other ports than Markup since they shouldn't be needed. Need to investigate this more
since the tests break if I don't define the handler on all ports.
- Cleaned-up WSRPConsumerImpl so that the registration information sent by remote producer is only
displayed if no registration data was defined in the producer configuration.
- Added reset method on RequestHeaderClientHandler.
- Minor improvements.
Revision Changes Path
1.2 +6 -5 jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvocationHandler.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- InvocationHandler.java 1 Jun 2006 03:59:45 -0000 1.1
+++ InvocationHandler.java 10 Aug 2006 19:56:47 -0000 1.2
@@ -38,7 +38,7 @@
/**
* @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @since 2.4 (May 31, 2006)
*/
public abstract class InvocationHandler
@@ -104,10 +104,11 @@
/**
* Deals with common error conditions.
*
- * @param error
- * @param invocation
- * @param runtimeContext
- * @param retryCount
+ * @param error the error that is to be dealt with
+ * @param invocation the invocation that caused the error to occur
+ * @param runtimeContext the current WSRP RuntimeContext
+ * @param retryCount the number of times we tried to perform the invocation at the time the error occurred
+ * @return the updated number of re-try or <code>DO_NOT_RETRY</code> if the error was fatal
*/
private int dealWithError(Exception error, PortletInvocation invocation, RuntimeContext runtimeContext, int retryCount)
throws ServiceDescriptionUnavailableException
1.5 +4 -3 jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SessionHandler.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/SessionHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- SessionHandler.java 8 Aug 2006 04:31:50 -0000 1.4
+++ SessionHandler.java 10 Aug 2006 19:56:47 -0000 1.5
@@ -44,7 +44,7 @@
* Manages session informations on behalf of a consumer.
*
* @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @since 2.4 (May 31, 2006)
*/
public class SessionHandler
@@ -129,11 +129,11 @@
// check if we have already initialized cookies for this user
ProducerSessionInformation sessionInformation = getProducerSessionInformation(invocation);
- RequestHeaderClientHandler.setCurrentInfo(null, sessionInformation);
if (sessionInformation.isUserCookiesInitialized())
{
return;
}
+ RequestHeaderClientHandler.setCurrentInfo(null, sessionInformation);
InitCookie initCookie = WSRPTypeFactory.createInitCookie(consumer.getRegistrationContext());
@@ -161,7 +161,7 @@
}
finally
{
- RequestHeaderClientHandler.setCurrentGroupId(null);
+ resetPortletGroupIdIfNeeded();
}
}
@@ -260,5 +260,6 @@
{
HttpSession session = WSRPConsumerImpl.getHttpSession(invocation);
session.removeAttribute(getProducerSessionInformationKey());
+ RequestHeaderClientHandler.resetCurrentInfo();
}
}
1.51 +24 -24 jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WSRPConsumerImpl.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- WSRPConsumerImpl.java 2 Aug 2006 23:48:23 -0000 1.50
+++ WSRPConsumerImpl.java 10 Aug 2006 19:56:47 -0000 1.51
@@ -68,7 +68,7 @@
/**
* @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision: 1.50 $
+ * @version $Revision: 1.51 $
* @since 2.4
*/
public class WSRPConsumerImpl extends AbstractJBossService implements WSRPConsumer
@@ -488,6 +488,7 @@
{
GetServiceDescription request = getServiceDescriptionRequest();
+ final String producerId = getProducerId();
try
{
ServiceDescription serviceDescription = getServiceDescriptionService().getServiceDescription(request);
@@ -498,10 +499,26 @@
{
ModelDescription registrationProperties = serviceDescription.getRegistrationPropertyDescription();
ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties, "registration properties");
+
+ // try to register with the registration data provided at deployment time
+ if (registrationData != null)
+ {
+ RegistrationContext registrationContext = getRegistrationService().register(registrationData);
+
+ // if we reach this point, registration was successful so remember the returned registration context
+ this.registrationContext = registrationContext;
+
+ // add it to the request and try to get the service description again!
+ request.setRegistrationContext(registrationContext);
+ serviceDescription = getServiceDescriptionService().getServiceDescription(request);
+ }
+ else
+ {
PropertyDescription[] propertyDescriptions = registrationProperties.getPropertyDescriptions();
if (propertyDescriptions != null)
{
- System.out.println("Required registration information for producer " + getProducerId());
+ log.info("Producer " + producerId + " requires registration yet configuration of this producer " +
+ "does not provide any registration data. The required registration information is: ");
for (int i = 0; i < propertyDescriptions.length; i++)
{
PropertyDescription propertyDescription = propertyDescriptions[i];
@@ -511,30 +528,13 @@
String label = nillableLabel == null ? null : nillableLabel.getValue();
LocalizedString nillableHint = propertyDescription.getHint();
String hint = nillableHint == null ? null : nillableHint.getValue();
- System.out.println("propertyDescription =\n"
+ log.info("propertyDescription =\n"
+ "- name:\t" + name + "\n"
+ "- type:\t" + type + "\n"
+ "- label:\t" + label + "\n"
+ "- hint:\t" + hint + "\n");
}
}
-
- // try to register with the registration data provided at deployment time
- if (registrationData != null)
- {
- RegistrationContext registrationContext = getRegistrationService().register(registrationData);
-
- // if we reach this point, registration was successful so remember the returned registration context
- this.registrationContext = registrationContext;
-
- // add it to the request and try to get the service description again!
- request.setRegistrationContext(registrationContext);
- serviceDescription = getServiceDescriptionService().getServiceDescription(request);
- }
- else
- {
- log.info("Producer " + getProducerId() + " requires registration yet configuration of this producer " +
- "does not provide any registration data. See above for the required registration information.");
}
}
@@ -557,7 +557,7 @@
log.debug(e);
Throwable cause = e.getCause();
throw new ServiceDescriptionUnavailableException("Problem getting service description for producer "
- + getProducerId(), cause == null ? e : cause);
+ + producerId, cause == null ? e : cause);
}
}
More information about the jboss-cvs-commits
mailing list