Understanding ADF BC Configuration Property Scopes

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:26:11 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Understanding ADF BC Configuration Property Scopes

ADF Business Components configuration properties are documented in the online documentation's section entitled Oracle ADF Business Components System Properties, however missing from that table is the piece of information about the scope of the property. The scope of the property indicates at what level the properties value is evaluated and whether it's value is effective shared/static in a single Java VM, or not.

We'll update the documentation to include that in the future, but this information is easy to get today. Here's how:

Assuming JDEVHOME is your jdeveloper home, do the following:

$ java -cp JDEVHOME/BC4J/lib/bc4jmt.jar oracle.jbo.common.PropertyManager

This will dump to the console all of the system properties. It also lists a handy reference about the different precedence levels that you can set values of these configuration properties:

---------------------------------------------------------------
  Properties loaded from following sources, in order:
  1. Client environment [Provided programmatically or declaratively in bc4j.xcfg]
  2. Applet tags
  3. -D flags (appear in System.properties)
  4. bc4j.properties file (in current directory)
  5. /oracle/jbo/BC4J.properties resource
  6. /oracle/jbo/commom.jboserver.properties resource
  7. /oracle/jbo/common.Diagnostic.properties resource
  8. System defined default
---------------------------------------------------------------

You'll see each property is listed with one of the following scopes:

  • MetaObjectManager
  • SessionImpl
  • Configuration
  • Diagnostic

The properties that are at the "MetaObjectManager" scope are initialized once per Java VM when the ADF PropertyManager is first initialized.

Those marked with a scope of "SessionImpl" are initialized once per invocation of ApplicationModule.prepareSession().

Those marked with a scope of "Configuration" are initialized when the ApplicationModule pool is first created and the application module's configuration is read the first time.

Those marked with a scope of "Diagnostic" are specific to the built-in ADF Business Components diagnostic facility.

At each of these scopes, the layered value resolution described above is performed when the properties are initialized.

Whenever property values are initialized, if you have specified them in the Client Environment (level 1 in the resolution order) the values will take precedence over values specified as System parameters (level 3 in the resolution order). Keep in mind the the "Client Environment" is a hashtable of name/value pairs that you can either programatically populate, or will be automatically populated for you by the Configuration when loaded, with the name/value pairs it contains in its entry in the bc4j.xcfg file.

The implication of this is that for any properties scoped at MetaObjectManager level, the most reliable way to ensure that all of your application modules use the same default value for those properties is to:

  1. Make sure the property value does not appear in any of your application module's bc4j.xcfg file configuration name/value pair entries.
  2. Set the property value using a Java system property in your runtime environment

If instead you leave any MetaObjectManager-scoped properties in your bc4j.xcfg files, you will have the behavior that the value used by the MetaObjectManager-scoped properties will be the value specified in the configuration of the first application module whose pool gets created after the Java VM starts up.



© Copyright 2008 Steve Muench. Click here to send an email to the editor of this weblog.
Last update: 2/3/2008; 9:26:11 PM.