public synchronized DataSource getDataSourceByUrlPrefix(String url) { for (DataSource dataSource : getDataSources()) { if (url.startsWith(dataSource.getBaseUrl())) return dataSource; } return null; }
public synchronized DataSource getDataSourceById(String id) { for (DataSource dataSource : getDataSources()) { if (id.equals(dataSource.getId())) return dataSource; } return null; }
public void initialize() { DataSourceService dataSourceService = dataSourceManager.getDataSourceService(); for (DataSource dataSource : dataSourceService.getDataSources()) { mapFiles.add(new MapFiles(dataSource)); } }
public Downloadable getDownloadable(String url) { for (DataSource dataSource : getDataSources()) { if(!url.startsWith(dataSource.getBaseUrl())) continue; String uri = url.substring(dataSource.getBaseUrl().length()); Downloadable downloadable = dataSource.getDownloadable(uri); if (downloadable != null) return downloadable; } return null; }
public synchronized void initialize() { hgtFiles.clear(); for (DataSource dataSource : dataSourceManager.getDataSourceService().getDataSources()) { if (DATASOURCE_URIS.contains(dataSource.getId())) hgtFiles.add(new HgtFiles(dataSource, dataSourceManager.getDownloadManager())); } }
public synchronized Downloadable getDownloadable(File file) throws IOException { String filePath = asMetaDataComparablePath(file); for (DataSource dataSource : getDataSources()) { File directory = getApplicationDirectory(dataSource.getDirectory()); String directoryPath = directory.getCanonicalPath();
public void snapshot() throws IOException, JAXBException { open(); dataSourceManager.downloadRoot(getDataSourcesServer(), getRootDirectory()); DataSourceService root = loadAllDataSources(getRootDirectory()); dataSourceManager.downloadEditions(root.getEditions(), getEditionsDirectory()); DataSourceService editions = loadAllDataSources(getEditionsDirectory()); dataSourceManager.downloadDataSources(createDataSourceSet(editions.getEditions()), getDataSourcesDirectory()); DataSourceService dataSources = loadAllDataSources(getDataSourcesDirectory()); log.info(String.format("Snapshot contains %d editions and %d datasources", editions.getEditions().size(), dataSources.getDataSources().size())); close(); }