Invoking Author Operation programatically

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Invoking Author Operation programatically

Post by sijomon » Fri Nov 13, 2009 12:06 pm

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.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Invoking Author Operation programatically

Post by sorin_ristache » Fri Nov 13, 2009 5:42 pm

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

sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Invoking Author Operation programatically

Post by sijomon » Fri Nov 13, 2009 6:08 pm

Ok, that's pretty much what I thought; thanks for the confirmation.

Simon.

Post Reply