X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2FConfig.java;h=76151a7c64c3b0159ede64dddd5dc2cb26624422;hp=8aa423419ef74ab08fee0c9764124d9215ba5b72;hb=b5ed81c932db5a409f916d736fc9a8e600f8b15e;hpb=2769cf82ccae57ee3716aecc9bd694be1f115d92 diff --git a/prod/net/jaekl/cfb/Config.java b/prod/net/jaekl/cfb/Config.java index 8aa4234..76151a7 100644 --- a/prod/net/jaekl/cfb/Config.java +++ b/prod/net/jaekl/cfb/Config.java @@ -17,6 +17,11 @@ import org.apache.commons.cli.Options; 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"; @@ -64,6 +69,18 @@ public class Config { public String getMailSmtpHost() { return m_mailSmtpHost; } public ArrayList getNotify() { return new ArrayList(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(); @@ -79,6 +96,21 @@ public class Config { } } + 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)); }