[TransWarp] peak.naming refactoring plan
Phillip J. Eby
pje at telecommunity.com
Wed Jul 3 16:03:39 EDT 2002
Goals:
* Cut down on number of classes/other overhead needed to implement simple
URL schemes
* Make ParsedURL base class cleaner/more extendable (based off new 'struct'
type)
* More clearly delineate differences in concept between "name", "address",
and "reference"
* Make URL-based contexts easier to write for handling URLs-as-names, minus
the "scheme:" part
Plan:
* Get rid of the "address type" concept and the RefAddr() class; let
address objects stand on their own. This is Java overhead from JNDI that
we don't need in Python.
* Use ParsedURLs as addresses directly, and allow them to specify a
"default factory" to implement creation of an object from the address.
Possibly add an interface declaration for this.
* Create a generic "URLContext" whose _get() simply returns the appropriate
ParsedURL instance, based on a scheme->addressFactory (i.e.
scheme->parsedURL subclass) registry. Make peak.factories.getURLContext()
use this if there's no more specific context registered, and the created
context will support the scheme.
* Make the default objectFactory in peak.factories (i.e. getObjectInstance)
check if the object supports the "I've got a default factory" interface,
and if so, use it so long as another registry doesn't take precedence.
* Re-org existing schemes to drop out context classes, have parsedURL
classes declare their default factory, move their scheme->context entries
to a scheme->addressFactory registry. Ditch the "address type" registry
stuff.
Results: implementing a new URL address scheme will require only a
parsedURL subclass, an implementation factory, and an entry in the
scheme->parser table. In other words, 2 classes and 1 registry entry, vs.
3 and 2 currently. Plus various junk gone that's not really needed. We
also could begin to standardize the interface to the default factory
system's registries, which right now must be hard-coded or monkeypatched.
More information about the PEAK
mailing list