eperson.setCanLogIn(true); eperson.setRequireCertificate(false); eperson.setSelfRegistered(false);
    public static void main(String[] argv)    {        Context context = null;        BufferedReader input = null;        try        {            // For easier reading of typing            input = new BufferedReader(new InputStreamReader(System.in));            context = new Context();            // Of course we aren't an administrator yet so we need to            // circumvent authorisation            context.setIgnoreAuthorization(true);            System.out.println("Creating an initial administrator account");            boolean dataOK = false;            String email = null;            String firstName = null;            String lastName = null;            String password1 = null;            String password2 = null;            while (!dataOK)            {                System.out.print("E-mail address: ");                System.out.flush();                email = input.readLine().trim();                System.out.print("First name: ");                System.out.flush();                firstName = input.readLine().trim();                System.out.print("Last name: ");                System.out.flush();                lastName = input.readLine().trim();                System.out.println("WARNING: Password will appear on-screen.");                System.out.print("Password: ");                System.out.flush();                password1 = input.readLine().trim();                System.out.print("Again to confirm: ");                System.out.flush();                password2 = input.readLine().trim();                if (!password1.equals("") && password1.equals(password2))                {                    // password OK                    System.out.print("Is the above data correct? (y or n): ");                    System.out.flush();                    String s = input.readLine().trim();                    if (s.toLowerCase().startsWith("y"))                    {                        dataOK = true;                    }                }                else                {                    System.out.println("Passwords don't match");                }            }            // Find administrator group            Group admins = Group.find(context, 1);            if (admins == null)            {                System.out.println("Error, no admin group (group 1) found");                System.exit(1);            }            // Create the administrator e-person            EPerson eperson = EPerson.create(context);            eperson.setEmail(email);            eperson.setLastName(lastName);            eperson.setFirstName(firstName);            eperson.setPassword(password1);            eperson.setCanLogIn(true);            eperson.setRequireCertificate(false);            eperson.setSelfRegistered(false);            eperson.update();            admins.addMember(eperson);            admins.update();            context.complete();            System.out.println("Administrator account created");            System.exit(0);        }        catch (Exception e)        {            System.err.println("Exception occurred:" + e);            e.printStackTrace();            if (context != null)            {                context.abort();            }            System.exit(1);        }    }