Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

oracle.jbo.common.ampool
Class SessionCookieImpl

java.lang.Object
  extended by oracle.jbo.common.ampool.SessionCookieImpl
All Implemented Interfaces:
java.io.Serializable, ApplicationModuleHandle, ApplicationModuleRef, SessionCookie
Direct Known Subclasses:
RemoteCookieImpl

public class SessionCookieImpl
extends java.lang.Object
implements SessionCookie, java.io.Serializable

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.

See Also:
Serialized Form

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.
 void destroy()
          Destroys the SessionCookie.
 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.
protected  ApplicationPool getApplicationPool()
           
 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.lang.Object getInfoObject()
          INTERNAL USE ONLY.
 java.util.Date getLastUpdate()
          Returns a date value indicating the last time the state of this cookie was updated.
 long getLastUpdateLong()
           
 ApplicationPoolSvcMsgContext getMessageContext()
          Returns the current message context for this cookie.
 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.
 boolean getProperty(java.lang.String name, boolean defaultValue)
           
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.
 boolean isWriteCookieValue()
          Indicates that the cookie passivation id should be written to the client.
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 setInfoObject(java.lang.Object infoObject)
          INTERNAL USE ONLY.
 void setMessageContext(ApplicationPoolSvcMsgContext messageContext)
          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 ApplicationModuleRef.useApplicationModule() an arbitrary number of times with only one matching SessionCookie.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

mEnvironment

protected java.util.Hashtable mEnvironment
Constructor Detail

SessionCookieImpl

public SessionCookieImpl(java.lang.String applicationId,
                         java.lang.String sessionId,
                         ApplicationPool pool,
                         java.security.Principal userPrincipal)
Constructor.

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.

Parameters:
applicationId - a unique identifier for the session application
sessionId - a unique identifer for the session
pool - an application pool instance

SessionCookieImpl

public SessionCookieImpl(java.lang.String applicationId,
                         java.lang.String sessionId,
                         ApplicationPool pool)
Method Detail

getEnvInfoProvider

public EnvInfoProvider getEnvInfoProvider()
Specified by:
getEnvInfoProvider in interface SessionCookie

setEnvInfoProvider

public void setEnvInfoProvider(EnvInfoProvider envInfo)
Specified by:
setEnvInfoProvider in interface SessionCookie

getLastUpdate

public java.util.Date getLastUpdate()
Description copied from interface: SessionCookie
Returns a date value indicating the last time the state of this cookie was updated.

Specified by:
getLastUpdate in interface SessionCookie

getLastUpdateLong

public long getLastUpdateLong()
Specified by:
getLastUpdateLong in interface SessionCookie

toString

public java.lang.String toString()
Specified by:
toString in interface SessionCookie
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface SessionCookie
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Session cookies are equal if their application and session identifiers are equal

Specified by:
equals in interface SessionCookie
Overrides:
equals in class java.lang.Object

getPoolSignature

public long getPoolSignature()
Description copied from interface: SessionCookie
Returns the signature of the pool for which this session cookie is a handle.

Specified by:
getPoolSignature in interface SessionCookie

getApplicationId

public java.lang.String getApplicationId()
Description copied from interface: SessionCookie
Returns the application id for this session cookie.

Specified by:
getApplicationId in interface SessionCookie

getSessionId

public java.lang.String getSessionId()
Description copied from interface: SessionCookie
Returns the session identifier.

Session identifers should be uniques across sessions and consistent across servers.

Specified by:
getSessionId in interface SessionCookie

getValue

public java.lang.String getValue()
Description copied from interface: SessionCookie
Returns the session cookie value.

Session cookie values represent the session application state.

Specified by:
getValue in interface SessionCookie

getEnvConfigurationName

public java.lang.String getEnvConfigurationName()
Description copied from interface: SessionCookie
Return the name of the BC4J configuration that was used to initialize the SessionCookie environment. The name of the configuration will be a package qualified name. If the pool environment was not initialized by a BC4J configuration then this method will return null.

Specified by:
getEnvConfigurationName in interface SessionCookie

getEnvironment

public java.util.Hashtable getEnvironment()
Description copied from interface: ApplicationModuleHandle
Returns a java.util.Hashtable representing the BC4J context that is related to this application session. Application developers should not modify this environment directly.

Specified by:
getEnvironment in interface ApplicationModuleHandle

getEnvironment

public java.lang.Object getEnvironment(java.lang.Object key)
Description copied from interface: ApplicationModuleHandle
Returns the value of the specified attribute from the ApplicationModuleHandle environment.

Specified by:
getEnvironment in interface ApplicationModuleHandle

getClientEnvironment

public java.util.Hashtable getClientEnvironment()
Description copied from interface: ApplicationModuleHandle
Returns a java.util.Hashtable representing the BC4J context that is related to this application session. Application developers should not modify this environment directly. The client environment differs from the environment returned by ApplicationModuleHandle.getEnvironment() in that the client environment will not be marshalled to the middle tier.

Specified by:
getClientEnvironment in interface ApplicationModuleHandle

getClientEnvironment

public java.lang.Object getClientEnvironment(java.lang.Object key)
Description copied from interface: ApplicationModuleHandle
Returns the value of the specified attribute from the ApplicationModuleHandle client environment.

Specified by:
getClientEnvironment in interface ApplicationModuleHandle

setEnvironment

public void setEnvironment(java.lang.Object key,
                           java.lang.Object value)
Description copied from interface: SessionCookie
Sets the session environment. When creating a session cookie the application pool should use this method to initialize the new session cookie instance with the default pool environment. After initializiation the developer may use this method to modify any session level application pool properties. An ApplicationPoolException will be thrown if this method is invoked after the session cookie has become active.

Specified by:
setEnvironment in interface SessionCookie

setEnvironment

public void setEnvironment(java.util.Hashtable environment)
Description copied from interface: SessionCookie
Sets the session environment. When creating a session cookie the application pool should use this method to initialize the new session cookie instance with the default pool environment. After initializiation the developer may use this method to modify any session level application pool properties. An ApplicationPoolException will be thrown if this method is invoked after the session cookie has become active.

Specified by:
setEnvironment in interface SessionCookie

isApplicationModuleReserved

public boolean isApplicationModuleReserved()
Description copied from interface: ApplicationModuleRef
Tests if the application module that is referenced by this session cookie has been reserved for exclusive access by this session cookie.

Specified by:
isApplicationModuleReserved in interface ApplicationModuleRef
Returns:
boolean true if the referenced instance is reserved

isApplicationModuleReleased

public boolean isApplicationModuleReleased()
Description copied from interface: SessionCookie
Determines if the ApplicationModule which is referenced by this session has been released to the ApplicationPool. If this SessionCookie is not referencing an ApplicationModule then true is returned.

This 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.

Specified by:
isApplicationModuleReleased in interface SessionCookie

isApplicationModuleReleasedByThread

public boolean isApplicationModuleReleasedByThread()
Description copied from interface: SessionCookie
If the cookie is multi-threaded then this method will determine if the invoking thread has released the SessionCookie ApplicationModule.

If 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()

Specified by:
isApplicationModuleReleasedByThread in interface SessionCookie
See Also:
SessionCookie.isApplicationModuleReleased()

useApplicationModule

public ApplicationModule useApplicationModule()
Description copied from interface: ApplicationModuleRef
Returns an application module instance without acquiring a session cookie lock.

Specified by:
useApplicationModule in interface ApplicationModuleHandle
Specified by:
useApplicationModule in interface ApplicationModuleRef
See Also:
ApplicationModuleRef.useApplicationModule(boolean, long)

useApplicationModule

public ApplicationModule useApplicationModule(boolean lock)
Description copied from interface: ApplicationModuleRef
Returns an application module instance for the current thread. Uses the default waitTimeout specified by the cookie.

Specified by:
useApplicationModule in interface ApplicationModuleRef
Parameters:
lock - specify whether a session lock should be acquired for the shared application module resource
See Also:
ApplicationModuleRef.useApplicationModule(boolean, long)

useApplicationModule

public 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. This will prevent multi-threaded use of an application module instance for a given session.

Specified by:
useApplicationModule in interface ApplicationModuleRef
Parameters:
lock - specify whether a session lock should be acquired for the shared application module resource
waitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lock

destroy

public void destroy()
Description copied from interface: SessionCookie
Destroys the SessionCookie. Removes the SessionCookie from the pool. Throws an exception if the SessionCookie references a reserved ApplicationModule.

Specified by:
destroy in interface SessionCookie

timeout

public void timeout()
Internal use only.


removeFromPool

protected void removeFromPool()

releaseApplicationModule

public void releaseApplicationModule(boolean checkin,
                                     boolean manageState)
The default implementation will release the session cookie lock after having checked in the session application module. At this point any other waiting session threads may be notified.

Specified by:
releaseApplicationModule in interface ApplicationModuleRef
Specified by:
releaseApplicationModule in interface SessionCookie
Parameters:
checkin - SHARED or UNSHARED
manageState - manage the session application state between requests


releaseApplicationModule

public 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. At this point any other waiting session threads may be notified.

Specified by:
releaseApplicationModule in interface ApplicationModuleRef
Specified by:
releaseApplicationModule in interface SessionCookie
Parameters:
checkin - SHARED or UNSHARED
manageState - STATE_MANAGED or STATE_UNMANAGED
waitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lock


releaseApplicationModule

public void releaseApplicationModule(int releaseFlags)
Description copied from interface: SessionCookie
Release an application module for reuse.

This 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 ApplicationModuleRef.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.

Specified by:
releaseApplicationModule in interface SessionCookie
Parameters:
releaseFlags - 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


releaseApplicationModule

public void releaseApplicationModule(int releaseFlags,
                                     long waitTimeout)
Description copied from interface: SessionCookie
Release an application module for reuse.

This 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 ApplicationModuleRef.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.

Specified by:
releaseApplicationModule in interface SessionCookie
Parameters:
releaseFlags - 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
waitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lock


beforeApplicationModuleRelease

protected void beforeApplicationModuleRelease(ApplicationModule am)

afterApplicationModuleRelease

protected void afterApplicationModuleRelease()

writeValue

public void writeValue(java.lang.Object sink)
Description copied from interface: SessionCookie
Write the cookie value to the specified data sink.

Specified by:
writeValue in interface SessionCookie
Parameters:
sink - a data sink

writeValue

public void writeValue(java.lang.Object sink,
                       java.lang.String value)
Description copied from interface: SessionCookie
Write the specified cookie value to the specified data sink.

Specified by:
writeValue in interface SessionCookie
Parameters:
sink - a data sink

readValue

public java.lang.String readValue(java.lang.Object source)
Description copied from interface: SessionCookie
Read the cookie value to the specified data sink.

Specified by:
readValue in interface SessionCookie
Parameters:
source - a data source

getSyncLock

public final java.lang.Object getSyncLock()
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Applications should not use this method.

Specified by:
getSyncLock in interface SessionCookie

isActivationRequired

public boolean isActivationRequired()
Description copied from interface: SessionCookie
Indicates that state activation is required upon the next checkout for this session. INTERNAL USE ONLY. Applications should not use this method.

Specified by:
isActivationRequired in interface SessionCookie

isActivationRequired

public boolean isActivationRequired(ApplicationModule context)
Description copied from interface: SessionCookie
Indicates that state activation is required upon the next checkout for this session. The application module is passed to provide some context for the activation check. For example, an advanced developer could store some additional properties on the ApplicationModule to indicate whether or not it is necessary to activate that ApplicationModule.

The 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.

Specified by:
isActivationRequired in interface SessionCookie

setActivationRequired

public void setActivationRequired(boolean activationRequired)
Description copied from interface: SessionCookie
May be used to force activation upon the next checkout for this session. INTERNAL USE ONLY. Applications should not use this method.

Specified by:
setActivationRequired in interface SessionCookie

getPassivationId

public int getPassivationId()
Description copied from interface: SessionCookie
Return an identifier for the last persisted session application state. The passivation id should may used to activate a previous application state.

Specified by:
getPassivationId in interface SessionCookie

setPassivationId

public void setPassivationId(int passivationId)
Description copied from interface: SessionCookie
Sets the identifier for the last persisted session application state.

Specified by:
setPassivationId in interface SessionCookie

getMostRecentStackId

public int getMostRecentStackId()
Description copied from interface: SessionCookie
If the current thread holds an active ApplicationModule reference then this method will delegate to ApplicationModule.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:

  1. SessionCookie.reservePassivationId() is invoked.
  2. An ApplicationModule is released by this SessionCookie.
  3. 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.

Specified by:
getMostRecentStackId in interface SessionCookie

setMostRecentStackId

public void setMostRecentStackId(int mostRecentStackId)
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Applications should not use this method.

This method is used by the pooling framework to set the local most recent stack id.

Specified by:
setMostRecentStackId in interface SessionCookie
See Also:
SessionCookie.getMostRecentStackId()

passivateState

public void passivateState(java.lang.Object sink)
Description copied from interface: SessionCookie
Passivates the session ApplicationModule state.

If 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.

Specified by:
passivateState in interface SessionCookie

reservePassivationId

public void reservePassivationId()
Description copied from interface: SessionCookie
Reserves a unique identifier for the session application. The identifier will be used to persist the session application state if session state management has been enabled.

A passivation id should not be reserved if one has already been reserved or if failover is disabled.

Specified by:
reservePassivationId in interface SessionCookie
See Also:
SessionCookie.getReservedPassivationId()

reservePassivationId

public void reservePassivationId(java.lang.Object sink)
Description copied from interface: SessionCookie
Reserves a unique identifier for the session application. The identifier will be used to persist the session application state if session state management has been enabled.

If 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.

Specified by:
reservePassivationId in interface SessionCookie
See Also:
SessionCookie.getReservedPassivationId()

getReservedPassivationId

public int getReservedPassivationId()
Description copied from interface: SessionCookie
Return the identifier that will be used to persist the session application state at the end of the request.

The next passivation id should be used when generating the session cookie value.

Specified by:
getReservedPassivationId in interface SessionCookie

setReservedPassivationId

public void setReservedPassivationId(int reservedPassivationId)
Description copied from interface: SessionCookie
Set the identifier that will be used to persist the session application state.

Specified by:
setReservedPassivationId in interface SessionCookie

getUserData

public java.util.Hashtable getUserData()
Description copied from interface: ApplicationModuleHandle
Returns a java.util.Hashtable which may be used to store user specific context that is related to this application session.

Specified by:
getUserData in interface ApplicationModuleHandle

getSSOUserName

public java.lang.String getSSOUserName()
Specified by:
getSSOUserName in interface SessionCookie

getSSOSubscriber

public java.lang.String getSSOSubscriber()
Specified by:
getSSOSubscriber in interface SessionCookie

resetState

public void resetState()
Description copied from interface: ApplicationModuleRef
Reset the ApplicationModule state associated with this ApplicationModuleRef.

Invoking 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.

Specified by:
resetState in interface ApplicationModuleRef

resetStateInternal

public void resetStateInternal()
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Applications should not use this method.

Specified by:
resetStateInternal in interface SessionCookie

copyInto

public void copyInto(SessionCookie cookie)
Description copied from interface: SessionCookie
Copies the state of this cookie into the target cookie.

Specified by:
copyInto in interface SessionCookie
Parameters:
cookie - the target of the copy.

isFailoverEnabled

public boolean isFailoverEnabled()
Description copied from interface: SessionCookie
Indicates that session application module state should be persisted to secondary storage immediately upon a managed release.

Session cookie developers should be careful that this value not change after a session cookie has become active.

Specified by:
isFailoverEnabled in interface SessionCookie

isWriteCookieValue

public boolean isWriteCookieValue()
Description copied from interface: SessionCookie
Indicates that the cookie passivation id should be written to the client. Applicable for HTTP usages only. By default, the cookie passivation id will be encoded in an HTTP request cookie.

Defaults to false.

Specified by:
isWriteCookieValue in interface SessionCookie

isConnectionPoolingEnabled

public boolean isConnectionPoolingEnabled()
Description copied from interface: SessionCookie
Indicates that the session application module resource's JDBC connection should be released immediately upon release to the application pool.

Session cookie developers should be careful that this value not change after a session cookie has become active.

Specified by:
isConnectionPoolingEnabled in interface SessionCookie

isResetNonTransactionalState

public boolean isResetNonTransactionalState()
Description copied from interface: SessionCookie
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.

Transactional 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.

Specified by:
isResetNonTransactionalState in interface SessionCookie

getProperty

public boolean getProperty(java.lang.String name,
                           boolean defaultValue)

getProperty

protected boolean getProperty(java.lang.String name,
                              java.util.Hashtable environment,
                              boolean defaultValue)

setSessionCookieListener

public void setSessionCookieListener(SessionCookieListener listener)
Description copied from interface: SessionCookie
Set a session cookie listener on the cookie. INTERNAL USE ONLY. Applications should not use this method.

Specified by:
setSessionCookieListener in interface SessionCookie

parseSessionId

public static java.lang.String parseSessionId(java.lang.String cookieValue)

parsePassivationId

public static int parsePassivationId(java.lang.String cookieValue)

getThreadRefCount

public final int getThreadRefCount()
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Applications should not use this method.

Specified by:
getThreadRefCount in interface SessionCookie

setSingleThreaded

public void setSingleThreaded(boolean isSingleThreaded)
Description copied from interface: SessionCookie
Advanced Use Only:

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 oracle.jbo.http.HttpSessionCookieImpl instances is false.

Specified by:
setSingleThreaded in interface SessionCookie

setReferenceCounting

public void setReferenceCounting(boolean isReferenceCounting)
Description copied from interface: SessionCookie
Advanced Use Only: By default a SessionCookie may invoke ApplicationModuleRef.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.

Specified by:
setReferenceCounting in interface SessionCookie

setUserData

public void setUserData(java.lang.Object name,
                        java.lang.Object value)
Description copied from interface: SessionCookie
Puts user data in the SessionCookie user data map. The user data is associated with the specified key.

SessionCookie user data is automatically synched with the ApplicationModule upon ApplicationModule use.

Specified by:
setUserData in interface SessionCookie

getUserData

public java.lang.Object getUserData(java.lang.Object name)
Description copied from interface: SessionCookie
Acquires the user data associated with the specified key from the SessionCookie user data map.

Specified by:
getUserData in interface SessionCookie

removeUserData

public java.lang.Object removeUserData(java.lang.Object name)
Description copied from interface: SessionCookie
Removes the user data associated with the specified key from the SessionCookie user data map.

Specified by:
removeUserData in interface SessionCookie

wasActivated

public boolean wasActivated()
Description copied from interface: SessionCookie
INTERANL USE ONLY. Used by BC4J to perform special handling if it detects that a pool request required activation.

Specified by:
wasActivated in interface SessionCookie

setActivated

public void setActivated(boolean activated)
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Used by BC4J to perform special handling if it detects that a pool request required activation.

Specified by:
setActivated in interface SessionCookie

getIgnorePiggyback

public boolean getIgnorePiggyback()
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Used by BC4J to ignore piggyback messages for doPoolMessages processed on behalf of this cookie by the ApplicationPool. Used by the WSApplicationModule to prevent unnecessary state reset due to loss of affinity. ApplicationModule associations.

Specified by:
getIgnorePiggyback in interface SessionCookie

setIgnorePiggyback

public void setIgnorePiggyback(boolean ignorePiggyback)
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Used by BC4J to ignore piggyback messages for doPoolMessages processed on behalf of this cookie by the ApplicationPool. Used by the WSApplicationModule to prevent unnecessary state reset due to loss of affinity. ApplicationModule associations.

Specified by:
setIgnorePiggyback in interface SessionCookie

getMessageContext

public ApplicationPoolSvcMsgContext getMessageContext()
Description copied from interface: SessionCookie
Returns the current message context for this cookie. A message context represents a batch request from the ApplicationPool for this SessionCookie. The message context may be null if no request is currently active for this SessionCookie.

The request represented by this message context should not be confused with the user request. The pool request represents a request from the pool to be performed by a request handler upon the poolable resource. There may be many pool requests issued during a single user request. For example, two pool requests will be required to acquire and release an ApplicationModule.

An application may access the message context during request processing in order to acquire more information about the pool request. For example, the DefaultConnectionStrategy uses the ApplicationPoolSvcMsgContext to acquire the user credentials that are to be used for connect.

Specified by:
getMessageContext in interface SessionCookie

setMessageContext

public void setMessageContext(ApplicationPoolSvcMsgContext messageContext)
Description copied from interface: SessionCookie
INTERNAL USE ONLY.

Specified by:
setMessageContext in interface SessionCookie

getInfoObject

public java.lang.Object getInfoObject()
Description copied from interface: SessionCookie
INTERNAL USE ONLY. Return the info structure that is used by the ApplicationPool to maintain additional information about this SessionCookie.

Specified by:
getInfoObject in interface SessionCookie

setInfoObject

public void setInfoObject(java.lang.Object infoObject)
Description copied from interface: SessionCookie
INTERNAL USE ONLY. See SessionCookie.getInfoObject().

Specified by:
setInfoObject in interface SessionCookie

getApplicationPool

protected final ApplicationPool getApplicationPool()

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

Copyright © 1997, 2010, Oracle. All rights reserved.