1 19 20 21 22 package org.apache.james.remotemanager; 23 24 import org.apache.avalon.framework.configuration.DefaultConfiguration; 25 import org.apache.james.test.util.Util; 26 27 public class RemoteManagerTestConfiguration extends DefaultConfiguration { 28 29 private int m_remoteManagerListenerPort; 30 private Integer m_connectionLimit = null; 31 private String m_loginName = "testLogin"; 32 private String m_loginPassword = "testPassword"; 33 private String commandClassName = "org.apache.james.remotemanager.EchoCommand"; 34 35 public RemoteManagerTestConfiguration(int smtpListenerPort) { 36 super("smptserver"); 37 38 m_remoteManagerListenerPort = smtpListenerPort; 39 } 40 41 42 43 public String getCommandClassName() { 44 return commandClassName; 45 } 46 47 48 49 public void setCommandClassName(String commandClassName) { 50 this.commandClassName = commandClassName; 51 } 52 53 54 55 public void setConnectionLimit(int iConnectionLimit) { 56 m_connectionLimit = new Integer (iConnectionLimit); 57 } 58 59 public String getLoginName() { 60 return m_loginName; 61 } 62 63 public void setLoginName(String loginName) { 64 m_loginName = loginName; 65 } 66 67 public String getLoginPassword() { 68 return m_loginPassword; 69 } 70 71 public void setLoginPassword(String loginPassword) { 72 m_loginPassword = loginPassword; 73 } 74 75 public void init() { 76 77 setAttribute("enabled", true); 78 79 addChild(Util.getValuedConfiguration("port", "" + m_remoteManagerListenerPort)); 80 if (m_connectionLimit != null) addChild(Util.getValuedConfiguration("connectionLimit", "" + m_connectionLimit.intValue())); 81 82 DefaultConfiguration handlerConfig = new DefaultConfiguration("handler"); 83 handlerConfig.addChild(Util.getValuedConfiguration("helloName", "myMailServer")); 84 handlerConfig.addChild(Util.getValuedConfiguration("connectiontimeout", "360000")); 85 86 DefaultConfiguration adminAccounts = new DefaultConfiguration("administrator_accounts"); 87 88 DefaultConfiguration account = new DefaultConfiguration("account"); 89 90 account.setAttribute("login", m_loginName); 91 account.setAttribute("password", m_loginPassword); 92 93 adminAccounts.addChild(account); 94 handlerConfig.addChild(adminAccounts); 95 96 98 handlerConfig.addChild(Util.createRemoteManagerHandlerChainConfiguration()); 99 addChild(handlerConfig); 100 101 DefaultConfiguration commandConfiguration = new DefaultConfiguration("command"); 102 commandConfiguration.addChild(Util.getValuedConfiguration("class-name", commandClassName)); 103 104 addChild(commandConfiguration); 105 } 106 107 } 108 | Popular Tags |