Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

..this page is under construction and will be completed shortlyIf you want to write some code that make the Pentaho BI Platform talk to an external system, this may be what you are looking for, so read on...

Intro

Actions are the lightweight alternative to Pentaho BI Components.  For an understanding of how and why they are different, let's take a step back and examine what a BI Component is and how it is used.  A BI Component is historically a Java class that does some work, yielding some output, when it is provided certain inputs and resources.  The work done as well as the inputs and resources required are entirely up to the component developer.  It's purpose is to perform some work in a sequential success-based workflow (action sequence).  A saavy BI Platform user with a bit of inclination for Java coding can implement his or her own custom component to do just about anything.  However, this is not an easy endevour since developing your own BI Component requires intimate knowledge of internal Pentaho APIs.  When you are done writing your custom component, the code you have written will be tightly coupled to the Pentaho BI Platform, so much so, that it will be difficult to unit test and may be difficult to maintain.

...

xaction input

Java type

expected Action bean method (Java)
(all methods start with 'public void')

<myInput type="string">

java.lang.String

setMyInput(String s) { ...

<myInput type="long">

java.lang.Long

setMyInput(Long n) { ...

<myInputMap type="property-map">

java.util.Map<java.lang.String, java.lang.String>

setMyInputMap(Map<String, String> m) { ...

<myInputListMap type="property-map-list">

java.util.List<java.util.Map<java.lang.String, java.lang.String>>

setMyInputListMap(List<Map<String, String>> l) { ...

<myInputList type="string-list">

java.util.List<java.lang.String>

setMyInputList(List<String> l) { ...

<myInput> (no type specified)

In this case, the Action framework does not know the type and will try to convert the data to the type specified in your Action's setter method.  If the conversion fails, you will see a warning to this effect.

setMyInput(Object o),
or
 setMyInput(SomeOtherType t) //of course this will only work if the data can be cast to a SomeOtherType type

 

 

 

Outputs

...

xaction output

...

Java type

...

expected Action bean method (Java)

...

<myOutput type="content"/>

...

java.io.OutputStream

...

public void setMyOutputStream(OutputStream o)(star)
{ ...

...

 

...

 

(star) Note the At the end of a step in an action sequence, the Action framework will attempt to retrieve data from your Action bean per the action-outputs section of the action definition. The framework will loop through the listed outputs and set them to the appropriate context. A discussion about the "appropriate" context is out of scope here, but suffice it to say the output data will be stored in a session-like structure and will be made accessible if you should chose to bind it to the input of a subsequent step, or bound in a way that will direct the data to the user for viewing or to a data sync such as a file.  You will notice that the type attribute is not required for action outputs, other than the special case "content" type which behaves very differently from other outputs.

The content type output is treated like an input since the presence of a content type implies that your Action bean intends to write to a pre-existing data stream. This pre-existing stream is retrieved by the Action framework code and passed to your Action bean as a java.io.OuputStream prior to your Action bean executing.

xaction output

Java type

expected Action bean method (Java)

<myOutput> (no type specified)

user specified

public SomeType getMyOutput() { ...

<myOutput type="content"/>

java.io.OutputStream

public void setMyOutputStream(OutputStream o)
{ ...

Resources

xaction resource

Java type

expected Action bean method (Java)

<myResource type="resource"/>

java.io.InputStream

setMyResource(InputStream o) { ...

 

 


...