@Override public void setPropertyValue(final OperationContext context, final ModelNode model, final PropertyConfigurable configuration) throws OperationFailedException { final String value = resolvePropertyValue(context, model); if (value == null) { configuration.removeProperty(propertyName); } else { configuration.setPropertyValueString(propertyName, value); } }
@Override public void setPropertyValue(final OperationContext context, final ModelNode model, final PropertyConfigurable configuration) throws OperationFailedException { final String value = resolvePropertyValue(context, model); if (value == null) { configuration.removeProperty(propertyName); } else { // Only change the property if the two resolved values do not match. We currently don't set expressions. final String currentValue = configuration.getPropertyValueString(propertyName); if (!value.equals(currentValue)) { configuration.setPropertyValueString(propertyName, value); } } }
@Override public void setPropertyValue(final OperationContext context, final ModelNode model, final PropertyConfigurable configuration) throws OperationFailedException { final String value = resolvePropertyValue(context, model); if (value == null) { configuration.removeProperty(propertyName); } else { // Only change the property if the two resolved values do not match. We currently don't set expressions. final String currentValue = configuration.getPropertyValueString(propertyName); if (!value.equals(currentValue)) { configuration.setPropertyValueString(propertyName, value); } } }
@Override public void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model, final LogContextConfiguration logContextConfiguration) throws OperationFailedException { final String name = context.getCurrentAddressValue(); HandlerConfiguration configuration = logContextConfiguration.getHandlerConfiguration(name); if (configuration == null) { configuration = logContextConfiguration.addHandlerConfiguration(null, DelayedHandler.class.getName(), name); } else { if (!(configuration.getInstance() instanceof DelayedHandler)) { throw LoggingLogger.ROOT_LOGGER.invalidType(DelayedHandler.class, configuration.getInstance().getClass()); } } ENABLED.setPropertyValue(context, model, configuration); final ModelNode filter = FILTER_SPEC.resolveModelAttribute(context, model); if (filter.isDefined()) { configuration.setFilter(filter.asString()); } configuration.setLevel(LEVEL.resolvePropertyValue(context, model)); configuration.setFormatterName(NAMED_FORMATTER.resolveModelAttribute(context, model).asString()); }
@Override public void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model, final LogContextConfiguration logContextConfiguration) throws OperationFailedException { final String name = context.getCurrentAddressValue(); HandlerConfiguration configuration = logContextConfiguration.getHandlerConfiguration(name); if (configuration == null) { configuration = logContextConfiguration.addHandlerConfiguration(null, DelayedHandler.class.getName(), name); } else { if (!(configuration.getInstance() instanceof DelayedHandler)) { throw LoggingLogger.ROOT_LOGGER.invalidType(DelayedHandler.class, configuration.getInstance().getClass()); } } ENABLED.setPropertyValue(context, model, configuration); final ModelNode filter = FILTER_SPEC.resolveModelAttribute(context, model); if (filter.isDefined()) { configuration.setFilter(filter.asString()); } configuration.setLevel(LEVEL.resolvePropertyValue(context, model)); configuration.setFormatterName(NAMED_FORMATTER.resolveModelAttribute(context, model).asString()); }
final String resolvedValue = ENCODING.resolvePropertyValue(context, model); final String currentValue = configuration.getEncoding(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); if (logContextConfiguration.getFormatterNames().contains(formatterName)) { fmtConfig = logContextConfiguration.getFormatterConfiguration(formatterName); final String resolvedValue = FORMATTER.resolvePropertyValue(context, model); final String currentValue = fmtConfig.getPropertyValueString("pattern"); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = LEVEL.resolvePropertyValue(context, model); final String currentValue = configuration.getLevel(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(configuration.getLevel())); if (attribute instanceof PropertyAttributeDefinition) { final PropertyAttributeDefinition propAttribute = ((PropertyAttributeDefinition) attribute); final String resolvedValue = propAttribute.resolvePropertyValue(context, model); final String currentValue = configuration.getPropertyValueString(propAttribute.getPropertyName()); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue));
private static void handleProperty(final AttributeDefinition attribute, final OperationContext context, final ModelNode model, final LoggerConfiguration configuration, final boolean resolveValue) throws OperationFailedException { if (FILTER_SPEC.equals(attribute)) { final ModelNode valueNode = (resolveValue ? FILTER_SPEC.resolveModelAttribute(context, model) : model); final String resolvedValue = (valueNode.isDefined() ? valueNode.asString() : null); configuration.setFilter(resolvedValue); } else if (LEVEL.equals(attribute)) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (HANDLERS.equals(attribute)) { final Collection<String> resolvedValue = (resolveValue ? HANDLERS.resolvePropertyValue(context, model) : HANDLERS.resolver().resolveValue(context, model)); configuration.setHandlerNames(resolvedValue); } else if (USE_PARENT_HANDLERS.equals(attribute)) { final ModelNode useParentHandlers = (resolveValue ? USE_PARENT_HANDLERS.resolveModelAttribute(context, model) : model); final Boolean resolvedValue = (useParentHandlers.isDefined() ? useParentHandlers.asBoolean() : null); configuration.setUseParentHandlers(resolvedValue); } }
private static void handleProperty(final AttributeDefinition attribute, final OperationContext context, final ModelNode model, final LoggerConfiguration configuration, final boolean resolveValue) throws OperationFailedException { if (FILTER_SPEC.equals(attribute)) { final ModelNode valueNode = (resolveValue ? FILTER_SPEC.resolveModelAttribute(context, model) : model); final String resolvedValue = (valueNode.isDefined() ? valueNode.asString() : null); configuration.setFilter(resolvedValue); } else if (LEVEL.equals(attribute)) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (HANDLERS.equals(attribute)) { final Collection<String> resolvedValue = (resolveValue ? HANDLERS.resolvePropertyValue(context, model) : HANDLERS.resolver().resolveValue(context, model)); configuration.setHandlerNames(resolvedValue); } else if (USE_PARENT_HANDLERS.equals(attribute)) { final ModelNode useParentHandlers = (resolveValue ? USE_PARENT_HANDLERS.resolveModelAttribute(context, model) : model); final Boolean resolvedValue = (useParentHandlers.isDefined() ? useParentHandlers.asBoolean() : null); configuration.setUseParentHandlers(resolvedValue); } }
final String resolvedValue = ENCODING.resolvePropertyValue(context, model); final String currentValue = configuration.getEncoding(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); if (logContextConfiguration.getFormatterNames().contains(formatterName)) { fmtConfig = logContextConfiguration.getFormatterConfiguration(formatterName); final String resolvedValue = FORMATTER.resolvePropertyValue(context, model); final String currentValue = fmtConfig.getPropertyValueString(PATTERN.getName()); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = LEVEL.resolvePropertyValue(context, model); final String currentValue = configuration.getLevel(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(configuration.getLevel()));
private static void handleProperty(final AttributeDefinition attribute, final OperationContext context, final ModelNode model, final LoggerConfiguration configuration, final boolean resolveValue) throws OperationFailedException { if (FILTER_SPEC.equals(attribute)) { final ModelNode valueNode = (resolveValue ? FILTER_SPEC.resolveModelAttribute(context, model) : model); final String resolvedValue = (valueNode.isDefined() ? valueNode.asString() : null); configuration.setFilter(resolvedValue); } else if (LEVEL.equals(attribute)) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (HANDLERS.equals(attribute)) { final Collection<String> resolvedValue = (resolveValue ? HANDLERS.resolvePropertyValue(context, model) : HANDLERS.resolver().resolveValue(context, model)); configuration.setHandlerNames(resolvedValue); } else if (USE_PARENT_HANDLERS.equals(attribute)) { final ModelNode useParentHandlers = (resolveValue ? USE_PARENT_HANDLERS.resolveModelAttribute(context, model) : model); final Boolean resolvedValue = (useParentHandlers.isDefined() ? useParentHandlers.asBoolean() : null); configuration.setUseParentHandlers(resolvedValue); } }
final String resolvedValue = ENCODING.resolvePropertyValue(context, model); final String currentValue = configuration.getEncoding(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); if (logContextConfiguration.getFormatterNames().contains(formatterName)) { fmtConfig = logContextConfiguration.getFormatterConfiguration(formatterName); final String resolvedValue = FORMATTER.resolvePropertyValue(context, model); final String currentValue = fmtConfig.getPropertyValueString(PATTERN.getName()); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(currentValue)); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = LEVEL.resolvePropertyValue(context, model); final String currentValue = configuration.getLevel(); result = (resolvedValue == null ? currentValue == null : resolvedValue.equals(configuration.getLevel()));
final String resolvedValue = (resolveValue ? ENCODING.resolvePropertyValue(context, model) : model.asString()); configuration.setEncoding(resolvedValue); } else if (attribute.getName().equals(FORMATTER.getName())) { fmtConfig = logContextConfiguration.addFormatterConfiguration(null, PatternFormatter.class.getName(), formatterName, "pattern"); final String resolvedValue = (resolveValue ? FORMATTER.resolvePropertyValue(context, model) : model.asString()); fmtConfig.setPropertyValueString("pattern", resolvedValue); configuration.setFormatterName(formatterName); configuration.setFilter(resolvedValue); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (attribute.getName().equals(SUBHANDLERS.getName())) {
final String resolvedValue = (resolveValue ? ENCODING.resolvePropertyValue(context, model) : model.isDefined() ? model.asString() : null); configuration.setEncoding(resolvedValue); } else if (attribute.getName().equals(FORMATTER.getName())) { fmtConfig = logContextConfiguration.addFormatterConfiguration(null, PatternFormatter.class.getName(), handlerName, PATTERN.getPropertyName()); final String resolvedValue = (resolveValue ? FORMATTER.resolvePropertyValue(context, model) : model.asString()); fmtConfig.setPropertyValueString(PATTERN.getPropertyName(), resolvedValue); configuration.setFormatterName(handlerName); fmtConfig.setPropertyValueString(PATTERN.getPropertyName(), FORMATTER.resolvePropertyValue(context, resource.getModel())); configuration.setFormatterName(handlerName); configuration.setFilter(resolvedValue); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (attribute.getName().equals(SUBHANDLERS.getName())) {
final String resolvedValue = (resolveValue ? ENCODING.resolvePropertyValue(context, model) : model.isDefined() ? model.asString() : null); configuration.setEncoding(resolvedValue); } else if (attribute.getName().equals(FORMATTER.getName())) { fmtConfig = logContextConfiguration.addFormatterConfiguration(null, PatternFormatter.class.getName(), handlerName, PATTERN.getPropertyName()); final String resolvedValue = (resolveValue ? FORMATTER.resolvePropertyValue(context, model) : model.asString()); fmtConfig.setPropertyValueString(PATTERN.getPropertyName(), resolvedValue); configuration.setFormatterName(handlerName); fmtConfig.setPropertyValueString(PATTERN.getPropertyName(), FORMATTER.resolvePropertyValue(context, resource.getModel())); configuration.setFormatterName(handlerName); configuration.setFilter(resolvedValue); } else if (attribute.getName().equals(LEVEL.getName())) { final String resolvedValue = (resolveValue ? LEVEL.resolvePropertyValue(context, model) : LEVEL.resolver().resolveValue(context, model)); configuration.setLevel(resolvedValue); } else if (attribute.getName().equals(SUBHANDLERS.getName())) {