Page 1 of 1

Invoking Author Operation programatically

Posted: Fri Nov 13, 2009 12:06 pm
by sijomon
Hi,

I was wondering; is there a mechanism for invoking an AuthorOperation programatically from another AuthorOperation? I have a completed, tested and delivered AuthorOperation that I'm not partciuarly keen to modify. I have another, new operation, that, amongst other functions, needs to offer the user exactly them same behaviour as the first operation (essentailly two different routes to the same behaviour, required to support two different working practices). I can invoke the first operation simply by instantiating it and then calling doOperation() however the target operation has a large number of arguments (under normal circumstances tese are suipplied by Oxygen from the framework config). I cannot seem to find a way to access the arguments for one operation form another operation. The only two solutions I can think of are 1) replicate all the argumenst required to call the first operation and add them to the argumenst list for the seocnd operation, or 2) build a framework file parser to exract the operation argumens directly from the config file, with eitehr approach I could then construct my own ArgumenstMap instance to pass to the instatiated operation. Neither of this solutions are particuarly good, 1) for maintainence reasons, and 2) for complexity reasons.

Can you suggest anything?

Regards,

Simon.

Re: Invoking Author Operation programatically

Posted: Fri Nov 13, 2009 5:42 pm
by sorin_ristache
Hello,

If the second action has almost the same behavior as the first one maybe you can have everything in the first action and add one argument (maybe a boolean argument) that selects the behavior of the first action or the behavior of the second action. Other option could be storing the argument values as static values in the class of the first action and reuse them when it will be called by the second action.

If you want to have a separate action that must execute the same behavior as the first action and you want to pass the same argument values that are set in the framework file for the first action I think you have to read the framework file for finding the values of the arguments. Oxygen Author also reads the argument values from the framework for running an action that is invoked by the user in Author mode.


Regards,
Sorin

Re: Invoking Author Operation programatically

Posted: Fri Nov 13, 2009 6:08 pm
by sijomon
Ok, that's pretty much what I thought; thanks for the confirmation.

Simon.