public abstract class AbstractResourceHandler extends AbstractLogEnabled implements ResourceHandler, Serviceable, Configurable, Contextualizable
Modifier and Type | Field and Description |
---|---|
protected Context |
_cocoonContext
The cocoon context
|
protected Context |
_context
The context
|
protected SourceResolver |
_resolver
The source resolver
|
protected Set<String> |
_supportedSuffixes
The supported suffixes
|
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
AbstractResourceHandler() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration configuration) |
void |
contextualize(Context context) |
Serializable |
getKey(Source source,
Map objectModel,
Parameters parameters,
Map<String,Object> additionalParameters)
Get the unique key for this resource, for cache purpose.
|
long |
getLastModified(Source source,
Parameters parameters)
Get the resource last modified time
|
String |
getMimeType(Source source,
Parameters parameters)
Return the mime type of the configured resource.
|
int |
getPriority()
Get the priority of this handler
|
long |
getSize(Source source,
Parameters parameters)
Get the resource size, if available.
|
SourceValidity |
getValidity(Source source,
Map objectModel,
Parameters parameters,
Map<String,Object> additionalParameters)
Get the resource validity, for cache purpose.
|
boolean |
isSupported(String source)
Determines if the resource is supported by this handler
|
void |
service(ServiceManager manager) |
Source |
setup(String location,
Map objectModel,
Parameters par,
Map<String,Object> additionalParameters)
Initialize the resource handler with a resource.
|
getLogger, setLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateResource
protected Set<String> _supportedSuffixes
protected SourceResolver _resolver
protected Context _cocoonContext
public AbstractResourceHandler()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
public Source setup(String location, Map objectModel, Parameters par, Map<String,Object> additionalParameters) throws IOException, ProcessingException
ResourceHandler
setup
in interface ResourceHandler
location
- The source uriobjectModel
- The object modelpar
- The parametersadditionalParameters
- Additional parameters that can be filled, and will be transmitted to getKey, getValidity and generateResourceIOException
- If an error occursProcessingException
- If an error occurspublic boolean isSupported(String source)
ResourceHandler
isSupported
in interface ResourceHandler
source
- The uri of resourcetrue
if the resource is supportedpublic int getPriority()
ResourceHandler
getPriority
in interface ResourceHandler
public String getMimeType(Source source, Parameters parameters)
ResourceHandler
getMimeType
in interface ResourceHandler
source
- The sourceparameters
- The parameterspublic Serializable getKey(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
ResourceHandler
getKey
in interface ResourceHandler
source
- The sourceobjectModel
- The object modelparameters
- The parametersadditionalParameters
- Additional parameterspublic SourceValidity getValidity(Source source, Map objectModel, Parameters parameters, Map<String,Object> additionalParameters)
ResourceHandler
getValidity
in interface ResourceHandler
source
- The sourceobjectModel
- The object modelparameters
- The parametersadditionalParameters
- Additional parameterspublic long getSize(Source source, Parameters parameters)
ResourceHandler
getSize
in interface ResourceHandler
source
- The sourceparameters
- The parameterspublic long getLastModified(Source source, Parameters parameters)
ResourceHandler
getLastModified
in interface ResourceHandler
source
- The sourceparameters
- The parameters