Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import com.mongodb.*;
  2. import com.mongodb.client.MongoCollection;
  3.  
  4. import javax.swing.text.Document;
  5. import java.io.IOError;
  6.  
  7. public class DataBaseManager {
  8.  
  9. private DB db;
  10. private MongoClient client;
  11.  
  12. private MongoCollection<Document> profile;
  13.  
  14. public boolean connect(String ip, int port){
  15. try {
  16. client = new MongoClient(ip, port);
  17. } catch (IOError e) {
  18. System.out.println("Could not connect to database!");
  19. e.printStackTrace();
  20. return false;
  21. }
  22. return true;
  23. }
  24.  
  25. public DBCollection getProfileCollection() {
  26. return this.db.getCollection("profile");
  27. }
  28.  
  29. public DBCollection getPermBans() {
  30. return this.db.getCollection("permbans");
  31. }
  32.  
  33. public DBCollection getTempBans() {
  34. return this.db.getCollection("tempbans");
  35. }
  36.  
  37. public DBCollection getPermIPBans() {
  38. return this.db.getCollection("ipbans");
  39. }
  40.  
  41. public DBCollection getTempIPBans() {
  42. return this.db.getCollection("tempipbans");
  43. }
  44.  
  45.  
  46. public DB getDb() {
  47. return db;
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement