Author: chris.laprun(a)jboss.com
Date: 2007-05-04 23:27:23 -0400 (Fri, 04 May 2007)
New Revision: 7195
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.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/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/style.css
Log:
- JBPORTAL-715: Improved layout, behavior and information reporting
+ Fixed display of registration information
+ Moved refresh functionality to ConsumerManagerBean
+ Better display of consumer status
+ Can refresh from consumer list
+ Still needs work and testing.
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-05
03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-05-05
03:27:23 UTC (rev 7195)
@@ -23,11 +23,9 @@
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;
@@ -176,11 +174,21 @@
return getProducerInfo().isRegistrationRequired();
}
+ public boolean isRegistrationChecked()
+ {
+ return getProducerInfo().isRegistrationChecked();
+ }
+
public ProducerInfo getProducerInfo()
{
return consumer.getProducerInfo();
}
+ public boolean isLocalInfoPresent()
+ {
+ return getProducerInfo().hasLocalRegistrationInfo();
+ }
+
// Actions
public String update()
@@ -234,35 +242,6 @@
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/admin/ui/ConsumerManagerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-05-05
03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-05-05
03:27:23 UTC (rev 7195)
@@ -23,8 +23,10 @@
package org.jboss.portal.wsrp.admin.ui;
import org.jboss.portal.common.util.ParameterValidation;
+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.RefreshResult;
import javax.faces.context.FacesContext;
import java.util.ArrayList;
@@ -191,6 +193,36 @@
}
}
+ public String refreshConsumer()
+ {
+ if (refreshConsumerId() != null)
+ {
+ try
+ {
+ RefreshResult result = getSelectedConsumer().refresh(true);
+ if (result.hasIssues())
+ {
+ createErrorMessage(result.getStatus());
+ }
+ else
+ {
+ createInfoMessage(null, result.getStatus());
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ createErrorMessageFrom(e);
+ }
+
+ return configureConsumer();
+ }
+ else
+ {
+ noSelectedConsumerError();
+ return null;
+ }
+ }
+
public String listConsumers()
{
setConsumerIdInSession(true);
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
03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-05-05
03:27:23 UTC (rev 7195)
@@ -178,6 +178,11 @@
return persistentRegistrationInfo != null &&
persistentRegistrationInfo.isRegistrationRequired() != null;
}
+ public boolean hasLocalRegistrationInfo()
+ {
+ return persistentRegistrationInfo != null &&
persistentRegistrationInfo.hasLocalInfo();
+ }
+
/**
* Determines whether the associated consumer is active.
*
@@ -651,7 +656,7 @@
if (serviceDescription.isRequiresRegistration())
{
// check if the configured registration information is correct and if we can
get the service description
- RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription,
persistentId, false, false);
+ RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription,
persistentId, true, false);
if (!result.hasIssues())
{
try
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-05
03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2007-05-05
03:27:23 UTC (rev 7195)
@@ -80,7 +80,7 @@
}
else
{
- status.append(" ").append(message);
+ status.append("\n").append(message);
}
return status;
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
03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-05-05
03:27:23 UTC (rev 7195)
@@ -152,6 +152,11 @@
return requiresRegistration != null &&
!requiresRegistration.booleanValue();
}
+ public boolean hasLocalInfo()
+ {
+ return persistentRegistrationHandle != null ||
!getRegistrationProperties().isEmpty();
+ }
+
public RegistrationData getRegistrationData()
{
if (registrationData == null)
@@ -306,7 +311,7 @@
if (serviceDescription.isRequiresRegistration())
{
requiresRegistration = Boolean.TRUE;
- StringBuffer message = new StringBuffer("Producer
'").append(producerId).append("' requires registration.");
+ StringBuffer message = new StringBuffer("Producer
'").append(producerId).append("' requires registration");
result.appendToStatus(message.toString());
log.debug(message);
@@ -364,7 +369,7 @@
}
else
{
- String msg = "Producer '" + producerId + "'
doesn't require registration.";
+ String msg = "Producer '" + producerId + "'
doesn't require registration";
log.debug(msg);
result.appendToStatus(msg);
requiresRegistration = Boolean.FALSE;
@@ -393,12 +398,12 @@
private void handleNoRequiredRegistrationProperties(String producerId,
RegistrationRefreshResult result, boolean keepExtra)
{
- log.info("The producer didn't require any specific registration
properties.");
+ log.info("The producer didn't require any specific registration
properties");
Map properties = getRegistrationProperties();
if (!properties.isEmpty())
{
String msg = "Registration data is available for producer '"
- + producerId + "' when none is expected by the producer.";
+ + producerId + "' when none is expected by the producer";
log.info(msg);
checkForExtraProperties(producerId, result, Collections.EMPTY_SET, properties,
keepExtra);
}
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-05
03:23:14 UTC (rev 7194)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-05-05
03:27:23 UTC (rev 7195)
@@ -15,7 +15,8 @@
Create a consumer named:
<h:inputText value="#{consumersMgr.selectedId}"
id="consumerName"/><h:message styleClass="error"
for="consumerName"/>
- <h:commandButton action="#{consumersMgr.createConsumer}"
value="Create Consumer"/>
+ <h:commandButton action="#{consumersMgr.createConsumer}"
value="Create Consumer"
+ styleClass="portlet-form-button"/>
</h:form>
<table width="100%" class="portlet-table-body">
@@ -28,40 +29,45 @@
<td colspan="2">Legend:
<span class="active">active</span>
<span class="inactive">inactive</span>
+ <span class="needsRefresh">needs refresh</span>
</td>
</tr>
</thead>
<tbody>
<h:form>
<c:forEach items="#{consumersMgr.consumers}"
var="consumer">
- <tr class="#{consumer.producerInfo.active ? 'active' :
'inactive'}">
+ <tr class="#{consumer.active ? 'active' :
'inactive'} #{consumer.refreshNeeded ? 'needsRefresh' :
''}">
<td>
<h:commandLink
action="#{consumersMgr.configureConsumer}">
<f:param name="id"
value="#{consumer.producerId}"/>
<h:outputText
- value="#{consumer.producerId}
(#{consumer.producerInfo.active ? 'active' : 'inactive'})"/>
+ value="#{consumer.producerId} (#{consumer.active ?
'active' : 'inactive'})
+ #{consumer.refreshNeeded ? '(refresh needed)' :
''}"/>
</h:commandLink>
</td>
<td>
<h:commandLink
action="#{consumersMgr.configureConsumer}">
<f:param name="id"
value="#{consumer.producerId}"/>
<h:outputText value="Configure"/>
- </h:commandLink>
- |
+ </h:commandLink> |
+ <h:commandLink
action="#{consumersMgr.refreshConsumer}">
+ <f:param name="id"
value="#{consumer.producerId}"/>
+ <h:outputText value="Refresh"/>
+ </h:commandLink> |
<h:commandLink
action="#{consumersMgr.activateConsumer}">
<f:param name="id"
value="#{consumer.producerId}"/>
- <f:param name="activate"
value="#{!consumer.producerInfo.active}"/>
- <h:outputText value="#{consumer.producerInfo.active ?
'Deactivate' : 'Activate'}"/>
+ <f:param name="activate"
value="#{!consumer.active}"/>
+ <h:outputText value="#{consumer.active ?
'Deactivate' : 'Activate'}"/>
</h:commandLink>
- <c:if test="#{consumer.producerInfo.active and
consumer.producerInfo.registrationRequired}"> |
- <h:commandLink
- action="#{consumersMgr.registerConsumer}">
+ <c:if
+ test="#{!consumer.refreshNeeded and consumer.active and
consumer.producerInfo.registrationRequired}">
+ |
+ <h:commandLink
action="#{consumersMgr.registerConsumer}">
<f:param name="id"
value="#{consumer.producerId}"/>
<f:param name="register"
value="#{!consumer.producerInfo.registered}"/>
<h:outputText
value="#{consumer.producerInfo.registered ? 'Deregister' :
'Register'}"/>
</h:commandLink>
- </c:if>
- |
+ </c:if> |
<h:commandLink
action="#{consumersMgr.destroyConsumer}">
<f:param name="id"
value="#{consumer.producerId}"/>
<h:outputText value="Destroy"/>
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
03:23:14 UTC (rev 7194)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-05-05
03:27:23 UTC (rev 7195)
@@ -5,9 +5,10 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
-<h:form>
- <h1 class="portlet">Consumer '#{consumer.id}'
configuration</h1>
-</h:form>
+<h1
+ class="portlet-section-header #{consumer.active ? 'active' :
'inactive'} #{consumer.refreshNeeded ? 'needsRefresh' :
''}">
+ Consumer '#{consumer.id}' configuration (#{consumer.active ? 'active'
: 'inactive'})
+ #{consumer.refreshNeeded ? '(refresh needed)' : ''}</h1>
<hr/>
@@ -72,20 +73,12 @@
</c:choose>
</td>
</tr>
-<c:if test="#{consumer.refreshNeeded}">
+<c:if test="#{!consumer.refreshNeeded or consumer.registrationChecked}">
<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:when test="#{consumer.localInfoPresent}">
<c:choose>
<c:when test="#{!empty
consumer.producerInfo.registrationInfo.registrationPropertyNames}">
<table border='1' cellspacing='0'
class='registration-prop-table'>
@@ -107,31 +100,44 @@
</table>
</c:when>
<c:otherwise>
- No required registration properties.
+ Registration is indicated as required without registration
properties.
</c:otherwise>
</c:choose>
</c:when>
- <c:otherwise>
+ <c:when test="#{consumer.registrationChecked and
!consumer.registrationRequired}">
Producer doesn't require registration.
- </c:otherwise>
+ </c:when>
</c:choose>
</td>
</tr>
+ <c:if test="#{!empty
consumer.producerInfo.registrationInfo.registrationHandle}">
+ <tr>
+ <th>Registration context:</th>
+ <td>Handle:
+ <h:outputText
value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+ </td>
+ </tr>
+ </c:if>
+ <c:if test="#{!consumer.registrationChecked}">
+ <tr>
+ <td colspan="2">
+ <p class="info">Registration information hasn't been
validated with the Producer. You should validate
+ it.</p>
+ <h:commandLink action="#{consumer.refreshRegistrationInfo}"
value="Validate"
+ title="Validate registration info from Producer"
+ styleClass="portlet-form-button">
+ <f:param name="eraseLocalInfo" value="false"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:if>
</c:if>
-<c:if
test="#{consumer.producerInfo.registrationInfo.registrationValid}">
- <tr>
- <th>Registration context:</th>
- <td>Handle:
- <h:outputText
value="#{consumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
- </td>
- </tr>
-</c:if>
<tr>
<td>
<h:commandButton action="#{consumer.update}" value="Save"
styleClass="portlet-form-button"/>
- <h:commandLink action="#{consumer.refresh}" value="Refresh"
title="Refresh information from Producer"
+ <h:commandLink action="#{consumersMgr.refreshConsumer}"
value="Refresh" title="Refresh information from Producer"
styleClass="portlet-form-button">
- <f:param name="eraseLocalData" value="true"/>
+ <f:param name="id" value="#{consumer.id}"/>
</h:commandLink>
</td>
<td style="text-align: right;">
Modified: trunk/wsrp/src/resources/portal-wsrp-war/style.css
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-05-05 03:23:14 UTC (rev 7194)
+++ trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-05-05 03:27:23 UTC (rev 7195)
@@ -28,15 +28,19 @@
padding-top: 2px;
}
-.wsrp-consumers-ui .active {
+.wsrp-consumers-ui .active, .wsrp-consumer-ui .active {
background-color: #C7DDB7;
font-weight: bold;
}
-.wsrp-consumers-ui .inactive {
+.wsrp-consumers-ui .inactive, .wsrp-consumer-ui .inactive {
background-color: #EBD1B8;
}
+.wsrp-consumers-ui .needsRefresh, .wsrp-consumer-ui .needsRefresh {
+ font-style: italic;
+}
+
.wsrp-consumer-ui .registration-prop-table {
text-align: left;
border: 0;
@@ -57,7 +61,15 @@
color: red;
}
+.error:before {
+ content: "Error: "
+}
+
.info {
font-weight: bold;
color: green;
+}
+
+.info:before {
+ content: "Info: "
}
\ No newline at end of file