Examples of DBQueryHandler


Examples of org.milowski.db.DBQueryHandler

   {
      final Slot<Iterator<RealmUser>> result = new Slot<Iterator<RealmUser>>();
      final DBCache<UUID,RealmUser> cache = db.realmUserCaches.get(realm);
      final DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_MEMBERS, new DBQueryHandler() {
            public boolean shouldClose() { return false; }
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

      if (!result) {
         final Slot<Boolean> found = new Slot<Boolean>(Boolean.FALSE);
         final DBCache<UUID,Group> cache = db.realmGroupCaches.get(realm);
         DBConnection connection = db.getConnection();
         try {
            connection.query(AuthDB.GROUP_BY_REALM_USER, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,realm.getId());
                  s.setInt(2,id);
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

   {
      final Slot<Iterator<Group>> result = new Slot<Iterator<Group>>();
      final DBCache<UUID,Group> cache = db.realmGroupCaches.get(realm);
      final DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_BY_REALM_USER, new DBQueryHandler() {
            public boolean shouldClose() {
               return false;
            }
            public void prepare(PreparedStatement s)
               throws SQLException
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

   {
      final Slot<Boolean> found = new Slot<Boolean>(false);
      if (alias!=null) {
         DBConnection connection = getConnection();
         try {
            connection.query(USER_ALIAS_EXISTS, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setString(1,alias);
               }
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

      throws SQLException
   {
      final Slot<User> user = new Slot<User>();
      final DBConnection connection = getConnection();
      try {
         connection.query(USER_BY_EMAIL, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setString(1, email);
            }
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

      throws SQLException
   {
      final Slot<Iterator<User>> result = new Slot<Iterator<User>>();
      final DBConnection connection = getConnection();
      try {
         connection.query(all ? USERS : GLOBAL_USERS, new DBQueryHandler() {
            public boolean shouldClose() { return false; }
            public void onResults(ResultSet set)
               throws SQLException
            {
               result.set(new DBIterator<User>(set,new DBResultConstructor<User>() {
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

   {
      final Slot<Iterator<Group>> result = new Slot<Iterator<Group>>();
      final DBCache<UUID,Group> cache = realmGroupCaches.get(realm);
      final DBConnection connection = getConnection();
      try {
         connection.query(GROUPS, new DBQueryHandler() {
            public boolean shouldClose() { return false; }
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,realm.getId());
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

      final Slot<Boolean> found = new Slot<Boolean>(false);
      if (alias!=null) {
         // check realm against alias
         DBConnection connection = getConnection();
         try {
            connection.query(REALM_USER_BY_ALIAS, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,realm.getId());
                  s.setString(2,alias);
               }
               public void onResults(ResultSet set)
                  throws SQLException
               {
                  found.set(set.next());
               }
            });
            if (found.get()) {
               return false;
            }
            // check inherited aliases
            connection.query(REALM_USER_HAS_INHERITED_ALIAS, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,realm.getId());
                  s.setString(2,alias);
               }
               public void onResults(ResultSet set)
                  throws SQLException
               {
                  found.set(set.next());
               }
            });
            if (found.get()) {
               return false;
            }
         } finally {
            release(connection);
         }
      }
      //
      if (alias==null) {
         // Check inherited alias against local aliases
         DBConnection connection = getConnection();
         try {
            connection.query(REALM_USER_BY_ALIAS, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,realm.getId());
                  s.setString(2,user.getAlias());
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

      throws SQLException
   {
      final Slot<RealmUser> ruser = new Slot<RealmUser>();
      final DBConnection connection = getConnection();
      try {
         connection.query(REALM_USER_BY_EMAIL, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,realm.getId());
               s.setString(2, email);
            }
            public void onResults(ResultSet set)
               throws SQLException
            {
               if (set.next()) {
                  ruser.set(realmUserCaches.get(realm).get(set.getInt(1)));
               }
            }
         });
         if (ruser.get()!=null) {
            return ruser.get();
         }
         final User user = findUserByEmail(email);
         if (user!=null) {
            connection.query(REALM_USER_BY_USER, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,realm.getId());
                  s.setInt(2, user.getId());
View Full Code Here

Examples of org.milowski.db.DBQueryHandler

   {
      final DBCache<UUID,RealmUser> cache = realmUserCaches.get(realm);
      final Slot<Iterator<RealmUser>> result = new Slot<Iterator<RealmUser>>();
      final DBConnection connection = getConnection();
      try {
         connection.query(REALM_USERS, new DBQueryHandler() {
            public boolean shouldClose() { return false; }
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,realm.getId());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.