public URI createFolder(URI studyUri, String folderName, boolean parent) throws CatalogIOException { checkParam(folderName); if (!folderName.endsWith("/")) { folderName += "/"; } checkDirectoryUri(studyUri, true); URI folderUri = null; try { folderUri = studyUri.resolve(new URI(null, folderName, null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(folderName, e); } try { if (!exists(folderUri)) { if (parent) { createDirectory(folderUri, true); } else { checkDirectoryUri(folderUri.resolve(".."), true); createDirectory(folderUri); } } } catch (CatalogIOException e) { throw new CatalogIOException("createFolder(): could not create the directory", e); } return folderUri; }
/** * This method creates the folders and workspace structure for storing the OpenCGA data. I * * @throws CatalogIOException CatalogIOException */ public void setup() throws CatalogIOException { setConfiguration(configuration); if (!exists(rootDir)) { logger.info("Initializing CatalogIOManager. Creating main folder '" + rootDir + "'"); createDirectory(rootDir, true); } checkDirectoryUri(rootDir, true); if (!exists(jobsDir)) { logger.info("Initializing CatalogIOManager. Creating jobs folder '" + jobsDir + "'"); createDirectory(jobsDir); } checkDirectoryUri(jobsDir, true); if (!exists(rootDir.resolve(OPENCGA_USERS_FOLDER))) { createDirectory(rootDir.resolve(OPENCGA_USERS_FOLDER)); } if (!exists(rootDir.resolve(OPENCGA_ANONYMOUS_USERS_FOLDER))) { createDirectory(rootDir.resolve(OPENCGA_ANONYMOUS_USERS_FOLDER)); } if (!exists(rootDir.resolve(OPENCGA_BIN_FOLDER))) { createDirectory(rootDir.resolve(OPENCGA_BIN_FOLDER)); } }
public URI createStudy(String userId, String projectId, String studyId) throws CatalogIOException { checkParam(studyId); URI projectUri = getProjectUri(userId, projectId); checkDirectoryUri(projectUri, true); URI studyUri = getStudyUri(userId, projectId, studyId); return createStudy(studyUri); }
public URI createUser(String userId) throws CatalogIOException { checkParam(userId); URI usersUri = getUsersUri(); checkDirectoryUri(usersUri, true); URI userPath = getUserUri(userId); try { if (!exists(userPath)) { createDirectory(userPath); createDirectory(userPath.resolve(CatalogIOManager.USER_PROJECTS_FOLDER)); createDirectory(userPath.resolve(CatalogIOManager.USER_BIN_FOLDER)); return userPath; } } catch (CatalogIOException e) { throw e; } return null; }
public URI createJobOutDir(String userId, String folderName) throws CatalogIOException { checkParam(folderName); URI jobsFolderUri = getJobsUri(userId); checkDirectoryUri(jobsFolderUri, true); URI jobUri; try { jobUri = jobsFolderUri.resolve(new URI(null, folderName, null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(folderName, e); } if (!exists(jobUri)) { try { jobUri = createDirectory(jobUri, true); } catch (CatalogIOException e) { throw new CatalogIOException("createStudy method: could not create the study folder: " + e.toString(), e); } } else { throw new CatalogIOException("createJobOutDir method: Job folder " + folderName + "already exists."); } return jobUri; }