Author: chris.laprun(a)jboss.com
Date: 2007-10-01 21:42:51 -0400 (Mon, 01 Oct 2007)
New Revision: 8510
Added:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/LocalizedStringConverter.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css
Log:
- JBPORTAL-1715: first pass at producer configuration, read-only for now.
- Renamed WSRP admin portlet (and related objects) to WSRPConfigurationPortlet (and
related) as it deals with more than just consumers now.
- NOTE: ProducerBean required Java 5 (not actually needed, just switching to using Java 5
now).
Copied:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/LocalizedStringConverter.java
(from rev 8509,
trunk/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/LocalizedStringConverter.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/LocalizedStringConverter.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/LocalizedStringConverter.java 2007-10-02
01:42:51 UTC (rev 8510)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.admin.ui;
+
+import org.jboss.portal.wsrp.registration.LocalizedString;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6.3
+ */
+public class LocalizedStringConverter implements Converter
+{
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
s)
+ {
+ return s == null ? null : new LocalizedString(s);
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
o)
+ {
+ return o == null ? null : ((LocalizedString)o).getValue();
+ }
+}
Copied:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
(from rev 8509,
trunk/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2007-10-02
01:42:51 UTC (rev 8510)
@@ -0,0 +1,142 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.admin.ui;
+
+import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
+import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6.3
+ */
+public class ProducerBean extends ManagedBean
+{
+ private ProducerConfiguration configuration;
+ private String policyClassName;
+ private String validatorClassName;
+
+ public ProducerConfiguration getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void setConfiguration(ProducerConfiguration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public boolean isRegistrationRequiredForFullDescription()
+ {
+ return getRegRequirements().isRegistrationRequiredForFullDescription();
+ }
+
+ private ProducerRegistrationRequirements getRegRequirements()
+ {
+ return configuration.getRegistrationRequirements();
+ }
+
+ public void setRegistrationRequiredForFullDescription(boolean
requireRegForFullDescription)
+ {
+
getRegRequirements().setRegistrationRequiredForFullDescription(requireRegForFullDescription);
+ }
+
+ public boolean isRegistrationRequired()
+ {
+ return getRegRequirements().isRegistrationRequired();
+ }
+
+ public void setRegistrationRequired(boolean requireRegistration)
+ {
+ getRegRequirements().setRegistrationRequired(requireRegistration);
+ }
+
+ public String getRegistrationPolicyClassName()
+ {
+ RegistrationPolicy policy = getRegRequirements().getPolicy();
+ if (policy != null)
+ {
+ return policy.getClass().getName();
+ }
+ else
+ {
+ return "RegistrationPolicy unset";
+ }
+ }
+
+ public void setRegistrationPolicyClassName(String className)
+ {
+ policyClassName = className;
+ }
+
+ public boolean isDefaultRegistrationPolicy()
+ {
+ return
ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME.equals(getRegistrationPolicyClassName());
+ }
+
+ public String getValidatorClassName()
+ {
+ if (isDefaultRegistrationPolicy())
+ {
+ return
((DefaultRegistrationPolicy)getRegRequirements().getPolicy()).getValidator().getClass().getName();
+ }
+ throw new IllegalStateException("getValidatorClassName shouldn't be called
if we're not using the default registration");
+ }
+
+ public void setValidatorClassName(String className)
+ {
+ validatorClassName = className;
+ }
+
+ public List<RegistrationPropertyDescription> getRegistrationProperties()
+ {
+ Map descriptions = getRegRequirements().getRegistrationProperties();
+ Comparator<RegistrationPropertyDescription> descComparator = new
Comparator<RegistrationPropertyDescription>()
+ {
+ public int compare(RegistrationPropertyDescription o1,
RegistrationPropertyDescription o2)
+ {
+ return o1.getName().toString().compareTo(o2.getName().toString());
+ }
+ };
+
+ List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>(descriptions.values());
+ Collections.sort(result, descComparator);
+ return result;
+ }
+
+ public List<SelectItem> getSupportedPropertyTypes()
+ {
+ return Collections.singletonList(new SelectItem("xsd:string"));
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -32,6 +32,11 @@
<view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
</application>
+ <converter>
+
<converter-for-class>org.jboss.portal.wsrp.registration.LocalizedString</converter-for-class>
+
<converter-class>org.jboss.portal.wsrp.admin.ui.LocalizedStringConverter</converter-class>
+ </converter>
+
<managed-bean>
<managed-bean-name>beanContext</managed-bean-name>
<managed-bean-class>org.jboss.portal.wsrp.admin.ui.JSFBeanContext</managed-bean-class>
@@ -75,6 +80,21 @@
<value>#{beanContext}</value>
</managed-property>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>producer</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.wsrp.admin.ui.ProducerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>configuration</property-name>
+
<property-class>org.jboss.portal.wsrp.producer.config.ProducerConfiguration</property-class>
+
<value>#{applicationScope.ProducerConfigurationService.configuration}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+
<property-class>org.jboss.portal.wsrp.admin.ui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
+ </managed-bean>
<navigation-rule>
<navigation-case>
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jboss-portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jboss-portlet.xml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jboss-portlet.xml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -20,10 +20,11 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
"http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<portlet>
- <portlet-name>WSRPConsumersConfigurationPortlet</portlet-name>
+ <portlet-name>WSRPConfigurationPortlet</portlet-name>
<transaction>
<trans-attribute>Required</trans-attribute>
</transaction>
@@ -36,5 +37,10 @@
<service-class>org.jboss.portal.wsrp.consumer.ConsumerRegistry</service-class>
<service-ref>portal.wsrp:service=ConsumerRegistry</service-ref>
</service>
+ <service>
+ <service-name>ProducerConfigurationService</service-name>
+
<service-class>org.jboss.portal.wsrp.producer.config.ProducerConfigurationService</service-class>
+ <service-ref>portal.wsrp:service=ProducerConfiguration</service-ref>
+ </service>
</portlet-app>
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -8,24 +8,86 @@
<h:form>
<ul class="topnav">
<li><h:commandLink action="#{consumersMgr.listConsumers}"
value="Consumers"/></li>
- <li class="currentTab">Producer</li>
+ <li id="currentTab">Producer</li>
</ul>
</h:form>
<ui:decorate template="common/tabContainer.xhtml">
<ui:define name="tab-container-content">
+
<h3 class="sectionTitle">Producer configuration</h3>
<!-- Status message -->
<h:message id="status" for="status"
infoClass="portlet-msg-success" errorClass="portlet-msg-error"
fatalClass="portlet-msg-error"
warnClass="portlet-msg-alert"/>
- <p>Feature not quite ready yet! Please refer to Portal's
- <a
href="http://docs.jboss.com/jbportal/v2.6/referenceGuide/html/wsrp.h...
to
- learn how to configure JBoss Portal's WSRP producer.
- </p>
+ <h:form>
+ <h:panelGrid columns="2" width="100%">
+ <h:selectBooleanCheckbox
value="#{producer.registrationRequiredForFullDescription}"/>
+ <h:outputText value="Access to full service description requires
consumers to be registered."/>
+ <h:selectBooleanCheckbox
value="#{producer.registrationRequired}"/>
+ <h:outputText value="Requires registration."/>
+
+ <h:outputText value=" "
rendered="#{producer.registrationRequired}"/>
+ <h:panelGroup>
+ <h:panelGrid columns="2"
rendered="#{producer.registrationRequired}" width="100%">
+ <h:outputLabel value="Registration policy class name:"
for="registrationPolicy"/>
+ <h:inputText id="registrationPolicy"
value="#{producer.registrationPolicyClassName}" size="80"/>
+
+ <h:outputLabel value="Registration property validator class
name:" for="validator"
+
rendered="#{producer.defaultRegistrationPolicy}"/>
+ <h:inputText id="validator"
value="#{producer.validatorClassName}" size="80"
+
rendered="#{producer.defaultRegistrationPolicy}"/>
+
+ </h:panelGrid>
+ </h:panelGroup>
+
+ <h:outputText value=" "
rendered="#{producer.registrationRequired}"/>
+ <h:panelGroup
rendered="#{producer.registrationRequired}">
+ <h:outputText styleClass="portlet-area-header"
value="Registration properties"/>
+ <h:panelGroup styleClass="portlet-area-body">
+ <c:choose>
+ <c:when test="#{!empty
producer.registrationProperties}">
+ <h:dataTable var="property"
id="registrationProperties" width="100%"
+
value="#{producer.registrationProperties}"
+
rendered="#{producer.registrationRequired}"
+
headerClass="portlet-section-header">
+ <h:column>
+ <f:facet
name="header">Name</f:facet>
+ <h:inputText value="#{property.name}"
size="60"/>
+ </h:column>
+ <h:column>
+ <f:facet
name="header">Type</f:facet>
+ <h:selectOneListbox disabled="true">
+ <f:selectItems
value="#{producer.supportedPropertyTypes}"/>
+ </h:selectOneListbox>
+ </h:column>
+ <h:column>
+ <f:facet
name="header">Label</f:facet>
+ <h:inputText value="#{property.label}"
size="60"/>
+ </h:column>
+ <h:column>
+ <f:facet
name="header">Hint</f:facet>
+ <h:inputText value="#{property.hint}"
size="60"/>
+ </h:column>
+ </h:dataTable>
+ <h:commandLink
action="#{producer.addRegistrationProperty}" value="Add property"
+
styleClass="portlet-form-button"/>
+ </c:when>
+ <c:otherwise>
+ <h:outputText value="No specified required
registration properties."/>
+ </c:otherwise>
+ </c:choose>
+ </h:panelGroup>
+ </h:panelGroup>
+
+ <h:outputText value=" "/>
+ <h:commandLink action="#{producer.save}"
value="Save" styleClass="portlet-form-button"/>
+ </h:panelGrid>
+ </h:form>
+
</ui:define>
</ui:decorate>
</div>
\ No newline at end of file
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet-instances.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet-instances.xml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet-instances.xml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -25,8 +25,8 @@
<deployments>
<deployment>
<instance>
-
<instance-id>WSRPConsumersConfigurationPortletInstance</instance-id>
- <portlet-ref>WSRPConsumersConfigurationPortlet</portlet-ref>
+ <instance-id>WSRPConfigurationPortletInstance</instance-id>
+ <portlet-ref>WSRPConfigurationPortlet</portlet-ref>
<security-constraint>
<policy-permission>
<role-name>Admin</role-name>
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet.xml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/portlet.xml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -26,9 +26,9 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0">
<portlet>
- <description>Configuration portlet for WSRP remote
producers.</description>
- <portlet-name>WSRPConsumersConfigurationPortlet</portlet-name>
- <display-name>WSRP Consumers Configuration</display-name>
+ <description>Configuration portlet for WSRP.</description>
+ <portlet-name>WSRPConfigurationPortlet</portlet-name>
+ <display-name>WSRP Configuration</display-name>
<portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
<init-param>
<name>default-view</name>
@@ -39,7 +39,7 @@
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
- <title>WSRP Consumers Configuration</title>
+ <title>WSRP Configuration</title>
<keywords>management,admin,wsrp</keywords>
</portlet-info>
</portlet>
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/wsrp-object.xml 2007-10-02
01:42:51 UTC (rev 8510)
@@ -31,21 +31,21 @@
<if-exists>keep</if-exists>
<page>
<page-name>WSRP</page-name>
+ <properties>
+ <property>
+ <name>layout.id</name>
+ <value>1column</value>
+ </property>
+ </properties>
<security-constraint>
<policy-permission>
<action-name>viewrecursive</action-name>
<role-name>Admin</role-name>
</policy-permission>
</security-constraint>
- <properties>
- <property>
- <name>layout.id</name>
- <value>1column</value>
- </property>
- </properties>
<window>
-
<window-name>WSRPConsumersConfigurationPortletWindow</window-name>
-
<instance-ref>WSRPConsumersConfigurationPortletInstance</instance-ref>
+ <window-name>WSRPConfigurationPortletWindow</window-name>
+ <instance-ref>WSRPConfigurationPortletInstance</instance-ref>
<region>center</region>
<height>0</height>
<properties>
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css 2007-10-02
01:40:39 UTC (rev 8509)
+++
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/style.css 2007-10-02
01:42:51 UTC (rev 8510)
@@ -265,4 +265,25 @@
.portlet-msg-alert:before {
content: "Warning: "
+}
+
+.wsrp-consumers-ui .portlet-area-header {
+ border: 1px solid #54708c;
+ font-weight: bold;
+ color: #fff;
+ font-size: 11px;
+ background-color: #5986b3;
+ padding: 2px;
+ padding-left: 4px;
+ margin: 0;
+ display: block;
+}
+
+.wsrp-consumers-ui .portlet-area-body {
+ border: 1px solid #d5d5d5;
+ border-top: 0px;
+ background-color: #fff;
+ padding: 4px;
+ margin: 0;
+ display: block;
}
\ No newline at end of file