Hello Everybody,
I enabled yesterday self-referencing option sources. That means only the configuration of
the current resource will be queried for possible options. The initial implementation only
allowed options sources that take options from all resources of a certain type. So all
resources of the referenced type were scanned, and property values were extracted and
aggregated into a single set of options.
Options sources can be used in three places:
1) Resource Configuration
2) Parameters for Operations
3) Connection Settings on import or creation of new resources
With the original implementation, it was easy to compute the options in all three cases
since types were referenced. In the AS7 plugin, the referenced resource type was different
than the current type in all the cases. Also, for compatible groups, getting these options
made sense since again all the resources of a type were scanned; so all these options
would have been identical regardless of actual resource that was using it.
Things get complicated with self-referencing option sources. In some cases computing the
options does not make sense. The current implementation presents users with a text box if
the option source does not return anything. With self-referenced option sources, users
will see a text field in cases where computing the options does not make sense.
Here are the cases where it no longer makes sense (user will see a blank text box):
1) Create or import a new resource - impossible to self-reference something that is not
yet created.
2) Group operations with option sources for parameters - each resource would have a
different set of options
3) Group updates for resource configuration - each resource would have a different set of
options
Original - option source with type reference:
<c:simple-property name="myProperty">
<c:option-source target="configuration"
expression="listProperty/socketBinding=name:type=SocketBindingGroup"/>
</c:simple-property>
New - self-referencing option source:
<c:simple-property name="myProperty">
<c:option-source target="configuration"
expression="listProperty/socketBinding=name"/>
</c:simple-property>
Rather than using a keyword (eg. "this"), the omission of type will imply an
option source is referencing the resource where it is located.
Right now the change is only in the Cassandra plugin branch but it will be merged soon in
master. Here is the code commit:
http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?h=jsanda/cassandra-p...
I would really appreciate a code review.
Thank you,
Stefan Negrea
Software Engineer