Tuesday, April 5, 2011

Jdeveloper– ADF Project as dependent Library

As the project size goes big ,it is best idea to create multiple sub project based on module.

Here is a step by step example to make your life simple.

Create Main Application

1. Create AppMain App with two view object EmployeeVO , DepartmentVO view object.

2. Create taskflow –> Crete view and drop EmployeeVO as table on page

Create Child App and Deploy as Jar

1. Create AppChildOne App with one view object JobVO view object.

2.Create task flow –> view and drop JobVO as table on page.

3.Create library of AppChildOne to be used in AppMain project.

4. Right click view controller of AppChildOne and click new

image

5.Select ADF Library Jar file and click ok.

6. It will open Edit Library which will show the path where Jar will be stored.

image

7. After doing this , right click the viewcontroller and click project properties and click deployment where it will show you the jar that you recently created and you can use this to edit the lib properties in future.

image

Compressing Jar

8.When you click edit ,  there is one option to compress the jar file that you can use to make your final project size small.

I have used default compression option and it has compress my small jar file from 21 KB to 9 KB that is enormous compression.

image

9.Now deploy this file as jar ,so that we can use this in AppMainProject. Right click viewcontroller and click deploy to adflibAppChildOne1.jar

 

image

Time to Use Dependent JAR

There are many ways to use this jar as library. However one of the best preferred way is as follow.

In Jdeveloper Click

View –> Resource Pallete

In Resource pallete click the above folder on left side of resource pallete and click new –> File System.

Give the path of deploy folder and click test connection.

image

Inside file system prjlib will be created.

Right click the project and click add to project.

image

Now right click viewcontroller of main project and click project properties.

Go to Library and Classpath. Locate  “ADF Library” and click edit.

image

Now you can see dependent project is added as library.

Next step is to go to component pallete.

image

We can see the library in component pallete.

image

We can use this task flow on our page that is coming from library.

Creating second dependent project

Now let us say we have new module requirement and we create new application appmodulechildtwo and create one task flow.

We will follow the same steps as in appchild one except we will point jar option to appchildone deploy folder.

Actually in real case scenario we have to create separate deploy folder at application level where all the jar file will be stored.

So we can create file system in resource pallet it will refer to same folder for all adf lib jar file.

image

Now go back to applicationmain and click add to project for appchildtwo.

image

This will bring the library in component pallete where we can drag and drop task flow from appchildtwo.

image

Finally,I would like to say that how easy it is to manage the structure of project based on library and manage it using jdeveloper ide.

My next blog it to create EAR based on this multiple project library that we can deploy it on server.

2 comments:

  1. This method of including other projects as "adf library jar file" has a drawback.

    Let's say you have a jspx page in the main project that has a region. Let's say the region displays a bounded taskflow consisting in a bunch of jsff files.
    If the taskflow and the jsff files are in one of the subprojects, the jsff never get recompiled when changed. Presumably cause they are deployed inside a jar file.

    You really have to re-run the whole up to see the changes. Needles to say, for large projects it can be very time consuming.

    Do you happen to know a workaround for this problem?

    ReplyDelete
  2. I prefer modular approach consisting of only taskflow. It all depend of development practice.
    Your scenario
    Jspx in main project that has region - Agree

    If taskflow and jsf are in one of subproject.
    Answer :- Make multiple taskflow and use contexual event to refresh or make a design like that so everything is in single taskflow.

    Plus you are facing development time issue ,it is not production time issue.Second this issue of refresh is fixed in 11.2 ,if i am not wrong it will refresh the main application page which is dependent on lib without restarting weblogic server.

    ReplyDelete