com.ibm.as400.security.auth
Class AS400Principal

java.lang.Object
  extended by com.ibm.as400.security.auth.AS400Principal
All Implemented Interfaces:
Serializable, Principal
Direct Known Subclasses:
UserProfilePrincipal

public abstract class AS400Principal
extends Object
implements Principal, Serializable

The AS400Principal class provides an abstract superclass for representations of IBM i system security-related identities.

Typical IBM i system Principals include, but are not necessarily limited to, user profiles.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
AS400Principal()
          Constructs an AS400Principal object.
AS400Principal(AS400 system)
          Constructs an AS400Principal object.
 
Method Summary
Modifier and Type Method and Description
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 String getName()
          Returns the name commonly used to refer to the principal.
 AS400 getSystem()
          Returns the AS400 system object for the principal.
 User getUser()
          Returns an IBM i system User object based on the user profile name and system associated with the principal.
 String getUserProfileName()
          Returns the name of a user profile associated with the thread when work is performed on behalf of the principal.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the specified listener from the internal list.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes the specified listener from the internal list.
 void setSystem(AS400 system)
          Sets the AS400 system object for the principal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

AS400Principal

public AS400Principal()
Constructs an AS400Principal object.


AS400Principal

public AS400Principal(AS400 system)
Constructs an AS400Principal object.

The system property is set to the specified value.

Parameters:
system - The IBM i system associated with the principal.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener.

The specified listener's propertyChange method will be called each time the value of a bound property is changed.

Parameters:
listener - The PropertyChangeListener.
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a VetoableChangeListener.

The specified listener's vetoableChange method will be called each time the value of a constrained property is changed.

Parameters:
listener - The VetoableChangeListener.
See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener)

getName

public String getName()
Returns the name commonly used to refer to the principal.

Default behavior for the superclass is to return the user profile name

Specified by:
getName in interface Principal
Returns:
The principal's name.

getSystem

public AS400 getSystem()
Returns the AS400 system object for the principal.

Returns:
The AS400 system for the principal; null if not assigned.

getUser

public User getUser()
             throws AS400Exception,
                    AS400SecurityException,
                    ConnectionDroppedException,
                    ErrorCompletingRequestException,
                    InterruptedException,
                    ObjectDoesNotExistException,
                    IOException,
                    UnsupportedEncodingException
Returns an IBM i system User object based on the user profile name and system associated with the principal.

The system property must be set and a valid userProfileName must be identified by the principal prior to requesting the user.

Returns:
The com.ibm.as400.access.User object.
Throws:
ExtendedIllegalStateException - If a required property is not set.
AS400Exception - If the IBM i system returns an error message.
AS400SecurityException - If a security or authority error occurs.
ConnectionDroppedException - If the connection is dropped unexpectedly.
ErrorCompletingRequestException - If an error occurs before the request is completed.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the system object does not exist.
UnsupportedEncodingException - If the character encoding is not supported.

getUserProfileName

public String getUserProfileName()
Returns the name of a user profile associated with the thread when work is performed on behalf of the principal.

Returns:
A String containing the name; empty if not applicable.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified listener from the internal list.

Does nothing if the listener is not in the list.

Parameters:
listener - The PropertyChangeListener.
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes the specified listener from the internal list.

Does nothing if the listener is not in the list.

Parameters:
listener - The VetoableChangeListener.
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener)

setSystem

public void setSystem(AS400 system)
               throws PropertyVetoException
Sets the AS400 system object for the principal.

Parameters:
system - The AS400 system object.
Throws:
PropertyVetoException - If the change is vetoed.