@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); } }
public IndexDaemon(int interval, String sessionId, CatalogManager catalogManager, String appHome) throws URISyntaxException, CatalogIOException, CatalogDBException { super(interval, sessionId, catalogManager); this.binHome = appHome + "/bin/"; URI uri = UriUtils.createUri(catalogManager.getConfiguration().getTempJobsDir()); this.tempJobFolder = Paths.get(uri.getPath()); this.catalogIOManager = catalogManager.getCatalogIOManagerFactory().get("file"); this.jobDBAdaptor = dbAdaptorFactory.getCatalogJobDBAdaptor(); // this.variantIndexOutputRecorder = new VariantIndexOutputRecorder(catalogManager, catalogIOManager, sessionId); }
public ExecutionDaemon(int interval, String sessionId, CatalogManager catalogManager, String appHome) throws CatalogDBException, URISyntaxException, CatalogIOException { super(interval, sessionId, catalogManager); URI uri = UriUtils.createUri(catalogManager.getConfiguration().getTempJobsDir()); this.tempJobFolder = Paths.get(uri.getPath()); this.catalogIOManager = catalogManager.getCatalogIOManagerFactory().get("file"); this.binAnalysis = appHome + "/bin/opencga-analysis.sh"; this.jobDBAdaptor = dbAdaptorFactory.getCatalogJobDBAdaptor(); }
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()); } } }
if (!configuration.getTempJobsDir().isEmpty()) { Path jobsDir = Paths.get(UriUtils.createDirectoryUri(configuration.getTempJobsDir())); if (jobsDir.toFile().exists()) { deleteFolderTree(jobsDir.toFile());
public void installCatalogDB(String secretKey, String password) throws CatalogException { if (existsCatalogDB()) { throw new CatalogException("Nothing to install. There already exists a catalog database"); } ParamUtils.checkParameter(secretKey, "secretKey"); ParamUtils.checkParameter(password, "password"); configuration.getAdmin().setPassword(password); configuration.getAdmin().setSecretKey(secretKey); // Check jobs folder is empty URI jobsURI; try { jobsURI = UriUtils.createDirectoryUri(configuration.getTempJobsDir()); } catch (URISyntaxException e) { throw new CatalogException("Failed to create a directory URI from " + configuration.getTempJobsDir()); } CatalogIOManager ioManager = getCatalogIOManagerFactory().get(jobsURI); if (!ioManager.isDirectory(jobsURI) || CollectionUtils.isNotEmpty(ioManager.listFiles(jobsURI))) { throw new CatalogException("Cannot install openCGA. Jobs folder is not empty.\nPlease, empty it first."); } catalogDBAdaptorFactory.installCatalogDB(configuration); }