@Service(value=ResourceBundleProvider.class) public class JcrResourceBundleProvider extends Object implements ResourceBundleProvider
JcrResourceBundleProvider implements the
ResourceBundleProvider interface creating
ResourceBundle instances from resources stored in the
repository.BUNDLE_REQ_ATTR| Constructor and Description |
|---|
JcrResourceBundleProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(org.osgi.service.component.ComponentContext context)
Activates and configures this component with the repository access
details and the default locale to use
|
protected void |
bindResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
Binds a new
ResourceResolverFactory. |
protected void |
deactivate() |
Locale |
getDefaultLocale()
Returns the configured default
Locale which is used as a
fallback for getResourceBundle(Locale) and also as the basis for
any messages requested from resource bundles. |
ResourceBundle |
getResourceBundle(Locale locale)
Returns the
ResourceBundle for the given
locale. |
ResourceBundle |
getResourceBundle(String baseName,
Locale locale)
Returns a
ResourceBundle for the given locale. |
protected void |
unbindResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
Unbinds the
ResourceResolverFactory. |
public Locale getDefaultLocale()
Locale which is used as a
fallback for getResourceBundle(Locale) and also as the basis for
any messages requested from resource bundles.getDefaultLocale in interface ResourceBundleProviderpublic ResourceBundle getResourceBundle(Locale locale)
ResourceBundle for the given
locale.getResourceBundle in interface ResourceBundleProviderlocale - The Locale for which to return the resource
bundle. If this is null the configured
default locale is assumed.ResourceBundle for the given locale.MissingResourceException - If the ResourceResolver
is not available to access the resources.public ResourceBundle getResourceBundle(String baseName, Locale locale)
ResourceBundleProviderResourceBundle for the given locale.getResourceBundle in interface ResourceBundleProviderbaseName - The base name for the resource bundle. If this is
null, the same resource bundle will be
returned as when calling the
ResourceBundleProvider.getResourceBundle(Locale) method.locale - The Locale for which to return the resource
bundle. If this is null the default locale as
returned by ResourceBundleProvider.getDefaultLocale() is assumed.ResourceBundle for the given localeprotected void activate(org.osgi.service.component.ComponentContext context)
protected void deactivate()
protected void bindResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
ResourceResolverFactory. If we are already
bound to another factory, we release that latter one first.protected void unbindResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
ResourceResolverFactory. If we are bound to
this factory, we release it.Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.