[jboss-as7-dev] Descriptions of non-simple attributes
Brian Stansberry
brian.stansberry at redhat.com
Fri Jan 28 14:57:47 EST 2011
You're right; thanks. And that means one less thing to change on the
wiki. :-)
On 1/28/11 11:54 AM, Kabir Khan wrote:
> With the stuff discussed at [2] doesn't DESCRIPTORS become superfluous? The idea being that complex sub-attribute (for want of a better word) types live under VALUE_TYPE?
> On 28 Jan 2011, at 17:34, Brian Stansberry wrote:
>
>> We discussed your idea on IRC[1] and your proposal at [2] looks good.
>> For this to work, we can't allow "Arbitrary Descriptors" as described on
>> [3] at the same level as "type", "required", "description, "value-type".
>> So the idea is we'd add a "descriptors" reserved word at the same level
>> as "type", "required" etc; any arbitary descriptors would need to be
>> nested under "descriptors", e.g.
>>
>> node.get(ATTRIBUTES, SIZE, DESCRIPTORS, MAX).set(20);
>>
>> [1] http://echelog.matzon.dk/logs/browse/jboss-as7/1296169200 starting
>> at 17:14:31
>>
>> [2] http://pastebin.com/1X6qhcLf
>>
>> [3] http://community.jboss.org/docs/DOC-16317
>>
>> On 1/28/11 5:28 AM, Kabir Khan wrote:
>>> For jboss-as-threads I wrote pretty full model descriptors, however for values such as
>>>
>>> <keepalive-time time="100" unit="ms"/>
>>>
>>> I split this into two attributes in the model
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_DURATION, DESCRIPTION).set(bundle.getString("threadpool.common.keepaliveduration"));
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_DURATION, TYPE).set(ModelType.LONG);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_DURATION, REQUIRED).set(false);
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_UNIT, DESCRIPTION).set(bundle.getString("threadpool.common.keepaliveunit"));
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_UNIT, TYPE).set(ModelType.STRING);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME_UNIT, REQUIRED).set(false);
>>>
>>> //threadpool.common.keepaliveduration=Used to specify the amount of time that pool threads should be kept running when idle; if not specified, threads will run until the executor is shut down.
>>> //threadpool.common.keepaliveunit=The time unit for the number specified in keepalive-time-duration.
>>>
>>>
>>> Working on the marshalling I see Emanuel takes a different approch by passing in simple sub-elements like this as a ModelNode which is more elegant. That is kind of what I wanted to do but didn't really know how to write the description in a nice way. Since there are not many descriptors yet I'd like to clarify the structure and find the best practice. My original thought was that the structure would have to go in the node's description attribute (ATTRIBUTES, KEEPALIVE_TIME, DESCRIPTION below), but it might be nicer to do something like this:
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, DESCRIPTION).set("Used to specify the amount of time that pool threads should be kept running when idle; if not specified, threads will run until the executor is shut down"));
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TYPE).set(ModelType.OBJECT);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, REQUIRED).set(false);
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TIME, DESCRIPTION).set("The time"));
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TIME, TYPE).set(ModelType.LONG);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TIME, REQUIRED).set(false);
>>>
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, UNIT, DESCRIPTION).set("The time unit (Seconds, Milliseconds etc.)"));
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, UNIT, TYPE).set(ModelType.STRING);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, UNIT, REQUIRED).set(false);
>>>
>>> And if the keepalive-time attribute is optional but if present both time and unit sub-attributes must be specified, I think we would go with something like
>>>
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, REQUIRED).set(false);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TIME, REQUIRED).set(true);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, UNIT, REQUIRED).set(true);
>>>
>>> If it is keepalive-time is required and unit is optional, how about
>>>
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, REQUIRED).set(true);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, TIME, REQUIRED).set(true);
>>> node.get(ATTRIBUTES, KEEPALIVE_TIME, UNIT, REQUIRED).set(false);
>>>
>>>
>>>
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> jboss-as7-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>>
>> --
>> Brian Stansberry
>> Principal Software Engineer
>> JBoss by Red Hat
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
--
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat
More information about the jboss-as7-dev
mailing list