Package xregistry

Examples of xregistry.XregistryException


            if(!publicGroup.hasUser(anonymousUser)){
                addUsertoGroup(publicGroup.getName(), anonymousUser);
            }

        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
       
    }
View Full Code Here


            statement.executeUpdate();
            //Add the group to memory model
            addGroup(new Group(newGroup));
            log.info("Group "+ newGroup + " Created");
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
    }
View Full Code Here

            statement.setBoolean(3,isAdmin );
            statement.executeUpdate();
            log.info("User "+ newUser + " created");
            users.put(newUser, new User(newUser));
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
       
    }
View Full Code Here

     * @see xregistry.auth.GroupManager#addGrouptoGroup(java.lang.String, java.lang.String)
     */
    public void addGrouptoGroup(String groupName, String grouptoAddedName) throws XregistryException {
        Group group = getGroup(groupName);
        if(group == null){
            throw new XregistryException("No such Group "+ groupName);
        }
       
        Group grouptoAdd = getGroup(groupName);
        if(grouptoAdd == null){
            throw new XregistryException("No such Group "+ groupName);
        }
       
        if(group.hasGroup(grouptoAddedName)){
            throw new XregistryException("Group"+ grouptoAddedName + " already exisits in group "+ groupName);
        }
        Connection connection = context.createConnection();
        try {
            PreparedStatement statement = connection.prepareStatement(ADD_GROUP_TO_GROUP_SQL);
            statement.setString(1, groupName);
            statement.setString(2,grouptoAddedName );
            statement.executeUpdate();
            group.addGroup(grouptoAdd);
            log.info("Add Group "+ groupName + " to "+ grouptoAddedName);
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
       
       
View Full Code Here

     */
    public void addUsertoGroup(String groupName, String usertoAdded) throws XregistryException {
        usertoAdded = Utils.canonicalizeDN(usertoAdded);
        Group group = getGroup(groupName);
        if(group == null){
            throw new XregistryException("No such Group "+ groupName);
        }
        if(group.hasUser(usertoAdded)){
            throw new XregistryException("user "+ usertoAdded + " already exisits in group "+ groupName);
        }
        Connection connection = context.createConnection();
        try {
            PreparedStatement statement = connection.prepareStatement(ADD_USER_TO_GROUP);
            statement.setString(1,usertoAdded );
            statement.setString(2,groupName );
            statement.executeUpdate();
            group.addUser(usertoAdded);
            log.info("Add User "+ usertoAdded + " to "+ groupName);
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
       
       
View Full Code Here

                PreparedStatement statement1 = connection.prepareStatement(DELETE_GROUP_SQL_MAIN);
                statement1.setString(1,groupID );
                int updateCount = statement1.executeUpdate();
               
                if(updateCount == 0){
                    throw new XregistryException("Database is not updated, Can not find such Group "+ groupID);
                }
               
                if(cascadingDeletes){
                    PreparedStatement statement2 = connection.prepareStatement(DELETE_GROUP_SQL_DEPEND);
                    statement2.setString(1,groupID );
                    statement2.setString(2,groupID );
                    statement2.executeUpdate();
                }
               
                connection.commit();
                groups.remove(groupID);
                log.info("Delete Group "+ groupID + (cascadingDeletes?" with cascading deletes ":""));
            } catch (SQLException e) {
                connection.rollback();
                throw new XregistryException(e);
            }finally{
                context.closeConnection(connection);
            }
        } catch (SQLException e) {
            throw new XregistryException(e);
        }
       
    }
View Full Code Here

                    group.removeUser(userID);
                }
                log.info("Delete User "+ userID);
            } catch (SQLException e) {
                connection.rollback();
                throw new XregistryException(e);
            }finally{
                context.closeConnection(connection);
            }
        } catch (SQLException e) {
            throw new XregistryException(e);
        }
       
    }
View Full Code Here

            for(int i = 0;i<keys.length;i++){
                statement1.setString(i+1,keys[i] );
            }
            statement1.executeUpdate();
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            context.closeConnection(connection);
        }
    }
View Full Code Here

        //DELETE FROM group_group_table WHERE AND userid = ?  AND groupid = ?
        usertoRemoved = canonicalizeDN(usertoRemoved);
        genericUpdate(REMOVE_USER_FROM_GROUP, new String[]{usertoRemoved,groupName});
        Group group = getGroup(groupName);
        if(group == null){
            throw new XregistryException("No such group "+ groupName);
        }
        if(group.hasUser(usertoRemoved)){
            group.removeUser(usertoRemoved);   
        }else{
            throw new XregistryException("No such User "+ usertoRemoved);
        }
       
    }
View Full Code Here

    public void removeGroupFromGroup(String groupName,String grouptoRemovedName)throws XregistryException{
        //DELETE FROM group_group_table WHERE AND contained_groupid = ?  AND groupid = ?
        Group group = getGroup(groupName);
        Group groupToRemove = getGroup(groupName);
        if(group == null){
            throw new XregistryException("No such group "+ groupName);
        }
        if(grouptoRemovedName == null){
            throw new XregistryException("No such group "+ grouptoRemovedName);
        }
        group.removeGroup(groupToRemove);
        genericUpdate(REMOVE_GROUP_FROM_GROUP, new String[]{grouptoRemovedName,groupName});
    }
View Full Code Here

TOP

Related Classes of xregistry.XregistryException

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.