Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1415001] |
Mon, 01 September 2014 21:19 |
UmaShankar Subramani 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 |
|
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
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 |
UmaShankar Subramani 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 #1415157 is a reply to message #1415153] |
Tue, 02 September 2014 07:53 |
UmaShankar Subramani 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 #1415467 is a reply to message #1415351] |
Tue, 02 September 2014 21:29 |
UmaShankar Subramani 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 #1416879 is a reply to message #1415587] |
Thu, 04 September 2014 20:59 |
UmaShankar Subramani 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 |
|
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)
>
>
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: Understanding CDODataOutputImpl and CDODataInputImpl classes' methods [message #1418853 is a reply to message #1417285] |
Sun, 07 September 2014 19:12 |
UmaShankar Subramani 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
|
|
|
Powered by
FUDForum. Page generated in 0.05265 seconds