1 21 package org.jsmtpd.config; 22 23 import java.io.FileInputStream ; 24 import java.util.Properties ; 25 26 32 public class ReadConfig { 33 34 Properties props = new Properties (); 35 private static ReadConfig instance = null; 36 37 private ReadConfig() { 38 39 } 40 41 public static ReadConfig getInstance() { 42 if (instance == null) 43 instance = new ReadConfig(); 44 return instance; 45 } 46 47 52 public void loadConfig(String configFile) throws ConfigErrorException { 53 try { 54 props.load(new FileInputStream (configFile)); 55 } catch (Exception e) { 56 throw new ConfigErrorException(e); 57 } 58 } 59 60 63 public String getVersion() { 64 return (props.getProperty("version", "NA")); 65 } 66 67 70 public int getRPort() { 71 return Integer.parseInt(props.getProperty("rPort", "25").trim()); 72 } 73 74 77 public int getRMaxInstances() { 78 return Integer.parseInt(props.getProperty("rMaxInstances", "10").trim()); 79 } 80 81 85 public String getTempPath() { 86 return props.getProperty("temporaryFolder", "tmp/"); 87 } 88 89 92 public int getMaxTemporarySize() { 93 return Integer.parseInt(props.getProperty("maxTemporarySize", "1024").trim()); 94 } 95 96 100 public int getMaxMessageSize() { 101 return Integer.parseInt(props.getProperty("maxMessageSize", "10").trim()); 102 } 103 104 108 public int getConnectionTimeout() { 109 return Integer.parseInt(props.getProperty("connectionTimeout", "20").trim()); 110 } 111 112 115 public String getLocalDomain() { 116 return props.getProperty("localHost", "taldius.ath.cxx").trim(); 117 } 118 119 122 public int getDMaxInstances() { 123 return Integer.parseInt(props.getProperty("dMaxInstances", "10").trim()); 124 } 125 126 130 public boolean getSafeMode() { 131 if (props.getProperty("safeMode", "on").trim().equals("on")) 132 return true; 133 return false; 134 } 135 136 140 public String getSafeModePath() { 141 return props.getProperty("safeModeFolder", "safeModeFolder/"); 142 } 143 146 public int getMaxRetries() { 147 return Integer.parseInt(props.getProperty("dNumRetry", "48").trim()); 148 } 149 152 public int getDelayRetry() { 153 return Integer.parseInt(props.getProperty("dDelayRetry", "30").trim()); 154 } 155 156 public String getSyslog() { 157 return props.getProperty("syslogServer", ""); 158 } 159 public int getMaxRcpt () { 160 return Integer.parseInt(props.getProperty("maxRcpt","100")); 161 } 162 } | Popular Tags |