1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.resources;
17
18 import java.util.Locale;
19 import java.util.MissingResourceException;
20
21 /**
22 * <p>
23 * Definition of an interface for objects that are able to load resource groups.
24 * </p>
25 * <p>
26 * A <code>ResourceLoader</code> is responsible for retrieving
27 * <code>ResourceGroup</code> objects from a specific source. There will be
28 * different implementations for different resource sources like resource
29 * bundles, database tables, etc.
30 * </p>
31 * <p>
32 * This interface defines only a single method that must somehow retrieve a
33 * resource group for a given <code>Locale</code> specified by a name. If this
34 * fails, an exception will be thrown.
35 * </p>
36 *
37 * @see ResourceGroup
38 *
39 * @author Oliver Heger
40 * @version $Id: ResourceLoader.java 205 2012-01-29 18:29:57Z oheger $
41 */
42 public interface ResourceLoader
43 {
44 /**
45 * Performs all necessary steps to retrieve the specified resource group.
46 * This method will be called by a <code>ResourceManager</code> whenever
47 * resource entries or groups are accessed.
48 *
49 * @param locale the <code>Locale</code>
50 * @param name the name of the searched resource group
51 * @return the resource group
52 * @throws MissingResourceException if this group cannot be retrieved
53 */
54 ResourceGroup loadGroup(Locale locale, Object name)
55 throws MissingResourceException;
56 }