This get-user-stats is not the root of the problem. From where results RpcType?
RpcType.setRpcOperation(JAXBElement<? extends RpcOperationType>)
I should warn you that if this is embedded in the internal workings of
http://xml.juniper.net/dmi, you may have to ask elsewhere. At least to me,
this is very white space on my map.
JAXBElement is sort of a container for wrapping POJOs where unmarshalling
applications need to see the XML tag in addition to the POJO in order to
determine what is what. The other imporant field therein is "name", giving
you the XML tag. So, for instance, in a sequence of elements of identical
types, you can still distiguish foos from bars even though they all are typed
alike and the unmarshaller returns them all in a List<JAXBElement<?>>.
-W
On 25 August 2010 20:08, wuntee <mathew_rowley_at_cable.comcast.com> wrote:
>
> I am not very familiar with XSD creation - my experience has been more of
> implementing clients, could you explain what you mean by :
>
> Prabably the XML schema could be tweaked to have a more general base
> type (Object) as JAXBElement's generic parameter.
>
> This is the XSD (truncated to the single method):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:dmi="http://xml.juniper.net/dmi">
>
> <!-- get-user-stats -->
> <xs:complexType name="get-user-stats">
> <xs:annotation>
> <xs:appinfo>
> <dmi:rpc-info>
> <name>Get user statistics</name>
> <description>
> This command returns AllocatedUserCount CurrentUserCount
> MaxUsersin24Hrs MinUsersin24Hrs
> </description>
> <rpc-reply-tag>user-stats</rpc-reply-tag>
> </dmi:rpc-info>
> </xs:appinfo>
> </xs:annotation>
> <xs:sequence>
> <xs:element name="reset" type="xs:boolean" minOccurs="0">
> <xs:annotation>
> <xs:appinfo>
> <dmi:param-info>
> <name>Reset Stats</name>
> <description>
> This will govern the reseting of this statistics data. By
> default, the data is not reset.
> </description>
> </dmi:param-info>
> </xs:appinfo>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
>
> </xs:schema>
>
>
>
>
> Wolfgang Laun-2 wrote:
>>
>> A JAXBElement<? extends RpcOperationType> can contain (as its "value"
>> field)
>> anything that is or extends RpcOperationType. GetUserStat(u)s doesn't fit.
>>
>> So: the answer is "no".
>>
>> Prabably the XML schema could be tweaked to have a more general base
>> type (Object) as JAXBElement's generic parameter.
>>
>> -W
>>
>> On 25 August 2010 19:31, wuntee <mathew_rowley_at_cable.comcast.com> wrote:
>>>
>>> I have 2 sets of XSD's, one that generates RPC based calls, and another
>>> that
>>> defines the product specific methods. The RpcType object (generated by
>>> JAXB2) has a 'setRpcOperation' method defined by:
>>>
>>> RpcType.setRpcOperation(JAXBElement<? extends RpcOperationType>)
>>>
>>> That 'RpcOperation' object should be the 'specific product method'
>>> described
>>> above. One example is (also generated by JAXB2):
>>>
>>>
>>> @XmlAccessorType(XmlAccessType.FIELD)
>>> @XmlType(name = "get-user-stats", propOrder = {
>>> "reset"
>>> })
>>> public class GetUserStats {
>>>
>>> protected Boolean reset;
>>>
>>> /**
>>> * Gets the value of the reset property.
>>> *
>>> * @return
>>> * possible object is
>>> * {_at_link Boolean }
>>> *
>>> */
>>> public Boolean isReset() {
>>> return reset;
>>> }
>>>
>>> /**
>>> * Sets the value of the reset property.
>>> *
>>> * @param value
>>> * allowed object is
>>> * {_at_link Boolean }
>>> *
>>> */
>>> public void setReset(Boolean value) {
>>> this.reset = value;
>>> }
>>>
>>> }
>>>
>>>
>>> Now, is it possible to create an instance of 'GetUserStatus' and add it
>>> to
>>> the RpcType object via setRpcOperation?
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Cast-JAXB2-generated-object-to-JAXBElement--tp29534757p29534757.html
>>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Cast-JAXB2-generated-object-to-JAXBElement--tp29534757p29535064.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>