Package org.atomojo.app.auth

Examples of org.atomojo.app.auth.AuthException


         try {
            AuthService service = serviceClass.newInstance();
            service.init(props);
            return service;
         } catch (InstantiationException ex) {
            throw new AuthException("Cannot instantiate service "+serviceClass.getName(),ex);
         } catch (IllegalAccessException ex) {
            throw new AuthException("Cannot instantiate service "+serviceClass.getName(),ex);
         }
      }
View Full Code Here


            s = dbConnection.getStatement(STATEMENT_CREATE_GROUP);
            s.setString(1,name);
            int count = s.executeUpdate();
            return count==1;
         } catch (SQLException ex) {
            throw new AuthException("Cannot create group "+name+" due to SQL error.",ex);
         } finally {
            release(s);
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }
   }
View Full Code Here

      try {
         DBConnection dbConnection = getConnection();
         try {
            int groupId = lookupInternalId(STATEMENT_FIND_GROUP_ID,name);
            if (groupId<0) {
               throw new AuthException("Group "+name+" cannot be found.");
            }
            PreparedStatement s = dbConnection.getStatement(STATEMENT_DELETE_GROUP_MEMBERS);
            s.setInt(1,groupId);
            s.executeUpdate();
            release(s);
            s = dbConnection.getStatement(STATEMENT_DELETE_GROUP);
            s.setInt(1,groupId);
            int count = s.executeUpdate();
            release(s);
            return count>0;
         } catch (SQLException ex) {
            throw new AuthException("Cannot delete group "+name,ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }

   }
View Full Code Here

            release(s);
            if (count!=1) {
               return false;
            }
         } catch (SQLException ex) {
            throw new AuthException("Cannot add user "+alias+" to group "+name+" due to SQL error.",ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }
      return true;
   }
View Full Code Here

      try {
         DBConnection dbConnection = getConnection();
         try {
            int userId = lookupInternalId(STATEMENT_FIND_AUTHOR_ID,alias);
            if (userId<0) {
               throw new AuthException("User "+alias+" cannot be found.");
            }
            int groupId = lookupInternalId(STATEMENT_FIND_GROUP_ID,name);
            if (groupId<0) {
               throw new AuthException("Group "+name+" cannot be found.");
            }
            PreparedStatement s = dbConnection.getStatement(STATEMENT_DELETE_GROUP_MEMBER);
            s.setInt(1,groupId);
            s.setInt(2,userId);
            int count = s.executeUpdate();
            release(s);
            return count>0;
         } catch (SQLException ex) {
            throw new AuthException("Cannot delete user "+alias+" from group "+name,ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }

   }
View Full Code Here

            synchronized (users) {
               users.put(alias,u);
            }
            return u;
         } catch (SQLException ex) {
            throw new AuthException("Cannot create user "+alias+" due to SQL error.",ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      } catch (java.security.NoSuchAlgorithmException ex) {
         throw new AuthException(ex.getMessage());
      }

   }
View Full Code Here

                  }
               }
               release(r);
               release(s);
            } catch (SQLException ex) {
               throw new AuthException("Cannot get user "+alias+" due to SQL error.",ex);
            } finally {
               release(dbConnection);
            }
         } catch (SQLException ex) {
            throw new AuthException("Cannot get database connection.",ex);
         }
      }
      return u;

   }
View Full Code Here

               }

            },this,dbConnection);
         } catch (SQLException ex) {
            release(dbConnection);
            throw new AuthException("Cannot execute queries connection.",ex);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }
   }
View Full Code Here

            synchronized (users) {
               users.remove(alias);
            }
            return count>0;
         } catch (SQLException ex) {
            throw new AuthException("Cannot delete user "+alias+" from the database.",ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }
   }
View Full Code Here

            synchronized (users) {
               users.remove(alias);
            }
            return count>0;
         } catch (SQLException ex) {
            throw new AuthException("Cannot update user "+alias+" in the database.",ex);
         } finally {
            release(dbConnection);
         }
      } catch (SQLException ex) {
         throw new AuthException("Cannot get database connection.",ex);
      }
   }
View Full Code Here

TOP

Related Classes of org.atomojo.app.auth.AuthException

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.