gt: 				waitingToFinish = "Y".equalsIgnoreCase(wait);
context: /* Copyright (c) 2007 Pentaho Corporation.  All rights reserved. 
   * This software was developed by Pentaho Corporation and is provided under the terms 
   * of the GNU Lesser General Public License, Version 2.1. You may not use 
   * this file except in compliance with the license. If you need a copy of the license, 
   * please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is Pentaho 
   * Data Integration.  The Initial Developer is Pentaho Corporation.
   *
   * Software distributed under the GNU Lesser Public License is distributed on an "AS IS" 
   * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
   * the license for the specific language governing your rights and limitations.*/
  
  package com.panet.imeta.job.entries.trans;
  
  import static com.panet.imeta.job.entry.validator.AndValidator.putValidators;
  import static com.panet.imeta.job.entry.validator.JobEntryValidatorUtils.andValidator;
  import static com.panet.imeta.job.entry.validator.JobEntryValidatorUtils.notBlankValidator;
  import static com.panet.imeta.job.entry.validator.JobEntryValidatorUtils.notNullValidator;
  
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Calendar;
  import java.util.List;
  import java.util.Map;
  
  import org.w3c.dom.Node;
  
  import com.panet.imeta.cluster.SlaveServer;
  import com.panet.imeta.core.CheckResultInterface;
  import com.panet.imeta.core.Const;
  import com.panet.imeta.core.Result;
  import com.panet.imeta.core.ResultFile;
  import com.panet.imeta.core.RowMetaAndData;
  import com.panet.imeta.core.SQLStatement;
  import com.panet.imeta.core.database.Database;
  import com.panet.imeta.core.database.DatabaseMeta;
  import com.panet.imeta.core.exception.KettleDatabaseException;
  import com.panet.imeta.core.exception.KettleException;
  import com.panet.imeta.core.exception.KettleJobException;
  import com.panet.imeta.core.exception.KettleXMLException;
  import com.panet.imeta.core.logging.Log4jFileAppender;
  import com.panet.imeta.core.logging.LogWriter;
  import com.panet.imeta.core.parameters.NamedParams;
  import com.panet.imeta.core.parameters.NamedParamsDefault;
  import com.panet.imeta.core.variables.VariableSpace;
  import com.panet.imeta.core.vfs.KettleVFS;
  import com.panet.imeta.core.xml.XMLHandler;
  import com.panet.imeta.job.Job;
  import com.panet.imeta.job.JobEntryCategory;
  import com.panet.imeta.job.JobEntryType;
  import com.panet.imeta.job.JobMeta;
  import com.panet.imeta.job.entry.JobEntryBase;
  import com.panet.imeta.job.entry.JobEntryInterface;
  import com.panet.imeta.repository.Repository;
  import com.panet.imeta.resource.ResourceDefinition;
  import com.panet.imeta.resource.ResourceEntry;
  import com.panet.imeta.resource.ResourceNamingInterface;
  import com.panet.imeta.resource.ResourceReference;
  import com.panet.imeta.resource.ResourceEntry.ResourceType;
  import com.panet.imeta.shared.SharedObjectInterface;
  import com.panet.imeta.trans.Trans;
  import com.panet.imeta.trans.TransExecutionConfiguration;
  import com.panet.imeta.trans.TransMeta;
  import com.panet.imeta.trans.cluster.TransSplitter;
  import com.panet.imeta.www.SlaveServerTransStatus;
  
  /**
   * This is the job entry that defines a transformation to be run.
   * 
   * @author Matt
   * @since 1-10-2003, rewritten on 18-06-2004
   * 
   */
  @com.panet.imeta.core.annotations.Job(image = "TRN.png", id = "TRANS", type = JobEntryType.TRANS, tooltip = "JobEntry.Trans.Tooltip", category = JobEntryCategory.CATEGORY_GENERAL)
  public class JobEntryTrans extends JobEntryBase implements Cloneable,
  		JobEntryInterface {
  	private String transname;
  	private String filename;
  	private String directory;
  
  	public String arguments[];
  	public boolean argFromPrevious;
  	public boolean paramsFromPrevious;
  	public boolean execPerRow;
  
  	public String parameters[];
  	public String parameterFieldNames[];
  	public String parameterValues[];
  
  	public boolean clearResultRows;
  	public boolean clearResultFiles;
  
  	public boolean setLogfile;
  	public boolean setAppendLogfile;
  	public String logfile, logext;
  	public boolean addDate, addTime;
  	public int loglevel;
  
  	private String directoryPath;
  
  	private boolean clustering;
  
  	public boolean waitingToFinish = true;
  	public boolean followingAbortRemotely;
  
  	private String remoteSlaveServerName;
  	public boolean passingAllParameters = true;
  
  	public JobEntryTrans(String name) {
  		super(name, "");
  		setJobEntryType(JobEntryType.TRANS);
  	}
  
  	public JobEntryTrans() {
  		this("");
  		clear();
  	}
  
  	public Object clone() {
  		JobEntryTrans je = (JobEntryTrans) super.clone();
  		return je;
  	}
  
  	public JobEntryTrans(JobEntryBase jeb) {
  		super(jeb);
  	}
  
  	public void setFileName(String n) {
  		filename = n;
  	}
  
  	/**
  	 * @deprecated use getFilename() instead
  	 * @return the filename
  	 */
  	public String getFileName() {
  		return filename;
  	}
  
  	public String getFilename() {
  		return filename;
  	}
  
  	public String getRealFilename() {
  		return environmentSubstitute(getFilename());
  	}
  
  	public void setTransname(String transname) {
  		this.transname = transname;
  	}
  
  	public String getTransname() {
  		return transname;
  	}
  
  	public String getDirectory() {
  		return directory;
  	}
  
  	public void setDirectory(String directory) {
  		this.directory = directory;
  	}
  
  	public String getLogFilename() {
  		String retval = "";
  		if (setLogfile) {
  			retval += logfile;
  			Calendar cal = Calendar.getInstance();
  			if (addDate) {
  				SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
  				retval += "_" + sdf.format(cal.getTime());
  			}
  			if (addTime) {
  				SimpleDateFormat sdf = new SimpleDateFormat("HHmmss");
  				retval += "_" + sdf.format(cal.getTime());
  			}
  			if (logext != null && logext.length() > 0) {
  				retval += "." + logext;
  			}
  		}
  		return retval;
  	}
  
  	public String getXML() {
  		StringBuffer retval = new StringBuffer(300);
  
  		retval.append(super.getXML());
  
  		retval.append("      ").append(
  				XMLHandler.addTagValue("filename", filename));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("transname", transname));
  		if (directory != null) {
  			retval.append("      ").append(
  					XMLHandler.addTagValue("directory", directory));
  		} else if (directoryPath != null) {
  			retval.append("      ").append(
  					XMLHandler.addTagValue("directory", directoryPath)); // don't
  			// loose
  			// this
  			// info
  			// (backup/recovery)
  		}
  		retval.append("      ").append(
  				XMLHandler.addTagValue("arg_from_previous", argFromPrevious));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("params_from_previous",
  						paramsFromPrevious));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("exec_per_row", execPerRow));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("clear_rows", clearResultRows));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("clear_files", clearResultFiles));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("set_logfile", setLogfile));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("logfile", logfile));
  		retval.append("      ")
  				.append(XMLHandler.addTagValue("logext", logext));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("add_date", addDate));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("add_time", addTime));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("loglevel", LogWriter
  						.getLogLevelDesc(loglevel)));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("cluster", clustering));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("slave_server_name",
  						remoteSlaveServerName));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("set_append_logfile", setAppendLogfile));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("wait_until_finished", waitingToFinish));
  		retval.append("      ").append(
  				XMLHandler.addTagValue("follow_abort_remote",
  						followingAbortRemotely));
  
  		if (arguments != null)
  			for (int i = 0; i < arguments.length; i++) {
  				retval.append("      ").append(
  						XMLHandler.addTagValue("argument" + i, arguments[i]));
  			}
  
  		if (parameters != null) {
  			retval.append("      ").append(XMLHandler.openTag("parameters"));
  
  			retval.append("        ").append(
  					XMLHandler.addTagValue("pass_all_parameters",
  							passingAllParameters));
  
  			for (int i = 0; i < parameters.length; i++) {
  				// This is a better way of making the XML file than the
  				// arguments.
  				retval.append("            ").append(
  						XMLHandler.openTag("parameter"));
  
  				retval.append("            ").append(
  						XMLHandler.addTagValue("name", parameters[i]));
  				retval.append("            ").append(
  						XMLHandler.addTagValue("stream_name",
  								parameterFieldNames[i]));
  				retval.append("            ").append(
  						XMLHandler.addTagValue("value", parameterValues[i]));
  
  				retval.append("            ").append(
  						XMLHandler.closeTag("parameter"));
  			}
  			retval.append("      ").append(XMLHandler.closeTag("parameters"));
  		}
  
  		return retval.toString();
  	}
  
  	public void loadXML(Node entrynode, List<DatabaseMeta> databases,
  			List<SlaveServer> slaveServers, Repository rep)
  			throws KettleXMLException {
  		try {
  			super.loadXML(entrynode, databases, slaveServers);
  
  			filename = XMLHandler.getTagValue(entrynode, "filename");
  			transname = XMLHandler.getTagValue(entrynode, "transname");
  
  			directory = XMLHandler.getTagValue(entrynode, "directory");
  
  			argFromPrevious = "Y".equalsIgnoreCase(XMLHandler.getTagValue(
  					entrynode, "arg_from_previous"));
  			paramsFromPrevious = "Y".equalsIgnoreCase(XMLHandler.getTagValue(
  					entrynode, "params_from_previous"));
  			execPerRow = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode,
  					"exec_per_row"));
  			clearResultRows = "Y".equalsIgnoreCase(XMLHandler.getTagValue(
  					entrynode, "clear_rows"));
  			clearResultFiles = "Y".equalsIgnoreCase(XMLHandler.getTagValue(
  					entrynode, "clear_files"));
  			setLogfile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode,
  					"set_logfile"));
  			addDate = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode,
  					"add_date"));
  			addTime = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode,
  					"add_time"));
  			logfile = XMLHandler.getTagValue(entrynode, "logfile");
  			logext = XMLHandler.getTagValue(entrynode, "logext");
  			loglevel = LogWriter.getLogLevel(XMLHandler.getTagValue(entrynode,
  					"loglevel"));
  			clustering = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode,
  					"cluster"));
  
  			remoteSlaveServerName = XMLHandler.getTagValue(entrynode,
  					"slave_server_name");
  
  			setAppendLogfile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(
  					entrynode, "set_append_logfile"));
  			String wait = XMLHandler.getTagValue(entrynode,
  					"wait_until_finished");
  			if (Const.isEmpty(wait))
  				waitingToFinish = true;
  			else
  