private Map<String, ModelNode> getDescribedRequestProperties(final ModelNode operation, final ModelNode description){ final Map<String, ModelNode> requestProperties = new HashMap<String, ModelNode>(); if (description.hasDefined(REQUEST_PROPERTIES)) { for (String key : description.get(REQUEST_PROPERTIES).keys()) { ModelNode desc = description.get(REQUEST_PROPERTIES, key); if (!desc.isDefined()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionUndefinedRequestProperty(key, getPathAddress(operation), desc)); } requestProperties.put(key, desc); } } return requestProperties; }
private Map<String, ModelNode> getDescribedRequestProperties(final ModelNode operation, final ModelNode description){ final Map<String, ModelNode> requestProperties = new HashMap<String, ModelNode>(); if (description.hasDefined(REQUEST_PROPERTIES)) { for (String key : description.get(REQUEST_PROPERTIES).keys()) { ModelNode desc = description.get(REQUEST_PROPERTIES, key); if (!desc.isDefined()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionUndefinedRequestProperty(key, getPathAddress(operation), desc)); } requestProperties.put(key, desc); } } return requestProperties; }
private Map<String, ModelNode> getDescribedRequestProperties(final ModelNode operation, final ModelNode description){ final Map<String, ModelNode> requestProperties = new HashMap<String, ModelNode>(); if (description.hasDefined(REQUEST_PROPERTIES)) { for (String key : description.get(REQUEST_PROPERTIES).keys()) { ModelNode desc = description.get(REQUEST_PROPERTIES, key); if (!desc.isDefined()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionUndefinedRequestProperty(key, getPathAddress(operation), desc)); } requestProperties.put(key, desc); } } return requestProperties; }
private Map<String, ModelNode> getDescribedRequestProperties(final ModelNode operation, final ModelNode description){ final Map<String, ModelNode> requestProperties = new HashMap<String, ModelNode>(); if (description.hasDefined(REQUEST_PROPERTIES)) { for (String key : description.get(REQUEST_PROPERTIES).keys()) { ModelNode desc = description.get(REQUEST_PROPERTIES, key); if (!desc.isDefined()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionUndefinedRequestProperty(key, getPathAddress(operation), desc)); } requestProperties.put(key, desc); } } return requestProperties; }
private void checkParameterTypes(final ModelNode description, final ModelNode operation, final Map<String, ModelNode> describedProperties, final Map<String, ModelNode> actualParams) { for (String paramName : actualParams.keySet()) { final ModelNode value = actualParams.get(paramName); if(!value.isDefined()) { continue; } if(value.getType() == ModelType.OBJECT && value.keys().isEmpty()) { return; } final ModelNode typeNode = describedProperties.get(paramName).get(TYPE); if (!typeNode.isDefined()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionNoParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } final ModelType modelType; try { modelType = Enum.valueOf(ModelType.class, typeNode.asString()); } catch (Exception e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionInvalidParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } try { checkType(modelType, value); } catch (IllegalArgumentException e) { throw MESSAGES.validationFailedCouldNotConvertParamToType(paramName, modelType, formatOperationForMessage(operation)); } checkRange(operation, description, paramName, modelType, describedProperties.get(paramName), value); checkList(operation, paramName, modelType, describedProperties.get(paramName), value); } }
private void checkParameterTypes(final ModelNode description, final ModelNode operation, final Map<String, ModelNode> describedProperties, final Map<String, ModelNode> actualParams) { for (String paramName : actualParams.keySet()) { final ModelNode value = actualParams.get(paramName); if(!value.isDefined()) { continue; } if(value.getType() == ModelType.OBJECT && value.keys().isEmpty()) { return; } final ModelNode typeNode = describedProperties.get(paramName).get(TYPE); if (!typeNode.isDefined()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionNoParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } final ModelType modelType; try { modelType = Enum.valueOf(ModelType.class, typeNode.asString()); } catch (Exception e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionInvalidParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } try { checkType(modelType, value); } catch (IllegalArgumentException e) { throw MESSAGES.validationFailedCouldNotConvertParamToType(paramName, modelType, formatOperationForMessage(operation)); } checkRange(operation, description, paramName, modelType, describedProperties.get(paramName), value); checkList(operation, paramName, modelType, describedProperties.get(paramName), value); } }
private void checkParameterTypes(final ModelNode description, final ModelNode operation, final Map<String, ModelNode> describedProperties, final Map<String, ModelNode> actualParams) { for (String paramName : actualParams.keySet()) { final ModelNode value = actualParams.get(paramName); if(!value.isDefined()) { continue; } if(value.getType() == ModelType.OBJECT && value.keys().isEmpty()) { return; } final ModelNode typeNode = describedProperties.get(paramName).get(TYPE); if (!typeNode.isDefined()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionNoParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } final ModelType modelType; try { modelType = Enum.valueOf(ModelType.class, typeNode.asString()); } catch (Exception e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionInvalidParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } try { checkType(modelType, value); } catch (IllegalArgumentException e) { throw ControllerLogger.ROOT_LOGGER.validationFailedCouldNotConvertParamToType(paramName, modelType, formatOperationForMessage(operation)); } checkRange(operation, description, paramName, modelType, describedProperties.get(paramName), value); checkList(operation, paramName, describedProperties.get(paramName), value); } }
private void checkParameterTypes(final ModelNode description, final ModelNode operation, final Map<String, ModelNode> describedProperties, final Map<String, ModelNode> actualParams) { for (String paramName : actualParams.keySet()) { final ModelNode value = actualParams.get(paramName); if(!value.isDefined()) { continue; } if(value.getType() == ModelType.OBJECT && value.keys().isEmpty()) { return; } final ModelNode typeNode = describedProperties.get(paramName).get(TYPE); if (!typeNode.isDefined()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionNoParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } final ModelType modelType; try { modelType = Enum.valueOf(ModelType.class, typeNode.asString()); } catch (Exception e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionInvalidParamTypeInDescription(paramName, getPathAddress(operation), description)); return; } try { checkType(modelType, value); } catch (IllegalArgumentException e) { throw ControllerLogger.ROOT_LOGGER.validationFailedCouldNotConvertParamToType(paramName, modelType, formatOperationForMessage(operation)); } checkRange(operation, description, paramName, modelType, describedProperties.get(paramName), value); checkList(operation, paramName, describedProperties.get(paramName), value); } }
if (described.hasDefined(REQUIRED)) { if (ModelType.BOOLEAN != described.get(REQUIRED).getType()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionRequiredFlagIsNotABoolean(paramName, getPathAddress(operation), description)); required = false; } else {
if (described.hasDefined(REQUIRED)) { if (ModelType.BOOLEAN != described.get(REQUIRED).getType()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionRequiredFlagIsNotABoolean(paramName, getPathAddress(operation), description)); required = false; } else {
if (described.hasDefined(REQUIRED)) { if (ModelType.BOOLEAN != described.get(REQUIRED).getType()) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionRequiredFlagIsNotABoolean(paramName, getPathAddress(operation), description)); required = false; } else {
if (described.hasDefined(REQUIRED)) { if (ModelType.BOOLEAN != described.get(REQUIRED).getType()) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionRequiredFlagIsNotABoolean(paramName, getPathAddress(operation), description)); required = false; } else {
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationEntry(name, address)); throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationHandler(name, address));
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationEntry(name, address)); throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationHandler(name, address));
throwOrWarnAboutDescriptorProblem(MESSAGES.noOperationEntry(name, address)); throwOrWarnAboutDescriptorProblem(MESSAGES.noOperationHandler(name, address));
throwOrWarnAboutDescriptorProblem(MESSAGES.noOperationEntry(name, address)); throwOrWarnAboutDescriptorProblem(MESSAGES.noOperationHandler(name, address));
min = describedProperty.get(MIN).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asBigInteger(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_INTEGER, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asDouble(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.DOUBLE, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asInt(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.INT, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asLong(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.LONG, getPathAddress(operation), description)); return; max = describedProperty.get(MAX).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MAX, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return;
min = describedProperty.get(MIN).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asBigInteger(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_INTEGER, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asDouble(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.DOUBLE, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asInt(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.INT, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asLong(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.LONG, getPathAddress(operation), description)); return; max = describedProperty.get(MAX).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MAX, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return;
min = describedProperty.get(MIN).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asBigInteger(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_INTEGER, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asDouble(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.DOUBLE, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asInt(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.INT, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asLong(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.LONG, getPathAddress(operation), description)); return; max = describedProperty.get(MAX).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(MESSAGES.invalidDescriptionMinMaxForParameterHasWrongType(MAX, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return;
min = describedProperty.get(MIN).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asBigInteger(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.BIG_INTEGER, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asDouble(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.DOUBLE, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asInt(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.INT, getPathAddress(operation), description)); return; min = describedProperty.get(MIN).asLong(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MIN, paramName, ModelType.LONG, getPathAddress(operation), description)); return; max = describedProperty.get(MAX).asBigDecimal(); } catch (IllegalArgumentException e) { throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.invalidDescriptionMinMaxForParameterHasWrongType(MAX, paramName, ModelType.BIG_DECIMAL, getPathAddress(operation), description)); return;