com.ibm.as400.security.auth
Class AS400Principal

java.lang.Object
  |
  +--com.ibm.as400.security.auth.AS400Principal
All Implemented Interfaces:
java.security.Principal, java.io.Serializable

public abstract class AS400Principal
extends java.lang.Object
implements java.security.Principal, java.io.Serializable

The AS400Principal class provides an abstract superclass for representations of AS/400 security-related identities.

Typical AS/400 Principals include, but are not necessarily limited to, user profiles.

See Also:
Serialized Form

Constructor Summary
AS400Principal()
          Constructs an AS400Principal object.
AS400Principal(AS400 system)
          Constructs an AS400Principal object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 java.lang.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 AS/400 User object based on the user profile name and system associated with the principal.
 java.lang.String getUserProfileName()
          Returns the name of a user profile associated with the OS/400 thread when work is performed on behalf of the principal.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the specified listener from the internal list.
 void removeVetoableChangeListener(java.beans.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 AS/400 associated with the principal.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.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(java.beans.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 java.lang.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 java.security.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,
                    java.lang.InterruptedException,
                    ObjectDoesNotExistException,
                    java.io.IOException,
                    java.io.UnsupportedEncodingException
Returns an AS/400 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 AS/400 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.
java.lang.InterruptedException - If this thread is interrupted.
java.io.IOException - If an error occurs while communicating with the AS/400.
ObjectDoesNotExistException - If the AS/400 object does not exist.
java.io.UnsupportedEncodingException - If the character encoding is not supported.

getUserProfileName

public java.lang.String getUserProfileName()
Returns the name of a user profile associated with the OS/400 thread when work is performed on behalf of the principal.
Returns:
A String containing the name; empty if not applicable.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.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(java.beans.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 java.beans.PropertyVetoException
Sets the AS400 system object for the principal.
Parameters:
system - The AS400 system object.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.