/*
 * @(#)FxpStor.java
 *
 * Copyright (c) 2004 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
package com.jscape.inet.ftp;


/**
 * Responsible for storing file to destination server.
 */
public class FxpStor
        extends Thread {

    private Fxp fxp;
    private Ftp source;
    private Ftp dest;
    private String filename;

    /**
     * Create new FxpStore instance
     *
     * @param fxp
     * @param source
     * @param dest
     * @param filename
     */
    public FxpStor(Fxp fxp, Ftp source, Ftp dest, String filename) {
        super();
        this.fxp = fxp;
        this.source = source;
        this.dest = dest;
        this.filename = filename;
    }

    /**
     * Runs command
     */
    public void run() {
        try {
            dest.issueCommand("STOR " + filename);
        } catch (Exception e) {
            fxp.fireFxpFailed(source, dest, filename, e);
        }
    }
}
