0 Replies Latest reply: Jul 20, 2012 11:20 AM by 950584 RSS

    POF Version Compatabilty Between .NET External Client & JAVA Client

    950584
      Hi EveryBody,

      Basically we have coherence server application which is running in java , i want store an object from either .NET or Java and it should be read from .NET or Java .
      1) I create a class in .NET
      2) I create equlant class in java and mentioned in pof configuration in server side as well java external client side.
      3) i am able to store/retrive objects in .NET as well java
      4) when i create same object in .NET and java and it's not overiding ?.

      JAva Class :

      public class ContactInfo implements PortableObject {

           private String id;
           private String name;
           
           public ContactInfo()
      {
      }
           public ContactInfo(String id, String name)
      {
                setID(id);
                setName(name);
      }

           @Override
           public void readExternal(PofReader reader) throws IOException {
                setID(reader.readString(0));
                setName(reader.readString(1));
                
           }

           @Override
           public void writeExternal(PofWriter writer) throws IOException {
                writer.writeString(0, getID());
                writer.writeString(1, getName());

           }

           public void setID(String iD) {
                id = iD;
           }

           public String getID() {
                return id;
           }

           public void setName(String name) {
                this.name = name;
           }

           public String getName() {
                return name;
           }


      }

      POF XML at Server Side & Java External client side

      <!DOCTYPE pof-config SYSTEM "pof-config.dtd">
      <pof-config>
      <user-type-list>
           <include>coherence-pof-config.xml</include>
           <user-type>
                <type-id>1000</type-id>
                <class-name>com.ml.cad.online.datacaching360views.cache.ep.ClusterInfo</class-name>
           </user-type>

      <user-type>
      <type-id>5011</type-id>
      <class-name>com.ml.gedt.cad.hubservices.beans.common.ContactInfo</class-name>
      </user-type>
      </user-type-list>
      </pof-config>


      .NET OBject

      namespace CoherenceSample

      {

      class ContactInfo : IPortableObject
      {
      private String id;

      public String Id
      {
      get { return id; }
      set { id = value; }
      }
      private String name;

      public String Name
      {
      get { return name; }
      set { name = value; }
      }
      public ContactInfo()
      {
      }
      public ContactInfo(String id,String name)
      {
      Id = id;
      name = Name;
      }

      public void ReadExternal(IPofReader reader)
      {
      Id=reader.ReadString(0);
      Name = reader.ReadString(1);
      }
      public void WriteExternal(IPofWriter writer)
      {
      writer.WriteString(0, Id);
      writer.WriteString(1, Name);
      }
      }
      }

      POF Configuration at .NET :

      <?xml version="1.0"?>

      <pof-config xmlns="http://schemas.tangosol.com/pof">
      <user-type-list>

      <!-- coherence POF user types -->
      <include>assembly://Coherence/Tangosol.Config/coherence-pof-config.xml</include>

      <!-- Tangosol.Examples namespace -->
      <user-type>
      <type-id>4011</type-id>
      <class-name>CoherenceSample.Address, CoherenceSample</class-name>
      </user-type>
      <user-type>
      <type-id>5011</type-id>
      <class-name>CoherenceSample.ContactInfo, CoherenceSample</class-name>
      </user-type>
      </user-type-list>

      <allow-interfaces>true</allow-interfaces>
      <allow-subclasses>true</allow-subclasses>
      </pof-config>

      ISSUE :
      adding data into cache from java :

      ContactInfo c= new ContactInfo("100","Sankar");
      cache.put(c, c);

      adding data into cache from .Net :

      ContactInfo c = new ContactInfo("100", "Sankar");
      cache.Insert(c, c);

      it's creating two entire into cache and i am not able retrive from java if i stored data via .NET


      Thanks,
      Sankar.