Nowadays, no one is using CORBA! ?? What aside: thermometer_face:
I think it will come out as much as you want if you google ...
Abbreviation for Common Object Request Broker Architecture (Corva Cova). A standard for linking distributed processing, which defines only language-independent interfaces in IDL (Interface Definition Language). In COBRA, code is encapsulated together with information on its function and calling method, and CORBA-compatible components can communicate with each other regardless of language or OS. In other words, if you implement the interface described in IDL, you can communicate between different languages (Java, C, etc.): scream_cat :.
Reference site -About Java technology related to CORBA -ORB Circle
In this case, the interface described in IDL is converted to Java with the idlj command ... However, I was addicted to it because the IDL syntax and Java syntax are different. (The idlj command can be used by installing the JDK.)
As an example, if you define a method to calculate the consumption tax by passing the price as an argument, it will be as follows.
test.idl
module com{
module neriudon {
module corba {
interface CalcTax{
double calc(in long price);
};
};
};
};
module
corresponds to Java's package
, and IDL's long
corresponds to Java's ʻint`. See Java IDL: IDL to Java Language Mapping for more information.
So, the main subject is from here. The conversion table is described on the ↑ site, but what should I do if I want to specify an array for the return value / argument of the method?
So, as a result of investigation ...
Is it possible to accept a string array as argument in corba idl file
It seems that the array needs to be defined in advance using typedef
. It looks like a structure.
The following is a method to convert an array of String to a byte array.
Converter.idl
module com{
module neriudon {
module corba {
typedef sequence<octet> response;
typedef sequence<string> request;
interface Conveter
{
response convert(in request request);
};
};
};
};
string
corresponds to Java String
, and ʻoctetcorresponds to
byte`.Now, let's convert this to a Java file with the ʻidlj` command.
ʻIdlj -fall -td ./ ./Converter.idl` will output Java code similar to the following.
Extend ConveterPOA
if you want to implement the generated interface.
ConverterImpl.java
package com.neriudon.corba;
public class ConverterImpl extends ConveterPOA {
@Override
public byte[] convert(String[] request) {
// TODO Auto-generated method stub
return null;
}
}
I will omit the part that actually communicates the object using the IOR file etc .: frowning2 :.
By the way, there is also a project called JacORB when dealing with CORBA in Java.
I'm addicted to the difference between IDL grammar and Java grammar: cry :. The byte notation and array notation are hits by themselves, but I had a hard time finding an example of method input / output: confounded :. Also, I was surprised that Qiita's code block supported IDL: stuck_out_tongue_winking_eye :.
Recommended Posts