Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. class Conf
  2. {
  3. public String activeMQPassword;
  4. public String activeMQPath;
  5. public String activeMQUser;
  6. public String jdbcPassword;
  7. public String jdbcUrl;
  8. public String jdbcUser;
  9. public String jmsserver;
  10. public String logPath;
  11. public String s3AccessKey;
  12. public String s3Path;
  13. public String s3SecretKey;
  14.  
  15. public Conf(String activeMQPassword, String activeMQPath, String activeMQUser, String jdbcPassword, String jdbcUrl, String jdbcUser, String jmsserver, String logPath, String s3AccessKey, String s3Path, String s3SecretKey)
  16. {
  17. this.activeMQPassword = activeMQPassword;
  18. this.activeMQPath = activeMQPath;
  19. this.activeMQUser = activeMQUser;
  20. this.jdbcPassword = jdbcPassword;
  21. this.jdbcUrl = jdbcUrl;
  22. this.jdbcUser = jdbcUser;
  23. this.jmsserver = jmsserver;
  24. this.logPath = logPath;
  25. this.s3AccessKey = s3AccessKey;
  26. this.s3Path = s3Path;
  27. this.s3SecretKey = s3SecretKey;
  28. }
  29.  
  30. }
  31.  
  32.  
  33.  
  34. FirebaseOptions options = new FirebaseOptions.Builder()
  35. .setServiceAccount(new FileInputStream("c:/chaveFB/TesteNovaApi-0efd51a8ad0c.json"))
  36. .setDatabaseUrl("https://testenovaapi.firebaseio.com/")
  37. //.setDatabaseAuthVariableOverride(auth) //AQUI SETAMOS A RESTRIÇÃO DE ACESSO CRIADA LOGO ACIMA.
  38. .build();
  39. FirebaseApp.initializeApp(options);
  40.  
  41. DatabaseReference ref = FirebaseDatabase
  42. .getInstance()
  43. .getReference("/conf");
  44. ref.addListenerForSingleValueEvent(new ValueEventListener() {
  45. @Override
  46. public void onDataChange(DataSnapshot dataSnapshot) {
  47. System.out.println("LA2LA2LA2LA2LA2LA2LA2LA2LA2LA2");
  48. Conf conf = dataSnapshot.getValue(Conf.class);
  49. System.out.println(conf.activeMQPassword);
  50. System.out.println(conf.activeMQPath);
  51. System.out.println(conf.activeMQUser);
  52. System.out.println(conf.jdbcPassword);
  53. System.out.println(conf.jdbcUser);
  54. System.out.println(conf.jmsserver);
  55. }
  56.  
  57. @Override
  58. public void onCancelled(DatabaseError databaseError) {
  59.  
  60. }
  61. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement