Oracle® Content Services Web Services Java API Reference
10g Release 1 (10.1.1)

B19047-01


oracle.ifs.fdk
Class FdkSession

java.lang.Object
  extended byoracle.ifs.fdk.FdkSession

All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, oracle.ifs.common.logging.LogInfo

public abstract class FdkSession
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener, oracle.ifs.common.logging.LogInfo

Represents an authenticated user session.


Field Summary
protected java.lang.Thread m_CurrentRequestThread

Constructor Summary
FdkSession()

Method Summary
void beginRequest()
Notifies the session that a new request has begun.
abstract boolean endRequest()
Notifies the session that the request has ended.
static FdkSession getCurrentSession()
Returns the current session for the ongoing request, or null if no session is available or cannot be determined.
abstract java.lang.String getDistinguishedName()
Returned the distinguished name for the authenticated user.
abstract long getId()
Returns this session identifier.
abstract long getLastAccessTime()
Returns the time when the last request was completed by calling endRequest() on the current session.
abstract long getSessionTimeout()
Returns the session timeout, in seconds, for this session.
abstract java.lang.Object getState(java.lang.Object key)
Returns the value stored at the given key using setState().
abstract java.lang.String getUsername()
Returns the username for the authenticated user.
abstract boolean isConnected()
Returns true if this session is connected.
abstract boolean isGuest()
Returns true if the session is a guest/anonymous session.
abstract boolean isRequestInProgress()
Returns true if there is a request being serviced by this session.
abstract void registerForEvents(FdkSessionListener listener)
Registers a listener for events that may occur on this session.
protected void requestCleanup()
Request cleanup.
abstract void setLastAccessTimeUpdate(boolean update)
Sets whether the last access time will be updated when endRequest() is called on the current session.
abstract void setSessionTimeout(long timeout)
Sets the automatic session timeout for inactivity.
abstract void setState(java.lang.Object key, java.lang.Object value)
Sets a value representing a piece of state that makes sense to the application.
abstract boolean unregisterForEvents(FdkSessionListener listener)
Unregisters a previously registered listener.
abstract boolean verifyCredential(oracle.ifs.common.Credential credential)
Verifies that the given credential is valid for the user represented by this session.

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface javax.servlet.http.HttpSessionBindingListener
valueBound, valueUnbound

Methods inherited from interface oracle.ifs.common.logging.LogInfo
getSessionIdentifier, getUserIdentifier

Field Detail

m_CurrentRequestThread

protected java.lang.Thread m_CurrentRequestThread

Constructor Detail

FdkSession

public FdkSession()

Method Detail

beginRequest

public void beginRequest()
                  throws FdkException
Notifies the session that a new request has begun. The current thread becomes the owner of this session. endRequest() must be called from the same thread.
Throws:
FdkException

endRequest

public abstract boolean endRequest()
                            throws FdkException
Notifies the session that the request has ended. Returns false if there were no outstanding requests on the session or the current thread did not own the session. The caller may interpret it as an error or just ignore it, depending on its implementation.
Throws:
FdkException

getCurrentSession

public static FdkSession getCurrentSession()
Returns the current session for the ongoing request, or null if no session is available or cannot be determined. The current session is determined based on the calling thread. This call works only for callers that run in the request thread, not for child threads.

getDistinguishedName

public abstract java.lang.String getDistinguishedName()
Returned the distinguished name for the authenticated user. For OID users this is equivalent to the OID GUID. It is recommended that implementations cache the value so that a call to this method will not block if for example the underlying session is busy.

getId

public abstract long getId()
Returns this session identifier. The identifier is not persisted, it is unique in the context of a Java Virtual Machine and it may be the same between different runs of the software.

getLastAccessTime

public abstract long getLastAccessTime()
Returns the time when the last request was completed by calling endRequest() on the current session. The time format is the same as System.currentTimeMillis().

getSessionTimeout

public abstract long getSessionTimeout()
Returns the session timeout, in seconds, for this session. A zero return value means the session does not time out.

getState

public abstract java.lang.Object getState(java.lang.Object key)
                                   throws FdkException
Returns the value stored at the given key using setState(). See the documentation of setState().
Parameters:
key - The key to retrieve the value for.
Throws:
FdkException

getUsername

public abstract java.lang.String getUsername()
Returns the username for the authenticated user. It is recommended that implementations cache the value so that a call to this method will not block if for example the underlying session is busy.

isConnected

public abstract boolean isConnected()
Returns true if this session is connected.

isGuest

public abstract boolean isGuest()
Returns true if the session is a guest/anonymous session.

isRequestInProgress

public abstract boolean isRequestInProgress()
Returns true if there is a request being serviced by this session. See beginRequest() and endRequest()

registerForEvents

public abstract void registerForEvents(FdkSessionListener listener)
Registers a listener for events that may occur on this session. The listener must implement the FdkSessionListener interface.
Parameters:
listener - The listener to register. It must imlpement the FdkSessionListener interface.

requestCleanup

protected void requestCleanup()
Request cleanup.

setLastAccessTimeUpdate

public abstract void setLastAccessTimeUpdate(boolean update)
Sets whether the last access time will be updated when endRequest() is called on the current session. This is useful behavior for requests that are not sent by the true end-user but rather by a polling process for example.

Note that the behavior is changed on a per request basis, the default behavior if the method is not called during a request is to always update the last access time and the behavior is reset to the default when a request is completed by calling endRequest().

Parameters:
update - If false the last access time will not be updated, otherwise it will be updated.

setSessionTimeout

public abstract void setSessionTimeout(long timeout)
Sets the automatic session timeout for inactivity. A session that has a timeout greater than zero will automatically be disconnected if there is no activity for the specified number of seconds.

In addition, if the timeout is greater than zero, the session will not be disconnected when it gets the unbind even from the HttpSession, as it is assumed it is being managed by a different entity.

Parameters:
timeout - Number of seconds to set the timeout to.

setState

public abstract void setState(java.lang.Object key,
                              java.lang.Object value)
                       throws FdkException
Sets a value representing a piece of state that makes sense to the application. The value can be retrieved using getState().

It is recommended that applications store only one object as their state. The object can be a Map that contains other pieces of state.

Parameters:
key - The key that identifies the piece of state. The namespace for the key is not specified. It is recommended that a package-like key name be used in order to avoid potential conflicts.
value - The value to store at the given key. If null, the key will be removed.
Throws:
FdkException

unregisterForEvents

public abstract boolean unregisterForEvents(FdkSessionListener listener)
Unregisters a previously registered listener. If the listener instance is not found, false is returned.
Parameters:
listener - The listener to register. It must imlpement the FdkSessionListener interface.

verifyCredential

public abstract boolean verifyCredential(oracle.ifs.common.Credential credential)
                                  throws FdkException
Verifies that the given credential is valid for the user represented by this session. Returns true if the credential is valid or false otherwise. The method can also throw a FdkException if errors occur during the verification process.
Parameters:
credential - The credential to verify.
Throws:
FdkException

Oracle® Content Services Web Services Java API Reference
10g Release 1 (10.1.1)

B19047-01


Copyright © 2002, 2005, Oracle. All rights reserved.