.build(); private ParametersValidator readAttributeValidator = new ParametersValidator();
.build(); private ParametersValidator readAttributeValidator = new ParametersValidator();
public ContentAdd(final ContentRepository contentRepository, final DeploymentFileRepository remoteRepository) { this.contentRepository = contentRepository; this.remoteRepository = remoteRepository; final ParametersValidator contentValidator = new ParametersValidator(); // existing managed content contentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES, true)); // content additions contentValidator.registerValidator(INPUT_STREAM_INDEX, new ModelTypeValidator(ModelType.INT, true)); contentValidator.registerValidator(BYTES, new ModelTypeValidator(ModelType.BYTES, true)); contentValidator.registerValidator(URL, new StringLengthValidator(1, true)); this.validator.registerValidator(CONTENT, chain(new ListValidator(new ParametersOfValidator(contentValidator)), new AbstractParameterValidator() { @Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { validateOnePieceOfContent(value); } })); this.managedContentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES)); }
public ContentAdd(final ContentRepository contentRepository, final DeploymentFileRepository remoteRepository) { this.contentRepository = contentRepository; this.remoteRepository = remoteRepository; final ParametersValidator contentValidator = new ParametersValidator(); // existing managed content contentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES, true)); // content additions contentValidator.registerValidator(INPUT_STREAM_INDEX, new ModelTypeValidator(ModelType.INT, true)); contentValidator.registerValidator(BYTES, new ModelTypeValidator(ModelType.BYTES, true)); contentValidator.registerValidator(URL, new StringLengthValidator(1, true)); this.validator.registerValidator(CONTENT, chain(new ListValidator(new ParametersOfValidator(contentValidator)), new AbstractParameterValidator() { @Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { validateOnePieceOfContent(value); } })); this.managedContentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES)); }
public DeploymentAddHandler(final ContentRepository contentRepository) { this.contentRepository = contentRepository; this.validator.registerValidator(RUNTIME_NAME, new StringLengthValidator(1, Integer.MAX_VALUE, true, false)); final ParametersValidator contentValidator = new ParametersValidator(); // existing managed content contentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES, true)); // existing unmanaged content contentValidator.registerValidator(ARCHIVE, new ModelTypeValidator(ModelType.BOOLEAN, true)); contentValidator.registerValidator(PATH, new StringLengthValidator(1, true)); contentValidator.registerValidator(RELATIVE_TO, new ModelTypeValidator(ModelType.STRING, true)); // content additions contentValidator.registerValidator(INPUT_STREAM_INDEX, new ModelTypeValidator(ModelType.INT, true)); contentValidator.registerValidator(BYTES, new ModelTypeValidator(ModelType.BYTES, true)); contentValidator.registerValidator(URL, new StringLengthValidator(1, true)); this.validator.registerValidator(CONTENT, chain(new ListValidator(new ParametersOfValidator(contentValidator)), new AbstractParameterValidator() { @Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { validateOnePieceOfContent(value); } })); this.managedContentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES)); this.unmanagedContentValidator.registerValidator(ARCHIVE, new ModelTypeValidator(ModelType.BOOLEAN)); this.unmanagedContentValidator.registerValidator(PATH, new StringLengthValidator(1)); }
private void init() { this.validator.registerValidator(NAME, new StringLengthValidator(1, Integer.MAX_VALUE, false, false)); this.validator.registerValidator(RUNTIME_NAME, new StringLengthValidator(1, Integer.MAX_VALUE, true, false)); // TODO: can we force enablement on replace? //this.validator.registerValidator(ENABLED, new ModelTypeValidator(ModelType.BOOLEAN, true)); final ParametersValidator contentValidator = new ParametersValidator(); // existing managed content contentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES, true)); // existing unmanaged content contentValidator.registerValidator(ARCHIVE, new ModelTypeValidator(ModelType.BOOLEAN, true)); contentValidator.registerValidator(PATH, new StringLengthValidator(1, true)); contentValidator.registerValidator(RELATIVE_TO, new ModelTypeValidator(ModelType.STRING, true)); // content additions contentValidator.registerValidator(INPUT_STREAM_INDEX, new ModelTypeValidator(ModelType.INT, true)); contentValidator.registerValidator(BYTES, new ModelTypeValidator(ModelType.BYTES, true)); contentValidator.registerValidator(URL, new StringLengthValidator(1, true)); this.validator.registerValidator(CONTENT, chain(new ListValidator(new ParametersOfValidator(contentValidator)), new AbstractParameterValidator() { @Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { validateOnePieceOfContent(value); } })); this.managedContentValidator.registerValidator(HASH, new ModelTypeValidator(ModelType.BYTES)); this.unmanagedContentValidator.registerValidator(ARCHIVE, new ModelTypeValidator(ModelType.BOOLEAN)); this.unmanagedContentValidator.registerValidator(PATH, new StringLengthValidator(1)); }