*/
@Override
public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException {
SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
ValidatesModel validatesModel = null;
ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT;
for (ValidateNamespace value : ValidateNamespace.values()) {
if (value.versionMatches(switchyardNamespace)) {
validateNamespace = value;
break;
}
}
List<Class<?>> validatorClasses = scanForValidators(input.getURLs());
for (Class<?> validator : validatorClasses) {
List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator);
for (ValidatorTypes supportedValidate : supportedValidators) {
JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri());
String bean = CDIUtil.getNamedAnnotationValue(validator);
if (bean != null) {
validateModel.setBean(bean);
} else {
validateModel.setClazz(validator.getName());
}
validateModel.setName(supportedValidate.getName());
if (validatesModel == null) {
validatesModel = new V1ValidatesModel(switchyardNamespace.uri());
switchyardModel.setValidates(validatesModel);
}
validatesModel.addValidate(validateModel);
}
}
return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel);
}