Class CreateAdministrator

java.lang.Object
org.dspace.administer.CreateAdministrator

public final class CreateAdministrator extends Object
A command-line tool for creating an initial administrator for setting up a DSpace site. Prompts for an e-mail address, last name, first name and password from standard input. An administrator group is then created and the data passed in used to create an e-person in that group.

Alternatively, it can be used to take the email, first name, last name and desired password as arguments thus: CreateAdministrator -e [email] -f [first name] -l [last name] -p [password] This is particularly convenient for automated deploy scripts that require an initial administrator, for example, before deployment can be completed

Version:
$Revision$
Author:
Robert Tansley, Richard Jones
  • Field Details

  • Constructor Details

    • CreateAdministrator

      protected CreateAdministrator() throws Exception
      constructor, which just creates and object with a ready context
      Throws:
      Exception - if error
  • Method Details

    • main

      public static void main(String[] argv) throws Exception
      For invoking via the command line. If called with no command line arguments, it will negotiate with the user for the administrator details
      Parameters:
      argv - the command line arguments given
      Throws:
      Exception - if error
    • negotiateAdministratorDetails

      protected void negotiateAdministratorDetails(org.apache.commons.cli.CommandLine line) throws Exception
      Method which will negotiate with the user via the command line to obtain the administrator's details
      Throws:
      Exception - if error
    • createAdministrator

      protected void createAdministrator(String email, String first, String last, String language, String pw) throws Exception
      Create the administrator with the given details. If the user already exists then they are simply upped to administrator status
      Parameters:
      email - the email for the user
      first - user's first name
      last - user's last name
      language - preferred language
      pw - desired password
      Throws:
      Exception - if error