Re: Clarification on the indexer

Here is what the ResourceIndexer currently looks like (only in my
head, nothing implemented yet), speak up if this would be a problem to
you. 

-----
package w3c.jigsaw.indexer;

public abstract class ResourceIndexer {
    ResourceIndexer forward = null;

    abstract public Resource localCreateResource(File file
                                                 , String name
                                                 , Hashtable defs
                                                 , Object arg) ;

    public Resource createResource(File file
                                   , String name
                                   , Hashtable defs
                                   , Object arg) {
        Resource resource = localCreateResource(file, name, defs, arg);
        if ((resource == null) && (forward != null))
            return forward.createResource(file, name, defs, arg);
        return null;
    }

    public void initialize(httpd server, ResourceIndexer forward) {
        this.forward = forward;
        initialize(server);
    }

    public void initialize(httpd server);
}
-----

Note I am still unsure wether this should be an abstract class or an
interface. If it is an abstract class, then Jigsaw can provide the
basic mechanism for delegation among resource indexers. Otherwise this
would simply be an interface made of only the createResource and
initialize method. I am rather in favor of the bastract class, so that
Jigsaw comes with a consistent way of delegating resource creation
(otherwise everyone is going to implement its own way of dealing with
that, we mat end up in a mess).

To initialize the indexer there would be a new property
"w3c.jigsaw.indexers" that could take a list of resource inddexer that
would be chained together at creation time, eg:

if
w3c.jigsaw.indexer=myFancyIndexer|w3c.jigsaw.indexer.SampleResourceIndexer

would first create an instance of SampleresourceIndexer and call its

initialize(server);

method, and then create an instance of myFancyIndexer initialized
through  

initialize(server, sample_resource_indexer);

Hum, this seems quite nifty to me.

Anselm.

Received on Thursday, 5 September 1996 13:06:25 UTC