Uncategorized

Creating Root Application Module Instance – Oracle ADF


Introduction:

When developing ADF Business Components, we might need a handle to an Application Module (AM) instance. I have used the AM instance in the past to

a) invoke the methods on the Application Module for testing – think quick and dirty Java main for validating configuration is okay or for debugging through the method you implemented in the AM

b) invoke the methods on the Application Module from a Web Services project. We used a separate project to host the invoker classes that has the Webservice methods on them, the methods would create an instance of the AM and release them once done.

Now, to get an instance of the AM we need to invoke the “createRootApplicationModule” method on the “oracle.jbo.client.Configuration” class statically. There are a couple of overloaded methods in the class, I will illustrate using the simplest which takes in two parameters.

Example Details:

Before we start you should have done the following:

1) Created a new Fusion Web Application in JDeveloper

2) Created an Application Module in your Model project

Notice when you create the application module how the file-system looks …  look for a “common” folder where your ApplicationModule class is … do you see a “bc4j.xcfg” there? Open this up in your favorite text-editor and study it a little … what configurations do you see defined under “AppModuleConfig” ? what are the some of the application names under “ApplicationName” ?

Done?

My project looks something like this

…and my BC4J file looks something like this

Next we will see how to create an instance of the Application Module and invoke a method there.

Steps:

  1. Create a method in your AM
  2. Expose it to the AM Client by editing the AM propertiese
  3. Create a test client – a simple Java main which has the Configuration.createRootApplicationModule(String, String) method in it
  4. Invoke the method in the AM from the Java main client

I have illustrated these steps in detail below, click on the thumbnail to see the details:

1) Create a method in your AM

2) Expose it to the AM Client by editing the AM properties

Right click and open the properties dialog by clicking the “Open ApplicationModule”

Select the Java tab for configuring the methods exposed to the client …click on the “pencil” icon to edit

Once the dialog opens up, shuttle the method or methods you want to expose to the client. Note: If the methods use variables that are not serialize-able then you might not be able to shuttle them.

3) Create a test client – a simple Java main which has the Configuration.createRootApplicationModule(String, String) method in it

4) Invoke the method in the AM from the Java main client

Advertisements

2 thoughts on “Creating Root Application Module Instance – Oracle ADF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s