Package org.dspace.administer
Class CreateAdministrator
java.lang.Object
org.dspace.administer.CreateAdministrator
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedconstructor, which just creates and object with a ready context -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreate the administrator with the given details.static voidFor invoking via the command line.protected voidnegotiateAdministratorDetails(org.apache.commons.cli.CommandLine line) Method which will negotiate with the user via the command line to obtain the administrator's details
-
Field Details
-
ePersonService
-
groupService
-
-
Constructor Details
-
CreateAdministrator
constructor, which just creates and object with a ready context- Throws:
Exception- if error
-
-
Method Details
-
main
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 userfirst- user's first namelast- user's last namelanguage- preferred languagepw- desired password- Throws:
Exception- if error
-