public IUser getSingleUser() { if (localUser == null) { class LocalPerson implements IPerson { public String getEmail() { return ""; } public String getFirstName() { return ""; } public String getLastName() { return ""; } public String getUserID() { return IDavinciServerConstants.LOCAL_INSTALL_USER; } } IStorage userDir = this.baseDirectory; userDir.mkdir(); localUser = new User(new LocalPerson(), userDir); IStorage settingsDir = this.baseDirectory.newInstance(userDir, IDavinciServerConstants.SETTINGS_DIRECTORY_NAME); if (!settingsDir.exists()) { settingsDir.mkdir(); IVResource project = localUser.createProject(IDavinciServerConstants.DEFAULT_PROJECT); } } return localUser; }
private void initVersionDir(IDesignerUser user, String timeStamp) { IStorage versionDir = baseDirectory.newInstance(user.getCommentingDirectory(), "snapshot/" + timeStamp); if (versionDir.exists()) return; versionDir.mkdir(); IStorage userDir = user.getUserDirectory(); IStorage[] files = userDir.listFiles(); for (int i = 0; i < files.length; i++) { String path = files[i].getAbsolutePath(); if (files[i].isFile() && path.indexOf(IDavinciServerConstants.WORKING_COPY_EXTENSION) < 0) { IStorage destination = baseDirectory.newInstance(versionDir, files[i].getName()); copyFile(files[i], destination); } else if (files[i].isDirectory() // && path.indexOf(IDavinciServerConstants.SETTINGS_DIRECTORY_NAME) < 0 // Need to // copy the settings && path.indexOf(IDavinciServerConstants.DOWNLOAD_DIRECTORY_NAME) < 0 && path.indexOf(Constants.REVIEW_DIRECTORY_NAME) < 0 && path.indexOf(".svn") < 0 && containsPublishedFiles(files[i], user, timeStamp)) { IStorage destination = baseDirectory.newInstance(versionDir, files[i].getName()); copyDirectory(files[i], destination); } } }
private IStorage getReviewerVersionDirectory() { // Init the directory to hold version info for all of the reviewers and return it IStorage reviewerVersionsDirectory = baseDirectory.newInstance(baseDirectory, Constants.REVIEW_DIRECTORY_NAME); if (!reviewerVersionsDirectory.exists()) { reviewerVersionsDirectory.mkdir(); } return reviewerVersionsDirectory; }
public void saveDraft(String name, Version version) { IDesignerUser user = getDesignerUser(name); IStorage commentingDir = user.getCommentingDirectory(); if (!commentingDir.exists()) { commentingDir.mkdir(); (baseDirectory.newInstance(commentingDir, "snapshot")).mkdir(); (baseDirectory.newInstance(commentingDir, "livedoc")).mkdir(); } saveVersionFile(user); }
public void publish(String name, Version version) { IDesignerUser user = getDesignerUser(name); IStorage commentingDir = user.getCommentingDirectory(); if (!commentingDir.exists()) { commentingDir.mkdir(); (baseDirectory.newInstance(commentingDir, "snapshot")).mkdir(); (baseDirectory.newInstance(commentingDir, "livedoc")).mkdir(); } initVersionDir(user, version.getTime()); saveVersionFile(user); // Persist review information this.saveReviewerVersionFiles(version); }