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); } } }
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); }
private void copyDirectory(IStorage sourceDir, IStorage destinationDir) { destinationDir.mkdirs(); IStorage[] file = sourceDir.listFiles(); for (int i = 0; i < file.length; i++) { if (file[i].isFile()) { IStorage sourceFile = file[i]; IStorage targetFile = baseDirectory.newInstance(destinationDir, file[i].getName()); copyFile(sourceFile, targetFile); } if (file[i].isDirectory()) { IStorage destination = baseDirectory.newInstance(destinationDir, file[i].getName()); copyDirectory(file[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 ReviewManager() { String basePath = ServerManager.getServerManger() .getDavinciProperty(IDavinciServerConstants.BASE_DIRECTORY_PROPERTY); baseDirectory = ServerManager.getServerManger().getBaseDirectory().newInstance("."); if (basePath != null) { IStorage dir = baseDirectory.newInstance(basePath); if (dir.exists()) baseDirectory = dir; } if (ServerManager.DEBUG_IO_TO_CONSOLE) System.out.println("\nSetting [user space] to: " + baseDirectory.getAbsolutePath()); }
/** *********************************************** */ public void saveVersionFile(IDesignerUser user) { IStorage versionFile = baseDirectory.newInstance(user.getCommentingDirectory(), "snapshot/versions.xml"); VersionFile file = new VersionFile(); file.save(versionFile, user); }
private IStorage getReviewerVersionFile(Reviewer reviewer) { IStorage versionFile = baseDirectory.newInstance( getReviewerVersionDirectory(), this.buildBaseFileForFromReviewer(reviewer)); return versionFile; }