私は現在分散システムを調査しているので...私はそのIDLのことを学ばなければなりません。:D私にはこの要件があります:
IDLで定義-構造体としてのアカウント-アカウントのシーケンスとしてのアカウント-いくつかのアカウント操作を持つインターフェイス顧客: payIn(amount、accountId)、-成功した場合はtrueを返し、そうでない場合はfalse getAccounts(name)、-のシーケンスを返しますアカウント(個人に属する) -アカウント操作を行うインターフェイス管理者: 新しいアカウントを作成するアカウントを削除する
これは私の.idlファイルです:
module AccountNaming
{
struct Account
{
long id;
double balance;
string name;
};
typedef sequence<Account> accounts;
interface Customer
{
boolean payIn(in double amount, in long accountId);
accounts getAccounts(in string name);
string helloCust();
};
interface Administrator
{
void createAcc();
void deleteAcc();
string helloAdmin();
};
};
IDLのすべてのPOA、ヘルパー、ホルダークラスを生成しました。
私のJavaコードには、IDLコードを使用するクラスがあります。
import AccountNaming.*;
public class CustomerImpl extends CustomerPOA
{
public String helloCust()
{
return "Hello, dear Customer! :) ";
}
@Override
public boolean payIn(double amount, int accountId)
{
// how to get to the Customer's local variables ?
super.Customer.setAmount... // or something like that, because this doesn't work... etc.
return false;
}
@Override
public Account[] getAccounts(String name)
{
// TODO Auto-generated method stub
return null;
}
}
.idlファイルが正しいことを知っています。「helloCust/admin」メソッドは機能します。私の質問は、顧客/管理者の変数にアクセスして、payIn、getAccountsメソッドで引数として設定できるようにする方法です。