use of org.apache.qpid.server.model.AbstractConfigurationChangeListener in project qpid-broker-j by apache.
the class VirtualHostStoreUpgraderAndRecoverer method recover.
private void recover(final ConfiguredObject<?> recoveryRoot, final DurableConfigurationStore durableConfigurationStore, final List<ConfiguredObjectRecord> records, final boolean isNew) {
new GenericRecoverer(recoveryRoot).recover(records, isNew);
final StoreConfigurationChangeListener configChangeListener = new StoreConfigurationChangeListener(durableConfigurationStore);
if (_virtualHostNode.getVirtualHost() != null) {
applyRecursively(_virtualHostNode.getVirtualHost(), new RecursiveAction<ConfiguredObject<?>>() {
@Override
public boolean applyToChildren(final ConfiguredObject<?> object) {
return object.isDurable();
}
@Override
public void performAction(final ConfiguredObject<?> object) {
object.addChangeListener(configChangeListener);
}
});
}
if (recoveryRoot instanceof VirtualHostNode) {
_virtualHostNode.addChangeListener(new AbstractConfigurationChangeListener() {
@Override
public void childAdded(final ConfiguredObject<?> object, final ConfiguredObject<?> child) {
if (child instanceof VirtualHost) {
applyRecursively(child, new RecursiveAction<ConfiguredObject<?>>() {
@Override
public boolean applyToChildren(final ConfiguredObject<?> object) {
return object.isDurable();
}
@Override
public void performAction(final ConfiguredObject<?> object) {
if (object.isDurable()) {
durableConfigurationStore.update(true, object.asObjectRecord());
object.addChangeListener(configChangeListener);
}
}
});
}
}
@Override
public void childRemoved(final ConfiguredObject<?> object, final ConfiguredObject<?> child) {
if (child instanceof VirtualHost) {
child.removeChangeListener(configChangeListener);
}
}
});
if (isNew) {
if (_virtualHostNode instanceof AbstractConfiguredObject) {
((AbstractConfiguredObject) _virtualHostNode).forceUpdateAllSecureAttributes();
}
}
}
}
Aggregations