Author: chris.laprun(a)jboss.com
Date: 2007-03-15 01:19:32 -0400 (Thu, 15 Mar 2007)
New Revision: 6675
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
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:
- More WSRP consumer UI: register/deregister seem to work, activate/deactivate
doesn't.
- Need to find a way to return properly to the list view.
- Added registerOrDeregisterConsumerWith method on ConsumerRegistry.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-15
02:28:26 UTC (rev 6674)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-15
05:19:32 UTC (rev 6675)
@@ -107,4 +107,9 @@
{
// do nothing
}
+
+ public void registerOrDeregisterConsumerWith(String id, boolean register)
+ {
+ // do nothing
+ }
}
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-03-15
02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-15
05:19:32 UTC (rev 6675)
@@ -64,11 +64,42 @@
public String activateConsumer()
{
- return null;
+ if (refreshConsumerId() != null)
+ {
+ boolean activate =
Boolean.valueOf(getParameter("activate")).booleanValue();
+ if (activate)
+ {
+ registry.activateConsumerWith(selectedId);
+ }
+ else
+ {
+ registry.deactivateConsumerWith(selectedId);
+ }
+ }
+ else
+ {
+ // todo: error message
+ }
+
+ return "index";
}
public String registerConsumer()
{
+ if (refreshConsumerId() != null)
+ {
+ boolean register =
Boolean.valueOf(getParameter("register")).booleanValue();
+
+ registry.registerOrDeregisterConsumerWith(selectedId, register);
+
+ // show consumer configuration
+ return "configureConsumer";
+ }
+ else
+ {
+ // todo: error message
+ }
+
return null;
}
@@ -79,7 +110,7 @@
public String configureConsumer()
{
- if (getSelectedConsumerId() != null)
+ if (refreshConsumerId() != null)
{
return "configureConsumer";
}
@@ -87,10 +118,15 @@
return null;
}
- private String getSelectedConsumerId()
+ private String refreshConsumerId()
{
- Map pmap =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedId = (String)pmap.get("id");
+ selectedId = getParameter("id");
return selectedId;
}
+
+ private String getParameter(String key)
+ {
+ Map pmap =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ return (String)pmap.get(key);
+ }
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-15
02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-15
05:19:32 UTC (rev 6675)
@@ -58,4 +58,6 @@
RegistrationInfo getDefaultRegistrationInfo();
void deactivateConsumerWith(String id) throws ConsumerException;
+
+ void registerOrDeregisterConsumerWith(String id, boolean register);
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-15
02:28:26 UTC (rev 6674)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-15
05:19:32 UTC (rev 6675)
@@ -28,6 +28,7 @@
import org.hibernate.SessionFactory;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
@@ -228,6 +229,34 @@
return nullRegistration;
}
+ public void registerOrDeregisterConsumerWith(String id, boolean register)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer
identifier", "registerConsumerWith");
+
+ WSRPConsumer consumer = getConsumer(id);
+
+ if (consumer == null)
+ {
+ throw new ConsumerException("Consumer with id '" + id +
"' doesn't exist!");
+ }
+
+ try
+ {
+ if (register)
+ {
+ consumer.getProducerInfo().register();
+ }
+ else
+ {
+ consumer.getProducerInfo().deregister();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ConsumerException("Couldn't " + (register ?
"register" : "deregister") + " Consumer '" + id +
"'", e);
+ }
+ }
+
private void startOrStopConsumer(String id, boolean start)
{
WSRPConsumer consumer = getConsumer(id);
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-15 02:28:26
UTC (rev 6674)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-15 05:19:32
UTC (rev 6675)
@@ -53,4 +53,12 @@
<to-view-id>/WEB-INF/jsf/consumers/editConsumer.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/WEB-INF/jsf/consumers/editConsumer.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>index</from-outcome>
+ <to-view-id>/WEB-INF/jsf/consumers/consumers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
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-03-15
02:28:26 UTC (rev 6674)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-15
05:19:32 UTC (rev 6675)
@@ -38,11 +38,13 @@
<h:outputText value="Configure"/>
</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"}'/>
</h:commandLink>
<c:if test="#{consumer.producerInfo.active}"> |
<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> | <h:commandLink
action="#{consumersMgr.destroyConsumer}">
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-03-15
02:28:26 UTC (rev 6674)
+++
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-15
05:19:32 UTC (rev 6675)
@@ -5,99 +5,103 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <h1 class="portlet">Consumer
'#{consumersMgr.selectedConsumer.producerId}' configuration</h1>
+<h1 class="portlet">Consumer
'#{consumersMgr.selectedConsumer.producerId}' configuration</h1>
- <hr/>
+<hr/>
- <h:form>
- <table width="100%" class="portlet-table-body">
- <tr>
- <th>Producer id:</th>
- <td><h:inputText
value="#{consumersMgr.selectedConsumer.producerId}"/></td>
- </tr>
- <tr>
- <th>Cache expiration:</th>
- <td><h:inputText
value="#{consumersMgr.selectedConsumer.producerInfo.expirationCacheSeconds}"/>
(seconds
- before expiration)
- </td>
- </tr>
- <tr>
- <th>Endpoint configuration:</th>
- <td>
- <table border="0" class='portlet-table-body'>
- <tr>
- <th class="portlet-form-field-label">Service
Description URL:</th>
- <td><h:inputText size="50"
-
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Markup
URL:</th>
- <td><h:inputText size="50"
-
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Registration
URL:</th>
- <td><h:inputText size="50"
-
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Portlet
Management URL:</th>
- <td><h:inputText size="50"
-
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">WSDL
URL:</th>
- <td><h:inputText size="50"
-
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th><h:selectBooleanCheckbox
-
value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.requiresRegistration}"/>Requires
- registration?
- </th>
- <td>
- <c:choose>
- <c:when
- test="#{!empty
consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
- <table border='1' cellspacing='0'
class='portlet-table-body'>
+<h:form>
+ <table width="100%" class="portlet-table-body">
+ <tr>
+ <th>Producer id:</th>
+ <td><h:inputText
value="#{consumersMgr.selectedConsumer.producerId}"/></td>
+ </tr>
+ <tr>
+ <th>Cache expiration:</th>
+ <td><h:inputText
value="#{consumersMgr.selectedConsumer.producerInfo.expirationCacheSeconds}"/>
(seconds
+ before expiration)
+ </td>
+ </tr>
+ <tr>
+ <th>Endpoint configuration:</th>
+ <td>
+ <table border="0" class='portlet-table-body'>
+ <tr>
+ <th class="portlet-form-field-label">Service
Description URL:</th>
+ <td><h:inputText size="50"
+
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Markup
URL:</th>
+ <td><h:inputText size="50"
+
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Registration
URL:</th>
+ <td><h:inputText size="50"
+
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Portlet Management
URL:</th>
+ <td><h:inputText size="50"
+
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">WSDL
URL:</th>
+ <td><h:inputText size="50"
+
value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th><h:selectBooleanCheckbox
+
value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.requiresRegistration}"/>Requires
+ registration?
+ </th>
+ <td>
+ <c:choose>
+ <c:when
+ test="#{!empty
consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
+ <table border='1' cellspacing='0'
class='portlet-table-body'>
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
+ <th>Description</th>
+ </tr>
+ <c:forEach
+
items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop">
<tr>
- <th>Name</th>
- <th>Value</th>
- <th>Description</th>
+ <td><h:inputText
value="#{prop.name}"/></td>
+ <td><h:inputText
value="#{prop.value}"/></td>
+ <td><h:outputText
value="#{prop.description.label.value}"/></td>
</tr>
- <c:forEach
-
items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
- var="prop">
- <tr>
- <td><h:inputText
value="#{prop.name}"/></td>
- <td><h:inputText
value="#{prop.value}"/></td>
- <td><h:outputText
value="#{prop.description.label.value}"/></td>
- </tr>
- </c:forEach>
- </table>
- </c:when>
- <c:otherwise>
- No required registration properties.
- </c:otherwise>
- </c:choose>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ No required registration properties.
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <c:if
test="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationValid}">
+ <tr>
+ <th>Registration context:</th>
+ <td>Handle: <h:outputText
+
value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
</td>
</tr>
- <c:if
test="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationValid}">
- <tr>
- <th>Registration context:</th>
- <td>Handle: <h:outputText
-
value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
- </td>
- </tr>
- </c:if>
- </table>
- </h:form>
+ </c:if>
+ </table>
+
+ <hr/>
+
+ <h:commandButton action="index" value="Back"/>
+</h:form>
</div>
\ No newline at end of file