|
Helping ordinary people create extraordinary websites! |
A New Strategy of Language Pack Management for Wireless AppsBy Huang Chang & Tong Chun Jie2005-04-18
LPInvoker Bundle To show how well the embodiment works, we will develop a testing bundle to simulate how a fictitious application bundle can benefit from the globalization support provided by the LPProxy. This bundle first gets the instance of LPProxyService by looking up the service registry of the Service Management Framework run time. Next, it identifies the LP bundle by specifying the base name and locale. Finally, the bundle reads the multilingual data from the LP bundle by calling the getString(String key) method. Listing 3 shows the source code of the start method. Listing 3. The start method of LPInvoker Bundle public void start(BundleContext context) throws Exception {
Finally, we submit all these bundles to the Service Management Framework bundle server and elect to install the LPInvoker bundle. In the Service Management Framework run time console, we should see the output when the bundle starts and stops, as shown in Figure 4. We can try again by switching the locale to zh_CN in the start method, and the output changes accordingly, as shown in Figure 5.
Figure 4. The output from the console with locale en_US
Figure 5. The output from the console with locale zh_CN
Tutorial Pages: » Use the Service Management Framework to Develop Globalized Wireless Apps » Introduction » PC Versus Mobile Devices » OSGi Overview » OSGi-based LP Loading Strategy » Service Management Framework » Design Model for an Exemplary Implementation » Language Pack Bundle » LPProxy Bundle » LPInvoker Bundle » In Summary » Resources First published by IBM DeveloperWorks |
|