|
In NetKernel modules are functional building blocks and the unit of
deployment.
Modules can hold components: static resources, java classes,
accessors, aspects, transreptors, transports, fragmentors and caches.
Let's first examine the types of resources that a module may contain:
|
Universal Resource Accessors
A Universal Resource Accessors is an endpoint that accepts and processes requests for resources.
Accessor development is discussed in detail in the
Extension Guide
.
Accessors can be written in Java for ultimate control and flexibility, or
in one of the scripting languages.
Transports
A transport is an external-to-internal request translator.
An external request could be
for example an HTTP request,
a JMS message, an email, a SOAP message or even a GUI event.
A transport's role is to take an external
request, interpret it and issue a
kernel request for a resource.
A detailed
guide to developing
transports is available in the
Extensions Guide
.
Resources
We've intimated already that a module can contain pretty much any type of resource: Java classes, images,
static XML, PDF documents ... anything
you like. We'll show below how general resources are exported so that other modules or transports can access
them.
Transreptors
A transreptor changes the interface on a representation of a resource.
The best way to describe transreptors
is by example. Suppose a request is made to NetKernel
for an XML DOM version of a file-based xml resource.
NetKernel will issue the request to the File URA,
however the File URA is general
purpose and can only return a binary stream. NetKernel is aware that the request was made for a DOM version
and so it looks in the Module Manager
to see if a BinaryStream to DOM transreptor is registered. The NetKernel finds just such a transreptor, the
binary stream is parsed to DOM
and the result is returned to the requestor.
A detailed guide to developing
transreptors is available
here
.
Transreptors can be created for mapping from almost anything to anything. Typical examples are the DOM
parser and serializers in the ext_xml module.
It would be straightforward to provide a Java image to PNG binary transreptor. One important rule to stick
to though, is that transreptors do not
fundamentally process or transform a resource's content, they simply make the same abstract entity available
in another form. Therefore
generative transformations or processing should always occur in accessors.
Fragmentors
A fragmentor provides a transformation on a resource defined by a fragment identifier on a URI. A fragmentor
in many ways operates like a transforming accessor; the key differences are in the way that they are invoked
and
their flexibility. A fragmentor can operate on only a single resource and it should use the fragment
identifier as a
kind of operator to determine what transformation to apply.
Cachelets
Each module can host a single cachelet. A cachelet is a cache component that is responsible for providing
caching of any module resource. Cachelets
are resolved hierarchically and a single module can provide a cachelet for a whole set of modules.
Alternatively every module can provide it's own
module specific cachelet. In general a single cachelet for any given application is sufficient, this is
usually hosted in the module
which is providing a transport. A detailed discussion of the NetKernel dependency-based caching architecture
is provided
here
.
Java code libraries
An important location (not shown in the diagram) is the
/lib
directory of a module. Jar libraries placed in the /lib directory
will automatically be picked up by the Java ClassLoader for the module. A module is fully encapsulated and
has it's own classloader
therefore any Java libraries required by classes in the module must be provided here.