import org.apache.commons.cli.ParseException;
public class Config {
+ private static final String DB_HOST = "db.host";
+ private static final String DB_NAME = "db.name";
+ private static final String DB_PASS = "db.pass";
+ private static final String DB_PORT = "db.port";
+ private static final String DB_USER = "db.user";
private static final String FINDBUGS_HOME = "FindBugsHome";
private static final String MAIL_FROM = "mail.from";
private static final String MAIL_SMTP_HOST = "mail.smtp.host";
public String getMailSmtpHost() { return m_mailSmtpHost; }
public ArrayList<String> getNotify() { return new ArrayList<String>(m_notify); }
+ public String getDbHost() { return m_host; }
+ public int getDbPort() { return m_port; }
+ public String getDbName() { return m_dbName; }
+ public String getDbUser() { return m_user; }
+ public String getDbPass() { return m_pass; }
+
+ public void setDbHost(String value) { m_host = value; }
+ public void setDbPort(int value) { m_port = value; }
+ public void setDbName(String value) { m_dbName = value; }
+ public void setDbUser(String value) { m_user = value; }
+ public void setDbPass(String value) { m_pass = value; }
+
public void readFile(File configProperties) throws IOException
{
Properties props = new Properties();
}
}
+ if (props.containsKey(DB_HOST)) {
+ m_host = props.getProperty(DB_HOST);
+ }
+ if (props.containsKey(DB_NAME)) {
+ m_dbName = props.getProperty(DB_NAME);
+ }
+ if (props.containsKey(DB_PASS)) {
+ m_pass = props.getProperty(DB_PASS);
+ }
+ if (props.containsKey(DB_PORT)) {
+ m_port = Integer.parseInt(props.getProperty(DB_PORT));
+ }
+ if (props.containsKey(DB_USER)) {
+ m_user = props.getProperty(DB_USER);
+ }
if (props.containsKey(FINDBUGS_HOME)) {
m_fbDir = new File(props.getProperty(FINDBUGS_HOME));
}