Dive into Oracle ADF

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

Search blog with Google:
 

Search BC4J JavaDoc:
 

January 2004
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Dec   Feb

Get Firefox!

Tuesday, January 27, 2004

OTN published a new whitepaper today called Developing Swing-based Java Clients using Oracle JDeveloper 10g and Oracle ADF JClient.(PDF)
3:56:57 PM    



The BC4J framework provides a number of base classes that your application-specific business components extend as you implement your system. For example:

  • Entity Object (oracle.jbo.server.EntityImpl)
  • Entity Definition (oracle.jbo.server.EntityDefImpl)
  • View Object (oracle.jbo.server.ViewObjectImpl)
  • View Row (oracle.jbo.server.ViewRowImpl)
  • Application Module (oracle.jbo.server.ApplicationModuleImpl)
  • DBTransaction (oracle.jbo.server.DBTransactionImpl2)

One of the first things that I recommend to new BC4J developers is to create themselves a company-specific version of each of these classes which extends the base BC4J framework one. For example, you might create:

  • Custom Entity Object (com.yourcompany.bc4j.ExtendedEntityImpl)
  • Entity Definition (com.yourcompany.bc4j.ExtendedEntityDefImpl)
  • View Object (com.yourcompany.bc4j.ExtendedViewObjectImpl)
  • View Row (com.yourcompany.bc4j.ExtendedViewRowImpl)
  • Application Module (com.yourcompany.bc4j.ExtendedEntityImpl)
  • DBTransaction (com.yourcompany.bc4j.ExtendedDBTransactionImpl)

To begin with, these classes might be just trivial subclasses of the base BC4J framework classes like this:

package com.yourcompany.bc4j;
import oracle.jbo.server.EntityImpl;
public class ExtendedEntityImpl extends EntityImpl {
// Gives me a place to add entity object implementation
// customizations.


}

Once you have created company-specific customizations of all of the BC4J framework base classes, you can begin creating components in JDeveloper that extend your custom base classes instead of using the default BC4J framework base classes. You have two choices for how to configure this. You can do it once and for all at the JDeveloper IDE level under the Tools | Preferences... | Business Components | Base Classes category. Alternatively, in 9.0.3 and higher, you can configure your preferred framework base classes at the project level selecting the YourProject.jpx node in the navigator, and selecting the Edit YourProject... context menu.

Some software houses that use BC4J do a company-specific framework extension layer of classes, and then also perform a project-specific framework extension layer as well. Using the example above, that means that after creating a layer of extended framework classes in which they can customize the behavior of components for all BC4J-based applications that they build, they also create a project-specific layer of framework base classes in which component customizations can be placed which might only apply to all the BC4J components in that current project. The settings as the project level override those set at the IDE-level. When creating new projects, the IDE-wide base classes settings are copied as the default values for the project-level settings (which you then can customize if needed).

If you have already created BC4J components in your project without having first created a company-specific layer of framework extension classes (and setup the design time environment to use those as the defaults), all is not lost. You can perform this task after the fact as well. The IDE/project-level base classes settings affect only newly created components. You can visit the "Java" panel in the component editor for any BC4J component that supports Java customization, and click the (Extends...) button to setup the name of the custom framework class you'd prefer to use as the base class for your component. Make sure to do it this way and not only to hand-modify the extends clause in the source code. If you only do the hand-modification but don't tell the component editor that you want to change the base class, then the next time you leave the wizard the code-generation will override your hand-edited classname with the superclass name that is stored in the components metadata (that the component editor manages for you).

The BC4J Framework Customizations for the Business Services Layer section in the whitepaper for the BC4J Toy Store Demo includes a little more information on how to get the framework to use a custom DBTransactionImpl class. It requires setting the TransactionFactory configuration property to the fully-qualified name of a factory class that extends oracle.jbo.server.DBTransactionFactoryImpl and overrides the create() method to return an instance of your customized DBTransactionImpl2 class.


3:22:00 PM    


© Copyright 2008 Steve Muench.