/** * Resolves the path based on the relative to and the path. May return {@code null} if the service is not up. * * @param context the operation context. * @param relativeToPath the relative to path, may be {@code null}. * @param path the path to append to the relative to path or the absolute path if the relative to path is * {@code null}. * * @return the full path or {@code null} if the services were not started. */ public static String resolvePath(final OperationContext context, final String relativeToPath, final String path) { return INSTANCE.resolve(context, relativeToPath, path); }
@Override public String resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException { return String.valueOf(parseSize(value)); }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public Set<String> resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { Set<String> result = Collections.emptySet(); final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { result = resolver.resolveValue(context, value); } return result; }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public String resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException { return String.valueOf(parseSize(value)); }
/** * Resolves the path based on the relative to and the path. May return {@code null} if the service is not up. * * @param context the operation context. * @param relativeToPath the relative to path, may be {@code null}. * @param path the path to append to the relative to path or the absolute path if the relative to path is * {@code null}. * * @return the full path or {@code null} if the services were not started. */ public static String resolvePath(final OperationContext context, final String relativeToPath, final String path) { return INSTANCE.resolve(context, relativeToPath, path); }
@Override public Set<String> resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { Set<String> result = Collections.emptySet(); final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { result = resolver.resolveValue(context, value); } return result; }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public String resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException { return String.valueOf(parseSize(value)); }
/** * Resolves the path based on the relative to and the path. May return {@code null} if the service is not up. * * @param context the operation context. * @param relativeToPath the relative to path, may be {@code null}. * @param path the path to append to the relative to path or the absolute path if the relative to path is * {@code null}. * * @return the full path or {@code null} if the services were not started. */ public static String resolvePath(final OperationContext context, final String relativeToPath, final String path) { return INSTANCE.resolve(context, relativeToPath, path); }
@Override public Set<String> resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { Set<String> result = Collections.emptySet(); final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { result = resolver.resolveValue(context, value); } return result; }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { final String stringValue = value.asString(); try { SizeResolver.INSTANCE.parseSize(value); } catch (IllegalArgumentException e) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidSize(stringValue)); } catch (IllegalStateException e) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidSize(stringValue)); } } } }
@Override public String resolveValue(final OperationContext context, final ModelNode value) throws OperationFailedException { final ModelNode pathNode = PATH.resolveModelAttribute(context, value); final ModelNode relativeToNode = RELATIVE_TO.resolveModelAttribute(context, value); String path = pathNode.asString(); String result = path; if (relativeToNode.isDefined()) { result = resolve(context, relativeToNode.asString(), path); } if (result == null) { throw LoggingMessages.MESSAGES.pathManagerServiceNotStarted(); } return result; }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { final String stringValue = value.asString(); try { SizeResolver.INSTANCE.parseSize(value); } catch (IllegalArgumentException e) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidSize(stringValue)); } catch (IllegalStateException e) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidSize(stringValue)); } } } }
@Override public String resolvePropertyValue(final OperationContext context, final ModelNode model) throws OperationFailedException { String result = null; final ModelNode value = resolveModelAttribute(context, model); if (value.isDefined()) { if (resolver == null) { result = value.asString(); } else { result = resolver.resolveValue(context, value); } } return result; }
@Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { final String stringValue = value.asString(); try { SizeResolver.INSTANCE.parseSize(value); } catch (IllegalArgumentException e) { throw createOperationFailure(MESSAGES.invalidSize(stringValue)); } catch (IllegalStateException e) { throw createOperationFailure(MESSAGES.invalidSize(stringValue)); } } } }
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); } }