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:53 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 20, 2004

A few different customers have raised questions over the last few months about how they might approach managing all of their translatable text from a single XML file, instead of as a number of component-specific Java message bundle files. I prepared a small example in GenMessageBundles.zip that you can download to check out one possible approach.

This approach is not to change the way that resources are handled at runtime, but instead to simply give you some ideas for how you might automate the generation of BC4J-component-specific message bundles for multiple languages based on storing all of the messages in a single XML file like the included AllMessages.xml file. In this case, I just invented a few XML elements like <Mod> for a module and <Ent> for an entity and <Att> for an attribute and <Msg> for a translatable message. If there is some industry standand XML format for translatable messages, you could adopt the example to use that format instead.

The GenMessageBundles.xsl file makes use of the multiple-output-file feature of XSLT which is something that most XSLT processors support but which unfortunately did not make it into the standard set of XSLT 1.0 features. In other words, each vendor whose XSLT engine supports it does it a slightly different way until XSLT 2.0 comes out. This XSLT stylesheet is written using the <ora:output> tag which the Oracle XSLT engine supports. Since the Oracle XSLT engine is a core part of the Oracle XML Developers kit which ships with every release of JDeveloper, you already have the "bits" you need to make this example work if you have JDeveloper 9.0.3.X.

Finally, the build.xml script is a simple Ant script that contains two build targets rebuild-default-messages and rebuild-italian-messages. To see the sample in action, you'll need to:

  1. Create a working directory and unzip the three files in the GenMessageBundles.zip into it
  2. Edit the build.xml file so that the value of the jdev_home variable points to the root directory of your JDeveloper 9.0.3 installation
  3. Change directory into this new directory, and do an Ant build.

If you are using a version of "ant" that is in your system path, then you can just type ant and it will build the default target. To build the italian language resource bundles, you would type "ant rebuild-italian-messages".

If you are using the ant that comes with JDeveloper, you can substitute "java -jar <jdevhome>/jdev/lib/ant.jar" where you see ant in the two commands above.

After running the build, you'll see that down in the appropriate ".common" subdirectory of the package directory for the two example entity objects whose messages appear in AllMessages.xml, you will find the appropriate generated *ImplMessageBundle.java and *ImplMessageBundle_it.java files.

The last piece of the puzzle is the reference that your BC4J components have to their default message bundle file. You'll see that each XML component definition that supports a related message bundle (entity objects and view objects principally) there will be an XML attribute named MsgBundleClass. The default value for this attribute will be the default BC4J message bundle class name oracle.jbo.common.JboResourceBundle. However, once the BC4J design time has stored as least one string in the custom component message bundle, then it will change the value of this attribute in the respective component's XML file to reflect the name of the default custom message bundle class like "com.company.app.model.common.YourEntityImplMsgBundle".


4:30:52 PM    



Jeff Bernknopf has started a blog that will talk about Oracle's HTMLDB and XMLDB technologies.  Jeff is heavily involved in the New York Oracle User's Group, so his point of view as an Oracle professional and user will be a great addition to the Oracle-related blogging community. Welcome, and subscribed!

I was out in New York in late September to present on JDev and ADF to the NYOUG. A had a chance to walk around Manhattan the weekend before my talk and I snapped this picture of a Farmer's Market stand that specialized in all different kinds of spicy peppers.


12:04:43 PM    


Back in October I wrote about a customer application I studied that was suffering from heavy network traffic between the thin-client Swing/JClient user interface layer and the middle-tier BC4J components (deployed as EJB Session Beans).  I've just published a version of the whitepaper that I wrote for this customer to explain the issues we found and the best practices to follow for the future. Of course, I've removed the actual customer's name. The information in there should be useful to anyone who is working with JClient/BC4J in 2-Tier deployment mode and who is thinking about deploying in three-tier mode. My advice, if you plan to deploy 3-Tier, it's best to try deploying in 3-Tier early in your project so that you appreciate the thin-client-side and middle-tier-server-side distinction from experience.

Read the paper here.  Make sure to scroll down and click on the "Printer View" in the left-side menu/margin if you plan to print it out.


11:34:40 AM    


When working in the JDeveloper visual designer for Swing panels and frames, often you are trying to add a new Swing component to a panel that in turn already contains another child panel. Since oftentimes the inner-most panel can be take up most or all of the visual area of its containing parent, the user may press the [ALT] key during the click operation to ignore the child panel immediately under the cursor, and perform the drop into its containing parent panel instead.


12:32:36 AM    


© Copyright 2008 Steve Muench.