KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > drftpd > commands > Sections


1 /*
2  * This file is part of DrFTPD, Distributed FTP Daemon.
3  *
4  * DrFTPD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * DrFTPD is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with DrFTPD; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.drftpd.commands;
19
20 import java.util.Collection JavaDoc;
21 import java.util.Iterator JavaDoc;
22
23 import net.sf.drftpd.master.BaseFtpConnection;
24 import net.sf.drftpd.master.FtpReply;
25 import net.sf.drftpd.master.command.CommandHandlerBundle;
26 import net.sf.drftpd.master.command.CommandManager;
27 import net.sf.drftpd.master.command.CommandManagerFactory;
28
29 import org.drftpd.sections.SectionInterface;
30 import org.tanesha.replacer.ReplacerEnvironment;
31
32 /**
33  * @author mog
34  * @version $Id: Sections.java,v 1.2 2004/06/01 15:40:34 mog Exp $
35  */

36 public class Sections implements CommandHandlerBundle {
37
38     public Sections() {
39         super();
40     }
41
42     public FtpReply execute(BaseFtpConnection conn) throws UnhandledCommandException {
43         FtpReply reply = new FtpReply(200);
44         Collection JavaDoc sections = conn.getConnectionManager().getSectionManager().getSections();
45         ReplacerEnvironment env = new ReplacerEnvironment();
46         for (Iterator JavaDoc iter = sections.iterator(); iter.hasNext();) {
47             SectionInterface section = (SectionInterface) iter.next();
48             env.add("section", section.getName());
49             env.add("path", section.getPath());
50             reply.addComment(conn.jprintf(Sections.class, "section", env));
51         }
52         return reply;
53     }
54
55     public CommandHandler initialize(BaseFtpConnection conn, CommandManager initializer) {
56         return this;
57     }
58
59     public String JavaDoc[] getFeatReplies() {
60         return null;
61     }
62
63     public void load(CommandManagerFactory initializer) {
64     }
65
66     public void unload() {
67     }
68
69 }
70
Popular Tags