@Override protected void updateScanner(final DeploymentScanner scanner, final ModelNode newValue) { boolean enable = newValue.resolve().asBoolean(); scanner.setAutoDeployExplodedContent(enable); }
/** * Finds a value in the given {@code operationObject} whose key matches this attribute's {@link * #getName() name}, resolves it and validates it using this attribute's {@link #getValidator() * validator}. If the value is undefined and a {@link #getDefaultValue() default value} is * available, the default value is used. * * @param operationObject model node of type {@link ModelType#OBJECT}, typically representing an * operation request * @return the resolved value, possibly the default value if the operation does not have a defined * value matching this attribute's name * @throws OperationFailedException if the value is not valid */ public ModelNode validateResolvedOperation(final ModelNode operationObject) throws OperationFailedException { final ModelNode node = new ModelNode(); if (operationObject.has(name)) { node.set(operationObject.get(name)); } if (!node.isDefined() && defaultValue.isDefined()) { node.set(defaultValue); } final ModelNode resolved = node.resolve(); validator.validateParameter(name, resolved); return resolved; }
@Test public void testUndefinedTypeEmptyConverter() { TypeConverter converter = getConverter(new ModelNode()); Assert.assertEquals(SimpleType.STRING, converter.getOpenType()); ModelNode node = new ModelNode(); node.get("abc"); node.get("def"); node.protect(); String json = assertCast(String.class, converter.fromModelNode(node)); Assert.assertEquals(node.resolve(), ModelNode.fromJSONString(json)); Assert.assertEquals(json, assertCast(String.class, converter.fromModelNode(node))); assertToArray(converter, json); }
protected void performRuntime( OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { // Resolve any expressions and re-validate final ModelNode resolvedOp = operation.resolve(); runtimeValidator.validate(resolvedOp); PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); String name = address.getLastElement().getValue(); try { newControllers.add(installBindingService(context, resolvedOp, name)); } catch (UnknownHostException e) { throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage())); } }
@Override public void validateResolvedParameter(String parameterName, ModelNode value) throws OperationFailedException { validateParameter(parameterName, value.resolve()); }
public ModelNode resolveExpressions(ModelNode node) { return node.resolve(); }