Author: chris.laprun(a)jboss.com
Date: 2007-02-09 17:22:37 -0500 (Fri, 09 Feb 2007)
New Revision: 6198
Modified:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
Log:
- Correctly delegate to the validator even when the consumer already exists.
- Javadoc.
Modified:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
===================================================================
---
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-09
17:42:03 UTC (rev 6197)
+++
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-09
22:22:37 UTC (rev 6198)
@@ -39,7 +39,8 @@
import java.util.Map;
/**
- * Provides a default implementation of RegistrationPolicy.
+ * Provides a default implementation of RegistrationPolicy which should be enough for
most user needs provided the
+ * appropriate {@link RegistrationPropertyValidator} has been configured to validate
registration properties.
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
@@ -62,6 +63,9 @@
}
/**
+ * Only accepts the registration if no registration with identical values exists for
the Consumer identified by the
+ * specified identify and delegates the validation of properties to the configured
RegistrationPropertyValidator.
+ *
* @throws DuplicateRegistrationException if a Consumer with the same identity has
already registered with the same
* registration properties.
*/
@@ -86,14 +90,12 @@
}
}
}
- else
+
+ // check that values are consistent with ProducerRegistrationRequirement
+ for (Iterator properties = registrationProperties.entrySet().iterator();
properties.hasNext();)
{
- // check that values are consistent with ProducerRegistrationRequirement
- for (Iterator properties = registrationProperties.entrySet().iterator();
properties.hasNext();)
- {
- Map.Entry property = (Map.Entry)properties.next();
- validator.validateValueFor((QName)property.getKey(), property.getValue());
- }
+ Map.Entry property = (Map.Entry)properties.next();
+ validator.validateValueFor((QName)property.getKey(), property.getValue());
}
}
@@ -136,11 +138,22 @@
// this is already the behavior in the RegistrationPersistenceManager so no need to
do anything
}
+ /**
+ * Instructs this policy to use the specified RegistrationPropertyValidator. There
shouldn't be any need to call this
+ * method manually, as the validator is configured via the WSRP Producer xml
configuration file.
+ *
+ * @param validator
+ */
public void setValidator(RegistrationPropertyValidator validator)
{
this.validator = validator;
}
+ /**
+ * Retrieves the currently configured RegistrationPropertyValidator.
+ *
+ * @return
+ */
public RegistrationPropertyValidator getValidator()
{
return validator;