All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nyla.solutions.global.patterns.command.file.MacroFileCommand Maven / Gradle / Ivy

Go to download

Nyla Solutions Global Java API provides support for basic application utilities (application configuration, data encryption, debugger and text processing).

The newest version!
package nyla.solutions.global.patterns.command.file;

import java.io.File;
import java.util.Collection;
import java.util.Iterator;


import nyla.solutions.global.exception.RequiredException;

/**
 * The Macro file command
 * @author Gregory Green
 *
 */
public class MacroFileCommand implements FileCommand
{
	/**
	 * Execute the file on each given file command
	 */
	public synchronized Void execute(File file)
	{
		if(this.fileCommands == null)
			throw new RequiredException("this.fileCommands in MacroFileCommand");

		FileCommand fileCommand = null;
		for(Iterator> i = this.fileCommands.iterator();i.hasNext();)
		{
			fileCommand = i.next();
			
			fileCommand.execute(file);
		}
		
		return null;
	}//---------------------------------------------
	/**
	 * @return the fileCommands
	 */
	public synchronized Collection> getFileCommands()
	{
		return fileCommands;
	}//---------------------------------------------


	/**
	 * @param fileCommands the fileCommands to set
	 */
	public synchronized void setFileCommands(Collection> fileCommands)
	{
		this.fileCommands = fileCommands;
	}


	private Collection> fileCommands = null;
	

}