Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package dbConnection;
  2.  
  3. import java.util.ResourceBundle;
  4.  
  5. /**
  6. * Class for database parameters
  7. */
  8. public class ConfigurationManager {
  9. /**
  10. * Database user
  11. */
  12. private String user;
  13.  
  14. /**
  15. * Database password
  16. */
  17. private String pass;
  18.  
  19. /**
  20. * Database url
  21. */
  22. private String uri;
  23.  
  24. /**
  25. * Database driver
  26. */
  27. private String driver;
  28.  
  29. /**
  30. * File with resources
  31. */
  32. private ResourceBundle resources;
  33.  
  34.  
  35. public ConfigurationManager()
  36. {
  37. resources = ResourceBundle.getBundle("data");
  38. initSettings();
  39. }
  40.  
  41. public ConfigurationManager(String propertyFile)
  42. {
  43. resources = ResourceBundle.getBundle(propertyFile);
  44. initSettings();
  45. }
  46.  
  47. private void initSettings()
  48. {
  49. user = resources.getString("user");
  50. pass = resources.getString("password");
  51. uri = resources.getString("url");
  52. driver = resources.getString("driver");
  53. }
  54.  
  55. public String getUser() {
  56. return user;
  57. }
  58.  
  59. public String getPass() {
  60. return pass;
  61. }
  62.  
  63.  
  64. public String getUri() {
  65. return uri;
  66. }
  67.  
  68.  
  69. public String getDriver() {
  70. return driver;
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement