1 /*
2 * $Id: ResourceBundleResourcesFactory.java 349025 2005-11-25 21:09:54Z niallp $
3 * $Revision: 349025 $
4 * $Date: 2005-11-25 21:09:54 +0000 (Fri, 25 Nov 2005) $
5 *
6 * ====================================================================
7 *
8 * Copyright 2003-2005 The Apache Software Foundation
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 */
23
24 package org.apache.commons.resources.impl;
25
26 import org.apache.commons.resources.Resources;
27 import org.apache.commons.resources.ResourcesException;
28
29 /**
30 * <p>Concrete implementation of {@link org.apache.commons.resources.ResourcesFactory} that creates
31 * {@link org.apache.commons.resources.Resources} instances that wrap a set (one per Locale) of
32 * <code>java.util.ResourceBundle</code> instances that share a common
33 * base name. The configuration String that is passed to the
34 * <code>getResources()</code> method must contain the fully qualified
35 * Java name of the underlying <code>ResourceBundle</code> family
36 * that is to be wrapped.</p>
37 */
38 public class ResourceBundleResourcesFactory extends ResourcesFactoryBase {
39
40
41 // --------------------------------------------------------- Public Methods
42
43
44 // ------------------------------------------------------ Protected Methods
45
46
47 /**
48 * <p>Create and return a new {@link org.apache.commons.resources.Resources} instance with the
49 * specified logical name, after calling its <code>init()</code>
50 * method and delegating the relevant properties.</p>
51 *
52 * @param name Logical name of the {@link org.apache.commons.resources.Resources} instance to create
53 * @param config Configuration string for this resource (if any)
54 * @return The new Resources instance.
55 *
56 * @exception ResourcesException if a {@link org.apache.commons.resources.Resources} instance
57 * of the specified logical name cannot be created.
58 */
59 protected Resources createResources(String name, String config) {
60
61 Resources res = new ResourceBundleResources(name, config);
62 res.setReturnNull(isReturnNull());
63 res.init();
64 return (res);
65
66 }
67
68
69 }