Author: chris.laprun(a)jboss.com
Date: 2011-03-03 10:59:11 -0500 (Thu, 03 Mar 2011)
New Revision: 5960
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/jsf/producer/producer.xhtml
Log:
- GTNWSRP-201: Fixed improper state management by making local configuration deal with
strict mode as well. Made the registration required for full service description and
strict mode immediate and with a value change listener to properly handle state change.
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-03-03
15:50:49 UTC (rev 5959)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-03-03
15:59:11 UTC (rev 5960)
@@ -54,7 +54,7 @@
private static final String PROPERTY = "property";
private static final String PRODUCER = "producer";
private String selectedProp;
- private RegistrationConfiguration registrationConfiguration;
+ private LocalProducerConfiguration localProducerConfiguration;
public ProducerConfigurationService getConfigurationService()
{
@@ -73,27 +73,27 @@
public boolean isRegistrationRequiredForFullDescription()
{
- return getRegRequirements().isRegistrationRequiredForFullDescription();
+ return getLocalConfiguration().isRegistrationRequiredForFullDescription();
}
public void setRegistrationRequiredForFullDescription(boolean
requireRegForFullDescription)
{
-
getRegRequirements().setRegistrationRequiredForFullDescription(requireRegForFullDescription);
+
getLocalConfiguration().setRegistrationRequiredForFullDescription(requireRegForFullDescription);
}
public boolean isRegistrationRequired()
{
- return getRegRequirements().isRegistrationRequired();
+ return getLocalConfiguration().isRegistrationRequired();
}
public void setRegistrationRequired(boolean requireRegistration)
{
- getRegRequirements().setRegistrationRequired(requireRegistration);
+ getLocalConfiguration().setRegistrationRequired(requireRegistration);
}
public String getRegistrationPolicyClassName()
{
- RegistrationPolicy policy = getRegRequirements().getPolicy();
+ RegistrationPolicy policy = getLocalConfiguration().getPolicy();
if (policy != null)
{
return policy.getClassName();
@@ -118,7 +118,7 @@
{
if (isDefaultRegistrationPolicy())
{
- DefaultRegistrationPolicy policy =
(DefaultRegistrationPolicy)RegistrationPolicyWrapper.unwrap(getRegRequirements().getPolicy());
+ DefaultRegistrationPolicy policy =
(DefaultRegistrationPolicy)RegistrationPolicyWrapper.unwrap(getLocalConfiguration().getPolicy());
return policy.getValidator().getClass().getName();
}
throw new IllegalStateException("getValidatorClassName shouldn't be called
if we're not using the default registration");
@@ -131,17 +131,17 @@
public boolean isStrictMode()
{
- return getConfiguration().isUsingStrictMode();
+ return getLocalConfiguration().isUsingStrictMode();
}
public void setStrictMode(boolean strictMode)
{
- getConfiguration().setUsingStrictMode(strictMode);
+ getLocalConfiguration().setUsingStrictMode(strictMode);
}
public List<RegistrationPropertyDescription> getRegistrationProperties()
{
- return getRegRequirements().getRegistrationProperties();
+ return getLocalConfiguration().getRegistrationProperties();
}
public List<SelectItem> getSupportedPropertyTypes()
@@ -159,20 +159,24 @@
try
{
// replicate local state to producer state
- ProducerRegistrationRequirements registrationRequirements =
getConfiguration().getRegistrationRequirements();
- RegistrationConfiguration configuration = getRegRequirements();
+ ProducerConfiguration currentlyPersistedConfiguration = getConfiguration();
+ LocalProducerConfiguration localConfiguration = getLocalConfiguration();
-
registrationRequirements.setRegistrationRequiredForFullDescription(configuration.isRegistrationRequiredForFullDescription());
-
registrationRequirements.setRegistrationRequired(configuration.isRegistrationRequired());
+ ProducerRegistrationRequirements registrationRequirements =
currentlyPersistedConfiguration.getRegistrationRequirements();
+
registrationRequirements.setRegistrationRequiredForFullDescription(localConfiguration.isRegistrationRequiredForFullDescription());
+
registrationRequirements.setRegistrationRequired(localConfiguration.isRegistrationRequired());
+
registrationRequirements.reloadPolicyFrom(policyClassName, validatorClassName);
-
registrationRequirements.setRegistrationProperties(configuration.getRegistrationRequirements().getRegistrationProperties());
+
registrationRequirements.setRegistrationProperties(localConfiguration.getRegistrationRequirements().getRegistrationProperties());
+
currentlyPersistedConfiguration.setUsingStrictMode(localConfiguration.isUsingStrictMode());
+
getConfigurationService().saveConfiguration();
// force a reload local state
- registrationConfiguration = null;
+ localProducerConfiguration = null;
beanContext.createInfoMessage("bean_producer_save_success");
}
@@ -191,7 +195,7 @@
getConfigurationService().reloadConfiguration();
// force a reload local state
- registrationConfiguration = null;
+ localProducerConfiguration = null;
beanContext.createInfoMessage("bean_producer_cancel_success");
}
@@ -205,13 +209,13 @@
public String addRegistrationProperty()
{
- getRegRequirements().addEmptyRegistrationProperty(PROPERTY +
System.currentTimeMillis());
+ getLocalConfiguration().addEmptyRegistrationProperty(PROPERTY +
System.currentTimeMillis());
return PRODUCER;
}
public String deleteRegistrationProperty()
{
- getRegRequirements().removeRegistrationProperty(selectedProp);
+ getLocalConfiguration().removeRegistrationProperty(selectedProp);
return PRODUCER;
}
@@ -223,6 +227,22 @@
FacesContext.getCurrentInstance().renderResponse();
}
+ public void strictModeListener(ValueChangeEvent event)
+ {
+ setStrictMode((Boolean)event.getNewValue());
+
+ // bypass the rest of the life cycle and re-display page
+ FacesContext.getCurrentInstance().renderResponse();
+ }
+
+ public void requireRegistrationForFullDescListener(ValueChangeEvent event)
+ {
+ setRegistrationRequiredForFullDescription((Boolean)event.getNewValue());
+
+ // bypass the rest of the life cycle and re-display page
+ FacesContext.getCurrentInstance().renderResponse();
+ }
+
public void selectProperty(ActionEvent event)
{
selectedProp = beanContext.getParameter("propName");
@@ -238,15 +258,16 @@
return false; // default implementation as not used
}
- private RegistrationConfiguration getRegRequirements()
+ private LocalProducerConfiguration getLocalConfiguration()
{
- if (registrationConfiguration == null)
+ if (localProducerConfiguration == null)
{
- registrationConfiguration = new RegistrationConfiguration();
-
registrationConfiguration.initFrom(getConfiguration().getRegistrationRequirements());
+ localProducerConfiguration = new LocalProducerConfiguration();
+ ProducerConfiguration configuration = getConfiguration();
+ localProducerConfiguration.initFrom(configuration.getRegistrationRequirements(),
configuration.isUsingStrictMode());
}
- return registrationConfiguration;
+ return localProducerConfiguration;
}
public String getV1WSDL()
@@ -259,18 +280,21 @@
return beanContext.getServerAddress() +
"/wsrp-producer/v2/MarkupService?wsdl";
}
- private static class RegistrationConfiguration
+ private static class LocalProducerConfiguration
{
private List<RegistrationPropertyDescription> registrationProperties;
private ProducerRegistrationRequirements registrationRequirements;
+ private boolean strictMode;
- public void initFrom(ProducerRegistrationRequirements registrationRequirements)
+ public void initFrom(ProducerRegistrationRequirements registrationRequirements,
boolean usingStrictMode)
{
this.registrationRequirements = new
ProducerRegistrationRequirementsImpl(registrationRequirements);
Map descriptions = registrationRequirements.getRegistrationProperties();
registrationProperties = new
LinkedList<RegistrationPropertyDescription>(descriptions.values());
Collections.sort(registrationProperties);
+
+ this.strictMode = usingStrictMode;
}
public boolean isRegistrationRequiredForFullDescription()
@@ -328,5 +352,15 @@
{
return registrationRequirements;
}
+
+ public boolean isUsingStrictMode()
+ {
+ return strictMode;
+ }
+
+ public void setUsingStrictMode(boolean usingStrictMode)
+ {
+ this.strictMode = usingStrictMode;
+ }
}
}
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/jsf/producer/producer.xhtml
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/jsf/producer/producer.xhtml 2011-03-03
15:50:49 UTC (rev 5959)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/jsf/producer/producer.xhtml 2011-03-03
15:59:11 UTC (rev 5960)
@@ -1,6 +1,6 @@
<!--
~ JBoss, a division of Red Hat
- ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ Copyright 2011, 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.
@@ -41,9 +41,13 @@
<h:form id="producer-form">
<h:panelGrid columns="2" width="100%">
<h:selectBooleanCheckbox id="cons-reg-req-check"
-
value="#{producer.registrationRequiredForFullDescription}"/>
+
value="#{producer.registrationRequiredForFullDescription}"
+ immediate="true"
+
valueChangeListener="#{producer.requireRegistrationForFullDescListener}"/>
<h:outputText
value="#{i18n.producer_config_sd_requires_reg}"/>
- <h:selectBooleanCheckbox value="#{producer.strictMode}"/>
+ <h:selectBooleanCheckbox id="strict-mode-check"
value="#{producer.strictMode}"
+ immediate="true"
+
valueChangeListener="#{producer.strictModeListener}"/>
<h:outputText value="#{i18n.producer_config_strict}"/>
<h:selectBooleanCheckbox id="req-reg-check"
value="#{producer.registrationRequired}" immediate="true"
@@ -182,4 +186,4 @@
</h:form>
</ui:define>
-</ui:decorate>
\ No newline at end of file
+</ui:decorate>
Show replies by date