My IDL looks like:
interface TransactionResource {
void prepare() raises (NotPreparedException);
void commit() raises(TransactionException);
void rollback() raises(TransactionException);
};
interface ManageDemand : TransactionResource {
string createDemand(in string demand);
};
interface CreateAccount : TransactionResource {
string createAccount(in string account);
};
I create the ManageDemand distributed object on Server , I make it persistent, and it's reachable through the CORBALOC address.
I would like to create a generic method on the client that detects which resource it is ( if it's CreateAccount or manageDemand).
public TransactionResource getResource(String url){
Object obj = orb.string_to_object(url.toString());
How can I decide this, if I have to use ManageDemandHelper or CreateAccountHelper to narrow this obj?
Ex: ManageDemand transactionResource = ManageDemandHelper.narrow(obj);
return transactionResource;
}
I found the response for this problem. I just have to verify this:
if (obj._is_a("IDL:transaction/ManageDemand:1.0")){ .. } else if (obj._is_a("IDL:transaction/CreateAccount:1.0")){ .. }
– Saad Lamarti Dec 19 '13 at 12:48