Scala – External Config File

Reusing the existing Config XML that is referred by Pentaho Data Integration Tool

 

nag_config.xml

 

<params>

<param0 property1=”value-01″></param0>

<param1 property2=”value-02″></param1>

</params>

 

 

MainJob.scala

 

/**
* Created by Nag Arvind Gudiseva on 07-Apr-2016.
*/
object MainJob extends App {

 

val xml = XML.loadFile(“/apps/pentaho_nfs/CUSTOMER/MODULE/input/xmls/nag_config.xml”)

 

// Set Variables
val property1 = (xml \\ “params” \\ “@property1”) text

val property2 = (xml \\ “params” \\ “@property2”) text

 

println(“*************** input_param_from_XML **********************”)

println(“property1: ” + property1)

println(“property2: ” + property2)

println(“********************* [End] ****************************”)

 

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s