KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > blojsom > util > resources > ResourceManager


1 /**
2  * Copyright (c) 2003-2006, David A. Czarnecki
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the
9  * following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
11  * following disclaimer in the documentation and/or other materials provided with the distribution.
12  * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific prior written permission.
14  * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
15  * without prior written permission of David A. Czarnecki.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
18  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21  * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */

31 package org.blojsom.util.resources;
32
33 import java.util.Locale JavaDoc;
34
35 /**
36  * ResourceManager
37  *
38  * @author David Czarnecki
39  * @version $Id: ResourceManager.java,v 1.1 2006/03/20 21:31:18 czarneckid Exp $
40  * @since blojsom 3.0
41  */

42 public interface ResourceManager {
43
44     /**
45      * Initialize the ResourceManager.
46      */

47     public void init() throws org.blojsom.BlojsomException;
48
49     /**
50      * Retrieve a string from a given resource bundle for the default locale.
51      *
52      * @param resourceID Resource ID to retrieve from the resource bundle
53      * @param resource Full-qualified resource bundle from which to retrieve the resource ID
54      * @param fallback Fallback string to use if the given resource ID cannot be found
55      * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
56      */

57     public String JavaDoc getString(String JavaDoc resourceID, String JavaDoc resource, String JavaDoc fallback);
58
59     /**
60      * Retrieve a string from a given resource bundle for the particular language and country locale.
61      *
62      * @param resourceID Resource ID to retrieve from the resource bundle
63      * @param resource Full-qualified resource bundle from which to retrieve the resource ID
64      * @param fallback Fallback string to use if the given resource ID cannot be found
65      * @param language Language code
66      * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
67      */

68     public String JavaDoc getString(String JavaDoc resourceID, String JavaDoc resource, String JavaDoc fallback, String JavaDoc language);
69
70     /**
71      * Retrieve a string from a given resource bundle for the particular language and country locale.
72      *
73      * @param resourceID Resource ID to retrieve from the resource bundle
74      * @param resource Full-qualified resource bundle from which to retrieve the resource ID
75      * @param fallback Fallback string to use if the given resource ID cannot be found
76      * @param language Language code
77      * @param country Country code
78      * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
79      */

80     public String JavaDoc getString(String JavaDoc resourceID, String JavaDoc resource, String JavaDoc fallback, String JavaDoc language, String JavaDoc country);
81
82     /**
83      * Retrieve a string from a given resource bundle for the particular language and country locale.
84      *
85      * @param resourceID Resource ID to retrieve from the resource bundle
86      * @param resource Full-qualified resource bundle from which to retrieve the resource ID
87      * @param fallback Fallback string to use if the given resource ID cannot be found
88      * @param locale Locale object to use when retrieving the resource bundle
89      * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
90      */

91     public String JavaDoc getString(String JavaDoc resourceID, String JavaDoc resource, String JavaDoc fallback, Locale JavaDoc locale);
92
93     /**
94      * Wrapper for {@link java.text.MessageFormat#format(String, Object[])}
95      *
96      * @param pattern Pattern
97      * @param arguments Arguments to apply to pattern
98      * @return String where {@link java.text.MessageFormat#format(String, Object[])} has been applied or <code>null</code>
99      * if there is an error applying the arguments to the pattern
100      */

101     public String JavaDoc format(String JavaDoc pattern, Object JavaDoc[] arguments);
102 }
Popular Tags