atg.userprofiling
Class ProfileSessionFailService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.userprofiling.ProfileSessionFailService
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, atg.servlet.sessionsaver.Restoreable, java.util.EventListener
Direct Known Subclasses:
CommerceProfileFailService

public class ProfileSessionFailService
extends GenericService
implements atg.servlet.sessionsaver.Restoreable

This service is used to preserve a user's active profile in the event of a session failover to another Dynamo server. This service backs up the user id of the profile for the session. The id is only saved if the user is not anonymous. If the profile is transient, then by default is nothing is backup.

To backup profile attributes of anonymous visitors, developers should subclass this class. JavaBean properties should be added which expose and record the desired attribute. The sessionRestored method can be overrode to then update the final profile with the desired saved attributes.

For example the subclass could have functionality similar to this:

 protected byte [] mShoppingCart;

 public void setShoppingCart(byte [] pShoppingCart) {
   mShoppingCart = pShoppingCart;
 }
 public byte [] getShoppingCart() {
   if (getProfile() != null)
     return (byte [])getProfile().getPropertyValue("shoppingCart");
   return null;
 }

 public void sessionRestored () {
   super.sessionRestored();
   if ((mShoppingCart != null) && (mShoppingCart.length > 0) &&
       (getProfile() != null)) {
     try {
       getProfileTools().updateProperty("shoppingCart", mShoppingCart, getProfile());
     }
     catch (RepositoryException exc) {
       if (isLoggingError())
         logError(exc);
     }
   }
 


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  boolean mSecurityStatusFailoverEnabled
          The restored value of the profile id
protected  java.lang.String mUidForFailover
          The restored value of the profile id
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ProfileSessionFailService()
          Constructs an instanceof ProfileSessionFailService
 
Method Summary
 int getFailedOverSecurityStatus()
           
 Profile getProfile()
          Returns property Profile
 ProfileTools getProfileTools()
          Returns property ProfileTools
 java.lang.String getUidForFailover()
          Returns the user id of the profile.
 void sessionRestored()
          This restoring method takes the mUidForFailover member variable and attempts to load the profile with the given id.
 void setFailedOverSecurityStatus(int pFailedOverSecurityStatus)
          After a profile is failed over, the security status of the re-established profile will be set to this value.
 void setProfile(Profile pProfile)
          Sets property Profile
 void setProfileTools(ProfileTools pProfileTools)
          Sets property ProfileTools
 void setUidForFailover(java.lang.String pUidForFailover)
          Stores the uidForFailover parameter in the member variable mUidForFailover
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mUidForFailover

protected java.lang.String mUidForFailover
The restored value of the profile id


mSecurityStatusFailoverEnabled

protected boolean mSecurityStatusFailoverEnabled
The restored value of the profile id

Constructor Detail

ProfileSessionFailService

public ProfileSessionFailService()
Constructs an instanceof ProfileSessionFailService

Method Detail

setProfileTools

public void setProfileTools(ProfileTools pProfileTools)
Sets property ProfileTools


getProfileTools

public ProfileTools getProfileTools()
Returns property ProfileTools


setProfile

public void setProfile(Profile pProfile)
Sets property Profile


getProfile

public Profile getProfile()
Returns property Profile


setUidForFailover

public void setUidForFailover(java.lang.String pUidForFailover)
Stores the uidForFailover parameter in the member variable mUidForFailover


getUidForFailover

public java.lang.String getUidForFailover()
Returns the user id of the profile. If the profile property is null, or the profile is anonymous then we return null to indicate that this user does not exist in the persistent repository.


setFailedOverSecurityStatus

public void setFailedOverSecurityStatus(int pFailedOverSecurityStatus)
After a profile is failed over, the security status of the re-established profile will be set to this value. This allows a security conscious site to force relogin upon failover to plug any potential security holes during failover. Setting this value to -1 will allow the actual value to be failed over, but you will need to add the value to the list of properties to be failed over.


getFailedOverSecurityStatus

public int getFailedOverSecurityStatus()

sessionRestored

public void sessionRestored()
This restoring method takes the mUidForFailover member variable and attempts to load the profile with the given id. If mUidForFailover is null then this means that the user was anonymous and we do not attempt to load the profile from the database.

Specified by:
sessionRestored in interface atg.servlet.sessionsaver.Restoreable