Hi Rohit,

The whole using="..." approach is deprecated and no longer supported 
(meaning it hasn't actually been removed from the code, but if it 
doesn't work in a particular case don't expect any fixes). The binding 
tutorial shows better ways of doing the same type of thing with abstract 
bindings.

  - Dennis


Rohit Anand wrote:
>
> Hi,
>    I have created a binding of Interface implementation class style 
> data Object. following is the Struture if the classes.
>
> package com.jibxemf.example1.dataobject.impl;
>
>
> import com.jibxemf.example1.dataobject.Address;
>
> import com.jibxemf.example1.dataobject.Name 
> <http://com.jibxemf.example1.dataobject.Name>;
>
> import com.jibxemf.example1.dataobject.Person;
>
>
> public class PersonImpl implements Person {
>
>
> private Name name;
>
>
> private Address address;
>
>
> @Override
>
> public Name getName() {
>
> return this.name <http://this.name>;
>
> }
>
>
> public void setName(Name name) {
>
> this.name <http://this.name> = name;
>
>
> }
>
>
> public void setAddress(Address address) {
>
> this.address = address;
>
> }
>
>
> @Override
>
> public Address getAddress() {
>
> return this.address;
>
> }
>
>
> }
>
>  
>
> package com.jibxemf.example1.dataobject;
>
>
> public interface Name {
>
>
> public abstract String getFName();
>
>
> public abstract String getMName();
>
>
> public abstract String getLName();
>
>
> public abstract void setFName(String fName);
>
>
> public abstract void setMName(String mName);
>
>
> public abstract void setLName(String lName);
>
>
> }
>
> package com.jibxemf.example1.dataobject;
>
>
> public interface Address {
>
> public String getStreetNumber();
>
>
> public String getPostalCode();
>
>
> public String getCity();
>
>
> public String getState();
>
>
> public String getCOuntry();
>
>
> public void setStreetNumber(String arg);
>
>
> public void setPostalCode(String arg);
>
>
> public void setCity(String arg);
>
>
> public void setState(String arg);
>
>
> public void setCountry(String arg);
>
> }
> ============================================================================
> and the implementation classes of Name and Address contains just 
> getter and setter.
>
>  
>
> following is the binding file that I created
> =====================================================================================
> <binding xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
> xsi:noNamespaceSchemaLocation="D:/LidoNGWorkspace_code_19112009/TestJiBXEMFProject/binding.dtd">
>
> <mapping name="Person" 
> class="com.jibxemf.example1.dataobject.impl.PersonImpl">
>
> <structure using="NameType" name="Name" get-method="getName"
>
> set-method="setName" />
>
> <structure using="AddressType" name="Address" get-method="getAddress"
>
> set-method="setAddress" />
>
> </mapping>
>
> <mapping label="NameType" abstract="true"
>
> class="com.jibxemf.example1.dataobject.Name 
> <http://com.jibxemf.example1.dataobject.Name>"
>
> factory="com.jibxemf.example1.dataobject.impl.DataObjectFactory.createNameInstance"
>  
> />
>
> <mapping label="AddressType" abstract="true"
>
> class="com.jibxemf.example1.dataobject.Address"
>
> factory="com.jibxemf.example1.dataobject.impl.DataObjectFactory.createAddressInstance"
>  
> />
>
> <mapping name="Name" class="com.jibxemf.example1.dataobject.impl.NameImpl"
>
> extends="com.jibxemf.example1.dataobject.Name 
> <http://com.jibxemf.example1.dataobject.Name>">
>
> <value style="attribute" name="firstName" get-method="getLName"
>
> set-method="setLName" />
>
> <value style="attribute" name="middleName" get-method="getMName"
>
> set-method="setMName" usage="optional" type="java.lang.String" />
>
> <value style="attribute" name="lastName" get-method="getLName"
>
> set-method="setLName" type="java.lang.String" />
>
> </mapping>
>
> <mapping name="Address"
>
> class="com.jibxemf.example1.dataobject.impl.AddressImpl" 
> extends="com.jibxemf.example1.dataobject.Address">
>
> <value style="attribute" name="street" get-method="getStreetNumber"
>
> set-method="setStreetNumber" type="java.lang.String" />
>
> <value style="attribute" name="city" get-method="getCity"
>
> set-method="setCity" type="java.lang.String" />
>
> <value style="attribute" name="state" get-method="getState"
>
> set-method="setState" type="java.lang.String" />
>
> <value style="attribute" name="postalCode" get-method="getPostalCode"
>
> set-method="setPostalCode" type="java.lang.String" />
>
> <value style="attribute" name="country" get-method="getCOuntry"
>
> set-method="setCountry" usage="optional" type="java.lang.String" />
>
> </mapping>
>
> </binding>
> ================================================================
> now when I run the following program
> ================================================================
> package com.jibxemf.example1.test;
>
>
> import java.io.FileInputStream;
>
>
> import org.jibx.runtime.BindingDirectory;
>
> import org.jibx.runtime.IBindingFactory;
>
> import org.jibx.runtime.IUnmarshallingContext;
>
>
> import com.jibxemf.example1.dataobject.Address;
>
> import com.jibxemf.example1.dataobject.Name 
> <http://com.jibxemf.example1.dataobject.Name>;
>
> import com.jibxemf.example1.dataobject.impl.PersonImpl;
>
>
> public class PersonTest {
>
> private static final String TEST_BINDING_FILE_NAME = 
> "../TestJiBXEMFProject/resources/binding-example1-test.xml";
>
>
> public static void main(String s[]) {
>
> try {
>
> IBindingFactory bindingFactory = 
> BindingDirectory.getFactory(PersonImpl.class);
>
> IUnmarshallingContext uctx = bindingFactory.createUnmarshallingContext();
>
> FileInputStream in = new FileInputStream(TEST_BINDING_FILE_NAME);
>
> // uctx.setDocument(in, null);
>
> PersonImpl person = (PersonImpl) uctx.unmarshalDocument(in, null);
>
>
> Address address = person.getAddress();
>
> Name name = person.getName();
>
> System.out.println("First Name:" + name.getFName());
>
> System.out.println("Address Details::" + address.getStreetNumber());
>
> }
>
> catch(Exception exception){
>
> exception.printStackTrace();
>
> }
>
> }
>
>
> }
>
> ===================================================
>
> I see
>
> First Name:null
>
> Address Details::null
>
> ============================
>
> Please help me out over here, what mistake I might have done in 
> writing binding file.
>
>  
>
> Thanks a bunch I deeply appreciate your help in resolving me this issue.
>
>  
>
> also Please direct me to any discuss thread that talks about binding 
> EMF files
>
>  
>
> again thans alot for your help
>
> Rohit Anand.
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-devs mailing list
> jibx-devs@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-devs
>   

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to