Re: Clarification on the indexer

Forgive me if I'm misunderstanding this -- the indexer is still one part of
Jigsaw that I haven't fully come to grips with.  However, in your suggested
revision for the ResourceIndexer, I think there are still dependencies on
physical filesystems.

For instance, the first parameter to localCreateResource() and
createResource() is a File object.  In the original version of
createResource, the first parameter is named directory.  It seems to me
that instead, we should pass in a ContainerResource.  In other words, we
are creating a new resource inside some ContainerResource, not necessarily
inside a directory.  Of course, in the default case, the ContainerResource
would be an instance of DirectoryResource, tied to a physical directory.
However, with this modification it would be possible to create "virtual
containers" that are not directories, yet mimic the hierarchical
containment structure that directories provide.

Am I correct in understanding the following?

1) localCreateResource() is meant to return a Resource only if this
particular class of ResourceIndexer will accept the supplied parameters,
and otherwise it returns null.

2) createResource() is meant to return a Resource by any means necessary,
traveling up the list of ResourceIndexers until it finds one that will
return a non-null value, and only returning null if all else fails.

How might localCreateResource() determine whether to return null, or to go
ahead and create a resource?  Does it have to do with whether or not this
is the indexer registered to the specified container?  Or does it have to
do with the Object arg?  I imagine it could be either, but what would it be
in the default case?  Would the final arg be used at all in the default
case, or is it just for the sake of generality?

>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);
>}



+---------------------+-------------------------+---------------------+
|    Dave Makower     |    davemak@pencom.com   |   WWW Specialist    |
+---------------------+-------------------------+---------------------+
|     Co-author of "Java Programming Basics" (Henry Holt/MIS:Press)   |
|                 http://www.pencom.com/javabasics/                   |
+----------------------------------+----------------------------------+
|   Pencom Web Works               |   (212) 513-7777   voice         |
|   Pencom Systems Inc.            |   (212) 513-1975   fax           |
|   40 Fulton St.                  |                                  |
|   New York, NY  10038            |   http://www.pencom.com/         |
+----------------------------------+----------------------------------+

Received on Friday, 6 September 1996 18:54:20 UTC