public URI getJobsUri(String userId) throws CatalogIOException { checkParam(userId); return jobsDir; }
@Deprecated public URI getStudyUri(String userId, String projectId, String studyId) throws CatalogIOException { checkParam(studyId); try { return getProjectUri(userId, projectId).resolve(new URI(null, studyId.endsWith("/") ? studyId : (studyId + "/"), null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(studyId, e); } }
public URI getFileUri(URI studyUri, String relativeFilePath) throws CatalogIOException { checkUriExists(studyUri); checkParam(relativeFilePath); try { return studyUri.resolve(new URI(null, relativeFilePath, null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(relativeFilePath, e); } }
public URI getUserUri(String userId) throws CatalogIOException { checkParam(userId); try { return getUsersUri().resolve(new URI(null, userId.endsWith("/") ? userId : (userId + "/"), null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(userId, e); } }
public URI getAnonymousUserUri(String userId) throws CatalogIOException { // FIXME: Should replicate to getAnonymousPojectUri, // ...Study..., etc ? checkParam(userId); try { return getAnonymousUsersUri().resolve(new URI(null, userId.endsWith("/") ? userId : (userId + "/"), null)); } catch (URISyntaxException e) { throw CatalogIOException.uriSyntaxException(userId, e); } }
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 createProject(String userId, String projectId) throws CatalogIOException { checkParam(projectId); URI projectUri = getProjectUri(userId, projectId); try { if (!exists(projectUri)) { projectUri = createDirectory(projectUri, true); } } catch (CatalogIOException e) { throw new CatalogIOException("createProject(): could not create the project folder", e); } return projectUri; }
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; }
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; }