Search code examples
javacompiler-errorscorba

Passing an array or sequence to function in idl Java Corba


While trying to add an array or sequnce to function defined in idl file like

  // BackupDaemon.idl

  interface BackupDaemon;

  #ifndef BackupDaemon_idl
  #define BackupDaemon_idl

 typedef sequence<BackupDaemon> BackupDaemonList;

 #include "BackupExceptions.idl"


 interface BackupDaemon {



     boolean startBackup(in sequence<string> backupPathes ,in string backupDaemonMacAddress);

 };

 #endif 

I got the following error :-

Expected one of `float' `double' `long' `short' `un
signed' `char' `wchar' `boolean' `octet' `any' `string' `wstring' `<identifier>'
 `::' `ValueBase'; encountered `sequence'.
     boolean startBackup(in sequence<string> backupPathes ,in string backupDaemo
nMacAddress);

So how can i pass an array or sequence to a function defined in idl file ? Thanks in advance. ^


Solution

  • Sequences cannot be used directly in CORBA operations. You need to typedef them first:

    typedef sequence<string> BackupPathesStrings;
    
    interface BackupDaemon {
         boolean startBackup(in BackupPathesStrings backupPathes, in string backupDaemonMacAddress);
     };
    

    See: Sequences and Arrays