|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
oracle.jbo.common.ampool.SessionCookieImpl
Default SessionCookie implementation.
Default session cookie instances should only be instantiated by an application pool. This is required because the default session cookie uses the application pool framework to manage application state and to share application module instances between requests. Please see ApplicationPool.createSessionCookie(String, String, Properties) for more information about creating session cookies.
The default implementation uses a session cookie lock to prevent access to the session cookie application module resource by multiple threads. A lock is obtained when a thread invokes useApplicationModule. The lock is released when the thread invokes releaseApplicationModule.
Please see SessionCookie for more information about session cookies.
| Field Summary | |
protected java.util.Hashtable |
mEnvironment |
| Fields inherited from interface oracle.jbo.common.ampool.SessionCookie |
BUNDLED_EXC_MODE_KEY, FORCE_RELEASE_MODE, MANAGED_RELEASE_MODE, NULL_PASSIVATION_ID, REMOVE_RESOURCE, RESERVED_MANAGED_RELEASE_MODE, RESERVED_UNMANAGED_RELEASE_MODE, SHARED, SHARED_MANAGED_RELEASE_MODE, SHARED_RELEASE_MODE, SHARED_UNMANAGED_RELEASE_MODE, STATE_MANAGED, STATE_UNMANAGED, UNSHARED, VALUE_SINK_KEY |
| Constructor Summary | |
SessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool) |
|
SessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool, java.security.Principal userPrincipal)Constructor. |
|
| Method Summary | |
protected void |
afterApplicationModuleRelease() |
protected void |
beforeApplicationModuleRelease(ApplicationModule am) |
void |
copyInto(SessionCookie cookie)Copies the state of this cookie into the target cookie. |
boolean |
equals(java.lang.Object obj)Session cookies are equal if their application and session identifiers are equal |
java.lang.String |
getApplicationId()Returns the application id for this session cookie. |
java.util.Hashtable |
getClientEnvironment()Returns a java.util.Hashtable representing the BC4J context that is related to this application session. |
java.lang.Object |
getClientEnvironment(java.lang.Object key)Returns the value of the specified attribute from the ApplicationModuleHandle client environment. |
java.lang.String |
getEnvConfigurationName()Return the name of the BC4J configuration that was used to initialize the SessionCookie environment. |
EnvInfoProvider |
getEnvInfoProvider() |
java.util.Hashtable |
getEnvironment()Returns a java.util.Hashtable representing the BC4J context that is related to this application session. |
java.lang.Object |
getEnvironment(java.lang.Object key)Returns the value of the specified attribute from the ApplicationModuleHandle environment. |
boolean |
getIgnorePiggyback()INTERNAL USE ONLY. |
java.util.Date |
getLastUpdate()Returns a date value indicating the last time the state of this cookie was updated. |
int |
getMostRecentStackId()If the current thread holds an active ApplicationModule reference then this method will delegate to ApplicationModule.getMostRecentStackId(). |
int |
getPassivationId()Return an identifier for the last persisted session application state. |
long |
getPoolSignature()Returns the signature of the pool for which this session cookie is a handle. |
protected boolean |
getProperty(java.lang.String name, java.util.Hashtable environment, boolean defaultValue) |
int |
getReservedPassivationId()Return the identifier that will be used to persist the session application state at the end of the request. |
java.lang.String |
getSessionId()Returns the session identifier. |
java.lang.String |
getSSOSubscriber() |
java.lang.String |
getSSOUserName() |
java.lang.Object |
getSyncLock()INTERNAL USE ONLY. |
int |
getThreadRefCount()INTERNAL USE ONLY. |
java.util.Hashtable |
getUserData()Returns a java.util.Hashtable which may be used to store user specific context that is related to this application session. |
java.lang.Object |
getUserData(java.lang.Object name)Acquires the user data associated with the specified key from the SessionCookie user data map. |
java.lang.String |
getValue()Returns the session cookie value. |
int |
hashCode() |
boolean |
isActivationRequired()Indicates that state activation is required upon the next checkout for this session. |
boolean |
isActivationRequired(ApplicationModule context)Indicates that state activation is required upon the next checkout for this session. |
boolean |
isApplicationModuleReleased()Determines if the ApplicationModule which is referenced by this session has been released to the ApplicationPool. |
boolean |
isApplicationModuleReleasedByThread()If the cookie is multi-threaded then this method will determine if the invoking thread has released the SessionCookie ApplicationModule. |
boolean |
isApplicationModuleReserved()Tests if the application module that is referenced by this session cookie has been reserved for exclusive access by this session cookie. |
boolean |
isConnectionPoolingEnabled()Indicates that the session application module resource's JDBC connection should be released immediately upon release to the application pool. |
boolean |
isFailoverEnabled()Indicates that session application module state should be persisted to secondary storage immediately upon a managed release. |
boolean |
isResetNonTransactionalState()Indicates whether or not the non-transactional state of the session application module resource should be preserved upon an unmanaged release to the application pool. |
static int |
parsePassivationId(java.lang.String cookieValue) |
static java.lang.String |
parseSessionId(java.lang.String cookieValue) |
void |
passivateState(java.lang.Object sink)Passivates the session ApplicationModule state. |
java.lang.String |
readValue(java.lang.Object source)Read the cookie value to the specified data sink. |
void |
releaseApplicationModule(boolean checkin, boolean manageState)The default implementation will release the session cookie lock after having checked in the session application module. |
void |
releaseApplicationModule(boolean checkin, boolean manageState, long waitTimeout)The default implementation will release the session cookie lock after having checked in the session application module. |
void |
releaseApplicationModule(int releaseFlags)Release an application module for reuse. |
void |
releaseApplicationModule(int releaseFlags, long waitTimeout)Release an application module for reuse. |
protected void |
removeFromPool() |
java.lang.Object |
removeUserData(java.lang.Object name)Removes the user data associated with the specified key from the SessionCookie user data map. |
void |
reservePassivationId()Reserves a unique identifier for the session application. |
void |
reservePassivationId(java.lang.Object sink)Reserves a unique identifier for the session application. |
void |
resetState()Reset the ApplicationModule state associated with this ApplicationModuleRef. |
void |
resetStateInternal()INTERNAL USE ONLY. |
void |
setActivated(boolean activated)INTERNAL USE ONLY. |
void |
setActivationRequired(boolean activationRequired)May be used to force activation upon the next checkout for this session. |
void |
setEnvInfoProvider(EnvInfoProvider envInfo) |
void |
setEnvironment(java.util.Hashtable environment)Sets the session environment. |
void |
setEnvironment(java.lang.Object key, java.lang.Object value)Sets the session environment. |
void |
setIgnorePiggyback(boolean ignorePiggyback)INTERNAL USE ONLY. |
void |
setMostRecentStackId(int mostRecentStackId)INTERNAL USE ONLY. |
void |
setPassivationId(int passivationId)Sets the identifier for the last persisted session application state. |
void |
setReferenceCounting(boolean isReferenceCounting)Advanced Use Only: By default a SessionCookie may invoke useApplicationModule() an arbitrary number of times with only one matching releaseApplicationModule(int) invocation. |
void |
setReservedPassivationId(int reservedPassivationId)Set the identifier that will be used to persist the session application state. |
void |
setSessionCookieListener(SessionCookieListener listener)Set a session cookie listener on the cookie. |
void |
setSingleThreaded(boolean isSingleThreaded)Advanced Use Only: |
void |
setUserData(java.lang.Object name, java.lang.Object value)Puts user data in the SessionCookie user data map. |
void |
timeout()Internal use only. |
java.lang.String |
toString() |
ApplicationModule |
useApplicationModule()Returns an application module instance without acquiring a session cookie lock. |
ApplicationModule |
useApplicationModule(boolean lock)Returns an application module instance for the current thread. |
ApplicationModule |
useApplicationModule(boolean lock, long waitTimeout)The default implementation must obtain a session cookie lock before checking an application module instance out from the pool. |
boolean |
wasActivated()INTERANL USE ONLY. |
void |
writeValue(java.lang.Object sink)Write the cookie value to the specified data sink. |
void |
writeValue(java.lang.Object sink, java.lang.String value)Write the specified cookie value to the specified data sink. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.Hashtable mEnvironment
| Constructor Detail |
public SessionCookieImpl(java.lang.String applicationId,
java.lang.String sessionId,
ApplicationPool pool,
java.security.Principal userPrincipal)
Applications should not invoke this constructor directly. A session cookie factory should be used instead.
The implementation requires that all three parameters be not null.
applicationId - a unique identifier for the session applicationsessionId - a unique identifer for the sessionpool - an application pool instance
public SessionCookieImpl(java.lang.String applicationId,
java.lang.String sessionId,
ApplicationPool pool)
| Method Detail |
public EnvInfoProvider getEnvInfoProvider()
getEnvInfoProvider in interface SessionCookiepublic void setEnvInfoProvider(EnvInfoProvider envInfo)
setEnvInfoProvider in interface SessionCookiepublic java.util.Date getLastUpdate()
SessionCookiegetLastUpdate in interface SessionCookiepublic java.lang.String toString()
toString in interface SessionCookiepublic int hashCode()
hashCode in interface SessionCookiepublic boolean equals(java.lang.Object obj)
equals in interface SessionCookiepublic long getPoolSignature()
SessionCookiegetPoolSignature in interface SessionCookiepublic java.lang.String getApplicationId()
SessionCookiegetApplicationId in interface SessionCookiepublic java.lang.String getSessionId()
SessionCookieSession identifers should be uniques across sessions and consistent across servers.
getSessionId in interface SessionCookiepublic java.lang.String getValue()
SessionCookieSession cookie values represent the session application state.
getValue in interface SessionCookiepublic java.lang.String getEnvConfigurationName()
SessionCookiegetEnvConfigurationName in interface SessionCookiepublic java.util.Hashtable getEnvironment()
ApplicationModuleHandlegetEnvironment in interface ApplicationModuleHandlepublic java.lang.Object getEnvironment(java.lang.Object key)
ApplicationModuleHandlegetEnvironment in interface ApplicationModuleHandlepublic java.util.Hashtable getClientEnvironment()
ApplicationModuleHandleApplicationModuleHandle.getEnvironment() in that the client environment will not be marshalled to the middle tier.getClientEnvironment in interface ApplicationModuleHandlepublic java.lang.Object getClientEnvironment(java.lang.Object key)
ApplicationModuleHandlegetClientEnvironment in interface ApplicationModuleHandle
public void setEnvironment(java.lang.Object key,
java.lang.Object value)
SessionCookiesetEnvironment in interface SessionCookiepublic void setEnvironment(java.util.Hashtable environment)
SessionCookiesetEnvironment in interface SessionCookiepublic boolean isApplicationModuleReserved()
ApplicationModuleRefisApplicationModuleReserved in interface ApplicationModuleRefpublic boolean isApplicationModuleReleased()
SessionCookieThis method differs from ApplicationModuleRef.isApplicationModuleReserved() in that isApplicationModuleReserved will return true if an unshared or reserved release mode has been used to release an ApplicationModule.
isApplicationModuleReleased in interface SessionCookiepublic boolean isApplicationModuleReleasedByThread()
SessionCookieIf the SessionCookie ApplicationModule has been released then true will be returned.
If the invoking thread did not previously invoke ApplicationModuleRef.useApplicationModule() since the last release then true will be returned.
If the cookie is single threaded then this method will return the same result as SessionCookie.isApplicationModuleReleased()
isApplicationModuleReleasedByThread in interface SessionCookie{@link #isApplicationModuleReleased()}public ApplicationModule useApplicationModule()
ApplicationModuleRefuseApplicationModule in interface ApplicationModuleRefApplicationModuleRef.useApplicationModule(boolean, long)public ApplicationModule useApplicationModule(boolean lock)
ApplicationModuleRefuseApplicationModule in interface ApplicationModuleReflock - specify whether a session lock should be acquired for the shared application module resourceApplicationModuleRef.useApplicationModule(boolean, long)
public ApplicationModule useApplicationModule(boolean lock,
long waitTimeout)
useApplicationModule in interface ApplicationModuleReflock - specify whether a session lock should be acquired for the shared application module resourcewaitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lockpublic void timeout()
protected void removeFromPool()
public void releaseApplicationModule(boolean checkin,
boolean manageState)
releaseApplicationModule in interface SessionCookiecheckin - SHARED or UNSHAREDmanageState - manage the session application state between requests
public void releaseApplicationModule(boolean checkin,
boolean manageState,
long waitTimeout)
releaseApplicationModule in interface SessionCookiecheckin - SHARED or UNSHAREDmanageState - STATE_MANAGED or STATE_UNMANAGEDwaitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lockpublic void releaseApplicationModule(int releaseFlags)
SessionCookieThis method should be invoked at the end of each session request.
If another thread is holding the lock associated with the session cookie then the current thread will wait for the period specified by the waitTimeout parameter. The current thread may be blocked upon invoking releaseApplicationModule if it did not acquire a session cookie lock when it dereferenced the application module with {@link #useApplicationModule(b oolean).
The SessionCookie supports the following release modes:
SHARED_MANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state.
SHARED_UNMANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state.
RESERVED_UNMANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state. This mode would be used if failover is not required.
RESERVED_MANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state. This mode would be used if failover is required for a reserved ApplicationModule instance.
releaseApplicationModule in interface SessionCookiereleaseFlags - the desired releaseFlags. Must be one of the following release modes: SHARED_MANAGED_RELEASE_MODE SHARED_UNMANAGED_RELEASE_MODE RESERVED_UNMANAGED_RELEASE_MODE RESERVED_MANAGED_RELEASE_MODE
public void releaseApplicationModule(int releaseFlags,
long waitTimeout)
SessionCookieThis method should be invoked at the end of each session request.
If another thread is holding the lock associated with the session cookie then the current thread will wait for the period specified by the waitTimeout parameter. The current thread may be blocked upon invoking releaseApplicationModule if it did not acquire a session cookie lock when it dereferenced the application module with {@link #useApplicationModule(boolean).
The SessionCookie supports the following release modes:
SHARED_MANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state.
SHARED_UNMANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state.
RESERVED_UNMANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state. This mode would be used if failover is not required.
RESERVED_MANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state. This mode would be used if failover is required for a reserved ApplicationModule instance.
releaseApplicationModule in interface SessionCookiereleaseFlags - the desired releaseFlags. Must be one of the following release modes: SHARED_MANAGED_RELEASE_MODE SHARED_UNMANAGED_RELEASE_MODE RESERVED_UNMANAGED_RELEASE_MODE RESERVED_MANAGED_RELEASE_MODEwaitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lockprotected void beforeApplicationModuleRelease(ApplicationModule am)
protected void afterApplicationModuleRelease()
public void writeValue(java.lang.Object sink)
SessionCookiewriteValue in interface SessionCookiesink - a data sink
public void writeValue(java.lang.Object sink,
java.lang.String value)
SessionCookiewriteValue in interface SessionCookiesink - a data sinkpublic java.lang.String readValue(java.lang.Object source)
SessionCookiereadValue in interface SessionCookiesource - a data sourcepublic final java.lang.Object getSyncLock()
SessionCookiegetSyncLock in interface SessionCookiepublic boolean isActivationRequired()
SessionCookieisActivationRequired in interface SessionCookiepublic boolean isActivationRequired(ApplicationModule context)
SessionCookieThe ApplicationModule may not yet be in a valid state so care should be taken when accessing the ApplicationModule from a custom SessionCookie implementation.
This method is invoked only if the session's affinity to its ApplicationModule was maintained between requests. The return value of this method is ignored if the session's affinity to its ApplicationModule was lost. INTERNAL USE ONLY. Applications should not use this method.
isActivationRequired in interface SessionCookiepublic void setActivationRequired(boolean activationRequired)
SessionCookiesetActivationRequired in interface SessionCookiepublic int getPassivationId()
SessionCookiegetPassivationId in interface SessionCookiepublic void setPassivationId(int passivationId)
SessionCookiesetPassivationId in interface SessionCookiepublic int getMostRecentStackId()
SessionCookieApplicationModule.getMostRecentStackId().
If the current thread does not reference a reserved ApplicationModule then this method will return a local copy of the most recent stack id.
The local copy is updated in the following circumstances:
SessionCookie.reservePassivationId() is invoked.SessionCookie.getMostRecentStackId() is invoked while the SessionCookie holds an active ApplicationModule reference.The local stack snapshot id allows SessionCookie clients to reuse persistent snapshot ids as stack snapshots. This will reduce the memory overhead of maintaining an in-memory snapshot of an ApplicationModule state. This method should only be used if failover has been enabled.
This method is really only useful for clients that have enabled failover and require the stack id after the ApplicationModule has been released. Invoking this method while an active ApplicationModule reference is held is equivalent to invoking ApplicationModule.getMostRecentStackId() and therefore does not add any value.
getMostRecentStackId in interface SessionCookiepublic void setMostRecentStackId(int mostRecentStackId)
SessionCookieThis method is used by the pooling framework to set the local most recent stack id.
setMostRecentStackId in interface SessionCookie{@link #getMostRecentStackId()}public void passivateState(java.lang.Object sink)
SessionCookieIf a not null sink is passed then passivateState should persist the passivation id to the sink using SessionCookie.writeValue(Object).
State passivation should not take place if failover is disabled.
passivateState in interface SessionCookiepublic void reservePassivationId()
SessionCookieA passivation id should not be reserved if one has already been reserved or if failover is disabled.
reservePassivationId in interface SessionCookieSessionCookie.getReservedPassivationId()public void reservePassivationId(java.lang.Object sink)
SessionCookieIf a not null sink is passed then reservePassivationId should persist the reserved passivation id to the sink using SessionCookie.writeValue(Object).
A passivation id should not be reserved if one has already been reserved or if failover is disabled.
reservePassivationId in interface SessionCookieSessionCookie.getReservedPassivationId()public int getReservedPassivationId()
SessionCookieThe next passivation id should be used when generating the session cookie value.
getReservedPassivationId in interface SessionCookiepublic void setReservedPassivationId(int reservedPassivationId)
SessionCookiesetReservedPassivationId in interface SessionCookiepublic java.util.Hashtable getUserData()
ApplicationModuleHandlegetUserData in interface ApplicationModuleHandlepublic java.lang.String getSSOUserName()
getSSOUserName in interface SessionCookiepublic java.lang.String getSSOSubscriber()
getSSOSubscriber in interface SessionCookiepublic void resetState()
ApplicationModuleRefInvoking this method after an ApplicationModule has been released with state management specified will result in the affinity between the ApplicationModuleRef and the ApplicationModule state being lost. Consequently, the next time invocation of useApplicationModule on this ApplicationModuleRef will return a stateless Applicationmodule.
Invoking this method on an ApplicationModuleRef which is not referencing any ApplicationModule state will have no effect. Invoking this method on an ApplicationModuleRef which is currently reserving an ApplicationModule will result in an ApplicationPoolException.
resetState in interface ApplicationModuleRefpublic void resetStateInternal()
SessionCookieresetStateInternal in interface SessionCookiepublic void copyInto(SessionCookie cookie)
SessionCookiecopyInto in interface SessionCookiecookie - the target of the copy.public boolean isFailoverEnabled()
SessionCookieSession cookie developers should be careful that this value not change after a session cookie has become active.
isFailoverEnabled in interface SessionCookiepublic boolean isConnectionPoolingEnabled()
SessionCookieSession cookie developers should be careful that this value not change after a session cookie has become active.
isConnectionPoolingEnabled in interface SessionCookiepublic boolean isResetNonTransactionalState()
SessionCookieTransactional state includes the state of the transaction caches (EO and VO) and database state. Non-transactional state includes child view usage and application module usage instances and their related state including dynamic where clauses, order by clauses, and bind parameters. If connection pooling has been disabled for the application pool then non-transaction state will also include any cached JDBC statements.
isResetNonTransactionalState in interface SessionCookie
protected boolean getProperty(java.lang.String name,
java.util.Hashtable environment,
boolean defaultValue)
public void setSessionCookieListener(SessionCookieListener listener)
SessionCookiesetSessionCookieListener in interface SessionCookiepublic static java.lang.String parseSessionId(java.lang.String cookieValue)
public static int parsePassivationId(java.lang.String cookieValue)
public final int getThreadRefCount()
SessionCookiegetThreadRefCount in interface SessionCookiepublic void setSingleThreaded(boolean isSingleThreaded)
Setting this property will force the cookie to maintain a refcount for all threads that have invoked useApplicationModule after the property has been set. Only after the last thread that has used the application module releases the application will the application module actually be returned to the pool.
The default value of this property for SessionCookieImpl instances is true.
The default value of this property for HttpSessionCookieImpl instances is false.
public void setReferenceCounting(boolean isReferenceCounting)
SessionCookieApplicationModuleRef.useApplicationModule() an arbitrary number of times with only one matching SessionCookie.releaseApplicationModule(int) invocation. The release will always result in the ApplicationModule being released to the ApplicationPool. If reference counting is enabled then the number of release invocations must match the number of use invocations and only the last release will result in the ApplicationModule being released to the ApplicationPool.setReferenceCounting in interface SessionCookie
public void setUserData(java.lang.Object name,
java.lang.Object value)
SessionCookieSessionCookie user data is automatically synched with the ApplicationModule upon ApplicationModule use.
setUserData in interface SessionCookiepublic java.lang.Object getUserData(java.lang.Object name)
SessionCookiegetUserData in interface SessionCookiepublic java.lang.Object removeUserData(java.lang.Object name)
SessionCookieremoveUserData in interface SessionCookiepublic boolean wasActivated()
SessionCookiewasActivated in interface SessionCookiepublic void setActivated(boolean activated)
SessionCookiesetActivated in interface SessionCookiepublic boolean getIgnorePiggyback()
SessionCookiegetIgnorePiggyback in interface SessionCookiepublic void setIgnorePiggyback(boolean ignorePiggyback)
SessionCookiesetIgnorePiggyback in interface SessionCookie
|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-02 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Copyright © 1997, 2005, Oracle. All rights reserved.