001 package org.shiftone.jrat.inject.process;
002
003
004 import org.shiftone.jrat.core.JRatException;
005 import org.shiftone.jrat.inject.bytecode.Transformer;
006 import org.shiftone.jrat.util.io.IOUtil;
007 import org.shiftone.jrat.util.log.Logger;
008
009 import java.io.File;
010
011
012 /**
013 * @author jeff@shiftone.org (Jeff Drost)
014 */
015 public class CopyFileProcessor extends AbstractFileProcessor {
016
017 private static final Logger LOG = Logger.getLogger(CopyFileProcessor.class);
018
019 public void processFile(Transformer transformer, File source, File target) {
020
021 try {
022 File s = source.getCanonicalFile();
023 File t = target.getCanonicalFile();
024
025 if (!s.equals(t)) {
026 IOUtil.copy(source, target);
027 }
028 }
029 catch (Exception e) {
030 throw new JRatException("unable to copy to : " + target, e);
031 }
032 }
033 }