From 4b7cdda12e6df63fdd3c4f5e21955f3456457851 Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Tue, 29 Nov 2005 19:23:58 +0000 Subject: [PATCH] ICU-4907 modifications for eclipse/1.3/foundation compatibility X-SVN-Rev: 18838 --- .../icu/dev/eclipse/com.ibm.icu/.classpath | 1 + .../eclipse/com.ibm.icu/META-INF/MANIFEST.MF | 10 ++++-- .../dev/eclipse/com.ibm.icu/build.properties | 13 +++++++- .../dev/test/util/ICUResourceBundleTest.java | 12 +++---- icu4j/src/com/ibm/icu/manifest.stub | 4 +-- .../src/com/ibm/icu/util/UResourceBundle.java | 33 ++++++++++++++++++- 6 files changed, 60 insertions(+), 13 deletions(-) diff --git a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/.classpath b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/.classpath index b1d94ba6bd9..09cc676ec21 100644 --- a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/.classpath +++ b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/.classpath @@ -1,5 +1,6 @@ + diff --git a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/META-INF/MANIFEST.MF b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/META-INF/MANIFEST.MF index cd0e787146d..f568b7ebe3f 100644 --- a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/META-INF/MANIFEST.MF +++ b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/META-INF/MANIFEST.MF @@ -1,8 +1,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: International Components for Unicode for Java (ICU4J) -Bundle-SymbolicName: com.ibm.icu -Bundle-Version: 3.4.1 +Bundle-SymbolicName: com.ibm.icu; singleton:=true +Bundle-Version: 3.4.2 Bundle-Vendor: IBM Bundle-Localization: plugin Bundle-Copyright: Licensed Materials - Property of IBM @@ -15,5 +15,9 @@ Export-Package: com.ibm.icu.impl;x-friends:="com.ibm.icu.tests", com.ibm.icu.math, com.ibm.icu.text, com.ibm.icu.util -Bundle-ClassPath: icu4j.jar +Bundle-ClassPath: icu4j.jar, + bin/ Eclipse-LazyStart: true +Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0, + J2SE-1.3 +Require-Bundle: org.eclipse.icu diff --git a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/build.properties b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/build.properties index 53ca31421fb..040168f4685 100644 --- a/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/build.properties +++ b/icu4j/src/com/ibm/icu/dev/eclipse/com.ibm.icu/build.properties @@ -1,5 +1,16 @@ +source.. = src/ +output.. = bin/ bin.includes = .classpath,\ .project,\ build.properties,\ META-INF/,\ - com.ibm.icu_3.4.1.jar + icu4j.jar,\ + plugin.xml,\ + bin/ +src.includes = src/,\ + build.properties,\ + .classpath,\ + .project,\ + .settings/,\ + META-INF/ + diff --git a/icu4j/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java b/icu4j/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java index c164a6f487a..734a7f12e9e 100644 --- a/icu4j/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java @@ -1,4 +1,4 @@ -//##header 1132615047000 +//##header 1133291226000 /** ******************************************************************************* * Copyright (C) 2001-2005, International Business Machines Corporation and * @@ -993,7 +993,7 @@ public final class ICUResourceBundleTest extends TestFmwk { public void TestJavaULocaleBundleLoading(){ String baseName="com.ibm.icu.dev.data.resources.TestDataElements"; String locName = "en_Latn_US"; - UResourceBundle bundle = UResourceBundle.getBundleInstance(baseName, locName); + UResourceBundle bundle = UResourceBundle.getBundleInstance(baseName, locName, testLoader); String fromRoot = bundle.getString("from_root"); if(!fromRoot.equals("This data comes from root")){ errln("Did not get the expected string for from_root"); @@ -1010,7 +1010,7 @@ public final class ICUResourceBundleTest extends TestFmwk { if(!fromEnLatnUs.equals("This data comes from en_Latn_US")){ errln("Did not get the expected string for from_en_Latn_US"); } - UResourceBundle bundle1 = UResourceBundle.getBundleInstance(baseName, new ULocale(locName)); + UResourceBundle bundle1 = UResourceBundle.getBundleInstance(baseName, new ULocale(locName), testLoader); if(!bundle1.equals(bundle)){ errln("Did not get the expected bundle for "+baseName +"."+locName); } @@ -1018,7 +1018,7 @@ public final class ICUResourceBundleTest extends TestFmwk { errln("Did not load the bundle from cache"); } // non-existent bundle .. should return default - UResourceBundle defaultBundle = UResourceBundle.getBundleInstance(baseName, "hi_IN"); + UResourceBundle defaultBundle = UResourceBundle.getBundleInstance(baseName, "hi_IN", testLoader); ULocale defaultLocale = ULocale.getDefault(); if(!defaultBundle.getULocale().equals(defaultLocale)){ errln("Did not get the default bundle for non-existent bundle"); @@ -1026,7 +1026,7 @@ public final class ICUResourceBundleTest extends TestFmwk { // non-existent bundle, non-existent default locale // so return the root bundle. ULocale.setDefault(ULocale.CANADA_FRENCH); - UResourceBundle root = UResourceBundle.getBundleInstance(baseName, "hi_IN"); + UResourceBundle root = UResourceBundle.getBundleInstance(baseName, "hi_IN", testLoader); if(!root.getULocale().toString().equals("")){ errln("Did not get the root bundle for non-existent default bundle for non-existent bundle"); } @@ -1041,7 +1041,7 @@ public final class ICUResourceBundleTest extends TestFmwk { if(i!=4){ errln("Did not get the expected number of keys: got " + i + ", expected 4"); } - UResourceBundle bundle4 = UResourceBundle.getBundleInstance(baseName,"fr_Latn_FR"); + UResourceBundle bundle4 = UResourceBundle.getBundleInstance(baseName,"fr_Latn_FR", testLoader); if(bundle==null){ errln("Could not load bundle fr_Latn_FR"); } diff --git a/icu4j/src/com/ibm/icu/manifest.stub b/icu4j/src/com/ibm/icu/manifest.stub index fb2e6d3fd3b..5a0c4f2cf89 100644 --- a/icu4j/src/com/ibm/icu/manifest.stub +++ b/icu4j/src/com/ibm/icu/manifest.stub @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Name: com/ibm/icu/ Specification-Title: ICU for Java -Specification-Version: 3.5 +Specification-Version: 3.4.2 Specification-Vendor: ICU Implementation-Title: ICU for Java -Implementation-Version: 3.5 +Implementation-Version: 3.4.2 Implementation-Vendor: IBM Corporation Implementation-Vendor-Id: com.ibm Copyright-Info: Copyright (c) 2000-2005, International Business Machines Corporation and others. All Rights Reserved. diff --git a/icu4j/src/com/ibm/icu/util/UResourceBundle.java b/icu4j/src/com/ibm/icu/util/UResourceBundle.java index 6b34874a14d..e1b41410811 100644 --- a/icu4j/src/com/ibm/icu/util/UResourceBundle.java +++ b/icu4j/src/com/ibm/icu/util/UResourceBundle.java @@ -196,7 +196,38 @@ public abstract class UResourceBundle extends ResourceBundle{ return getBundleInstance(baseName, locale.toString(),ICUResourceBundle.ICU_DATA_CLASS_LOADER); } - + /** + * Creates a UResourceBundle for the specified locale and specified base name, + * from which users can extract resources by using their corresponding keys. + * @param baseName specifies the locale for which we want to open the resource. + * If null the bundle for default locale is opened. + * @param locale specifies the locale for which we want to open the resource. + * If null the bundle for default locale is opened. + * @param loader the loader to use + * @return a resource bundle for the given base name and locale + * @draft ICU 3.4.2 + * @deprecated This is a draft API and might change in a future release of ICU. + */ + public static UResourceBundle getBundleInstance(String baseName, Locale locale, ClassLoader loader){ + return getBundleInstance(baseName, ULocale.forLocale(locale), loader); + } + + /** + * Creates a UResourceBundle, from which users can extract resources by using + * their corresponding keys. + * @param baseName string containing the name of the data package. + * If null the default ICU package name is used. + * @param locale specifies the locale for which we want to open the resource. + * If null the bundle for default locale is opened. + * @param loader the loader to use + * @return a resource bundle for the given base name and locale + * @draft ICU 3.4.2 + * @deprecated This is a draft API and might change in a future release of ICU. + */ + public static UResourceBundle getBundleInstance(String baseName, ULocale locale, ClassLoader loader){ + return getBundleInstance(baseName, locale.toString(),loader); + } + /** * Returns the RFC 3066 conformant locale id of this resource bundle. * This method can be used after a call to getBundleInstance() to