001: /**
002: * Copyright (c) 2003-2007, David A. Czarnecki
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions are met:
007: *
008: * Redistributions of source code must retain the above copyright notice, this list of conditions and the
009: * following disclaimer.
010: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
011: * following disclaimer in the documentation and/or other materials provided with the distribution.
012: * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
013: * endorse or promote products derived from this software without specific prior written permission.
014: * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
015: * without prior written permission of David A. Czarnecki.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
018: * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
019: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
021: * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
022: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
025: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
026: * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
027: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
028: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
029: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030: */package org.blojsom.util.resources;
031:
032: import java.util.Locale;
033:
034: /**
035: * ResourceManager
036: *
037: * @author David Czarnecki
038: * @version $Id: ResourceManager.java,v 1.2 2007/01/17 02:35:21 czarneckid Exp $
039: * @since blojsom 3.0
040: */
041: public interface ResourceManager {
042:
043: /**
044: * Initialize the ResourceManager.
045: */
046: public void init() throws org.blojsom.BlojsomException;
047:
048: /**
049: * Retrieve a string from a given resource bundle for the default locale.
050: *
051: * @param resourceID Resource ID to retrieve from the resource bundle
052: * @param resource Full-qualified resource bundle from which to retrieve the resource ID
053: * @param fallback Fallback string to use if the given resource ID cannot be found
054: * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
055: */
056: public String getString(String resourceID, String resource,
057: String fallback);
058:
059: /**
060: * Retrieve a string from a given resource bundle for the particular language and country locale.
061: *
062: * @param resourceID Resource ID to retrieve from the resource bundle
063: * @param resource Full-qualified resource bundle from which to retrieve the resource ID
064: * @param fallback Fallback string to use if the given resource ID cannot be found
065: * @param language Language code
066: * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
067: */
068: public String getString(String resourceID, String resource,
069: String fallback, String language);
070:
071: /**
072: * Retrieve a string from a given resource bundle for the particular language and country locale.
073: *
074: * @param resourceID Resource ID to retrieve from the resource bundle
075: * @param resource Full-qualified resource bundle from which to retrieve the resource ID
076: * @param fallback Fallback string to use if the given resource ID cannot be found
077: * @param language Language code
078: * @param country Country code
079: * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
080: */
081: public String getString(String resourceID, String resource,
082: String fallback, String language, String country);
083:
084: /**
085: * Retrieve a string from a given resource bundle for the particular language and country locale.
086: *
087: * @param resourceID Resource ID to retrieve from the resource bundle
088: * @param resource Full-qualified resource bundle from which to retrieve the resource ID
089: * @param fallback Fallback string to use if the given resource ID cannot be found
090: * @param locale Locale object to use when retrieving the resource bundle
091: * @return <code>resourceID</code> from resource bundle <code>resource</code> or <code>fallback</code> if the given resource ID cannot be found
092: */
093: public String getString(String resourceID, String resource,
094: String fallback, Locale locale);
095:
096: /**
097: * Wrapper for {@link java.text.MessageFormat#format(String, Object[])}
098: *
099: * @param pattern Pattern
100: * @param arguments Arguments to apply to pattern
101: * @return String where {@link java.text.MessageFormat#format(String, Object[])} has been applied or <code>null</code>
102: * if there is an error applying the arguments to the pattern
103: */
104: public String format(String pattern, Object[] arguments);
105: }
|