<commit_before>/**
 * 
 */
package net.sf.taverna.t2.activities.externaltool.local;

import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;

import org.jdom.Element;
import org.jdom.Text;

import de.uni_luebeck.inb.knowarc.usecases.invocation.local.LocalUseCaseInvocation;

/**
 * @author alanrw
 *
 */
public class ExternalToolLocalInvocationMechanism extends
		InvocationMechanism {
	
	private String directory;
	
	private String shellPrefix;
	
	private String linkCommand;
	
	/**
	 * 
	 */
	public ExternalToolLocalInvocationMechanism() {
		super();
		String os = System.getProperty("os.name");
		if (!os.startsWith("Windows")) {
			setShellPrefix(UNIX_SHELL);
			setLinkCommand(UNIX_LINK);
		}
	}

	@Override
	public String getType() {
		return LocalUseCaseInvocation.LOCAL_USE_CASE_INVOCATION_TYPE;
	}

	@Override
	public Element getXMLElement() {
		Element result = new Element("localInvocation");
		if ((directory != null) && !directory.isEmpty()){
			Element directoryElement = new Element("directory");
			directoryElement.addContent(new Text(directory));
			result.addContent(directoryElement);
		}
		if ((shellPrefix != null) && !shellPrefix.isEmpty()) {
			Element shellPrefixElement = new Element("shellPrefix");
			shellPrefixElement.addContent(new Text(shellPrefix));
			result.addContent(shellPrefixElement);
		}
		if ((linkCommand != null) && !linkCommand.isEmpty()) {
			Element linkCommandElement = new Element("linkCommand");
			linkCommandElement.addContent(new Text(linkCommand));
			result.addContent(linkCommandElement);
		}
		return result;
	}


	/**
	 * @return the directory
	 */
	public String getDirectory() {
		return directory;
	}

	/**
	 * @param directory the directory to set
	 */
	public void setDirectory(String directory) {
		this.directory = directory;
	}

	/**
	 * @return the shellPrefix
	 */
	public String getShellPrefix() {
		return shellPrefix;
	}

	/**
	 * @param shellPrefix the shellPrefix to set
	 */
	public void setShellPrefix(String shellPrefix) {
		this.shellPrefix = shellPrefix;
	}

	/**
	 * @return the linkCommand
	 */
	public String getLinkCommand() {
		return linkCommand;
	}

	/**
	 * @param linkCommand the linkCommand to set
	 */
	public void setLinkCommand(String linkCommand) {
		if (linkCommand.isEmpty()) {<commit_msg>Fix for T2-1945 NullPointerException for link command<commit_after>/**
 * 
 */
package net.sf.taverna.t2.activities.externaltool.local;

import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;

import org.jdom.Element;
import org.jdom.Text;

import de.uni_luebeck.inb.knowarc.usecases.invocation.local.LocalUseCaseInvocation;

/**
 * @author alanrw
 *
 */
public class ExternalToolLocalInvocationMechanism extends
		InvocationMechanism {
	
	private String directory;
	
	private String shellPrefix;
	
	private String linkCommand;
	
	/**
	 * 
	 */
	public ExternalToolLocalInvocationMechanism() {
		super();
		String os = System.getProperty("os.name");
		if (!os.startsWith("Windows")) {
			setShellPrefix(UNIX_SHELL);
			setLinkCommand(UNIX_LINK);
		}
	}

	@Override
	public String getType() {
		return LocalUseCaseInvocation.LOCAL_USE_CASE_INVOCATION_TYPE;
	}

	@Override
	public Element getXMLElement() {
		Element result = new Element("localInvocation");
		if ((directory != null) && !directory.isEmpty()){
			Element directoryElement = new Element("directory");
			directoryElement.addContent(new Text(directory));
			result.addContent(directoryElement);
		}
		if ((shellPrefix != null) && !shellPrefix.isEmpty()) {
			Element shellPrefixElement = new Element("shellPrefix");
			shellPrefixElement.addContent(new Text(shellPrefix));
			result.addContent(shellPrefixElement);
		}
		if ((linkCommand != null) && !linkCommand.isEmpty()) {
			Element linkCommandElement = new Element("linkCommand");
			linkCommandElement.addContent(new Text(linkCommand));
			result.addContent(linkCommandElement);
		}
		return result;
	}


	/**
	 * @return the directory
	 */
	public String getDirectory() {
		return directory;
	}

	/**
	 * @param directory the directory to set
	 */
	public void setDirectory(String directory) {
		this.directory = directory;
	}

	/**
	 * @return the shellPrefix
	 */
	public String getShellPrefix() {
		return shellPrefix;
	}

	/**
	 * @param shellPrefix the shellPrefix to set
	 */
	public void setShellPrefix(String shellPrefix) {
		this.shellPrefix = shellPrefix;
	}

	/**
	 * @return the linkCommand
	 */
	public String getLinkCommand() {
		return linkCommand;
	}

	/**
	 * @param linkCommand the linkCommand to set
	 */
	public void setLinkCommand(String linkCommand) {
	    if ((linkCommand == null) || linkCommand.isEmpty()) {
{'fraction_non_alphanumeric': 0.11944444444444445, 'fraction_numerical': 0.0019230769230769232, 'mean_word_length': 4.3866513233601845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '382348', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1403, 'n_words': 300}