Thread: Reading IDL CORBA objects written from java

  1. #1
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250

    Reading IDL CORBA objects written from java

    I really don't know if any has experienced this, or has an answer, some guidance would be good too.

    Basically I have a binary file written by java, I can extract some information, however I am stuck after I get to the objects portion. I need to read some objects written through DataOutputStream.write_object, which basically takes an object and it says to quote the Java API site: "Writes the IDL CORBA::Object value to the output stream.". I would think it would be possible to interpret it in C++, but so far searches have come up blank for me, both here and on google. I've searched for CORBA and whatnot, but so far, no succcess.

    Incidentally, I am currently opening the file via std::ifstream, and reading 4-8 bytes at a time to find the information, if that has any bearing.

    Anyone have any ideas on the best way of approaching this? I've kinda hit a brick wall at the moment and figured there may be someone here who has found a way around, or at least point me in the right direction towards some info, because I am not finding much on it.

    Thanks.

  2. #2
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    it's been about 4 years since I've done any CORBA, but IIRC only java supports objects by value, so I doubt you'll have much success reading the binary file. What you could do is request the objects from the java ORB using CORBA, but I'm not sure if that's what you want.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  3. #3
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Awesome well I do have the source and structure of the actual object being written. It would be impossible without it of course, but I don't have any ORB servers to read from, so I don't know if its possible to read the values knowing the structure.

  4. #4
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    you could set up your own ORB server and request from that.

    It's been a while but a few years ago I used javaORB and OmniORB to talk to each other. you could use your java object in javaorb and write a C++ client with OmniORB to request the objects.

    I'm still not sure exactly what you're trying to achieve though.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  5. #5
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Well its a sorta complex thing. A "config" file is being written via a java applet. Which writes out data compressed as bytes. It also writes out objects via the write_object method of dataoutput stream.

    I did not write the applet, however, seeing as I must use it, and cannot modify it in any real way, I need to be able to interpret the file via c++ and modify the objects via a user dialog in mfc. The tricky part, is that I am not sure how the data via the CORBA objects is arranged, and would love to be able read byte by byte and convert it, however that seems unlikely.

  6. #6
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    can you not use CORBA to communicate directly with the applet instead of via the file?
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  7. #7
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Sadly I cannot, its supposed to read the file, and present the options changed there.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You could find the Java serialization specification and parse the values yourself from the binary file.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Quote Originally Posted by CornedBee
    You could find the Java serialization specification and parse the values yourself from the binary file.

    I would if I could find it. This object also has string values embedded, so it will be tricky to find it, but if anyone has a way or has found a link to that I'd love to have it. Currently I've found 0 good links on it.

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Try this one:
    http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
    Don't know if there's an updated one for Java 5.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #11
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Thanks, I must have missed that. Looks like a decent read, and a good place to start!


    Hmm I should look more carefully, however the object does not implement the serializable interfeace, I will however ask on the java boards as that seems more appropriate.
    Last edited by dpro; 01-25-2006 at 04:24 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. Java for real-time applications
    By zacs7 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 08-26-2008, 06:34 AM
  3. Java: Is reading String by String possible?
    By alphaoide in forum Tech Board
    Replies: 5
    Last Post: 08-28-2004, 07:01 PM
  4. Reading a file written by VB
    By nemaroller in forum C++ Programming
    Replies: 8
    Last Post: 07-12-2002, 11:17 PM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM