Nested ADF Application modules are key to component reuse when building and work like using Java JAR libraries with a slight difference. You can take your ADF Business Component and create an “adflib” out of it which is a glorified JAR archive with a bunch of other XML files that hold important connection information. The database connection information in your bc4j.xml file is “carried” along with this adflib so that when you “nest” it in another ADF BC module or a UI module the client need not reconfigure your connection information.
For example, if you have an application module that provides a “countries” service, and you wish you use this service is any new application you build in the future – you will want to use the jdbc/countriesDS datasource to use the appropriate dbuser and the correct host/port, as opposed to providing that information again in each new application that uses the countries model or using the connection information for the nesting application (i.e you don’t want “myclientappuserid” to connect to the countries db, you only want to use the “mycountriesserviceuser” – some cases it is better to use the connection info in the nesting app to get usage stats – more on that in a later post) .
So, before we start – have an Application Module ready, I usually do the following:
start db console -> create a sample schema -> point ADF BC to the schema create Business Components and new Application Module -> fine tune the entities for updating the history columns in the DB and have a clean service module ready ->create a deployment profile -> deploy to local workspace …
So you should end up with a jar that has an ADF Application Module. Play around with the data-source config in the service module and your standalone weblogic server (see my earlier post) to use a “datasource” instead of a local IDE connection. This makes your application module ready to be pulled in to a client application and deployable with the client EAR (if you DONT DO THIS you will see massive stack traces about “unable to connect to db” on your weblogic server log when you hit the service – from the UI, a webservice endpoint etc)
Okay, to nest the application module here are the steps – you need to create a “filesystem connection” in your “Resource Palette” (as opposed to DB connection, BAM connection etc) and use that connection in a “Catalog” …then in your catalog you will see the ADF library which you can right click on as say “Add to Project” – which will add a new ADF lib dependency XML element to your Project JPR (Note: Play with adding a standalone JAR to your project, open your <project>.jpr and see what the difference is here).
Here are the steps illustrated through screenshots: