com.sun.grid.jgdi.security

## Class JGDIPrincipal

- java.lang.Object
- - com.sun.grid.jgdi.security.JGDIPrincipal

- All Implemented Interfaces:
    java.io.Serializable, java.security.Principal

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

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `SESSION_ID_PREFIX`
    `static java.lang.String` | `SESSION_ID_SUFFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JGDIPrincipal(java.lang.String username, long sessionId)` Create a JGDIPrincipal with a username.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)` Compares the specified Object with this `JGDIPrincipal` for equality.
    `java.lang.String` | `getName()` Return the username for this `JGDIPrincipal`.
    `long` | `getSessionId()` Get the session id
    `java.lang.String` | `getUsername()` Get the username
    `int` | `hashCode()` Return a hash code for this `JGDIPrincipal`.
    `java.lang.String` | `toString()` Return a string representation of this `JGDIPrincipal`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `implies`

- - ### Field Detail

    - #### SESSION_ID_PREFIX

          public static final java.lang.String SESSION_ID_PREFIX

      See Also:
        Constant Field Values

    - #### SESSION_ID_SUFFIX

          public static final java.lang.String SESSION_ID_SUFFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JGDIPrincipal

          public JGDIPrincipal(java.lang.String username,
                               long sessionId)

      Create a JGDIPrincipal with a username.

      Parameters:
        `username` - the username for this user.
        `sessionId` - the id of the session
      Throws:
        `java.lang.NullPointerException` - if the `name` is `null`.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Return the username for this `JGDIPrincipal`.

      Specified by:
        `getName` in interface `java.security.Principal`
      Returns:
        the username for this `JGDIPrincipal`

    - #### toString

          public java.lang.String toString()

      Return a string representation of this `JGDIPrincipal`.

      Specified by:
        `toString` in interface `java.security.Principal`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of this `JGDIPrincipal`.

    - #### equals

          public boolean equals(java.lang.Object o)

      Compares the specified Object with this `JGDIPrincipal` for equality. Returns true if the given object is also a `JGDIPrincipal` and the two JGDIPrincipals have the same username.

      Specified by:
        `equals` in interface `java.security.Principal`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `o` - Object to be compared for equality with this `JGDIPrincipal`.
      Returns:
        true if the specified Object is equal equal to this `JGDIPrincipal`.

    - #### hashCode

          public int hashCode()

      Return a hash code for this `JGDIPrincipal`.

      Specified by:
        `hashCode` in interface `java.security.Principal`
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hash code for this `JGDIPrincipal`.

    - #### getSessionId

          public long getSessionId()

      Get the session id
      Returns:
        the session id

    - #### getUsername

          public java.lang.String getUsername()

      Get the username
      Returns:
        the username

Copyright © 2007 Sun Microsystems, Inc. All rights reserved.