Skip to content

Commit

Permalink
refactor install mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
youyong205 committed Jan 12, 2015
2 parents f1b5acb + 8cd8c3e commit 205d0e3
Showing 1 changed file with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,32 @@ private boolean setupDatabase() throws MojoFailureException {
}

private void validate() {
m_jdbcUrl = PropertyProviders.fromConsole().forString("jdbc.url", "Please input jdbc url:", null,
"jdbc:mysql://127.0.0.1:3306", new IValidator<String>() {
@Override
public boolean validate(String url) {
if (url.startsWith("jdbc:mysql://")) {
return true;
} else {
return false;
m_jdbcUrl = System.getenv("mysql_jdbcUrl");
m_user = System.getenv("mysql_username");
m_password = System.getenv("mysql_password");

if (m_jdbcUrl != null && m_user != null && m_password != null) {
// ignore it
} else {
m_jdbcUrl = PropertyProviders.fromConsole().forString("jdbc.url", "Please input jdbc url:", null,
"jdbc:mysql://127.0.0.1:3306", new IValidator<String>() {
@Override
public boolean validate(String url) {
if (url.startsWith("jdbc:mysql://")) {
return true;
} else {
return false;
}
}
}
});
m_user = PropertyProviders.fromConsole().forString("jdbc.user", "Please input username:", null, null, null);
m_password = PropertyProviders.fromConsole().forString("jdbc.password", "Please input password:", null, "", null);
});
m_user = PropertyProviders.fromConsole().forString("jdbc.user", "Please input username:", null, null, null);
m_password = PropertyProviders.fromConsole().forString("jdbc.password", "Please input password:", null, "",
null);

}

getLog().info("jdbc.url: " + m_jdbcUrl);
getLog().info("jdbc.user: " + m_user);
getLog().info("jdbc.password: " + m_password);
}
}

0 comments on commit 205d0e3

Please sign in to comment.