public CatalogIOManagerFactory(Configuration configuration) throws CatalogIOException { this.properties = null; this.configuration = configuration; try { mainRootdir = UriUtils.createDirectoryUri(configuration.getDataDir()); } catch (URISyntaxException e) { throw new CatalogIOException("Malformed URI 'OPENCGA.CATALOG.MAIN.ROOTDIR'", e); } String scheme = mainRootdir.getScheme(); if (scheme != null) { defaultCatalogScheme = scheme; } }
@Override protected void setConfiguration(Configuration configuration) throws CatalogIOException { try { rootDir = UriUtils.createDirectoryUri(configuration.getDataDir()); } catch (URISyntaxException e) { throw new CatalogIOException("Malformed URI 'OPENCGA.CATALOG.MAIN.ROOTDIR'", e); } if (!rootDir.getScheme().equals("file")) { throw new CatalogIOException("wrong posix file system in catalog.properties: " + rootDir); } if (configuration.getTempJobsDir().isEmpty()) { jobsDir = rootDir.resolve(DEFAULT_OPENCGA_JOBS_FOLDER); } else { try { jobsDir = UriUtils.createDirectoryUri(configuration.getTempJobsDir()); } catch (URISyntaxException e) { throw new CatalogIOException("Malformed URI 'OPENCGA.CATALOG.MAIN.ROOTDIR'", e); } } if (!jobsDir.getScheme().equals("file")) { throw new CatalogIOException("wrong posix file system in catalog.properties: " + jobsDir); } }
private void clearCatalog() throws URISyntaxException { List<DataStoreServerAddress> dataStoreServerAddresses = new LinkedList<>(); for (String hostPort : configuration.getCatalog().getDatabase().getHosts()) { if (hostPort.contains(":")) { String[] split = hostPort.split(":"); Integer port = Integer.valueOf(split[1]); dataStoreServerAddresses.add(new DataStoreServerAddress(split[0], port)); } else { dataStoreServerAddresses.add(new DataStoreServerAddress(hostPort, 27017)); } } MongoDataStoreManager mongoManager = new MongoDataStoreManager(dataStoreServerAddresses); // MongoDataStore db = mongoManager.get(catalogConfiguration.getDatabase().getDatabase()); MongoDataStore db = mongoManager.get(getCatalogDatabase()); db.getDb().drop(); // mongoManager.close(catalogConfiguration.getDatabase().getDatabase()); mongoManager.close(getCatalogDatabase()); Path rootdir = Paths.get(UriUtils.createDirectoryUri(configuration.getDataDir())); deleteFolderTree(rootdir.toFile()); if (!configuration.getTempJobsDir().isEmpty()) { Path jobsDir = Paths.get(UriUtils.createDirectoryUri(configuration.getTempJobsDir())); if (jobsDir.toFile().exists()) { deleteFolderTree(jobsDir.toFile()); } } }
Path rootdir = Paths.get(UriUtils.createDirectoryUri(configuration.getDataDir())); deleteFolderTree(rootdir.toFile()); if (!configuration.getTempJobsDir().isEmpty()) {