/**
   * Creates the generated script file.
   *
   * @return the string
   * @throws Exception the exception
   */
  public String createGeneratedScriptFile() throws Exception {
    // this is the method called when generating the actual script
    // to execute. we will construct the maps for types and length
    // here and pass them. Fix for ordering issue found 11/11/13
    // in which the fields in the stream were ordered differently
    // than in the field table, leading to incorrect typing.
    Map<String, Integer> inputFieldTypes = new HashMap<String, Integer>();
    Map<String, Integer> inputFieldLength = new HashMap<String, Integer>();

    for (int i = 0; i < parent.getInputRowMeta().size(); i++) {
      inputFieldTypes.put(
          parent.getInputRowMeta().getValueMeta(i).getName(),
          parent.getInputRowMeta().getValueMeta(i).getType());
      inputFieldLength.put(
          parent.getInputRowMeta().getValueMeta(i).getName(),
          parent.getInputRowMeta().getValueMeta(i).getLength());
    }
    return createGeneratedScriptFile(inputFieldTypes, inputFieldLength);
  }
 /**
  * Creates the from existing script file.
  *
  * @throws Exception the exception
  */
 public void createFromExistingScriptFile() throws Exception {
   FileInputStream originalScript = new FileInputStream(this.meta.getExistingScriptFile());
   DataInputStream in = new DataInputStream(originalScript);
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
   String strLine;
   while ((strLine = br.readLine()) != null) {
     if (this.meta.getSubstituteControlFile()) {
       scriptFilePrintStream.print(parent.environmentSubstitute(strLine) + "\n");
     } else {
       scriptFilePrintStream.print(strLine + "\n");
     }
   }
   // Close the input stream
   in.close();
 }
 /**
  * Resolve file name.
  *
  * @param fileName the filename to resolve. may contain Kettle Environment variables.
  * @return the data file name.
  * @throws KettleException the kettle exception
  */
 @SuppressWarnings("unused")
 private String resolveFileName(final String fileName) throws KettleException {
   final FileObject fileObject = KettleVFS.getFileObject(parent.environmentSubstitute(fileName));
   return KettleVFS.getFilename(fileObject);
 }