|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.gadgets.AbstractSpecFactory<T>
public abstract class AbstractSpecFactory<T>
Basis for implementing GadgetSpec and MessageBundle factories. Automatically updates objects as needed asynchronously to provide optimal throughput.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractSpecFactory.Query
Holds information used to fetch a spec. |
protected static class |
AbstractSpecFactory.SpecRetrievalFailedException
|
| Constructor Summary | |
|---|---|
AbstractSpecFactory(Class<T> clazz,
ExecutorService executor,
RequestPipeline pipeline,
Cache<Uri,Object> cache,
long refresh)
|
|
| Method Summary | |
|---|---|
protected T |
fetchFromNetwork(AbstractSpecFactory.Query query)
Retrieves a spec from the network, parses, and adds it to the cache. |
protected T |
getSpec(AbstractSpecFactory.Query query)
Attempt to fetch a spec, either from cache or from the network. |
protected abstract T |
parse(String content,
AbstractSpecFactory.Query query)
Parse and return a new spec object from the network. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractSpecFactory(Class<T> clazz,
ExecutorService executor,
RequestPipeline pipeline,
Cache<Uri,Object> cache,
long refresh)
clazz - the class for spec objects.executor - for asynchronously updating specspipeline - the request pipeline for fetching new specscache - a cache for parsed spec objectsrefresh - the frequency at which to update specs, independent of cache expiration policy| Method Detail |
|---|
protected T getSpec(AbstractSpecFactory.Query query)
throws GadgetException
query passed here will always be passed, unmodified, to
parse(String, Query). This can be used to carry additional context information
during parsing.
GadgetException
protected T fetchFromNetwork(AbstractSpecFactory.Query query)
throws AbstractSpecFactory.SpecRetrievalFailedException,
GadgetException
AbstractSpecFactory.SpecRetrievalFailedException
GadgetException
protected abstract T parse(String content,
AbstractSpecFactory.Query query)
throws XmlException,
GadgetException
content - the content located at specUriquery - same as was passed getSpec(Query)
XmlException
GadgetException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||