public class ProfileSessionFailService extends GenericService implements atg.servlet.sessionsaver.Restoreable
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); } }
Modifier and Type | Field and Description |
---|---|
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
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ProfileSessionFailService()
Constructs an instanceof ProfileSessionFailService
|
Modifier and Type | Method and Description |
---|---|
RepositoryItem |
getDataSource()
Gets the datasource property of the profile associated with this service.
|
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 |
setDataSource(RepositoryItem dataSource)
Set the datasource property on the profile associated with this service.
|
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
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
protected java.lang.String mUidForFailover
protected boolean mSecurityStatusFailoverEnabled
public ProfileSessionFailService()
public void setProfileTools(ProfileTools pProfileTools)
public ProfileTools getProfileTools()
public void setProfile(Profile pProfile)
public Profile getProfile()
public void setUidForFailover(java.lang.String pUidForFailover)
public java.lang.String getUidForFailover()
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.public void setDataSource(RepositoryItem dataSource)
dataSource
- The profile's datasource.public RepositoryItem getDataSource()
public void setFailedOverSecurityStatus(int pFailedOverSecurityStatus)
public int getFailedOverSecurityStatus()
public void sessionRestored()
sessionRestored
in interface atg.servlet.sessionsaver.Restoreable