@Override
public final void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
// Get the address and the name of the logger or handler
final PathAddress address = getAddress(operation);
final String name = getAddressName(operation);
final ConfigurationPersistence configurationPersistence;
final boolean isLoggingProfile = LoggingProfileOperations.isLoggingProfileAddress(address);
if (isLoggingProfile) {
final LogContext logContext = LoggingProfileContextSelector.getInstance().getOrCreate(LoggingProfileOperations.getLoggingProfileName(address));
configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence(logContext);
} else {
configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence();
}
final LogContextConfiguration logContextConfiguration = configurationPersistence.getLogContextConfiguration();
execute(context, operation, name, logContextConfiguration);
if (context.getProcessType().isServer()) {
addCommitStep(context, configurationPersistence);
// Add rollback handler in case rollback is invoked before a commit step is invoked
context.completeStep(new RollbackHandler() {
@Override
public void handleRollback(final OperationContext context, final ModelNode operation) {
configurationPersistence.rollback();
}
});
} else {
context.stepCompleted();
}