OSGi™ Enterprise
Release 5

org.osgi.jmx.service.useradmin
Interface UserAdminMBean


public interface UserAdminMBean

This MBean provides the management interface to the OSGi User Manager Service

ThreadSafe

Field Summary
static javax.management.openmbean.CompositeType AUTORIZATION_TYPE
          The Composite Type for an Authorization object.
static java.lang.String CREDENTIALS
          The CREDENTIALS key, used in CREDENTIALS_ITEM.
static Item CREDENTIALS_ITEM
          The item containing the credentials of a user.
static javax.management.openmbean.CompositeType GROUP_TYPE
          The Composite Type for a Group.
static java.lang.String MEMBERS
          The MEMBERS key, used in MEMBERS_ITEM.
static Item MEMBERS_ITEM
          The item containing the members of a group.
static java.lang.String NAME
          The key NAME, used in NAME_ITEM.
static Item NAME_ITEM
          The item for the user name for an authorization object.
static java.lang.String OBJECTNAME
          User Admin MBean object name.
static java.lang.String PROPERTIES
          The PROPERTIES key, used in PROPERTIES_ITEM.
static Item PROPERTIES_ITEM
          The item containing the properties of a Role.
static java.lang.String REQUIRED_MEMBERS
          The REQUIRED_MEMBERS key, used in REQUIRED_MEMBERS_ITEM.
static Item REQUIRED_MEMBERS_ITEM
          The item containing the required members of a group.
static javax.management.openmbean.CompositeType ROLE_TYPE
          The Composite Type for a Role.
static java.lang.String ROLES
          The key ROLES, used in ROLES_ITEM.
static Item ROLES_ITEM
          The item containing the roles for this authorization object.
static java.lang.String TYPE
          The Role TYPE key, used in TYPE_ITEM.
static Item TYPE_ITEM
          The item containing the type of the roles encapsulated by this authorization object.
static javax.management.openmbean.CompositeType USER_TYPE
          A Composite Type for a User.
 
Method Summary
 void addCredential(java.lang.String key, byte[] value, java.lang.String username)
          Add credentials to a user, associated with the supplied key
 void addCredentialString(java.lang.String key, java.lang.String value, java.lang.String username)
          Add credentials to a user, associated with the supplied key
 boolean addMember(java.lang.String groupname, java.lang.String rolename)
          Add a member to the group.
 void addProperty(java.lang.String key, byte[] value, java.lang.String rolename)
          Add or update a property on a role.
 void addPropertyString(java.lang.String key, java.lang.String value, java.lang.String rolename)
          Add or update a property on a role
 boolean addRequiredMember(java.lang.String groupname, java.lang.String rolename)
          Add a required member to the group
 void createGroup(java.lang.String name)
          Create a Group
 void createRole(java.lang.String name)
          Deprecated. This method was specified in error. It does not function and must not be used. Use either createUser(String) or createGroup(String).
 void createUser(java.lang.String name)
          Create a User
 javax.management.openmbean.CompositeData getAuthorization(java.lang.String user)
          Answer the authorization for the user name.
 javax.management.openmbean.TabularData getCredentials(java.lang.String username)
          Answer the credentials associated with a user.
 javax.management.openmbean.CompositeData getGroup(java.lang.String groupname)
          Answer the Group associated with the group name.
 java.lang.String[] getGroups(java.lang.String filter)
          Answer the list of group names
 java.lang.String[] getImpliedRoles(java.lang.String username)
          Answer the list of implied roles for a user
 java.lang.String[] getMembers(java.lang.String groupname)
          Answer the the user names which are members of the group
 javax.management.openmbean.TabularData getProperties(java.lang.String rolename)
          Answer the properties associated with a role.
 java.lang.String[] getRequiredMembers(java.lang.String groupname)
          Answer the list of user names which are required members of this group
 javax.management.openmbean.CompositeData getRole(java.lang.String name)
          Answer the role associated with a name.
 java.lang.String[] getRoles(java.lang.String filter)
          Answer the list of role names which match the supplied filter
 javax.management.openmbean.CompositeData getUser(java.lang.String username)
          Answer the User associated with the user name.
 java.lang.String[] getUsers(java.lang.String filter)
          Answer the list of user names in the User Admin database
 java.lang.String getUserWithProperty(java.lang.String key, java.lang.String value)
          Answer the user name with the given property key-value pair from the User Admin service database.
 java.lang.String[] listGroups()
          Answer the list of group names
 java.lang.String[] listRoles()
          Answer the list of role names in the User Admin database
 java.lang.String[] listUsers()
          Answer the list of user names in the User Admin database
 void removeCredential(java.lang.String key, java.lang.String username)
          Remove the credential associated with the given user
 boolean removeGroup(java.lang.String name)
          Remove the Group associated with the name
 boolean removeMember(java.lang.String groupname, java.lang.String rolename)
          Remove a role from the group
 void removeProperty(java.lang.String key, java.lang.String rolename)
          Remove a property from a role
 boolean removeRole(java.lang.String name)
          Remove the Role associated with the name
 boolean removeUser(java.lang.String name)
          Remove the User associated with the name
 

Field Detail

OBJECTNAME

static final java.lang.String OBJECTNAME
User Admin MBean object name.

See Also:
Constant Field Values

NAME

static final java.lang.String NAME
The key NAME, used in NAME_ITEM.

See Also:
Constant Field Values

NAME_ITEM

static final Item NAME_ITEM
The item for the user name for an authorization object. The key is NAME and the type is SimpleType.STRING.


ROLES

static final java.lang.String ROLES
The key ROLES, used in ROLES_ITEM.

See Also:
Constant Field Values

ROLES_ITEM

static final Item ROLES_ITEM
The item containing the roles for this authorization object. The key is ROLES. and the type is JmxConstants.STRING_ARRAY_TYPE.


AUTORIZATION_TYPE

static final javax.management.openmbean.CompositeType AUTORIZATION_TYPE
The Composite Type for an Authorization object. It consists of the NAME_ITEM and TYPE_ITEM items.


TYPE

static final java.lang.String TYPE
The Role TYPE key, used in TYPE_ITEM.

See Also:
Constant Field Values

TYPE_ITEM

static final Item TYPE_ITEM
The item containing the type of the roles encapsulated by this authorization object. The key is TYPE and the type is SimpleType.INTEGER.


PROPERTIES

static final java.lang.String PROPERTIES
The PROPERTIES key, used in PROPERTIES_ITEM.

See Also:
Constant Field Values

PROPERTIES_ITEM

static final Item PROPERTIES_ITEM
The item containing the properties of a Role. The key is PROPERTIES and the type is JmxConstants.PROPERTIES_TYPE.


ROLE_TYPE

static final javax.management.openmbean.CompositeType ROLE_TYPE
The Composite Type for a Role. It contains the following items:


CREDENTIALS

static final java.lang.String CREDENTIALS
The CREDENTIALS key, used in CREDENTIALS_ITEM.

See Also:
Constant Field Values

CREDENTIALS_ITEM

static final Item CREDENTIALS_ITEM
The item containing the credentials of a user. The key is CREDENTIALS and the type is JmxConstants.PROPERTIES_TYPE .


USER_TYPE

static final javax.management.openmbean.CompositeType USER_TYPE
A Composite Type for a User. A User contains its Role description and adds the credentials. It extends ROLE_TYPE and adds CREDENTIALS_ITEM. This type extends the ROLE_TYPE. It adds:


MEMBERS

static final java.lang.String MEMBERS
The MEMBERS key, used in MEMBERS_ITEM.

See Also:
Constant Field Values

MEMBERS_ITEM

static final Item MEMBERS_ITEM
The item containing the members of a group. The key is MEMBERS and the type is JmxConstants.STRING_ARRAY_TYPE. It is used in GROUP_TYPE.


REQUIRED_MEMBERS

static final java.lang.String REQUIRED_MEMBERS
The REQUIRED_MEMBERS key, used in REQUIRED_MEMBERS_ITEM.

See Also:
Constant Field Values

REQUIRED_MEMBERS_ITEM

static final Item REQUIRED_MEMBERS_ITEM
The item containing the required members of a group. The key is REQUIRED_MEMBERS and the type is JmxConstants.STRING_ARRAY_TYPE. It is used in GROUP_TYPE .


GROUP_TYPE

static final javax.management.openmbean.CompositeType GROUP_TYPE
The Composite Type for a Group. It extends USER_TYPE and adds MEMBERS_ITEM, and REQUIRED_MEMBERS_ITEM. This type extends the USER_TYPE. It adds: If there are no members or required members an empty array is returned in the respective items.

Method Detail

addCredential

void addCredential(java.lang.String key,
                   byte[] value,
                   java.lang.String username)
                   throws java.io.IOException
Add credentials to a user, associated with the supplied key

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:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the username is not a User

addCredentialString

void addCredentialString(java.lang.String key,
                         java.lang.String value,
                         java.lang.String username)
                         throws java.io.IOException
Add credentials to a user, associated with the supplied key

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:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the username is not a User

addMember

boolean addMember(java.lang.String groupname,
                  java.lang.String rolename)
                  throws java.io.IOException
Add a member to the group.

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:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if an invalid group name or role name is specified

addPropertyString

void addPropertyString(java.lang.String key,
                       java.lang.String value,
                       java.lang.String rolename)
                       throws java.io.IOException
Add or update a property on a role

Parameters:
key - The key of the property to add
value - The value of the property to add (String)
rolename - The role name
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if an invalid role name is specified

addProperty

void addProperty(java.lang.String key,
                 byte[] value,
                 java.lang.String rolename)
                 throws java.io.IOException
Add or update a property on a role.

Parameters:
key - The added property key
value - The added byte[] property value
rolename - The role name that receives the property
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if an invalid role name is specified

addRequiredMember

boolean addRequiredMember(java.lang.String groupname,
                          java.lang.String rolename)
                          throws java.io.IOException
Add a required member to the group

Parameters:
groupname - The group name that is addded
rolename - The role that
Returns:
true if the role was added to the group
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if an invalid group name or role name is specified

createUser

void createUser(java.lang.String name)
                throws java.io.IOException
Create a User

Parameters:
name - Name of the user to create
Throws:
java.io.IOException - if the operation fails

createGroup

void createGroup(java.lang.String name)
                 throws java.io.IOException
Create a Group

Parameters:
name - Name of the group to create
Throws:
java.io.IOException - if the operation fails

createRole

void createRole(java.lang.String name)
                throws java.io.IOException
Deprecated. This method was specified in error. It does not function and must not be used. Use either createUser(String) or createGroup(String).

This method was specified in error and must not be used.

Parameters:
name - Ignored.
Throws:
java.io.IOException - This method will throw an exception if called.

getAuthorization

javax.management.openmbean.CompositeData getAuthorization(java.lang.String user)
                                                          throws java.io.IOException
Answer the authorization for the user name. The Composite Data is typed by AUTORIZATION_TYPE.

Parameters:
user - The user name
Returns:
the Authorization typed by AUTORIZATION_TYPE.
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the user name is not a User

getCredentials

javax.management.openmbean.TabularData getCredentials(java.lang.String username)
                                                      throws java.io.IOException
Answer the credentials associated with a user. The returned Tabular Data is typed by JmxConstants.PROPERTIES_TYPE.

Parameters:
username - The user name
Returns:
the credentials associated with the user, see JmxConstants.PROPERTIES_TYPE
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the user name is not a User

getGroup

javax.management.openmbean.CompositeData getGroup(java.lang.String groupname)
                                                  throws java.io.IOException
Answer the Group associated with the group name. The returned Composite Data is typed by GROUP_TYPE

Parameters:
groupname - The group name
Returns:
the Group, see GROUP_TYPE
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the group name is not a Group

listGroups

java.lang.String[] listGroups()
                              throws java.io.IOException
Answer the list of group names

Returns:
The list of group names
Throws:
java.io.IOException - if the operation fails

getGroups

java.lang.String[] getGroups(java.lang.String filter)
                             throws java.io.IOException
Answer the list of group names

Parameters:
filter - The filter to apply
Returns:
The list of group names
Throws:
java.io.IOException - if the operation fails

getImpliedRoles

java.lang.String[] getImpliedRoles(java.lang.String username)
                                   throws java.io.IOException
Answer the list of implied roles for a user

Parameters:
username - The name of the user that has the implied roles
Returns:
The list of role names
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the username is not a User

getMembers

java.lang.String[] getMembers(java.lang.String groupname)
                              throws java.io.IOException
Answer the the user names which are members of the group

Parameters:
groupname - The name of the group to get the members from
Returns:
The list of user names
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the groupname is not a Group

getProperties

javax.management.openmbean.TabularData getProperties(java.lang.String rolename)
                                                     throws java.io.IOException
Answer the properties associated with a role. The returned Tabular Data is typed by JmxConstants.PROPERTIES_TYPE.

Parameters:
rolename - The name of the role to get properties from
Returns:
the properties associated with the role, see JmxConstants.PROPERTIES_TYPE
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the rolename is not a role

getRequiredMembers

java.lang.String[] getRequiredMembers(java.lang.String groupname)
                                      throws java.io.IOException
Answer the list of user names which are required members of this group

Parameters:
groupname - The name of the group to get the required members from
Returns:
The list of user names
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the group name is not a Group

getRole

javax.management.openmbean.CompositeData getRole(java.lang.String name)
                                                 throws java.io.IOException
Answer the role associated with a name. The returned Composite Data is typed by ROLE_TYPE.

Parameters:
name - The name of the role to get the data from
Returns:
the Role, see ROLE_TYPE
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the name is not a role

listRoles

java.lang.String[] listRoles()
                             throws java.io.IOException
Answer the list of role names in the User Admin database

Returns:
The list of role names
Throws:
java.io.IOException - if the operation fails

getRoles

java.lang.String[] getRoles(java.lang.String filter)
                            throws java.io.IOException
Answer the list of role names which match the supplied filter

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:
java.io.IOException - if the operation fails

getUser

javax.management.openmbean.CompositeData getUser(java.lang.String username)
                                                 throws java.io.IOException
Answer the User associated with the user name. The returned Composite Data is typed by USER_TYPE.

Parameters:
username - The name of the requested user
Returns:
The User, see USER_TYPE
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the username is not a User

getUserWithProperty

java.lang.String getUserWithProperty(java.lang.String key,
                                     java.lang.String value)
                                     throws java.io.IOException
Answer the user name with the given property key-value pair from the User Admin service database.

Parameters:
key - The key to compare
value - The value to compare
Returns:
The User
Throws:
java.io.IOException - if the operation fails

listUsers

java.lang.String[] listUsers()
                             throws java.io.IOException
Answer the list of user names in the User Admin database

Returns:
The list of user names
Throws:
java.io.IOException - if the operation fails

getUsers

java.lang.String[] getUsers(java.lang.String filter)
                            throws java.io.IOException
Answer the list of user names in the User Admin database

Parameters:
filter - The filter to apply
Returns:
The list of user names
Throws:
java.io.IOException - if the operation fails

removeCredential

void removeCredential(java.lang.String key,
                      java.lang.String username)
                      throws java.io.IOException
Remove the credential associated with the given user

Parameters:
key - The key of the credential to remove
username - The name of the user for which the credential must be removed
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the username is not a User

removeMember

boolean removeMember(java.lang.String groupname,
                     java.lang.String rolename)
                     throws java.io.IOException
Remove a role from the group

Parameters:
groupname - The group name
rolename -
Returns:
true if the role was removed from the group
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the groupname is not a Group

removeProperty

void removeProperty(java.lang.String key,
                    java.lang.String rolename)
                    throws java.io.IOException
Remove a property from a role

Parameters:
key -
rolename -
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the rolename is not a role

removeRole

boolean removeRole(java.lang.String name)
                   throws java.io.IOException
Remove the Role associated with the name

Parameters:
name -
Returns:
true if the remove succeeded
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the name is not a role

removeGroup

boolean removeGroup(java.lang.String name)
                    throws java.io.IOException
Remove the Group associated with the name

Parameters:
name -
Returns:
true if the remove succeeded
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the name is not a Group

removeUser

boolean removeUser(java.lang.String name)
                   throws java.io.IOException
Remove the User associated with the name

Parameters:
name -
Returns:
true if the remove succeeded
Throws:
java.io.IOException - if the operation fails
java.lang.IllegalArgumentException - if the name is not a User

OSGi™ Enterprise
Release 5

Copyright © OSGi Alliance (2000, 2012). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0