com.wm.app.b2b.server
Class UGClass

java.lang.Object
  extended by com.wm.app.b2b.server.UGClass
All Implemented Interfaces:
Codable
Direct Known Subclasses:
Group, User

public abstract class UGClass
extends java.lang.Object
implements Codable

Generic class used to represent both User and Group objects. These users and groups are circularly linked.


Field Summary
static int LDAP
           
static int NIS
           
static int OTHER
           
static int WM
           
 
Constructor Summary
UGClass()
           
 
Method Summary
 UGClass add(UGClass member)
          Adds the supplied UG to this one (this has a slightly different meaning depending on whether this is a user or a group).
 void addCredential(Credential cred)
          Adds a credential to this user.
 boolean check(Credential cred)
          Checks the supplied credential against the set for this user.
 boolean checkPassword(java.lang.String guess)
          Verifies the password of this UG.
 Credentials getCredentials()
          Gets a set of credentials for this UG
 Values getData()
          Returns arbitrary data associated with this UG -- be warned that this is most probably not thread-safe!!
 java.lang.String getName()
          Returns the name of this UG
 int getSource()
          Gets the source for this UG.
 boolean hasMember(java.lang.String member)
          Indicates whether the supplied UG (given as a String) is a "member" of this object.
 boolean hasMember(UGClass member)
          Indicates whether the supplied UG (given as a UGClass) is a "member" of this object.
 java.util.Enumeration membership()
          Returns an Enumeration of String names.
 java.util.Vector membershipNames()
          Same as membership but returns a Vector of Strings instead of an Enumeration.
 java.lang.String remove(UGClass member)
          Removes the supplied UG from this one's membership list.
 void setCredentials(Credentials creds)
          Supplies a set of credentials for this UG.
 void setData(Values data)
          Sets arbitrary data associated with this UG -- should probably only be set at creation-time.
 void setSource(int src)
          Sets the source for this UG.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.wm.util.coder.Codable
getValue, getValueKeys, setValue
 

Field Detail

WM

public static final int WM
See Also:
Constant Field Values

NIS

public static final int NIS
See Also:
Constant Field Values

LDAP

public static final int LDAP
See Also:
Constant Field Values

OTHER

public static final int OTHER
See Also:
Constant Field Values
Constructor Detail

UGClass

public UGClass()
Method Detail

getData

public Values getData()
Returns arbitrary data associated with this UG -- be warned that this is most probably not thread-safe!!

Returns:
The data associated with this UG.

setData

public void setData(Values data)
Sets arbitrary data associated with this UG -- should probably only be set at creation-time.

Parameters:
data - The data to be associated with this UG.

checkPassword

public boolean checkPassword(java.lang.String guess)
Verifies the password of this UG. The supplied guess is checked against the set password. Null passwords match any guess; otherwise a strict match is required.

Parameters:
guess - A password to test.
Returns:
Does the password match?

getName

public java.lang.String getName()
Returns the name of this UG

Returns:
the name

add

public UGClass add(UGClass member)
Adds the supplied UG to this one (this has a slightly different meaning depending on whether this is a user or a group). This has the side effect of adding this UG to the supplied UG, as well (circular linking).

Parameters:
member - The new UG to add.
Returns:
The same UG.

hasMember

public boolean hasMember(UGClass member)
Indicates whether the supplied UG (given as a UGClass) is a "member" of this object. (This has slightly different semantics depending on whether this is a user or a group.)

Parameters:
member - The UG the check with.
Returns:
boolean If the supplied UG is a "member" of this one.

hasMember

public boolean hasMember(java.lang.String member)
Indicates whether the supplied UG (given as a String) is a "member" of this object. (This has slightly different semantics depending on whether this is a user or a group.)

Parameters:
member - The name of the UG to check.
Returns:
boolean If the supplied UG is a "member" of this one.

remove

public java.lang.String remove(UGClass member)
Removes the supplied UG from this one's membership list. This has the side effect of removing this UG from the list of the supplied UG (circular links).

Parameters:
member - The UG to remove.
Returns:
The name of the removed UG.

membership

public java.util.Enumeration membership()
Returns an Enumeration of String names. For Users this represents the list of Groups that User belongs to. For Groups, this represents the list of Users that are in that Group.

Returns:
An Enumeration of Strings.

membershipNames

public java.util.Vector membershipNames()
Same as membership but returns a Vector of Strings instead of an Enumeration.

See Also:
membership()

getSource

public int getSource()
Gets the source for this UG. UGs that are native to this webMethods system have source == UGClass.WM Non-native users and groups (for instance, those from LDAP or NIS directories) have source != UGClass.WM.

Returns:
The code for the source of this UG.

setSource

public void setSource(int src)
Sets the source for this UG. See getSource for comments on source. Should only be called when creating the UG. Codes should be >10 for implementors of alternate directory interfaces.

Parameters:
src - Code for the source of this UG.

getCredentials

public Credentials getCredentials()
Gets a set of credentials for this UG

Returns:
the credentials (if any)

setCredentials

public void setCredentials(Credentials creds)
Supplies a set of credentials for this UG. Should only be called when creating new users.

Parameters:
creds - The credentials (if any).

addCredential

public void addCredential(Credential cred)
Adds a credential to this user. Should only be called when creating new users.

Parameters:
cred - The credential to add.

check

public boolean check(Credential cred)
Checks the supplied credential against the set for this user.

Parameters:
cred - The credential to check.
Returns:
true if the credential matched.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object