*/
@Override
public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException {
SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace();
SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri());
TransformsModel transformsModel = null;
TransformNamespace transformNamespace = TransformNamespace.DEFAULT;
for (TransformNamespace value : TransformNamespace.values()) {
if (value.versionMatches(switchyardNamespace)) {
transformNamespace = value;
break;
}
}
List<Class<?>> transformerClasses = scanForTransformers(input.getURLs());
for (Class<?> transformer : transformerClasses) {
List<TransformerTypes> supportedTransforms = TransformerUtil.listTransformations(transformer);
for (TransformerTypes supportedTransform : supportedTransforms) {
JavaTransformModel transformModel = new V1JavaTransformModel(transformNamespace.uri());
String bean = CDIUtil.getNamedAnnotationValue(transformer);
if (bean != null) {
transformModel.setBean(bean);
} else {
transformModel.setClazz(transformer.getName());
}
transformModel.setFrom(supportedTransform.getFrom());
transformModel.setTo(supportedTransform.getTo());
if (transformsModel == null) {
transformsModel = new V1TransformsModel(switchyardNamespace.uri());
switchyardModel.setTransforms(transformsModel);
}
transformsModel.addTransform(transformModel);
}
}
return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel);
}