Tutorial 16: Writing an application that creates a user
In this tutorial, you build an application that logs in to a volume as Administrator and creates a user. The program demonstrates the following administration operations to create a user:
Creates a user name and home folder
Sets view preference, notification, e-mail, and job priority options
Calls ActuateControl.CreateUser( )
Figure 21‑13 shows the output to the command prompt window when the user creation operation succeeds.
Figure 21‑13 Message indicating that the user creation operation succeeded
To complete this tutorial, you need access to the following application classes and related files from Tutorial 15:
Arguments.java
ActuateController.java
ActuateAPIEx.java
ActuateAPILocatorEx.java
Task 1: How to write the application that creates a volume user
In this task, you create the AcCreateUser application. If you did not create Arguments.java, ActuateAPIEx.java, and ActuateAPILocatorEx.java in Tutorial 15: “Catching a SOAP message with Axis TCPMonitor,” you must also create these classes.
1 Navigate to or create the \ActuateTraining3\IDAPI\source directory. Create a new file called \ActuateTraining11\IDAPI\source\AcCreateUser.java and open the file for editing. Add import statements for com.actuate.schemas and java.rmi.RemoteException, and create an AcCreateUser class definition and main method, as shown in Listing 21‑4.
1 To instantiate a User object and use ActuateControl.newUser( ) to set the userName, a password that is the same as the user name, and homeFolder attributes, type:
User user = actuateControl.newUser(userName, userName, homeFolder);
7 To make the call to create the user using ActuateControl.CreateUser( ), type:
actuateControl.createUser(user);
8 To create an output message, type:
System.out.println("User " + userName + ", view preferences, send notice and email features, plus job priority privileges created.");
2 In the \ActuateTraining3\IDAPI\source directory, open the file called AcController.java, created in Tutorial 15: “Catching a SOAP message with Axis TCPMonitor,” for editing. If AcController.java does not exist, create a new file called AcController.java as instructed in Tutorial 15. Add a method to create a user as shown in Listing 21‑5.
Listing 21‑5 AcController with a createUser method
The Java application writes the following messages, shown in Figure 21‑14, to the command prompt when a volume login succeeds and the volume creates the user.
Figure 21‑14 Message indicating that login succeeds and a new user is created
Task 3: How to verify the creation of the user
In this task, you use the iHub administration tool to examine the results of the actions you completed in the earlier tasks of this tutorial.
1 Open BIRT iHub Visualization Console.
2 Log in as Administrator.
3 In Visualization Console, choose Administrator➛iHub Administration. Users appears.
4 Verify that testUser exists in the list of Users, as shown in Figure 21‑15.
5 Choose testUser. Edit testUser appears.
Figure 21‑15 The list of users showing testUser
6 Verify that correct values appear in E-mail address and Home folder, as shown in Figure 21‑16.
Figure 21‑16 The general property values for testUser