How to specify an array in the return value / argument of the method in the CORBA IDL file

Introduction

Nowadays, no one is using CORBA! ?? What aside: thermometer_face:

What is CORBA in the first place?

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.)

IDL example

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);
      };
    };
  };
};

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.

How I posted this article

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

How to specify an array in the return value / argument of the method in the CORBA IDL file
How to retrieve the hash value in an array in Ruby
How to output the value when there is an array in the array
How to get the length of an audio file in java
[Java] How to search for a value in an array (or list) with the contains method
[Swift] How to get the number of elements in an array (super basic)
[Note] [Beginner] How to write when changing the value of an array element in a Ruby iterative statement
[Swift5] How to get an array and the complement of arrays
How to increment the value of Map in one line in Java
Procedure to make the value of the property file visible in Spring Boot
How to convert an array of Strings to an array of objects with the Stream API
How to change the value of a variable at a breakpoint in intelliJ
Android development, how to check null in the value of JSON object
Output of how to use the slice method
If the parameter is an array, how to include it in Stopara's params.permit
How to make a judgment method to search for an arbitrary character in an array
How to set environment variables in the properties file of Spring boot application
[Java] How to get the maximum value of HashMap
[SwiftUI] How to specify the abbreviated position of Text
How to specify the resource path in HTML import
How to convert a file to a byte array in Java
How to debug the generated jar file in Eclipse
[Rails] How to display an image in the view
How to find the total value, average value, etc. of a two-dimensional array (multidimensional array)-java
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
How to use git with the power of jgit in an environment without git commands
How to request by passing an array to the query with HTTP Client of Ruby
Pass arguments to the method and receive the result of the operation as a return value
Sample code to assign a value in a property file to a field of the expected type
[Ruby] How to use the map method. How to process the value of an object and get it by hash or symbol.
How to get the class name / method name running in Java
How to correctly check the local HTML file in the browser
How to use the getter / setter method (in object orientation)
[Ruby] Count an even number in an array using the even? Method
9 Corresponds to the return value
How to change a string in an array to a number in Ruby
A method that applies transforms in parallel to all elements and returns an array of return values that maintain their order
Create a method to return the tax rate in Java
How to change the setting value of Springboot Hikari CP
How to add elements without specifying the length of the array
How to add the same Indexes in a nested array
How to derive the last day of the month in Java
How to change the contents of the jar file without decompressing
[Ruby] How to batch convert strings in an array to numbers
Method definition location Summary of how to check When defined in the project and Rails / Gem
[Ruby] How to count even or odd numbers in an array
It doesn't respond to the description in .js of the packs file
How to display 0 on the left side of the standard input value
Fix the file name of war to the one set in Maven
[Rails] Talk about paying attention to the return value of where
The story of toString () starting with passing an array to System.out.println
[Rails] How to omit the display of the character string of the link_to method
How to get the id of PRIMAY KEY auto_incremented in MyBatis
Cast an array of Strings to a List of Integers in Java
How to store the information entered in textarea in a variable in the method
[chown] How to change the owner of a file or directory
I want to change the value of Attribute in Selenium of Ruby
[Ruby] Specify the argument name of the method. Meaning of the colon (:) at the end
How to use the link_to method
How to use the include? method