Package org.milowski.db

Examples of org.milowski.db.DBQueryHandler


   {
      final DBCache<UUID,Group> groupCache = db.realmGroupCaches.get(this);
      final DBCache<UUID,RealmUser> userCache = db.realmUserCaches.get(this);
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_BY_REALM,new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
            }
            public void onResults(ResultSet set)
               throws SQLException
            {
               while (set.next()) {
                  Group group = groupCache.get(set.getInt(1));
                  group.delete();
               }
            }
         });
         connection.query(AuthDB.REALM_USER_BY_REALM,new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
            }
View Full Code Here


      DBConnection connection = db.getConnection();
      try {
         connection.deleteById(AuthDB.DELETE_USER_ROLES_BY_USER, id);
         connection.deleteById(AuthDB.DELETE_AUTHENTICATION_BY_USER, id);
         connection.deleteById(AuthDB.DELETE_USER_ALIAS_BY_USER, id);
         connection.query(AuthDB.REALM_USERS_BY_USER, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
            }
View Full Code Here

   {
     
      final Slot<Boolean> hasRole = new Slot<Boolean>(false);
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.USER_HAS_ROLE, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,role.getId());
View Full Code Here

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

   {
      final Slot<Authenticated> retval = new Slot<Authenticated>();
      if (realm==null) {
         DBConnection connection = db.getConnection();
         try {
            connection.query(AuthDB.USER_AUTHENTICATED, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,id);
                  s.setString(2,session.toString());
               }
               public void onResults(ResultSet set)
                  throws SQLException
               {
                  if (set.next()) {
                     Timestamp created = set.getTimestamp(2);
                     Timestamp expiration = set.getTimestamp(3);
                     Authenticated auth = new Authenticated(db,set.getInt(1),session,created,expiration,User.this,realm);
                     retval.set(auth);
                  }
               }
            });
            if (retval.get().isExpired()) {
               // the session has expired
               retval.get().delete();
               retval.set(null);
            }
           
         } finally {
            db.release(connection);
         }
      } else {
         DBConnection connection = db.getConnection();
         try {
            connection.query(AuthDB.REALM_USER_AUTHENTICATED, new DBQueryHandler() {
               public void prepare(PreparedStatement s)
                  throws SQLException
               {
                  s.setInt(1,id);
                  s.setInt(2,realm.getId());
View Full Code Here

   {
      final Slot<Boolean> found = new Slot<Boolean>(false);
      final String encrypted = md5Password(password);
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.CHECK_PASSWORD, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setString(2,encrypted);
View Full Code Here

      throws SQLException
   {
      final Slot<String> found = new Slot<String>();
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.ENCRYPTED_PASSWORD, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
            }
View Full Code Here

      throws SQLException
   {
     
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.ROLE_PERMISSIONS, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
            }
View Full Code Here

   protected void init()
      throws SQLException
   {
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_ROLES, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1, id);
            }
View Full Code Here

      throws SQLException
   {
      final Slot<Boolean> member = new Slot<Boolean>(false);
      DBConnection connection = db.getConnection();
      try {
         connection.query(AuthDB.GROUP_MEMBER, new DBQueryHandler() {
            public void prepare(PreparedStatement s)
               throws SQLException
            {
               s.setInt(1,id);
               s.setInt(2,user.getId());
View Full Code Here

TOP

Related Classes of org.milowski.db.DBQueryHandler

Copyright © 2018 www.massapicom. 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.