Sample source transfer end user exit

/*
 * A Sample Source Transfer End Exit that prints information about a transfer to standard output.
 * If the agent is run in the background the output will be sent to the agent's event log file. If 
 * the agent is started in the foreground by specifying the -F parameter on the fteStartAgent 
 * command the output will be sent to the console.
 *    
 * To run the exit execute the following steps:
 *
 * Compile and build the exit into a jar file. You need the following in the class path:
 * {MQ_INSTALLATION_PATH}\mqft\lib\com.ibm.wmqfte.exitroutines.api.jar
 *
 * Put the jar in your agent's exits directory:
 * {MQ_DATA_PATH}\config\<coordQmgrName>\agents\<agentName>\exits\
 *
 * Update the agent's properties file:
 * {MQ_DATA_PATH}\config\<coordQmgrName>\agents\<agentName>\agent.properties
 * to include the following property:
 * sourceTransferEndExitClasses=[<packageName>.]SampleEndExit
 *
 * Restart agent to pick up the exit
 *
 * Send the agent a transfer request:
 * For example: fteCreateTransfer -sa myAgent -da YourAgent -df output.txt input.txt 
 */

import java.util.List;
import java.util.Map;
import java.util.Iterator;

import com.ibm.wmqfte.exitroutine.api.SourceTransferEndExit;
import com.ibm.wmqfte.exitroutine.api.TransferExitResult;
import com.ibm.wmqfte.exitroutine.api.FileTransferResult;

public class SampleEndExit implements SourceTransferEndExit {

	public String onSourceTransferEnd(TransferExitResult transferExitResult,
			String sourceAgentName,
			String destinationAgentName,
			Map<String, String>environmentMetaData,
			Map<String, String>transferMetaData,
			List<FileTransferResult>fileResults) {
	
		System.out.println("Environment Meta Data: " + environmentMetaData);
		System.out.println("Transfer Meta Data:    " + transferMetaData);

		System.out.println("Source agent:          " + 
				sourceAgentName);
		System.out.println("Destination agent:     " + 
				destinationAgentName);

		if (fileResults.isEmpty()) {
			System.out.println("No files in the list");
			return "No files";
		}
		else {

			System.out.println( "File list: ");  

			final Iterator<FileTransferResult> iterator = fileResults.iterator();     

			while (iterator.hasNext()){
				final FileTransferResult thisFileSpec = iterator.next();  
				System.out.println("Source file spec: "  + 
						thisFileSpec.getSourceFileSpecification() +
						", Destination file spec: " + 
						thisFileSpec.getDestinationFileSpecification());  
			}
		}
		return "Done";
	}
}