[jboss-as7-dev] Descriptions of non-simple attributes
Kabir Khan
kabir.khan at jboss.com
Sat Jan 29 05:49:19 EST 2011
I missed something, since A and B are not required in that example you could have this
[ {"A"=>100, "B"=>"MILLISECONDS"},
{"A"=>100},
{"B"=>"SECONDS"},
{"A"=>5, "B"=>"NANOSECONDS"}
(or since the complex list is not required in the parent it could be absent)
It is mainly there to group attributes that work together in a "parent", think something like
<xs:complexType name="thing">
<xs:all>
<xs:element name="thing" type="type" minOccurs="0" maxOccurs="unbounded"/>
<xs:all>
<xs:complexType>
<xs:complexType name="type">
<xs:attribute name="A" use="required" type="xs:integer"/>
<xs:attribute name="B" use="optional" type="xs:string"/>
</xs:complexType>
On 29 Jan 2011, at 10:29, Kabir Khan wrote:
> No that refers to a list of similar elements
>
> [ {"A"=>100, "B"=>"MILLISECONDS"},
> {"A"=>10, "B"=>"SECONDS"},
> {"A"=>5, "B"=>"NANOSECONDS"}
> ]
> On 29 Jan 2011, at 03:37, Jason T. Greene wrote:
>
>> Could you guys explain the complex list example in [2]?
>>
>> Is that referring to an alternating type list like:
>>
>> [A, B, A, B]?
>>
>> On 1/28/11 1:57 PM, Brian Stansberry wrote:
>>> 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
>>>>
>>>
>>>
>>
>>
>> --
>> Jason T. Greene
>> JBoss, a division of Red Hat
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
More information about the jboss-as7-dev
mailing list