KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > coldcore > coloradoftp > command > impl > ftp > RnfrCommand


1 /**
2  * Command RNFR.
3  * See FTP spec for details on the command.
4  */

5 package com.coldcore.coloradoftp.command.impl.ftp;
6
7 import com.coldcore.coloradoftp.command.Reply;
8 import com.coldcore.coloradoftp.command.impl.AbstractCommand;
9 import com.coldcore.coloradoftp.session.Session;
10 import org.apache.log4j.Logger;
11
12 public class RnfrCommand extends AbstractCommand {
13
14   private static Logger log = Logger.getLogger(RnfrCommand.class);
15
16
17   public Reply execute() {
18     Reply reply = getReply();
19     if (!testLogin()) return reply;
20
21     Session session = controlConnection.getSession();
22     session.removeAttribute("rnfr.path");
23
24     String JavaDoc path = getParameter();
25     if (path.equals("")) {
26       reply.setCode("501");
27       reply.setText("Send path name.");
28       return reply;
29     }
30
31     session.setAttribute("rnfr.path", path);
32
33     reply.setCode("350");
34     reply.setText("Send RNTO to complete rename.");
35     return reply;
36   }
37 }
38
Popular Tags