Hi list,

while working on the tenant refactoring and related stuff I got stuck
on the Tenant API and how to map it to metatype.

My train of thought/questions:

1) Tenants are basically just configuration provisioned onto 1 or more
targets. They MUST be readonly in nature. Right?

2) Tenants have an id, name and host and possibly additional
properties. Should this be a fixed set or arbitrarily extensible? If
so, what are use cases for this? If some kind of components adds logic
based on aditional properties why does it not carry that information
itself?

3) The Tenant interface current as well as proposed has a Dictionary
getProperties(). Why? If a Tenant has a (limited or fixed) set of
readonly properties that we publish on the service registration
anyway... the only thing I can think of that it allows easy access for
busines logic that just want the Tenant and not the ServiceReference
(OSGi plumbing). Good argument... good enough and/or alternatives? At
the very least I'd suggest changing it to keys()/get(Object key)
instead of having to return an immutable map.

=> Reason for asking <=

MetaType does not support maps for arbitrary key/value pairs. The
schema has an xs:any there, but autoconf wont understand how to
handled any mixin. Thus, if we want to validate a Designate, a
concrete configuration set for a specific (factory)Pid, against a
fixed  ObjectClassDefinition (OCD) there is no nice way to support
arbitrary properties.

A valid question if whether to use strict OCD at all. A designate it
is required to have a valid ocdref but at least in the Felix
implementation a local OCD takes precedence. Kind of strange... when I
specify a Tenant OCD as {id, name, host} you can still ship in a
configuration file with an arbitrarily different local OCD schema to
autoconf and it willl happily accept it :S

So, as it is shipping an OCD in /OSGi-INF/metatype with platform
bundles only serves the purpose of webconsole support (but no
arbitrary properties!) and it allows configuration files comming in to
reference it saving boilerplate OCD in each file, but it enforces
nothing.

Finally, for completeness sake, the Felix Metatype service requires at
least one designate to be specified in the bundle  /OSGi-INF/metatype
file which it crazy in a factory use case like Tenant. I posted a
question about this to the Felix list but have not recieved any
feedback yet.

Summarizing... we could replace or fix the buggy/incomplete Felix
Metatype service depending on whether we want more strict OCD checking
or more relaxed (allow arbitrary properties) MetaType support. Then we
can say we use Metatype in some sensible way. However, if we break the
semantics we might be better of with a custom little Tenant schema
that satisfies our needs. Building the resourceprocessor to handle
that will be less work then fixing MetaType.


Ref to how things look now:

http://subversion.amdatu.org/viewvc/trunk/amdatu-core/tenant/src/main/resources/OSGI-INF/metatype/metatype.xml?revision=1768&root=amdatu&view=markup
http://subversion.amdatu.org/viewvc/trunk/amdatu-release/src/main/resources/config/tenant-default.xml?revision=1771&root=amdatu&view=markup

Any thoughts or even suggestions?

grz
Bram
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to