org.apache.aries.jmx.useradmin
Class UserAdmin

java.lang.Object
  extended by org.apache.aries.jmx.useradmin.UserAdmin
All Implemented Interfaces:
UserAdminMBean

public class UserAdmin
extends Object
implements UserAdminMBean

UserAdmin represents UserAdminMBean implementation.

Version:
$Rev: 953097 $ $Date: 2010-06-09 18:48:01 +0100 (Wed, 09 Jun 2010) $
See Also:
UserAdminMBean

Field Summary
 
Fields inherited from interface org.osgi.jmx.service.useradmin.UserAdminMBean
AUTORIZATION_TYPE, CREDENTIALS, CREDENTIALS_ITEM, GROUP_TYPE, MEMBERS, MEMBERS_ITEM, NAME, NAME_ITEM, OBJECTNAME, PROPERTIES, PROPERTIES_ITEM, REQUIRED_MEMBERS, REQUIRED_MEMBERS_ITEM, ROLE_TYPE, ROLES, ROLES_ITEM, TYPE, TYPE_ITEM, USER_TYPE
 
Constructor Summary
UserAdmin(org.osgi.service.useradmin.UserAdmin userAdmin)
          Constructs new UserAdmin MBean.
 
Method Summary
 void addCredential(String key, byte[] value, String username)
          Add credentials to a user, associated with the supplied key
 void addCredentialString(String key, String value, String username)
          Add credentials to a user, associated with the supplied key
 boolean addMember(String groupname, String rolename)
          Add a member to the group.
 void addProperty(String key, byte[] value, String rolename)
          Add or update a property on a role.
 void addPropertyString(String key, String value, String rolename)
          Add or update a property on a role
 boolean addRequiredMember(String groupname, String rolename)
          Add a required member to the group
 void createGroup(String name)
          Create a Group
 void createRole(String name)
          Create a Role
 void createUser(String name)
          Create a User
 CompositeData getAuthorization(String username)
          Answer the authorization for the user name.
 TabularData getCredentials(String username)
          Answer the credentials associated with a user.
 CompositeData getGroup(String groupname)
          Answer the Group associated with the group name.
 String[] getGroups(String filter)
          Answer the list of group names
 String[] getImpliedRoles(String username)
          Answer the list of implied roles for a user
 String[] getMembers(String groupname)
          Answer the the user names which are members of the group
 TabularData getProperties(String rolename)
          Answer the properties associated with a role.
 String[] getRequiredMembers(String groupname)
          Answer the list of user names which are required members of this group
 CompositeData getRole(String name)
          Answer the role associated with a name.
 String[] getRoles(String filter)
          Answer the list of role names which match the supplied filter
 CompositeData getUser(String username)
          Answer the User associated with the user name.
 String[] getUsers(String filter)
          Answer the list of user names in the User Admin database
 String getUserWithProperty(String key, String value)
          Answer the user name with the given property key-value pair from the User Admin service database.
 String[] listGroups()
          Answer the list of group names
 String[] listRoles()
          Answer the list of role names in the User Admin database
 String[] listUsers()
          Answer the list of user names in the User Admin database
 void removeCredential(String key, String username)
          Remove the credential associated with the given user
 boolean removeGroup(String name)
          Remove the Group associated with the name
 boolean removeMember(String groupname, String rolename)
          Remove a role from the group
 void removeProperty(String key, String rolename)
          Remove a property from a role
 boolean removeRole(String name)
          Remove the Role associated with the name
 boolean removeUser(String name)
          Remove the User associated with the name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAdmin

public UserAdmin(org.osgi.service.useradmin.UserAdmin userAdmin)
Constructs new UserAdmin MBean.

Parameters:
userAdmin - UserAdmin service reference.
Method Detail

addCredential

public void addCredential(String key,
                          byte[] value,
                          String username)
                   throws IOException
Description copied from interface: UserAdminMBean
Add credentials to a user, associated with the supplied key

Specified by:
addCredential in interface UserAdminMBean
Parameters:
key - The key of the credential to add
value - The value of the credential to add
username - The name of the user that gets the credential.
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addCredential(java.lang.String, byte[], java.lang.String)

addCredentialString

public void addCredentialString(String key,
                                String value,
                                String username)
                         throws IOException
Description copied from interface: UserAdminMBean
Add credentials to a user, associated with the supplied key

Specified by:
addCredentialString in interface UserAdminMBean
Parameters:
key - The key of the credential to add
value - The value of the credential to add
username - The name of the user that gets the credential.
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addCredentialString(String, String, String)

addMember

public boolean addMember(String groupname,
                         String rolename)
                  throws IOException
Description copied from interface: UserAdminMBean
Add a member to the group.

Specified by:
addMember in interface UserAdminMBean
Parameters:
groupname - The group name that receives the rolename as member.
rolename - The rolename (User or Group) that must be added.
Returns:
true if the role was added to the group
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addMember(java.lang.String, java.lang.String)

addPropertyString

public void addPropertyString(String key,
                              String value,
                              String rolename)
                       throws IOException
Description copied from interface: UserAdminMBean
Add or update a property on a role

Specified by:
addPropertyString in interface UserAdminMBean
Parameters:
key - The key of the property to add
value - The value of the property to add (String)
rolename - The role name
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addPropertyString(String, String, String)

addProperty

public void addProperty(String key,
                        byte[] value,
                        String rolename)
                 throws IOException
Description copied from interface: UserAdminMBean
Add or update a property on a role.

Specified by:
addProperty in interface UserAdminMBean
Parameters:
key - The added property key
value - The added byte[] property value
rolename - The role name that receives the property
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addProperty(java.lang.String, byte[], java.lang.String)

addRequiredMember

public boolean addRequiredMember(String groupname,
                                 String rolename)
                          throws IOException
Description copied from interface: UserAdminMBean
Add a required member to the group

Specified by:
addRequiredMember in interface UserAdminMBean
Parameters:
groupname - The group name that is addded
rolename - The role that
Returns:
true if the role was added to the group
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.addRequiredMember(java.lang.String, java.lang.String)

createGroup

public void createGroup(String name)
                 throws IOException
Description copied from interface: UserAdminMBean
Create a Group

Specified by:
createGroup in interface UserAdminMBean
Parameters:
name - Name of the group to create
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.createGroup(java.lang.String)

createRole

public void createRole(String name)
                throws IOException
Description copied from interface: UserAdminMBean
Create a Role

Specified by:
createRole in interface UserAdminMBean
Parameters:
name - of the role to create
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.createRole(java.lang.String)

createUser

public void createUser(String name)
                throws IOException
Description copied from interface: UserAdminMBean
Create a User

Specified by:
createUser in interface UserAdminMBean
Parameters:
name - Name of the user to create
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.createUser(java.lang.String)

getAuthorization

public CompositeData getAuthorization(String username)
                               throws IOException
Description copied from interface: UserAdminMBean
Answer the authorization for the user name. The Composite Data is typed by UserAdminMBean.AUTORIZATION_TYPE.

Specified by:
getAuthorization in interface UserAdminMBean
Parameters:
username - The user name
Returns:
the Authorization typed by UserAdminMBean.AUTORIZATION_TYPE.
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getAuthorization(java.lang.String)

getCredentials

public TabularData getCredentials(String username)
                           throws IOException
Description copied from interface: UserAdminMBean
Answer the credentials associated with a user. The returned Tabular Data is typed by JmxConstants.PROPERTIES_TYPE.

Specified by:
getCredentials in interface UserAdminMBean
Parameters:
username - The user name
Returns:
the credentials associated with the user, see JmxConstants.PROPERTIES_TYPE
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getCredentials(java.lang.String)

getGroup

public CompositeData getGroup(String groupname)
                       throws IOException
Description copied from interface: UserAdminMBean
Answer the Group associated with the group name. The returned Composite Data is typed by UserAdminMBean.GROUP_TYPE

Specified by:
getGroup in interface UserAdminMBean
Parameters:
groupname - The group name
Returns:
the Group, see UserAdminMBean.GROUP_TYPE
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getGroup(java.lang.String)

getGroups

public String[] getGroups(String filter)
                   throws IOException
Description copied from interface: UserAdminMBean
Answer the list of group names

Specified by:
getGroups in interface UserAdminMBean
Parameters:
filter - The filter to apply
Returns:
The list of group names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getGroups(java.lang.String)

getImpliedRoles

public String[] getImpliedRoles(String username)
                         throws IOException
Description copied from interface: UserAdminMBean
Answer the list of implied roles for a user

Specified by:
getImpliedRoles in interface UserAdminMBean
Parameters:
username - The name of the user that has the implied roles
Returns:
The list of role names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getImpliedRoles(java.lang.String)

getMembers

public String[] getMembers(String groupname)
                    throws IOException
Description copied from interface: UserAdminMBean
Answer the the user names which are members of the group

Specified by:
getMembers in interface UserAdminMBean
Parameters:
groupname - The name of the group to get the members from
Returns:
The list of user names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getMembers(java.lang.String)

getProperties

public TabularData getProperties(String rolename)
                          throws IOException
Description copied from interface: UserAdminMBean
Answer the properties associated with a role. The returned Tabular Data is typed by JmxConstants.PROPERTIES_TYPE.

Specified by:
getProperties in interface UserAdminMBean
Parameters:
rolename - The name of the role to get properties from
Returns:
the properties associated with the role, see JmxConstants.PROPERTIES_TYPE
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getProperties(java.lang.String)

getRequiredMembers

public String[] getRequiredMembers(String groupname)
                            throws IOException
Description copied from interface: UserAdminMBean
Answer the list of user names which are required members of this group

Specified by:
getRequiredMembers in interface UserAdminMBean
Parameters:
groupname - The name of the group to get the required members from
Returns:
The list of user names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getRequiredMembers(java.lang.String)

getRole

public CompositeData getRole(String name)
                      throws IOException
Description copied from interface: UserAdminMBean
Answer the role associated with a name. The returned Composite Data is typed by UserAdminMBean.ROLE_TYPE.

Specified by:
getRole in interface UserAdminMBean
Parameters:
name - The name of the role to get the data from
Returns:
the Role, see UserAdminMBean.ROLE_TYPE
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getRole(java.lang.String)

getRoles

public String[] getRoles(String filter)
                  throws IOException
Description copied from interface: UserAdminMBean
Answer the list of role names which match the supplied filter

Specified by:
getRoles in interface UserAdminMBean
Parameters:
filter - The string representation of the org.osgi.framework.Filter that is used to filter the roles by applying to the properties, if null all roles are returned.
Returns:
The list the role names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getRoles(java.lang.String)

getUser

public CompositeData getUser(String username)
                      throws IOException
Description copied from interface: UserAdminMBean
Answer the User associated with the user name. The returned Composite Data is typed by UserAdminMBean.USER_TYPE.

Specified by:
getUser in interface UserAdminMBean
Parameters:
username - The name of the requested user
Returns:
The User, see UserAdminMBean.USER_TYPE
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getUser(java.lang.String)

getUserWithProperty

public String getUserWithProperty(String key,
                                  String value)
                           throws IOException
Description copied from interface: UserAdminMBean
Answer the user name with the given property key-value pair from the User Admin service database.

Specified by:
getUserWithProperty in interface UserAdminMBean
Parameters:
key - The key to compare
value - The value to compare
Returns:
The User
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getUserWithProperty(String, String)

getUsers

public String[] getUsers(String filter)
                  throws IOException
Description copied from interface: UserAdminMBean
Answer the list of user names in the User Admin database

Specified by:
getUsers in interface UserAdminMBean
Parameters:
filter - The filter to apply
Returns:
The list of user names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.getUsers(java.lang.String)

listGroups

public String[] listGroups()
                    throws IOException
Description copied from interface: UserAdminMBean
Answer the list of group names

Specified by:
listGroups in interface UserAdminMBean
Returns:
The list of group names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.listGroups()

listRoles

public String[] listRoles()
                   throws IOException
Description copied from interface: UserAdminMBean
Answer the list of role names in the User Admin database

Specified by:
listRoles in interface UserAdminMBean
Returns:
The list of role names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.listRoles()

listUsers

public String[] listUsers()
                   throws IOException
Description copied from interface: UserAdminMBean
Answer the list of user names in the User Admin database

Specified by:
listUsers in interface UserAdminMBean
Returns:
The list of user names
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.listUsers()

removeCredential

public void removeCredential(String key,
                             String username)
                      throws IOException
Description copied from interface: UserAdminMBean
Remove the credential associated with the given user

Specified by:
removeCredential in interface UserAdminMBean
Parameters:
key - The key of the credential to remove
username - The name of the user for which the credential must be removed
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeCredential(java.lang.String, java.lang.String)

removeGroup

public boolean removeGroup(String name)
                    throws IOException
Description copied from interface: UserAdminMBean
Remove the Group associated with the name

Specified by:
removeGroup in interface UserAdminMBean
Returns:
true if the remove succeeded
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeGroup(java.lang.String)

removeMember

public boolean removeMember(String groupname,
                            String rolename)
                     throws IOException
Description copied from interface: UserAdminMBean
Remove a role from the group

Specified by:
removeMember in interface UserAdminMBean
Parameters:
groupname - The group name
Returns:
true if the role was removed from the group
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeMember(java.lang.String, java.lang.String)

removeProperty

public void removeProperty(String key,
                           String rolename)
                    throws IOException
Description copied from interface: UserAdminMBean
Remove a property from a role

Specified by:
removeProperty in interface UserAdminMBean
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeProperty(java.lang.String, java.lang.String)

removeRole

public boolean removeRole(String name)
                   throws IOException
Description copied from interface: UserAdminMBean
Remove the Role associated with the name

Specified by:
removeRole in interface UserAdminMBean
Returns:
true if the remove succeeded
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeRole(java.lang.String)

removeUser

public boolean removeUser(String name)
                   throws IOException
Description copied from interface: UserAdminMBean
Remove the User associated with the name

Specified by:
removeUser in interface UserAdminMBean
Returns:
true if the remove succeeded
Throws:
IOException - if the operation fails
See Also:
UserAdminMBean.removeUser(java.lang.String)


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.