nu.staldal.lsp.servlet
Interface LocaleBundleFactory


public interface LocaleBundleFactory

Interface for localization bundle factories.

The resureces for a locale is stored in an Map. The key in this map is either [pageName]$[key] for page specific resources, or just [key] for global resources. If a page specific resource is not found, a global resource with the same key will be used.


Method Summary
 void init(java.lang.ClassLoader classLoader, javax.servlet.ServletContext servletContext)
          Initialize this factory.
 java.util.Map<java.lang.String,java.lang.String> loadBundle(java.util.Locale locale)
          Load a localization bundle for a given locale.
 

Method Detail

init

void init(java.lang.ClassLoader classLoader,
          javax.servlet.ServletContext servletContext)
          throws java.lang.Exception
Initialize this factory.

Parameters:
classLoader - the ClassLoader to use
servletContext - the ServletContext
Throws:
java.lang.Exception - may throw any Exception

loadBundle

java.util.Map<java.lang.String,java.lang.String> loadBundle(java.util.Locale locale)
                                                            throws java.lang.Exception
Load a localization bundle for a given locale.

The localization bundles are cached, this method is only invoked once for each locale.

This method should not attempt to load a default locale if the specified locale is not found. The framework will invoke this method again with null as argument when nessecary.

Parameters:
locale - the Locale, or null for default
Returns:
the Map with localization data, or null if none found for the given locale
Throws:
java.lang.Exception - may throw any Exception