Hi all,

I have read the "Reducing the amount of ZCML directives" proposal
with some interest and general agreement, although as a relative Zope 3
newbie I haven't used the full range of directives yet. The
deprecation of this confusing markup:

    name="SD6 Agents"

with this clearer approach:


class SD6AgentsVocabulary(UtilityVocabulary?):
    interface = alias.interfaces.ISD6Agent

led me to think of a possibly better solution. The ability to pass
configuration to utilities in ZCML would be very useful and would avoid
lots of extra code if it could be generalised. Coincidentally, a
couple of years ago, I wrote a component framework in Java called JChassis
that is in many respects similar to Zope 3, although it targeted much
smaller non-web applications (and could in fact run on Java 2 Micro
Edition!). In it, 'services' could be configured thus:


for a simple string-valued 'myProperty' property. This would call a
setMyProperty method with the value (a classic JavaBeans pattern). There
is also markup to add properties of other basic types such as integers,
booleans, floats, arrays of basic types, etc. .. e.g. type="boolean". The
XML style used in JChassis is a bit different from what Zope 3 uses, but I
would envisage something like this:


resulting in the ISD6Agent class being resolved (because of its 'type')
and set as the 'interface' property on the UtilityVocabulary instance (I
assume it has such a property). This notation leaves no confusion about
the role of 'interface' here.

Such a general approach would have many other applications as a very
clear and quick way to get configuration into utilities, without having to
do custom extensions to the DTD. Of course if the properties expect values
other than the allowed basic types, then this type of configuration is not

There is a lot more info on what JChassis can do here:
which might be a source of ideas. Note that the project hasn't been
worked on for quite a while, and the ideas haven't really been tested out
in a serious application. The DTD for service configuration is truly

There is also a lot of functionality in JChassis for packaging "modules"
which might be of interest to those involved in eggification - there is an
XML DTD for defining complex dependencies and versioning, and the ability
to declare module dependencies on other modules, and even dependencies on
I might do a separate post on that at some stage.

And yes, JChassis even has contexts an acquisition too! No concept like
Zope 3 multi-adapators though. I like those ...


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to