use of org.apache.qpid.server.model.VirtualHostAccessControlProvider in project qpid-broker-j by apache.
the class AbstractVirtualHost method updateAccessControl.
private void updateAccessControl() {
if (!((SystemConfig) _broker.getParent()).isManagementMode()) {
List<VirtualHostAccessControlProvider> children = new ArrayList<>(getChildren(VirtualHostAccessControlProvider.class));
LOGGER.debug("Updating access control list with {} provider children", children.size());
Collections.sort(children, VirtualHostAccessControlProvider.ACCESS_CONTROL_PROVIDER_COMPARATOR);
List<AccessControl<?>> accessControls = new ArrayList<>(children.size() + 2);
accessControls.add(_systemUserAllowed);
for (VirtualHostAccessControlProvider prov : children) {
if (prov.getState() == State.ERRORED) {
accessControls.clear();
accessControls.add(AccessControl.ALWAYS_DENIED);
break;
} else if (prov.getState() == State.ACTIVE) {
accessControls.add(prov.getController());
}
}
accessControls.add(getParentAccessControl());
((CompoundAccessControl) _accessControl).setAccessControls(accessControls);
}
}
use of org.apache.qpid.server.model.VirtualHostAccessControlProvider in project qpid-broker-j by apache.
the class AbstractVirtualHost method doRestart.
private ListenableFuture<Void> doRestart() {
createHousekeepingExecutor();
final VirtualHostStoreUpgraderAndRecoverer virtualHostStoreUpgraderAndRecoverer = new VirtualHostStoreUpgraderAndRecoverer((VirtualHostNode<?>) getParent());
virtualHostStoreUpgraderAndRecoverer.reloadAndRecoverVirtualHost(getDurableConfigurationStore());
final Collection<VirtualHostAccessControlProvider> accessControlProviders = getChildren(VirtualHostAccessControlProvider.class);
if (!accessControlProviders.isEmpty()) {
accessControlProviders.forEach(child -> child.addChangeListener(_accessControlProviderListener));
}
final List<ListenableFuture<Void>> childOpenFutures = new ArrayList<>();
Subject.doAs(getSubjectWithAddedSystemRights(), (PrivilegedAction<Object>) () -> {
applyToChildren(child -> {
final ListenableFuture<Void> childOpenFuture = child.openAsync();
childOpenFutures.add(childOpenFuture);
addFutureCallback(childOpenFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
}
@Override
public void onFailure(final Throwable t) {
LOGGER.error("Exception occurred while opening {} : {}", child.getClass().getSimpleName(), child.getName(), t);
onRestartFailure();
}
}, getTaskExecutor());
});
return null;
});
ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(childOpenFutures);
return Futures.transformAsync(combinedFuture, input -> onActivate(), MoreExecutors.directExecutor());
}
Aggregations