📄 jwmasettings.java
字号:
/*** * jwma Java WebMail * Copyright (c) 2000-2003 jwma team * * jwma is free software; you can distribute and use this source * under the terms of the BSD-style license received along with * the distribution. ***/package dtw.webmail.util;import java.io.*;import java.net.*;import java.util.*;import org.apache.log4j.Logger;//import dtw.webmail.JwmaKernel;import dtw.webmail.model.*;import dtw.webmail.util.StringUtil;/** * Class implementing a wrapper for jwma's settings. * * @author Dieter Wimberger * @version 0.9.7 07/02/2003 */public class JwmaSettings { //logging private static Logger log = Logger.getLogger(JwmaSettings.class); //instance attributes private String m_WebInfDir; private File m_PropFile; private Properties m_Properties; /** * Constructs a new <tt>JwmaSettings</tt> instance. * The given path should point to the persistent settings * file. * At the moment the file is a standard properties file. * * @param path the full path of the persistent settings file. */ protected JwmaSettings(String path) { m_WebInfDir = path; }//constructor /*** Account related *************************************************/ /** * Tests if creation of accounts is enabled. * * @return true if account creation is enabled, false otherwise. */ public boolean isAccountCreationEnabled() { return (new Boolean( m_Properties.getProperty("jwma.account.creation.enabled")) .booleanValue()); }//isAccountCreationEnabled /** * Sets the flag that controls if the automatic creation of * accounts is enabled. * * @param true if account creation is enabled, false otherwise. */ public void setAccountCreationEnabled(boolean enabled) { m_Properties.setProperty("jwma.account.creation.enabled", new Boolean(enabled).toString()); }//setAccountCreationEnabled /** * Returns a <tt>String</tt> representing a JwmaKernel * view constant, denoting the view to be presented on * account creation. * * @return the account creation view key as <tt>String</tt>. */ public String getAccountCreationView() { return m_Properties.getProperty("jwma.account.creation.view"); }//getAccountCreationView /** * Sets the view key constant of the view to be presented to * the user on account creation. * * @param view the view key as <tt>String</tt>. */ public void setAccountCreationView(String view) { m_Properties.setProperty("jwma.account.creation.view", view); }//setAccountCreationView /*** End Account related *********************************************/ /*** Admin related ***************************************************/ /** * Returns a <tt>String</tt> representing a list * of usernames that have administrative rights. * * @return the list of admin's usernames as <tt>String</tt>. */ public String[] getAdminUsernames() { return StringUtil.split( m_Properties.getProperty("jwma.admin.usernames"), "," ); }//getAdminUsernames /** * Sets the admin's usernames. * * @param admins the admin's usernames as <tt>String[]</tt>. */ public void setAdminUsernames(String[] admins) { m_Properties.setProperty( "jwma.admin.usernames", StringUtil.join(admins, ",") ); }//setAdminUsername /** * Tests if accessing the system's administration is enabled. * * @return true if administration is enabled, false otherwise. */ public boolean isAdminEnabled() { return (new Boolean( m_Properties.getProperty("jwma.admin.enabled")) .booleanValue()); }//isAdminEnabled /** * Sets the flag that controls if the system's adminstration is * enabled. * * @param true if administration is enabled, false otherwise. */ public void setAdminEnabled(boolean enabled) { m_Properties.setProperty("jwma.admin.enabled", new Boolean(enabled).toString()); }//setAdminEnabled /*** End admin related ***********************************************/ /*** Controllers related *********************************************/ /** * Returns a <tt>String</tt> representing the prefix * for the controllers. * * @return the prefix for the controllers as <tt>String</tt>. */ public String getControllerPrefix() { return m_Properties.getProperty("jwma.controller.prefix"); }//getControllerPrefix /** * Sets the prefix for the controllers. * * @param prefix the prefix for the controllers as <tt>String</tt>. */ public void setControllerPrefix(String prefix) { m_Properties.setProperty("jwma.controller.prefix", prefix); }//setControllerPrefix /** * Returns a <tt>String</tt> representing the main * controller alias. * * @return the alias of the main controller as <tt>String</tt>. */ public String getMainControllerAlias() { return m_Properties.getProperty("jwma.controller.main"); }//getMainControllerAlias /** * Sets the alias for the main controller. * * @param alias the alias for the main controller as <tt>String</tt>. */ public void setMainControllerAlias(String alias) { m_Properties.setProperty("jwma.controller.main", alias); }//setMainControllerAlias /** * Returns a <tt>String</tt> representing the mailing * controller alias. * * @return the alias of the mailing controller as <tt>String</tt>. */ public String getMailingControllerAlias() { return m_Properties.getProperty("jwma.controller.mailing"); }//getMailingControllerAlias /** * Sets the alias for the mailing controller. * * @param alias the alias for the mailing controller as <tt>String</tt>. */ public void setMailingControllerAlias(String alias) { m_Properties.setProperty("jwma.controller.mailing", alias); }//setMailingControllerAlias /** * Returns a <tt>String</tt> representing the admin * controller alias. * * @return the alias of the admin controller as <tt>String</tt>. */ public String getAdminControllerAlias() { return m_Properties.getProperty("jwma.controller.admin"); }//getAdminControllerAlias /** * Sets the alias for the admin controller. * * @param alias the alias for the admin controller as <tt>String</tt>. */ public void setAdminControllerAlias(String alias) { m_Properties.setProperty("jwma.controller.admin", alias); }//setAdminControllerAlias /** * Returns a <tt>String</tt> representing the contacts * controller alias. * * @return the alias of the contacts controller as <tt>String</tt>. */ public String getContactsControllerAlias() { return m_Properties.getProperty("jwma.controller.contacts"); }//getContactsControllerAlias /** * Sets the alias for the contacts controller. * * @param alias the alias for the contacts controller as <tt>String</tt>. */ public void setContactsControllerAlias(String alias) { m_Properties.setProperty("jwma.controller.contacts", alias); }//setContactsControllerAlias /*** END Controllers related *****************************************/ /*** Postoffice related **********************************************/ /** * Returns a <tt>String</tt> representing the post office * protocol name. * * @return the postoffice protocol name as <tt>String</tt>. */ public String getPostOfficeProtocol() { return m_Properties.getProperty("jwma.postoffice.protocol"); }//getPostOfficeProtocol /** * Sets the name of the postoffice protocol. * * @param protocol the name of the postoffice protocol as <tt>String</tt>. */ public void setPostOfficeProtocol(String protocol) { m_Properties.setProperty("jwma.postoffice.protocol", protocol); }//setPostOfficeProtocol /** * Returns a <tt>String</tt> representing the postoffice's * hostname. * * @return the postoffice hostname as <tt>String</tt>. */ public String getPostOfficeHost() { return m_Properties.getProperty("jwma.postoffice.host"); }//getPostOfficeHost /** * Sets the host name of the postoffice. * * @param host the hostname of the postoffice as <tt>String</tt>. */ public void setPostOfficeHost(String host) { m_Properties.setProperty("jwma.postoffice.host", host); }//setPostOfficeHost /** * Returns an <tt>int</tt> representing the port * the postoffice is running on. * * @return the port number as <tt>int</tt>. */ public int getPostOfficePort() { return new Integer( m_Properties.getProperty("jwma.postoffice.port") ).intValue(); }//getPostOfficePort /** * Sets the port the postoffice is running on. * * @param the port number as <tt>int</tt>. */ public void setPostOfficePort(int num) { m_Properties.setProperty( "jwma.postoffice.port", new Integer(num).toString() ); }//setPostOfficePort /** * Returns a <tt>String</tt> representing the postoffice's * type. * <ul> * <li>mixed: folders in the store can hold folders and files.</li> * <li>plain: folders in the store can hold only folders or messages.</li> * <li>auto: folder types are checked by jwma</li> * <ul> * Note that in jwma terminology the folder that can only hold messages * is called a <tt>mailbox</tt> * * @return the postoffice type as <tt>String</tt>. */ public String getPostOfficeType() { return m_Properties.getProperty("jwma.postoffice.type"); }//getPostOfficeType /** * Sets the type of the postoffice. * * @param type the type of the postoffice as <tt>String</tt>. */ public void setPostOfficeType(String type) { m_Properties.setProperty("jwma.postoffice.type", type); }//setPostOfficeType /** * Tests if overriding the system's set postoffice is allowed. * * @return true if overriding is allowed, false otherwise. */ public boolean getPostOfficeAllowOverride() { return (new Boolean( m_Properties.getProperty("jwma.postoffice.allowoverride")) .booleanValue()); }//getPostOfficeAllowOverride /** * Sets the flag that controls if overriding the system's set postoffice * is allowed or not. * * @param true if the overriding is to be allowed, false otherwise. */ public void setPostOfficeAllowOverride(boolean allowoverride) { m_Properties.setProperty("jwma.postoffice.allowoverride", new Boolean(allowoverride).toString()); }//setPostOfficeAllowOverride /** * Tests if the connection to the postoffice should be secure. * * @return true if secure, false otherwise. */ public boolean isPostOfficeSecure() { return (new Boolean( m_Properties.getProperty("jwma.postoffice.secure")) .booleanValue()); }//isPostOfficeSecure /** * Sets the flag that controls if connections to the MTA * should be secure. * * @param true if secure, false otherwise. */ public void setPostOfficeSecure(boolean b) { m_Properties.setProperty( "jwma.postoffice.secure", new Boolean(b).toString() ); }//setPostOfficeSecure /** * Returns a <tt>String</tt> representing the * fully qualified class name of the secure socket factory * to be used for secure connections to the postoffice. * * @return the secure socket factory classname as <tt>String</tt>. */ public String getPostOfficeSecureSocketFactory() { return m_Properties.getProperty("jwma.postoffice.securesocketfactory"); }//getPostOfficeSecureSocketFactory /** * Sets the fully qualified class name of the secure socket * factory to be used for secure connections to the postoffice. * * @param classname of the factory as <tt>String</tt>. */ public void setPostSecureFactory(String factory) { m_Properties.setProperty("jwma.postoffice.securesocketfactory", factory); }//setPostOfficeSecureSocketFactory /*** END Postoffice related ******************************************/ /*** Mail transport related ******************************************/ /** * Returns a <tt>String</tt> representing the mail transport * protocol name.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -