Author: chris.laprun(a)jboss.com
Date: 2007-05-05 13:30:04 -0400 (Sat, 05 May 2007)
New Revision: 7198
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
Log:
- Refreshing a consumer should start it.
- JBPORTAL-715: Properly display registration info if local information is present.
- Fixed error in RegistrationInfo.refresh where the status would be improperly set to
invalid
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-05
04:56:19 UTC (rev 7197)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-05
17:30:04 UTC (rev 7198)
@@ -204,6 +204,12 @@
this.persistentActive = active;
}
+ public void setActiveAndSave(boolean active)
+ {
+ setActive(active);
+ registry.updateProducerInfo(this);
+ }
+
CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
@@ -257,6 +263,8 @@
{
result.appendToStatus("Couldn't refresh endpoint information:
").append(e.getLocalizedMessage());
}
+ // save changes to endpoint
+ registry.updateProducerInfo(this);
serviceDescription = getServiceDescription(false);
@@ -527,8 +535,7 @@
log.debug("Caught Exception in getServiceDescription:\n", e);
// de-activate
- setActive(false);
- registry.updateProducerInfo(this);
+ setActiveAndSave(false);
Throwable cause = e.getCause();
throw new InvokerUnavailableException("Problem getting service description
for producer "
@@ -626,7 +633,6 @@
public void register() throws PortletInvokerException
{
register(null);
- registry.updateProducerInfo(this);
}
/**
@@ -684,11 +690,15 @@
setActive(false);
throw new PortletInvokerException("Couldn't register with
producer '" + persistentId + "'", e);
}
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
}
else
{
log.info(result.getStatus());
- setActive(false);
+ setActiveAndSave(false);
throw new PortletInvokerException("Consumer is not ready to be
registered with producer because of missing or invalid registration information.");
}
}
@@ -723,9 +733,16 @@
persistentRegistrationInfo = new RegistrationInfo(this);
}
- RegistrationInfo.RegistrationRefreshResult result =
- persistentRegistrationInfo.refresh(getServiceDescription(true), persistentId,
mergeWithLocalInfo, true);
- registry.updateProducerInfo(this);
+ RegistrationInfo.RegistrationRefreshResult result;
+ try
+ {
+ result = persistentRegistrationInfo.refresh(getServiceDescription(true),
persistentId, mergeWithLocalInfo, true);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
+
log.info("Refreshed registration information for consumer with id '"
+ persistentId + "'");
return result;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-05
04:56:19 UTC (rev 7197)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-05
17:30:04 UTC (rev 7198)
@@ -339,7 +339,7 @@
{
// take the opportunity to add the property description... ^_^
existing.setDescription(prop.getDescription());
- if (prop.isInvalid())
+ if (existing.isInvalid())
{
result.setHasIssues(true);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-05-05
04:56:19 UTC (rev 7197)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-05-05
17:30:04 UTC (rev 7198)
@@ -460,6 +460,12 @@
public void activate() throws Exception
{
+ internalStart();
+ producerInfo.setActiveAndSave(getEndpointConfigurationInfo().isAvailable());
+ }
+
+ private void internalStart() throws Exception
+ {
if (!started)
{
try
@@ -469,18 +475,17 @@
catch (Exception e)
{
// mark the consumer as inactive if it cannot be started
- producerInfo.setActive(false);
+ producerInfo.setActiveAndSave(false);
throw e;
}
log.info("Consumer with id '" + getProducerId() + "'
activated");
}
- producerInfo.setActive(getEndpointConfigurationInfo().isAvailable());
}
public void deactivate() throws Exception
{
- producerInfo.setActive(false);
+ producerInfo.setActiveAndSave(false);
if (started)
{
stop();
@@ -505,6 +510,15 @@
public RefreshResult refresh(boolean forceRefresh) throws PortletInvokerException
{
+ try
+ {
+ internalStart();
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException(e);
+ }
+
return producerInfo.detailedRefresh(forceRefresh);
}
Modified:
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
---
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-05
04:56:19 UTC (rev 7197)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-05
17:30:04 UTC (rev 7198)
@@ -73,7 +73,7 @@
</c:choose>
</td>
</tr>
-<c:if test="#{!consumer.refreshNeeded or consumer.registrationChecked}">
+<c:if test="#{!consumer.refreshNeeded or consumer.localInfoPresent}">
<tr>
<th>Registration information</th>
<td>
Show replies by date