public class FeatureResourceLoader extends Object
| Constructor and Description |
|---|
FeatureResourceLoader(HttpFetcher fetcher,
TimeSource timeSource,
FeatureFileSystem fileSystem) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
fileHasChanged(FeatureFile file,
long lastModified) |
protected String |
getFileContent(FeatureFile file) |
protected String |
getOptPath(String orig) |
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 |
setSupportFileUpdates(int updateCheckFrequency) |
@Inject public FeatureResourceLoader(HttpFetcher fetcher, TimeSource timeSource, FeatureFileSystem fileSystem)
@Inject(optional=true) public void setSupportFileUpdates(int updateCheckFrequency)
public FeatureResource load(Uri uri, Map<String,String> attribs) throws GadgetException
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.uri - Uri of resource to be loaded.attribs - Attributes decorating the resource in the corresponding feature.xmlGadgetException - If any failure occurs during this process.protected FeatureResource loadFile(String path, Map<String,String> attribs) throws IOException
IOExceptionprotected String getFileContent(FeatureFile file)
protected FeatureResource loadResource(String path, Map<String,String> attribs) throws IOException
IOExceptionpublic String getResourceContent(String resource) throws IOException
IOExceptionprotected FeatureResource loadUri(Uri uri, Map<String,String> attribs) throws IOException
IOException - if failed to load uri (by derived classes)protected boolean fileHasChanged(FeatureFile file, long lastModified)
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.