Database Reference
In-Depth Information
ojsInit()
method of
RegNewApp
as shown in Listing 12-70. We also call
putAppConnections()
but that has
no effect when an there is no existing connection string list in the database—that call, at this point, does
not save the list in the database.
Listing 12-70.
Bootstrap Register New Application for OJSAdmin
public RegNewApp() {
try {
jbInit();
// First times through way to build conn string list, or use this tool
OracleJavaSecure.putAppConnString("apver", "avadmin", "password",
"localhost", String.valueOf(1521));
OracleJavaSecure.putAppConnections();
conn = OracleJavaSecure.getAAConnRole("apver", "avadmin");
} catch (Exception e) {
e.printStackTrace();
}
}
We are going to enter some representative data on the Register New Application screen shown in
Figure 12-6. The top three entries for application ID, app user and app role will not be needed - we have
already entered records with the necessary data values in our scripts, and we haven't acquired the
appver_admin
role needed to do the associated inserts. However, enter
ojsadmin
,
avadmin
,
appver_admin
in the top three text fields. Enter the correct package,
orajavsec
, and enter the class name,
Login
. At this
point the
Create App Class
button will appear. Click the
Create App Class
button to create the Java
structure. If you ever mistype a package name, and create an incorrect class, you can drop the class with
a command like this (don't do this, for information only):
DROP JAVA SOURCE appsec."badPackageName/Login";
Notice when you click the
Create App Class
button that the last text field on the screen is
automatically populated with the default inner class name of the
Login
class,
InnerRevLvlClass
. With all
the fields populated, you are now ready to click on the
Register
button. When you do that, the
Register
New Application
screen will instantiate the class described by your package name and the class name
Login$InnerRevLvlClass
. Some errors will be reported because this event normally inserts data into the
v_application_registry
,
v_application_admins
and
v_app_conn_id
views. Those inserts fail, but
inserting the application inner class and an empty list of connection strings into
v_app_conn_registry
succeeds. This was the bootstrap process!
The
Close
button turned to
Exit
because we have changed the application context. You can select
the
Exit
button at this time. Your application is registered, but you still need to insert connection strings
into the list in order to use the functional screens of
OJSAdmin
. Start
OJSAdmin
again, and provide the two-
factor authentication code that is sent to you. This may seem like an odd step, but you need to enter the
Register New Application screen again. This time as you go in, the
putAppConnString()
method is called
to again add the
avadmin
connection string to the list in memory, but this time when we call
putAppConnections()
, that connection string will be saved in the list that resides in the database. Since
our connection strings list contains the
avadmin
connection string, we entered this screen with the
appver_admin
role, and we can
UPDATE
the
v_app_conn_registry
view.