@Override protected final boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<ConfigurationPersistence> handbackHolder) throws OperationFailedException { final String name = getAddressName(operation); final PathAddress address = getAddress(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(); handbackHolder.setHandback(configurationPersistence); final boolean restartRequired = applyUpdate(context, attributeName, name, resolvedValue, logContextConfiguration); addCommitStep(context, configurationPersistence); return restartRequired; }
@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(); } }