ruper2/src/java/ant/org/krysalis/ruper2/ant/task SynchronizeTask.java,NONE,1.1

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/java/ant/org/krysalis/ruper2/ant/task
In directory sc8-pr-cvs1:/tmp/cvs-serv30481/src/java/ant/org/krysalis/ruper2/ant/task

Added Files:
	SynchronizeTask.java 
Log Message:
Avoid clash with existing Ruper...

--- NEW FILE: SynchronizeTask.java ---
/*
 * Created on Sep 9, 2003
 */
package org.krysalis.ruper2.ant.task;

import java.io.File;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.krysalis.ruper2.RuperException;
import org.krysalis.ruper2.ant.util.AntLogListener;
import org.krysalis.ruper2.api.tool.FileUpdater;
import org.krysalis.ruper2.log.Logger;
import org.krysalis.ruper2.util.RuperConstants;

/**
 * @author ajack
 */
public class SynchronizeTask extends Task {

	private File m_file = null;
	private String m_ruper = RuperConstants.DEFAULT;
	private String m_repositories = RuperConstants.DEFAULT;

	/**
	 * @param file
	 */
	public void setFile(File file) {
		m_file = file;
	}

	/**
	 * @param string
	 */
	public void setRepositories(String string) {
		m_repositories = string;
	}

	/**
	 * @param string
	 */
	public void setRuper(String string) {
		m_ruper = string;
	}

	/* (non-Javadoc)
	 * @see org.apache.tools.ant.Task#execute()
	 */
	public void execute() throws BuildException {

		log("Execute Synchronize...");

		// Set logging context..
		Logger logger = Logger.pushContext(new AntLogListener(this));

		try {
			//
			// This uses default or configured stuff..
			//
			FileUpdater updater = new FileUpdater(m_ruper, m_repositories);

			if (null == m_file)
				throw new BuildException("Missing mandatory attribute 'file'");

			log("Update File: " + m_file, Project.MSG_INFO);

			// Update all files [if folder], or one file
			updater.updateFiles(m_file);
		}
		catch (RuperException re) {
			throw new BuildException("Failed to <synchronize " + m_file, re);
		}
		finally {
			Logger.popContext(logger);
		}
	}
}




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.