1 18 package org.drftpd.commands; 19 20 import java.util.Collection ; 21 import java.util.Iterator ; 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 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 sections = conn.getConnectionManager().getSectionManager().getSections(); 45 ReplacerEnvironment env = new ReplacerEnvironment(); 46 for (Iterator 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 [] getFeatReplies() { 60 return null; 61 } 62 63 public void load(CommandManagerFactory initializer) { 64 } 65 66 public void unload() { 67 } 68 69 } 70 | Popular Tags |