Author: chris.laprun(a)jboss.com
Date: 2008-07-02 04:18:37 -0400 (Wed, 02 Jul 2008)
New Revision: 11258
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
Log:
- Improved logic in status handling: tests should now pass.
- A RegistrationRefreshResult now only affects the total refresh result if it wasn't
bypassed.
- Cleaned-up code somewhat.
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-07-02
08:18:20 UTC (rev 11257)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-07-02
08:18:37 UTC (rev 11258)
@@ -303,8 +303,8 @@
if (forceRefresh || isRefreshNeeded(true))
{
log.debug("Refreshing info for producer '" + getId() +
"'");
-// RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
- RefreshResult result = new RefreshResult();
+ // Refresh occurs until proven otherwise! :)
+ RefreshResult result = new RefreshResult(RefreshResult.Status.SUCCESS);
try
{
persistentEndpointInfo.refresh();
@@ -312,13 +312,12 @@
catch (InvokerUnavailableException e)
{
log.debug("Couldn't refresh endpoint information: " + e);
-// result.appendToStatus("Couldn't refresh endpoint information:
").append(e.getLocalizedMessage());
+ // todo: should we fail fast here?
// throw new PortletInvokerException("Couldn't refresh endpoint
information: " + e.getLocalizedMessage());
}
// save changes to endpoint
registry.updateProducerInfo(this);
- boolean registeredSDSucceeded = true;
try
{
// if we don't yet have registration information, get an unregistered
service description
@@ -330,7 +329,6 @@
if (hasLocalRegistrationInfo())
{
log.debug("OperationFailedFault occurred, might indicate a need to
modify registration");
- registeredSDSucceeded = false;
// attempt to get unregistered service description
serviceDescription = getServiceDescription(true);
result.setServiceDescription(serviceDescription);
@@ -344,8 +342,6 @@
}
result.setRegistrationResult(registrationResult);
- /*result.appendToStatus(registrationResult.getStatus(), false);
- result.setHasIssues(registrationResult.hasIssues());*/
return result;
}
else
@@ -367,16 +363,15 @@
if (serviceDescription.isRequiresRegistration())
{
// refresh and force check for extra props if the registered SD failed
- RefreshResult registrationResult =
internalRefreshRegistration(serviceDescription, true, forceRefresh,
!registeredSDSucceeded);
+ // todo: deal with forcing check of extra registration properties properly
(if needed)
+ RefreshResult registrationResult =
internalRefreshRegistration(serviceDescription, true, forceRefresh, false);
registry.updateProducerInfo(this);
-// result.appendToStatus(registrationResult.getStatus());
-
// attempt to register and determine if the current service description can
be used to extract POPs
- if (registeredSDSucceeded && !registrationResult.hasIssues())
+ if (!registrationResult.hasIssues())
{
registrationResult = register(serviceDescription, false);
- if (RefreshResult.Status.SUCCESS.equals(registrationResult.getStatus()))
+ if (!registrationResult.hasIssues())
{
// registration occurred, so we should ask for a new service
description
serviceDescription = getServiceDescription(false);
@@ -386,10 +381,7 @@
extractOfferedPortlets(serviceDescription);
}
-// result.appendToStatus(registrationResult.getStatus());
-// result.setHasIssues(registrationResult.hasIssues());
result.setRegistrationResult(registrationResult);
-// result.appendToStatus("Producer information successfully
refreshed");
return result;
}
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2008-07-02
08:18:20 UTC (rev 11257)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2008-07-02
08:18:37 UTC (rev 11258)
@@ -62,7 +62,13 @@
if (registrationResult != null)
{
this.registrationResult = registrationResult;
- status = registrationResult.getStatus();
+
+ // result of registration only impacts the result of the total refresh if it
wasn't bypassed
+ RefreshResult.Status regStatus = registrationResult.getStatus();
+ if (!BYPASSED.equals(regStatus))
+ {
+ status = regStatus;
+ }
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-07-02
08:18:20 UTC (rev 11257)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-07-02
08:18:37 UTC (rev 11258)
@@ -407,9 +407,7 @@
if (serviceDescription.isRequiresRegistration())
{
requiresRegistration = Boolean.TRUE;
- StringBuffer message = new StringBuffer("Producer
'").append(producerId).append("' requires registration");
-// result.appendToStatus(message.toString());
- log.debug(message);
+ log.debug("Producer '" + producerId + "' requires
registration");
// check if the configured registration properties match the producer
expectations
ModelDescription regPropDescs =
serviceDescription.getRegistrationPropertyDescription();
@@ -452,7 +450,6 @@
}
log.debug("Missing value for property '" + name +
"'");
-// result.appendToStatus("Missing value for property
'" + name + "'");
result.setStatus(RefreshResult.Status.FAILURE);
}
}
@@ -471,7 +468,6 @@
{
String msg = "Producer '" + producerId + "'
doesn't require registration";
log.debug(msg);
-// result.appendToStatus(msg);
requiresRegistration = Boolean.FALSE;
result.setStatus(RefreshResult.Status.SUCCESS);
}
@@ -488,7 +484,6 @@
consistentWithProducerExpectations = !result.hasIssues();
String msg = "Registration configuration is " +
(consistentWithProducerExpectations ? "" : "NOT ") +
"valid";
-// result.appendToStatus(msg);
log.debug(msg);
return result;
}
@@ -566,7 +561,6 @@
}
}
log.debug(message);
-// result.appendToStatus(message.toString());
result.setStatus(RefreshResult.Status.FAILURE);
}
}
Show replies by date