com.sun.slamd.db
Class SLAMDGroup

java.lang.Object
  extended by com.sun.slamd.db.SLAMDGroup

public class SLAMDGroup
extends java.lang.Object

This class defines a set of information about a user defined in the SLAMD database, including the username and hashed password, the default folder, and the set of groups in which the user is a member.

Author:
Neil A. Wilson

Field Summary
static java.lang.String ELEMENT_MEMBERS
          The name of the encoded element that holds the member names for this group.
static java.lang.String ELEMENT_NAME
          The name of the encoded element that holds the name of this group.
 
Constructor Summary
SLAMDGroup(java.lang.String groupName, java.lang.String[] memberNames)
          Creates a new SLAMD group with the provided information.
 
Method Summary
 void addMember(java.lang.String userName)
          Adds the specified user as a member of this group.
static SLAMDGroup decode(byte[] encodedGroup)
          Decodes the provided byte array as a SLAMD group.
 byte[] encode()
          Encodes this group into a byte array.
 java.lang.String getGroupName()
          Retrieves the name of this group.
 java.lang.String[] getMemberNames()
          Retrieves the names of the members of this group.
 boolean isMember(java.lang.String userName)
          Determines whether the specified user is a member of this group.
 void removeMember(java.lang.String userName)
          Removes the specified user from this group.
 void setMemberNames(java.lang.String[] memberNames)
          Specifies the set of members to use for this group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
The name of the encoded element that holds the name of this group.

See Also:
Constant Field Values

ELEMENT_MEMBERS

public static final java.lang.String ELEMENT_MEMBERS
The name of the encoded element that holds the member names for this group.

See Also:
Constant Field Values
Constructor Detail

SLAMDGroup

public SLAMDGroup(java.lang.String groupName,
                  java.lang.String[] memberNames)
Creates a new SLAMD group with the provided information.

Parameters:
groupName - The name of this group.
memberNames - The user names of the users that are members of this group.
Method Detail

getGroupName

public java.lang.String getGroupName()
Retrieves the name of this group.

Returns:
The name of this group.

getMemberNames

public java.lang.String[] getMemberNames()
Retrieves the names of the members of this group.

Returns:
The names of the members of this group.

isMember

public boolean isMember(java.lang.String userName)
Determines whether the specified user is a member of this group.

Parameters:
userName - The user name of the user for which to make the determination.
Returns:
true if the user is a member of this group, or false if not.

setMemberNames

public void setMemberNames(java.lang.String[] memberNames)
Specifies the set of members to use for this group.

Parameters:
memberNames - The user names of the users that should be members of this group.

addMember

public void addMember(java.lang.String userName)
Adds the specified user as a member of this group.

Parameters:
userName - The user name of the user to add to this group.

removeMember

public void removeMember(java.lang.String userName)
Removes the specified user from this group.

Parameters:
userName - The user name of the user to remove from this group.

encode

public byte[] encode()
Encodes this group into a byte array.

Returns:
The byte array containing the encoded representation of this group.

decode

public static SLAMDGroup decode(byte[] encodedGroup)
                         throws DecodeException
Decodes the provided byte array as a SLAMD group.

Parameters:
encodedGroup - The byte array containing the encoded group information.
Returns:
The decoded SLAMD group.
Throws:
DecodeException - If a problem occurs while trying to decode the provided byte array as a SLAMD group.