org.apache.shindig.gadgets
Class DefaultMessageBundleFactory

java.lang.Object
  extended by org.apache.shindig.gadgets.AbstractSpecFactory<MessageBundle>
      extended by org.apache.shindig.gadgets.DefaultMessageBundleFactory
All Implemented Interfaces:
MessageBundleFactory

public class DefaultMessageBundleFactory
extends AbstractSpecFactory<MessageBundle>
implements MessageBundleFactory

Default implementation of a message bundle factory.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.shindig.gadgets.AbstractSpecFactory
AbstractSpecFactory.Query, AbstractSpecFactory.SpecRetrievalFailedException
 
Field Summary
static String CACHE_NAME
           
 
Constructor Summary
DefaultMessageBundleFactory(ExecutorService executor, RequestPipeline pipeline, CacheProvider cacheProvider, long refresh)
           
 
Method Summary
 MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container)
          Retrieves a messagMessageBundle for the provided GadgetSpec and Locale.
protected  MessageBundle parse(String content, AbstractSpecFactory.Query query)
          Parse and return a new spec object from the network.
 
Methods inherited from class org.apache.shindig.gadgets.AbstractSpecFactory
fetchFromNetwork, getSpec
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_NAME

public static final String CACHE_NAME
See Also:
Constant Field Values
Constructor Detail

DefaultMessageBundleFactory

@Inject
public DefaultMessageBundleFactory(ExecutorService executor,
                                          RequestPipeline pipeline,
                                          CacheProvider cacheProvider,
                                          long refresh)
Method Detail

parse

protected MessageBundle parse(String content,
                              AbstractSpecFactory.Query query)
                       throws GadgetException
Description copied from class: AbstractSpecFactory
Parse and return a new spec object from the network.

Specified by:
parse in class AbstractSpecFactory<MessageBundle>
Parameters:
content - the content located at specUri
query - same as was passed AbstractSpecFactory.getSpec(Query)
Throws:
GadgetException

getBundle

public MessageBundle getBundle(GadgetSpec spec,
                               Locale locale,
                               boolean ignoreCache,
                               String container)
                        throws GadgetException
Description copied from interface: MessageBundleFactory
Retrieves a messagMessageBundle for the provided GadgetSpec and Locale. Implementations must be sure to perform proper merging of message bundles of lower specifity with exact matches (exact > lang only > country only > all / all)

Specified by:
getBundle in interface MessageBundleFactory
Parameters:
spec - The gadget to inspect for Locales.
locale - The language and country to get a message bundle for.
ignoreCache - True to bypass any caching of message bundles for debugging purposes.
container - The container that is requesting this message bundle
Returns:
The newly created MesageBundle.
Throws:
GadgetException - if retrieval fails for any reason.


Copyright © 2007-2012. All Rights Reserved.