Versions Compared

Key

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

...

A system action is simply an action sequence that is configured to run either at system start time (i.e. when the application server starts) or session start time (i.e. when the user logs in). The output of a system action is available to other action sequences as input parameters. System actions are configured by adding the appropriate child elements to the <system-action> element in the pentaho.xml file.

Note
titleWhen do System Actions configured to run at global scope really run?

In order to reduce the amount of time it takes to start the platform, System Actions configured to run at global scope are run in a lazy manner. The platform postpones running the global System Actions until it absolutely has to run them. It has to run them when the first user session is initiated. When the first user session is initiated, all of the global System Actions run, and then all of the session System Actions run. When the second and following user sessions are initiated, only the session System Actions run.

...

The first step in configuring a system action is to locate and edit the pentaho.xml. In the Pentaho Preconfigured Install, the pentaho.xml file is located in the pentaho-demo/system folder.

You configure a system action by adding information about your action sequence to the <system-action> node of the pentaho.xml file. For instance, if your action sequence is called usernameToRegion

Configuring System Actions
Anchor
Configuring System Actions
Configuring System Actions

The first step in configuring a system action is to locate and edit the sessionStartupActions.xml. sessionStartupActions.xml is located in pentaho-solutions/system folder.

Assume your action sequence is called session-region-list.xaction, it exists in the repository under samplesbi-developers/filtersrules, you want the action sequence to run when the user logs in, with the output placed in session scope, and you want the output of the action sequence to be available in a portlet, you would write this xml element:

...


<org.pentaho.ui.portlet.PentahoPortletSession scope="session">
   samples/filters/usernameToRegion.xaction
</org.pentaho.ui.portlet.PentahoPortletSession>

and place it inside the <system-action> node in the pentaho.xml file.

As another example, suppose your action sequence is called setCompanyNameservlet, your addition to sessionStartupActions.xml would look like this:

Code Block
xml
xml

<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">
  <property name="sessionType" value="org.pentaho.platform.web.http.session.PentahoHttpSession"/>
  <property name="actionPath" value="bi-developers/rules/session-region-list.xaction"/>
  <property name="actionOutputScope" value="session"/>
</bean>

For another example, assume your action sequence is called global-department-list.xaction, it exists in the repository under samplesbi-developers/filterssecure, you want the action sequence to run when the system starts up with the output placed in global scope, and you want the output of the action sequence to be available in a Servlet/jsp, you would write this xml elementportlet, your addition to sessionStartupActions.xml would look like this:

Code Block

<org.pentaho.core.session.PentahoHttpSession scope="global">
   samples/filters/setCompanyName.xaction
</org.pentaho.core.session.PentahoHttpSession>
<bean class="org.pentaho.platform.engine.core.system.SessionStartupAction">
  <property name="sessionType" value="org.pentaho.platform.web.portal.PentahoPortletSession"/>
  <property name="actionPath" value="bi-developers/secure/global-department-list.xaction"/>
  <property name="actionOutputScope" value="global"/>
</bean>
Info
titleLet's Break it Down

Let's break it down a bit using the previous examples.

  • We make the output of the action sequence available to portlets by creating the XML element <org.pentaho.ui.portlet.PentahoPortletSession>.
  • We make the output of the action sequence available to servlets/jsps by creating the XML element <org.pentaho.core.session.PentahoHttpSession>.
  • We make the action sequence run at system start time and make output available in global scope by adding the scope="global" attribute to our element.
  • We make the action sequence run at session start time and make output available in session scope by adding the scope="session" attribute to our element.
  • We identify the name and location of our action sequence by adding samples/filters/setCompanyName.xaction as a child text node of our xml element.

...