I'm sorry for the basic question.  I've searched the archives, 
but was unable to locate a situation just like mine - sorry if 
I missed it.

Basically, I have two interfaces as follows:

public interface IEventBase;

public interface IMyEvent extends IEventBase;

I also have a concrete class as follows:

public class DefaultEvent implements IMyEvent
{
 .....
}

The problem is that when I marshall an instance of DefaultEvent 
I get an essentially empty document containing only:

 <?xml version="1.0" encoding="UTF-8"?>
 <event xmlns="com.foo.bar"/>

While there are no marshalling exceptions or errors, this is 
all I get despite the fact that the DefaultEvent fields have 
been fully populated.  It does not appear to marshall any of 
the fields referenced from the extended interfaces?  Any and 
all help will be greatly appreciated as I am new to JiBX and 
obviously missing something simple (I hope).

Here is the binding file I am using:


<?xml version="1.0" encoding="UTF-8"?>
<binding value-style="attribute" track-source="true">
  <namespace uri="com.foo.bar" default="elements"/>
  <mapping class="java.util.Map" name="map"
        
        marshaller="org.jibx.extras.HashMapperStringToSchemaType
"
unmarshaller="org.jibx.extras.HashMapperStringToSchemaType"/>
  <mapping class="IEventBase" name="Event"
                abstract="true"
                ordered="false">
    <value name="timestamp" get-method="getTimestamp"
set-method="setTimestamp"/>
    <value style="element" name="description"
get-method="getDescription" set-method="setDescription"
usage="optional"/>
    <value style="element" name="host" get-method="getHost"
set-method="setHost" usage="optional"
                deserializer="java.net.InetAddress.getByName"/>
    <value style="element" name="sourceHost" get-
method="getSourceHost"
set-method="setSourceHost" usage="optional"
                deserializer="java.net.InetAddress.getByName"/>
    <structure get-method="getPayload" set-method="setPayload"
usage="optional"/>
  </mapping>
  <mapping class="IMyEvent" name="MyEvent"
                extends="IEventBase"
                factory="MyEventFactory.createEvent"
                ordered="false">
    <value style="element" name="eventType" get-
method="getEventType"
set-method="setEventType" deserializer="EventType.valueOf"/>
    <value style="element" name="layer" get-method="getLayer"
set-method="setLayer" usage="optional" 
deserializer="Layer.valueOf"/>
    <value style="element" name="criticality"
get-method="getCriticality" set-method="setCriticality" 
usage="optional"
deserializer="Criticality.valueOf"/>
    <value style="element" name="classification"
get-method="getClassification" set-method="setClassification"
usage="optional" deserializer="Classification.valueOf"/>
    <value style="element" name="securityContext"
get-method="getSecurityContext" set-method="setSecurityContext"
usage="optional"/>
    <structure map-as="IEventBase"/>
  </mapping>
  <mapping name="event" class="DefaultEvent">
                extends="IMyEvent"
                ordered="false">
  </mapping>
</binding>


#################

I have also attempted to invoke the IMyEvent mapping directly 
in the
DefaultEvent mapping as follows:

  <mapping name="event" class="DefaultEvent">
                extends="IMyEvent"
                ordered="false">
    <structure map-as="IMyEvent"/>
  </mapping>

This version does not work as the marshalling operation fails. 

Finally, all of my code will be passing parameters if the 
IMyEvent type around.  I'm using the runtime type of this 
parameter to pass t the BindingDirectory.getFactory() method.  
I'm also hoping to be able to unmarshall the same DefaultEvent 
instances back to the IMyEvent interface on the unmarshalling 
side - but that's the next step.  Just some background in case 
it is helpful.

Thanks again for any and all help.

Todd








-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to