Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
  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);
      }
    }
  }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
  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);
  }