org.apache.shindig.gadgets.features
Class FeatureResourceLoader
java.lang.Object
org.apache.shindig.gadgets.features.FeatureResourceLoader
- Direct Known Subclasses:
- BrowserSpecificFeatureResource.Loader
public class FeatureResourceLoader
- extends Object
Class that loads FeatureResource objects used to populate JS feature code.
|
Method Summary |
protected boolean |
fileHasChanged(File file,
long lastModified)
|
protected String |
getFileContent(File file)
|
protected String |
getOptPath(String orig)
|
protected String |
getResourceContent(String resource)
|
FeatureResource |
load(Uri uri,
Map<String,String> attribs)
Primary, and only public, method of FeatureResourceLoader. |
protected FeatureResource |
loadFile(String path,
Map<String,String> attribs)
|
protected FeatureResource |
loadResource(String path,
Map<String,String> attribs)
|
protected FeatureResource |
loadUri(Uri uri,
Map<String,String> attribs)
|
void |
setHttpFetcher(HttpFetcher fetcher)
|
void |
setSupportFileUpdates(int updateCheckFrequency)
|
void |
setTimeSource(TimeSource timeSource)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FeatureResourceLoader
public FeatureResourceLoader()
setHttpFetcher
@Inject
public void setHttpFetcher(HttpFetcher fetcher)
setTimeSource
@Inject
public void setTimeSource(TimeSource timeSource)
setSupportFileUpdates
@Inject(optional=true)
public void setSupportFileUpdates(int updateCheckFrequency)
load
public FeatureResource load(Uri uri,
Map<String,String> attribs)
throws GadgetException
- Primary, and only public, method of FeatureResourceLoader. Loads the resource
keyed at the given
uri, which was decorated with the provided list of attributes.
The default implementation loads both file and res-schema resources using
ResourceLoader, attempting to load optimized content for files named [file].js as [file].opt.js.
Override this method to provide custom functionality. Basic loadFile, loadResource, and loadUri
methods are kept protected for easy reuse.
- Parameters:
uri - Uri of resource to be loaded.attribs - Attributes decorating the resource in the corresponding feature.xml
- Returns:
- FeatureResource object providing content and debugContent loading capability.
- Throws:
GadgetException - If any failure occurs during this process.
loadFile
protected FeatureResource loadFile(String path,
Map<String,String> attribs)
throws IOException
- Throws:
IOException
getFileContent
protected String getFileContent(File file)
loadResource
protected FeatureResource loadResource(String path,
Map<String,String> attribs)
throws IOException
- Throws:
IOException
getResourceContent
protected String getResourceContent(String resource)
loadUri
protected FeatureResource loadUri(Uri uri,
Map<String,String> attribs)
getOptPath
protected String getOptPath(String orig)
fileHasChanged
protected boolean fileHasChanged(File file,
long lastModified)
Copyright © 2007-2012. All Rights Reserved.