title: How to Fetch All Parameters in 'User Defined Java Class' Step in Pentaho Data Integration (Kettle)
body: <p><strong>Scenario:</strong>
  I am creating a Transformation in PDI. This transformation Has a Step 'User Defined Java Class', In which I am calling an external library.<br>
  This Transformation have'parameters' and for now, I have to fetch all parameters <strong><em>individually</em></strong> to pass to use them in this step (passing to my external jar)like this:</p>
  
  <pre><code>PgSqlHost = getVariable("PostgresHost"); 
  PgSqlPort = getVariable("PgSqlPort"); 
  PgSqlLoginUserId = getVariable("PgSqlLoginUserId"); 
  PgSqlLoginPassword = getVariable("PgSqlLoginPassword");
  </code></pre>
  
  <p>There are 50-60 params like these that I have to use in this step. and I have to fetch each of them individually and pass it to external java lib like this.</p>
  
  <pre><code>TransformationParameters tparams= new TransformationParameters();
  tparams.PgSqlHost = PgSqlHost;
  tparams.PgSqlPort = Integer.parseInt(PgSqlPort);
  tparams.PgSqlLoginUserId = PgSqlLoginUserId;
  tparams.PgSqlLoginPassword = PgSqlLoginPassword;
  Configuration config =  ConfigurationReader.getConfiguration();
  config.setParameters(tparams);
  </code></pre>
  
  <p>The problem with this approach is:</p>
  
  <ol>
  <li>I have to fetch all parameters individually.</li>
  <li>When Adding new parameter I have to handle modify this step in all transformations</li>
  </ol>
  
  <p><strong>My question:</strong>
  Is there a way to fetch all parameters something just like this:</p>
  
  <pre><code>HashMap&lt;K,V&gt; params = getAllVariables();
  Configuration config =  ConfigurationReader.getConfiguration();
  config.setParametersMap(tparams);
  </code></pre>
  
  <p><strong>What I tried:</strong></p>
  
  <ol>
  <li><p>I tried searching in Pentaho <a href="http://wiki.pentaho.com/display/EAI/User+Defined+Java+Class" rel="nofollow noreferrer">Wiki</a> &amp; This <a href="http://forums.pentaho.com/showthread.php?80903-Using-Variables-in-User-Defined-Java-Class" rel="nofollow noreferrer">thread</a> in Forums,
  But found nothing close.</p></li>
  <li><p>I could add a step to write those params to a .properties file and
  read those in my external jar.</p></li>
  </ol>
  
  <p>Can someone suggest a better idea to achieve this?
  Thanks.</p>