private Source[] getSources() throws FileNotFoundException, MalformedURLException { // we support multiple schema by delimiting they by ',' String[] schemas = schema.split(","); Source[] sources = new Source[schemas.length]; for (int i = 0; i < schemas.length; i++) { URL schemaUrl = ResourceHelper.resolveMandatoryResourceAsUrl(camelContext.getClassResolver(), schemas[i]); sources[i] = new StreamSource(schemaUrl.toExternalForm()); } return sources; }
@Override protected void doStart() throws Exception { super.doStart(); ObjectHelper.notNull(resourceUri, "resourceUri", this); if (elSqlConfig == null && databaseVendor != null) { elSqlConfig = databaseVendor.asElSqlConfig(); } else if (elSqlConfig == null) { elSqlConfig = ElSqlDatabaseVendor.Default.asElSqlConfig(); } // there can be multiple resources // so we have all this lovely code to turn that into an URL[] final List<URL> list = new ArrayList<>(); final Iterable it = ObjectHelper.createIterable(resourceUri); for (final Object path : it) { final URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), path.toString()); list.add(url); } final URL[] urls = list.toArray(new URL[list.size()]); elSql = ElSql.parse(elSqlConfig, urls); }
protected void initDozerBeanContainerAndMapper() throws Exception { LOG.info("Configuring {}...", Mapper.class.getName()); if (mapper == null) { if (configuration.getMappingConfiguration() == null) { URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), configuration.getMappingFile()); DozerBeanMapperConfiguration config = new DozerBeanMapperConfiguration(); config.setCustomConvertersWithId(getCustomConvertersWithId()); config.setMappingFiles(Arrays.asList(url.toString())); configuration.setMappingConfiguration(config); } else { DozerBeanMapperConfiguration config = configuration.getMappingConfiguration(); if (config.getCustomConvertersWithId() == null) { config.setCustomConvertersWithId(getCustomConvertersWithId()); } else { config.getCustomConvertersWithId().putAll(getCustomConvertersWithId()); } if (config.getMappingFiles() == null || config.getMappingFiles().size() <= 0) { URL url = ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(), configuration.getMappingFile()); config.setMappingFiles(Arrays.asList(url.toString())); } } MapperFactory factory = new MapperFactory(getCamelContext(), configuration.getMappingConfiguration()); mapper = factory.create(); } }