Author: chris.laprun(a)jboss.com
Date: 2007-01-08 17:46:42 -0500 (Mon, 08 Jan 2007)
New Revision: 5966
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
Log:
- Avoid useless work if there aren't any registration properties.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-01-08
22:46:01 UTC (rev 5965)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-01-08
22:46:42 UTC (rev 5966)
@@ -217,48 +217,51 @@
{
configurationValid = true;
PropertyDescription[] propertyDescriptions =
regPropDescs.getPropertyDescriptions();
- Map descriptionsMap =
getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
+ if (propertyDescriptions != null && propertyDescriptions.length >
0)
+ {
+ Map descriptionsMap =
getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
- Map registrationProperties = getOrCreateRegistrationPropertiesMap(true);
+ Map registrationProperties = getOrCreateRegistrationPropertiesMap(true);
- // check that we don't have unexpected registration properties and if so,
mark them as invalid
- Set unexpected = new HashSet(registrationProperties.keySet());
- Set expectedNames = descriptionsMap.keySet();
- unexpected.removeAll(expectedNames);
- if (!unexpected.isEmpty())
- {
- message = new StringBuffer("The registration for producer
'"
- + producerId + "' provided values for unexpected registration
properties: ");
- for (Iterator invalidProps = unexpected.iterator();
invalidProps.hasNext();)
+ // check that we don't have unexpected registration properties and if
so, mark them as invalid
+ Set unexpected = new HashSet(registrationProperties.keySet());
+ Set expectedNames = descriptionsMap.keySet();
+ unexpected.removeAll(expectedNames);
+ if (!unexpected.isEmpty())
{
- String name = (String)invalidProps.next();
- message.append("\t- ").append(name).append("\n");
-
((RegistrationProperty)registrationProperties.get(name)).setInvalid(true);
+ message = new StringBuffer("The registration for producer
'"
+ + producerId + "' provided values for unexpected
registration properties: ");
+ for (Iterator invalidProps = unexpected.iterator();
invalidProps.hasNext();)
+ {
+ String name = (String)invalidProps.next();
+ message.append("\t-
").append(name).append("\n");
+
((RegistrationProperty)registrationProperties.get(name)).setInvalid(true);
+ }
+ log.info(message);
+ resetRegistration();
+ configurationValid = false;
}
- log.info(message);
- resetRegistration();
- configurationValid = false;
- }
- // now check for missing properties, add the missing ones with a null value
- StringBuffer missingProps = new StringBuffer();
- for (Iterator descriptionNames = expectedNames.iterator();
descriptionNames.hasNext();)
- {
- String name = (String)descriptionNames.next();
- RegistrationProperty prop =
(RegistrationProperty)registrationProperties.get(name);
- if (prop == null)
+ // now check for missing properties, add the missing ones with a null
value
+ StringBuffer missingProps = new StringBuffer();
+ for (Iterator descriptionNames = expectedNames.iterator();
descriptionNames.hasNext();)
{
- Object missingProp = descriptionsMap.get(name);
- registrationProperties.put(name, missingProp);
- missingProps.append("Missing value for
").append(missingProp).append("\n");
+ String name = (String)descriptionNames.next();
+ RegistrationProperty prop =
(RegistrationProperty)registrationProperties.get(name);
+ if (prop == null)
+ {
+ Object missingProp = descriptionsMap.get(name);
+ registrationProperties.put(name, missingProp);
+ missingProps.append("Missing value for
").append(missingProp).append("\n");
+ }
}
- }
- if (missingProps.length() > 0)
- {
- log.info(missingProps);
- resetRegistration();
- configurationValid = false;
+ if (missingProps.length() > 0)
+ {
+ log.info(missingProps);
+ resetRegistration();
+ configurationValid = false;
+ }
}
}
else
Show replies by date