Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Understanding CDODataOutputImpl and CDODataInputImpl classes' methods
icon5.gif  Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415001] Mon, 01 September 2014 21:19 Go to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
I am learning how communication works between the CDO Sessions.

I need to know what is the agreement between CDODataOutput and CDODataInput classes.

For instance, consider the method "writeCDOChangeSetData()" in CDODataOutput class and "readCDOChangeSetData()" metod in CDODataInput class.

The write method writes the CDOIDandVersons of newObjects, changedObjects and detatchedObjects in the same order.


Then read method in the CDODataINput class reads it in the same order. How does this work? What is the aggrement between these two classes?

Can I write and read only Integers? Can I also write and read java objects?

[Updated on: Mon, 01 September 2014 21:57]

Report message to a moderator

Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415114 is a reply to message #1415001] Tue, 02 September 2014 05:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 01.09.2014 um 23:19 schrieb UmaShankar Subramani:
> I am learning how communication works between the CDO Sessions.
>
> I need to know what is the agreement between CDODataOutput and CDODataInput classes.
>
> For instance, consider the method "writeCDOChangeSetData()" in CDODataOutput class and "readCDOChangeSetData()" metod
> in CDODataInput class.
>
> The write method writes the CDOIDandVersons of newObjects, changedObjects and detatchedObjects in the same order.
>
>
> Then read method in the CDODataINput class reads it in the same order. How does this work? What is the aggrement
> between these two classes?
I'm not sure I understand the problem. The readXyz() methods are supposed to read the object(s) from a stream that the
writeXyz() methods have written to it.

> If I want to write an additional Object to this method in the CDODataOutput class and read the same in CDODataInput
> class, how should I do it?
I think you shouldn't do that. But I'd need to know what exactly you're trying to accomplish in the end.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415145 is a reply to message #1415114] Tue, 02 September 2014 07:26 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
> I am learning how communication works between the CDO Sessions.
>
> I need to know what is the agreement between CDODataOutput and CDODataInput classes.
>
> For instance, consider the method "writeCDOChangeSetData()" in CDODataOutput class and "readCDOChangeSetData()" metod
> in CDODataInput class.
>
> The write method writes the CDOIDandVersons of newObjects, changedObjects and detatchedObjects in the same order.
>
>
> Then read method in the CDODataINput class reads it in the same order. How does this work? What is the aggrement
> between these two classes?

I'm not sure I understand the problem. The readXyz() methods are supposed to read the object(s) from a stream that the
writeXyz() methods have written to it.


That answers my question.


> If I want to write an additional Object to this method in the CDODataOutput class and read the same in CDODataInput
> class, how should I do it?

I think you shouldn't do that. But I'd need to know what exactly you're trying to accomplish in the end.


I want to send the CDOCommitData object over the network and read it from the client side. Why are you writing the RevisionIDs from CDOCommitData objects over the network, then read them and generate new CDOCommitData objects on the client side again, instead of sending the object itself.



I have extended the CDOCommitData, which has additional information which should be sent to all open sessions during a cdo commit.




thanks,
Uma






----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper[/quote]

[Updated on: Tue, 02 September 2014 07:43]

Report message to a moderator

Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415153 is a reply to message #1415145] Tue, 02 September 2014 07:37 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.09.2014 um 09:26 schrieb UmaShankar Subramani:
> I'm not sure I understand the problem. The readXyz() methods are supposed to read the object(s) from a stream that the
> writeXyz() methods have written to it.
>
>
> That answers my question.
>
> I think you shouldn't do that. But I'd need to know what exactly you're trying to accomplish in the end.
>
>
> My question is, why don't you send the CDOCommitData objects over the network. Why are you writing the RevisionIDs
> from CDOCommitData objects, then read them and generate new CDOCommitData objects on the client side again.
Why do you think that would be better?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415157 is a reply to message #1415153] Tue, 02 September 2014 07:53 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
Quote:
Am 02.09.2014 um 09:26 schrieb UmaShankar Subramani:
> I'm not sure I understand the problem. The readXyz() methods are supposed to read the object(s) from a stream that the
> writeXyz() methods have written to it.
>
>
> That answers my question.
>
> I think you shouldn't do that. But I'd need to know what exactly you're trying to accomplish in the end.
>
>
> My question is, why don't you send the CDOCommitData objects over the network. Why are you writing the RevisionIDs
> from CDOCommitData objects, then read them and generate new CDOCommitData objects on the client side again.
Why do you think that would be better?


I want to do it because, I have extended the CDOCommitData, which has additional information(a java object) which should be sent to all open sessions during a cdo commit.


thank,
Uma Shankar

[Updated on: Tue, 02 September 2014 07:54]

Report message to a moderator

Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415202 is a reply to message #1415157] Tue, 02 September 2014 09:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.09.2014 um 09:53 schrieb UmaShankar Subramani:
> I want to do it because, I have extended the CDOCommitData, which has additional information(a java object) which
> should be sent to all open sessions during a cdo commit.
Does that mean you want to maintain your own fork of CDO?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415213 is a reply to message #1415202] Tue, 02 September 2014 10:28 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
Yes. In order to achieve this. I want to be able to send and receive java objects. Instead of sending IDs.
Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415351 is a reply to message #1415213] Tue, 02 September 2014 15:27 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 02.09.2014 um 12:28 schrieb UmaShankar Subramani:
> Yes. In order to achieve this. I want to be able to send and receive java objects. Instead of sending IDs.
CDOCommitData and all the other data structures that can be written and read with the CDO streams are carefully designed
to work in many different contexts. I doubt that transferring them differently has any advantage. If you see advantages
I fear it's left to you to design, implement and test that.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415467 is a reply to message #1415351] Tue, 02 September 2014 21:29 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
Hi Eike,

Thanks for the information. I am just trying to use Net4j Signalling platform for commmunication between the client sessions(similiar to CDO Sessions).

For that purpose I am starting with CDO. Because I can reuse most of the things from CDO, instead of developing them from the scratch.

In the end, I will leave the other things apart and only write and read CDOCommitData between the clients.





When I tried to write a simple Serializable object, I get the following exception.

Please help.

writeObject(new DataObject());

public class DataObject implements Serializable
{

}



[WARN] A problem occured while notifying session Session[2]
java.io.NotSerializableException: org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerRequest$1
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at org.eclipse.net4j.util.io.ExtendedIOUtil.writeObject(ExtendedIOUtil.java:111)
at org.eclipse.net4j.util.io.ExtendedDataOutputStream.writeObject(ExtendedDataOutputStream.java:47)
at org.eclipse.net4j.util.io.ExtendedDataOutput$Delegating.writeObject(ExtendedDataOutput.java:118)
at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOCommitData(CDODataOutputImpl.java:220)

/Uma

[Updated on: Tue, 02 September 2014 21:30]

Report message to a moderator

Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415587 is a reply to message #1415467] Wed, 03 September 2014 05:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
The code you've pasted doesn't show how it's related to CDOCommitData or CDOServerRequest so I can't help much.

Have you tried to use the CDORemoteSessionManager to notify other CDO clients without forking CDO?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1416879 is a reply to message #1415587] Thu, 04 September 2014 20:59 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
>> Have you tried to use the CDORemoteSessionManager to notify other CDO clients without forking CDO?

I did not know about CDORemoteSessionManager before. I will try to use it instead of forking CDO as you said. I want to send CDOCommitData object from one session to another during a commit. Could you please give me some hint, how can I do this with the help of CDORemoteSessionManager?


>>The code you've pasted doesn't show how it's related to CDOCommitData or CDOServerRequest so I can't help much

I was just trying to write a simple Serializable object (using writeObject method)in CDODataOutput and read the same object (using readObject method) in CDODataInput class during a commit.

Is it also possible to write the CDOCommitInfo object from CDODataOutput and read it in CDODataInput class using the writeObject(Object object) and readObject(Object object) method in these classes?

The simple serializable class is given below:

writeObject(new DataObject());

public class DataObject implements Serializable
{

}


The exception I get when i try to write the object is given below:

[WARN] A problem occured while notifying session Session[2]
java.io.NotSerializableException: org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerRequest$1
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at org.eclipse.net4j.util.io.ExtendedIOUtil.writeObject(ExtendedIOUtil.java:111)
at org.eclipse.net4j.util.io.ExtendedDataOutputStream.writeObject(ExtendedDataOutputStream.java:47)
at org.eclipse.net4j.util.io.ExtendedDataOutput$Delegating.writeObject(ExtendedDataOutput.java:118)
at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOCommitData(CDODataOutputImpl.java:220)


Thanks,
Uma

[Updated on: Thu, 04 September 2014 21:26]

Report message to a moderator

Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1417285 is a reply to message #1416879] Fri, 05 September 2014 04:51 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 04.09.2014 um 22:59 schrieb UmaShankar Subramani:
>>> Have you tried to use the CDORemoteSessionManager to notify other CDO clients >>without forking CDO?
>
> I did not know about CDORemoteSessionManager before. I will try to use it instead of forking CDO as you said. I want
> to send CDOCommitData object from one session to another during a commit. Could you please give me some hint, how can
> I do this with the help of CDORemoteSessionManager?
You cannot send messages exactly during a commit with CDORemoteSessionManager. In fact it's not related with committing
at all. You can think of it as a very simple, JMS-like messaging proptocol that's embedded into the CDO protocol. You
can play with it by opening the CDORemoteSessionsView and double-clicking on remote sessions to send message strings. Of
course there's JavaDoc on CDORemoteSessionManager, too.

> I was just trying to write a simple Serializable object (using writeObject(Object method)in CDODataOutput and read the
> same object (using readObject method) in CDODataInput class during a commit.
That is not as easy as you might think. I strongly discourage you from tampering with the commit and commit notification
protocol.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> The simple serializable class is given below:
>
> writeObject(new DataObject());
>
> public class DataObject implements Serializable
> {
>
> }
>
>
> The exception I get when i try to write the object is given below:
>
> [WARN] A problem occured while notifying session Session[2]
> java.io.NotSerializableException: org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerRequest$1
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
> at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.writeObject(Unknown Source)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.writeObject(ExtendedIOUtil.java:111)
> at org.eclipse.net4j.util.io.ExtendedDataOutputStream.writeObject(ExtendedDataOutputStream.java:47)
> at org.eclipse.net4j.util.io.ExtendedDataOutput$Delegating.writeObject(ExtendedDataOutput.java:118)
> at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOCommitData(CDODataOutputImpl.java:220)
>
>
>
>


Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1418853 is a reply to message #1417285] Sun, 07 September 2014 19:12 Go to previous message
UmaShankar Subramani is currently offline UmaShankar SubramaniFriend
Messages: 194
Registered: December 2011
Location: SWEDEN
Senior Member
Hi Eike,

Thanks for your answers.

I am trying to send string messages from one session to all other remote sessions using CDORemoteSessionManager. I can send the message. But I do not know how do I receive the message on the other end. This the code which I use to send the message. But I do not know if it is the right way of doing this.

I looked into the javadoc. But I did not understand how am I supposed to receive the sent message.

Could you please help me?


private void sendMessage() {

InternalCDORemoteSessionManager remoteSessionManager = new CDORemoteSessionManagerImpl();
remoteSessionManager.setLocalSession(this.getSession());


remoteSessionManager.setForceSubscription(true);
remoteSessionManager.activate();
CDORemoteSession[] recipients=remoteSessionManager.getRemoteSessions();



for(CDORemoteSession session:recipients)
{
remoteSessionManager.handleRemoteSessionSubscribed(session.getSessionID(), true);

}

CDORemoteSessionMessage message = new CDORemoteSessionMessage("Fist Message");
remoteSessionManager.sendMessage(message, recipients);

}

[Updated on: Sun, 07 September 2014 19:42]

Report message to a moderator

Previous Topic:Prevent elements to be moved from one container to another
Next Topic:release of Xcore 1.3.0 (compatible with Xtext 2.7.0)
Goto Forum:
  


Current Time: Thu Apr 25 09:03:21 GMT 2024

Powered by FUDForum. Page generated in 0.03961 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top