Dan asked about a Java DCE interface, we've use email... Copying to a forum thread for other ideas:
>> Can you guys send me a few different binary files containing sample DCE messages for analysis and testing of the Java integration side? I'm unfamiliar with the C++ project stuff so I was hoping to get a jump on it without having to try and build/run Pluto locally from source code.
DCE is pretty simple. First, the basic wrappers are in plain text so it is very easy to follow in the logs. There are a few special text messages, such as RELOAD, etc., but the only one that really matters for sending messages is MESSAGE. Basically you just send MESSAGE xxx
Where xxx is the size in bytes of the binary data that will follow. The binary data it contains the actual message. All messages contain a from device and a to device, type and an ID. The most common type is 1, which means command. In that case the ID is the command's number. The second most common type is 2, which is the event, and the ID the events number. Each message also has an optional number of parameters.
What the commands and events are is defined in the database. In your Pluto admin web site, if you click advanced, DCE, you can see a list of all the commands and events and the parameters they take. Our utility DCEGen uses this database to build a pregenerated C++ program that encapsulates everything. So for example the command “MH Move Media” is ID 241. It expects 2 parameters: “PK_EntertainArea” is parameter ID 45, and “StreamID” is parameter ID 41.
Media_Plugin is a DCEDevice that implements that command. So DCEGen builds a base class for media plug-in that listens for incoming messages on a socket, automatically parses them and deserializes them, and then passes them to a switch block which will include a case 241, that will then extract the parameters, and call a virtual function called: “MH_Move_Media(string sPK_EntertainArea,int iStreamID)”.
So for C++ it's really simple, the programmer has nothing to do. It he wants to send the command he just types in DCE:: and then auto complete gives them a list of all the commands, and when he chooses the move media command, auto complete gives all the parameters, and when he calls SendCommand(), the command goes through and in media plug-in the MH_Move_Media() function gets called automatically.
To implement the entire functionality within java including the whole framework, the class generator and everything would be a pretty big task. however if all you want to be able to do is send a command or an event, you simply can open a sockets to DCE router and send MESSAGE xxx followed by the message in the same binary format. I attached a sample file containing the move media command going from device 123 to device for 83, with the stream ID of 382 and an entertainment area of “abc”. If you cat that to a socket the message goes through. Now the question is how to do this in Java. I included the message header and CPP file. Do you know C++?
There is another way of doing this. It is to make a C++ to Java gateway where all the guts of the code is still in C++ and uses the exact same libraries, but the user can do the implementations in Java. This is how we encapsulated Ruby. In this case there is very little code in Ruby, Ruby does not form messages, it does not open sockets, it does essentially nothing. All of that is done in a normal C++ DCE device. The C++ device parses the messages and then calls a Ruby function with the same name. This is how our C++ GSD device works. It would create a Ruby function MH_Move_Media that was an empty stub for the user to fill in. Virtually the only code in Ruby is what the user puts in to implement that function. The advantage is that it works faster, because C++ usually runs faster than the high-level languages, and more importantly, all our existing C++ libraries are still used so we do not have two sets of code to maintain. If we wanted to change the message format for example, we would just change the C++ message function, and would not need to change any Ruby code.
Does Java have the same type of C++ <-> Java interaction?