Contents:
Deployment
Paths and access
Filters
The WHIFF resource abstraction provides a flexible naming scheme
for applications to read and write external resources. The WHIFF resource
infrastructure allows resources to be
Flexible
Any number of resources may be attached to an application.
Configured at deployment
Different installations can configure resources using filters
that implement accesses to the same resource name in different ways.
Protected
WHIFF configuration templates must access resources via the
resource configuration provided for the application. This prevents
configuration templates from accessing or modifying data not accessible through
the interface.
Managed
Resource filters can be implemented to support caching and reuse.
Deployment
Resources are attached to an application root directory when the
directory is configured. A resource attached to a directory
has a
prefix which is used in applications to name the resource
and a
filter which is used by the infrastructure to locate
resources with that prefix (or refuse to locate them). For example
the following assignment constructs a root application
testapp = resolver.moduleRootApplication("/", root)
The following assignment creates a resource that allows access to a data
file mediated by a password
filefinder = gateway.FileFinder("secretpassword", "/tmp/testfile.txt")
And this method call attaches the finder for the data file to
the root application
testapp.registerResourceFinder(prefix="datafile", finder=filefinder)
Paths and access
Applications get access to resources by naming the resource with a
path list. For example the following configuration directive evaluates
to the contents of the
datafile resource configured above
{{include "whiff_middleware/getResource"}}
["datafile", "secretpassword"]
{{/include}}
Applications may attempt to
get or
put a resource
(and the attempt may be refused). The following directive
puts
the
datafile resource deployed above
{{include "whiff_middleware/putResource"}}
{{using path}} ["datafile", "secretpassword"] {{/using}}
{{using value}} NEW CONTENT FOR THE FILE {{/using}}
{{/include}}
Resources may be implemented as any sort of object.
Filters
Resource filters are responsible for assigning resources upon request or
for refusing to assign resources when access is not permitted. For a given
path a filter may assign a new resource or a shared resource based on the
context and environment of the application requesting the resource and the
semantics of the resources.