Author: chris.laprun(a)jboss.com
Date: 2007-05-04 01:28:38 -0400 (Fri, 04 May 2007)
New Revision: 7190
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.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/consumers.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
Log:
- JBPORTAL-715:
+ Improved layout, behavior and information reporting.
+ Implemented refresh functionality.
+ Still needs work and testing.
- Renamed RegistrationInfo.refreshRegistrationRequirementsFor to refresh.
- Refresh methods return more detailed information.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-05-04
02:43:12 UTC (rev 7189)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -35,6 +35,7 @@
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.services.ServiceFactory;
@@ -66,11 +67,6 @@
{
}
- public ServiceFactory getServiceFactory()
- {
- return producerInfo.getEndpointConfigurationInfo().getServiceFactory();
- }
-
public ProducerSessionInformation getProducerSessionInformationFrom(PortletInvocation
invocation)
{
return null;
@@ -116,6 +112,16 @@
return true;
}
+ public boolean isRefreshNeeded()
+ {
+ return false;
+ }
+
+ public RefreshResult refresh(boolean forceRefresh)
+ {
+ return null;
+ }
+
public Set getPortlets() throws PortletInvokerException
{
return null;
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationInfoTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationInfoTestCase.java 2007-05-04
02:43:12 UTC (rev 7189)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationInfoTestCase.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -80,7 +80,7 @@
assertFalse(info.isRegistrationValid());
ServiceDescription sd = createServiceDescription(false, 0);
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(sd, producerId, true, false);
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId,
true, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationRequired().booleanValue());
@@ -88,7 +88,7 @@
assertFalse(info.isRegistrationDeterminedRequired());
assertTrue(info.isRegistrationValid());
- result = info.refreshRegistrationRequirementsFor(sd, producerId, false, false);
+ result = info.refresh(sd, producerId, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationRequired().booleanValue());
@@ -103,7 +103,7 @@
assertNull(info.isRegistrationRequired());
assertFalse(info.isRegistrationValid());
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(
createServiceDescription(true, 0), producerId, true, false);
assertNotNull(result);
assertFalse(result.hasIssues());
@@ -118,7 +118,7 @@
// set a registration property
info.setRegistrationPropertyValue("foo", "bar");
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(
createServiceDescription(true, 0), producerId, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
@@ -143,7 +143,7 @@
// producer requests 2 registration properties
ServiceDescription sd = createServiceDescription(true, 2);
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(sd, producerId, false, false);
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId,
false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
String status = result.getStatus();
@@ -165,7 +165,7 @@
{
info.setRegistrationPropertyValue("foo", "bar");
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(createServiceDescription(true, 2),
+ RegistrationInfo.RegistrationRefreshResult result =
info.refresh(createServiceDescription(true, 2),
producerId, true, false);
assertNotNull(result);
assertTrue(result.hasIssues());
@@ -189,7 +189,7 @@
public void testForceRefreshRegistration()
{
- RegistrationInfo.RegistrationRefreshResult result =
info.refreshRegistrationRequirementsFor(
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(
createServiceDescription(true, 0), producerId, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
@@ -197,22 +197,22 @@
// Modifying a property renders the info dirty and hence should be refreshed
info.setRegistrationPropertyValue("foo", "bar");
- result = info.refreshRegistrationRequirementsFor(createServiceDescription(true, 0),
producerId, false, false);
+ result = info.refresh(createServiceDescription(true, 0), producerId, false,
false);
assertTrue(result.hasIssues());
assertFalse(info.isRegistrationValid());
info.removeRegistrationProperty("foo");
- result = info.refreshRegistrationRequirementsFor(createServiceDescription(true, 0),
producerId, false, false);
+ result = info.refresh(createServiceDescription(true, 0), producerId, false,
false);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationValid());
// producer has changed but we're not forcing refresh so registration should
still be invalid
- result = info.refreshRegistrationRequirementsFor(createServiceDescription(false,
0), producerId, false, false);
+ result = info.refresh(createServiceDescription(false, 0), producerId, false,
false);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationValid());
// force refresh
- result = info.refreshRegistrationRequirementsFor(createServiceDescription(false,
0), producerId, false, true);
+ result = info.refresh(createServiceDescription(false, 0), producerId, false,
true);
assertFalse(result.hasIssues());
assertTrue(info.isRegistrationValid());
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-05-04 02:43:12 UTC
(rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-05-04 05:28:38 UTC
(rev 7190)
@@ -28,6 +28,7 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.system.Service;
@@ -123,4 +124,17 @@
* @since 2.6
*/
boolean isActive();
+
+ /**
+ * @return
+ * @since 2.6
+ */
+ boolean isRefreshNeeded();
+
+ /**
+ * @param forceRefresh
+ * @return
+ * @since 2.6
+ */
+ RefreshResult refresh(boolean forceRefresh) throws PortletInvokerException;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-05-04
02:43:12 UTC (rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -23,9 +23,11 @@
package org.jboss.portal.wsrp.admin.ui;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import javax.faces.context.FacesContext;
@@ -69,6 +71,11 @@
this.useWSDL = useWSDL ? Boolean.TRUE : Boolean.FALSE;
}
+ public boolean isRefreshNeeded()
+ {
+ return consumer.isRefreshNeeded();
+ }
+
public String getId()
{
return consumer.getProducerId();
@@ -206,7 +213,7 @@
try
{
RegistrationInfo.RegistrationRefreshResult result =
consumer.refreshRegistrationInfo(eraseLocalData);
- if (!result.isValid())
+ if (result.hasIssues())
{
createErrorMessage(result.getStatus());
}
@@ -227,6 +234,35 @@
return null;
}
+ public String refresh()
+ {
+ if (consumer != null)
+ {
+ try
+ {
+ RefreshResult result = consumer.refresh(true);
+ if (result.hasIssues())
+ {
+ createErrorMessage(result.getStatus());
+ }
+ else
+ {
+ createInfoMessage(null, result.getStatus());
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ createErrorMessageFrom(e);
+ return null;
+ }
+
+ return null;
+ }
+
+ createErrorMessage("Couldn't refresh Consumer!");
+ return null;
+ }
+
// Listeners
public void useWSDLListener(ValueChangeEvent event)
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-04
02:43:12 UTC (rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -104,6 +104,8 @@
private GetServiceDescription serviceDescriptionRequest;
private ConsumerRegistry registry;
+ private static final String REGISTER_MEANING = "Should clients ask for a new
service description?";
+ private static final String REFRESH_MEANING = "Did just refresh?";
/*protected org.jboss.portal.wsrp.core.ItemDescription[] userCategoryDescriptions;
protected org.jboss.portal.wsrp.core.ItemDescription[]
customUserProfileItemDescriptions;
@@ -212,10 +214,15 @@
*/
public boolean refresh(boolean forceRefresh) throws PortletInvokerException
{
- boolean justRefreshed = internalRefresh(forceRefresh);
+ return detailedRefresh(forceRefresh).specificCode();
+ }
+ public RefreshResult detailedRefresh(boolean forceRefresh) throws
PortletInvokerException
+ {
+ RefreshResult result = internalRefresh(forceRefresh);
+
// update DB
- if (justRefreshed)
+ if (result.specificCode())
{
if (!isActive())
{
@@ -225,10 +232,10 @@
registry.updateProducerInfo(this);
}
- return justRefreshed;
+ return result;
}
- private boolean internalRefresh(boolean forceRefresh) throws PortletInvokerException
+ private RefreshResult internalRefresh(boolean forceRefresh) throws
PortletInvokerException
{
ServiceDescription serviceDescription;
// might neeed a different cache value: right now, we cache the whole producer info
but we might want to cache
@@ -236,7 +243,16 @@
if (forceRefresh || isRefreshNeeded(true))
{
log.debug("ProducerInfo refresh needed for producer '" +
persistentId + "'");
- persistentEndpointInfo.refresh();
+ RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
+ try
+ {
+ persistentEndpointInfo.refresh();
+ }
+ catch (InvokerUnavailableException e)
+ {
+ result.appendToStatus("Couldn't refresh endpoint information:
").append(e.getLocalizedMessage());
+ }
+
serviceDescription = getServiceDescription(false);
// do we need to call initCookie or not?
@@ -246,7 +262,8 @@
if (serviceDescription.isRequiresRegistration())
{
// attempt to register and determine if the current service description can
be used to extract POPs
- if (register(serviceDescription))
+ RefreshResult registrationResult = register(serviceDescription);
+ if (registrationResult.specificCode())
{
// registration occurred, so we should ask for a new service description
serviceDescription = getServiceDescription(false);
@@ -254,7 +271,16 @@
// extract the POPs
extractOfferedPortlets(serviceDescription);
- return true;
+
+ String status = registrationResult.getStatus();
+ if (status != null)
+ {
+ result.appendToStatus(status);
+ }
+ result.setHasIssues(registrationResult.hasIssues());
+ result.appendToStatus("Producer information successfully
refreshed");
+
+ return result;
}
else
{
@@ -262,11 +288,11 @@
persistentRegistrationInfo = new RegistrationInfo(this, false);
setServiceDescriptionRequest(getUnregisteredServiceDescriptionRequest());
extractOfferedPortlets(serviceDescription);
- return true;
+ return result;
}
}
- return false;
+ return new RefreshResult(false, REFRESH_MEANING);
}
public String getId()
@@ -607,7 +633,7 @@
* @throws PortletInvokerException
* @since 2.6
*/
- private boolean register(ServiceDescription serviceDescription) throws
PortletInvokerException
+ private RefreshResult register(ServiceDescription serviceDescription) throws
PortletInvokerException
{
if (persistentRegistrationInfo == null)
{
@@ -625,7 +651,8 @@
if (serviceDescription.isRequiresRegistration())
{
// check if the configured registration information is correct and if we can
get the service description
- if (persistentRegistrationInfo.initialize(serviceDescription, getId()))
+ RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription,
persistentId, false, false);
+ if (!result.hasIssues())
{
try
{
@@ -640,9 +667,11 @@
}
persistentRegistrationInfo.setRegistrationContext(registrationContext);
- log.info("Consumer with id '" + persistentId +
"' successfully registered with handle: '"
- + registrationContext.getRegistrationHandle() + "'");
- return true;
+ String msg = "Consumer with id '" + persistentId +
"' successfully registered with handle: '"
+ + registrationContext.getRegistrationHandle() + "'";
+ log.info(msg);
+ result.appendToStatus("\n").append(msg);
+ return new RefreshResult(result, true, REGISTER_MEANING);
}
catch (Exception e)
{
@@ -653,14 +682,14 @@
}
else
{
- log.info("Consumer is not ready to be registered with producer
because of missing or invalid registration information.");
+ log.info(result.getStatus());
setActive(false);
throw new PortletInvokerException("Consumer is not ready to be
registered with producer because of missing or invalid registration information.");
}
}
}
- return false;
+ return new RefreshResult(false, REGISTER_MEANING);
}
public void deregister() throws PortletInvokerException
@@ -690,7 +719,7 @@
}
RegistrationInfo.RegistrationRefreshResult result =
-
persistentRegistrationInfo.refreshRegistrationRequirementsFor(getServiceDescription(true),
persistentId, mergeWithLocalInfo, true);
+ persistentRegistrationInfo.refresh(getServiceDescription(true), persistentId,
mergeWithLocalInfo, true);
registry.updateProducerInfo(this);
log.info("Refreshed registration information for consumer with id '"
+ persistentId + "'");
@@ -700,7 +729,8 @@
public boolean isRefreshNeeded(boolean considerCache)
{
return (considerCache && isCacheExpired())
- || (persistentRegistrationInfo != null &&
persistentRegistrationInfo.isRefreshNeeded())
+ || persistentRegistrationInfo == null
+ || persistentRegistrationInfo.isRefreshNeeded()
|| persistentEndpointInfo.isRefreshNeeded();
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2007-05-04
02:43:12 UTC (rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -32,7 +32,26 @@
{
private StringBuffer status;
private boolean hasIssues;
+ private boolean specificCode;
+ private final String meaning;
+ public RefreshResult(boolean specificCode, String specificCodeMeaning)
+ {
+ this.specificCode = specificCode;
+ this.meaning = specificCodeMeaning;
+ }
+
+ public RefreshResult(RefreshResult previous, boolean specificCode, String
specificCodeMeaning)
+ {
+ this(specificCode, specificCodeMeaning);
+ String status = previous.getStatus();
+ if (status != null)
+ {
+ appendToStatus(status);
+ }
+ setHasIssues(previous.hasIssues);
+ }
+
public boolean hasIssues()
{
return hasIssues;
@@ -66,4 +85,19 @@
return status;
}
+
+ public boolean specificCode()
+ {
+ return specificCode;
+ }
+
+ public void setSpecificCode(boolean specificCode)
+ {
+ this.specificCode = specificCode;
+ }
+
+ public String getMeaning()
+ {
+ return meaning;
+ }
}
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-04
02:43:12 UTC (rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -275,7 +275,7 @@
*/
boolean initialize(ServiceDescription serviceDescription, String producerId)
{
- return !refreshRegistrationRequirementsFor(serviceDescription, producerId, false,
false).hasIssues();
+ return !refresh(serviceDescription, producerId, false, false).hasIssues();
}
@@ -286,9 +286,8 @@
* @param forceRefresh
* @return
*/
- public RegistrationRefreshResult refreshRegistrationRequirementsFor(ServiceDescription
serviceDescription,
- String producerId,
boolean mergeWithLocalInfo,
- boolean
forceRefresh)
+ public RegistrationRefreshResult refresh(ServiceDescription serviceDescription, String
producerId,
+ boolean mergeWithLocalInfo, boolean
forceRefresh)
{
log.debug("RegistrationInfo refresh requested");
@@ -525,6 +524,11 @@
public class RegistrationRefreshResult extends RefreshResult
{
+ public RegistrationRefreshResult()
+ {
+ super(false, "Unused");
+ }
+
private Map registrationProperties;
public Map getRegistrationProperties()
@@ -536,6 +540,16 @@
{
this.registrationProperties = registrationProperties;
}
+
+ public boolean specificCode()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setSpecificCode(boolean specificCode)
+ {
+ throw new UnsupportedOperationException();
+ }
}
private String modifyIfNeeded(String oldValue, String newValue)
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-04
02:43:12 UTC (rev 7189)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-05-04
05:28:38 UTC (rev 7190)
@@ -488,9 +488,9 @@
}
}
- public RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean
eraseLocalData) throws PortletInvokerException
+ public RegistrationInfo.RegistrationRefreshResult refreshRegistrationInfo(boolean
mergeWithLocalInfo) throws PortletInvokerException
{
- return producerInfo.refreshRegistrationInfo(eraseLocalData);
+ return producerInfo.refreshRegistrationInfo(mergeWithLocalInfo);
}
public boolean isActive()
@@ -498,6 +498,16 @@
return producerInfo.isActive() && started;
}
+ public boolean isRefreshNeeded()
+ {
+ return !started || producerInfo.isRefreshNeeded(false);
+ }
+
+ public RefreshResult refresh(boolean forceRefresh) throws PortletInvokerException
+ {
+ return producerInfo.detailedRefresh(forceRefresh);
+ }
+
// Service implementation
*******************************************************************************************
protected void startService() throws Exception
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
===================================================================
---
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-05-04
02:43:12 UTC (rev 7189)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-05-04
05:28:38 UTC (rev 7190)
@@ -9,7 +9,7 @@
<hr/>
- <h:messages styleClass="error"/>
+ <h:messages errorClass="error" infoClass="info"/>
<h:form>
Create a consumer named:
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-04
02:43:12 UTC (rev 7189)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-04
05:28:38 UTC (rev 7190)
@@ -7,30 +7,12 @@
<h:form>
<h1 class="portlet">Consumer '#{consumer.id}'
configuration</h1>
- <h:commandLink action="#{consumersMgr.activateConsumer}"
styleClass="portlet-form-button"
- value="#{consumer.active ? 'Deactivate' :
'Activate'}">
- <f:param name="id" value="#{consumer.id}"/>
- <f:param name="activate" value="#{!consumer.active}"/>
- </h:commandLink>
-
- <h:commandLink action="#{consumersMgr.registerConsumer}"
styleClass="portlet-form-button"
- rendered="#{consumer.active and
consumer.registrationRequired}"
- value="#{consumer.registered ? 'Deregister' :
'Register'}">
- <f:param name="id" value="#{consumer.id}"/>
- <f:param name="register"
value="#{!consumer.registered}"/>
- </h:commandLink>
-
- <h:commandLink action="#{consumersMgr.destroyConsumer}"
value="Destroy" styleClass="portlet-form-button">
- <f:param name="id" value="#{consumer.id}"/>
- </h:commandLink>
-
- <h:commandLink action="#{consumersMgr.listConsumers}" value="Return
to list" styleClass="portlet-form-button"/>
</h:form>
<hr/>
<h:form>
-<h:messages styleClass="error"/>
+<h:messages errorClass="error" infoClass="info"/>
<table width="100%" class="portlet-table-body">
<tr>
<th>Producer id:</th>
@@ -90,48 +72,52 @@
</c:choose>
</td>
</tr>
-<tr>
- <th>Registration information<br/><br/>
- <h:commandLink action="#{consumer.refreshRegistrationInfo}"
value="Validate" styleClass="portlet-form-button">
- <f:param name="eraseLocalData" value="false"/>
- </h:commandLink>
- <h:commandLink action="#{consumer.refreshRegistrationInfo}"
value="Replace" styleClass="portlet-form-button">
- <f:param name="eraseLocalData" value="true"/>
- </h:commandLink>
- </th>
- <td>
- <c:choose>
- <c:when test="#{consumer.registrationRequired}">
- <c:choose>
- <c:when test="#{!empty
consumer.producerInfo.registrationInfo.registrationPropertyNames}">
- <table border='1' cellspacing='0'
class='registration-prop-table'>
- <tr>
- <th>Name</th>
- <th>Value</th>
- </tr>
- <c:forEach
items="#{consumer.producerInfo.registrationInfo.registrationProperties}"
var="prop">
- <tr title="#{prop.description.label.value}">
- <td>
- <h:inputText value="#{prop.name}"
size="40"/>
- </td>
- <td>
- <h:inputText value="#{prop.value}"
size="40"/>
- </td>
+<c:if test="#{consumer.refreshNeeded}">
+ <tr>
+ <td colspan="2" class="info">
+ There have been changes in the Producer configuration (or the Producer's
service description has not yet
+ been retrieved), refreshing the Consumer might be a good idea.
+ </td>
+ </tr>
+</c:if>
+<c:if test="#{!consumer.refreshNeeded}">
+ <tr>
+ <th>Registration information</th>
+ <td>
+ <c:choose>
+ <c:when test="#{consumer.registrationRequired}">
+ <c:choose>
+ <c:when test="#{!empty
consumer.producerInfo.registrationInfo.registrationPropertyNames}">
+ <table border='1' cellspacing='0'
class='registration-prop-table'>
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
</tr>
- </c:forEach>
- </table>
- </c:when>
- <c:otherwise>
- No required registration properties.
- </c:otherwise>
- </c:choose>
- </c:when>
- <c:otherwise>
- Producer doesn't require registration.
- </c:otherwise>
- </c:choose>
- </td>
-</tr>
+ <c:forEach
items="#{consumer.producerInfo.registrationInfo.registrationProperties}"
var="prop">
+ <tr title="#{prop.description.label.value}">
+ <td>
+ <h:outputText value="#{prop.name}"/>
+ </td>
+ <td>
+ <h:inputText value="#{prop.value}"
size="40"/>
+ <h:outputText styleClass="error"
value="#{prop.status}" rendered="#{prop.invalid}"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ No required registration properties.
+ </c:otherwise>
+ </c:choose>
+ </c:when>
+ <c:otherwise>
+ Producer doesn't require registration.
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+</c:if>
<c:if
test="#{consumer.producerInfo.registrationInfo.registrationValid}">
<tr>
<th>Registration context:</th>
@@ -141,12 +127,39 @@
</tr>
</c:if>
<tr>
- <td colspan="2">
+ <td>
<h:commandButton action="#{consumer.update}" value="Save"
styleClass="portlet-form-button"/>
+ <h:commandLink action="#{consumer.refresh}" value="Refresh"
title="Refresh information from Producer"
+ styleClass="portlet-form-button">
+ <f:param name="eraseLocalData" value="true"/>
+ </h:commandLink>
</td>
+ <td style="text-align: right;">
+ <h:commandLink action="#{consumersMgr.listConsumers}"
value="Return to list" styleClass="portlet-form-button"/>
+ </td>
</tr>
+<tr>
+ <td>
+ <h:commandLink action="#{consumersMgr.activateConsumer}"
styleClass="portlet-form-button"
+ value="#{consumer.active ? 'Deactivate' :
'Activate'}">
+ <f:param name="id" value="#{consumer.id}"/>
+ <f:param name="activate"
value="#{!consumer.active}"/>
+ </h:commandLink>
+
+ <h:commandLink action="#{consumersMgr.registerConsumer}"
styleClass="portlet-form-button"
+ rendered="#{consumer.active and
consumer.registrationRequired}"
+ value="#{consumer.registered ? 'Deregister' :
'Register'}">
+ <f:param name="id" value="#{consumer.id}"/>
+ <f:param name="register"
value="#{!consumer.registered}"/>
+ </h:commandLink>
+
+ </td>
+ <td style="text-align: right;">
+ <h:commandLink action="#{consumersMgr.destroyConsumer}"
value="Destroy" styleClass="portlet-form-button">
+ <f:param name="id" value="#{consumer.id}"/>
+ </h:commandLink>
+ </td>
+</tr>
</table>
-
-<hr/>
</h:form>
</div>
\ No newline at end of file