All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class hp.ov.session.Session

java.lang.Object
   |
   +----hp.ov.session.Session

public class Session
extends Object
Session represents a user session for an HP OpenView Java Console. The Session class provides information about the current user session, including the user's name, roles, and specified locale.


Constructor Index

 o Session(Applet)
The constructor.

Method Index

 o getJavaConverter()
Get the character encoding for the InputStreamReader converter class.
 o getLocale()
Get the Java locale object for the session.
 o getOSLocale()
Get the platform-dependent OS locale for the session.
 o getRoles()
Get the roles for the user for the session.
 o getSessionID()
Get the session ID for the session.
 o getUser()
Get the user for the session.
 o getWebLocale()
Get the platform-independent Web locale for the session.
 o isLoginEnabled()
Check whether user login is enabled.
 o isSessionValid()
Check whether the session is valid.
 o userHasRole(String)
Check whether the current user has the specified role.

Constructors

 o Session
 public Session(Applet applet) throws NoSessionException
The constructor. Checks whether there is a valid session (that is, the user has done a login if user login is enabled) and initializes the session information, including the Java locale for the session.

Parameters:
applet - the calling Java applet

Methods

 o isSessionValid
 public boolean isSessionValid()
Check whether the session is valid. There is not a valid session if user login is enabled and the user has not yet done a login to the HP OpenView Java Console.

Returns:
true if the session if valid; false otherwise
 o getSessionID
 public String getSessionID()
Get the session ID for the session. The session ID has the form "hostname:n" (e.g., "server.acme.com:42"). The hostname refers to the server on which the session is maintained.

Returns:
the session ID
 o isLoginEnabled
 public boolean isLoginEnabled()
Check whether user login is enabled. If user login is enabled for the HP OpenView Java Console, the user must do a login to the HP OpenView Java Console. If user login is disabled, the user is not required to do a login.

Returns:
true if user login if enabled; false otherwise
 o getUser
 public String getUser()
Get the user for the session.

Returns:
the user name if user login is enabled; null if user login is disabled
 o getRoles
 public String getRoles()
Get the roles for the user for the session. Returns a blank-separated list of user roles (e.g., "netop sysadm").

Returns:
the user roles if user login is enabled; null if user login is disabled
 o userHasRole
 public boolean userHasRole(String role)
Check whether the current user has the specified role.

Parameters:
role - the specified role
Returns:
true if the user has the specified role; false if the current user does not have the specified role or if user login is disabled
 o getLocale
 public static Locale getLocale()
Get the Java locale object for the session. This returns the Java locale object created based on the locale specified by the user when the session was started. The Java applet should use this locale and not rely on the default locale for the applet. (Due to applet security restrictions, the applet cannot set the default locale.)

Locale-sensitive classes have a locale argument for the constructor or other appropriate methods. If the locale is not specified, the default locale for the Java virtual machine is used. The applet should call these methods with the locale returned by Session.getLocale() instead of relying on the default locale. For example, the applet should call Collator.getInstance(session.getLocale()) rather than Collator.getInstance().

Returns:
the Java locale object for the session
 o getWebLocale
 public static String getWebLocale()
Get the platform-independent Web locale for the session. This is the locale set via the Web browser. The format is typically "language-country". Examples: "en-US", "de-DE".

Returns:
the Web locale for the session; "en-US" is returned if the session is not valid
See Also:
getOSLocale
 o getJavaConverter
 public static String getJavaConverter()
Get the character encoding for the InputStreamReader converter class. This is used to convert characters from some specified encoding to Unicode. This only needs to be used if codeset conversion is not done on the server using the Iconv routines.

Returns:
the character encoding to be used for converting characters to Unicode via the InputStreamReader class; null is returned if the session is not valid
 o getOSLocale
 public static String getOSLocale()
Get the platform-dependent OS locale for the session. This is the name of the locale used by the Web UI server system. For example, the Web locale "en-US" corresponds to "C" on many types of systems. This can be used for file lookups on the server.

Returns:
the OS locale for the session; "C" is returned if the session is not valid
See Also:
getWebLocale

All Packages  Class Hierarchy  This Package  Previous  Next  Index