{
// save listeners if we already have a configuration
List<ProducerConfigurationChangeListener> listeners = null;
Set<RegistrationPolicyChangeListener> policyListeners = null;
Set<RegistrationPropertyChangeListener> propertyListeners = null;
ProducerRegistrationRequirements registrationRequirements;
if (configuration.get() != null)
{
listeners = configuration.get().getChangeListeners();
registrationRequirements = configuration.get().getRegistrationRequirements();
if (registrationRequirements != null)
{
policyListeners = registrationRequirements.getPolicyChangeListeners();
propertyListeners = registrationRequirements.getPropertyChangeListeners();
}
}
// reload
loadConfiguration();
// make sure that we set strict mode on things which need to know about it regardless of listeners (which might
// not exist when this method is called, as is the case at startup)
WSRPValidator.setStrict(configuration.get().isUsingStrictMode());
// restore listeners and trigger them if requested
if (listeners != null)
{
for (ProducerConfigurationChangeListener listener : listeners)
{
configuration.get().addChangeListener(listener);
if (triggerListeners)
{
listener.usingStrictModeChangedTo(configuration.get().isUsingStrictMode());
}
}
}
registrationRequirements = configuration.get().getRegistrationRequirements();
if (registrationRequirements != null)
{
if (propertyListeners != null)
{
for (RegistrationPropertyChangeListener listener : propertyListeners)
{
registrationRequirements.addRegistrationPropertyChangeListener(listener);
if (triggerListeners)
{
listener.propertiesHaveChanged(registrationRequirements.getRegistrationProperties());
}
}
}
if (policyListeners != null)
{
for (RegistrationPolicyChangeListener listener : policyListeners)
{
registrationRequirements.addRegistrationPolicyChangeListener(listener);
if (triggerListeners)
{
listener.policyUpdatedTo(registrationRequirements.getPolicy());
}
}
}
}
}