Example #1
0
  /**
   * Create a new file database with the specified name and unique folder name.
   *
   * @param displayName name displayed to the user
   * @param name of the file database used when creating the dabase in the file system.
   * @param path of the file database
   * @return the created file database
   * @throws LocationAlreadyExistsException - if the location already exists
   */
  public DefaultFileDatabase createFileDatabase(
      String displayName, String name, String path, String description)
      throws LocationAlreadyExistsException {

    if (path == null) {
      throw new IllegalStateException("The path cannot be null");
    }

    if (name == null) {
      throw new IllegalStateException("the name cannot be null");
    }

    // create the new file database
    DefaultFileDatabase FileDatabaseImpl = new DefaultFileDatabase();
    FileDatabaseImpl.setDisplayName(displayName);
    FileDatabaseImpl.setName(name);
    FileDatabaseImpl.setPath(path);
    FileDatabaseImpl.setFileServer(this);

    // create a folder for this file database
    FileSystemManager.createDirectory(FileDatabaseImpl.getFullPath());

    fileDatabases.add(FileDatabaseImpl);
    return FileDatabaseImpl;
  }