Monday, October 26, 2009

Integration in Oracle ADF with ADF Task Flows and Shared Java Classes

I continue a series of posts about Oracle ADF application structuring, splitting and integration. You can read my previous hints and advices from this blog post - Integration in Oracle ADF with ADF Task Flows and Common Files. Today I will show, how you can reuse Java classes through project dependencies.

Download updated sample application - I have updated it with one more application - SharedApp, where I have extracted common Java classes I have used previously - JSFUtils and ADFUtils. Lets see how it works.

First, I have application where I'm using common Java classes - JSFUtils and ADF Utils:

There are more applications in my infrastructure, and all of them are using same classes. You can imagine, if we need to do change in those classes, we will need to replicate it across all infrastructure. In order to avoid this, we would prefer to keep those classes in unique physical location, so when there will be any change it will be propagated automatically - since all applications are pointing to the same location.

Lets refactor applications and extract common Java classes into separate project. I will delete local common files and will copy them to SharedApp application, Shared project:

When refactoring is completed, I can come back to original application and add project from SharedApp application, yes we can add project even from different application:

Shared project is added, I can see common Java classes are there:

When we have Shared project added, one thing we need to do, is to specify ViewController project dependency on external Shared project:

Dependency is set:

ADFUtils are now imported from shared location:

Its important to mention, when you will generate ADF Library JAR from your application, classes included through dependency will not be included into JAR package. This means, you will need to enable same dependency in your master application - in order for common Java classes to be loaded on runtime.

No comments: