BEA Systems, Inc.

com.beasys.portal.admin
Class PortalAdminHelper

java.lang.Object
  |
  +--com.beasys.portal.admin.PortalAdminHelper

public class PortalAdminHelper
extends java.lang.Object
implements PortalAdminConstants

Provides several utility services which facilitate portal run-time operation. These services assist in cookie and session management, Portal traffic routing, encoding/decoding, PortalManager access, and license management.


Fields inherited from interface com.beasys.portal.admin.PortalAdminConstants
DEFAULT_DESTINATION, DESTINATION_URI, FALSE, IMMUTABLE_PORTAL_PAGE, PORTAL_COOKIE_TIMEOUT, PORTAL_GROUP, PORTAL_LOGGED_IN, PORTAL_MANAGER_A, PORTAL_NAME, PORTAL_PAGE, PORTAL_PROPERTIES_A, PORTAL_SESSION_TIMEOUT, PORTAL_USER, PROFILE_GROUP, PROFILE_USER, TRAFFIC_URI, TRANSACTION_SERVICE, TRANSACTION_TIMEOUT, TRUE, WORKING_DIR
 
Constructor Summary
PortalAdminHelper()
           
 
Method Summary
static void checkAccess()
          Verifies that the correct licensing arrangement is in place for Portal Framework operation.
static java.lang.String decode(java.lang.String aString)
          Decodes the provided String using a Base64Decoder.
static java.lang.String encode(java.lang.String aString)
          Encodes the provided String using a Base64Encoder.
static javax.servlet.http.Cookie findCookie(java.lang.String aName, javax.servlet.http.Cookie[] cookies)
          Finds the cookie for a given cookie name.
static int getCookieTimeout(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the portal Cookie timeout, in seconds.
static java.lang.String getCookieValue(java.lang.String aName, javax.servlet.http.Cookie[] cookies)
          Retrieves a particular cookie value from a set of javax.servlet.http.Cookie objects.
static java.lang.String getDefaultDestination(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the default destination of the portal associated with the provided javax.servlet.http.HttpServletRequest.
static boolean getLoggedIn(javax.servlet.http.HttpServletRequest aRequest)
          Determines whether a user is currently logged into the portal.
static PortalManager getPortalManager()
          Retrieves a com.beasys.portal.PortalManager instance.
static PortalManager getPortalManager(javax.servlet.http.HttpServletRequest aRequest)
           
static PortalProperties getPortalProperties(javax.servlet.http.HttpServletRequest aRequest)
           
static java.lang.Object getSessionValue(java.lang.String aName, javax.servlet.http.HttpServletRequest aRequest)
          Retrieves a session value based on the name provided.
static java.lang.String getTrafficURI(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the URI of the PortalServiceManager associated with the request.
static java.lang.String getWorkingDirectory(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the working directory of the portal associated with the provided javax.servlet.http.HttpServletRequest.
static void putSessionValue(java.lang.String aName, java.lang.Object aValue, javax.servlet.http.HttpServletRequest aRequest)
          Sets a session value based on the name provided.
static java.lang.String qualifiedName(java.lang.String aBaseName, javax.servlet.http.HttpServletRequest aRequest)
          Creates a name, based on the provided base name, which uniquely identifies a session paramater as belonging to a particular PortalServiceManager.
static void removeSessionValue(java.lang.String aName, javax.servlet.http.HttpServletRequest aRequest)
          Removes a session value based on the name provided.
static void setCookie(java.lang.String aName, java.lang.String aValue, javax.servlet.http.Cookie[] cookies, javax.servlet.http.HttpServletResponse aResponse, int aMaxAge)
          Locates a javax.servlet.http.Cookie with a name matching the provided name, and sets the value of the Cookie to the provided value.
static void setSessionValue(java.lang.String aName, java.lang.Object aValue, javax.servlet.http.HttpServletRequest aRequest)
          Sets a session value based on the name provided.
static boolean validSession(javax.servlet.http.HttpServletRequest aRequest)
          Checks to see if the session has all of the valid values for portal run-time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortalAdminHelper

public PortalAdminHelper()
Method Detail

findCookie

public static javax.servlet.http.Cookie findCookie(java.lang.String aName,
                                                   javax.servlet.http.Cookie[] cookies)
Finds the cookie for a given cookie name.
Parameters:
aName - the cookie name
cookies - an array of cookies previously obtain from from the request.
Returns:
Cookie the cookie if found, null if not.

encode

public static java.lang.String encode(java.lang.String aString)
Encodes the provided String using a Base64Encoder.
Parameters:
aString - the String to encode
Returns:
String the encoded version of the provided String

decode

public static java.lang.String decode(java.lang.String aString)
                               throws java.io.IOException
Decodes the provided String using a Base64Decoder.
Parameters:
the - String to decode
Returns:
String the decoded version of the provided String
Throws:
IOException - buffer read error

setCookie

public static void setCookie(java.lang.String aName,
                             java.lang.String aValue,
                             javax.servlet.http.Cookie[] cookies,
                             javax.servlet.http.HttpServletResponse aResponse,
                             int aMaxAge)
Locates a javax.servlet.http.Cookie with a name matching the provided name, and sets the value of the Cookie to the provided value. Also, sets the maximum age of the Cookie to the age provided. If a cookie is not found in the provided array, a new cookie is created, and appropriate values are set.
Parameters:
aName - the Cookie name
aValue - the new Cookie value
cookies - the array of Cookie object searched for the provided name
aResponse - the javax.servlet.http.HttpServletResponse to which the cookie is added
aMaxAge - the maximum cookie age, in seconds

getTrafficURI

public static java.lang.String getTrafficURI(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the URI of the PortalServiceManager associated with the request.
Parameters:
aRequest - the request used to obtain the Traffic URI.
Returns:
String

getWorkingDirectory

public static java.lang.String getWorkingDirectory(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the working directory of the portal associated with the provided javax.servlet.http.HttpServletRequest.
Parameters:
aRequest - the HttpServletRequest associated with the portal
Returns:
String the working directory of the portal

getDefaultDestination

public static java.lang.String getDefaultDestination(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the default destination of the portal associated with the provided javax.servlet.http.HttpServletRequest. This value is the destination to which the PortalServiceManager directs the browser when no alternate destination is provided to the PortalServiceManager.
Parameters:
aRequest - the HttpServletRequest associated with the portal
Returns:
String the default destination of the portal

qualifiedName

public static java.lang.String qualifiedName(java.lang.String aBaseName,
                                             javax.servlet.http.HttpServletRequest aRequest)
Creates a name, based on the provided base name, which uniquely identifies a session paramater as belonging to a particular PortalServiceManager. This prevents naming collisions between multiple portal instances, as multiple portals can be part of the same session.
Parameters:
aBaseName - the base parameter name (e.g. "userName")
aRequest - the HttpServletRequest used to retrieve the Traffic URI, and therefore the correct PortalServiceManager name.
Returns:
String

getCookieValue

public static java.lang.String getCookieValue(java.lang.String aName,
                                              javax.servlet.http.Cookie[] cookies)
                                       throws java.io.IOException
Retrieves a particular cookie value from a set of javax.servlet.http.Cookie objects.
Parameters:
aName - the name of the Cookie from which the value is sought
cookies - an array of Cookie objects which is searched for the cookie whose name matches the provided name
Returns:
String the value of the cookie, if found ; null otherwise
Throws:
IOException - propagated from decode.

getCookieTimeout

public static int getCookieTimeout(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the portal Cookie timeout, in seconds.
Parameters:
aRequest - the javax.servlet.http.HttpServletRequest associated with the portal
Returns:
int the Cookie timeout, in seconds.

validSession

public static boolean validSession(javax.servlet.http.HttpServletRequest aRequest)
Checks to see if the session has all of the valid values for portal run-time. Also checks to see the session has timed out.
Parameters:
the - javax.servlet.http.HttpServletRequest from which the session is retreived
Returns:
boolean whether the session is valid

getLoggedIn

public static boolean getLoggedIn(javax.servlet.http.HttpServletRequest aRequest)
Determines whether a user is currently logged into the portal.
Parameters:
aRequest - the javax.servle.http.HttpServletRequest used to retrieve the portal's session
Returns:
boolean whether a user is currently logged into the portal

getSessionValue

public static java.lang.Object getSessionValue(java.lang.String aName,
                                               javax.servlet.http.HttpServletRequest aRequest)
Retrieves a session value based on the name provided. This name is a base name, which is qualified to correspond to a particular PortalServiceManager, so that naming collisions are avoided among portals which co-exist in the same session.
Parameters:
aName - the name of the session value to be retrieved
aRequest - the javax.servlet.http.HttpServletRequest used to retrieve the current session
Returns:
Object

setSessionValue

public static void setSessionValue(java.lang.String aName,
                                   java.lang.Object aValue,
                                   javax.servlet.http.HttpServletRequest aRequest)
Sets a session value based on the name provided. This name is a base name, which is qualified to correspond to a particular PortalServiceManager, so that naming collisions are avoided among portals which co-exist in the same session.
Parameters:
aName - the name of the session value to be set
aValue - the new session value
aRequest - the javax.servlet.http.HttpServletRequest used to retrieve the current session
Returns:
Object

putSessionValue

public static void putSessionValue(java.lang.String aName,
                                   java.lang.Object aValue,
                                   javax.servlet.http.HttpServletRequest aRequest)
Sets a session value based on the name provided. This name is a base name, which is qualified to correspond to a particular PortalServiceManager, so that naming collisions are avoided among portals which co-exist in the same session.
Parameters:
aName - the name of the session value to be set
aValue - the new session value
aRequest - the javax.servlet.http.HttpServletRequest used to retrieve the current session
Returns:
Object

removeSessionValue

public static void removeSessionValue(java.lang.String aName,
                                      javax.servlet.http.HttpServletRequest aRequest)
Removes a session value based on the name provided. This name is a base name, which is qualified to correspond to a particular PortalServiceManager, so that naming collisions are avoided among portals which co-exist in the same session.
Parameters:
aName - the name of the session value to be removed
aRequest - the javax.servlet.http.HttpServletRequest used to retrieve the current session
Returns:
Object

getPortalProperties

public static PortalProperties getPortalProperties(javax.servlet.http.HttpServletRequest aRequest)
                                            throws java.rmi.RemoteException,
                                                   PortalCreateException,
                                                   PortalException

getPortalManager

public static PortalManager getPortalManager(javax.servlet.http.HttpServletRequest aRequest)
                                      throws java.rmi.RemoteException,
                                             PortalCreateException,
                                             PortalException

getPortalManager

public static PortalManager getPortalManager()
                                      throws java.rmi.RemoteException,
                                             PortalCreateException,
                                             PortalException
Retrieves a com.beasys.portal.PortalManager instance.
Returns:
PortalManager a new PortalManager
Throws:
java.rmi.RemoteException - a remote connection failure
PortalCreateException - failure to create the PortalManager
PortalException - general Portal Framework problem

checkAccess

public static final void checkAccess()
Verifies that the correct licensing arrangement is in place for Portal Framework operation. Causes a System.exit() if the license is not found, or is not properly provisioned. Logs failure reason.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved