|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.i18n.impl.JcrResourceBundleProvider
@Service(value=ResourceBundleProvider.class) public class JcrResourceBundleProvider
The JcrResourceBundleProvider implements the
ResourceBundleProvider interface creating
ResourceBundle instances from resources stored in the
repository.
| Constructor Summary | |
|---|---|
JcrResourceBundleProvider()
|
|
| Method Summary | |
|---|---|
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. |
java.util.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. |
java.util.ResourceBundle |
getResourceBundle(java.util.Locale locale)
Returns the ResourceBundle for the given
locale. |
java.util.ResourceBundle |
getResourceBundle(java.lang.String baseName,
java.util.Locale locale)
Returns a ResourceBundle for the given locale. |
void |
onEvent(javax.jcr.observation.EventIterator events)
Called whenever something is changed inside of jcr:language
or sling:Message nodes. |
protected void |
unbindResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory)
Unbinds the ResourceResolverFactory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JcrResourceBundleProvider()
| Method Detail |
|---|
public java.util.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 java.util.ResourceBundle getResourceBundle(java.util.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.
java.util.MissingResourceException - If the ResourceResolver
is not available to access the resources.
public java.util.ResourceBundle getResourceBundle(java.lang.String baseName,
java.util.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 localepublic void onEvent(javax.jcr.observation.EventIterator events)
jcr:language
or sling:Message nodes. We just removed all cached
resource bundles in this case to force reloading them.
This is much simpler than analyzing the events and trying to be clever about which exact resource bundles to remove from the cache and at the same time care for any resource bundle dependencies.
onEvent in interface javax.jcr.observation.EventListenerevents - The actual JCR events are ignored by this implementation.protected void activate(org.osgi.service.component.ComponentContext context)
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||