/** * Checks if the address is a logging profile address. * * @param address the address to check for the logging profile * * @return {@code true} if the address is a logging profile address, otherwise {@code false} */ static boolean isLoggingProfileAddress(final PathAddress address) { return getLoggingProfileName(address) != null; }
private static ConfigurationPersistence getOrCreateConfigurationPersistence(final OperationContext context) { final PathAddress address = context.getCurrentAddress(); final ConfigurationPersistence configurationPersistence; if (LoggingProfileOperations.isLoggingProfileAddress(address)) { final LogContext logContext = LoggingProfileContextSelector.getInstance().getOrCreate(LoggingProfileOperations.getLoggingProfileName(address)); configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence(logContext); } else { configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence(); } return configurationPersistence; }
@Override public void handleResult(final ResultAction resultAction, final OperationContext context, final ModelNode operation) { if (resultAction == ResultAction.KEEP) { configurationPersistence.commit(); if (!LoggingProfileOperations.isLoggingProfileAddress(context.getCurrentAddress())) { // Write once if (context.getAttachment(WRITTEN_KEY) == null) { context.attachIfAbsent(WRITTEN_KEY, Boolean.TRUE); if (persistConfig) { configurationPersistence.writeConfiguration(context); } } } } else if (resultAction == ResultAction.ROLLBACK) { configurationPersistence.rollback(); } } });
private static ConfigurationPersistence getConfigurationPersistence(final OperationContext context) { final PathAddress address = context.getCurrentAddress(); final LogContext logContext; if (LoggingProfileOperations.isLoggingProfileAddress(address)) { logContext = LoggingProfileContextSelector.getInstance().get(LoggingProfileOperations.getLoggingProfileName(address)); } else { logContext = LogContext.getLogContext(); } return ConfigurationPersistence.getConfigurationPersistence(logContext); }
@Override public void handleResult(final ResultAction resultAction, final OperationContext context, final ModelNode operation) { if (resultAction == ResultAction.KEEP) { configurationPersistence.commit(); if (!LoggingProfileOperations.isLoggingProfileAddress(context.getCurrentAddress())) { // Write once if (context.getAttachment(WRITTEN_KEY) == null) { context.attachIfAbsent(WRITTEN_KEY, Boolean.TRUE); if (persistConfig) { configurationPersistence.writeConfiguration(context); } } } } else if (resultAction == ResultAction.ROLLBACK) { configurationPersistence.rollback(); } } });
private static ConfigurationPersistence getOrCreateConfigurationPersistence(final OperationContext context) { final PathAddress address = context.getCurrentAddress(); final ConfigurationPersistence configurationPersistence; if (LoggingProfileOperations.isLoggingProfileAddress(address)) { final LogContext logContext = LoggingProfileContextSelector.getInstance().getOrCreate(LoggingProfileOperations.getLoggingProfileName(address)); configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence(logContext); } else { configurationPersistence = ConfigurationPersistence.getOrCreateConfigurationPersistence(); } return configurationPersistence; }
/** * Checks if the address is a logging profile address. * * @param address the address to check for the logging profile * * @return {@code true} if the address is a logging profile address, otherwise {@code false} */ static boolean isLoggingProfileAddress(final PathAddress address) { return getLoggingProfileName(address) != null; }
@Override public void handleResult(final ResultAction resultAction, final OperationContext context, final ModelNode operation) { if (resultAction == ResultAction.KEEP) { configurationPersistence.commit(); if (!LoggingProfileOperations.isLoggingProfileAddress(getAddress(operation))) { // Write once if (context.getAttachment(WRITTEN_KEY) == null) { context.attachIfAbsent(WRITTEN_KEY, Boolean.TRUE); if (persistConfig) { configurationPersistence.writeConfiguration(context); } } } } else if (resultAction == ResultAction.ROLLBACK) { configurationPersistence.rollback(); } } });
private static ConfigurationPersistence getConfigurationPersistence(final OperationContext context) { final PathAddress address = context.getCurrentAddress(); final LogContext logContext; if (LoggingProfileOperations.isLoggingProfileAddress(address)) { logContext = LoggingProfileContextSelector.getInstance().get(LoggingProfileOperations.getLoggingProfileName(address)); } else { logContext = LogContext.getLogContext(); } return ConfigurationPersistence.getConfigurationPersistence(logContext); }
/** * Checks if the address is a logging profile address. * * @param address the address to check for the logging profile * * @return {@code true} if the address is a logging profile address, otherwise {@code false} */ static boolean isLoggingProfileAddress(final PathAddress address) { return getLoggingProfileName(address) != null; }
@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; }
final String loggingProfile = getLoggingProfileName(address); final LoggingProfileContextSelector contextSelector = LoggingProfileContextSelector.getInstance(); final LogContext logContext = contextSelector.get(loggingProfile);
@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(); } }
final String loggingProfile = getLoggingProfileName(address); final LoggingProfileContextSelector contextSelector = LoggingProfileContextSelector.getInstance(); final LogContext logContext = contextSelector.get(loggingProfile);
final String loggingProfile = getLoggingProfileName(address); final LoggingProfileContextSelector contextSelector = LoggingProfileContextSelector.getInstance(); final LogContext logContext = contextSelector.get(loggingProfile);