@Test public void test() throws IOException { TransformSwitchYardScanner scanner = new TransformSwitchYardScanner(); List<URL> urls = new ArrayList<URL>(); urls.add(new File("./target/test-classes").toURI().toURL()); ScannerInput<SwitchYardModel> input = new ScannerInput<SwitchYardModel>().setURLs(urls); SwitchYardModel switchyard = scanner.scan(input).getModel(); List<TransformModel> models = switchyard.getTransforms().getTransforms(); Assert.assertEquals(11, models.size()); assertModelInstanceOK((JavaTransformModel) models.get(0)); assertModelInstanceOK((JavaTransformModel) models.get(1)); assertModelInstanceOK((JavaTransformModel) models.get(2)); }
@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); }
TransformSwitchYardScanner implements Scanner<SwitchYardModel> { @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); } }
TransformSwitchYardScanner implements Scanner<SwitchYardModel> { @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); }  }
TransformSwitchYardScanner implements Scanner<SwitchYardModel> { @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); }  @Override ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input); }
TransformSwitchYardScanner implements Scanner<SwitchYardModel> { @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); }  @Override ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input);  }