Hi Ali,
It looks like you want to change your mapping for InputStream, dropping
the name="stream-source" from the collection:
<mapping name="input-stream" class="gsn.beans.InputStream" >
<value name="name" field="name" style="attribute"/>
<value name="rate" field="rate" style="attribute"
usage="optional"/>
<value name="count" field="count" style="attribute"
usage="optional"/>
<value name="start-time" field="startTime" style="attribute"
usage="optional"/>
<value name="end-time" field="endTime" style="attribute"
usage="optional"/>
<collection name="stream-source" field="sources"
item-type="gsn.beans.StreamSource" />
<value field="sql" style="text" />
</mapping>
The problem with it as shown above is that you're saying the collection
itself will have an element "stream-source", then within that each
source will have its own "stream-source" element (since that's the name
you use in the StreamSource mapping). Your XML doesn't have this element
for the collection.
Also, please subscribe to the jibx-users list so your emails will get
through. Without subscribing they get held (along with all the PayPal
and BankOfAmerica account updates for JiBX ;-) ) until I remember to
check the administrative interface and sort through the accumulation of
(mostly) junk.
- Dennis
Ali Salehi wrote:
Dear friends,
I'm trying to parse the following file :
<virtual-sensor name="Bla" priority="11">
<class>gsn.sample.BS</class>
<author>bla-bla</author>
<email>[EMAIL PROTECTED]</email>
<description>bla bla.</description>
<life-cycle pool-size="10" drop-policy="NoDrop">
<parameters/>
</life-cycle>
<output-specification rate="1500">
<buffering policy="FIFO">
<parameters/>
</buffering>
<dropping policy="NoDrop">
<parameters/>
</dropping>
</output-specification>
<addressing>
<predicate key="geographical">BC121</predicate>
<predicate key="geographical">BC122</predicate>
</addressing>
<output-structure>
<field name="light" type="integer"/>
<field name="ligh2" type="integer"/>
</output-structure>
<storage enable="false" history-size="100"/>
<input-streams>
<input-stream name="light" rate="10" count="100">
<stream-source alias="bla" storage-size="20"
disconnect-buffer-size="10" >
<addressing>
<absolute-address host="localhost"
port="1234" wrapper-id="sf"/>
</addressing>
select bla from bla
</stream-source>
</input-stream>
</input-streams>
</virtual-sensor>
With the following JiBX file :
<binding>
<mapping name="virtual-sensor" class="gsn.beans.VSConf2">
<value name="name" field="name" style="attribute" />
<value name="priority" field="priority" usage="optional"
style="attribute" />
<value name="class" field="mainClass" />
<value name="author" field="author" />
<value name="email" field="email" />
<value name="description" field="description" />
<structure name="life-cycle" >
<value name="pool-size" field="lifeCyclePoolSize"
style="attribute" />
<value name="drop-policy" field="lifeCycleDropPolicy"
style="attribute"/>
<collection name="parameters" field="lifeCycleDropParams"
item-type="gsn.beans.KeyValueImp" />
</structure>
<structure name="output-specification">
<value name="rate" field="outputStreamRate"
style="attribute" usage="optional" />
<structure name="buffering" >
<value name="policy" field="outputBufferName"
style="attribute" />
<collection name="parameters"
field="outputBufferParams"
item-type="gsn.beans.KeyValueImp" />
</structure>
<structure name="dropping" >
<value name="policy" field="outputDropPolicyName"
style="attribute"/>
<collection name="parameters"
field="outputDropPolicyParams"
item-type="gsn.beans.KeyValueImp" />
</structure>
</structure>
<collection name="addressing" field="addressing"
item-type="gsn.beans.KeyValueImp" />
<collection name="output-structure" field="outputStructure"
item-type="gsn.beans.DataField" />
<structure name="storage">
<value name="enable" field="storageEnable"
style="attribute"/>
<value name="history-size" field="storageHistorySize"
style="attribute"/>
<value field="storageUrl" style="text" usage="optional" />
</structure>
<collection name="input-streams" field="inputStreams"
item-type="gsn.beans.InputStream" />
</mapping>
<mapping name="predicate" class="gsn.beans.KeyValueImp" >
<value name="key" field="key" style="attribute"/>
<value field="value" style="text"/>
</mapping>
<mapping name="input-stream" class="gsn.beans.InputStream" >
<value name="name" field="name" style="attribute"/>
<value name="rate" field="rate" style="attribute"
usage="optional"/>
<value name="count" field="count" style="attribute"
usage="optional"/>
<value name="start-time" field="startTime" style="attribute"
usage="optional"/>
<value name="end-time" field="endTime" style="attribute"
usage="optional"/>
<collection name="stream-source" field="sources"
item-type="gsn.beans.StreamSource" />
<value field="sql" style="text" />
</mapping>
<mapping name="absolute-address" class="gsn.beans.HostAddress">
<value name="host" field="host" style="attribute"/>
<value name="port" field="port" style="attribute"/>
<value name="wrapper-id" field="wrapperId"
style="attribute"/>
</mapping>
<mapping name="stream-source" class="gsn.beans.StreamSource" >
<value name="alias" field="alias" style="attribute"/>
<value name="storage-size" field="storageSize"
style="attribute" />
<value name="disconnect-buffer-size" field="bufferSize"
style="attribute" usage="optional" />
<value name="sampling-rate" field="samplingRate"
style="attribute" usage="optional" />
<structure name="addressing">
<structure name="absolute-address" field="staticAddress">
<value name="host" field="host"
style="attribute"/>
<value name="port" field="port"
style="attribute"/>
<value name="wrapper-id" field="wrapperId"
style="attribute"/>
</structure>
<structure name="dynamic-address" field="dynamicAddress">
<collection name="conditions"
field="conditions"
item-type="gsn.beans.KeyValueImp" />
</structure>
</structure>
</mapping>
<mapping name="dynamic-address" class="gsn.beans.DynamicAddress">
<collection name="conditions" field="conditions"
item-type="gsn.beans.KeyValueImp" />
</mapping>
<mapping name="field" class="gsn.beans.DataField">
<value name="name" field="name" style="attribute"/>
<value name="type" field="type" style="attribute"/>
<value field="description" style="text" usage="optional"/>
</mapping>
</binding>
The problem is that, in the jibx can't parse the addressing part of the
input stream :
<addressing>
<absolute-address host="localhost"
port="1234" wrapper-id="sf"/>
</addressing>
And complains with :
Expected "stream-source" end tag, found "absolute-address" start tag
(line 33, col 69) at
org.jibx.runtime.impl.UnmarshallingContext.parsePastEndTag(UnmarshallingContext.java:835)
gsn.beans.InputStream.JiBX_VirtualSensorDescription_unmarshal_1_0(InputStream.java)
gsn.beans.JiBX_VirtualSensorDescriptionInputStream_access.unmarshal()
gsn.beans.JiBX_MungeAdapter.JiBX_VirtualSensorDescription_unmarshal_1_2()
gsn.beans.VSConf2.JiBX_VirtualSensorDescription_unmarshal_1_0(VSConf2.java)
gsn.beans.JiBX_VirtualSensorDescriptionVSConf2_access.unmarshal()
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2542)
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2702)
at gsn.beans.VSensorLoader.loadPlugin(VSensorLoader.java:64)
at gsn.beans.VSensorLoader.run(VSensorLoader.java:38)
at java.lang.Thread.run(Thread.java:595)
The error is strange since I explained the "addressing" element in the
configuration file. I though this is a bug, since if I move the
"addressing" definition to the first "mapping" it starts works.
Any suggestions ?
PS - I also tried latest CVS :-(
Cheers,
Ali Salehi
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users