KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > tbutils > res > SimpleInitialProvider


1 package com.tonbeller.tbutils.res;
2
3 import java.util.MissingResourceException JavaDoc;
4 import java.util.ResourceBundle JavaDoc;
5
6 /**
7  * initial provider. looks up variables
8  * <ol>
9  * <li>System.getProperty()</li>
10  * <li>user.properties in root classpath</li>
11  * <li>resfactory.properties in root classpath</li>
12  * </ol>
13  * in that order.
14  *
15  * @author av
16  */

17 public class SimpleInitialProvider extends CompositeResourceProvider implements InitialProvider {
18   public SimpleInitialProvider() {
19     add(new SystemResourceProvider());
20
21     try {
22       ResourceBundle JavaDoc resb = ResourceBundle.getBundle(USER_PROPERTIES);
23       add(new BundleResourceProvider(USER_PROPERTIES, resb));
24     }
25     catch (MissingResourceException JavaDoc e) {
26       // ignore
27
}
28     
29     try {
30       ResourceBundle JavaDoc resb = ResourceBundle.getBundle(RESFACTORY_PROPERTIES);
31       add(new BundleResourceProvider(RESFACTORY_PROPERTIES, resb));
32     }
33     catch (MissingResourceException JavaDoc e) {
34       // ignore
35
}
36   }
37 }
Popular Tags