private ModelTestModelDescriptionValidator(List<ValidationFailure> errors, ModelNode address, ModelNode description, ValidationConfiguration validationConfiguration) { if (address == null) { throw new IllegalArgumentException("Null address"); } if (description == null) { throw new IllegalArgumentException("Null address"); } this.errors = errors; this.address = address; this.description = description; this.validationConfiguration = validationConfiguration == null ? new ValidationConfiguration() : validationConfiguration; }
private static ValidationConfiguration createForDomain() { ValidationConfiguration config = createWithGlobalOperations(); ModelNode rolloutPlan = new ModelNode().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS).add(ROLLOUT_PLAN, "*"); config.allowNullValueTypeForAttribute(rolloutPlan, CONTENT); config.allowNullValueTypeForOperationParameter(rolloutPlan, "store", CONTENT); config.allowNullValueTypeForOperationParameter(rolloutPlan, ADD, CONTENT); return config; }
Set<String> arbitraryAttributeDescriptors = descriptor.getValue(); for(String arbitraryAttributeDescriptor : arbitraryAttributeDescriptors) { config.registerAttributeArbitraryDescriptor(address, attributeName, arbitraryAttributeDescriptor, ARBITRARY_DESCRIPTOR_VALIDATOR); Set<String> arbitraryAttributeDescriptors = parameterDescriptor.getValue(); for (String arbitraryAttributeDescriptor : arbitraryAttributeDescriptors) { config.registerArbitraryDescriptorForOperationParameter(address, operationName, parameter, arbitraryAttributeDescriptor, ARBITRARY_DESCRIPTOR_VALIDATOR);
Set<String> arbitraryAttributeDescriptors = descriptor.getValue(); for(String arbitraryAttributeDescriptor : arbitraryAttributeDescriptors) { config.registerAttributeArbitraryDescriptor(address, attributeName, arbitraryAttributeDescriptor, ARBITRARY_DESCRIPTOR_VALIDATOR); Set<String> arbitraryAttributeDescriptors = parameterDescriptor.getValue(); for (String arbitraryAttributeDescriptor : arbitraryAttributeDescriptors) { config.registerArbitraryDescriptorForOperationParameter(address, operationName, parameter, arbitraryAttributeDescriptor, ARBITRARY_DESCRIPTOR_VALIDATOR);
private static ValidationConfiguration createForHost() { ValidationConfiguration config = createWithGlobalOperations(); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForAttribute(new ModelNode(), DOMAIN_CONTROLLER); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.COMPILATION), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.THREADING), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.OPERATING_SYSTEM), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.RUNTIME), READ_RESOURCE_OPERATION); final ModelNode MEMORY_POOL_CHILDREN_ADDR = createHostPlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL); MEMORY_POOL_CHILDREN_ADDR.add(NAME, "*"); config.allowNullValueTypeForOperationReplyProperties(MEMORY_POOL_CHILDREN_ADDR, READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationParameter(new ModelNode().add(HOST, "master"), ValidateAddressOperationHandler.OPERATION_NAME, VALUE); return config; }
private static ValidationConfiguration createForHost() { ValidationConfiguration config = createWithGlobalOperations(); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createServerConfigPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForAttribute(new ModelNode(), DOMAIN_CONTROLLER); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.COMPILATION), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.THREADING), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.OPERATING_SYSTEM), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createHostPlatformMBeanAddress(PlatformMBeanConstants.RUNTIME), READ_RESOURCE_OPERATION); final ModelNode MEMORY_POOL_CHILDREN_ADDR = createHostPlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL); MEMORY_POOL_CHILDREN_ADDR.add(NAME, "*"); config.allowNullValueTypeForOperationReplyProperties(MEMORY_POOL_CHILDREN_ADDR, READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationParameter(new ModelNode().add(HOST, "master"), ValidateAddressOperationHandler.OPERATION_NAME, VALUE); return config; }
private static ValidationConfiguration createForStandalone() { ValidationConfiguration config = createWithGlobalOperations(); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.COMPILATION), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.THREADING), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.OPERATING_SYSTEM), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.RUNTIME), READ_RESOURCE_OPERATION); final ModelNode MEMORY_POOL_CHILDREN_ADDR = createStandlonePlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL); MEMORY_POOL_CHILDREN_ADDR.add(NAME, "*"); config.allowNullValueTypeForOperationReplyProperties(MEMORY_POOL_CHILDREN_ADDR, READ_RESOURCE_OPERATION); return config; }
private static ValidationConfiguration createForStandalone() { ValidationConfiguration config = createWithGlobalOperations(); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createInterfaceMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createPathMBeanAddress(), READ_ATTRIBUTE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.COMPILATION), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.THREADING), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.OPERATING_SYSTEM), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL), READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(createStandlonePlatformMBeanAddress(PlatformMBeanConstants.RUNTIME), READ_RESOURCE_OPERATION); final ModelNode MEMORY_POOL_CHILDREN_ADDR = createStandlonePlatformMBeanAddress(PlatformMBeanConstants.MEMORY_POOL); MEMORY_POOL_CHILDREN_ADDR.add(NAME, "*"); config.allowNullValueTypeForOperationReplyProperties(MEMORY_POOL_CHILDREN_ADDR, READ_RESOURCE_OPERATION); return config; }
private static ValidationConfiguration createWithGlobalOperations() { ValidationConfiguration config = new ValidationConfiguration(); //TODO should be possible to validate the operations executed... final ModelNode ROOT_ADDR = new ModelNode().setEmptyList(); //Exclude the operations where one of the reply properties is known to have {type=OBJECT,value-type=UNDEFINED} config.allowNullValueTypeForOperationParameter(ROOT_ADDR, VALIDATE_OPERATION, VALUE); config.allowNullValueTypeForOperationParameter(ROOT_ADDR, ValidateAddressOperationHandler.OPERATION_NAME, VALUE); //Exclude the operations where reply-properties is known to have {type=OBJECT,value-type=UNDEFINED} config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_OPERATION_DESCRIPTION_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_RESOURCE_DESCRIPTION_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_ATTRIBUTE_OPERATION); return config; }
/** * Register an additional arbitrary descriptor for all of an operation's parameters and reply properties * * @param address the address of the operation * @param operation the name of the operation * @param descriptor the arbitrary descriptor to register for the operation's parameters * @param validator an implementation of a validator, may be {@code null} */ public void registerArbitraryDescriptorForOperation(ModelNode address, String operation, String descriptor, AttributeOrParameterArbitraryDescriptorValidator validator) { registerArbitraryDescriptorForOperationParameter(address, operation, "*", descriptor, validator); }
private static ValidationConfiguration createWithGlobalOperations() { ValidationConfiguration config = new ValidationConfiguration(); //TODO should be possible to validate the operations executed... final ModelNode ROOT_ADDR = new ModelNode().setEmptyList(); //Exclude the operations where one of the reply properties is known to have {type=OBJECT,value-type=UNDEFINED} config.allowNullValueTypeForOperationParameter(ROOT_ADDR, VALIDATE_OPERATION, VALUE); config.allowNullValueTypeForOperationParameter(ROOT_ADDR, ValidateAddressOperationHandler.OPERATION_NAME, VALUE); //Exclude the operations where reply-properties is known to have {type=OBJECT,value-type=UNDEFINED} config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_OPERATION_DESCRIPTION_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_RESOURCE_DESCRIPTION_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_RESOURCE_OPERATION); config.allowNullValueTypeForOperationReplyProperties(ROOT_ADDR, READ_ATTRIBUTE_OPERATION); return config; }
/** * Allow undefined value-types for OBJECT or LIST type for an operation's reply-properties. * This should be used sparingly since an undefined value-type is normally a problem with your model. * * @param address the address of the operation * @param operation the name of the operation */ public void allowNullValueTypeForOperationReplyProperties(ModelNode address, String operation) { allowNullValueTypeForOperationParameter(address, operation, REPLY_PROPERTIES); }
/** * Allow undefined value-types for OBJECT or LIST type for all parameters and return types for an operation. * This should be used sparingly since an undefined value-type is normally a problem with your model. * * @param address the address of the operation * @param operation the name of the operation */ public void allowNullValueTypeForOperation(ModelNode address, String operation) { allowNullValueTypeForOperationParameter(address, operation, "*"); }
private static ValidationConfiguration createForDomain() { ValidationConfiguration config = createWithGlobalOperations(); ModelNode rolloutPlan = new ModelNode().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS).add(ROLLOUT_PLAN, "*"); config.allowNullValueTypeForAttribute(rolloutPlan, CONTENT); config.allowNullValueTypeForOperationParameter(rolloutPlan, "store", CONTENT); config.allowNullValueTypeForOperationParameter(rolloutPlan, ADD, CONTENT); return config; }
/** * Register an additional arbitrary descriptor for an operation's reply properties * * @param address the address of the operation * @param operation the name of the operation * @param descriptor the arbitrary descriptor to register for the operation's parameters * @param validator an implementation of a validator, may be {@code null} */ public void registerArbitraryDescriptorForOperationReplyProperties(ModelNode address, String operation, String descriptor, AttributeOrParameterArbitraryDescriptorValidator validator) { registerArbitraryDescriptorForOperationParameter(address, operation, REPLY_PROPERTIES, descriptor, validator); }