moniker design problem



Hi everyone,

I just detected a small design problem concerning the moniker interface. The problem is that shlib monikers are loaded into the address space of its parent moniker, and not into the address space of the calling process. This is especially a problem with monikers trying to implement something like a cache (leading to an out of process cache).

Consider the following moniker:

"file:/tmp/test.xmldb#cache#xmldb#config:/gnomeric/autoconf"
where the "file:" and "xmldb:" moniker are "exe" type, and "config:" and "cache:" are "shlib" monikers.

Resolving the above moniker in P0 leads to (where P0 is the current process, P? is another process):

P1                   P1    P2    P2
file:/tmp/test.xmldb#cache#xmldb#config:/gnomeric/autoconf
Both shlib monikers are in the wrong process.

One solution is to load all shlib monikers into the process which accesses a moniker, for example if we have the following moniker:

xmldb:/tmp/test.xmldb#config:/a/value
we can simply split the string into separate monikers:
xmldb:/tmp/test.xmldb
and
config:/a/value
We can then generate a moniker for each sub string, and combine the monikers by setting the parent attribute.

Please notice that we do not need a parseDisplayName method in the IDL at all for this approach. So this would lead to much simpler code. The disadvantage of this approach is that we still not have the right loading order (everything is loaded into the actual process), but it solves the 'cache' problem.

A better solution would be to use a method which guarantees the right loading order. One way is to parse the moniker name from right to left, instead of left to right. This is really not much work to implement, and application should not see and difference at all. We only need to replace the parseDisplayName method with something like:

     /**
      * setParent:
      * @name: the display name of the parent moniker
      *
      * Generates a moniker from @name and then set the parent 
      * attribute.
      */
      void    setParent (in string name)
           raises (InvalidSyntax, UnknownPrefix);
Here is an example how to get the moniker for "file:/test.text#cache:":

    -    extract the toplevel moniker name = "cache:"
    -    get the moniker for "cache:"
    -    extract the parent name = "file:/test.text"
    -    call setParent()

Sure, we have to hardcode the moniker delimiter '#' to make this work. But I would prefer this solution, because it guarantees the right loading order.

Are there any objections to this approach?

- Dietmar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]