...
- IAction - advertises that your bean has something to do and gives the platform's solution engine a method to execute. This is the API that identifies your bean an Action.
- IStreamingAction - indicates that your bean accepts output streams managed by action sequence content outputs, such as a ServletResponse output stream. You would implement this if you intended to write to such an output stream during execution.
- ILoggingAction - if your bean implements this, it will be provided a logger instance to which it can write errors, warnings, and debug messages.
- ISessionAwareAction - supplies your bean with an instance of the current Pentaho session
- IVarArgsAction - Allows an Action to accept inputs from the action sequence that are unspecified by the Action
- itself
- IDefinitionAwareAction - Makes an Action privy to certain details about the action definition that is responsible for executing it
- IPreProcessingAction - Allows an Action to do some preliminary work prior to execution
...
Action Execution
As we mentioned earlier, the heart of the Action framework is it's ability to do some work, thus, the IAction.execute() API. The only interface your Action bean is required to implement is the IAction interface which specifies only a single method, "execute()". All the other interfaces listed in intro section above are just there to provide either your Action bean or the Action framework with additional context about this execution.
Action Validation
There are two stages in which we speak of validation. The first is during the action sequence validation stage which is prior to execution. The intent at this stage is to "check the wiring", i.e. to see that all expected inputs and outputs are declared in the action sequence. You can think of this as a static type of validation, vs runtime validation. In the IComponent framework, this kind of validation was performed by invoking a validate method on an IComponent. Given that part of the intent of the Action framework is to minimize the coupling of an Action bean with the Pentaho BI Platform, we provide explicit APIs to allow your Action bean to become "aware" of the context in which it is being used, namely, it can become aware that it is running in an action sequence. For more information, see the javadoc for IDefinitionAwareAction and IPreProcessingAction.
The second stage, runtime validation, is handled by you the Action bean writer. If you want runtime validation, then just implement it before you do anything else in your execute() method. It is highly recommended that you throw an execption when something goes wrong in execute(), this includes runtime validation failure. Throwing an exception will allow the Pentaho BI Platform to report meaningful information as to the cause of action sequence failure.
Action IO
Actions, as full-fledged Components, can participate in action sequences and can be provided inputs and resources by the typical means, as defined in xaction solution files. There is an important distinction in the way that these parameters are obtained in Components versus in Actions. While developing a Component, you will need to essentially go and mine out the parameters and values you need from within various internal APIs. Actions are the inverse. The Action framework will determine what inputs you desire and hand them right to you by way of a setter method (see Java bean specification).
...
xaction resource | Java type | expected Action bean method (Java) |
---|---|---|
<myResource type="resource"/> | java.io.InputStream | setMyResource(InputStream o) { ... |
|
|
The Execute API
...