public abstract class AbstractCompiledResourceHandler extends AbstractResourceHandler implements Component
Modifier and Type | Field and Description |
---|---|
private static Map<String,List<String>> |
_dependenciesCache |
private static Map<String,Long> |
_dependenciesCacheValidity |
_cocoonContext, _context, _resolver, _supportedSuffixes
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AbstractCompiledResourceHandler() |
Modifier and Type | Method and Description |
---|---|
private Long |
_getCalculatedLastModified(Source inputSource,
String sourceUri,
long lastModified,
HashMap<String,String> knowDependencies) |
private List<String> |
_getDependencies(Source inputSource,
String sourceUri,
long lastModified) |
private String |
_getDependenciesKeys(Source inputSource,
String sourceUri,
String fileURI,
long lastModified,
HashMap<String,String> knowDependencies) |
private String |
_getDependencyURI(String sourceUri,
String dependency) |
abstract String |
compileResource(Source resource)
Compile the current resource, and returns its value.
|
void |
generateResource(Source source,
OutputStream out,
Parameters parameters)
Generate the resource configured during setup, and output it
|
protected abstract Source |
getCompiledSource(String location)
Get the compiled source uri
|
protected abstract List<String> |
getDependenciesList(Source inputSource)
Calculate the list of dependencies for the given source, for validity calculations.
|
Serializable |
getKey(Source source,
Parameters parameters)
Get the unique key for this resource, for cache purpose.
|
SourceValidity |
getValidity(Source source,
Parameters parameters)
Get the resource validity, for cache purpose.
|
boolean |
isSupported(String source)
Determines if the resource is supported by this handler
|
Source |
setup(String location,
Parameters par)
Initialize the resource handler with a resource.
|
configure, contextualize, getLastModified, getMimeType, getPriority, getSize, service
getLogger, setLogger
private static Map<String,Long> _dependenciesCacheValidity
private static Map<String,List<String>> _dependenciesCache
public AbstractCompiledResourceHandler()
public abstract String compileResource(Source resource) throws IOException, ProcessingException
resource
- The current resourceIOException
- If an IO error occursProcessingException
- If a processing error occursprotected abstract List<String> getDependenciesList(Source inputSource)
inputSource
- The sourceprotected abstract Source getCompiledSource(String location) throws MalformedURLException, IOException
location
- The requested locationMalformedURLException
- if location is malformed.IOException
- If an IO error occurspublic boolean isSupported(String source)
ResourceHandler
isSupported
in interface ResourceHandler
isSupported
in class AbstractResourceHandler
source
- The uri of resourcetrue
if the resource is supportedpublic Source setup(String location, Parameters par) throws IOException, ProcessingException
ResourceHandler
setup
in interface ResourceHandler
setup
in class AbstractResourceHandler
location
- The source uripar
- The parametersIOException
- If an error occursProcessingException
- If an error occurspublic void generateResource(Source source, OutputStream out, Parameters parameters) throws IOException, ProcessingException
ResourceHandler
generateResource
in interface ResourceHandler
source
- The sourceout
- The output stream to write toparameters
- The parametersIOException
- If an error occursProcessingException
- If an error occurspublic Serializable getKey(Source source, Parameters parameters)
ResourceHandler
getKey
in interface ResourceHandler
getKey
in class AbstractResourceHandler
source
- The sourceparameters
- The parameterspublic SourceValidity getValidity(Source source, Parameters parameters)
ResourceHandler
getValidity
in interface ResourceHandler
getValidity
in class AbstractResourceHandler
source
- The sourceparameters
- The parametersprivate Long _getCalculatedLastModified(Source inputSource, String sourceUri, long lastModified, HashMap<String,String> knowDependencies)
private String _getDependenciesKeys(Source inputSource, String sourceUri, String fileURI, long lastModified, HashMap<String,String> knowDependencies)
private String _getDependencyURI(String sourceUri, String dependency) throws URISyntaxException
URISyntaxException
private List<String> _getDependencies(Source inputSource, String sourceUri, long lastModified)