Package org.osgi.service.useradmin

Examples of org.osgi.service.useradmin.Role


        }
    }

    public Hashtable getProperties(String rolename) {
        try {
            Role role = ac.getUserAdmin().getRole(rolename);
            Dictionary dic = role.getProperties();
            Hashtable props = new Hashtable();
            Enumeration keys = dic.keys();
            while (keys.hasMoreElements()) {
                Object key = keys.nextElement();
                props.put(key, dic.get(key));
View Full Code Here


     * @param repository the repository to obtain the roles from, cannot be <code>null</code>;
     * @param name the name of the role to retrieve, cannot be <code>null</code>.
     * @return a role matching the given name, or <code>null</code> if no such role exists.
     */
    private Role getRoleFromRepository(Map repository, String name) {
        Role role;
        if (Role.USER_ANYONE.equals(name)) {
            role = RoleFactory.createRole(Role.USER_ANYONE);
        } else {
            role = (Role) repository.get(name);
        }
View Full Code Here

       
        // Keep reading until no more types can be read...
        while (entryCount-- > 0) {
            int type = dis.readInt();
           
            Role role = null;
            if (Role.GROUP == type) {
                stubGroups.add(readGroup(dis));
            } else if (Role.USER == type) {
                role = readUser(dis);
            } else {
                role = readRole(dis);
            }
           
            if (role != null) {
                repository.put(role.getName(), role);
            }
        }
       
        // Post processing stage: replace all stub groups with real group implementations...
        addGroups(repository, stubGroups);
View Full Code Here

     * @param dis the input stream to read the data from, cannot be <code>null</code>.
     * @return the read role, never <code>null</code>.
     * @throws IOException in case of I/O problems.
     */
    private Role readRole(DataInputStream dis) throws IOException {
        Role role = RoleFactory.createRole(Role.ROLE, dis.readUTF());
       
        readDictionary(role.getProperties(), dis);
       
        return role;
    }
View Full Code Here

        List names = stubGroup.getMemberNames();
        int size = names.size();

        for (int i = 0; i < size; i++) {
            String name = (String) names.get(i);
            Role role = getRoleFromRepository(repository, name);
            if (role == null) {
                throw new IOException("Unable to find referenced basic member: " + name);
            }
            group.addMember(role);
        }
       
        names = stubGroup.getRequiredMemberNames();
        size = names.size();
       
        for (int i = 0; i < size; i++) {
            String name = (String) names.get(i);
            Role role = getRoleFromRepository(repository, name);
            if (role == null) {
                throw new IOException("Unable to find referenced required member: " + name);
            }
            group.addRequiredMember(role);
        }
View Full Code Here

       
        // Write the total number of entries in our repository first...
        dos.writeInt(values.size());
       
        while (valuesIter.hasNext()) {
            Role role = (Role) valuesIter.next();
           
            int type = role.getType();
           
            dos.writeInt(type);
           
            if (Role.GROUP == type) {
                writeGroup((Group) role, dos);
View Full Code Here

    public Role deserialize(DBObject object)
    {
        int type = ((Integer) object.get(TYPE)).intValue();
        String name = (String) object.get(NAME);

        Role result = RoleFactory.createRole(type, name);
        // Read the generic properties of the role...
        deserializeDictionary(result.getProperties(), (DBObject) object.get(PROPERTIES));

        if ((Role.GROUP == type) || (Role.USER == type))
        {
            // This is safe, as Group extends from User...
            deserializeDictionary(((User) result).getCredentials(), (DBObject) object.get(CREDENTIALS));
View Full Code Here

     * @return a member instance, never <code>null</code>.
     * @throws MongoException in case the requested member was not found (or any other MongoDB exception).
     */
    final Role findExistingMember(String name)
    {
        Role result = m_roleProvider.getRole(name);
        if (result == null)
        {
            throw new MongoException("No such role: " + name);
        }
        return result;
View Full Code Here

            throw new IllegalArgumentException("Role cannot be null!");
        }
       
        DBCollection coll = getCollection();

        Role role = getRole(roleName);
        if (role != null) {
            return null;
        }

        // Role does not exist; insert it...
View Full Code Here

        DBCursor cursor = coll.find();
        try {
            while (cursor.hasNext()) {
                // Hmm, there might be a more clever way of doing this...
                Role role = m_helper.deserialize(cursor.next());
                if ((filter == null) || filter.match(role.getProperties())) {
                    roles.add(role);
                }
            }
        } finally {
            cursor.close();
View Full Code Here

TOP

Related Classes of org.osgi.service.useradmin.Role

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.