axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Daniels" <gdani...@macromedia.com>
Subject Handler registration patterns
Date Fri, 22 Jun 2001 13:00:05 GMT
Hi all:

I've just discovered a problem which my recent XML-izing of the registries
has brought to the fore.  Namely, we currently rely on registering things in
a particular order, to avoid forward-references to Handlers which haven't
yet been defined.  All our XML is currently set up this way, and when we
used to write the serialized object .reg files, Java took care of
maintaining all the references for us.

The list() code, which is what I'm using to store stuff in XML now, simply
walks the registry in no particular order, so it's possible to end up with
xml that looks like this:

<handlers>
 <chain name="chain1" flow="handler1"/>
 <handler name="handler1" class="foo"/>
</handlers>

(actually, right now I make sure to process Handler definitions before Chain
definitions, so this particular situation wouldn't be a problem, but when
chains include other chains it arises)

This also raises the spectre of circular references, which was there before
as well.  Should we notice the following and complain?

 <chain name="auth" flow="auth,securelog,access"/>
 <chain name="securelog" flow="auth,log"/>

One suggestion for the first problem is to use a "placeholder" Handler when
we're reading references to names that don't exist yet.  We'd also need to
add a replace() method in the Chain API so we can fix these when they
eventually do get registered.  We'd need to keep a table of fixups and
resolve all the replacements.  Alternately, we could let the placeholder be
a reference, and have it forward messages to the "real" Handler once it's
deployed.  This is kind of cool but involves more objects and more method
calls per invocation.

As for the circular refs - anyone got any suggestions?  One school of
thought says "you can shoot yourself in the foot if you want to" - i.e. we
shouldn't do anything.  Alternately, we could at either deploy time or run
time check for loops and complain if we find any.

--Glen



Mime
View raw message